[linux-sunxi] Re: [PATCH v2 2/4] pinctrl: sunxi: h6-r: Add s_rsb pin functions

2021-01-05 Thread Chen-Yu Tsai
On Wed, Jan 6, 2021 at 6:35 AM Linus Walleij  wrote:
>
> On Sun, Jan 3, 2021 at 11:00 AM Samuel Holland  wrote:
>
> > As there is an RSB controller in the H6 SoC, there should be some pin
> > configuration for it. While no such configuration is documented, the
> > "s_i2c" pins are suspiciously on the "alternate" function 3, with no
> > primary function 2 given. This suggests the primary function for these
> > pins is actually RSB, and that is indeed the case.
> >
> > Add the "s_rsb" pin functions so the RSB controller can be used.
> >
> > Signed-off-by: Samuel Holland 
>
> Is it OK if I just apply this patch to the pinctrl tree?

Please do.

Thanks
ChenYu

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CAGb2v64MmtmpYiLjV_3H_K3i9FVEqmj2jp02HD1FBVzqK1N%3Deg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 01/17] sunxi: Add support for AXP305 PMIC

2021-01-05 Thread Jaehoon Chung
Hi Jernej

On 1/3/21 6:26 PM, Jernej Skrabec wrote:
> This PMIC can be found on H616 boards and it's very similar to AXP805
> and AXP806.

Is there any plan to cleanup codes?

