Skip to contentSkip to conversation

pinephone-pro: Fix I/O port voltage (GPIO3D4A is 1.8V)

PATCH In review Ondřej Jirman 3 participants 3 messages May 25, 2023 – Jun 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinephone-pro: Fix I/O port voltage (GPIO3D4A is 1.8V)

From: Ondrej Jirman <[email protected]>

This fixes access to camera sensor over I2C during probe time in the kernel. (Kernel will fix I/0 port voltage by itself, but the timing depends on probe order of the drivers, so the fix can come after the camera sensor driver already failed to probe.)

---
 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +4 -2
index eb639cd0d070..b6ccbb9c1c4b 100644
@@ -15,7 +15,8 @@
 #include <asm/arch-rockchip/misc.h>
 #include <power/regulator.h>
 
-#define GRF_IO_VSEL_BT565_SHIFT 0
+#define GRF_IO_VSEL_BT565_GPIO2AB 1
+#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2
 #define PMUGRF_CON0_VSEL_SHIFT 8
 
 #ifndef CONFIG_SPL_BUILD
@@ -48,7 +49,8 @@ static void setup_iodomain(void)
 	   syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
 
 	/* BT565 is in 1.8v domain */
-	rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
+	rk_setreg(&grf->io_vsel,
+		  GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
 
 	/* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
 	rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Ondrej,

    Thanks for your patch.

Quoted 9 lines · Ondřej Jirman

From: Ondrej Jirman <[email protected]>

This fixes access to camera sensor over I2C during probe time in the kernel. (Kernel will fix I/0 port voltage by itself, but the timing depends on probe order of the drivers, so the fix can come after the camera sensor driver already failed to probe.)

Thanks,
- Kever

Quoted 28 lines
---
  board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +4 -2
index eb639cd0d070..b6ccbb9c1c4b 100644
@@ -15,7 +15,8 @@
  #include <asm/arch-rockchip/misc.h>
  #include <power/regulator.h>
 
-#define GRF_IO_VSEL_BT565_SHIFT 0
+#define GRF_IO_VSEL_BT565_GPIO2AB 1
+#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2
  #define PMUGRF_CON0_VSEL_SHIFT 8
 
  #ifndef CONFIG_SPL_BUILD
@@ -48,7 +49,8 @@ static void setup_iodomain(void)
  	   syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
 
  	/* BT565 is in 1.8v domain */
-	rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
+	rk_setreg(&grf->io_vsel,
+		  GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
 
  	/* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
  	rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Ondřej Jirman
Quoted 9 lines · Ondřej Jirman

From: Ondrej Jirman <[email protected]>

This fixes access to camera sensor over I2C during probe time in the kernel. (Kernel will fix I/0 port voltage by itself, but the timing depends on probe order of the drivers, so the fix can come after the camera sensor driver already failed to probe.)

Quoted 32 lines
Cc Kever Yang <[email protected]>
---
 board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +4 -3
index eb639cd0d070..b6ccbb9c1c4b 100644
@@ -15,7 +15,8 @@
 #include <asm/arch-rockchip/misc.h>
 #include <power/regulator.h>
 
-#define GRF_IO_VSEL_BT565_SHIFT 0
+#define GRF_IO_VSEL_BT565_GPIO2AB 1
+#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2
 #define PMUGRF_CON0_VSEL_SHIFT 8
 
 #ifndef CONFIG_SPL_BUILD
@@ -48,7 +49,8 @@ static void setup_iodomain(void)
           syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
 
        /* BT565 is in 1.8v domain */
-       rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT);
+       rk_setreg(&grf->io_vsel,
+                 GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A);
 
        /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */
        rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT);
--

2.40.1