Hi,
I want to use a DS18B20 temp sensor on my dragonboard through a bidirectional level shifter (1.8V low/5V high with the 4.7k pullup resistor on the high side for the data pin of the sensor). It uses the one-wire protocol and I see there is a kernel driver for enabling one wire on a gpio pin but I am not sure how to go about making it work. I’ve enabled the w1-gpio and w1-therm drivers but I don’t know how to enable it for a pin.
I’ve recompiled my kernel with these config options:
CONFIG_W1_MASTER_GPIO=y
CONFIG_W1=y
CONFIG_W1_SLAVE_THERM=y
and I see the directory under /sys/bus/w1on my device.
I think I need to modify a DTS to make a pin compatible with the driver (am very new to this).
The documentation says I need to add something like:
onewire@0 {
compatible = “w1-gpio”;
gpios = <&gpio 126 0>, <&gpio 105 0>;
};
but am not sure of:
- which dts to add it to (assuming arch/arm/boot/dts/qcom/apq8016-sbc.dtsi or arch/arm/boot/dts/qcom/msm8916-pinctrl.dtsi)
- which pin is okay to add this to (assuming unreserved gpio pins)
- if I have to disable some previous definition
- what the gpio address are of the pins etc. (I’ve looked through many qcom pdf files but nothing is popping out at me)
I’m pretty new to a lot of this stuff so it’d be really appreciative of an in depth explanation of what to do and why.
Thanks!