* [PATCH 0/3] Minor device-tree additions for C.H.I.P @ 2023-04-15 17:45 Jonathan McDowell 2023-04-15 17:46 ` [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell ` (3 more replies) 0 siblings, 4 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-04-15 17:45 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel This small patch series adds some improvements for the C.H.I.P DTS, enabling bluetooth, exporting the PMIC temperature details via iio-hwmon and finally adding the appropriate base pinmux info for an external MMC card. Jonathan McDowell (3): ARM: dts: sun5i: chip: Enable bluetooth ARM: dts: sun5i: Add port E pinmux settings for mmc2 ARM: dts: axp209: Add iio-hwmon node for internal temperature arch/arm/boot/dts/axp209.dtsi | 7 +++++++ arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ arch/arm/boot/dts/sun5i.dtsi | 8 ++++++++ 3 files changed, 19 insertions(+) -- 2.39.2 ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-15 17:45 [PATCH 0/3] Minor device-tree additions for C.H.I.P Jonathan McDowell @ 2023-04-15 17:46 ` Jonathan McDowell 2023-04-15 20:36 ` kernel test robot 2023-04-16 0:24 ` Andre Przywara 2023-04-15 17:46 ` [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell ` (2 subsequent siblings) 3 siblings, 2 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-04-15 17:46 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked up on UART3. Support for this didn't exist in mainline when the DTS was initially added, but it does now, so enable it. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts index fd37bd1f3920..4d72a181d8aa 100644 --- a/arch/arm/boot/dts/sun5i-r8-chip.dts +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts @@ -255,6 +255,10 @@ &uart3 { pinctrl-0 = <&uart3_pg_pins>, <&uart3_cts_rts_pg_pins>; status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + } }; &usb_otg { -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-15 17:46 ` [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell @ 2023-04-15 20:36 ` kernel test robot 2023-04-16 0:24 ` Andre Przywara 1 sibling, 0 replies; 44+ messages in thread From: kernel test robot @ 2023-04-15 20:36 UTC (permalink / raw) To: Jonathan McDowell, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland Cc: oe-kbuild-all, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel Hi Jonathan, kernel test robot noticed the following build errors: [auto build test ERROR on sunxi/sunxi/for-next] [also build test ERROR on robh/for-next krzk/for-next krzk-dt/for-next krzk-mem-ctrl/for-next linus/master v6.3-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-McDowell/ARM-dts-sun5i-chip-Enable-bluetooth/20230416-014856 base: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git sunxi/for-next patch link: https://lore.kernel.org/r/f26d11e613df7bd55822ff3fb7689e36bf9e4f7a.1681580558.git.noodles%40earth.li patch subject: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth config: arm-defconfig (https://download.01.org/0day-ci/archive/20230416/202304160423.TaGIRb5X-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/7eb91ccc0e287519d5df2e97e81c3bee553e3535 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jonathan-McDowell/ARM-dts-sun5i-chip-Enable-bluetooth/20230416-014856 git checkout 7eb91ccc0e287519d5df2e97e81c3bee553e3535 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202304160423.TaGIRb5X-lkp@intel.com/ All errors (new ones prefixed by >>): >> Error: arch/arm/boot/dts/sun5i-r8-chip.dts:262.1-2 syntax error FATAL ERROR: Unable to parse input tree -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-15 17:46 ` [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell 2023-04-15 20:36 ` kernel test robot @ 2023-04-16 0:24 ` Andre Przywara 2023-04-20 19:12 ` Jonathan McDowell 1 sibling, 1 reply; 44+ messages in thread From: Andre Przywara @ 2023-04-16 0:24 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Sat, 15 Apr 2023 18:46:03 +0100 Jonathan McDowell <noodles@earth.li> wrote: > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > up on UART3. Support for this didn't exist in mainline when the DTS was > initially added, but it does now, so enable it. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > --- > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > index fd37bd1f3920..4d72a181d8aa 100644 > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > @@ -255,6 +255,10 @@ &uart3 { > pinctrl-0 = <&uart3_pg_pins>, > <&uart3_cts_rts_pg_pins>; > status = "okay"; > + > + bluetooth { > + compatible = "realtek,rtl8723bs-bt"; > + } As the kernel test robot already pointed out, there is a semicolon missing here. Otherwise looks good (dt-validate passes), but don't know if there are any wakeup GPIOs connected (can't seem to find a schematic?). Cheers, Andre > }; > > &usb_otg { ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-16 0:24 ` Andre Przywara @ 2023-04-20 19:12 ` Jonathan McDowell 2023-04-21 1:43 ` Saravana Kannan 0 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-04-20 19:12 UTC (permalink / raw) To: Andre Przywara, Saravana Kannan, Greg Kroah-Hartman Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > On Sat, 15 Apr 2023 18:46:03 +0100 > Jonathan McDowell <noodles@earth.li> wrote: > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > up on UART3. Support for this didn't exist in mainline when the DTS was > > initially added, but it does now, so enable it. > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > --- > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > index fd37bd1f3920..4d72a181d8aa 100644 > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > @@ -255,6 +255,10 @@ &uart3 { > > pinctrl-0 = <&uart3_pg_pins>, > > <&uart3_cts_rts_pg_pins>; > > status = "okay"; > > + > > + bluetooth { > > + compatible = "realtek,rtl8723bs-bt"; > > + } > > As the kernel test robot already pointed out, there is a semicolon > missing here. > Otherwise looks good (dt-validate passes), but don't know if there are > any wakeup GPIOs connected (can't seem to find a schematic?). So there are wakeups, but if I add: device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ then some odd sort of dependency issue happens where the serial port load is deferred waiting for the GPIO to appear, and then the device doesn't work. Error in dmesg is: serial serial0-0: deferred probe pending on 6.3-rc and on 6.1 I get: dw-apb-uart 1c28c00.serial: Failed to create device link (0x180) with axp20x-gpio I'm not clear why it's trying to link the serial port to the GPIO; it seems that it should be the bluetooth device that depends on both the UART and the GPIO, and that the GPIO is actually optional so shouldn't hold up loading, but I can't see how that should be represented. Adding Greg + Saravana in the hope they can tell me what I've done wrong here. The LED driver using a different GPIO line on the axp209 works fine, so the device is definitely loaded and working ok. > > }; > > > > &usb_otg { > J. -- Sex, truth and jellibabies. | .''`. Debian GNU/Linux Developer | : :' : Happy to accept PGP signed | `. `' or encrypted mail - RSA | `- key on the keyservers. ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-20 19:12 ` Jonathan McDowell @ 2023-04-21 1:43 ` Saravana Kannan 2023-04-21 8:28 ` Jonathan McDowell 0 siblings, 1 reply; 44+ messages in thread From: Saravana Kannan @ 2023-04-21 1:43 UTC (permalink / raw) To: Jonathan McDowell Cc: Andre Przywara, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Thu, Apr 20, 2023 at 12:12 PM Jonathan McDowell <noodles@earth.li> wrote: > > On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > > On Sat, 15 Apr 2023 18:46:03 +0100 > > Jonathan McDowell <noodles@earth.li> wrote: > > > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > > up on UART3. Support for this didn't exist in mainline when the DTS was > > > initially added, but it does now, so enable it. > > > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > --- > > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > index fd37bd1f3920..4d72a181d8aa 100644 > > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > @@ -255,6 +255,10 @@ &uart3 { > > > pinctrl-0 = <&uart3_pg_pins>, > > > <&uart3_cts_rts_pg_pins>; > > > status = "okay"; > > > + > > > + bluetooth { > > > + compatible = "realtek,rtl8723bs-bt"; > > > + } > > > > As the kernel test robot already pointed out, there is a semicolon > > missing here. > > Otherwise looks good (dt-validate passes), but don't know if there are > > any wakeup GPIOs connected (can't seem to find a schematic?). > > So there are wakeups, but if I add: > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > then some odd sort of dependency issue happens where the serial port > load is deferred waiting for the GPIO to appear, and then the device > doesn't work. When you say your device doesn't work, are you saying it never probes? <debugfs>/devices_deferred should tell you what devices have deferred and why. > Error in dmesg is: > > serial serial0-0: deferred probe pending > > on 6.3-rc and on 6.1 I get: > > dw-apb-uart 1c28c00.serial: Failed to create device link (0x180) with axp20x-gpio This error message doesn't block anything. So I don't think this is the cause of your blocking issue. But I still want to understand why this error message is showing up. > I'm not clear why it's trying to link the serial port to the GPIO; it > seems that it should be the bluetooth device that depends on both the > UART and the GPIO, A fix for the device link error message went in on v6.3-rc3. Is that the 6.3 version you tested this on? Also, I tried looking into the UART driver (drivers/tty/serial/8250/8250_dw.c) but it wasn't clear how it ends up populating the bluetooth serial device. If you can point that out, that'd be helpful (assuming 6.3-rc3 still shows that error message). > and that the GPIO is actually optional so shouldn't > hold up loading, but I can't see how that should be represented. Optional dependencies should get ignored after the default deferred_probe_timeout runs out and the supplier driver hasn't been loaded yet. -Saravana > Adding Greg + Saravana in the hope they can tell me what I've done wrong > here. The LED driver using a different GPIO line on the axp209 works > fine, so the device is definitely loaded and working ok. ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-21 1:43 ` Saravana Kannan @ 2023-04-21 8:28 ` Jonathan McDowell 2023-04-21 22:45 ` Saravana Kannan 0 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-04-21 8:28 UTC (permalink / raw) To: Saravana Kannan Cc: Andre Przywara, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Thu, Apr 20, 2023 at 06:43:06PM -0700, Saravana Kannan wrote: > On Thu, Apr 20, 2023 at 12:12 PM Jonathan McDowell <noodles@earth.li> wrote: > > On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > > > On Sat, 15 Apr 2023 18:46:03 +0100 > > > Jonathan McDowell <noodles@earth.li> wrote: > > > > > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > > > up on UART3. Support for this didn't exist in mainline when the DTS was > > > > initially added, but it does now, so enable it. > > > > > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > > --- > > > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > > > 1 file changed, 4 insertions(+) > > > > > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > index fd37bd1f3920..4d72a181d8aa 100644 > > > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > @@ -255,6 +255,10 @@ &uart3 { > > > > pinctrl-0 = <&uart3_pg_pins>, > > > > <&uart3_cts_rts_pg_pins>; > > > > status = "okay"; > > > > + > > > > + bluetooth { > > > > + compatible = "realtek,rtl8723bs-bt"; > > > > + } > > > > > > As the kernel test robot already pointed out, there is a semicolon > > > missing here. > > > Otherwise looks good (dt-validate passes), but don't know if there are > > > any wakeup GPIOs connected (can't seem to find a schematic?). > > > > So there are wakeups, but if I add: > > > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > > > then some odd sort of dependency issue happens where the serial port > > load is deferred waiting for the GPIO to appear, and then the device > > doesn't work. > > When you say your device doesn't work, are you saying it never probes? The bluetooth device (realtek,rtl8723bs-bt) never appears, apparently because the UART it's attached to never loads - it doesn't even try to load the firmware. > <debugfs>/devices_deferred should tell you what devices have deferred and why. root@chip:~# cat /sys/kernel/debug/devices_deferred serial0-0 > > Error in dmesg is: > > > > serial serial0-0: deferred probe pending > > > > on 6.3-rc and on 6.1 I get: > > > > dw-apb-uart 1c28c00.serial: Failed to create device link (0x180) with axp20x-gpio > > This error message doesn't block anything. So I don't think this is > the cause of your blocking issue. But I still want to understand why > this error message is showing up. > > > I'm not clear why it's trying to link the serial port to the GPIO; it > > seems that it should be the bluetooth device that depends on both the > > UART and the GPIO, > > A fix for the device link error message went in on v6.3-rc3. Is that > the 6.3 version you tested this on? I originally tried on 6.1.21, which is where I got the "Failed to create device link" message. I then moved to 6.3-rc7 as I saw there had been further changes recently. There I just get the: serial serial0-0: deferred probe pending message. > Also, I tried looking into the UART driver > (drivers/tty/serial/8250/8250_dw.c) but it wasn't clear how it ends up > populating the bluetooth serial device. If you can point that out, > that'd be helpful (assuming 6.3-rc3 still shows that error message). I have the following in my device tree: &uart3 { pinctrl-names = "default"; pinctrl-0 = <&uart3_pg_pins>, <&uart3_cts_rts_pg_pins>; status = "okay"; bluetooth { compatible = "realtek,rtl8723bs-bt"; device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ }; }; uart3 is a snps,dw-apb-uart, defined in arch/arm/boot/dts/sun5i.dtsi The UART and AXP209 device drivers are compiled into the kernel: CONFIG_PINCTRL_AXP209=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_DW=y The bluetooth bits are modules (btrtl, hci_uart). If I remove the device-wake-gpios line then the Bluetooth device works fine, and /sys/kernel/debug/devices_deferred is empty. Somehow it seems like the GPIO is being parsed as a dependency for the serial port, even though the serial port + GPIO are both dependencies for the bluetooth device. Even with that, given both are built-in I don't understand why the serial port never completes setup. > > and that the GPIO is actually optional so shouldn't > > hold up loading, but I can't see how that should be represented. > > Optional dependencies should get ignored after the default > deferred_probe_timeout runs out and the supplier driver hasn't been > loaded yet. When I say it's optional I mean if it's not listed everything works fine, but I don't believe there's anyway to express that in the DTS. It's certainly not required for the serial port, just the bluetooth device. J. -- Web [ Don't be a stranger. ] site: https:// [ ] Made by www.earth.li/~noodles/ [ ] HuggieTag 0.0.24 ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-21 8:28 ` Jonathan McDowell @ 2023-04-21 22:45 ` Saravana Kannan 2023-04-24 17:34 ` Jonathan McDowell 0 siblings, 1 reply; 44+ messages in thread From: Saravana Kannan @ 2023-04-21 22:45 UTC (permalink / raw) To: Jonathan McDowell Cc: Andre Przywara, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Fri, Apr 21, 2023 at 1:28 AM Jonathan McDowell <noodles@earth.li> wrote: > > On Thu, Apr 20, 2023 at 06:43:06PM -0700, Saravana Kannan wrote: > > On Thu, Apr 20, 2023 at 12:12 PM Jonathan McDowell <noodles@earth.li> wrote: > > > On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > > > > On Sat, 15 Apr 2023 18:46:03 +0100 > > > > Jonathan McDowell <noodles@earth.li> wrote: > > > > > > > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > > > > up on UART3. Support for this didn't exist in mainline when the DTS was > > > > > initially added, but it does now, so enable it. > > > > > > > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > > > --- > > > > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > > > > 1 file changed, 4 insertions(+) > > > > > > > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > index fd37bd1f3920..4d72a181d8aa 100644 > > > > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > @@ -255,6 +255,10 @@ &uart3 { > > > > > pinctrl-0 = <&uart3_pg_pins>, > > > > > <&uart3_cts_rts_pg_pins>; > > > > > status = "okay"; > > > > > + > > > > > + bluetooth { > > > > > + compatible = "realtek,rtl8723bs-bt"; > > > > > + } > > > > > > > > As the kernel test robot already pointed out, there is a semicolon > > > > missing here. > > > > Otherwise looks good (dt-validate passes), but don't know if there are > > > > any wakeup GPIOs connected (can't seem to find a schematic?). > > > > > > So there are wakeups, but if I add: > > > > > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > > > > > then some odd sort of dependency issue happens where the serial port > > > load is deferred waiting for the GPIO to appear, and then the device > > > doesn't work. > > > > When you say your device doesn't work, are you saying it never probes? Read your whole email and it's a strange issue. Also, going forward to avoid confusion, only reply to questions with respect to 6.3-rc7. > The bluetooth device (realtek,rtl8723bs-bt) never appears, apparently > because the UART it's attached to never loads - it doesn't even try to > load the firmware. > > > <debugfs>/devices_deferred should tell you what devices have deferred and why. > > root@chip:~# cat /sys/kernel/debug/devices_deferred > serial0-0 Do you see this in 6.3-rc7 too? > > > Error in dmesg is: > > > > > > serial serial0-0: deferred probe pending > > > > > > on 6.3-rc and on 6.1 I get: > > > > > > dw-apb-uart 1c28c00.serial: Failed to create device link (0x180) with axp20x-gpio > > > > This error message doesn't block anything. So I don't think this is > > the cause of your blocking issue. But I still want to understand why > > this error message is showing up. > > > > > I'm not clear why it's trying to link the serial port to the GPIO; it > > > seems that it should be the bluetooth device that depends on both the > > > UART and the GPIO, > > > > A fix for the device link error message went in on v6.3-rc3. Is that > > the 6.3 version you tested this on? > > I originally tried on 6.1.21, which is where I got the "Failed to create > device link" message. I then moved to 6.3-rc7 as I saw there had been > further changes recently. There I just get the: > > serial serial0-0: deferred probe pending If the deferral is related to fw_devlink, you should see the reason for deferring in the devices_deferred file. So I don't think the issue is related to fw_devlink. > message. > > > Also, I tried looking into the UART driver > > (drivers/tty/serial/8250/8250_dw.c) but it wasn't clear how it ends up > > populating the bluetooth serial device. If you can point that out, > > that'd be helpful (assuming 6.3-rc3 still shows that error message). > > I have the following in my device tree: > > &uart3 { > pinctrl-names = "default"; > pinctrl-0 = <&uart3_pg_pins>, > <&uart3_cts_rts_pg_pins>; > status = "okay"; > > bluetooth { > compatible = "realtek,rtl8723bs-bt"; > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > }; > }; > > uart3 is a snps,dw-apb-uart, defined in arch/arm/boot/dts/sun5i.dtsi > > The UART and AXP209 device drivers are compiled into the kernel: > > CONFIG_PINCTRL_AXP209=y > CONFIG_SERIAL_8250=y > CONFIG_SERIAL_8250_DW=y > > The bluetooth bits are modules (btrtl, hci_uart). > > If I remove the device-wake-gpios line then the Bluetooth device works > fine, and /sys/kernel/debug/devices_deferred is empty. > > Somehow it seems like the GPIO is being parsed as a dependency for the > serial port, even though the serial port + GPIO are both dependencies > for the bluetooth device. I'm fairly sure that fw_devlink isn't causing that. Because even without bluetooth, fw_devlink doesn't consider any suppliers listed in child DT nodes as mandatory suppliers. That has been the case since the beginning. > Even with that, given both are built-in I > don't understand why the serial port never completes setup. My guess is that the driver itself has some bug that's sensitive to device probe order even though it shouldn't. Can you add #define DEBUG 1 to the top of drivers/base/core.c and share the boot log? I can try and help debug it. -Saravana > > > and that the GPIO is actually optional so shouldn't > > > hold up loading, but I can't see how that should be represented. > > > > Optional dependencies should get ignored after the default > > deferred_probe_timeout runs out and the supplier driver hasn't been > > loaded yet. > > When I say it's optional I mean if it's not listed everything works > fine, but I don't believe there's anyway to express that in the DTS. > It's certainly not required for the serial port, just the bluetooth > device. > > J. > > -- > Web [ Don't be a stranger. ] > site: https:// [ ] Made by > www.earth.li/~noodles/ [ ] HuggieTag 0.0.24 ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-21 22:45 ` Saravana Kannan @ 2023-04-24 17:34 ` Jonathan McDowell 2023-05-01 21:12 ` Saravana Kannan 0 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-04-24 17:34 UTC (permalink / raw) To: Saravana Kannan Cc: Andre Przywara, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Fri, Apr 21, 2023 at 03:45:52PM -0700, Saravana Kannan wrote: > On Fri, Apr 21, 2023 at 1:28 AM Jonathan McDowell <noodles@earth.li> wrote: > > > > On Thu, Apr 20, 2023 at 06:43:06PM -0700, Saravana Kannan wrote: > > > On Thu, Apr 20, 2023 at 12:12 PM Jonathan McDowell <noodles@earth.li> wrote: > > > > On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > > > > > On Sat, 15 Apr 2023 18:46:03 +0100 > > > > > Jonathan McDowell <noodles@earth.li> wrote: > > > > > > > > > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > > > > > up on UART3. Support for this didn't exist in mainline when the DTS was > > > > > > initially added, but it does now, so enable it. > > > > > > > > > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > > > > --- > > > > > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > > > > > 1 file changed, 4 insertions(+) > > > > > > > > > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > index fd37bd1f3920..4d72a181d8aa 100644 > > > > > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > @@ -255,6 +255,10 @@ &uart3 { > > > > > > pinctrl-0 = <&uart3_pg_pins>, > > > > > > <&uart3_cts_rts_pg_pins>; > > > > > > status = "okay"; > > > > > > + > > > > > > + bluetooth { > > > > > > + compatible = "realtek,rtl8723bs-bt"; > > > > > > + } > > > > > > > > > > As the kernel test robot already pointed out, there is a semicolon > > > > > missing here. > > > > > Otherwise looks good (dt-validate passes), but don't know if there are > > > > > any wakeup GPIOs connected (can't seem to find a schematic?). > > > > > > > > So there are wakeups, but if I add: > > > > > > > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > > > > > > > then some odd sort of dependency issue happens where the serial port > > > > load is deferred waiting for the GPIO to appear, and then the device > > > > doesn't work. > > > > > > When you say your device doesn't work, are you saying it never probes? > > Read your whole email and it's a strange issue. Also, going forward to > avoid confusion, only reply to questions with respect to 6.3-rc7. Just to be clear, in my initial mail I referred to 6.1.21 as that's where I started, but in my reply to you all output was quoted from 6.3-rc7. 6.3 has been released since, so all details below are based on that. > > The bluetooth device (realtek,rtl8723bs-bt) never appears, apparently > > because the UART it's attached to never loads - it doesn't even try to > > load the firmware. > > > > > <debugfs>/devices_deferred should tell you what devices have deferred and why. > > > > root@chip:~# cat /sys/kernel/debug/devices_deferred > > serial0-0 > > Do you see this in 6.3-rc7 too? That was under 6.3-rc7. I see it on 6.3 too: root@chip:~# cat /sys/kernel/debug/devices_deferred serial0-0 Without the device-wake-gpios line in the device tree it's empty. > > > > Error in dmesg is: > > > > > > > > serial serial0-0: deferred probe pending > > > > > > > > on 6.3-rc and on 6.1 I get: > > > > > > > > dw-apb-uart 1c28c00.serial: Failed to create device link (0x180) with axp20x-gpio > > > > > > This error message doesn't block anything. So I don't think this is > > > the cause of your blocking issue. But I still want to understand why > > > this error message is showing up. > > > > > > > I'm not clear why it's trying to link the serial port to the GPIO; it > > > > seems that it should be the bluetooth device that depends on both the > > > > UART and the GPIO, > > > > > > A fix for the device link error message went in on v6.3-rc3. Is that > > > the 6.3 version you tested this on? > > > > I originally tried on 6.1.21, which is where I got the "Failed to create > > device link" message. I then moved to 6.3-rc7 as I saw there had been > > further changes recently. There I just get the: > > > > serial serial0-0: deferred probe pending > > If the deferral is related to fw_devlink, you should see the reason > for deferring in the devices_deferred file. So I don't think the issue > is related to fw_devlink. Ok. > > message. > > > > > Also, I tried looking into the UART driver > > > (drivers/tty/serial/8250/8250_dw.c) but it wasn't clear how it ends up > > > populating the bluetooth serial device. If you can point that out, > > > that'd be helpful (assuming 6.3-rc3 still shows that error message). > > > > I have the following in my device tree: > > > > &uart3 { > > pinctrl-names = "default"; > > pinctrl-0 = <&uart3_pg_pins>, > > <&uart3_cts_rts_pg_pins>; > > status = "okay"; > > > > bluetooth { > > compatible = "realtek,rtl8723bs-bt"; > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > }; > > }; > > > > uart3 is a snps,dw-apb-uart, defined in arch/arm/boot/dts/sun5i.dtsi > > > > The UART and AXP209 device drivers are compiled into the kernel: > > > > CONFIG_PINCTRL_AXP209=y > > CONFIG_SERIAL_8250=y > > CONFIG_SERIAL_8250_DW=y > > > > The bluetooth bits are modules (btrtl, hci_uart). > > > > If I remove the device-wake-gpios line then the Bluetooth device works > > fine, and /sys/kernel/debug/devices_deferred is empty. > > > > Somehow it seems like the GPIO is being parsed as a dependency for the > > serial port, even though the serial port + GPIO are both dependencies > > for the bluetooth device. > > I'm fairly sure that fw_devlink isn't causing that. Because even > without bluetooth, fw_devlink doesn't consider any suppliers listed in > child DT nodes as mandatory suppliers. That has been the case since > the beginning. Ok, I just got confused with the 6.1 message about the device link and thought that might be the rough area. > > Even with that, given both are built-in I > > don't understand why the serial port never completes setup. > > My guess is that the driver itself has some bug that's sensitive to > device probe order even though it shouldn't. > > Can you add #define DEBUG 1 to the top of drivers/base/core.c and > share the boot log? I can try and help debug it. Thanks for any input you're able to provide. dmesg from 6.3 with a failure to complete the probe: https://the.earth.li/~noodles/chip-bluetooth/6.3-not-working and just for completeness, without the device-wake-gpios line: https://the.earth.li/~noodles/chip-bluetooth/6.3-working J. -- Most people are descended from apes. Redheads are descended from cats. ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-04-24 17:34 ` Jonathan McDowell @ 2023-05-01 21:12 ` Saravana Kannan 2023-05-10 11:34 ` Jonathan McDowell 0 siblings, 1 reply; 44+ messages in thread From: Saravana Kannan @ 2023-05-01 21:12 UTC (permalink / raw) To: Jonathan McDowell Cc: Andre Przywara, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Mon, Apr 24, 2023 at 10:34 AM Jonathan McDowell <noodles@earth.li> wrote: > > On Fri, Apr 21, 2023 at 03:45:52PM -0700, Saravana Kannan wrote: > > On Fri, Apr 21, 2023 at 1:28 AM Jonathan McDowell <noodles@earth.li> wrote: > > > > > > On Thu, Apr 20, 2023 at 06:43:06PM -0700, Saravana Kannan wrote: > > > > On Thu, Apr 20, 2023 at 12:12 PM Jonathan McDowell <noodles@earth.li> wrote: > > > > > On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > > > > > > On Sat, 15 Apr 2023 18:46:03 +0100 > > > > > > Jonathan McDowell <noodles@earth.li> wrote: > > > > > > > > > > > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > > > > > > up on UART3. Support for this didn't exist in mainline when the DTS was > > > > > > > initially added, but it does now, so enable it. > > > > > > > > > > > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > > > > > --- > > > > > > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > > > > > > 1 file changed, 4 insertions(+) > > > > > > > > > > > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > > index fd37bd1f3920..4d72a181d8aa 100644 > > > > > > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > > @@ -255,6 +255,10 @@ &uart3 { > > > > > > > pinctrl-0 = <&uart3_pg_pins>, > > > > > > > <&uart3_cts_rts_pg_pins>; > > > > > > > status = "okay"; > > > > > > > + > > > > > > > + bluetooth { > > > > > > > + compatible = "realtek,rtl8723bs-bt"; > > > > > > > + } > > > > > > > > > > > > As the kernel test robot already pointed out, there is a semicolon > > > > > > missing here. > > > > > > Otherwise looks good (dt-validate passes), but don't know if there are > > > > > > any wakeup GPIOs connected (can't seem to find a schematic?). > > > > > > > > > > So there are wakeups, but if I add: > > > > > > > > > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > > > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > > > > > > > > > then some odd sort of dependency issue happens where the serial port > > > > > load is deferred waiting for the GPIO to appear, and then the device > > > > > doesn't work. > > > > > > > > When you say your device doesn't work, are you saying it never probes? > > > > Read your whole email and it's a strange issue. Also, going forward to > > avoid confusion, only reply to questions with respect to 6.3-rc7. Sorry it took a while to respond. Life got busy. > Just to be clear, in my initial mail I referred to 6.1.21 as that's > where I started, but in my reply to you all output was quoted from > 6.3-rc7. 6.3 has been released since, so all details below are based on > that. > > > > The bluetooth device (realtek,rtl8723bs-bt) never appears, apparently > > > because the UART it's attached to never loads - it doesn't even try to > > > load the firmware. > > > > > > > <debugfs>/devices_deferred should tell you what devices have deferred and why. > > > > > > root@chip:~# cat /sys/kernel/debug/devices_deferred > > > serial0-0 > > > > Do you see this in 6.3-rc7 too? > > That was under 6.3-rc7. I see it on 6.3 too: > > root@chip:~# cat /sys/kernel/debug/devices_deferred > serial0-0 I somehow didn't connect the dots earlier... but serial0-0 is NOT the uart/serial device. It's the child device of serial0 and in this case, it's the bluetooth device. So adding those gpios in DT is not breaking serial. It's just preventing the BT device from probing. Looking at the logs in the non-working case: [ 0.715083] 1c28c00.serial: ttyS1 at MMIO 0x1c28c00 (irq = 53, base_baud = 1500000) is a U6_16550A [ 0.724132] device: 'serial0': device_add I don't know why all of the ttySx are showing up as serial0, but this is the serial port. As you can see 1c28c00 is already probing. [ 0.724228] device: 'serial0-0': device_add This is the child devices getting populated. In this case this is the BT device. [ 0.724311] device: 'platform:1c20800.pinctrl--serial:serial0-0': device_add I can tell it's the BT device because we see a device link being created between pinctrl and serial:serial0-0. So it's a device sitting on the serial bus. [ 0.724378] devices_kset: Moving serial0-0 to end of list [ 0.724390] serial serial0-0: Linked as a consumer to 1c20800.pinctrl [ 0.724401] /soc/serial@1c28c00/bluetooth Dropping the fwnode link to /soc/pinctrl@1c20800 And the fwnode like that was converted to device link clearly shows that the serial0-0 corresponds to the bluetooth node. [ 0.724441] serial serial0: tty port ttyS1 registered Serial port works. > > Without the device-wake-gpios line in the device tree it's empty. I think the issue is at the BT driver level or some other framework. Add a print at the start of the BT driver to see if the probe() is actually getting called. I'm guessing it is and it's returning an error from within. If you don't see that print, then debug the really_probe() function to see how far within it the BT device goes through before it errors out. It's possible pinctrl_bind_pins() in really_probe() fails for the BT device because of how the GPIO pins are configured in your DT. Thanks, Saravana > > > > > > Error in dmesg is: > > > > > > > > > > serial serial0-0: deferred probe pending > > > > > > > > > > on 6.3-rc and on 6.1 I get: > > > > > > > > > > dw-apb-uart 1c28c00.serial: Failed to create device link (0x180) with axp20x-gpio > > > > > > > > This error message doesn't block anything. So I don't think this is > > > > the cause of your blocking issue. But I still want to understand why > > > > this error message is showing up. > > > > > > > > > I'm not clear why it's trying to link the serial port to the GPIO; it > > > > > seems that it should be the bluetooth device that depends on both the > > > > > UART and the GPIO, > > > > > > > > A fix for the device link error message went in on v6.3-rc3. Is that > > > > the 6.3 version you tested this on? > > > > > > I originally tried on 6.1.21, which is where I got the "Failed to create > > > device link" message. I then moved to 6.3-rc7 as I saw there had been > > > further changes recently. There I just get the: > > > > > > serial serial0-0: deferred probe pending > > > > If the deferral is related to fw_devlink, you should see the reason > > for deferring in the devices_deferred file. So I don't think the issue > > is related to fw_devlink. > > Ok. > > > > message. > > > > > > > Also, I tried looking into the UART driver > > > > (drivers/tty/serial/8250/8250_dw.c) but it wasn't clear how it ends up > > > > populating the bluetooth serial device. If you can point that out, > > > > that'd be helpful (assuming 6.3-rc3 still shows that error message). > > > > > > I have the following in my device tree: > > > > > > &uart3 { > > > pinctrl-names = "default"; > > > pinctrl-0 = <&uart3_pg_pins>, > > > <&uart3_cts_rts_pg_pins>; > > > status = "okay"; > > > > > > bluetooth { > > > compatible = "realtek,rtl8723bs-bt"; > > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > > }; > > > }; > > > > > > uart3 is a snps,dw-apb-uart, defined in arch/arm/boot/dts/sun5i.dtsi > > > > > > The UART and AXP209 device drivers are compiled into the kernel: > > > > > > CONFIG_PINCTRL_AXP209=y > > > CONFIG_SERIAL_8250=y > > > CONFIG_SERIAL_8250_DW=y > > > > > > The bluetooth bits are modules (btrtl, hci_uart). > > > > > > If I remove the device-wake-gpios line then the Bluetooth device works > > > fine, and /sys/kernel/debug/devices_deferred is empty. > > > > > > Somehow it seems like the GPIO is being parsed as a dependency for the > > > serial port, even though the serial port + GPIO are both dependencies > > > for the bluetooth device. > > > > I'm fairly sure that fw_devlink isn't causing that. Because even > > without bluetooth, fw_devlink doesn't consider any suppliers listed in > > child DT nodes as mandatory suppliers. That has been the case since > > the beginning. > > Ok, I just got confused with the 6.1 message about the device link and > thought that might be the rough area. > > > > Even with that, given both are built-in I > > > don't understand why the serial port never completes setup. > > > > My guess is that the driver itself has some bug that's sensitive to > > device probe order even though it shouldn't. > > > > Can you add #define DEBUG 1 to the top of drivers/base/core.c and > > share the boot log? I can try and help debug it. > > Thanks for any input you're able to provide. dmesg from 6.3 with a > failure to complete the probe: > > https://the.earth.li/~noodles/chip-bluetooth/6.3-not-working > > and just for completeness, without the device-wake-gpios line: > > https://the.earth.li/~noodles/chip-bluetooth/6.3-working > > J. > > -- > Most people are descended from apes. Redheads are descended from cats. ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth 2023-05-01 21:12 ` Saravana Kannan @ 2023-05-10 11:34 ` Jonathan McDowell 0 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 11:34 UTC (permalink / raw) To: Saravana Kannan Cc: Andre Przywara, Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Mon, May 01, 2023 at 02:12:05PM -0700, Saravana Kannan wrote: > On Mon, Apr 24, 2023 at 10:34 AM Jonathan McDowell <noodles@earth.li> wrote: > > > > On Fri, Apr 21, 2023 at 03:45:52PM -0700, Saravana Kannan wrote: > > > On Fri, Apr 21, 2023 at 1:28 AM Jonathan McDowell <noodles@earth.li> wrote: > > > > > > > > On Thu, Apr 20, 2023 at 06:43:06PM -0700, Saravana Kannan wrote: > > > > > On Thu, Apr 20, 2023 at 12:12 PM Jonathan McDowell <noodles@earth.li> wrote: > > > > > > On Sun, Apr 16, 2023 at 01:24:21AM +0100, Andre Przywara wrote: > > > > > > > On Sat, 15 Apr 2023 18:46:03 +0100 > > > > > > > Jonathan McDowell <noodles@earth.li> wrote: > > > > > > > > > > > > > > > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > > > > > > > > up on UART3. Support for this didn't exist in mainline when the DTS was > > > > > > > > initially added, but it does now, so enable it. > > > > > > > > > > > > > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > > > > > > --- > > > > > > > > arch/arm/boot/dts/sun5i-r8-chip.dts | 4 ++++ > > > > > > > > 1 file changed, 4 insertions(+) > > > > > > > > > > > > > > > > diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > > > index fd37bd1f3920..4d72a181d8aa 100644 > > > > > > > > --- a/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > > > +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts > > > > > > > > @@ -255,6 +255,10 @@ &uart3 { > > > > > > > > pinctrl-0 = <&uart3_pg_pins>, > > > > > > > > <&uart3_cts_rts_pg_pins>; > > > > > > > > status = "okay"; > > > > > > > > + > > > > > > > > + bluetooth { > > > > > > > > + compatible = "realtek,rtl8723bs-bt"; > > > > > > > > + } > > > > > > > > > > > > > > As the kernel test robot already pointed out, there is a semicolon > > > > > > > missing here. > > > > > > > Otherwise looks good (dt-validate passes), but don't know if there are > > > > > > > any wakeup GPIOs connected (can't seem to find a schematic?). > > > > > > > > > > > > So there are wakeups, but if I add: > > > > > > > > > > > > device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_LOW>; > > > > > > host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ > > > > > > > > > > > > then some odd sort of dependency issue happens where the serial port > > > > > > load is deferred waiting for the GPIO to appear, and then the device > > > > > > doesn't work. > > > > > > > > > > When you say your device doesn't work, are you saying it never probes? > > > > > > Read your whole email and it's a strange issue. Also, going forward to > > > avoid confusion, only reply to questions with respect to 6.3-rc7. > > Sorry it took a while to respond. Life got busy. No problem, I appreciate you looking into this. > > Just to be clear, in my initial mail I referred to 6.1.21 as that's > > where I started, but in my reply to you all output was quoted from > > 6.3-rc7. 6.3 has been released since, so all details below are based on > > that. > > > > > > The bluetooth device (realtek,rtl8723bs-bt) never appears, apparently > > > > because the UART it's attached to never loads - it doesn't even try to > > > > load the firmware. > > > > > > > > > <debugfs>/devices_deferred should tell you what devices have deferred and why. > > > > > > > > root@chip:~# cat /sys/kernel/debug/devices_deferred > > > > serial0-0 > > > > > > Do you see this in 6.3-rc7 too? > > > > That was under 6.3-rc7. I see it on 6.3 too: > > > > root@chip:~# cat /sys/kernel/debug/devices_deferred > > serial0-0 > > I somehow didn't connect the dots earlier... but serial0-0 is NOT the > uart/serial device. It's the child device of serial0 and in this case, > it's the bluetooth device. > > So adding those gpios in DT is not breaking serial. It's just > preventing the BT device from probing. Aaaaah. > Looking at the logs in the non-working case: > > [ 0.715083] 1c28c00.serial: ttyS1 at MMIO 0x1c28c00 (irq = 53, > base_baud = 1500000) is a U6_16550A > [ 0.724132] device: 'serial0': device_add > > I don't know why all of the ttySx are showing up as serial0, but this > is the serial port. As you can see 1c28c00 is already probing. > > [ 0.724228] device: 'serial0-0': device_add > > This is the child devices getting populated. In this case this is the BT device. > > [ 0.724311] device: 'platform:1c20800.pinctrl--serial:serial0-0': device_add > > I can tell it's the BT device because we see a device link being > created between pinctrl and serial:serial0-0. So it's a device sitting > on the serial bus. > > [ 0.724378] devices_kset: Moving serial0-0 to end of list > [ 0.724390] serial serial0-0: Linked as a consumer to 1c20800.pinctrl > [ 0.724401] /soc/serial@1c28c00/bluetooth Dropping the fwnode link > to /soc/pinctrl@1c20800 > > And the fwnode like that was converted to device link clearly shows > that the serial0-0 corresponds to the bluetooth node. > > [ 0.724441] serial serial0: tty port ttyS1 registered > > Serial port works. > > > > > Without the device-wake-gpios line in the device tree it's empty. > > I think the issue is at the BT driver level or some other framework. > > Add a print at the start of the BT driver to see if the probe() is > actually getting called. I'm guessing it is and it's returning an > error from within. > > If you don't see that print, then debug the really_probe() function to > see how far within it the BT device goes through before it errors out. > It's possible pinctrl_bind_pins() in really_probe() fails for the BT > device because of how the GPIO pins are configured in your DT. Thank you! That was exactly the pointer I needed to go and find the actual issue, which is a real facepalm moment. The AXP209 driver does not have support for GPIO3 (which is in a different register and needs a bunch of special casing). So the Bluetooth driver tries to request it and gets failures, so can't complete the probe. I've added support to the pinctrl-axp209 driver for GPIO3 and everything is working just fine now. I'll get that cleaned up and a v2 patch set submitted. Thanks for all your help. J. -- 101 things you can't have too much of : 49 - Bandwidth. This .sig brought to you by the letter V and the number 8 Product of the Republic of HuggieTag ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 2023-04-15 17:45 [PATCH 0/3] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-04-15 17:46 ` [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell @ 2023-04-15 17:46 ` Jonathan McDowell 2023-04-16 0:47 ` Andre Przywara 2023-04-15 17:47 ` [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 3 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-04-15 17:46 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel These alternate pins for mmc2 are brought out to the 40 pin U14 header on the C.H.I.P and can be used to add an external MMC device with a 4 bit interface. See https://byteporter.com/ntc-chip-micro-sd-slot/ for further details on how. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- arch/arm/boot/dts/sun5i.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi index 250d6b87ab4d..e4922506ce22 100644 --- a/arch/arm/boot/dts/sun5i.dtsi +++ b/arch/arm/boot/dts/sun5i.dtsi @@ -517,6 +517,14 @@ mmc2_4bit_pc_pins: mmc2-4bit-pc-pins { bias-pull-up; }; + mmc2_4bit_pe_pins: mmc2-4bit-pe-pins { + pins = "PE4", "PE5", "PE6", "PE7", + "PE8", "PE9"; + function = "mmc2"; + drive-strength = <30>; + bias-pull-up; + }; + mmc2_8bit_pins: mmc2-8bit-pins { pins = "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 2023-04-15 17:46 ` [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell @ 2023-04-16 0:47 ` Andre Przywara 2023-04-20 19:13 ` Jonathan McDowell 0 siblings, 1 reply; 44+ messages in thread From: Andre Przywara @ 2023-04-16 0:47 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Sat, 15 Apr 2023 18:46:24 +0100 Jonathan McDowell <noodles@earth.li> wrote: Hi, > These alternate pins for mmc2 are brought out to the 40 pin U14 header > on the C.H.I.P and can be used to add an external MMC device with a 4 > bit interface. See > > https://byteporter.com/ntc-chip-micro-sd-slot/ > > for further details on how. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > --- > arch/arm/boot/dts/sun5i.dtsi | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi > index 250d6b87ab4d..e4922506ce22 100644 > --- a/arch/arm/boot/dts/sun5i.dtsi > +++ b/arch/arm/boot/dts/sun5i.dtsi > @@ -517,6 +517,14 @@ mmc2_4bit_pc_pins: mmc2-4bit-pc-pins { > bias-pull-up; > }; > As this seems to be a highly non-standard and rare modification, that doesn't even get used in the mainline DT, please add a: /omit-if-no-ref/ line, so we don't get this into every sun5i board. Otherwise looks good, though I don't know if that should belong into the same DT overlay that is probably used to also enable the MMC2 node. Cheers, Andre > + mmc2_4bit_pe_pins: mmc2-4bit-pe-pins { > + pins = "PE4", "PE5", "PE6", "PE7", > + "PE8", "PE9"; > + function = "mmc2"; > + drive-strength = <30>; > + bias-pull-up; > + }; > + > mmc2_8bit_pins: mmc2-8bit-pins { > pins = "PC6", "PC7", "PC8", "PC9", > "PC10", "PC11", "PC12", "PC13", ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 2023-04-16 0:47 ` Andre Przywara @ 2023-04-20 19:13 ` Jonathan McDowell 0 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-04-20 19:13 UTC (permalink / raw) To: Andre Przywara Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Sun, Apr 16, 2023 at 01:47:56AM +0100, Andre Przywara wrote: > On Sat, 15 Apr 2023 18:46:24 +0100 > Jonathan McDowell <noodles@earth.li> wrote: > > Hi, > > > These alternate pins for mmc2 are brought out to the 40 pin U14 header > > on the C.H.I.P and can be used to add an external MMC device with a 4 > > bit interface. See > > > > https://byteporter.com/ntc-chip-micro-sd-slot/ > > > > for further details on how. > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > --- > > arch/arm/boot/dts/sun5i.dtsi | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi > > index 250d6b87ab4d..e4922506ce22 100644 > > --- a/arch/arm/boot/dts/sun5i.dtsi > > +++ b/arch/arm/boot/dts/sun5i.dtsi > > @@ -517,6 +517,14 @@ mmc2_4bit_pc_pins: mmc2-4bit-pc-pins { > > bias-pull-up; > > }; > > > > As this seems to be a highly non-standard and rare modification, that > doesn't even get used in the mainline DT, please add a: > /omit-if-no-ref/ > line, so we don't get this into every sun5i board. Neat, will add in v2. > Otherwise looks good, though I don't know if that should belong into > the same DT overlay that is probably used to also enable the MMC2 node. I pondered that, but we already have the mmc2-4bit-pc-pins definition here so it seemed helpful to add the pe-pins too. > > + mmc2_4bit_pe_pins: mmc2-4bit-pe-pins { > > + pins = "PE4", "PE5", "PE6", "PE7", > > + "PE8", "PE9"; > > + function = "mmc2"; > > + drive-strength = <30>; > > + bias-pull-up; > > + }; > > + > > mmc2_8bit_pins: mmc2-8bit-pins { > > pins = "PC6", "PC7", "PC8", "PC9", > > "PC10", "PC11", "PC12", "PC13", > J. -- "Where the f**k is all this | .''`. Debian GNU/Linux Developer water coming from?" -- Captain | : :' : Happy to accept PGP signed of the Titanic | `. `' or encrypted mail - RSA | `- key on the keyservers. ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-04-15 17:45 [PATCH 0/3] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-04-15 17:46 ` [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell 2023-04-15 17:46 ` [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell @ 2023-04-15 17:47 ` Jonathan McDowell 2023-04-16 7:27 ` Krzysztof Kozlowski 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 3 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-04-15 17:47 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel This adds a DT node to hook up the internal temperature ADC to the iio-hwmon driver. The various voltage + current ADCs are consumed and exposed by their respective drivers, but this is not and is always available. Naming chosen to match the axp20x_ prefix the power sensors use. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- arch/arm/boot/dts/axp209.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index ca240cd6f6c3..f00b5a7ec106 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -48,6 +48,13 @@ * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf */ +/ { + axp20x_temp { + compatible = "iio-hwmon"; + io-channels = <&axp_adc 4>; /* Internal temperature */ + }; +}; + &axp209 { compatible = "x-powers,axp209"; interrupt-controller; -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-04-15 17:47 ` [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell @ 2023-04-16 7:27 ` Krzysztof Kozlowski 2023-04-20 19:06 ` Jonathan McDowell 0 siblings, 1 reply; 44+ messages in thread From: Krzysztof Kozlowski @ 2023-04-16 7:27 UTC (permalink / raw) To: Jonathan McDowell, Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On 15/04/2023 19:47, Jonathan McDowell wrote: > This adds a DT node to hook up the internal temperature ADC to the Do not use "This commit/patch", but imperative mood. See: https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95 > iio-hwmon driver. The various voltage + current ADCs are consumed and > exposed by their respective drivers, but this is not and is always > available. Naming chosen to match the axp20x_ prefix the power sensors > use. Weird choice. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > --- > arch/arm/boot/dts/axp209.dtsi | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi > index ca240cd6f6c3..f00b5a7ec106 100644 > --- a/arch/arm/boot/dts/axp209.dtsi > +++ b/arch/arm/boot/dts/axp209.dtsi > @@ -48,6 +48,13 @@ > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf > */ > > +/ { > + axp20x_temp { No underscores in node names. Node names should be generic. https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation > + compatible = "iio-hwmon"; > + io-channels = <&axp_adc 4>; /* Internal temperature */ > + }; > +}; > + > &axp209 { > compatible = "x-powers,axp209"; > interrupt-controller; Best regards, Krzysztof ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-04-16 7:27 ` Krzysztof Kozlowski @ 2023-04-20 19:06 ` Jonathan McDowell 0 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-04-20 19:06 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel On Sun, Apr 16, 2023 at 09:27:46AM +0200, Krzysztof Kozlowski wrote: > On 15/04/2023 19:47, Jonathan McDowell wrote: > > This adds a DT node to hook up the internal temperature ADC to the > > Do not use "This commit/patch", but imperative mood. See: > https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95 > > > iio-hwmon driver. The various voltage + current ADCs are consumed and > > exposed by their respective drivers, but this is not and is always > > available. Naming chosen to match the axp20x_ prefix the power sensors > > use. > > Weird choice. You think? I didn't choose the axp20x_ prefix for the others, but it made sense to me that all the sensors from the same device would be identifiable as such. From your comment below it sounds like you'd prefer I use the more generic pmic-temp as the node name? Will do for v2. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > --- > > arch/arm/boot/dts/axp209.dtsi | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi > > index ca240cd6f6c3..f00b5a7ec106 100644 > > --- a/arch/arm/boot/dts/axp209.dtsi > > +++ b/arch/arm/boot/dts/axp209.dtsi > > @@ -48,6 +48,13 @@ > > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf > > */ > > > > +/ { > > + axp20x_temp { > > No underscores in node names. > > Node names should be generic. > https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation > > > + compatible = "iio-hwmon"; > > + io-channels = <&axp_adc 4>; /* Internal temperature */ > > + }; > > +}; > > + > > &axp209 { > > compatible = "x-powers,axp209"; > > interrupt-controller; J. -- "My house has this new innovation called "windows". Even my bedroom has them. " -- Paul Tomblin ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 0/5] Minor device-tree additions for C.H.I.P 2023-04-15 17:45 [PATCH 0/3] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (2 preceding siblings ...) 2023-04-15 17:47 ` [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell @ 2023-05-10 12:00 ` Jonathan McDowell 2023-05-10 12:01 ` [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell ` (5 more replies) 3 siblings, 6 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 12:00 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio This small patch series adds some improvements for the C.H.I.P DTS, enabling bluetooth, exporting the PMIC temperature details via iio-hwmon and finally adding the appropriate base pinmux info for an external MMC card. As a pre-requisite for the Bluetooth it also adds support to the AXP209 driver for GPIO3, which is the Bluetooth device wakeup line. v2: - Fix missing ; on bluetooth stanza in DTS - Add device/host wake GPIOs for Bluetooth device - Add omit-if-no-ref on the port E pinmux stanza - Rename axp20x_temp to pmic-temp - Add AXP209 GPIO3 support Jonathan McDowell (5): dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema pinctrl: axp209: Add support for GPIO3 on the AXP209 ARM: dts: sun5i: chip: Enable bluetooth ARM: dts: sun5i: Add port E pinmux settings for mmc2 ARM: dts: axp209: Add iio-hwmon node for internal temperature .../bindings/gpio/x-powers,axp209-gpio.yaml | 1 + arch/arm/boot/dts/axp209.dtsi | 7 ++++ arch/arm/boot/dts/sun5i-r8-chip.dts | 6 +++ arch/arm/boot/dts/sun5i.dtsi | 9 ++++ drivers/pinctrl/pinctrl-axp209.c | 42 +++++++++++++++++++ 5 files changed, 65 insertions(+) -- 2.39.2 ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell @ 2023-05-10 12:01 ` Jonathan McDowell 2023-05-11 15:41 ` Jernej Škrabec 2023-05-11 18:55 ` Conor Dooley 2023-05-10 12:01 ` [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell ` (4 subsequent siblings) 5 siblings, 2 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 12:01 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio The AXP209 has a 4th GPIO, so add it in preparation for support in the driver. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml index 31906c253940..1638cfe90f1c 100644 --- a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml @@ -44,6 +44,7 @@ patternProperties: - GPIO0 - GPIO1 - GPIO2 + - GPIO3 function: enum: -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema 2023-05-10 12:01 ` [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell @ 2023-05-11 15:41 ` Jernej Škrabec 2023-05-11 18:55 ` Conor Dooley 1 sibling, 0 replies; 44+ messages in thread From: Jernej Škrabec @ 2023-05-11 15:41 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, Jonathan McDowell Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne sreda, 10. maj 2023 ob 14:01:12 CEST je Jonathan McDowell napisal(a): > The AXP209 has a 4th GPIO, so add it in preparation for support in the > driver. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema 2023-05-10 12:01 ` [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell 2023-05-11 15:41 ` Jernej Škrabec @ 2023-05-11 18:55 ` Conor Dooley 1 sibling, 0 replies; 44+ messages in thread From: Conor Dooley @ 2023-05-11 18:55 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio [-- Attachment #1: Type: text/plain, Size: 286 bytes --] On Wed, May 10, 2023 at 01:01:12PM +0100, Jonathan McDowell wrote: > The AXP209 has a 4th GPIO, so add it in preparation for support in the > driver. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> Acked-by: Conor Dooley <conor.dooley@microchip.com> Thanks, Conor. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-05-10 12:01 ` [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell @ 2023-05-10 12:01 ` Jonathan McDowell 2023-05-10 14:15 ` andy.shevchenko 2023-05-29 9:51 ` Linus Walleij 2023-05-10 12:01 ` [PATCH v2 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell ` (3 subsequent siblings) 5 siblings, 2 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 12:01 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio The AXP209 device has a 4th GPIO which has a slightly different register setup, where the control + status bits are held in a single register rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- drivers/pinctrl/pinctrl-axp209.c | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 0bc1b381a2b8..317691aee86b 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -30,6 +30,11 @@ #define AXP20X_GPIO_FUNCTION_OUT_HIGH 1 #define AXP20X_GPIO_FUNCTION_INPUT 2 +#define AXP20X_GPIO3_FUNCTIONS (BIT(2) | BIT(1)) +#define AXP20X_GPIO3_FUNCTION_OUT_LOW 0 +#define AXP20X_GPIO3_FUNCTION_OUT_HIGH BIT(1) +#define AXP20X_GPIO3_FUNCTION_INPUT BIT(2) + #define AXP20X_FUNC_GPIO_OUT 0 #define AXP20X_FUNC_GPIO_IN 1 #define AXP20X_FUNC_LDO 2 @@ -73,6 +78,7 @@ static const struct pinctrl_pin_desc axp209_pins[] = { PINCTRL_PIN(0, "GPIO0"), PINCTRL_PIN(1, "GPIO1"), PINCTRL_PIN(2, "GPIO2"), + PINCTRL_PIN(3, "GPIO3"), }; static const struct pinctrl_pin_desc axp22x_pins[] = { @@ -130,6 +136,14 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset) unsigned int val; int ret; + /* AXP209 has GPIO3 status sharing the settings register */ + if (offset == 3) { + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); + if (ret) + return ret; + return !!(val & BIT(0)); + } + ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val); if (ret) return ret; @@ -144,6 +158,17 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned int val; int reg, ret; + /* AXP209 GPIO3 settings have a different layout */ + if (offset == 3) { + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); + if (ret) + return ret; + if (val & AXP20X_GPIO3_FUNCTION_INPUT) + return GPIO_LINE_DIRECTION_IN; + else + return GPIO_LINE_DIRECTION_OUT; + } + reg = axp20x_gpio_get_reg(offset); if (reg < 0) return reg; @@ -184,6 +209,15 @@ static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset, struct axp20x_pctl *pctl = gpiochip_get_data(chip); int reg; + /* AXP209 has GPIO3 status sharing the settings register */ + if (offset == 3) { + regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, + AXP20X_GPIO3_FUNCTIONS, + value ? AXP20X_GPIO3_FUNCTION_OUT_HIGH : + AXP20X_GPIO3_FUNCTION_OUT_LOW); + return; + } + reg = axp20x_gpio_get_reg(offset); if (reg < 0) return; @@ -200,6 +234,14 @@ static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset, struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); int reg; + /* AXP209 GPIO3 settings have a different layout */ + if (offset == 3) { + return regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, + AXP20X_GPIO3_FUNCTIONS, + config == AXP20X_MUX_GPIO_OUT ? AXP20X_GPIO3_FUNCTION_OUT_LOW : + AXP20X_GPIO3_FUNCTION_INPUT); + } + reg = axp20x_gpio_get_reg(offset); if (reg < 0) return reg; -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-10 12:01 ` [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell @ 2023-05-10 14:15 ` andy.shevchenko 2023-05-29 9:51 ` Linus Walleij 1 sibling, 0 replies; 44+ messages in thread From: andy.shevchenko @ 2023-05-10 14:15 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Wed, May 10, 2023 at 01:01:27PM +0100, Jonathan McDowell kirjoitti: > The AXP209 device has a 4th GPIO which has a slightly different register > setup, where the control + status bits are held in a single register > rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. ... > +#define AXP20X_GPIO3_FUNCTIONS (BIT(2) | BIT(1)) GENMASK() ? ... > +#define AXP20X_GPIO3_FUNCTION_OUT_LOW 0 > +#define AXP20X_GPIO3_FUNCTION_OUT_HIGH BIT(1) > +#define AXP20X_GPIO3_FUNCTION_INPUT BIT(2) Seems mixed use of decimal and bitwise values, switch to decimal, since it makes more sense in my opinion. ... > + if (offset == 3) { > + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); > + if (ret) > + return ret; > + if (val & AXP20X_GPIO3_FUNCTION_INPUT) > + return GPIO_LINE_DIRECTION_IN; > + else Redundant 'else'. > + return GPIO_LINE_DIRECTION_OUT; > + } -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-10 12:01 ` [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell 2023-05-10 14:15 ` andy.shevchenko @ 2023-05-29 9:51 ` Linus Walleij 2023-06-01 7:30 ` Jonathan McDowell 1 sibling, 1 reply; 44+ messages in thread From: Linus Walleij @ 2023-05-29 9:51 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio On Wed, May 10, 2023 at 2:01 PM Jonathan McDowell <noodles@earth.li> wrote: > The AXP209 device has a 4th GPIO which has a slightly different register > setup, where the control + status bits are held in a single register > rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> This patch 2/5 applied to the pinctrl tree. I just assume it is fine to apply this one patch, Bartosz already applied the binding patch. Tell me if this works. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-29 9:51 ` Linus Walleij @ 2023-06-01 7:30 ` Jonathan McDowell 0 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-06-01 7:30 UTC (permalink / raw) To: Linus Walleij Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio On Mon, May 29, 2023 at 11:51:46AM +0200, Linus Walleij wrote: > On Wed, May 10, 2023 at 2:01 PM Jonathan McDowell <noodles@earth.li> wrote: > > The AXP209 device has a 4th GPIO which has a slightly different register > > setup, where the control + status bits are held in a single register > > rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > This patch 2/5 applied to the pinctrl tree. > > I just assume it is fine to apply this one patch, Bartosz already > applied the binding patch. > > Tell me if this works. Everything else seems to have been picked up, so that works for me. J. -- Revd Jonathan McDowell, ULC | Even the Evening Herald slags me off. ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 3/5] ARM: dts: sun5i: chip: Enable bluetooth 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-05-10 12:01 ` [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell 2023-05-10 12:01 ` [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell @ 2023-05-10 12:01 ` Jonathan McDowell 2023-05-11 15:41 ` Jernej Škrabec 2023-05-10 12:02 ` [PATCH v2 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell ` (2 subsequent siblings) 5 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 12:01 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked up on UART3. Support for this didn't exist in mainline when the DTS was initially added, but it does now, so enable it. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- arch/arm/boot/dts/sun5i-r8-chip.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts index fd37bd1f3920..4192c23848c3 100644 --- a/arch/arm/boot/dts/sun5i-r8-chip.dts +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts @@ -255,6 +255,12 @@ &uart3 { pinctrl-0 = <&uart3_pg_pins>, <&uart3_cts_rts_pg_pins>; status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ + }; }; &usb_otg { -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 3/5] ARM: dts: sun5i: chip: Enable bluetooth 2023-05-10 12:01 ` [PATCH v2 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell @ 2023-05-11 15:41 ` Jernej Škrabec 0 siblings, 0 replies; 44+ messages in thread From: Jernej Škrabec @ 2023-05-11 15:41 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, Jonathan McDowell Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne sreda, 10. maj 2023 ob 14:01:43 CEST je Jonathan McDowell napisal(a): > The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked > up on UART3. Support for this didn't exist in mainline when the DTS was > initially added, but it does now, so enable it. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (2 preceding siblings ...) 2023-05-10 12:01 ` [PATCH v2 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell @ 2023-05-10 12:02 ` Jonathan McDowell 2023-05-11 15:45 ` Jernej Škrabec 2023-05-10 12:02 ` [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 5 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 12:02 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio These alternate pins for mmc2 are brought out to the 40 pin U14 header on the C.H.I.P and can be used to add an external MMC device with a 4 bit interface. See https://byteporter.com/ntc-chip-micro-sd-slot/ for further details on how. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- arch/arm/boot/dts/sun5i.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi index 250d6b87ab4d..ab7f675aeec4 100644 --- a/arch/arm/boot/dts/sun5i.dtsi +++ b/arch/arm/boot/dts/sun5i.dtsi @@ -517,6 +517,15 @@ mmc2_4bit_pc_pins: mmc2-4bit-pc-pins { bias-pull-up; }; + /omit-if-no-ref/ + mmc2_4bit_pe_pins: mmc2-4bit-pe-pins { + pins = "PE4", "PE5", "PE6", "PE7", + "PE8", "PE9"; + function = "mmc2"; + drive-strength = <30>; + bias-pull-up; + }; + mmc2_8bit_pins: mmc2-8bit-pins { pins = "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 2023-05-10 12:02 ` [PATCH v2 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell @ 2023-05-11 15:45 ` Jernej Škrabec 0 siblings, 0 replies; 44+ messages in thread From: Jernej Škrabec @ 2023-05-11 15:45 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, Jonathan McDowell Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne sreda, 10. maj 2023 ob 14:02:02 CEST je Jonathan McDowell napisal(a): > These alternate pins for mmc2 are brought out to the 40 pin U14 header > on the C.H.I.P and can be used to add an external MMC device with a 4 > bit interface. See > > https://byteporter.com/ntc-chip-micro-sd-slot/ > > for further details on how. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (3 preceding siblings ...) 2023-05-10 12:02 ` [PATCH v2 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell @ 2023-05-10 12:02 ` Jonathan McDowell 2023-05-11 16:11 ` Jernej Škrabec 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 5 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-05-10 12:02 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio This adds a DT node to hook up the internal temperature ADC to the iio-hwmon driver. The various voltage + current ADCs are consumed and exposed by their respective drivers, but this is not and is always available. Naming chosen to match the axp20x_ prefix the power sensors use. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- arch/arm/boot/dts/axp209.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index ca240cd6f6c3..469d0f7d5185 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -48,6 +48,13 @@ * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf */ +/ { + pmic-temp { + compatible = "iio-hwmon"; + io-channels = <&axp_adc 4>; /* Internal temperature */ + }; +}; + &axp209 { compatible = "x-powers,axp209"; interrupt-controller; -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-05-10 12:02 ` [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell @ 2023-05-11 16:11 ` Jernej Škrabec 2023-05-12 10:30 ` Jonathan McDowell 0 siblings, 1 reply; 44+ messages in thread From: Jernej Škrabec @ 2023-05-11 16:11 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, Jonathan McDowell Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne sreda, 10. maj 2023 ob 14:02:28 CEST je Jonathan McDowell napisal(a): > This adds a DT node to hook up the internal temperature ADC to the > iio-hwmon driver. The various voltage + current ADCs are consumed and > exposed by their respective drivers, but this is not and is always > available. Naming chosen to match the axp20x_ prefix the power sensors > use. Sorry for maybe obvious thing, but where are other ADC channels exposed? Best regards, Jernej > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > --- > arch/arm/boot/dts/axp209.dtsi | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi > index ca240cd6f6c3..469d0f7d5185 100644 > --- a/arch/arm/boot/dts/axp209.dtsi > +++ b/arch/arm/boot/dts/axp209.dtsi > @@ -48,6 +48,13 @@ > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf > */ > > +/ { > + pmic-temp { > + compatible = "iio-hwmon"; > + io-channels = <&axp_adc 4>; /* Internal temperature */ > + }; > +}; > + > &axp209 { > compatible = "x-powers,axp209"; > interrupt-controller; ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-05-11 16:11 ` Jernej Škrabec @ 2023-05-12 10:30 ` Jonathan McDowell 2023-05-12 16:37 ` Jernej Škrabec 0 siblings, 1 reply; 44+ messages in thread From: Jonathan McDowell @ 2023-05-12 10:30 UTC (permalink / raw) To: Jernej Škrabec Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio On Thu, May 11, 2023 at 06:11:49PM +0200, Jernej Škrabec wrote: > Dne sreda, 10. maj 2023 ob 14:02:28 CEST je Jonathan McDowell napisal(a): > > This adds a DT node to hook up the internal temperature ADC to the > > iio-hwmon driver. The various voltage + current ADCs are consumed and > > exposed by their respective drivers, but this is not and is always > > available. Naming chosen to match the axp20x_ prefix the power sensors > > use. > > Sorry for maybe obvious thing, but where are other ADC channels exposed? In the associated power drivers; e.g. axp20x_ac_power, axp20x_usb_power + axp20x_battery. The internal temperature is the only one that logically belongs to the chip as a whole rather than one of the subfunctions. root@chip:~# sensors axp20x_battery-isa-0000 Adapter: ISA adapter in0: 0.00 V curr1: 0.00 A pmic_temp-isa-0000 Adapter: ISA adapter temp1: +42.5°C axp20x_ac-isa-0000 Adapter: ISA adapter in0: 0.00 V curr1: 0.00 A axp20x_usb-isa-0000 Adapter: ISA adapter in0: 4.93 V (min = +4.00 V) curr1: 330.00 mA (max = +0.00 A) > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > --- > > arch/arm/boot/dts/axp209.dtsi | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi > > index ca240cd6f6c3..469d0f7d5185 100644 > > --- a/arch/arm/boot/dts/axp209.dtsi > > +++ b/arch/arm/boot/dts/axp209.dtsi > > @@ -48,6 +48,13 @@ > > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf > > */ > > > > +/ { > > + pmic-temp { > > + compatible = "iio-hwmon"; > > + io-channels = <&axp_adc 4>; /* Internal temperature */ > > + }; > > +}; > > + > > &axp209 { > > compatible = "x-powers,axp209"; > > interrupt-controller; J. -- /-\ | Synonym: word used when you can't |@/ Debian GNU/Linux Developer | spell the one you want \- | ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-05-12 10:30 ` Jonathan McDowell @ 2023-05-12 16:37 ` Jernej Škrabec 0 siblings, 0 replies; 44+ messages in thread From: Jernej Škrabec @ 2023-05-12 16:37 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne petek, 12. maj 2023 ob 12:30:32 CEST je Jonathan McDowell napisal(a): > On Thu, May 11, 2023 at 06:11:49PM +0200, Jernej Škrabec wrote: > > Dne sreda, 10. maj 2023 ob 14:02:28 CEST je Jonathan McDowell napisal(a): > > > This adds a DT node to hook up the internal temperature ADC to the > > > iio-hwmon driver. The various voltage + current ADCs are consumed and > > > exposed by their respective drivers, but this is not and is always > > > available. Naming chosen to match the axp20x_ prefix the power sensors > > > use. > > > > Sorry for maybe obvious thing, but where are other ADC channels exposed? > > In the associated power drivers; e.g. axp20x_ac_power, axp20x_usb_power > + axp20x_battery. The internal temperature is the only one that > logically belongs to the chip as a whole rather than one of the > subfunctions. > > root@chip:~# sensors > axp20x_battery-isa-0000 > Adapter: ISA adapter > in0: 0.00 V > curr1: 0.00 A > > pmic_temp-isa-0000 > Adapter: ISA adapter > temp1: +42.5°C > > axp20x_ac-isa-0000 > Adapter: ISA adapter > in0: 0.00 V > curr1: 0.00 A > > axp20x_usb-isa-0000 > Adapter: ISA adapter > in0: 4.93 V (min = +4.00 V) > curr1: 330.00 mA (max = +0.00 A) Right. Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej > > > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > > > --- > > > > > > arch/arm/boot/dts/axp209.dtsi | 7 +++++++ > > > 1 file changed, 7 insertions(+) > > > > > > diff --git a/arch/arm/boot/dts/axp209.dtsi > > > b/arch/arm/boot/dts/axp209.dtsi > > > index ca240cd6f6c3..469d0f7d5185 100644 > > > --- a/arch/arm/boot/dts/axp209.dtsi > > > +++ b/arch/arm/boot/dts/axp209.dtsi > > > @@ -48,6 +48,13 @@ > > > > > > * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf > > > */ > > > > > > +/ { > > > + pmic-temp { > > > + compatible = "iio-hwmon"; > > > + io-channels = <&axp_adc 4>; /* Internal temperature */ > > > + }; > > > +}; > > > + > > > > > > &axp209 { > > > > > > compatible = "x-powers,axp209"; > > > interrupt-controller; > > J. ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 0/5] Minor device-tree additions for C.H.I.P 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (4 preceding siblings ...) 2023-05-10 12:02 ` [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell @ 2023-05-16 17:46 ` Jonathan McDowell 2023-05-16 17:47 ` [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell ` (5 more replies) 5 siblings, 6 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-16 17:46 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio This small patch series adds some improvements for the C.H.I.P DTS, enabling bluetooth, exporting the PMIC temperature details via iio-hwmon and finally adding the appropriate base pinmux info for an external MMC card. As a pre-requisite for the Bluetooth it also adds support to the AXP209 driver for GPIO3, which is the Bluetooth device wakeup line. v3: - Add Reviewed-By/Acked-Bys - Drop redundant else - Switch to GENMASK/decimal values for GPIO3 function defs v2: - Fix missing ; on bluetooth stanza in DTS - Add device/host wake GPIOs for Bluetooth device - Add omit-if-no-ref on the port E pinmux stanza - Rename axp20x_temp to pmic-temp - Add AXP209 GPIO3 support Jonathan McDowell (5): dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema pinctrl: axp209: Add support for GPIO3 on the AXP209 ARM: dts: sun5i: chip: Enable bluetooth ARM: dts: sun5i: Add port E pinmux settings for mmc2 ARM: dts: axp209: Add iio-hwmon node for internal temperature .../bindings/gpio/x-powers,axp209-gpio.yaml | 1 + arch/arm/boot/dts/axp209.dtsi | 7 ++++ arch/arm/boot/dts/sun5i-r8-chip.dts | 6 +++ arch/arm/boot/dts/sun5i.dtsi | 9 ++++ drivers/pinctrl/pinctrl-axp209.c | 42 +++++++++++++++++++ 5 files changed, 65 insertions(+) -- 2.39.2 ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell @ 2023-05-16 17:47 ` Jonathan McDowell 2023-05-22 7:37 ` Linus Walleij 2023-05-26 12:24 ` Bartosz Golaszewski 2023-05-16 17:47 ` [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell ` (4 subsequent siblings) 5 siblings, 2 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-16 17:47 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio The AXP209 has a 4th GPIO, so add it in preparation for support in the driver. Signed-off-by: Jonathan McDowell <noodles@earth.li> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> --- Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml index 31906c253940..1638cfe90f1c 100644 --- a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml @@ -44,6 +44,7 @@ patternProperties: - GPIO0 - GPIO1 - GPIO2 + - GPIO3 function: enum: -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema 2023-05-16 17:47 ` [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell @ 2023-05-22 7:37 ` Linus Walleij 2023-05-26 12:24 ` Bartosz Golaszewski 1 sibling, 0 replies; 44+ messages in thread From: Linus Walleij @ 2023-05-22 7:37 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Bartosz Golaszewski, Conor Dooley, andy.shevchenko, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio On Tue, May 16, 2023 at 7:47 PM Jonathan McDowell <noodles@earth.li> wrote: > The AXP209 has a 4th GPIO, so add it in preparation for support in the > driver. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> > Acked-by: Conor Dooley <conor.dooley@microchip.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema 2023-05-16 17:47 ` [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell 2023-05-22 7:37 ` Linus Walleij @ 2023-05-26 12:24 ` Bartosz Golaszewski 1 sibling, 0 replies; 44+ messages in thread From: Bartosz Golaszewski @ 2023-05-26 12:24 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Conor Dooley, andy.shevchenko, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio On Tue, May 16, 2023 at 7:47 PM Jonathan McDowell <noodles@earth.li> wrote: > > The AXP209 has a 4th GPIO, so add it in preparation for support in the > driver. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> > Acked-by: Conor Dooley <conor.dooley@microchip.com> > --- > Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml > index 31906c253940..1638cfe90f1c 100644 > --- a/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml > +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp209-gpio.yaml > @@ -44,6 +44,7 @@ patternProperties: > - GPIO0 > - GPIO1 > - GPIO2 > + - GPIO3 > > function: > enum: > -- > 2.39.2 > Applied, thanks! Bart ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-05-16 17:47 ` [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell @ 2023-05-16 17:47 ` Jonathan McDowell 2023-05-16 18:55 ` Andy Shevchenko 2023-05-18 21:21 ` Jernej Škrabec 2023-05-16 17:47 ` [PATCH v3 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell ` (3 subsequent siblings) 5 siblings, 2 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-16 17:47 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio The AXP209 device has a 4th GPIO which has a slightly different register setup, where the control + status bits are held in a single register rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. Signed-off-by: Jonathan McDowell <noodles@earth.li> --- drivers/pinctrl/pinctrl-axp209.c | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 0bc1b381a2b8..b3ba25435c34 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -30,6 +30,11 @@ #define AXP20X_GPIO_FUNCTION_OUT_HIGH 1 #define AXP20X_GPIO_FUNCTION_INPUT 2 +#define AXP20X_GPIO3_FUNCTIONS GENMASK(2, 1) +#define AXP20X_GPIO3_FUNCTION_OUT_LOW 0 +#define AXP20X_GPIO3_FUNCTION_OUT_HIGH 2 +#define AXP20X_GPIO3_FUNCTION_INPUT 4 + #define AXP20X_FUNC_GPIO_OUT 0 #define AXP20X_FUNC_GPIO_IN 1 #define AXP20X_FUNC_LDO 2 @@ -73,6 +78,7 @@ static const struct pinctrl_pin_desc axp209_pins[] = { PINCTRL_PIN(0, "GPIO0"), PINCTRL_PIN(1, "GPIO1"), PINCTRL_PIN(2, "GPIO2"), + PINCTRL_PIN(3, "GPIO3"), }; static const struct pinctrl_pin_desc axp22x_pins[] = { @@ -130,6 +136,14 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset) unsigned int val; int ret; + /* AXP209 has GPIO3 status sharing the settings register */ + if (offset == 3) { + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); + if (ret) + return ret; + return !!(val & BIT(0)); + } + ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val); if (ret) return ret; @@ -144,6 +158,17 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned int val; int reg, ret; + /* AXP209 GPIO3 settings have a different layout */ + if (offset == 3) { + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); + if (ret) + return ret; + if (val & AXP20X_GPIO3_FUNCTION_INPUT) + return GPIO_LINE_DIRECTION_IN; + + return GPIO_LINE_DIRECTION_OUT; + } + reg = axp20x_gpio_get_reg(offset); if (reg < 0) return reg; @@ -184,6 +209,15 @@ static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset, struct axp20x_pctl *pctl = gpiochip_get_data(chip); int reg; + /* AXP209 has GPIO3 status sharing the settings register */ + if (offset == 3) { + regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, + AXP20X_GPIO3_FUNCTIONS, + value ? AXP20X_GPIO3_FUNCTION_OUT_HIGH : + AXP20X_GPIO3_FUNCTION_OUT_LOW); + return; + } + reg = axp20x_gpio_get_reg(offset); if (reg < 0) return; @@ -200,6 +234,14 @@ static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset, struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); int reg; + /* AXP209 GPIO3 settings have a different layout */ + if (offset == 3) { + return regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, + AXP20X_GPIO3_FUNCTIONS, + config == AXP20X_MUX_GPIO_OUT ? AXP20X_GPIO3_FUNCTION_OUT_LOW : + AXP20X_GPIO3_FUNCTION_INPUT); + } + reg = axp20x_gpio_get_reg(offset); if (reg < 0) return reg; -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-16 17:47 ` [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell @ 2023-05-16 18:55 ` Andy Shevchenko 2023-05-18 21:21 ` Jernej Škrabec 1 sibling, 0 replies; 44+ messages in thread From: Andy Shevchenko @ 2023-05-16 18:55 UTC (permalink / raw) To: Jonathan McDowell Cc: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio On Tue, May 16, 2023 at 8:47 PM Jonathan McDowell <noodles@earth.li> wrote: > > The AXP209 device has a 4th GPIO which has a slightly different register > setup, where the control + status bits are held in a single register > rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. LGTM, Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Jonathan McDowell <noodles@earth.li> > --- > drivers/pinctrl/pinctrl-axp209.c | 42 ++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c > index 0bc1b381a2b8..b3ba25435c34 100644 > --- a/drivers/pinctrl/pinctrl-axp209.c > +++ b/drivers/pinctrl/pinctrl-axp209.c > @@ -30,6 +30,11 @@ > #define AXP20X_GPIO_FUNCTION_OUT_HIGH 1 > #define AXP20X_GPIO_FUNCTION_INPUT 2 > > +#define AXP20X_GPIO3_FUNCTIONS GENMASK(2, 1) > +#define AXP20X_GPIO3_FUNCTION_OUT_LOW 0 > +#define AXP20X_GPIO3_FUNCTION_OUT_HIGH 2 > +#define AXP20X_GPIO3_FUNCTION_INPUT 4 > + > #define AXP20X_FUNC_GPIO_OUT 0 > #define AXP20X_FUNC_GPIO_IN 1 > #define AXP20X_FUNC_LDO 2 > @@ -73,6 +78,7 @@ static const struct pinctrl_pin_desc axp209_pins[] = { > PINCTRL_PIN(0, "GPIO0"), > PINCTRL_PIN(1, "GPIO1"), > PINCTRL_PIN(2, "GPIO2"), > + PINCTRL_PIN(3, "GPIO3"), > }; > > static const struct pinctrl_pin_desc axp22x_pins[] = { > @@ -130,6 +136,14 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset) > unsigned int val; > int ret; > > + /* AXP209 has GPIO3 status sharing the settings register */ > + if (offset == 3) { > + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); > + if (ret) > + return ret; > + return !!(val & BIT(0)); > + } > + > ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val); > if (ret) > return ret; > @@ -144,6 +158,17 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip, > unsigned int val; > int reg, ret; > > + /* AXP209 GPIO3 settings have a different layout */ > + if (offset == 3) { > + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); > + if (ret) > + return ret; > + if (val & AXP20X_GPIO3_FUNCTION_INPUT) > + return GPIO_LINE_DIRECTION_IN; > + > + return GPIO_LINE_DIRECTION_OUT; > + } > + > reg = axp20x_gpio_get_reg(offset); > if (reg < 0) > return reg; > @@ -184,6 +209,15 @@ static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset, > struct axp20x_pctl *pctl = gpiochip_get_data(chip); > int reg; > > + /* AXP209 has GPIO3 status sharing the settings register */ > + if (offset == 3) { > + regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, > + AXP20X_GPIO3_FUNCTIONS, > + value ? AXP20X_GPIO3_FUNCTION_OUT_HIGH : > + AXP20X_GPIO3_FUNCTION_OUT_LOW); > + return; > + } > + > reg = axp20x_gpio_get_reg(offset); > if (reg < 0) > return; > @@ -200,6 +234,14 @@ static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset, > struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); > int reg; > > + /* AXP209 GPIO3 settings have a different layout */ > + if (offset == 3) { > + return regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, > + AXP20X_GPIO3_FUNCTIONS, > + config == AXP20X_MUX_GPIO_OUT ? AXP20X_GPIO3_FUNCTION_OUT_LOW : > + AXP20X_GPIO3_FUNCTION_INPUT); > + } > + > reg = axp20x_gpio_get_reg(offset); > if (reg < 0) > return reg; > -- > 2.39.2 > -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 2023-05-16 17:47 ` [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell 2023-05-16 18:55 ` Andy Shevchenko @ 2023-05-18 21:21 ` Jernej Škrabec 1 sibling, 0 replies; 44+ messages in thread From: Jernej Škrabec @ 2023-05-18 21:21 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko, Jonathan McDowell Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne torek, 16. maj 2023 ob 19:47:29 CEST je Jonathan McDowell napisal(a): > The AXP209 device has a 4th GPIO which has a slightly different register > setup, where the control + status bits are held in a single register > rather than sharing AXP20X_GPIO20_SS with GPIOs 0-2. > > Signed-off-by: Jonathan McDowell <noodles@earth.li> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej > --- > drivers/pinctrl/pinctrl-axp209.c | 42 ++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c > index 0bc1b381a2b8..b3ba25435c34 100644 > --- a/drivers/pinctrl/pinctrl-axp209.c > +++ b/drivers/pinctrl/pinctrl-axp209.c > @@ -30,6 +30,11 @@ > #define AXP20X_GPIO_FUNCTION_OUT_HIGH 1 > #define AXP20X_GPIO_FUNCTION_INPUT 2 > > +#define AXP20X_GPIO3_FUNCTIONS GENMASK(2, 1) > +#define AXP20X_GPIO3_FUNCTION_OUT_LOW 0 > +#define AXP20X_GPIO3_FUNCTION_OUT_HIGH 2 > +#define AXP20X_GPIO3_FUNCTION_INPUT 4 > + > #define AXP20X_FUNC_GPIO_OUT 0 > #define AXP20X_FUNC_GPIO_IN 1 > #define AXP20X_FUNC_LDO 2 > @@ -73,6 +78,7 @@ static const struct pinctrl_pin_desc axp209_pins[] = { > PINCTRL_PIN(0, "GPIO0"), > PINCTRL_PIN(1, "GPIO1"), > PINCTRL_PIN(2, "GPIO2"), > + PINCTRL_PIN(3, "GPIO3"), > }; > > static const struct pinctrl_pin_desc axp22x_pins[] = { > @@ -130,6 +136,14 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset) > unsigned int val; > int ret; > > + /* AXP209 has GPIO3 status sharing the settings register */ > + if (offset == 3) { > + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); > + if (ret) > + return ret; > + return !!(val & BIT(0)); > + } > + > ret = regmap_read(pctl->regmap, AXP20X_GPIO20_SS, &val); > if (ret) > return ret; > @@ -144,6 +158,17 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip, > unsigned int val; > int reg, ret; > > + /* AXP209 GPIO3 settings have a different layout */ > + if (offset == 3) { > + ret = regmap_read(pctl->regmap, AXP20X_GPIO3_CTRL, &val); > + if (ret) > + return ret; > + if (val & AXP20X_GPIO3_FUNCTION_INPUT) > + return GPIO_LINE_DIRECTION_IN; > + > + return GPIO_LINE_DIRECTION_OUT; > + } > + > reg = axp20x_gpio_get_reg(offset); > if (reg < 0) > return reg; > @@ -184,6 +209,15 @@ static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset, > struct axp20x_pctl *pctl = gpiochip_get_data(chip); > int reg; > > + /* AXP209 has GPIO3 status sharing the settings register */ > + if (offset == 3) { > + regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, > + AXP20X_GPIO3_FUNCTIONS, > + value ? AXP20X_GPIO3_FUNCTION_OUT_HIGH : > + AXP20X_GPIO3_FUNCTION_OUT_LOW); > + return; > + } > + > reg = axp20x_gpio_get_reg(offset); > if (reg < 0) > return; > @@ -200,6 +234,14 @@ static int axp20x_pmx_set(struct pinctrl_dev *pctldev, unsigned int offset, > struct axp20x_pctl *pctl = pinctrl_dev_get_drvdata(pctldev); > int reg; > > + /* AXP209 GPIO3 settings have a different layout */ > + if (offset == 3) { > + return regmap_update_bits(pctl->regmap, AXP20X_GPIO3_CTRL, > + AXP20X_GPIO3_FUNCTIONS, > + config == AXP20X_MUX_GPIO_OUT ? AXP20X_GPIO3_FUNCTION_OUT_LOW : > + AXP20X_GPIO3_FUNCTION_INPUT); > + } > + > reg = axp20x_gpio_get_reg(offset); > if (reg < 0) > return reg; > ^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH v3 3/5] ARM: dts: sun5i: chip: Enable bluetooth 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-05-16 17:47 ` [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell 2023-05-16 17:47 ` [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell @ 2023-05-16 17:47 ` Jonathan McDowell 2023-05-16 17:48 ` [PATCH v3 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell ` (2 subsequent siblings) 5 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-16 17:47 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio The C.H.I.P has an rtl8723bs device with the bluetooth interface hooked up on UART3. Support for this didn't exist in mainline when the DTS was initially added, but it does now, so enable it. Signed-off-by: Jonathan McDowell <noodles@earth.li> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> --- arch/arm/boot/dts/sun5i-r8-chip.dts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun5i-r8-chip.dts b/arch/arm/boot/dts/sun5i-r8-chip.dts index fd37bd1f3920..4192c23848c3 100644 --- a/arch/arm/boot/dts/sun5i-r8-chip.dts +++ b/arch/arm/boot/dts/sun5i-r8-chip.dts @@ -255,6 +255,12 @@ &uart3 { pinctrl-0 = <&uart3_pg_pins>, <&uart3_cts_rts_pg_pins>; status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723bs-bt"; + device-wake-gpios = <&axp_gpio 3 GPIO_ACTIVE_HIGH>; + host-wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ + }; }; &usb_otg { -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (2 preceding siblings ...) 2023-05-16 17:47 ` [PATCH v3 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell @ 2023-05-16 17:48 ` Jonathan McDowell 2023-05-16 17:48 ` [PATCH v3 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell 2023-05-31 21:20 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jernej Škrabec 5 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-16 17:48 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio These alternate pins for mmc2 are brought out to the 40 pin U14 header on the C.H.I.P and can be used to add an external MMC device with a 4 bit interface. See https://byteporter.com/ntc-chip-micro-sd-slot/ for further details on how. Signed-off-by: Jonathan McDowell <noodles@earth.li> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> --- arch/arm/boot/dts/sun5i.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi index 250d6b87ab4d..ab7f675aeec4 100644 --- a/arch/arm/boot/dts/sun5i.dtsi +++ b/arch/arm/boot/dts/sun5i.dtsi @@ -517,6 +517,15 @@ mmc2_4bit_pc_pins: mmc2-4bit-pc-pins { bias-pull-up; }; + /omit-if-no-ref/ + mmc2_4bit_pe_pins: mmc2-4bit-pe-pins { + pins = "PE4", "PE5", "PE6", "PE7", + "PE8", "PE9"; + function = "mmc2"; + drive-strength = <30>; + bias-pull-up; + }; + mmc2_8bit_pins: mmc2-8bit-pins { pins = "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH v3 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (3 preceding siblings ...) 2023-05-16 17:48 ` [PATCH v3 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell @ 2023-05-16 17:48 ` Jonathan McDowell 2023-05-31 21:20 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jernej Škrabec 5 siblings, 0 replies; 44+ messages in thread From: Jonathan McDowell @ 2023-05-16 17:48 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio This adds a DT node to hook up the internal temperature ADC to the iio-hwmon driver. The various voltage + current ADCs are consumed and exposed by their respective drivers, but this is not and is always available. Naming chosen to match the axp20x_ prefix the power sensors use. Signed-off-by: Jonathan McDowell <noodles@earth.li> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> --- arch/arm/boot/dts/axp209.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index ca240cd6f6c3..469d0f7d5185 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -48,6 +48,13 @@ * http://dl.linux-sunxi.org/AXP/AXP209%20Datasheet%20v1.0_cn.pdf */ +/ { + pmic-temp { + compatible = "iio-hwmon"; + io-channels = <&axp_adc 4>; /* Internal temperature */ + }; +}; + &axp209 { compatible = "x-powers,axp209"; interrupt-controller; -- 2.39.2 ^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH v3 0/5] Minor device-tree additions for C.H.I.P 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell ` (4 preceding siblings ...) 2023-05-16 17:48 ` [PATCH v3 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell @ 2023-05-31 21:20 ` Jernej Škrabec 5 siblings, 0 replies; 44+ messages in thread From: Jernej Škrabec @ 2023-05-31 21:20 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Chen-Yu Tsai, Samuel Holland, Linus Walleij, Bartosz Golaszewski, Conor Dooley, andy.shevchenko, Jonathan McDowell Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, linux-gpio Dne torek, 16. maj 2023 ob 19:46:55 CEST je Jonathan McDowell napisal(a): > This small patch series adds some improvements for the C.H.I.P DTS, > enabling bluetooth, exporting the PMIC temperature details via iio-hwmon > and finally adding the appropriate base pinmux info for an external MMC > card. As a pre-requisite for the Bluetooth it also adds support to the > AXP209 driver for GPIO3, which is the Bluetooth device wakeup line. > > v3: > - Add Reviewed-By/Acked-Bys > - Drop redundant else > - Switch to GENMASK/decimal values for GPIO3 function defs > v2: > - Fix missing ; on bluetooth stanza in DTS > - Add device/host wake GPIOs for Bluetooth device > - Add omit-if-no-ref on the port E pinmux stanza > - Rename axp20x_temp to pmic-temp > - Add AXP209 GPIO3 support > > Jonathan McDowell (5): > dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema > pinctrl: axp209: Add support for GPIO3 on the AXP209 > ARM: dts: sun5i: chip: Enable bluetooth > ARM: dts: sun5i: Add port E pinmux settings for mmc2 > ARM: dts: axp209: Add iio-hwmon node for internal temperature Patches 3-5 applied to sunxi tree. Thanks! Best regards, Jernej > > .../bindings/gpio/x-powers,axp209-gpio.yaml | 1 + > arch/arm/boot/dts/axp209.dtsi | 7 ++++ > arch/arm/boot/dts/sun5i-r8-chip.dts | 6 +++ > arch/arm/boot/dts/sun5i.dtsi | 9 ++++ > drivers/pinctrl/pinctrl-axp209.c | 42 +++++++++++++++++++ > 5 files changed, 65 insertions(+) > > ^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2023-06-01 8:06 UTC | newest] Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-04-15 17:45 [PATCH 0/3] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-04-15 17:46 ` [PATCH 1/3] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell 2023-04-15 20:36 ` kernel test robot 2023-04-16 0:24 ` Andre Przywara 2023-04-20 19:12 ` Jonathan McDowell 2023-04-21 1:43 ` Saravana Kannan 2023-04-21 8:28 ` Jonathan McDowell 2023-04-21 22:45 ` Saravana Kannan 2023-04-24 17:34 ` Jonathan McDowell 2023-05-01 21:12 ` Saravana Kannan 2023-05-10 11:34 ` Jonathan McDowell 2023-04-15 17:46 ` [PATCH 2/3] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell 2023-04-16 0:47 ` Andre Przywara 2023-04-20 19:13 ` Jonathan McDowell 2023-04-15 17:47 ` [PATCH 3/3] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell 2023-04-16 7:27 ` Krzysztof Kozlowski 2023-04-20 19:06 ` Jonathan McDowell 2023-05-10 12:00 ` [PATCH v2 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-05-10 12:01 ` [PATCH v2 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell 2023-05-11 15:41 ` Jernej Škrabec 2023-05-11 18:55 ` Conor Dooley 2023-05-10 12:01 ` [PATCH v2 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell 2023-05-10 14:15 ` andy.shevchenko 2023-05-29 9:51 ` Linus Walleij 2023-06-01 7:30 ` Jonathan McDowell 2023-05-10 12:01 ` [PATCH v2 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell 2023-05-11 15:41 ` Jernej Škrabec 2023-05-10 12:02 ` [PATCH v2 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell 2023-05-11 15:45 ` Jernej Škrabec 2023-05-10 12:02 ` [PATCH v2 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell 2023-05-11 16:11 ` Jernej Škrabec 2023-05-12 10:30 ` Jonathan McDowell 2023-05-12 16:37 ` Jernej Škrabec 2023-05-16 17:46 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jonathan McDowell 2023-05-16 17:47 ` [PATCH v3 1/5] dt-bindings: gpio: Add GPIO3 for AXP209 GPIO binding schema Jonathan McDowell 2023-05-22 7:37 ` Linus Walleij 2023-05-26 12:24 ` Bartosz Golaszewski 2023-05-16 17:47 ` [PATCH v3 2/5] pinctrl: axp209: Add support for GPIO3 on the AXP209 Jonathan McDowell 2023-05-16 18:55 ` Andy Shevchenko 2023-05-18 21:21 ` Jernej Škrabec 2023-05-16 17:47 ` [PATCH v3 3/5] ARM: dts: sun5i: chip: Enable bluetooth Jonathan McDowell 2023-05-16 17:48 ` [PATCH v3 4/5] ARM: dts: sun5i: Add port E pinmux settings for mmc2 Jonathan McDowell 2023-05-16 17:48 ` [PATCH v3 5/5] ARM: dts: axp209: Add iio-hwmon node for internal temperature Jonathan McDowell 2023-05-31 21:20 ` [PATCH v3 0/5] Minor device-tree additions for C.H.I.P Jernej Škrabec
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).