linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] mfd: rk808: fix rk818 ID template
@ 2019-09-17  8:12 Heiko Stuebner
  2019-09-17  8:12 ` [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration Heiko Stuebner
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Heiko Stuebner @ 2019-09-17  8:12 UTC (permalink / raw)
  To: lee.jones
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner,
	tony.xie, stable, Elaine Zhang, Joseph Chen, Heiko Stuebner

From: Daniel Schultz <d.schultz@phytec.de>

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: stable@vger.kernel.org
Cc: Elaine Zhang <zhangqing@rock-chips.com>
Cc: Joseph Chen <chenjh@rock-chips.com>
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
[resend as it seems to have dropped on the floor]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 include/linux/mfd/rk808.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 7cfd2b0504df..a59bf323f713 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -610,7 +610,7 @@ enum {
 	RK808_ID = 0x0000,
 	RK809_ID = 0x8090,
 	RK817_ID = 0x8170,
-	RK818_ID = 0x8181,
+	RK818_ID = 0x8180,
 };
 
 struct rk808 {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration
  2019-09-17  8:12 [PATCH 1/4] mfd: rk808: fix rk818 ID template Heiko Stuebner
@ 2019-09-17  8:12 ` Heiko Stuebner
  2019-10-04 12:05   ` Lee Jones
  2019-09-17  8:12 ` [PATCH 3/4] mfd: rk808: set rk817 interrupt polarity to low Heiko Stuebner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Heiko Stuebner @ 2019-09-17  8:12 UTC (permalink / raw)
  To: lee.jones
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner,
	tony.xie, 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.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mfd/rk808.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 050478cabc95..966841744ee6 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -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],
 	},
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] mfd: rk808: set rk817 interrupt polarity to low
  2019-09-17  8:12 [PATCH 1/4] mfd: rk808: fix rk818 ID template Heiko Stuebner
  2019-09-17  8:12 ` [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration Heiko Stuebner
@ 2019-09-17  8:12 ` Heiko Stuebner
  2019-09-17  8:12 ` [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq Heiko Stuebner
  2019-10-04 11:55 ` [PATCH 1/4] mfd: rk808: fix rk818 ID template Lee Jones
  3 siblings, 0 replies; 7+ messages in thread
From: Heiko Stuebner @ 2019-09-17  8:12 UTC (permalink / raw)
  To: lee.jones
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner,
	tony.xie, 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.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mfd/rk808.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 966841744ee6..c0e5e921766d 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -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},
 };
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq
  2019-09-17  8:12 [PATCH 1/4] mfd: rk808: fix rk818 ID template Heiko Stuebner
  2019-09-17  8:12 ` [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration Heiko Stuebner
  2019-09-17  8:12 ` [PATCH 3/4] mfd: rk808: set rk817 interrupt polarity to low Heiko Stuebner
@ 2019-09-17  8:12 ` Heiko Stuebner
  2019-10-04 12:06   ` Lee Jones
  2019-10-04 11:55 ` [PATCH 1/4] mfd: rk808: fix rk818 ID template Lee Jones
  3 siblings, 1 reply; 7+ messages in thread
From: Heiko Stuebner @ 2019-09-17  8:12 UTC (permalink / raw)
  To: lee.jones
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner,
	tony.xie, Heiko Stuebner

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

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/mfd/rk808.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index c0e5e921766d..a69a6742ecdc 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -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[] = {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] mfd: rk808: fix rk818 ID template
  2019-09-17  8:12 [PATCH 1/4] mfd: rk808: fix rk818 ID template Heiko Stuebner
                   ` (2 preceding siblings ...)
  2019-09-17  8:12 ` [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq Heiko Stuebner
@ 2019-10-04 11:55 ` Lee Jones
  3 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2019-10-04 11:55 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner,
	tony.xie, stable, Elaine Zhang, Joseph Chen

On Tue, 17 Sep 2019, Heiko Stuebner wrote:

> From: Daniel Schultz <d.schultz@phytec.de>
> 
> 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: stable@vger.kernel.org
> Cc: Elaine Zhang <zhangqing@rock-chips.com>
> Cc: Joseph Chen <chenjh@rock-chips.com>
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> [resend as it seems to have dropped on the floor]
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  include/linux/mfd/rk808.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration
  2019-09-17  8:12 ` [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration Heiko Stuebner
@ 2019-10-04 12:05   ` Lee Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2019-10-04 12:05 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner, tony.xie

On Tue, 17 Sep 2019, Heiko Stuebner wrote:

> 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.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/mfd/rk808.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)

Applied, thanks.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq
  2019-09-17  8:12 ` [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq Heiko Stuebner
@ 2019-10-04 12:06   ` Lee Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2019-10-04 12:06 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: linux-kernel, d.schultz, linux-rockchip, christoph.muellner, tony.xie

On Tue, 17 Sep 2019, Heiko Stuebner wrote:

> Do not open code the definition, instead use the nice DEFINE_RES_IRQ
> macro for it.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/mfd/rk808.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Applied, thanks.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-04 12:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17  8:12 [PATCH 1/4] mfd: rk808: fix rk818 ID template Heiko Stuebner
2019-09-17  8:12 ` [PATCH 2/4] mfd: rk808: fix rk817 powerkey integration Heiko Stuebner
2019-10-04 12:05   ` Lee Jones
2019-09-17  8:12 ` [PATCH 3/4] mfd: rk808: set rk817 interrupt polarity to low Heiko Stuebner
2019-09-17  8:12 ` [PATCH 4/4] mfd: rk808: use DEFINE_RES_IRQ for rk808 rtc alarm irq Heiko Stuebner
2019-10-04 12:06   ` Lee Jones
2019-10-04 11:55 ` [PATCH 1/4] mfd: rk808: fix rk818 ID template Lee Jones

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).