Skip to contentSkip to conversation

mfd: rk808: fix rk818 ID template

PATCH Applied Heiko Stuebner 2 participants 7 messages Sep 17, 2019 – Oct 4, 2019

Subsystems (3)
lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

PATCH 1/4 mfd: rk808: fix rk818 ID template

From: Daniel Schultz <[email protected]>

The Rockchip PMIC driver can automatically detect connected component versions by reading the ID_MSB and ID_LSB registers. The probe function will always fail with RK818 PMICs because the ID_MSK is 0xFFF0 and the RK818 template ID is 0x8181.

This patch changes this value to 0x8180.

Fixes 9d6105e19f61 ("mfd: rk808: Fix up the chip id get failed")
Cc Elaine Zhang <[email protected]>
Cc Joseph Chen <[email protected]>
[resend as it seems to have dropped on the floor]
---
 include/linux/mfd/rk808.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mfd/rk808.h +1 -1
index 7cfd2b0504df..a59bf323f713 100644
@@ -610,7 +610,7 @@ enum {
 	RK808_ID = 0x0000,
 	RK809_ID = 0x8090,
 	RK817_ID = 0x8170,
-	RK818_ID = 0x8181,
+	RK818_ID = 0x8180,
 };
 
 struct rk808 {
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH 2/4 mfd: rk808: fix rk817 powerkey integration

The pwrkey integration seems to stem from the vendor kernel, as the compatible is wrong and also the order of key-irqs is swapped.

So fix these issues to make the pwrkey on rk817 actually work.

---
 drivers/mfd/rk808.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/mfd/rk808.c +3 -11
index 050478cabc95..966841744ee6 100644
@@ -121,16 +121,8 @@ static struct resource rk817_rtc_resources[] = {
 };
 
 static struct resource rk805_key_resources[] = {
-	{
-		.start  = RK805_IRQ_PWRON_FALL,
-		.end    = RK805_IRQ_PWRON_FALL,
-		.flags  = IORESOURCE_IRQ,
-	},
-	{
-		.start  = RK805_IRQ_PWRON_RISE,
-		.end    = RK805_IRQ_PWRON_RISE,
-		.flags  = IORESOURCE_IRQ,
-	}
+	DEFINE_RES_IRQ(RK805_IRQ_PWRON_RISE),
+	DEFINE_RES_IRQ(RK805_IRQ_PWRON_FALL),
 };
 
 static struct resource rk817_pwrkey_resources[] = {
@@ -167,7 +159,7 @@ static const struct mfd_cell rk817s[] = {
 	{ .name = "rk808-clkout",},
 	{ .name = "rk808-regulator",},
 	{
-		.name = "rk8xx-pwrkey",
+		.name = "rk805-pwrkey",
 		.num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
 		.resources = &rk817_pwrkey_resources[0],
 	},
Signature · 1 line
2.20.1
Applied
#2 lore raw

Re: [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration

Quoted 9 lines · Heiko Stuebner

The pwrkey integration seems to stem from the vendor kernel, as the compatible is wrong and also the order of key-irqs is swapped.

So fix these issues to make the pwrkey on rk817 actually work.

---
 drivers/mfd/rk808.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
author maintainer
#3 lore raw

PATCH 3/4 mfd: rk808: set rk817 interrupt polarity to low

In reply to Heiko Stuebner

All other rk8xx operate with the polarity on low and even the old submitted devicetree snippet for the px30-evb declared the irq as low. So bring the rk817 preset in line with this, as there is really no reason for it to be the only with with a high polarity.

The rk809/rk817 hasn't been added to any devicetrees so far, so this won't break anything.

---
 drivers/mfd/rk808.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/rk808.c +1 -1
index 966841744ee6..c0e5e921766d 100644
@@ -207,7 +207,7 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = {
 
 static const struct rk808_reg_data rk817_pre_init_reg[] = {
 	{RK817_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
-	{RK817_GPIO_INT_CFG, RK817_INT_POL_MSK, RK817_INT_POL_H},
+	{RK817_GPIO_INT_CFG, RK817_INT_POL_MSK, RK817_INT_POL_L},
 	{RK817_SYS_CFG(1), RK817_HOTDIE_TEMP_MSK | RK817_TSD_TEMP_MSK,
 					   RK817_HOTDIE_105 | RK817_TSD_140},
 };
Signature · 1 line
2.20.1
author maintainer
#4 lore raw

PATCH 4/4 mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq

In reply to Heiko Stuebner

Do not open code the definition, instead use the nice DEFINE_RES_IRQ macro for it.

---
 drivers/mfd/rk808.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/mfd/rk808.c +1 -5
index c0e5e921766d..a69a6742ecdc 100644
@@ -109,11 +109,7 @@ static const struct regmap_config rk817_regmap_config = {
 };
 
 static struct resource rtc_resources[] = {
-	{
-		.start  = RK808_IRQ_RTC_ALARM,
-		.end    = RK808_IRQ_RTC_ALARM,
-		.flags  = IORESOURCE_IRQ,
-	}
+	DEFINE_RES_IRQ(RK808_IRQ_RTC_ALARM),
 };
 
 static struct resource rk817_rtc_resources[] = {
Signature · 1 line
2.20.1
Applied
#5 lore raw

Re: [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq

Quoted 7 lines · Heiko Stuebner

Do not open code the definition, instead use the nice DEFINE_RES_IRQ macro for it.

---
 drivers/mfd/rk808.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Applied
#6 lore raw
In reply to Heiko Stuebner
Quoted 17 lines · Heiko Stuebner

From: Daniel Schultz <[email protected]>

The Rockchip PMIC driver can automatically detect connected component versions by reading the ID_MSB and ID_LSB registers. The probe function will always fail with RK818 PMICs because the ID_MSK is 0xFFF0 and the RK818 template ID is 0x8181.

This patch changes this value to 0x8180.

Fixes 9d6105e19f61 ("mfd: rk808: Fix up the chip id get failed")
Cc Elaine Zhang <[email protected]>
Cc Joseph Chen <[email protected]>
[resend as it seems to have dropped on the floor]
Quoted 3 lines
---
 include/linux/mfd/rk808.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog