[PATCH 2/3] mfd: rk8xx-core: Configure `rk808-clkout2` function

Rudraksha Gupta via B4 Relay posted 3 patches 3 weeks, 6 days ago
[PATCH 2/3] mfd: rk8xx-core: Configure `rk808-clkout2` function
Posted by Rudraksha Gupta via B4 Relay 3 weeks, 6 days ago
From: Kamil Trzciński <ayufan@ayufan.eu>

While the Wifi and Bluetooth chip are defined in the Pinephone Pro's
DTS, it actually isn't able to be used. Let's define rk808-clkout2 so
that userspace can actually interact with Wifi and Bluetooth

Co-developed-by: Martijn Braam <martijn@brixit.nl>
Signed-off-by: Martijn Braam <martijn@brixit.nl>
Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 drivers/mfd/rk8xx-core.c  | 1 +
 include/linux/mfd/rk808.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
index def4587fdfb8..602218694334 100644
--- a/drivers/mfd/rk8xx-core.c
+++ b/drivers/mfd/rk8xx-core.c
@@ -282,6 +282,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = {
 	{ RK818_H5V_EN_REG,	  BIT(0),	    RK818_H5V_EN },
 	{ RK808_VB_MON_REG,	  MASK_ALL,	    VB_LO_ACT |
 						    VB_LO_SEL_3500MV },
+	{ RK808_CLK32OUT_REG, CLK32KOUT2_FUNC_MASK, CLK32KOUT2_FUNC },
 };
 
 static const struct regmap_irq rk805_irqs[] = {
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 28170ee08898..077fe2e15b78 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -934,6 +934,8 @@ enum rk806_dvs_mode {
 
 #define VOUT_LO_INT	BIT(0)
 #define CLK32KOUT2_EN	BIT(0)
+#define CLK32KOUT2_FUNC		(0 << 1)
+#define CLK32KOUT2_FUNC_MASK	BIT(1)
 
 #define TEMP105C			0x08
 #define TEMP115C			0x0c

-- 
2.52.0


Re: [PATCH 2/3] mfd: rk8xx-core: Configure `rk808-clkout2` function
Posted by Ondřej Jirman 3 weeks, 5 days ago
On Mon, Jan 12, 2026 at 10:42:25PM -0800, Rudraksha Gupta via B4 Relay wrote:
> From: Kamil Trzciński <ayufan@ayufan.eu>
> 
> While the Wifi and Bluetooth chip are defined in the Pinephone Pro's
> DTS, it actually isn't able to be used. Let's define rk808-clkout2 so
> that userspace can actually interact with Wifi and Bluetooth
> 
> Co-developed-by: Martijn Braam <martijn@brixit.nl>
> Signed-off-by: Martijn Braam <martijn@brixit.nl>
> Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
> Signed-off-by: Ondrej Jirman <megi@xff.cz>

Hi Rudraksha, I don't belong here. Semi-original patch from 5 yrs ago is here:
  
  https://codeberg.org/megi/linux/commit/75be96faf939504d0fd5112846e73e437573f716

thanks,
	o.

> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>  drivers/mfd/rk8xx-core.c  | 1 +
>  include/linux/mfd/rk808.h | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
> index def4587fdfb8..602218694334 100644
> --- a/drivers/mfd/rk8xx-core.c
> +++ b/drivers/mfd/rk8xx-core.c
> @@ -282,6 +282,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = {
>  	{ RK818_H5V_EN_REG,	  BIT(0),	    RK818_H5V_EN },
>  	{ RK808_VB_MON_REG,	  MASK_ALL,	    VB_LO_ACT |
>  						    VB_LO_SEL_3500MV },
> +	{ RK808_CLK32OUT_REG, CLK32KOUT2_FUNC_MASK, CLK32KOUT2_FUNC },
>  };
>  
>  static const struct regmap_irq rk805_irqs[] = {
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index 28170ee08898..077fe2e15b78 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -934,6 +934,8 @@ enum rk806_dvs_mode {
>  
>  #define VOUT_LO_INT	BIT(0)
>  #define CLK32KOUT2_EN	BIT(0)
> +#define CLK32KOUT2_FUNC		(0 << 1)
> +#define CLK32KOUT2_FUNC_MASK	BIT(1)
>  
>  #define TEMP105C			0x08
>  #define TEMP115C			0x0c
> 
> -- 
> 2.52.0
> 
> 
Re: [PATCH 2/3] mfd: rk8xx-core: Configure `rk808-clkout2` function
Posted by Lee Jones 3 weeks, 5 days ago
On Mon, 12 Jan 2026, Rudraksha Gupta via B4 Relay wrote:

> From: Kamil Trzciński <ayufan@ayufan.eu>
> 
> While the Wifi and Bluetooth chip are defined in the Pinephone Pro's
> DTS, it actually isn't able to be used. Let's define rk808-clkout2 so
> that userspace can actually interact with Wifi and Bluetooth
> 
> Co-developed-by: Martijn Braam <martijn@brixit.nl>
> Signed-off-by: Martijn Braam <martijn@brixit.nl>
> Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
> Signed-off-by: Ondrej Jirman <megi@xff.cz>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>

This is a bonkers amount of SoBs for a 3-line change.

What on earth is going on here?

> ---
>  drivers/mfd/rk8xx-core.c  | 1 +
>  include/linux/mfd/rk808.h | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
> index def4587fdfb8..602218694334 100644
> --- a/drivers/mfd/rk8xx-core.c
> +++ b/drivers/mfd/rk8xx-core.c
> @@ -282,6 +282,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = {
>  	{ RK818_H5V_EN_REG,	  BIT(0),	    RK818_H5V_EN },
>  	{ RK808_VB_MON_REG,	  MASK_ALL,	    VB_LO_ACT |
>  						    VB_LO_SEL_3500MV },
> +	{ RK808_CLK32OUT_REG, CLK32KOUT2_FUNC_MASK, CLK32KOUT2_FUNC },
>  };
>  
>  static const struct regmap_irq rk805_irqs[] = {
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index 28170ee08898..077fe2e15b78 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -934,6 +934,8 @@ enum rk806_dvs_mode {
>  
>  #define VOUT_LO_INT	BIT(0)
>  #define CLK32KOUT2_EN	BIT(0)
> +#define CLK32KOUT2_FUNC		(0 << 1)
> +#define CLK32KOUT2_FUNC_MASK	BIT(1)
>  
>  #define TEMP105C			0x08
>  #define TEMP115C			0x0c
> 
> -- 
> 2.52.0
> 
> 

-- 
Lee Jones [李琼斯]
Re: [PATCH 2/3] mfd: rk8xx-core: Configure `rk808-clkout2` function
Posted by Heiko Stübner 3 weeks, 5 days ago
Hi,

Am Dienstag, 13. Januar 2026, 07:42:25 Mitteleuropäische Normalzeit schrieb Rudraksha Gupta via B4 Relay:
> From: Kamil Trzciński <ayufan@ayufan.eu>
> 
> While the Wifi and Bluetooth chip are defined in the Pinephone Pro's
> DTS, it actually isn't able to be used. Let's define rk808-clkout2 so
> that userspace can actually interact with Wifi and Bluetooth

Needs of one special device don't really justify changing core drivers.
So this commit message definitly needs a more general description on
why this is needed.

> Co-developed-by: Martijn Braam <martijn@brixit.nl>
> Signed-off-by: Martijn Braam <martijn@brixit.nl>
> Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
> Signed-off-by: Ondrej Jirman <megi@xff.cz>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>  drivers/mfd/rk8xx-core.c  | 1 +
>  include/linux/mfd/rk808.h | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
> index def4587fdfb8..602218694334 100644
> --- a/drivers/mfd/rk8xx-core.c
> +++ b/drivers/mfd/rk8xx-core.c
> @@ -282,6 +282,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = {
>  	{ RK818_H5V_EN_REG,	  BIT(0),	    RK818_H5V_EN },
>  	{ RK808_VB_MON_REG,	  MASK_ALL,	    VB_LO_ACT |
>  						    VB_LO_SEL_3500MV },
> +	{ RK808_CLK32OUT_REG, CLK32KOUT2_FUNC_MASK, CLK32KOUT2_FUNC },

So now you're unconditionally enabling this clock output, without anybody
being able to turn it off again?

Please look at drivers/clk/clk-rk808.c and adapt it to handle the rk8xx
variants, as that provides a real clock driver that your wifi node can
use.


Heiko