Re: [PATCH 4/9] mfd: palmas: Add tps65917 support

2014-06-17 Thread Lee Jones
 Add tps65917 PMIC support. tps65917 is a subset of palmas PMIC.
 Some of the register definitions and the interrupt mappings
 are different.
 
 Signed-off-by: Keerthy j-keer...@ti.com
 ---
  drivers/mfd/palmas.c |  176 
 --
  1 file changed, 171 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
 index d280d78..485d755 100644
 --- a/drivers/mfd/palmas.c
 +++ b/drivers/mfd/palmas.c

[...]

 +struct palmas_driver_data {
 + unsigned int *features;
 + struct regmap_irq_chip *irq_chip;
 +};
 +
 +static struct palmas_driver_data palmas_data = {
 + .features = palmas_features,
 + .irq_chip = palmas_irq_chip,
 +};
 +
 +static struct palmas_driver_data tps659038_data = {
 + .features = tps659038_features,
 + .irq_chip = palmas_irq_chip,
 +};
 +
 +static struct palmas_driver_data tps65917_data = {
 + .features = tps659038_features,
 + .irq_chip = tps65917_irq_chip,
 +};
 +

[...]

 @@ -375,6 +539,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
  {
   struct palmas *palmas;
   struct palmas_platform_data *pdata;
 + struct palmas_driver_data *driver_data;
   struct device_node *node = i2c-dev.of_node;
   int ret = 0, i;
   unsigned int reg, addr, *features;
 @@ -408,7 +573,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
   if (!match)
   return -ENODATA;
  
 - features = (unsigned int *)match-data;
 + driver_data = (struct palmas_driver_data *)match-data;
 + features = (unsigned int *)driver_data-features;
   palmas-features = *features;

Couple of things a) I don't think the cast is required here and b) you
may as well do away with the local features variable here.

Just do:
  palmas-features = *driver_data-features;

Once fixed, re-submit with my:
  Acked-by: Lee Jones lee.jo...@linaro.org

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/9] mfd: palmas: Add tps65917 support

2014-06-17 Thread Keerthy

On Tuesday 17 June 2014 09:49 PM, Lee Jones wrote:

Add tps65917 PMIC support. tps65917 is a subset of palmas PMIC.
Some of the register definitions and the interrupt mappings
are different.

Signed-off-by: Keerthy j-keer...@ti.com
---
  drivers/mfd/palmas.c |  176 --
  1 file changed, 171 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index d280d78..485d755 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c

[...]


+struct palmas_driver_data {
+   unsigned int *features;
+   struct regmap_irq_chip *irq_chip;
+};
+
+static struct palmas_driver_data palmas_data = {
+   .features = palmas_features,
+   .irq_chip = palmas_irq_chip,
+};
+
+static struct palmas_driver_data tps659038_data = {
+   .features = tps659038_features,
+   .irq_chip = palmas_irq_chip,
+};
+
+static struct palmas_driver_data tps65917_data = {
+   .features = tps659038_features,
+   .irq_chip = tps65917_irq_chip,
+};
+

[...]


@@ -375,6 +539,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
  {
struct palmas *palmas;
struct palmas_platform_data *pdata;
+   struct palmas_driver_data *driver_data;
struct device_node *node = i2c-dev.of_node;
int ret = 0, i;
unsigned int reg, addr, *features;
@@ -408,7 +573,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
if (!match)
return -ENODATA;
  
-	features = (unsigned int *)match-data;

+   driver_data = (struct palmas_driver_data *)match-data;
+   features = (unsigned int *)driver_data-features;
palmas-features = *features;

Couple of things a) I don't think the cast is required here and b) you
may as well do away with the local features variable here.

Just do:
   palmas-features = *driver_data-features;

Once fixed, re-submit with my:
   Acked-by: Lee Jones lee.jo...@linaro.org


Sure. I will redo and send this set.
Thanks.





--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/9] mfd: palmas: Add tps65917 support

2014-05-28 Thread Keerthy
Add tps65917 PMIC support. tps65917 is a subset of palmas PMIC.
Some of the register definitions and the interrupt mappings
are different.