> 
> Signed-off-by: Jernej Skrabec 
> ---
>  arch/arm/mach-sunxi/pmic_bus.c |  6 +++
>  board/sunxi/board.c| 10 +++--
>  drivers/power/Kconfig  | 13 +-
>  drivers/power/Makefile |  1 +
>  drivers/power/axp305.c | 80 ++
>  include/axp305.h   | 17 
>  include/axp_pmic.h |  3 ++
>  7 files changed, 126 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/power/axp305.c
>  create mode 100644 include/axp305.h
> 
> diff --git a/arch/arm/mach-sunxi/pmic_bus.c b/arch/arm/mach-sunxi/pmic_bus.c
> index dea42de833f1..0394ce856448 100644
> --- a/arch/arm/mach-sunxi/pmic_bus.c
> +++ b/arch/arm/mach-sunxi/pmic_bus.c
> @@ -18,6 +18,8 @@
>  
>  #define AXP209_I2C_ADDR  0x34
>  
> +#define AXP305_I2C_ADDR  0x36
> +
>  #define AXP221_CHIP_ADDR 0x68
>  #define AXP221_CTRL_ADDR 0x3e
>  #define AXP221_INIT_DATA 0x3e
> @@ -64,6 +66,8 @@ int pmic_bus_read(u8 reg, u8 *data)
>   return i2c_read(AXP152_I2C_ADDR, reg, 1, data, 1);
>  #elif defined CONFIG_AXP209_POWER
>   return i2c_read(AXP209_I2C_ADDR, reg, 1, data, 1);
> +#elif defined CONFIG_AXP305_POWER
> + return i2c_read(AXP305_I2C_ADDR, reg, 1, data, 1);
>  #elif defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined 
> CONFIG_AXP818_POWER
>  # ifdef CONFIG_MACH_SUN6I
>   return p2wi_read(reg, data);
> @@ -81,6 +85,8 @@ int pmic_bus_write(u8 reg, u8 data)
>   return i2c_write(AXP152_I2C_ADDR, reg, 1, , 1);
>  #elif defined CONFIG_AXP209_POWER
>   return i2c_write(AXP209_I2C_ADDR, reg, 1, , 1);
> +#elif defined CONFIG_AXP305_POWER
> + return i2c_write(AXP305_I2C_ADDR, reg, 1, , 1);
>  #elif defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || defined 
> CONFIG_AXP818_POWER
>  # ifdef CONFIG_MACH_SUN6I
>   return p2wi_write(reg, data);
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 708a27ed78e9..54ff9bc92396 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -634,16 +634,18 @@ void sunxi_board_init(void)
>  #endif
>  
>  #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
> - defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
> - defined CONFIG_AXP818_POWER
> + defined CONFIG_AXP221_POWER || defined CONFIG_AXP305_POWER || \
> + defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER
>   power_failed = axp_init();
>  
>  #if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
>   defined CONFIG_AXP818_POWER
>   power_failed |= axp_set_dcdc1(CONFIG_AXP_DCDC1_VOLT);
>  #endif
> +#if !defined(CONFIG_AXP305_POWER)
>   power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
>   power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
> +#endif
>  #if !defined(CONFIG_AXP209_POWER) && !defined(CONFIG_AXP818_POWER)
>   power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
>  #endif
> @@ -656,8 +658,10 @@ void sunxi_board_init(void)
>   defined CONFIG_AXP818_POWER
>   power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
>  #endif
> +#if !defined(CONFIG_AXP305_POWER)
>   power_failed |= axp_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
> -#if !defined(CONFIG_AXP152_POWER)
> +#endif
> +#if !defined(CONFIG_AXP152_POWER) && !defined(CONFIG_AXP305_POWER)
>   power_failed |= axp_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
>  #endif
>  #ifdef CONFIG_AXP209_POWER
> diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
> index 02050f6f3569..d17cf2d9112a 100644
> --- a/drivers/power/Kconfig
> +++ b/drivers/power/Kconfig
> @@ -48,6 +48,15 @@ config AXP221_POWER
>   Select this to enable support for the axp221/axp223 pmic found on most
>   A23 and A31 boards.
>  
> +config AXP305_POWER
> + bool "axp305 pmic support"
> + depends on MACH_SUN50I_H616
> + select AXP_PMIC_BUS
> + select CMD_POWEROFF
> + ---help---
> + Select this to enable support for the axp305 pmic found on most
> + H616 boards.
> +
>  config AXP809_POWER
>   bool "axp809 pmic support"
>   depends on MACH_SUN9I
> @@ -127,11 +136,12 @@ config AXP_DCDC3_VOLT
>  
>  config AXP_DCDC4_VOLT
>   int "axp pmic dcdc4 voltage"
> - depends on AXP152_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER
> + depends on AXP152_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER 
> || AXP305_POWER
>   default 1250 if AXP152_POWER
>   default 1200 if MACH_SUN6I
>   default 0 if MACH_SUN8I
>   default 900 if MACH_SUN9I
> + default 1500 if AXP305_POWER
>   ---help---
>   Set the voltage (mV) to program the axp pmic dcdc4 at, set to 0 to
>   disable dcdc4.
> @@ -140,6 +150,7 @@ config AXP_DCDC4_VOLT
>   On A23 / A33 boards dcdc4 is unused 

[linux-sunxi] Re: [PATCH v2 2/4] pinctrl: sunxi: h6-r: Add s_rsb pin functions

2021-01-05 Thread Linus Walleij
On Sun, Jan 3, 2021 at 11:00 AM Samuel Holland  wrote:

> As there is an RSB controller in the H6 SoC, there should be some pin
> configuration for it. While no such configuration is documented, the
> "s_i2c" pins are suspiciously on the "alternate" function 3, with no
> primary function 2 given. This suggests the primary function for these
> pins is actually RSB, and that is indeed the case.
>
> Add the "s_rsb" pin functions so the RSB controller can be used.
>
> Signed-off-by: Samuel Holland 

Is it OK if I just apply this patch to the pinctrl tree?

Yours,
Linus Walleij

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CACRpkdZbNUxizfV5Oo8F8b0bsjNcBF6JfP%3DufykNLeqErvU-ug%40mail.gmail.com.


Re: [linux-sunxi] LRADC on A20

2021-01-05 Thread Nazım Gediz AYDINDOĞMUŞ
On 5.01.2021 12:30, Sertac Tüllük wrote:
> I wish to add my two-cents:
> 
> There is a way to check if the DTB / DTBO is really recognised / in-use 
> by kernel:
> 
> https://unix.stackexchange.com/questions/265890/is-it-possible-to-get-the-information-for-a-device-tree-using-sys-of-a-running

