TRay Posted May 17, 2024 Posted May 17, 2024 (edited) Hi, I managed to make w1-GPIO work in Orange Pi Zero v3 for, for example, the DS18B20 sensor. However, I have some doubts about setting the GPIO flags for w1-gpio. Many examples provide flags in the form gpios = <&pio 0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; but in the dts file when I use this form it does not work (syntax error) so I have to provide the flags in digital form. A description of flags and bits is here https://elixir.bootlin.com/linux/v6.6.30/source/include/dt-bindings/gpio/gpio.h If I would like to set GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN then the digital value for these bits will be for set bits: 0110000 = 48 because GPIO_OPEN_DRAIN it is (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN) Please help me and confirm whether I understood it correctly I wanted to get rid of the message in the logs for w1-gpio [ 4.994183] gpio-74 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file which understands that I need to set the GPIO flag GPIO_OPEN_DRAIN in the dts file I see one problem with this source https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt where a number of bits to set is 6 in source https://elixir.bootlin.com/linux/v6.6.30/source/include/dt-bindings/gpio/gpio.h number of bits to set is 7 I hope I posted this question in the right section, if not please move it Edited May 17, 2024 by TRay 0 Quote
TRay Posted May 17, 2024 Author Posted May 17, 2024 (edited) Reading many others documents about OPEN DRAIN flag , OZPI v3 and others like Raspberry Pi don't support Open DRAIN, but they should work in emulated mode, switching between input and output-driving-low. So for this reason if we set flag for GPIO with OPEN DARIN it looks not influence and not need setting this flag for w1-gpio for this SBC Edited May 17, 2024 by TRay 0 Quote
firepower Posted Monday at 09:33 AM Posted Monday at 09:33 AM /* Bit 0 express polarity */ #define GPIO_ACTIVE_HIGH 0 #define GPIO_ACTIVE_LOW 1 /* Bit 1 express single-endedness */ #define GPIO_PUSH_PULL 0 #define GPIO_SINGLE_ENDED 2 /* Bit 2 express Open drain or open source */ #define GPIO_LINE_OPEN_SOURCE 0 #define GPIO_LINE_OPEN_DRAIN 4 /* * Open Drain/Collector is the combination of single-ended open drain interface. * Open Source/Emitter is the combination of single-ended open source interface. */ #define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN) #define GPIO_OPEN_SOURCE (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_SOURCE) /* Bit 3 express GPIO suspend/resume and reset persistence */ #define GPIO_PERSISTENT 0 #define GPIO_TRANSITORY 8 when combining add the bits #define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN) is 2+4= 6 gpios = <&pio 0 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; or gpios = <&pio 0 7 4>; 0 Quote
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.