Re: [PATCH v2] mfd: twl-core: make driver DT only

2016-11-26 Thread Nicolae Rosia
Hi,

Please ignore this patch, I've sent it in a patch series here [0]

Thanks,
Nicolae

[0] https://www.spinics.net/lists/kernel/msg2392364.html


Re: [PATCH v2] mfd: twl-core: make driver DT only

2016-11-26 Thread Nicolae Rosia
Hi,

Please ignore this patch, I've sent it in a patch series here [0]

Thanks,
Nicolae

[0] https://www.spinics.net/lists/kernel/msg2392364.html


Re: [PATCH v2] mfd: twl-core: make driver DT only

2016-11-22 Thread Nicolae Rosia
Hi,

On Tue, Nov 22, 2016 at 12:45 PM, Baruch Siach  wrote:
> Hi Nicolae,
>
>
> Can struct twl4030_platform_data declaration be removed now from
> include/linux/i2c/twl.h?
>
> baruch
>
Yes, I have the patches ready and plan on doing that in the next cycle.
I have been sending multiple patches to convert twl related drivers to
DT only and I don't want to create merge conflicts on twl.h

Thanks,
Nicolae


Re: [PATCH v2] mfd: twl-core: make driver DT only

2016-11-22 Thread Nicolae Rosia
Hi,

On Tue, Nov 22, 2016 at 12:45 PM, Baruch Siach  wrote:
> Hi Nicolae,
>
>
> Can struct twl4030_platform_data declaration be removed now from
> include/linux/i2c/twl.h?
>
> baruch
>
Yes, I have the patches ready and plan on doing that in the next cycle.
I have been sending multiple patches to convert twl related drivers to
DT only and I don't want to create merge conflicts on twl.h

Thanks,
Nicolae


Re: [PATCH v2] mfd: twl-core: make driver DT only

2016-11-22 Thread Baruch Siach
Hi Nicolae,

On Tue, Nov 22, 2016 at 12:21:30PM +0200, Nicolae Rosia wrote:
> All users are DT-only and it makes no sense to keep
> unused code which also prevents further cleanups.
> 
> Signed-off-by: Nicolae Rosia 
> ---
> Changes in v2:
> Increased audience in CC list
> 
>  drivers/mfd/Kconfig|   1 +
>  drivers/mfd/twl-core.c | 395 
> ++---
>  2 files changed, 10 insertions(+), 386 deletions(-)

[...]

