Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419030 > unrolled thread

[PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver

Started byJohn Stultz <john.stultz@linaro.org>
First post2016-06-10 07:40 +0200
Last post2016-06-10 09:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver John Stultz <john.stultz@linaro.org> - 2016-06-10 07:40 +0200
    Re: [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver John Stultz <john.stultz@linaro.org> - 2016-06-10 09:40 +0200
    Re: [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC  driver Lee Jones <lee.jones@linaro.org> - 2016-06-10 09:40 +0200

#1419030 — [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver

FromJohn Stultz <john.stultz@linaro.org>
Date2016-06-10 07:40 +0200
Subject[PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver
Message-ID<rInkK-vX-15@gated-at.bofh.it>
Wire up the powerkey driver functionality for the hi655x PMIC.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: Feng Chen <puck.chen@hisilicon.com>
Cc: Wei Xu <xuwei5@hisilicon.com>
Cc: Guodong Xu <guodong.xu@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/mfd/hi655x-pmic.c | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c
index 68ab370..f3f6bfe2 100644
--- a/drivers/mfd/hi655x-pmic.c
+++ b/drivers/mfd/hi655x-pmic.c
@@ -24,10 +24,6 @@
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 
-static const struct mfd_cell hi655x_pmic_devs[] = {
-	{ .name = "hi655x-regulator", },
-};
-
 static const struct regmap_irq hi655x_irqs[] = {
 	{ .reg_offset = 0, .mask = OTMP_D1R_INT },
 	{ .reg_offset = 0, .mask = VSYS_2P5_R_INT },
@@ -56,6 +52,36 @@ static struct regmap_config hi655x_regmap_config = {
 	.max_register = HI655X_BUS_ADDR(0xFFF),
 };
 
+static struct resource pwrkey_resources[] = {
+	{
+		.name	= "down",
+		.start	= 6,
+		.end	= 6,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "up",
+		.start	= 5,
+		.end	= 5,
+		.flags	= IORESOURCE_IRQ,
+	}, {
+		.name	= "hold 4s",
+		.start	= 4,
+		.end	= 4,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static const struct mfd_cell hi655x_pmic_devs[] = {
+	{
+		.name		= "hi655x-regulator",
+	},
+	{
+		.name		= "hi65xx-powerkey",
+		.num_resources	= ARRAY_SIZE(pwrkey_resources),
+		.resources	= &pwrkey_resources[0],
+	},
+};
+
 static void hi655x_local_irq_clear(struct regmap *map)
 {
 	int i;
@@ -124,7 +150,8 @@ static int hi655x_pmic_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, pmic);
 
 	ret = mfd_add_devices(dev, PLATFORM_DEVID_AUTO, hi655x_pmic_devs,
-			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0, NULL);
+			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0,
+			      regmap_irq_get_domain(pmic->irq_data));
 	if (ret) {
 		dev_err(dev, "Failed to register device %d\n", ret);
 		regmap_del_irq_chip(gpio_to_irq(pmic->gpio), pmic->irq_data);
-- 
1.9.1

[toc] | [next] | [standalone]


#1419101

FromJohn Stultz <john.stultz@linaro.org>
Date2016-06-10 09:40 +0200
Message-ID<rIpcT-1FF-35@gated-at.bofh.it>
In reply to#1419030
On Fri, Jun 10, 2016 at 12:32 AM, Lee Jones <lee.jones@linaro.org> wrote:
> On Thu, 09 Jun 2016, John Stultz wrote:
>
>> +static struct resource pwrkey_resources[] = {
>> +     {
>> +             .name   = "down",
>> +             .start  = 6,
>> +             .end    = 6,
>> +             .flags  = IORESOURCE_IRQ,
>> +     }, {
>> +             .name   = "up",
>> +             .start  = 5,
>> +             .end    = 5,
>> +             .flags  = IORESOURCE_IRQ,
>> +     }, {
>> +             .name   = "hold 4s",
>> +             .start  = 4,
>> +             .end    = 4,
>> +             .flags  = IORESOURCE_IRQ,
>> +     },
>> +};
>
> No idea what 4, 5 and 6 mean.  Please define them.

Fair enough. It already defines PWRON_D4SR_INT, PWRON_D20F_INT and
PWRON_D20R_INT, but those are unfortunately mask values. I'll add a
patch to rename those to be clearly mask values and generate them from
a proper define value as well.

>> +static const struct mfd_cell hi655x_pmic_devs[] = {
>> +     {
>> +             .name           = "hi655x-regulator",
>> +     },
>> +     {
>> +             .name           = "hi65xx-powerkey",
>> +             .num_resources  = ARRAY_SIZE(pwrkey_resources),
>> +             .resources      = &pwrkey_resources[0],
>> +     },
>> +};
>
> Nit: Place the -regulator entry at the bottom and turn it into a one
> liner:
>
>         { .name         = "hi655x-regulator", },

Sure.  Will do!

Thanks for the feedback!
-john

[toc] | [prev] | [next] | [standalone]


#1419103 — Re: [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver

FromLee Jones <lee.jones@linaro.org>
Date2016-06-10 09:40 +0200
SubjectRe: [PATCH 3/3] mfd: hi655x-pmic: Add powerkey device to hi655x PMIC driver
Message-ID<rIpcT-1FF-37@gated-at.bofh.it>
In reply to#1419030
On Thu, 09 Jun 2016, John Stultz wrote:

> Wire up the powerkey driver functionality for the hi655x PMIC.
> 
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
> Cc: Feng Chen <puck.chen@hisilicon.com>
> Cc: Wei Xu <xuwei5@hisilicon.com>
> Cc: Guodong Xu <guodong.xu@linaro.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  drivers/mfd/hi655x-pmic.c | 37 ++++++++++++++++++++++++++++++++-----
>  1 file changed, 32 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c
> index 68ab370..f3f6bfe2 100644
> --- a/drivers/mfd/hi655x-pmic.c
> +++ b/drivers/mfd/hi655x-pmic.c
> @@ -24,10 +24,6 @@
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  
> -static const struct mfd_cell hi655x_pmic_devs[] = {
> -	{ .name = "hi655x-regulator", },
> -};
> -
>  static const struct regmap_irq hi655x_irqs[] = {
>  	{ .reg_offset = 0, .mask = OTMP_D1R_INT },
>  	{ .reg_offset = 0, .mask = VSYS_2P5_R_INT },
> @@ -56,6 +52,36 @@ static struct regmap_config hi655x_regmap_config = {
>  	.max_register = HI655X_BUS_ADDR(0xFFF),
>  };
>  
> +static struct resource pwrkey_resources[] = {
> +	{
> +		.name	= "down",
> +		.start	= 6,
> +		.end	= 6,
> +		.flags	= IORESOURCE_IRQ,
> +	}, {
> +		.name	= "up",
> +		.start	= 5,
> +		.end	= 5,
> +		.flags	= IORESOURCE_IRQ,
> +	}, {
> +		.name	= "hold 4s",
> +		.start	= 4,
> +		.end	= 4,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +};

No idea what 4, 5 and 6 mean.  Please define them.

> +static const struct mfd_cell hi655x_pmic_devs[] = {
> +	{
> +		.name		= "hi655x-regulator",
> +	},
> +	{
> +		.name		= "hi65xx-powerkey",
> +		.num_resources	= ARRAY_SIZE(pwrkey_resources),
> +		.resources	= &pwrkey_resources[0],
> +	},
> +};

Nit: Place the -regulator entry at the bottom and turn it into a one
liner:

	{ .name		= "hi655x-regulator", },


>  static void hi655x_local_irq_clear(struct regmap *map)
>  {
>  	int i;
> @@ -124,7 +150,8 @@ static int hi655x_pmic_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, pmic);
>  
>  	ret = mfd_add_devices(dev, PLATFORM_DEVID_AUTO, hi655x_pmic_devs,
> -			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0, NULL);
> +			      ARRAY_SIZE(hi655x_pmic_devs), NULL, 0,
> +			      regmap_irq_get_domain(pmic->irq_data));
>  	if (ret) {
>  		dev_err(dev, "Failed to register device %d\n", ret);
>  		regmap_del_irq_chip(gpio_to_irq(pmic->gpio), pmic->irq_data);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web