Signed-off-by: Keerthy j-keer...@ti.com
---
 drivers/mfd/palmas.c |  176 --
 1 file changed, 171 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index d280d78..485d755 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -92,6 +92,133 @@ static const struct regmap_config 
palmas_regmap_config[PALMAS_NUM_CLIENTS] = {
},
 };
 
+static const struct regmap_irq tps65917_irqs[] = {
+   /* INT1 IRQs */
+   [TPS65917_RESERVED1] = {
+   .mask = TPS65917_RESERVED,
+   },
+   [TPS65917_PWRON_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_PWRON,
+   },
+   [TPS65917_LONG_PRESS_KEY_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_LONG_PRESS_KEY,
+   },
+   [TPS65917_RESERVED2] = {
+   .mask = TPS65917_RESERVED,
+   },
+   [TPS65917_PWRDOWN_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_PWRDOWN,
+   },
+   [TPS65917_HOTDIE_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_HOTDIE,
+   },
+   [TPS65917_VSYS_MON_IRQ] = {
+   .mask = TPS65917_INT1_STATUS_VSYS_MON,
+   },
+   [TPS65917_RESERVED3] = {
+   .mask = TPS65917_RESERVED,
+   },
+   /* INT2 IRQs*/
+   [TPS65917_RESERVED4] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 1,
+   },
+   [TPS65917_OTP_ERROR_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_OTP_ERROR,
+   .reg_offset = 1,
+   },
+   [TPS65917_WDT_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_WDT,
+   .reg_offset = 1,
+   },
+   [TPS65917_RESERVED5] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 1,
+   },
+   [TPS65917_RESET_IN_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_RESET_IN,
+   .reg_offset = 1,
+   },
+   [TPS65917_FSD_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_FSD,
+   .reg_offset = 1,
+   },
+   [TPS65917_SHORT_IRQ] = {
+   .mask = TPS65917_INT2_STATUS_SHORT,
+   .reg_offset = 1,
+   },
+   [TPS65917_RESERVED6] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 1,
+   },
+   /* INT3 IRQs */
+   [TPS65917_GPADC_AUTO_0_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_GPADC_AUTO_0,
+   .reg_offset = 2,
+   },
+   [TPS65917_GPADC_AUTO_1_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_GPADC_AUTO_1,
+   .reg_offset = 2,
+   },
+   [TPS65917_GPADC_EOC_SW_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_GPADC_EOC_SW,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESREVED6] = {
+   .mask = TPS65917_RESERVED6,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESERVED7] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESERVED8] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 2,
+   },
+   [TPS65917_RESERVED9] = {
+   .mask = TPS65917_RESERVED,
+   .reg_offset = 2,
+   },
+   [TPS65917_VBUS_IRQ] = {
+   .mask = TPS65917_INT3_STATUS_VBUS,
+   .reg_offset = 2,
+   },
+   /* INT4 IRQs */
+   [TPS65917_GPIO_0_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_0,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_1_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_1,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_2_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_2,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_3_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_3,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_4_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_4,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_5_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_5,
+   .reg_offset = 3,
+   },
+   [TPS65917_GPIO_6_IRQ] = {
+   .mask = TPS65917_INT4_STATUS_GPIO_6,
+   .reg_offset = 3,
+   },
+   [TPS65917_RESERVED10] = {
+   .mask = TPS65917_RESERVED10,
+   .reg_offset = 3,
+   },
+};
+
 static const struct regmap_irq palmas_irqs[] = {
/* INT1 IRQs */
[PALMAS_CHARG_DET_N_VBUS_OVV_IRQ] = {
@@ -232,6 +359,19 @@ static struct regmap_irq_chip palmas_irq_chip = {
PALMAS_INT1_MASK),
 };
 
+static struct regmap_irq_chip tps65917_irq_chip = {
+   .name = tps65917,
+   .irqs = tps65917_irqs,
+   .num_irqs = ARRAY_SIZE(tps65917_irqs),
+
+