João Paulo Bodanese Posted July 11, 2023 Share Posted July 11, 2023 Hi, I need set the PC1 pin as output on a device driver using the new gpiod_export() method. What argument should i pass on the gpiod_get function? struct gpio_desc *gpio; gpio = gpiod_get(NULL, "PC1", GPIOD_OUT_HIGH); if (IS_ERR(gpio)) { printk("Failed to get GPIO: \n"); return PTR_ERR(gpio); } // Export the GPIO ret = gpiod_export(gpio, false); if (ret) { pr_err("Failed to export GPIO: %d\n", ret); return ret; } // Set the direction of the GPIO ret = gpiod_direction_output(gpio, 1); if (ret) { pr_err("Failed to set GPIO direction: %d\n", ret); return ret; } Armbian 23.8 Best regards 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.