> @@ -1080,7 +710,6 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
>  static int
>  twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  {
> - struct twl4030_platform_data*pdata = dev_get_platdata(>dev);

Can struct twl4030_platform_data declaration be removed now from 
include/linux/i2c/twl.h?

baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -


Re: [PATCH v2] mfd: twl-core: make driver DT only

2016-11-22 Thread Baruch Siach
Hi Nicolae,

On Tue, Nov 22, 2016 at 12:21:30PM +0200, Nicolae Rosia wrote:
> All users are DT-only and it makes no sense to keep
> unused code which also prevents further cleanups.
> 
> Signed-off-by: Nicolae Rosia 
> ---
> Changes in v2:
> Increased audience in CC list
> 
>  drivers/mfd/Kconfig|   1 +
>  drivers/mfd/twl-core.c | 395 
> ++---
>  2 files changed, 10 insertions(+), 386 deletions(-)

[...]

> @@ -1080,7 +710,6 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
>  static int
>  twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  {
> - struct twl4030_platform_data*pdata = dev_get_platdata(>dev);

Can struct twl4030_platform_data declaration be removed now from 
include/linux/i2c/twl.h?

baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -


[PATCH v2] mfd: twl-core: make driver DT only

2016-11-22 Thread Nicolae Rosia
All users are DT-only and it makes no sense to keep
unused code which also prevents further cleanups.

Signed-off-by: Nicolae Rosia 
---
Changes in v2:
Increased audience in CC list

 drivers/mfd/Kconfig|   1 +
 drivers/mfd/twl-core.c | 395 ++---
 2 files changed, 10 insertions(+), 386 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index c6df644..c180f8b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1333,6 +1333,7 @@ config MFD_TPS80031
 config TWL4030_CORE
bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
depends on I2C=y
+   depends on OF
select IRQ_DOMAIN
select REGMAP_I2C
help
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index c64615d..2025326 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -13,6 +13,9 @@
  * Code cleanup and modifications to IRQ handler.
  * by syed khasim 
  *
+ * Code cleanup and modifications:
+ * Copyright (C) 2016 Nicolae Rosia 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -604,376 +607,6 @@ int twl_get_hfclk_rate(void)
 }
 EXPORT_SYMBOL_GPL(twl_get_hfclk_rate);
 
-static struct device *
-add_numbered_child(unsigned mod_no, const char *name, int num,
-   void *pdata, unsigned pdata_len,
-   bool can_wakeup, int irq0, int irq1)
-{
-   struct platform_device  *pdev;
-   struct twl_client   *twl;
-   int status, sid;
-
-   if (unlikely(mod_no >= twl_get_last_module())) {
-   pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
-   return ERR_PTR(-EPERM);
-   }
-   sid = twl_priv->twl_map[mod_no].sid;
-   twl = _priv->twl_modules[sid];
-
-   pdev = platform_device_alloc(name, num);
-   if (!pdev)
-   return ERR_PTR(-ENOMEM);
-
-   pdev->dev.parent = >client->dev;
-
-   if (pdata) {
-   status = platform_device_add_data(pdev, pdata, pdata_len);
-   if (status < 0) {
-   dev_dbg(>dev, "can't add platform_data\n");
-   goto put_device;
-   }
-   }
-
-   if (irq0) {
-   struct resource r[2] = {
-   { .start = irq0, .flags = IORESOURCE_IRQ, },
-   { .start = irq1, .flags = IORESOURCE_IRQ, },
-   };
-
-   status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1);
-   if (status < 0) {
-   dev_dbg(>dev, "can't add irqs\n");
-   goto put_device;
-   }
-   }
-
-   status = platform_device_add(pdev);
-   if (status)
-   goto put_device;
-
-   device_init_wakeup(>dev, can_wakeup);
-
-   return >dev;
-
-put_device:
-   platform_device_put(pdev);
-   dev_err(>client->dev, "failed to add device %s\n", name);
-   return ERR_PTR(status);
-}
-
-static inline struct device *add_child(unsigned mod_no, const char *name,
-   void *pdata, unsigned pdata_len,
-   bool can_wakeup, int irq0, int irq1)
-{
-   return add_numbered_child(mod_no, name, -1, pdata, pdata_len,
-   can_wakeup, irq0, irq1);
-}
-
-static struct device *
-add_regulator_linked(int num, struct regulator_init_data *pdata,
-   struct regulator_consumer_supply *consumers,
-   unsigned num_consumers, unsigned long features)
-{
-   struct twl_regulator_driver_data drv_data;
-
-   /* regulator framework demands init_data ... */
-   if (!pdata)
-   return NULL;
-
-   if (consumers) {
-   pdata->consumer_supplies = consumers;
-   pdata->num_consumer_supplies = num_consumers;
-   }
-
-   if (pdata->driver_data) {
-   /* If we have existing drv_data, just add the flags */
-   struct twl_regulator_driver_data *tmp;
-   tmp = pdata->driver_data;
-   tmp->features |= features;
-   } else {
-   /* add new driver data struct, used only during init */
-   drv_data.features = features;
-   drv_data.set_voltage = NULL;
-   drv_data.get_voltage = NULL;
-   drv_data.data = NULL;
-   pdata->driver_data = _data;
-   }
-
-   /* NOTE:  we currently ignore regulator IRQs, e.g. for short circuits */
-   return add_numbered_child(TWL_MODULE_PM_MASTER, "twl_reg", num,
-   pdata, sizeof(*pdata), false, 0, 0);
-}
-
-static struct device *
-add_regulator(int num, struct regulator_init_data *pdata,
-   unsigned long features)
-{
-   return add_regulator_linked(num, pdata, NULL, 

[PATCH v2] mfd: twl-core: make driver DT only

2016-11-22 Thread Nicolae Rosia
All users are DT-only and it makes no sense to keep
unused code which also prevents further cleanups.

Signed-off-by: Nicolae Rosia 
---
Changes in v2:
Increased audience in CC list

 drivers/mfd/Kconfig|   1 +
 drivers/mfd/twl-core.c | 395 ++---
 2 files changed, 10 insertions(+), 386 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index c6df644..c180f8b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1333,6 +1333,7 @@ config MFD_TPS80031
 config TWL4030_CORE
bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
depends on I2C=y
+   depends on OF
select IRQ_DOMAIN
select REGMAP_I2C
help
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index c64615d..2025326 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -13,6 +13,9 @@
  * Code cleanup and modifications to IRQ handler.
  * by syed khasim 
  *
+ * Code cleanup and modifications:
+ * Copyright (C) 2016 Nicolae Rosia 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -604,376 +607,6 @@ int twl_get_hfclk_rate(void)
 }
 EXPORT_SYMBOL_GPL(twl_get_hfclk_rate);
 
-static struct device *
-add_numbered_child(unsigned mod_no, const char *name, int num,
-   void *pdata, unsigned pdata_len,
-   bool can_wakeup, int irq0, int irq1)
-{
-   struct platform_device  *pdev;
-   struct twl_client   *twl;
-   int status, sid;
-
-   if (unlikely(mod_no >= twl_get_last_module())) {
-   pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
-   return ERR_PTR(-EPERM);
-   }
-   sid = twl_priv->twl_map[mod_no].sid;
-   twl = _priv->twl_modules[sid];
-
-   pdev = platform_device_alloc(name, num);
-   if (!pdev)
-   return ERR_PTR(-ENOMEM);
-
-   pdev->dev.parent = >client->dev;
-
-   if (pdata) {
-   status = platform_device_add_data(pdev, pdata, pdata_len);
-   if (status < 0) {
-   dev_dbg(>dev, "can't add platform_data\n");
-   goto put_device;
-   }
-   }
-
-   if (irq0) {
-   struct resource r[2] = {
-   { .start = irq0, .flags = IORESOURCE_IRQ, },
-   { .start = irq1, .flags = IORESOURCE_IRQ, },
-   };
-
-   status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1);
-   if (status < 0) {
-   dev_dbg(>dev, "can't add irqs\n");
-   goto put_device;
-   }
-   }
-
-   status = platform_device_add(pdev);
-   if (status)
-   goto put_device;
-
-   device_init_wakeup(>dev, can_wakeup);
-
-   return >dev;
-
-put_device:
-   platform_device_put(pdev);
-   dev_err(>client->dev, "failed to add device %s\n", name);
-   return ERR_PTR(status);
-}
-
-static inline struct device *add_child(unsigned mod_no, const char *name,
-   void *pdata, unsigned pdata_len,
-   bool can_wakeup, int irq0, int irq1)
-{
-   return add_numbered_child(mod_no, name, -1, pdata, pdata_len,
-   can_wakeup, irq0, irq1);
-}
-
-static struct device *
-add_regulator_linked(int num, struct regulator_init_data *pdata,
-   struct regulator_consumer_supply *consumers,
-   unsigned num_consumers, unsigned long features)
-{
-   struct twl_regulator_driver_data drv_data;
-
-   /* regulator framework demands init_data ... */
-   if (!pdata)
-   return NULL;
-
-   if (consumers) {
-   pdata->consumer_supplies = consumers;
-   pdata->num_consumer_supplies = num_consumers;
-   }
-
-   if (pdata->driver_data) {
-   /* If we have existing drv_data, just add the flags */
-   struct twl_regulator_driver_data *tmp;
-   tmp = pdata->driver_data;
-   tmp->features |= features;
-   } else {
-   /* add new driver data struct, used only during init */
-   drv_data.features = features;
-   drv_data.set_voltage = NULL;
-   drv_data.get_voltage = NULL;
-   drv_data.data = NULL;
-   pdata->driver_data = _data;
-   }
-
-   /* NOTE:  we currently ignore regulator IRQs, e.g. for short circuits */
-   return add_numbered_child(TWL_MODULE_PM_MASTER, "twl_reg", num,
-   pdata, sizeof(*pdata), false, 0, 0);
-}
-
-static struct device *
-add_regulator(int num, struct regulator_init_data *pdata,
-   unsigned long features)
-{
-   return add_regulator_linked(num, pdata, NULL, 0, features);
-}
-
-/*
- * NOTE:  We know the first 8 IRQs after