Today I learned... That's really good to know. So I've tried it. 
Apparently there's a directory (or a node? perhaps a tree?) for LRADC. 
Full path for it is:
|/proc/device-tree/soc/lradc@1c22800|

"ls" yields the following result:
|# ls /proc/device-tree/soc/lradc@1c22800/
button-1000  button-200  interrupts  reg vref-supply
button-1200  compatible  namestatus
#|

An even better thing for Paolo is that it would be guaranteed to know 
that if an overlay file is actually loaded. I've simple tweaked "status" 
property of the DTS and it's really easy to check like this.

|# cat /proc/device-tree/soc/lradc@1c22800/status
disabled

# cat /proc/device-tree/soc/lradc@1c22800/status
okay|

Apparently most of the files contain binary data, and I've used hexdump 
to view them, fyi.

Thanks, by the way. I hope it'd also help Paolo :)

> I don't know if this is really valid for LRADC driver, but one can 
> basically see like:
> 
> |sudo apt-get install device-tree-compiler dtc -I fs -O dts 
> /sys/firmware/devicetree/base|
> -- 
> Sertac TULLUK
> Electronics Engineer
> +90 532 5683928

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/799c6d21064543f8a2d171314c4afc1b%40genemek.com.


Re: [linux-sunxi] LRADC on A20

2021-01-05 Thread Sertac Tüllük
I wish to add my two-cents:

There is a way to check if the DTB / DTBO is really recognised / in-use by
kernel:

https://unix.stackexchange.com/questions/265890/is-it-possible-to-get-the-information-for-a-device-tree-using-sys-of-a-running

I don't know if this is really valid for LRADC driver, but one can
basically see like:

sudo apt-get install device-tree-compiler
dtc -I fs -O dts /sys/firmware/devicetree/base


Nazım Gediz AYDINDOĞMUŞ , 5 Oca 2021 Sal,
10:02 tarihinde şunu yazdı:

> On 4.01.2021 18:16, Ing. Paolo Cremonese wrote:
> > Hello Gediz,
> > thank you for your kind reply.
> > in attachment the files describing the device tree.
> > lradc is noted in the .dtsi and is disabled for default: to enable it
> > I'm using the overlay lradc_enable.dtbo (the source is lradc-enable.dts)
> > the dmesg and lsmod outputs are in the related .txt
> > Thank you again for your time.
> > Best regards,
> > Paolo Cremonese
>
> You're welcome.
>
> I did not see any obvious warning/error in dmesg output. I'm not very
> familiar with DTBO files but compared "lradc-enable.dts" to valid ones
> and it looks okay. But I'd still somehow check if overlay is
> recognized/loaded properly. That's not your case but, even if module is
> built in to the kernel, it obviously does not start with a missing lradc
> node.
>
> I've set LRADC node status to "disabled" in the DTS to test it and there
> were no complaints about LRADC in the dmesg. Of course, I could not see
> the device under "/dev/input/eventX" anymore using "evtest" after
> disabling it.
>
> If you have compiled the kernel yourself, I'd recommend to check if
> CONFIG_KEYBOARD_SUN4I_LRADC is enabled. Otherwise, looking at
> "/proc/configz.gz" may help.
>
> I've tested the following on my device which has an A13. Their LRADC is
> probably identical. Maybe the output may help as a reference.
>
> # grep lradc /lib/modules/5.10.1/modules.builtin
> kernel/drivers/input/keyboard/sun4i-lradc-keys.ko
>
> # dmesg | grep lradc
> [1.597213] input: 1c22800.lradc as
> /devices/platform/soc/1c22800.lradc/input/input0
>
> Regards,
> Gediz
>
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi+unsubscr...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/linux-sunxi/f9d9406e3e7b4c74819adfc2d97b7927%40genemek.com
> .
>


-- 
Sertac TULLUK
Electronics Engineer
+90 532 5683928

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/CANUFAR%2B5svOpYz6LHnKyQjMb6BUuicQP9Bi5-EQWz%2BBe_Exkjw%40mail.gmail.com.