Re: [patch v1] mfd: da9055 change irq state to default

2013-03-27 Thread Ashish Jangam
On Mon, 2013-03-18 at 14:42 +0530, Ashish Jangam wrote:
> This patch changes the irq state from high to the now default low.
> Because the default PMIC irq state of DA9055 got changed from high to low.
> This change should not affect any of the existing users since all of them
> use active low state.
> 
> This patch has been tested on smdkv6410.
> 
> Signed-off-by: Ashish 
> 
> ---
>  drivers/mfd/da9055-core.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> index f56a1a9..49cb23d 100644
> --- a/drivers/mfd/da9055-core.c
> +++ b/drivers/mfd/da9055-core.c
> @@ -391,7 +391,7 @@ int da9055_device_init(struct da9055 *da9055)
>   da9055->irq_base = pdata->irq_base;
>  
>   ret = regmap_add_irq_chip(da9055->regmap, da9055->chip_irq,
> -   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> +   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> da9055->irq_base, &da9055_regmap_irq_chip,
> &da9055->irq_data);
>   if (ret < 0)
If there are no comments then can this patch get merged.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1]rtc: fix for DA9052/53 rtc device registration

2013-03-21 Thread Ashish Jangam
This patch adds supports for the virtual irq since now MFD only handles virtual 
irq
Without this patch rtc device will fail in registration.

This patch is for Linux stable version 3.8.x 

Signed-off-by: Ashish Jangam 
---
 drivers/rtc/rtc-da9052.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 60b826e..e22c950 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -239,10 +239,10 @@ static int da9052_rtc_probe(struct platform_device *pdev)
 
rtc->da9052 = dev_get_drvdata(pdev->dev.parent);
platform_set_drvdata(pdev, rtc);
-   rtc->irq = platform_get_irq_byname(pdev, "ALM");
-   ret = request_threaded_irq(rtc->irq, NULL, da9052_rtc_irq,
-  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-  "ALM", rtc);
+   rtc->irq =  DA9052_IRQ_ALARM;
+
+   ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM",
+   da9052_rtc_irq, rtc);
if (ret != 0) {
rtc_err(rtc->da9052, "irq registration failed: %d\n", ret);
return ret;
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v2] rtc: fix for the DA9052 rtc device registration

2013-03-19 Thread Ashish Jangam
This patch adds support for the virtual irq since now MFD only handles virtual 
irq
Without this patch rtc device will fail in registration

Signed-off-by: Ashish 
---
Changes since version v2:
- ported the patch for 3.9-rc3 kernel version
---
 drivers/rtc/rtc-da9052.c |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 0dde688..969abba 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -239,11 +239,9 @@ static int da9052_rtc_probe(struct platform_device *pdev)
 
rtc->da9052 = dev_get_drvdata(pdev->dev.parent);
platform_set_drvdata(pdev, rtc);
-   rtc->irq = platform_get_irq_byname(pdev, "ALM");
-   ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
-   da9052_rtc_irq,
-   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-   "ALM", rtc);
+   rtc->irq =  DA9052_IRQ_ALARM;
+   ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM",
+   da9052_rtc_irq, rtc);
if (ret != 0) {
rtc_err(rtc->da9052, "irq registration failed: %d\n", ret);
return ret;
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v1] rtc: fix for the DA9052 rtc device registration

2013-03-19 Thread Ashish Jangam
On Mon, 2013-03-18 at 15:21 -0700, Andrew Morton wrote:
> On Fri, 15 Mar 2013 13:59:39 +0530 Ashish Jangam 
>  wrote:
> 
> > DA9052/53 MFD core handles only virtual irq therefore rtc driver needs
> > to be updated to work on virtual irq. Without this update DA9052/53 rtc 
> > driver will fail during its registration.
> > Also getting irq by it name is no longer supported in DA9052/53 core.
> > 
> > ...
> >
> > --- a/drivers/rtc/rtc-da9052.c
> > +++ b/drivers/rtc/rtc-da9052.c
> > @@ -239,10 +239,10 @@ static int da9052_rtc_probe(struct platform_device 
> > *pdev)
> >  
> > rtc->da9052 = dev_get_drvdata(pdev->dev.parent);
> > platform_set_drvdata(pdev, rtc);
> > -   rtc->irq = platform_get_irq_byname(pdev, "ALM");
> > -   ret = request_threaded_irq(rtc->irq, NULL, da9052_rtc_irq,
> > -  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> > -  "ALM", rtc);
> > +   rtc->irq =  DA9052_IRQ_ALARM;
> > +
> > +   ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM",
> > +   da9052_rtc_irq, rtc);
> > if (ret != 0) {
> > rtc_err(rtc->da9052, "irq registration failed: %d\n", ret);
> > return ret;
> 
> drivers/rtc/rtc-da9052.c was converted to use
> devm_request_threaded_irq() after linux-3.8, so I cannot apply this
> patch to mainline.  Can you please prepare a patch against 3.9-rc3?
Yes.
> 
> Do you believe that the patch should be backported into -stable
> kernels?  If so, Greg will need a different version of it - ie, the one
> you have just sent.  Please send that to him at the appropriate time
> (say, when you see me drop the 3.9-rc3 version from the -mm tree).
Ok, I will do the necessary.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1] mfd: da9055 change irq state to default

2013-03-18 Thread Ashish Jangam
This patch changes the irq state from high to the now default low.
Because the default PMIC irq state of DA9055 got changed from high to low.
This change should not affect any of the existing users since all of them
use active low state.

This patch has been tested on smdkv6410.

Signed-off-by: Ashish 

---
 drivers/mfd/da9055-core.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index f56a1a9..49cb23d 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -391,7 +391,7 @@ int da9055_device_init(struct da9055 *da9055)
da9055->irq_base = pdata->irq_base;
 
ret = regmap_add_irq_chip(da9055->regmap, da9055->chip_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
  da9055->irq_base, &da9055_regmap_irq_chip,
  &da9055->irq_data);
if (ret < 0)
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v1] rtc: fix for the DA9052 rtc device registration

2013-03-15 Thread Ashish Jangam
DA9052/53 MFD core handles only virtual irq therefore rtc driver needs
to be updated to work on virtual irq. Without this update DA9052/53 rtc 
driver will fail during its registration.
Also getting irq by it name is no longer supported in DA9052/53 core.

Signed-off-by: Ashish Jangam 
---
 drivers/rtc/rtc-da9052.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 60b826e..e22c950 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -239,10 +239,10 @@ static int da9052_rtc_probe(struct platform_device *pdev)
 
rtc->da9052 = dev_get_drvdata(pdev->dev.parent);
platform_set_drvdata(pdev, rtc);
-   rtc->irq = platform_get_irq_byname(pdev, "ALM");
-   ret = request_threaded_irq(rtc->irq, NULL, da9052_rtc_irq,
-  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-  "ALM", rtc);
+   rtc->irq =  DA9052_IRQ_ALARM;
+
+   ret = da9052_request_irq(rtc->da9052, rtc->irq, "ALM",
+   da9052_rtc_irq, rtc);
if (ret != 0) {
rtc_err(rtc->da9052, "irq registration failed: %d\n", ret);
return ret;
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch v1 1/5] mfd: da9055 change irq state to default

2013-03-08 Thread Ashish Jangam
On Fri, 2013-03-01 at 16:43 +0530, Ashish Jangam wrote:
> On Fri, 2013-01-18 at 10:49 +0530, Ashish Jangam wrote:
> > This patch changes the irq state from high to the now default low
> > state.
> > 
> > This patch is tested on smdk6410 board.
> > 
> > Signed-off-by: Ashish Jangam 
> > ---
> >  drivers/mfd/da9055-core.c |2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> > index f56a1a9..49cb23d 100644
> > --- a/drivers/mfd/da9055-core.c
> > +++ b/drivers/mfd/da9055-core.c
> > @@ -391,7 +391,7 @@ int da9055_device_init(struct da9055 *da9055)
> > da9055->irq_base = pdata->irq_base;
> >  
> > ret = regmap_add_irq_chip(da9055->regmap, da9055->chip_irq,
> > - IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> > + IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> >   da9055->irq_base, &da9055_regmap_irq_chip,
> >   &da9055->irq_data);
> > if (ret < 0)
> Can you let me know if this patch looks good to get merged?
Any update? Sorry to ping, just need to close this small change till
earlier. 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: virtual irq isssue - regmap_irq

2013-03-07 Thread Ashish Jangam
On Thu, 2013-03-07 at 15:13 +0800, Mark Brown wrote:
> On Thu, Mar 07, 2013 at 12:27:52PM +0530, Ashish Jangam wrote:
> 
> > In regmap_irq if irq_base is unknown then regmap creates virq starting from > > 0
> > and it seems that in kernel 3.8 virq 0 usage is not permitted, since during 
> > irq
> > registration kernel throws a message "error: irq_desc already associated".
> 
> > I'm not sure if this requires fix in regmap_irq or kernel, can you please
> > comment on this?
> 
> This is a bug in your platform which will affect anything using a linear
> domain.  The platform isn't setting up its interrupts correctly so that
> the core knows that those interrupts are reserved, ideally the platform
> would just use domains for everything but at least irq_alloc_decs()
> needs to know what is going on.
Thanks I got this, however in this case should regmap handle such
condition where domain is unknown?
By the way, I was testing on smdkv6410 where Dialog device is not a
component of the board.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


virtual irq isssue - regmap_irq

2013-03-06 Thread Ashish Jangam
Hi,

In regmap_irq if irq_base is unknown then regmap creates virq starting from 0
and it seems that in kernel 3.8 virq 0 usage is not permitted, since during irq
registration kernel throws a message "error: irq_desc already associated".

I'm not sure if this requires fix in regmap_irq or kernel, can you please
comment on this?

Thanks,
Ashish


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch v1 1/5] mfd: da9055 change irq state to default

2013-03-01 Thread Ashish Jangam
On Fri, 2013-01-18 at 10:49 +0530, Ashish Jangam wrote:
> This patch changes the irq state from high to the now default low
> state.
> 
> This patch is tested on smdk6410 board.
> 
> Signed-off-by: Ashish Jangam 
> ---
>  drivers/mfd/da9055-core.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> index f56a1a9..49cb23d 100644
> --- a/drivers/mfd/da9055-core.c
> +++ b/drivers/mfd/da9055-core.c
> @@ -391,7 +391,7 @@ int da9055_device_init(struct da9055 *da9055)
>   da9055->irq_base = pdata->irq_base;
>  
>   ret = regmap_add_irq_chip(da9055->regmap, da9055->chip_irq,
> -   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> +   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> da9055->irq_base, &da9055_regmap_irq_chip,
> &da9055->irq_data);
>   if (ret < 0)
Can you let me know if this patch looks good to get merged?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v1/1] mfd: i2c issue fix for da9052/53

2013-01-25 Thread Ashish Jangam
An issue has been reported where the PMIC either locks up or fails to
respond following a system Reset. This could result in a second write
in which the bus writes the current content of the write buffer to address
of the last I2C access.

The failure case is where this unwanted write transfers incorrect data to
a critical register.

This patch fixes this issue to by following any read or write with a dummy read
to a safe register address. A safe register address is one where the contents
will not affect the operation of the system.

Signed-off-by: Ashish Jangam 
---
 drivers/mfd/da9052-i2c.c  |   61 ++
 include/linux/mfd/da9052/da9052.h |   66 ++--
 include/linux/mfd/da9052/reg.h|3 ++
 3 files changed, 126 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index ac74a4d..885e567 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -27,6 +27,66 @@
 #include 
 #endif
 
+/* I2C safe register check */
+static inline bool i2c_safe_reg(unsigned char reg)
+{
+   switch (reg) {
+   case DA9052_STATUS_A_REG:
+   case DA9052_STATUS_B_REG:
+   case DA9052_STATUS_C_REG:
+   case DA9052_STATUS_D_REG:
+   case DA9052_ADC_RES_L_REG:
+   case DA9052_ADC_RES_H_REG:
+   case DA9052_VDD_RES_REG:
+   case DA9052_ICHG_AV_REG:
+   case DA9052_TBAT_RES_REG:
+   case DA9052_ADCIN4_RES_REG:
+   case DA9052_ADCIN5_RES_REG:
+   case DA9052_ADCIN6_RES_REG:
+   case DA9052_TJUNC_RES_REG:
+   case DA9052_TSI_X_MSB_REG:
+   case DA9052_TSI_Y_MSB_REG:
+   case DA9052_TSI_LSB_REG:
+   case DA9052_TSI_Z_MSB_REG:
+   return true;
+   default:
+   return false;
+   }
+}
+
+/*
+ * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC
+ * gets lockup up or fails to respond following a system reset.
+ * This fix is to follow any read or write with a dummy read to a safe
+ * register.
+ */
+int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
+{
+   int val;
+
+   switch (da9052->chip_id) {
+   case DA9052:
+   case DA9053_AA:
+   case DA9053_BA:
+   case DA9053_BB:
+   /* A dummy read to a safe register address. */
+   if (!i2c_safe_reg(reg))
+   return regmap_read(da9052->regmap,
+  DA9052_PARK_REGISTER,
+  &val);
+   break;
+   default:
+   /*
+* For other chips parking of I2C register
+* to a safe place is not required.
+*/
+   break;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(da9052_i2c_fix);
+
 static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
 {
int reg_val, ret;
@@ -83,6 +143,7 @@ static int da9052_i2c_probe(struct i2c_client *client,
 
da9052->dev = &client->dev;
da9052->chip_irq = client->irq;
+   da9052->fix_io = da9052_i2c_fix;
 
i2c_set_clientdata(client, da9052);
 
diff --git a/include/linux/mfd/da9052/da9052.h 
b/include/linux/mfd/da9052/da9052.h
index 86dd93d..786d02e 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -99,6 +99,9 @@ struct da9052 {
u8 chip_id;
 
int chip_irq;
+
+   /* SOC I/O transfer related fixes for DA9052/53 */
+   int (*fix_io) (struct da9052 *da9052, unsigned char reg);
 };
 
 /* ADC API */
@@ -113,32 +116,87 @@ static inline int da9052_reg_read(struct da9052 *da9052, 
unsigned char reg)
ret = regmap_read(da9052->regmap, reg, &val);
if (ret < 0)
return ret;
+
+   if (da9052->fix_io) {
+   ret = da9052->fix_io(da9052, reg);
+   if (ret < 0)
+   return ret;
+   }
+
return val;
 }
 
 static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
unsigned char val)
 {
-   return regmap_write(da9052->regmap, reg, val);
+   int ret;
+
+   ret = regmap_write(da9052->regmap, reg, val);
+   if (ret < 0)
+   return ret;
+
+   if (da9052->fix_io) {
+   ret = da9052->fix_io(da9052, reg);
+   if (ret < 0)
+   return ret;
+   }
+
+   return ret;
 }
 
 static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
 unsigned reg_cnt, unsigned char *val)
 {
-   return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
+   int ret;
+
+   ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
+   if (ret < 0)
+   return ret;
+
+   if (da9052->fix_io) {
+   ret = da9052->fix_io(da9052, reg);
+   if (ret <

Re: [patch v1 2/5] regulator: da9055 change irq state to default

2013-01-25 Thread Ashish Jangam
On Thu, 2013-01-24 at 00:03 +0800, Mark Brown wrote:
> On Mon, Jan 21, 2013 at 02:05:12PM +0530, Ashish Jangam wrote:
> 
> > > What makes you say that there is a dependency here?  It's really not at
> > > all obvious why a change to the primary IRQ signalling mechanism would
> > > affect the internal interrupts of the device.
> 
> > Yes, functionally this dependency should not matter.However, if
> > mfd/primary irq state is low and its components are high then it shall
> > not look good. Therefore the term dependency was used, probably I should
> > have written it in a different manner.
> 
> This logic doesn't follow terribly directly - looking at what you've
> posted it in fact seems that the trigger type is irrelevant in the
> function drivers?
Though it is functionally irrelevant but in the code setting the primary
irq to low and functional driver to high may confuse the code reader.
However I leave this decision to you.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch v1 2/5] regulator: da9055 change irq state to default

2013-01-21 Thread Ashish Jangam
> -Original Message-
> > > > This patch changes the irq state from high to the now default low
> > > > state.
> 
> > > > This patch is dependent on the DA9055 MFD.
> 
> > > Why is this change required and why is there a dependency here?
> 
> > It has been decided to have nIRQ therefore the main mfd IRQ state needs
> 
> Won't this break all existing systems?
Since all of the existing users are using nIRQ therefore it was decided
to have the default state as nIRQ.
> 
> > to be changed. And since mfd children follows mfd irq state therefore
> > the dependency; though in case of mfd this may not affect.  
> 
> What makes you say that there is a dependency here?  It's really not at
> all obvious why a change to the primary IRQ signalling mechanism would
> affect the internal interrupts of the device.
Yes, functionally this dependency should not matter.However, if
mfd/primary irq state is low and its components are high then it shall
not look good. Therefore the term dependency was used, probably I should
have written it in a different manner.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch v1 2/5] regulator: da9055 change irq state to default

2013-01-21 Thread Ashish Jangam
> -Original Message-
> 
> On Fri, Jan 18, 2013 at 10:52:45AM +0530, Ashish Jangam wrote:
> > This patch changes the irq state from high to the now default low
> > state.
> > 
> > This patch is dependent on the DA9055 MFD.
> 
> Why is this change required and why is there a dependency here?
> 
It has been decided to have nIRQ therefore the main mfd IRQ state needs
to be changed. And since mfd children follows mfd irq state therefore
the dependency; though in case of mfd this may not affect.  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v1 5/5] onkey: da9055 change irq state to default

2013-01-17 Thread Ashish Jangam
This patch changes the irq state from high to the now default low
state.

This patch is dependent on the DA9055 MFD.

This patch is tested on smdk6410 board.

Signed-off-by: Ashish Jangam 
---
 drivers/input/misc/da9055_onkey.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/misc/da9055_onkey.c 
b/drivers/input/misc/da9055_onkey.c
index ee6ae3a..eec55b7 100644
--- a/drivers/input/misc/da9055_onkey.c
+++ b/drivers/input/misc/da9055_onkey.c
@@ -112,7 +112,7 @@ static int da9055_onkey_probe(struct platform_device *pdev)
 
irq = regmap_irq_get_virq(da9055->irq_data, irq);
err = request_threaded_irq(irq, NULL, da9055_onkey_irq,
-  IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
   "ONKEY", onkey);
if (err < 0) {
dev_err(&pdev->dev,
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1 4/5] rtc: da9055 change irq state to default

2013-01-17 Thread Ashish Jangam
This patch changes the irq state from high to the now default low
state.

This patch is dependent on the DA9055 MFD.

This patch is tested on smdk6410 board.

Signed-off-by: Ashish Jangam 
---
 drivers/rtc/rtc-da9055.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
index 8f0dcfe..918b16b 100644
--- a/drivers/rtc/rtc-da9055.c
+++ b/drivers/rtc/rtc-da9055.c
@@ -305,7 +305,7 @@ static int da9055_rtc_probe(struct platform_device *pdev)
alm_irq = regmap_irq_get_virq(rtc->da9055->irq_data, alm_irq);
ret = devm_request_threaded_irq(&pdev->dev, alm_irq, NULL,
da9055_rtc_alm_irq,
-   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"ALM", rtc);
if (ret != 0)
dev_err(rtc->da9055->dev, "irq registration failed: %d\n", ret);
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1 3/5] hwmon: da9055 change irq state to default

2013-01-17 Thread Ashish Jangam
This patch changes the irq state from high to the now default low
state.

This patch is dependent on the DA9055 MFD.

This patch is tested on smdk6410 board.

Signed-off-by: Ashish Jangam 
---
 drivers/hwmon/da9055-hwmon.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
index 9465c05..dfd0db1 100644
--- a/drivers/hwmon/da9055-hwmon.c
+++ b/drivers/hwmon/da9055-hwmon.c
@@ -284,7 +284,7 @@ static int da9055_hwmon_probe(struct platform_device *pdev)
 
ret = devm_request_threaded_irq(&pdev->dev, hwmon_irq,
NULL, da9055_auxadc_irq,
-   IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"adc-irq", hwmon);
if (ret != 0) {
dev_err(hwmon->da9055->dev, "DA9055 ADC IRQ failed ret=%d\n",
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1 2/5] regulator: da9055 change irq state to default

2013-01-17 Thread Ashish Jangam
This patch changes the irq state from high to the now default low
state.

This patch is dependent on the DA9055 MFD.

This patch is tested on smdk6410 board.

Signed-off-by: Ashish Jangam 
---
 drivers/regulator/da9055-regulator.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
index 3022109..d4297c2 100644
--- a/drivers/regulator/da9055-regulator.c
+++ b/drivers/regulator/da9055-regulator.c
@@ -579,7 +579,7 @@ static int da9055_regulator_probe(struct platform_device 
*pdev)
irq = regmap_irq_get_virq(da9055->irq_data, irq);
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
da9055_ldo5_6_oc_irq,
-   IRQF_TRIGGER_HIGH |
+   IRQF_TRIGGER_LOW |
IRQF_ONESHOT |
IRQF_PROBE_SHARED,
pdev->name, regulator);
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1 1/5] mfd: da9055 change irq state to default

2013-01-17 Thread Ashish Jangam
This patch changes the irq state from high to the now default low
state.

This patch is tested on smdk6410 board.

Signed-off-by: Ashish Jangam 
---
 drivers/mfd/da9055-core.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index f56a1a9..49cb23d 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -391,7 +391,7 @@ int da9055_device_init(struct da9055 *da9055)
da9055->irq_base = pdata->irq_base;
 
ret = regmap_add_irq_chip(da9055->regmap, da9055->chip_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
  da9055->irq_base, &da9055_regmap_irq_chip,
  &da9055->irq_data);
if (ret < 0)
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-12-13 Thread Ashish Jangam
(This rtc patch is resend for merge)
---
This is the RTC patch for the DA9055 PMIC. This patch has got dependency on
the DA9055 MFD core.

This patch is functionally tested on Samsung SMDKV6410.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v3:
- use of module_platform_driver macro
- add the regmap virtual irq map API
changes since version v2:
- Use of devm_request_threaded_irq API
---
 drivers/rtc/Kconfig  |   10 +
 drivers/rtc/Makefile |1 +
 drivers/rtc/rtc-da9055.c |  413 ++
 3 files changed, 424 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-da9055.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 5bb0314..d0cea02 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -609,6 +609,16 @@ config RTC_DRV_DA9052
  Say y here to support the RTC driver for Dialog Semiconductor
  DA9052-BC and DA9053-AA/Bx PMICs.
 
+config RTC_DRV_DA9055
+   tristate "Dialog Semiconductor DA9055 RTC"
+   depends on MFD_DA9055
+   help
+ If you say yes here you will get support for the
+ RTC of the Dialog DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-da9055
+
 config RTC_DRV_EFI
tristate "EFI RTC"
depends on IA64
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 59e2132..c3f62c8 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802)  += rtc-bq4802.o
 obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_COH901331)+= rtc-coh901331.o
 obj-$(CONFIG_RTC_DRV_DA9052)   += rtc-da9052.o
+obj-$(CONFIG_RTC_DRV_DA9055)   += rtc-da9055.o
 obj-$(CONFIG_RTC_DRV_DAVINCI)  += rtc-davinci.o
 obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o
diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
new file mode 100644
index 000..a60d109
--- /dev/null
+++ b/drivers/rtc/rtc-da9055.c
@@ -0,0 +1,413 @@
+/*
+ * Real time clock driver for DA9055
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: Dajun Dajun Chen 
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+struct da9055_rtc {
+   struct rtc_device *rtc;
+   struct da9055 *da9055;
+   int alarm_enable;
+};
+
+static int da9055_rtc_enable_alarm(struct da9055_rtc *rtc, bool enable)
+{
+   int ret;
+   if (enable) {
+   ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
+   DA9055_RTC_ALM_EN,
+   DA9055_RTC_ALM_EN);
+   if (ret != 0)
+   dev_err(rtc->da9055->dev, "Failed to enable ALM: %d\n",
+   ret);
+   rtc->alarm_enable = 1;
+   } else {
+   ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
+   DA9055_RTC_ALM_EN, 0);
+   if (ret != 0)
+   dev_err(rtc->da9055->dev,
+   "Failed to disable ALM: %d\n", ret);
+   rtc->alarm_enable = 0;
+   }
+   return ret;
+}
+
+static irqreturn_t da9055_rtc_alm_irq(int irq, void *data)
+{
+   struct da9055_rtc *rtc = data;
+
+   da9055_rtc_enable_alarm(rtc, 0);
+   rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
+
+   return IRQ_HANDLED;
+}
+
+static int da9055_read_alarm(struct da9055 *da9055, struct rtc_time *rtc_tm)
+{
+   int ret;
+   uint8_t v[5];
+
+   ret = da9055_group_read(da9055, DA9055_REG_ALARM_MI, 5, v);
+   if (ret != 0) {
+   dev_err(da9055->dev, "Failed to group read ALM: %d\n", ret);
+   return ret;
+   }
+
+   rtc_tm->tm_year = (v[4] & DA9055_RTC_ALM_YEAR) + 100;
+   rtc_tm->tm_mon  = (v[3] & DA9055_RTC_ALM_MONTH) - 1;
+   rtc_tm->tm_mday = v[2] & DA9055_RTC_ALM_DAY;
+   rtc_tm->tm_hour = v[1] & DA9055_RTC_ALM_HOUR;
+   rtc_tm->tm_min  = v[0] & DA9055_RTC_ALM_MIN;
+
+   return rtc_valid_tm(rtc_tm);
+}
+
+static int da9055_set_alarm(struct da9055 *da9055, struct rtc_time *rtc_tm)
+{
+   int ret;
+   uint8_t v[2];
+
+   rtc_tm->tm_year -= 100;
+   rtc_tm->tm_mon += 1;
+
+   ret = da9055_reg_update(da9055, DA9055_REG_ALARM_MI,
+   DA9055_RTC_ALM_MIN, rtc_tm->tm_min);
+   if (ret != 0) {
+   dev_err(da9055->dev, "Failed to write ALRM MIN

Re: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-12-12 Thread Ashish Jangam
On Wed, 2012-12-12 at 13:11 -0800, Andrew Morton wrote:
> On Mon, 10 Dec 2012 11:12:29 +0530
> Ashish Jangam  wrote:
> 
> > On Wed, 2012-11-28 at 14:54 +0530, Ashish Jangam wrote:
> > > On Tue, 2012-11-27 at 14:23 -0800, Andrew Morton wrote:
> > > > On Fri, 23 Nov 2012 15:41:03 +0530
> > > > Ashish Jangam  wrote:
> > > > 
> > > > > On Tue, 2012-10-23 at 15:33 +0530, Ashish Jangam wrote:
> > > > > > Does this patch looks good?
> > > > > > On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> > > > > > > This is the RTC patch for the DA9055 PMIC. This patch has got 
> > > > > > > dependency on
> > > > > > > the DA9055 MFD core.
> > > > > > > 
> > > > > > > This patch is functionally tested on Samsung SMDKV6410.
> > > > 
> > > > "shubhro " made a comment, but it was 
> > > > ignored:
> > > > 
> > > > : On Thu, 11 Oct 2012 16:53:34 +0530
> > > > : shubhro  wrote:
> > > > : 
> > > > : > On Thursday 11 October 2012 04:10 PM, Ashish Jangam wrote:
> > > > : > > +#define da9055_rtc_freeze NULL
> > > > : > > +#endif
> > > > : > > +
> > > > : > > +static const struct dev_pm_ops da9055_rtc_pm_ops = {
> > > > : > > + .suspend = da9055_rtc_suspend,
> > > > : > > + .resume = da9055_rtc_resume,
> > > > : > > +
> > > > : > > + .freeze = da9055_rtc_freeze,
> > > > : > > + .thaw = da9055_rtc_resume,
> > > > : > > + .restore = da9055_rtc_resume,
> > > > : > > +
> > > > : > > + .poweroff = da9055_rtc_suspend,
> > > > : > > +};
> > > > : > You may want to use simple dev pm ops
> > > To support generic PM ops these additional ops were supported.
> > Are there any further comments on this patch.
> 
> Is the patch usable against current mainline?  "This patch has got
> dependency on the DA9055 MFD core".  What is the status of that?
The dependent DA9055 MFD core is merged.
> 
> If the patch is ready to go then please refresh it, retest and resend?
> 
Ok, I can test and resend it.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-12-09 Thread Ashish Jangam
On Wed, 2012-11-28 at 14:54 +0530, Ashish Jangam wrote:
> On Tue, 2012-11-27 at 14:23 -0800, Andrew Morton wrote:
> > On Fri, 23 Nov 2012 15:41:03 +0530
> > Ashish Jangam  wrote:
> > 
> > > On Tue, 2012-10-23 at 15:33 +0530, Ashish Jangam wrote:
> > > > Does this patch looks good?
> > > > On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> > > > > This is the RTC patch for the DA9055 PMIC. This patch has got 
> > > > > dependency on
> > > > > the DA9055 MFD core.
> > > > > 
> > > > > This patch is functionally tested on Samsung SMDKV6410.
> > 
> > "shubhro " made a comment, but it was ignored:
> > 
> > : On Thu, 11 Oct 2012 16:53:34 +0530
> > : shubhro  wrote:
> > : 
> > : > On Thursday 11 October 2012 04:10 PM, Ashish Jangam wrote:
> > : > > +#define da9055_rtc_freeze NULL
> > : > > +#endif
> > : > > +
> > : > > +static const struct dev_pm_ops da9055_rtc_pm_ops = {
> > : > > + .suspend = da9055_rtc_suspend,
> > : > > + .resume = da9055_rtc_resume,
> > : > > +
> > : > > + .freeze = da9055_rtc_freeze,
> > : > > + .thaw = da9055_rtc_resume,
> > : > > + .restore = da9055_rtc_resume,
> > : > > +
> > : > > + .poweroff = da9055_rtc_suspend,
> > : > > +};
> > : > You may want to use simple dev pm ops
> To support generic PM ops these additional ops were supported.
Are there any further comments on this patch.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-11-28 Thread Ashish Jangam
On Tue, 2012-11-27 at 14:23 -0800, Andrew Morton wrote:
> On Fri, 23 Nov 2012 15:41:03 +0530
> Ashish Jangam  wrote:
> 
> > On Tue, 2012-10-23 at 15:33 +0530, Ashish Jangam wrote:
> > > Does this patch looks good?
> > > On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> > > > This is the RTC patch for the DA9055 PMIC. This patch has got 
> > > > dependency on
> > > > the DA9055 MFD core.
> > > > 
> > > > This patch is functionally tested on Samsung SMDKV6410.
> > > > 
> > >
> 
> (Top-posting repaired. Please don't top-post).
> 
> > Any comments on this patch.
> 
> "shubhro " made a comment, but it was ignored:
> 
> : On Thu, 11 Oct 2012 16:53:34 +0530
> : shubhro  wrote:
> : 
> : > On Thursday 11 October 2012 04:10 PM, Ashish Jangam wrote:
> : > > +#define da9055_rtc_freeze NULL
> : > > +#endif
> : > > +
> : > > +static const struct dev_pm_ops da9055_rtc_pm_ops = {
> : > > +   .suspend = da9055_rtc_suspend,
> : > > +   .resume = da9055_rtc_resume,
> : > > +
> : > > +   .freeze = da9055_rtc_freeze,
> : > > +   .thaw = da9055_rtc_resume,
> : > > +   .restore = da9055_rtc_resume,
> : > > +
> : > > +   .poweroff = da9055_rtc_suspend,
> : > > +};
> : > You may want to use simple dev pm ops
> 
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-11-28 Thread Ashish Jangam
On Tue, 2012-11-27 at 14:23 -0800, Andrew Morton wrote:
> On Fri, 23 Nov 2012 15:41:03 +0530
> Ashish Jangam  wrote:
> 
> > On Tue, 2012-10-23 at 15:33 +0530, Ashish Jangam wrote:
> > > Does this patch looks good?
> > > On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> > > > This is the RTC patch for the DA9055 PMIC. This patch has got 
> > > > dependency on
> > > > the DA9055 MFD core.
> > > > 
> > > > This patch is functionally tested on Samsung SMDKV6410.
> > > > 
> > >
> 
> (Top-posting repaired. Please don't top-post).
> 
> > Any comments on this patch.
> 
> "shubhro " made a comment, but it was ignored:
> 
> : On Thu, 11 Oct 2012 16:53:34 +0530
> : shubhro  wrote:
> : 
> : > On Thursday 11 October 2012 04:10 PM, Ashish Jangam wrote:
> : > > +#define da9055_rtc_freeze NULL
> : > > +#endif
> : > > +
> : > > +static const struct dev_pm_ops da9055_rtc_pm_ops = {
> : > > +   .suspend = da9055_rtc_suspend,
> : > > +   .resume = da9055_rtc_resume,
> : > > +
> : > > +   .freeze = da9055_rtc_freeze,
> : > > +   .thaw = da9055_rtc_resume,
> : > > +   .restore = da9055_rtc_resume,
> : > > +
> : > > +   .poweroff = da9055_rtc_suspend,
> : > > +};
> : > You may want to use simple dev pm ops
To support generic PM ops these additional ops were supported.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-11-23 Thread Ashish Jangam
On Fri, 2012-11-23 at 16:39 +0530, Venu Byravarasu wrote:
> > -Original Message-
> > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
> > ow...@vger.kernel.org] On Behalf Of Ashish Jangam
> > Sent: Friday, November 23, 2012 3:41 PM
> > To: a...@linux-foundation.org
> > Cc: linux-kernel@vger.kernel.org; sa...@linux.intel.com;
> > p_gortma...@yahoo.com; dc...@diasemi.com; rtc-
> > li...@googlegroups.com; Alessandro Zummo
> > Subject: Re: [Patch v3 3/7] rtc: DA9055 RTC driver
> > 
> > Any comments on this patch.
> > On Tue, 2012-10-23 at 15:33 +0530, Ashish Jangam wrote:
> > > Does this patch looks good?
> > > On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> > > > This is the RTC patch for the DA9055 PMIC. This patch has got
> > dependency on
> > > > the DA9055 MFD core.
> > > >
> > > > This patch is functionally tested on Samsung SMDKV6410.
> > > >
> > > > Signed-off-by: David Dajun Chen 
> > > > Signed-off-by: Ashish Jangam 
> > > > ---
> > > > changes since version v3:
> > > > - use of module_platform_driver macro
> > > > - add the regmap virtual irq map API.
> > > > changes since version v2:
> > > > - Use of devm_request_threaded_irq API
> > > > ---
> > > >  drivers/rtc/Kconfig  |   10 +
> > > >  drivers/rtc/Makefile |1 +
> > > >  drivers/rtc/rtc-da9055.c |  413
> > ++
> > > >  3 files changed, 424 insertions(+), 0 deletions(-)
> > > >  mode change 100644 => 100755 drivers/rtc/Kconfig
> > > >  create mode 100644 drivers/rtc/rtc-da9055.c
> > > >
> 
> > > > +static int da9055_set_alarm(struct da9055 *da9055, struct rtc_time
> > *rtc_tm)
> > > > +{
> > > > +   int ret;
> > > > +   uint8_t v[2];
> > > > +
> > > > +   rtc_tm->tm_year -= 100;
> > > > +   rtc_tm->tm_mon += 1;
> > > > +
> > > > +   ret = da9055_reg_update(da9055, DA9055_REG_ALARM_MI,
> > > > +   DA9055_RTC_ALM_MIN, rtc_tm->tm_min);
> > > > +   if (ret != 0) {
> > > > +   dev_err(da9055->dev, "Failed to write ALRM MIN: %d\n",
> > ret);
> > > > +   return ret;
> > > > +   }
> > > > +
> > > > +   v[0] = rtc_tm->tm_hour;
> > > > +   v[1] = rtc_tm->tm_mday;
> > > > +
> > > > +   ret = da9055_group_write(da9055, DA9055_REG_ALARM_H, 2, v);
> 
> Why don't you write all registers at once using single multi byte
> write command as you already used in da9055_rtc_set_time() ?
Unlike TIME/Date registers some of the ALARM register bits has got few
other bits which should not get modified during the setting of ALARM
therefore reg_update was used for those ALARM register.   


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 3/7] rtc: DA9055 RTC driver

2012-11-23 Thread Ashish Jangam
Any comments on this patch.
On Tue, 2012-10-23 at 15:33 +0530, Ashish Jangam wrote:
> Does this patch looks good?
> On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> > This is the RTC patch for the DA9055 PMIC. This patch has got dependency on
> > the DA9055 MFD core.
> > 
> > This patch is functionally tested on Samsung SMDKV6410.
> > 
> > Signed-off-by: David Dajun Chen 
> > Signed-off-by: Ashish Jangam 
> > ---
> > changes since version v3:
> > - use of module_platform_driver macro
> > - add the regmap virtual irq map API.
> > changes since version v2:
> > - Use of devm_request_threaded_irq API
> > ---
> >  drivers/rtc/Kconfig  |   10 +
> >  drivers/rtc/Makefile |1 +
> >  drivers/rtc/rtc-da9055.c |  413 
> > ++
> >  3 files changed, 424 insertions(+), 0 deletions(-)
> >  mode change 100644 => 100755 drivers/rtc/Kconfig
> >  create mode 100644 drivers/rtc/rtc-da9055.c
> > 
> > diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> > old mode 100644
> > new mode 100755
> > index fabc99a..6050f8b
> > --- a/drivers/rtc/Kconfig
> > +++ b/drivers/rtc/Kconfig
> > @@ -571,6 +571,16 @@ config RTC_DRV_DA9052
> >   Say y here to support the RTC driver for Dialog Semiconductor
> >   DA9052-BC and DA9053-AA/Bx PMICs.
> >  
> > +config RTC_DRV_DA9055
> > +   tristate "Dialog Semiconductor DA9055 RTC"
> > +   depends on MFD_DA9055
> > +   help
> > + If you say yes here you will get support for the
> > + RTC of the Dialog DA9055 PMIC.
> > +
> > + This driver can also be built as a module. If so, the module
> > + will be called rtc-da9055
> > +
> >  config RTC_DRV_EFI
> > tristate "EFI RTC"
> > depends on IA64
> > diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> > index 0d5b2b6..b4c162f 100644
> > --- a/drivers/rtc/Makefile
> > +++ b/drivers/rtc/Makefile
> > @@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802)  += rtc-bq4802.o
> >  obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o
> >  obj-$(CONFIG_RTC_DRV_COH901331)+= rtc-coh901331.o
> >  obj-$(CONFIG_RTC_DRV_DA9052)   += rtc-da9052.o
> > +obj-$(CONFIG_RTC_DRV_DA9055)   += rtc-da9055.o
> >  obj-$(CONFIG_RTC_DRV_DAVINCI)  += rtc-davinci.o
> >  obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
> >  obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o
> > diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
> > new file mode 100644
> > index 000..2304647
> > --- /dev/null
> > +++ b/drivers/rtc/rtc-da9055.c
> > @@ -0,0 +1,413 @@
> > +/*
> > + * Real time clock driver for DA9055
> > + *
> > + * Copyright(c) 2012 Dialog Semiconductor Ltd.
> > + *
> > + * Author: Dajun Dajun Chen 
> > + *
> > + * 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
> > + * (at your option) any later version.
> > + *
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +struct da9055_rtc {
> > +   struct rtc_device *rtc;
> > +   struct da9055 *da9055;
> > +   int alarm_enable;
> > +};
> > +
> > +static int da9055_rtc_enable_alarm(struct da9055_rtc *rtc, bool enable)
> > +{
> > +   int ret;
> > +   if (enable) {
> > +   ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
> > +   DA9055_RTC_ALM_EN,
> > +   DA9055_RTC_ALM_EN);
> > +   if (ret != 0)
> > +   dev_err(rtc->da9055->dev, "Failed to enable ALM: %d\n",
> > +   ret);
> > +   rtc->alarm_enable = 1;
> > +   } else {
> > +   ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
> > +   DA9055_RTC_ALM_EN, 0);
> > +   if (ret != 0)
> > +   dev_err(rtc->da9055->dev,
> > +   "Failed to disable ALM: %d\n", ret);
> > +   rtc->alarm_enable = 0;
> > +   }
> > +   return ret;
> > +}
> > +
> > +static irqreturn_t da9055_rtc_alm_irq(int irq, void *data)
> > +{
> > +   struct da9055_rtc *rtc = data;
> > +
&g

Re: [PATCH RFT] regulator: da9055: Properly handle voltage range that doesn't start with 0 offset

2012-11-21 Thread Ashish Jangam
> This patch implements map_voltage and list_voltage callbacks to properly 
> handle
> the case voltage range that doesn't start with 0 offset.
> 
> Now we adjust the selector in map_voltage() before calling set_voltage_sel().
> And return 0 in list_voltage() for invalid selectors.
> 
> With above change, we can remove da9055_regulator_set_voltage_bits function.
> 
> One tricky part is that we need adding voffset to n_voltages.
> Although for the cases "selector < voffset" are invalid, we need add voffset 
> to
> n_voltage so regulator_list_voltage() won't fail while checking the boundary 
> for
> selector before calling list_voltage callback.
> 
> Signed-off-by: Axel Lin 
> ---
> Hi Ashish,
>   I don't have this hardware to test this patch.
>   Can you help to review and test this patch?
> Thank you,
> Axel
This patch looks good to me.
I have tested this patch on SMDK6410 using the DA9055 evaluation board.
Tested-by: Ashish Jangam 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v1 1/1] mfd: fix for i2c issue DA9052/53 PMIC

2012-11-02 Thread Ashish Jangam
There is an issue where the DA9052/53-AA/BA/BB PMIC either locks up or fails to
respond following a system Reset. This could result in a second write
in which the bus writes the current content of the write buffer to address
of the last I2C access.

The failure case is where this unwanted write transfers incorrect data to
a critical register.

This patch fixes this issue by following any read or write with a dummy read
to a safe register address. A safe register address is one where the contents
will not affect the operation of the system.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
 drivers/mfd/da9052-i2c.c  |   56 +
 include/linux/mfd/da9052/da9052.h |   47 --
 include/linux/mfd/da9052/reg.h|3 ++
 3 files changed, 102 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 352c58b..90eff9a 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -27,6 +27,62 @@
 #include 
 #endif
 
+/* safe register to park I2C operation */
+static inline bool is_i2c_safe_reg(unsigned char reg)
+{
+   switch (reg) {
+   case DA9052_STATUS_A_REG:
+   case DA9052_STATUS_B_REG:
+   case DA9052_STATUS_C_REG:
+   case DA9052_STATUS_D_REG:
+   case DA9052_ADC_RES_L_REG:
+   case DA9052_ADC_RES_H_REG:
+   case DA9052_VDD_RES_REG:
+   case DA9052_ICHG_AV_REG:
+   case DA9052_TBAT_RES_REG:
+   case DA9052_ADCIN4_RES_REG:
+   case DA9052_ADCIN5_RES_REG:
+   case DA9052_ADCIN6_RES_REG:
+   case DA9052_TJUNC_RES_REG:
+   case DA9052_TSI_X_MSB_REG:
+   case DA9052_TSI_Y_MSB_REG:
+   case DA9052_TSI_LSB_REG:
+   case DA9052_TSI_Z_MSB_REG:
+   return true;
+   default:
+   return false;
+   }
+}
+
+/*
+ * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC
+ * gets lockup up or fails to respond following a system reset.
+ * This fix is to follow any read or write with a dummy read to a safe
+ * register.
+ */
+int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
+{
+   int val;
+
+   switch (da9052->chip_id) {
+   case DA9052:
+   case DA9053_AA:
+   case DA9053_BA:
+   case DA9053_BB:
+   /* A dummy read to a safe register address. */
+   if (!is_i2c_safe_reg(reg))
+   return regmap_read(da9052->regmap, DA9052_PARK_REGISTER,
+  &val);
+   break;
+   default:
+   /* Do nothing */
+   break;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(da9052_i2c_fix);
+
 static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
 {
int reg_val, ret;
diff --git a/include/linux/mfd/da9052/da9052.h 
b/include/linux/mfd/da9052/da9052.h
index 0507c4c..0bc0383 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -101,6 +101,16 @@ struct da9052 {
int chip_irq;
 };
 
+/* I2C Fix */
+#if defined(CONFIG_MFD_DA9052_SPI)
+static inline int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
+{
+   return 0;
+}
+#else
+int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg);
+#endif
+
 /* ADC API */
 int da9052_adc_manual_read(struct da9052 *da9052, unsigned char channel);
 int da9052_adc_read_temp(struct da9052 *da9052);
@@ -113,32 +123,61 @@ static inline int da9052_reg_read(struct da9052 *da9052, 
unsigned char reg)
ret = regmap_read(da9052->regmap, reg, &val);
if (ret < 0)
return ret;
+
+   ret = da9052_i2c_fix(da9052, reg);
+   if (ret < 0)
+   return ret;
+
return val;
 }
 
 static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
unsigned char val)
 {
-   return regmap_write(da9052->regmap, reg, val);
+   int ret;
+
+   ret = regmap_write(da9052->regmap, reg, val);
+   if (ret < 0)
+   return ret;
+
+   return da9052_i2c_fix(da9052, reg);
 }
 
 static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
 unsigned reg_cnt, unsigned char *val)
 {
-   return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
+   int ret;
+
+   ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
+   if (ret < 0)
+   return ret;
+
+   return da9052_i2c_fix(da9052, reg);
 }
 
 static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
  unsigned reg_cnt, unsigned char *val)
 {
-   return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
+   int ret;
+
+   ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
+   if (ret < 0)
+   return ret;
+
+   return da9052_i2c_fix(da9052, reg);
 }
 

Re: [patch v1 1/2] mfd: i2c issue fix for DA9052/53 and support for DA9053-BC

2012-11-02 Thread Ashish Jangam
On Thu, 2012-11-01 at 14:31 +, Mark Brown wrote:
> On Thu, Nov 01, 2012 at 11:48:42AM +0530, Ashish Jangam wrote:
> 
> > This patch fixes this issue to by following any read or write with a dummy 
> > read
> > to a safe register address. A safe register address is one where the 
> > contents
> > will not affect the operation of the system.
> 
> > Apart from this the patch also adds support to the DA9053-BC PMIC chip
> 
> This is two separate changes and so should be two separate patches (one
> is a bugfix and one isn't...).
I merged these two changes since I2C fix has got some dependency on
DA9053-BC PMIC. But I can separate out the things, its better.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v4 2/7] regulator: DA9055 regulator driver

2012-11-01 Thread Ashish Jangam
This is the Regulator patch for the DA9055 PMIC and has got dependency on
the DA9055 MFD core.

This patch support all of the DA9055 regulators. The output voltages are
fully programmable through I2C interface only. The platform data with regulation
constraints is passed down from the board to the regulator.

This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation board
was connected to the SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v4:
- Remove the unsupported regulator IDLE mode
- Fix the missing break condition
- In function *_get_voltage_sel() use of direct register values
- In fuction *_set_voltage_sel() set voltage is placed in if/else
- In suspend related functions took care of GPIO regulator selection
  condition.
- Fix indentation issue in find_regulator_info()
changes since version v3:
- Use of regulator framework API regulator_map_voltage_linear()
   and regulator_list_voltage_linear().
- Modify comments to indicate GPIO pins are muxed.
- Get the GPIO number from platform data.
changes since v2:
- restructuring of GPIO regulator initialization code.
---
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  663 ++
 include/linux/mfd/da9055/pdata.h |   27 ++-
 4 files changed, 698 insertions(+), 3 deletions(-)
 create mode 100644 drivers/regulator/da9055-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 7b920c7..d1fa325 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -109,6 +109,16 @@ config REGULATOR_DA9052
  This driver supports the voltage regulators of DA9052-BC and
  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA9055
+   tristate "Dialog Semiconductor DA9055 regulators"
+   depends on MFD_DA9055
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9055-regulator.
+
 config REGULATOR_FAN53555
tristate "Fairchild FAN53555 Regulator"
depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index db274dc..c4e2b2b 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o
diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
new file mode 100644
index 000..577a58e
--- /dev/null
+++ b/drivers/regulator/da9055-regulator.c
@@ -0,0 +1,663 @@
+/*
+* Regulator driver for DA9055 PMIC
+*
+* Copyright(c) 2012 Dialog Semiconductor Ltd.
+*
+* Author: David Dajun Chen 
+*
+* 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
+* (at your option) any later version.
+*
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DA9055_MIN_UA  0
+#define DA9055_MAX_UA  3
+
+#define DA9055_LDO_MODE_SYNC   0
+#define DA9055_LDO_MODE_SLEEP  1
+
+#define DA9055_BUCK_MODE_SLEEP 1
+#define DA9055_BUCK_MODE_SYNC  2
+#define DA9055_BUCK_MODE_AUTO  3
+
+/* DA9055 REGULATOR IDs */
+#define DA9055_ID_BUCK10
+#define DA9055_ID_BUCK21
+#define DA9055_ID_LDO1 2
+#define DA9055_ID_LDO2 3
+#define DA9055_ID_LDO3 4
+#define DA9055_ID_LDO4 5
+#define DA9055_ID_LDO5 6
+#define DA9055_ID_LDO6 7
+
+/* DA9055 BUCK current limit */
+static const int da9055_current_limits[] = { 50, 60, 70, 80 };
+
+struct da9055_conf_reg {
+   int reg;
+   int sel_mask;
+   int en_mask;
+};
+
+struct da9055_volt_reg {
+   int reg_a;
+   int reg_b;
+   int sl_shift;
+   int v_offset;
+   int v_mask;
+   int v_shift;
+};
+
+struct da9055_mode_reg {
+   int reg;
+   int mask;
+   int shift;
+};
+
+struct da9055_regulator_info {
+   struct regulator_desc reg_desc;
+   struct da9055_conf_reg conf;
+   struct da9055_volt_reg volt;
+   struct da9055_mode_reg mode;
+};
+
+struct da9055_regulator {
+   struct da9055 *da9055;
+   struct da9055_regulator_info *info;
+   struct regulator_dev *rdev;
+   enum gpio_select reg_rselect;
+};
+
+static unsigned int da9055_

[Patch v4 2/7] regulator: DA9055 regulator driver

2012-11-01 Thread Ashish Jangam
This is the Regulator patch for the DA9055 PMIC and has got dependency on
the DA9055 MFD core.

This patch support all of the DA9055 regulators. The output voltages are
fully programmable through I2C interface only. The platform data with regulation
constraints is passed down from the board to the regulator.

This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation board
was connected to the SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v4:
- Remove the unsupported regulator IDLE mode
- Fix the missing break condition
- In function *_get_voltage_sel() use of direct register values
- In fuction *_set_voltage_sel() set voltage is placed in if/else
- In suspend related functions took care of GPIO regulator selection
  condition.
- Fix indentation issue in find_regulator_info()
changes since version v3:
- Use of regulator framework API regulator_map_voltage_linear()
   and regulator_list_voltage_linear().
- Modify comments to indicate GPIO pins are muxed.
- Get the GPIO number from platform data.
changes since v2:
- restructuring of GPIO regulator initialization code.
---
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  663 ++
 include/linux/mfd/da9055/pdata.h |   27 ++-
 4 files changed, 698 insertions(+), 3 deletions(-)
 create mode 100644 drivers/regulator/da9055-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 7b920c7..d1fa325 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -109,6 +109,16 @@ config REGULATOR_DA9052
  This driver supports the voltage regulators of DA9052-BC and
  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA9055
+   tristate "Dialog Semiconductor DA9055 regulators"
+   depends on MFD_DA9055
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9055-regulator.
+
 config REGULATOR_FAN53555
tristate "Fairchild FAN53555 Regulator"
depends on I2C
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index db274dc..c4e2b2b 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o
diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
new file mode 100644
index 000..577a58e
--- /dev/null
+++ b/drivers/regulator/da9055-regulator.c
@@ -0,0 +1,663 @@
+/*
+* Regulator driver for DA9055 PMIC
+*
+* Copyright(c) 2012 Dialog Semiconductor Ltd.
+*
+* Author: David Dajun Chen 
+*
+* 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
+* (at your option) any later version.
+*
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DA9055_MIN_UA  0
+#define DA9055_MAX_UA  3
+
+#define DA9055_LDO_MODE_SYNC   0
+#define DA9055_LDO_MODE_SLEEP  1
+
+#define DA9055_BUCK_MODE_SLEEP 1
+#define DA9055_BUCK_MODE_SYNC  2
+#define DA9055_BUCK_MODE_AUTO  3
+
+/* DA9055 REGULATOR IDs */
+#define DA9055_ID_BUCK10
+#define DA9055_ID_BUCK21
+#define DA9055_ID_LDO1 2
+#define DA9055_ID_LDO2 3
+#define DA9055_ID_LDO3 4
+#define DA9055_ID_LDO4 5
+#define DA9055_ID_LDO5 6
+#define DA9055_ID_LDO6 7
+
+/* DA9055 BUCK current limit */
+static const int da9055_current_limits[] = { 50, 60, 70, 80 };
+
+struct da9055_conf_reg {
+   int reg;
+   int sel_mask;
+   int en_mask;
+};
+
+struct da9055_volt_reg {
+   int reg_a;
+   int reg_b;
+   int sl_shift;
+   int v_offset;
+   int v_mask;
+   int v_shift;
+};
+
+struct da9055_mode_reg {
+   int reg;
+   int mask;
+   int shift;
+};
+
+struct da9055_regulator_info {
+   struct regulator_desc reg_desc;
+   struct da9055_conf_reg conf;
+   struct da9055_volt_reg volt;
+   struct da9055_mode_reg mode;
+};
+
+struct da9055_regulator {
+   struct da9055 *da9055;
+   struct da9055_regulator_info *info;
+   struct regulator_dev *rdev;
+   enum gpio_select reg_rselect;
+};
+
+static unsigned int da9055_

[patch v2 2/2] regulator: support for DA9053-BC

2012-10-31 Thread Ashish Jangam
>From 7b2e8c26c995d775f17491fcce7258e662009d0d Mon Sep 17 00:00:00 2001
From: Ashish Jangam 
Date: Thu, 1 Nov 2012 11:06:17 +0530
Subject: [PATCH 2/2] [patch v 2/1] regulator: support for DA9053-BC

This patch adds DA9053-BC PMIC support to the existing DA9052/53
regulator driver

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
 drivers/regulator/da9052-regulator.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/da9052-regulator.c 
b/drivers/regulator/da9052-regulator.c
index 27355b1..22fb8cf 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -354,6 +354,7 @@ static inline struct da9052_regulator_info 
*find_regulator_info(u8 chip_id,
case DA9053_AA:
case DA9053_BA:
case DA9053_BB:
+   case DA9053_BC:
for (i = 0; i < ARRAY_SIZE(da9053_regulator_info); i++) {
info = &da9053_regulator_info[i];
if (info->reg_desc.id == id)
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch v1 1/2] mfd: i2c issue fix for DA9052/53 and support for DA9053-BC

2012-10-31 Thread Ashish Jangam
There is an issue where the DA9052/53-AA/BA/BB PMIC either locks up or fails to
respond following a system Reset. This could result in a second write
in which the bus writes the current content of the write buffer to address
of the last I2C access.

The failure case is where this unwanted write transfers incorrect data to
a critical register.

This patch fixes this issue to by following any read or write with a dummy read
to a safe register address. A safe register address is one where the contents
will not affect the operation of the system.

Apart from this the patch also adds support to the DA9053-BC PMIC chip

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
 drivers/mfd/da9052-i2c.c  |   58 +
 drivers/mfd/da9052-spi.c  |1 +
 include/linux/mfd/da9052/da9052.h |   48 --
 include/linux/mfd/da9052/reg.h|3 ++
 4 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 352c58b..279e5f8 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -27,6 +27,62 @@
 #include 
 #endif
 
+/* safe register to park I2C operation */
+static inline bool is_i2c_safe_reg(unsigned char reg)
+{
+   switch (reg) {
+   case DA9052_STATUS_A_REG:
+   case DA9052_STATUS_B_REG:
+   case DA9052_STATUS_C_REG:
+   case DA9052_STATUS_D_REG:
+   case DA9052_ADC_RES_L_REG:
+   case DA9052_ADC_RES_H_REG:
+   case DA9052_VDD_RES_REG:
+   case DA9052_ICHG_AV_REG:
+   case DA9052_TBAT_RES_REG:
+   case DA9052_ADCIN4_RES_REG:
+   case DA9052_ADCIN5_RES_REG:
+   case DA9052_ADCIN6_RES_REG:
+   case DA9052_TJUNC_RES_REG:
+   case DA9052_TSI_X_MSB_REG:
+   case DA9052_TSI_Y_MSB_REG:
+   case DA9052_TSI_LSB_REG:
+   case DA9052_TSI_Z_MSB_REG:
+   return true;
+   default:
+   return false;
+   }
+}
+
+/*
+ * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC
+ * gets lockup up or fails to respond following a system reset.
+ * This fix is to follow any read or write with a dummy read to a safe
+ * register.
+ */
+int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
+{
+   int val;
+
+   switch (da9052->chip_id) {
+   case DA9052:
+   case DA9053_AA:
+   case DA9053_BA:
+   case DA9053_BB:
+   /* A dummy read to a safe register address. */
+   if (!is_i2c_safe_reg(reg))
+   return regmap_read(da9052->regmap, DA9052_PARK_REGISTER,
+  &val);
+   break;
+   default:
+   /* Do nothing */
+   break;
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL(da9052_i2c_fix);
+
 static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
 {
int reg_val, ret;
@@ -51,6 +107,7 @@ static const struct i2c_device_id da9052_i2c_id[] = {
{"da9053-aa", DA9053_AA},
{"da9053-ba", DA9053_BA},
{"da9053-bb", DA9053_BB},
+   {"da9053-bc", DA9053_BC},
{}
 };
 
@@ -60,6 +117,7 @@ static const struct of_device_id dialog_dt_ids[] = {
{ .compatible = "dlg,da9053-aa", .data = &da9052_i2c_id[1] },
{ .compatible = "dlg,da9053-ab", .data = &da9052_i2c_id[2] },
{ .compatible = "dlg,da9053-bb", .data = &da9052_i2c_id[3] },
+   { .compatible = "dlg,da9053-bc", .data = &da9052_i2c_id[4] },
{ /* sentinel */ }
 };
 #endif
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index dbeadc5..524bd76 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -71,6 +71,7 @@ static struct spi_device_id da9052_spi_id[] = {
{"da9053-aa", DA9053_AA},
{"da9053-ba", DA9053_BA},
{"da9053-bb", DA9053_BB},
+   {"da9053-bc", DA9053_BC},
{}
 };
 
diff --git a/include/linux/mfd/da9052/da9052.h 
b/include/linux/mfd/da9052/da9052.h
index 0507c4c..21b934a 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -83,6 +83,7 @@ enum da9052_chip_id {
DA9053_AA,
DA9053_BA,
DA9053_BB,
+   DA9053_BC,
 };
 
 struct da9052_pdata;
@@ -101,6 +102,16 @@ struct da9052 {
int chip_irq;
 };
 
+/* I2C Fix */
+#if defined(CONFIG_MFD_DA9052_SPI)
+static inline int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
+{
+   return 0;
+}
+#else
+int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg);
+#endif
+
 /* ADC API */
 int da9052_adc_manual_read(struct da9052 *da9052, unsigned char channel);
 int da9052_adc_read_temp(struct da9052 *da9052);
@@ -113,32 +124,61 @@ static inline int da9052_reg_read(struct da9052 *da9052, 
unsigned char reg)
ret = regmap_read(da9052->regmap, reg,

Re: [PATCH] hwmon: da9055: Fix chan_mux[DA9055_ADC_ADCIN3] setting

2012-10-29 Thread Ashish Jangam
On Mon, 2012-10-29 at 17:52 -0700, Guenter Roeck wrote:
> On Mon, Oct 29, 2012 at 04:34:38PM +0800, Axel Lin wrote:
> > Set chan_mux[DA9055_ADC_ADCIN3] = DA9055_ADC_MUX_ADCIN3.
> > 
> > Signed-off-by: Axel Lin 
> > ---
> > Hi,
> >   This looks like a typo, but I don't have a hardware to test it.
> > Axel
> >  drivers/hwmon/da9055-hwmon.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c
> > index 0b41f2c..3a3377c 100644
> > --- a/drivers/hwmon/da9055-hwmon.c
> > +++ b/drivers/hwmon/da9055-hwmon.c
> > @@ -54,7 +54,7 @@ static const u8 chan_mux[DA9055_ADC_TJUNC + 1] = {
> > [DA9055_ADC_VSYS]   = DA9055_ADC_MUX_VSYS,
> > [DA9055_ADC_ADCIN1] = DA9055_ADC_MUX_ADCIN1,
> > [DA9055_ADC_ADCIN2] = DA9055_ADC_MUX_ADCIN2,
> > -   [DA9055_ADC_ADCIN3] = DA9055_ADC_MUX_ADCIN1,
> > +   [DA9055_ADC_ADCIN3] = DA9055_ADC_MUX_ADCIN3,
> > [DA9055_ADC_TJUNC]  = DA9055_ADC_MUX_T_SENSE,
> >  };
> 
> Very much loks like a typo.
> 
> David, Ashish, any comments ? I would like to get your Ack before applying it.
> 
> Thanks,
> Guenter
> 
Yes, its typo so you can apply the patch.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 2/7] Regulator: DA9055 Regulator driver

2012-10-29 Thread Ashish Jangam
On Sat, 2012-10-27 at 22:59 +0100, Mark Brown wrote:
> On Thu, Oct 11, 2012 at 03:39:24PM +0530, Ashish Jangam wrote:
> 
> > This is the Regulator patch for the DA9055 PMIC and has got dependency on
> > the DA9055 MFD core.
> 
> Always submit patches with subject lines appropriate for the subsystem,
> this helps get your patch noticed.  People do things like search their
> mailboxes for subsystem prefixes when looking for things they need to
> review.
In subject line apart from "regulator" I will introduce "next" too. 
> 
> > This patch support all of the DA9055 regulators. The output voltages are
> > fully programmable through I2C interface only. The platform data with 
> > regulation
> > constraints is passed down from the board to the regulator.
> > 
> > +   switch (mode) {
> > +   case REGULATOR_MODE_FAST:
> > +   val = DA9055_BUCK_MODE_SYNC << info->mode.shift;
> > +   break;
> > +   case REGULATOR_MODE_NORMAL:
> > +   val = DA9055_BUCK_MODE_AUTO << info->mode.shift;
> > +   break;
> > +   case REGULATOR_MODE_IDLE:
> > +   case REGULATOR_MODE_STANDBY:
> > +   val = DA9055_BUCK_MODE_SLEEP << info->mode.shift;
> > +   break;
> 
> _IDLE and _STANDBY should have different effects if they're both
> implemented; pick one.  From the rest of the code it looks like it
> should be _STANDBY.
Yes, _STANDBY should be picked only.  
> 
> > +   switch (mode) {
> > +   case REGULATOR_MODE_NORMAL:
> > +   case REGULATOR_MODE_FAST:
> > +   val = DA9055_LDO_MODE_SYNC;
> > +   break;
> > +   case REGULATOR_MODE_IDLE:
> > +   case REGULATOR_MODE_STANDBY:
> > +   val = DA9055_LDO_MODE_SLEEP;
> > +   }
> 
> Similarly here.  You're also missing a break;
Ok, will fix this.
> 
> > +   /* Get the voltage for the activer register set A/B */
> > +   if (ret == DA9055_REGUALTOR_SET_A)
> > +   ret = da9055_reg_read(regulator->da9055, volt.reg_a);
> > +   else
> > +   ret = da9055_reg_read(regulator->da9055, volt.reg_b);
> > +
> > +   if (ret < 0)
> > +   return ret;
> > +
> > +   sel = ((ret & volt.v_mask) - volt.v_offset);
> 
> Why not just use the register values directly and refuse to write ones
> That are too low?  This would simplify things a little as you'd only
> need to check 
If I understood it correctly, v_offset should be used to check register
values as seen in the below sample code snippet
sel = ret & mask;
if (sel <= v_offset)
return 0;
else
return sel
> 
> > +   /* Set the voltage */
> > +   if (ret == DA9055_REGUALTOR_SET_A)
> > +   return da9055_regulator_set_voltage_bits(rdev, info->volt.reg_a,
> > +selector);
> > +
> > +   return da9055_regulator_set_voltage_bits(rdev, info->volt.reg_b,
> > +selector);
> 
> This is confusingly written - it should be either a switch or an if/else
> really.
if/else seems to be sensible here.
> 
> > +   /* Select register set B for suspend voltage ramping. */
> > +   ret = da9055_reg_update(regulator->da9055, info->conf.reg,
> > +   info->conf.sel_mask, DA9055_SEL_REG_B);
> > +   if (ret < 0)
> > +   return ret;
> 
> This doesn't seem like it plays nicely with the GPIO selection in normal
> set_voltage() - does it need to check to see if register set B might be
> used in normal operation and refuse to run if it could?
Thanks for catching this. Need to add condition to check if GPIO is
selected. 
> 
> > +   for (i = 0; i < ARRAY_SIZE(da9055_regulator_info); i++) {
> > +   info = &da9055_regulator_info[i];
> > +   if (info->reg_desc.id == id)
> > +   return info;
> > +   }
> > +
> 
> The indentation here is *very* messed up.  I'd suggest not omitting any
> braces.
Ok, will fix indentation and put braces around if condition.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v3 3/7] RTC: DA9055 RTC driver

2012-10-23 Thread Ashish Jangam
Does this patch looks good?
On Thu, 2012-10-11 at 16:10 +0530, Ashish Jangam wrote:
> This is the RTC patch for the DA9055 PMIC. This patch has got dependency on
> the DA9055 MFD core.
> 
> This patch is functionally tested on Samsung SMDKV6410.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
> changes since version v3:
> - use of module_platform_driver macro
> - add the regmap virtual irq map API.
> changes since version v2:
> - Use of devm_request_threaded_irq API
> ---
>  drivers/rtc/Kconfig  |   10 +
>  drivers/rtc/Makefile |1 +
>  drivers/rtc/rtc-da9055.c |  413 
> ++
>  3 files changed, 424 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 drivers/rtc/Kconfig
>  create mode 100644 drivers/rtc/rtc-da9055.c
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> old mode 100644
> new mode 100755
> index fabc99a..6050f8b
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -571,6 +571,16 @@ config RTC_DRV_DA9052
> Say y here to support the RTC driver for Dialog Semiconductor
> DA9052-BC and DA9053-AA/Bx PMICs.
>  
> +config RTC_DRV_DA9055
> + tristate "Dialog Semiconductor DA9055 RTC"
> + depends on MFD_DA9055
> + help
> +   If you say yes here you will get support for the
> +   RTC of the Dialog DA9055 PMIC.
> +
> +   This driver can also be built as a module. If so, the module
> +   will be called rtc-da9055
> +
>  config RTC_DRV_EFI
>   tristate "EFI RTC"
>   depends on IA64
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index 0d5b2b6..b4c162f 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802)+= rtc-bq4802.o
>  obj-$(CONFIG_RTC_DRV_CMOS)   += rtc-cmos.o
>  obj-$(CONFIG_RTC_DRV_COH901331)  += rtc-coh901331.o
>  obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o
> +obj-$(CONFIG_RTC_DRV_DA9055) += rtc-da9055.o
>  obj-$(CONFIG_RTC_DRV_DAVINCI)+= rtc-davinci.o
>  obj-$(CONFIG_RTC_DRV_DM355EVM)   += rtc-dm355evm.o
>  obj-$(CONFIG_RTC_DRV_VRTC)   += rtc-mrst.o
> diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
> new file mode 100644
> index 000..2304647
> --- /dev/null
> +++ b/drivers/rtc/rtc-da9055.c
> @@ -0,0 +1,413 @@
> +/*
> + * Real time clock driver for DA9055
> + *
> + * Copyright(c) 2012 Dialog Semiconductor Ltd.
> + *
> + * Author: Dajun Dajun Chen 
> + *
> + * 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
> + * (at your option) any later version.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +struct da9055_rtc {
> + struct rtc_device *rtc;
> + struct da9055 *da9055;
> + int alarm_enable;
> +};
> +
> +static int da9055_rtc_enable_alarm(struct da9055_rtc *rtc, bool enable)
> +{
> + int ret;
> + if (enable) {
> + ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
> + DA9055_RTC_ALM_EN,
> + DA9055_RTC_ALM_EN);
> + if (ret != 0)
> + dev_err(rtc->da9055->dev, "Failed to enable ALM: %d\n",
> + ret);
> + rtc->alarm_enable = 1;
> + } else {
> + ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
> + DA9055_RTC_ALM_EN, 0);
> + if (ret != 0)
> + dev_err(rtc->da9055->dev,
> + "Failed to disable ALM: %d\n", ret);
> + rtc->alarm_enable = 0;
> + }
> + return ret;
> +}
> +
> +static irqreturn_t da9055_rtc_alm_irq(int irq, void *data)
> +{
> + struct da9055_rtc *rtc = data;
> +
> + da9055_rtc_enable_alarm(rtc, 0);
> + rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int da9055_read_alarm(struct da9055 *da9055, struct rtc_time *rtc_tm)
> +{
> + int ret;
> + uint8_t v[5];
> +
> + ret = da9055_group_read(da9055, DA9055_REG_ALARM_MI, 5, v);
> + if (ret != 0) {
> + dev_err(da9055->dev, "Failed to group read ALM: %d\n", ret);
> + return ret;
> + }
> +
> + rtc_tm->tm_year = (v[4] & DA9055_RTC_ALM_YEAR) + 100;
> +

Re: [Patch v3 2/7] Regulator: DA9055 Regulator driver

2012-10-23 Thread Ashish Jangam
Does this patch looks good for you?
On Thu, 2012-10-11 at 15:39 +0530, Ashish Jangam wrote:
> This is the Regulator patch for the DA9055 PMIC and has got dependency on
> the DA9055 MFD core.
> 
> This patch support all of the DA9055 regulators. The output voltages are
> fully programmable through I2C interface only. The platform data with 
> regulation
> constraints is passed down from the board to the regulator.
> 
> This patch is functionally tested on SMDK6410 board. DA9055 Evaluation board
> was connected to the SMDK6410 board.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
> changes since version v3:
> - Use of regulator framework API regulator_map_voltage_linear()
>and regulator_list_voltage_linear().
> - Remove struct members min and max from the struct da9055_regulator_info.
> - Modify comments to indicate GPIO pins are muxed.
> - Get the GPIO number from platform data.
> changes since v2:
> - restructuring of GPIO regulator initialization code.
> ---
>  drivers/regulator/Kconfig|   10 +
>  drivers/regulator/Makefile   |1 +
>  drivers/regulator/da9055-regulator.c |  654 
> ++
>  include/linux/mfd/da9055/pdata.h |   27 ++-
>  4 files changed, 689 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/regulator/da9055-regulator.c
> 
> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index 129c827..0bd6db1 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -109,6 +109,16 @@ config REGULATOR_DA9052
> This driver supports the voltage regulators of DA9052-BC and
> DA9053-AA/Bx PMIC.
>  
> +config REGULATOR_DA9055
> + tristate "Dialog Semiconductor DA9055 regulators"
> + depends on MFD_DA9055
> + help
> +   Say y here to support the BUCKs and LDOs regulators found on
> +   Dialog Semiconductor DA9055 PMIC.
> +
> +   This driver can also be built as a module. If so, the module
> +   will be called da9055-regulator.
> +
>  config REGULATOR_ANATOP
>   tristate "Freescale i.MX on-chip ANATOP LDO regulators"
>   depends on MFD_ANATOP
> diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
> index 3a0dbc5..950b38b 100644
> --- a/drivers/regulator/Makefile
> +++ b/drivers/regulator/Makefile
> @@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
>  obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
>  obj-$(CONFIG_REGULATOR_DA903X)   += da903x.o
>  obj-$(CONFIG_REGULATOR_DA9052)   += da9052-regulator.o
> +obj-$(CONFIG_REGULATOR_DA9055)   += da9055-regulator.o
>  obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
>  obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
>  obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
> diff --git a/drivers/regulator/da9055-regulator.c 
> b/drivers/regulator/da9055-regulator.c
> new file mode 100644
> index 000..a5da4f7
> --- /dev/null
> +++ b/drivers/regulator/da9055-regulator.c
> @@ -0,0 +1,654 @@
> +/*
> +* Regulator driver for DA9055 PMIC
> +*
> +* Copyright(c) 2012 Dialog Semiconductor Ltd.
> +*
> +* Author: David Dajun Chen 
> +*
> +* 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
> +* (at your option) any later version.
> +*
> +*/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#define DA9055_MIN_UA0
> +#define DA9055_MAX_UA3
> +
> +#define DA9055_LDO_MODE_SYNC 0
> +#define DA9055_LDO_MODE_SLEEP1
> +
> +#define DA9055_BUCK_MODE_SLEEP   1
> +#define DA9055_BUCK_MODE_SYNC2
> +#define DA9055_BUCK_MODE_AUTO3
> +
> +/* DA9055 REGULATOR IDs */
> +#define DA9055_ID_BUCK1  0
> +#define DA9055_ID_BUCK2  1
> +#define DA9055_ID_LDO1   2
> +#define DA9055_ID_LDO2   3
> +#define DA9055_ID_LDO3   4
> +#define DA9055_ID_LDO4   5
> +#define DA9055_ID_LDO5   6
> +#define DA9055_ID_LDO6   7
> +
> +/* DA9055 BUCK current limit */
> +static const int da9055_current_limits[] = { 50, 60, 70, 80 
> };
> +
> +struct da9055_conf_reg {
> + int reg;
> + int sel_mask;
> + int en_mask;
> +};
> +
> +struct da9055_volt_reg {
> + int reg_a;
> + int reg_b;
> + int sl_shift;
> + int v_offs

Re: [Patch v4 7/7] Onkey: DA9055 Onkey driver

2012-10-23 Thread Ashish Jangam
Does this patch looks good?
On Fri, 2012-10-12 at 15:02 +0530, Ashish Jangam wrote:
> This is the ONKEY driver of the Dialog DA9055 PMIC and depends on the DA9055 
> MFD
> core driver.
> 
> This patch is functionally tested on SMDK6410 board.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
> changes since v4:
> - remove of devm_*irq API
> changes since v3:
> - used of module_platform_driver macro
> - add regmap virtual irq function
> changes since v2:
> - add support for handling the button release case
> ---
>  drivers/input/misc/Kconfig|   10 ++
>  drivers/input/misc/Makefile   |1 +
>  drivers/input/misc/da9055_onkey.c |  171 
> +
>  3 files changed, 182 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/input/misc/da9055_onkey.c
> 
> diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
> index 7c0f1ec..6a45cb8 100644
> --- a/drivers/input/misc/Kconfig
> +++ b/drivers/input/misc/Kconfig
> @@ -486,6 +486,16 @@ config INPUT_DA9052_ONKEY
> To compile this driver as a module, choose M here: the
> module will be called da9052_onkey.
>  
> +config INPUT_DA9055_ONKEY
> + tristate "Dialog Semiconductor DA9055 ONKEY"
> + depends on MFD_DA9055
> + help
> +   Support the ONKEY of DA9055 PMICs as an input device
> +   reporting power button status.
> +
> +   To compile this driver as a module, choose M here: the module
> +   will be called da9055_onkey.
> +
>  config INPUT_DM355EVM
>   tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
>   depends on MFD_DM355EVM_MSP
> diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
> index 83fe6f5..23347e3 100644
> --- a/drivers/input/misc/Makefile
> +++ b/drivers/input/misc/Makefile
> @@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o
>  obj-$(CONFIG_INPUT_CMA3000_I2C)  += cma3000_d0x_i2c.o
>  obj-$(CONFIG_INPUT_COBALT_BTNS)  += cobalt_btns.o
>  obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o
> +obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o
>  obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o
>  obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o
>  obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o
> diff --git a/drivers/input/misc/da9055_onkey.c 
> b/drivers/input/misc/da9055_onkey.c
> new file mode 100644
> index 000..217b5ee
> --- /dev/null
> +++ b/drivers/input/misc/da9055_onkey.c
> @@ -0,0 +1,171 @@
> +/*
> + * ON pin driver for Dialog DA9055 PMICs
> + *
> + * Copyright(c) 2012 Dialog Semiconductor Ltd.
> + *
> + * Author: David Dajun Chen 
> + *
> + * 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 (at your
> + * option) any later version.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +struct da9055_onkey {
> + struct da9055 *da9055;
> + struct input_dev *input;
> + struct delayed_work work;
> +};
> +
> +static void da9055_onkey_query(struct da9055_onkey *onkey)
> +{
> + int key_stat;
> +
> + key_stat = da9055_reg_read(onkey->da9055, DA9055_REG_STATUS_A);
> + if (key_stat < 0) {
> + dev_err(onkey->da9055->dev,
> + "Failed to read onkey event %d\n", key_stat);
> + } else {
> + key_stat &= DA9055_NOKEY_STS;
> + /*
> +  * Onkey status bit is cleared when onkey button is relased.
> +  */
> + if (!key_stat) {
> + input_report_key(onkey->input, KEY_POWER, 0);
> + input_sync(onkey->input);
> + }
> + }
> +
> + /*
> +  * Interrupt is generated only when the ONKEY pin is asserted.
> +  * Hence the deassertion of the pin is simulated through work queue.
> +  */
> + if (key_stat)
> + schedule_delayed_work(&onkey->work, msecs_to_jiffies(10));
> +
> +}
> +
> +static void da9055_onkey_work(struct work_struct *work)
> +{
> + struct da9055_onkey *onkey = container_of(work, struct da9055_onkey,
> +   work.work);
> +
> + da9055_onkey_query(onkey);
> +}
> +
> +static irqreturn_t da9055_onkey_irq(int irq, void *data)
> +{
> + struct da9055_onkey *onkey = data;
> +
> + input_report_key(onkey

[Patch v4 7/7] Onkey: DA9055 Onkey driver

2012-10-12 Thread Ashish Jangam
This is the ONKEY driver of the Dialog DA9055 PMIC and depends on the DA9055 MFD
core driver.

This patch is functionally tested on SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since v4:
- remove of devm_*irq API
changes since v3:
- used of module_platform_driver macro
- add regmap virtual irq function
changes since v2:
- add support for handling the button release case
---
 drivers/input/misc/Kconfig|   10 ++
 drivers/input/misc/Makefile   |1 +
 drivers/input/misc/da9055_onkey.c |  171 +
 3 files changed, 182 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/da9055_onkey.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7c0f1ec..6a45cb8 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -486,6 +486,16 @@ config INPUT_DA9052_ONKEY
  To compile this driver as a module, choose M here: the
  module will be called da9052_onkey.
 
+config INPUT_DA9055_ONKEY
+   tristate "Dialog Semiconductor DA9055 ONKEY"
+   depends on MFD_DA9055
+   help
+ Support the ONKEY of DA9055 PMICs as an input device
+ reporting power button status.
+
+ To compile this driver as a module, choose M here: the module
+ will be called da9055_onkey.
+
 config INPUT_DM355EVM
tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
depends on MFD_DM355EVM_MSP
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 83fe6f5..23347e3 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000)   += cma3000_d0x.o
 obj-$(CONFIG_INPUT_CMA3000_I2C)+= cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DA9052_ONKEY)   += da9052_onkey.o
+obj-$(CONFIG_INPUT_DA9055_ONKEY)   += da9055_onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)   += dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)   += gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)   += gpio_tilt_polled.o
diff --git a/drivers/input/misc/da9055_onkey.c 
b/drivers/input/misc/da9055_onkey.c
new file mode 100644
index 000..217b5ee
--- /dev/null
+++ b/drivers/input/misc/da9055_onkey.c
@@ -0,0 +1,171 @@
+/*
+ * ON pin driver for Dialog DA9055 PMICs
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: David Dajun Chen 
+ *
+ * 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 (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct da9055_onkey {
+   struct da9055 *da9055;
+   struct input_dev *input;
+   struct delayed_work work;
+};
+
+static void da9055_onkey_query(struct da9055_onkey *onkey)
+{
+   int key_stat;
+
+   key_stat = da9055_reg_read(onkey->da9055, DA9055_REG_STATUS_A);
+   if (key_stat < 0) {
+   dev_err(onkey->da9055->dev,
+   "Failed to read onkey event %d\n", key_stat);
+   } else {
+   key_stat &= DA9055_NOKEY_STS;
+   /*
+* Onkey status bit is cleared when onkey button is relased.
+*/
+   if (!key_stat) {
+   input_report_key(onkey->input, KEY_POWER, 0);
+   input_sync(onkey->input);
+   }
+   }
+
+   /*
+* Interrupt is generated only when the ONKEY pin is asserted.
+* Hence the deassertion of the pin is simulated through work queue.
+*/
+   if (key_stat)
+   schedule_delayed_work(&onkey->work, msecs_to_jiffies(10));
+
+}
+
+static void da9055_onkey_work(struct work_struct *work)
+{
+   struct da9055_onkey *onkey = container_of(work, struct da9055_onkey,
+ work.work);
+
+   da9055_onkey_query(onkey);
+}
+
+static irqreturn_t da9055_onkey_irq(int irq, void *data)
+{
+   struct da9055_onkey *onkey = data;
+
+   input_report_key(onkey->input, KEY_POWER, 1);
+   input_sync(onkey->input);
+
+   da9055_onkey_query(onkey);
+
+   return IRQ_HANDLED;
+}
+
+static int __devinit da9055_onkey_probe(struct platform_device *pdev)
+{
+   struct input_dev *input_dev;
+   struct da9055 *da9055 = dev_get_drvdata(pdev->dev.parent);
+   struct da9055_onkey *onkey;
+   int irq, err;
+
+   irq = platform_get_irq_byname(pdev, "ONKEY");
+   if (irq < 0) {
+   dev_err(&pdev->dev,
+   "Failed to get an IRQ for input device, %d\n", irq);
+   return -EINVAL;
+   }
+
+   onkey = devm_kz

[Patch v2 6/7] Watchdog: DA9055 Watchdog driver

2012-10-12 Thread Ashish Jangam
This is the Watchdog patch for the DA9055 PMIC. This patch has got dependency on
the DA9055 MFD core.

This patch is functionally tested on SMDK6410

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v2:
- remove duplicate includes
- use of module_platform_driver macro
---
 drivers/watchdog/Kconfig  |   10 ++
 drivers/watchdog/Makefile |1 +
 drivers/watchdog/da9055_wdt.c |  216 +
 3 files changed, 227 insertions(+), 0 deletions(-)
 create mode 100644 drivers/watchdog/da9055_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 53d7571..eb51bf2 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -76,6 +76,16 @@ config DA9052_WATCHDOG
   Alternatively say M to compile the driver as a module,
   which will be called da9052_wdt.
 
+config DA9055_WATCHDOG
+   tristate "Dialog Semiconductor DA9055 Watchdog"
+   depends on MFD_DA9055
+   help
+ If you say yes here you get support for watchdog on the Dialog
+ Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module.  If so, the module
+ will be called da9055_wdt.
+
 config WM831X_WATCHDOG
tristate "WM831x watchdog"
depends on MFD_WM831X
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 572b39b..97bbdb3 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -164,6 +164,7 @@ obj-$(CONFIG_XEN_WDT) += xen_wdt.o
 
 # Architecture Independent
 obj-$(CONFIG_DA9052_WATCHDOG) += da9052_wdt.o
+obj-$(CONFIG_DA9055_WATCHDOG) += da9055_wdt.o
 obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o
 obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
 obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o
diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c
new file mode 100644
index 000..493f7b5
--- /dev/null
+++ b/drivers/watchdog/da9055_wdt.c
@@ -0,0 +1,216 @@
+/*
+ * System monitoring driver for DA9055 PMICs.
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: David Dajun Chen 
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout,
+"Watchdog cannot be stopped once started (default="
+__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+#define DA9055_DEF_TIMEOUT 4
+#define DA9055_TWDMIN  256
+
+struct da9055_wdt_data {
+   struct watchdog_device wdt;
+   struct da9055 *da9055;
+   struct kref kref;
+};
+
+static const struct {
+   u8 reg_val;
+   int user_time;  /* In seconds */
+} da9055_wdt_maps[] = {
+   { 0, 0 },
+   { 1, 2 },
+   { 2, 4 },
+   { 3, 8 },
+   { 4, 16 },
+   { 5, 32 },
+   { 5, 33 },  /* Actual time  32.768s so included both 32s and 33s */
+   { 6, 65 },
+   { 6, 66 },  /* Actual time 65.536s so include both, 65s and 66s */
+   { 7, 131 },
+};
+
+static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,
+ unsigned int timeout)
+{
+   struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
+   struct da9055 *da9055 = driver_data->da9055;
+   int ret, i;
+
+   for (i = 0; i < ARRAY_SIZE(da9055_wdt_maps); i++)
+   if (da9055_wdt_maps[i].user_time == timeout)
+   break;
+
+   if (i == ARRAY_SIZE(da9055_wdt_maps))
+   ret = -EINVAL;
+   else
+   ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_B,
+   DA9055_TWDSCALE_MASK,
+   da9055_wdt_maps[i].reg_val <<
+   DA9055_TWDSCALE_SHIFT);
+   if (ret < 0)
+   dev_err(da9055->dev,
+   "Failed to update timescale bit, %d\n", ret);
+
+   wdt_dev->timeout = timeout;
+
+   return ret;
+}
+
+static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
+{
+   struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
+   struct da9055 *da9055 = driver_data->da9055;
+   int ret;
+
+   /*
+* We have a minimum time for watchdog window called TWDMIN. A write
+* to the watchdog before this elapsed time will cause an error.
+*/
+   mdelay(DA9055_TWDMIN);
+
+   /* Reset the watchdog timer */
+   ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_E,
+   DA9055_WATCHDOG_MASK, 1);
+
+  

Re: [Patch v3 7/7] Onkey: DA9055 Onkey driver

2012-10-11 Thread Ashish Jangam
On Thu, 2012-10-11 at 09:28 -0700, Dmitry Torokhov wrote:
> Hi Ashish,
> 
> On Thu, Oct 11, 2012 at 04:15:16PM +0530, Ashish Jangam wrote:
> > This is the ONKEY driver of the Dialog DA9055 PMIC and depends on the 
> > DA9055 MFD
> > core driver.
> > 
> > This patch is functionally tested on SMDK6410 board.
> > 
> > Signed-off-by: David Dajun Chen 
> > Signed-off-by: Ashish Jangam 
> > ---
> > changes since v3:
> > - used of module_platform_driver macro
> > - add regmap virtual irq function
> > changes since v2:
> > - add support for button release
> > - use of devm_request_threaded_irq API
> 
> This API does not make any sense for your driver as you are scheduling
> delayed work from the IRQ handler. In such cases you need _first_ free
> IRQ and _then_ cancel the work but with devm_* you do it in opposite
> order.
I miss on this, will correct it.
> 
> Also, I think I mentioned this before - this driver looks like twin
> brother for da9055_onkey.c. How many of such parts do you have (or will
> you have)? Is there way to unify them?
Well, DA9052 and DA9055 register sets are entirely different even there
bit position are different and also few of its components have slight
different behaviour.  Device components functional difference can be
managed programmatic but, to unify these two different sets of register
will be impractical. In case of DA9052 I managed to club the DA9053
functionality within it but it was not possible for DA9055.
> 
> Thanks.
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v3 7/7] Onkey: DA9055 Onkey driver

2012-10-11 Thread Ashish Jangam
This is the ONKEY driver of the Dialog DA9055 PMIC and depends on the DA9055 MFD
core driver.

This patch is functionally tested on SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since v3:
- used of module_platform_driver macro
- add regmap virtual irq function
changes since v2:
- add support for button release
- use of devm_request_threaded_irq API
---
 drivers/input/misc/Kconfig|   10 ++
 drivers/input/misc/Makefile   |1 +
 drivers/input/misc/da9055_onkey.c |  167 +
 3 files changed, 178 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/da9055_onkey.c

diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7c0f1ec..6a45cb8 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -486,6 +486,16 @@ config INPUT_DA9052_ONKEY
  To compile this driver as a module, choose M here: the
  module will be called da9052_onkey.
 
+config INPUT_DA9055_ONKEY
+   tristate "Dialog Semiconductor DA9055 ONKEY"
+   depends on MFD_DA9055
+   help
+ Support the ONKEY of DA9055 PMICs as an input device
+ reporting power button status.
+
+ To compile this driver as a module, choose M here: the module
+ will be called da9055_onkey.
+
 config INPUT_DM355EVM
tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
depends on MFD_DM355EVM_MSP
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 83fe6f5..23347e3 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000)   += cma3000_d0x.o
 obj-$(CONFIG_INPUT_CMA3000_I2C)+= cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DA9052_ONKEY)   += da9052_onkey.o
+obj-$(CONFIG_INPUT_DA9055_ONKEY)   += da9055_onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)   += dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)   += gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)   += gpio_tilt_polled.o
diff --git a/drivers/input/misc/da9055_onkey.c 
b/drivers/input/misc/da9055_onkey.c
new file mode 100644
index 000..2addd6d
--- /dev/null
+++ b/drivers/input/misc/da9055_onkey.c
@@ -0,0 +1,167 @@
+/*
+ * ON pin driver for Dialog DA9055 PMICs
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: David Dajun Chen 
+ *
+ * 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 (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct da9055_onkey {
+   struct da9055 *da9055;
+   struct input_dev *input;
+   struct delayed_work work;
+};
+
+static void da9055_onkey_query(struct da9055_onkey *onkey)
+{
+   int key_stat;
+
+   key_stat = da9055_reg_read(onkey->da9055, DA9055_REG_STATUS_A);
+   if (key_stat < 0) {
+   dev_err(onkey->da9055->dev,
+   "Failed to read onkey event %d\n", key_stat);
+   } else {
+   key_stat &= DA9055_NOKEY_STS;
+   /*
+* Onkey status bit is cleared when onkey button is relased.
+*/
+   if (!key_stat) {
+   input_report_key(onkey->input, KEY_POWER, 0);
+   input_sync(onkey->input);
+   }
+   }
+
+   /*
+* Interrupt is generated only when the ONKEY pin is asserted.
+* Hence the deassertion of the pin is simulated through work queue.
+*/
+   if (key_stat)
+   schedule_delayed_work(&onkey->work, msecs_to_jiffies(10));
+
+}
+
+static void da9055_onkey_work(struct work_struct *work)
+{
+   struct da9055_onkey *onkey = container_of(work, struct da9055_onkey,
+ work.work);
+
+   da9055_onkey_query(onkey);
+}
+
+static irqreturn_t da9055_onkey_irq(int irq, void *data)
+{
+   struct da9055_onkey *onkey = data;
+
+   input_report_key(onkey->input, KEY_POWER, 1);
+   input_sync(onkey->input);
+
+   da9055_onkey_query(onkey);
+
+   return IRQ_HANDLED;
+}
+
+static int __devinit da9055_onkey_probe(struct platform_device *pdev)
+{
+   struct input_dev *input_dev;
+   struct da9055 *da9055 = dev_get_drvdata(pdev->dev.parent);
+   struct da9055_onkey *onkey;
+   int irq, err;
+
+   irq = platform_get_irq_byname(pdev, "ONKEY");
+   if (irq < 0) {
+   dev_err(&pdev->dev,
+   "Failed to get an IRQ for input device, %d\n", irq);
+   return -EINVAL;
+   }
+
+   onkey = devm_kzalloc(&pdev-&

[Patch v3 3/7] RTC: DA9055 RTC driver

2012-10-11 Thread Ashish Jangam
This is the RTC patch for the DA9055 PMIC. This patch has got dependency on
the DA9055 MFD core.

This patch is functionally tested on Samsung SMDKV6410.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v3:
- use of module_platform_driver macro
- add the regmap virtual irq map API.
changes since version v2:
- Use of devm_request_threaded_irq API
---
 drivers/rtc/Kconfig  |   10 +
 drivers/rtc/Makefile |1 +
 drivers/rtc/rtc-da9055.c |  413 ++
 3 files changed, 424 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 drivers/rtc/Kconfig
 create mode 100644 drivers/rtc/rtc-da9055.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
old mode 100644
new mode 100755
index fabc99a..6050f8b
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -571,6 +571,16 @@ config RTC_DRV_DA9052
  Say y here to support the RTC driver for Dialog Semiconductor
  DA9052-BC and DA9053-AA/Bx PMICs.
 
+config RTC_DRV_DA9055
+   tristate "Dialog Semiconductor DA9055 RTC"
+   depends on MFD_DA9055
+   help
+ If you say yes here you will get support for the
+ RTC of the Dialog DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-da9055
+
 config RTC_DRV_EFI
tristate "EFI RTC"
depends on IA64
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 0d5b2b6..b4c162f 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802)  += rtc-bq4802.o
 obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_COH901331)+= rtc-coh901331.o
 obj-$(CONFIG_RTC_DRV_DA9052)   += rtc-da9052.o
+obj-$(CONFIG_RTC_DRV_DA9055)   += rtc-da9055.o
 obj-$(CONFIG_RTC_DRV_DAVINCI)  += rtc-davinci.o
 obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o
diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
new file mode 100644
index 000..2304647
--- /dev/null
+++ b/drivers/rtc/rtc-da9055.c
@@ -0,0 +1,413 @@
+/*
+ * Real time clock driver for DA9055
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: Dajun Dajun Chen 
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+struct da9055_rtc {
+   struct rtc_device *rtc;
+   struct da9055 *da9055;
+   int alarm_enable;
+};
+
+static int da9055_rtc_enable_alarm(struct da9055_rtc *rtc, bool enable)
+{
+   int ret;
+   if (enable) {
+   ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
+   DA9055_RTC_ALM_EN,
+   DA9055_RTC_ALM_EN);
+   if (ret != 0)
+   dev_err(rtc->da9055->dev, "Failed to enable ALM: %d\n",
+   ret);
+   rtc->alarm_enable = 1;
+   } else {
+   ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
+   DA9055_RTC_ALM_EN, 0);
+   if (ret != 0)
+   dev_err(rtc->da9055->dev,
+   "Failed to disable ALM: %d\n", ret);
+   rtc->alarm_enable = 0;
+   }
+   return ret;
+}
+
+static irqreturn_t da9055_rtc_alm_irq(int irq, void *data)
+{
+   struct da9055_rtc *rtc = data;
+
+   da9055_rtc_enable_alarm(rtc, 0);
+   rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
+
+   return IRQ_HANDLED;
+}
+
+static int da9055_read_alarm(struct da9055 *da9055, struct rtc_time *rtc_tm)
+{
+   int ret;
+   uint8_t v[5];
+
+   ret = da9055_group_read(da9055, DA9055_REG_ALARM_MI, 5, v);
+   if (ret != 0) {
+   dev_err(da9055->dev, "Failed to group read ALM: %d\n", ret);
+   return ret;
+   }
+
+   rtc_tm->tm_year = (v[4] & DA9055_RTC_ALM_YEAR) + 100;
+   rtc_tm->tm_mon  = (v[3] & DA9055_RTC_ALM_MONTH) - 1;
+   rtc_tm->tm_mday = v[2] & DA9055_RTC_ALM_DAY;
+   rtc_tm->tm_hour = v[1] & DA9055_RTC_ALM_HOUR;
+   rtc_tm->tm_min  = v[0] & DA9055_RTC_ALM_MIN;
+
+   return rtc_valid_tm(rtc_tm);
+}
+
+static int da9055_set_alarm(struct da9055 *da9055, struct rtc_time *rtc_tm)
+{
+   int ret;
+   uint8_t v[2];
+
+   rtc_tm->tm_year -= 100;
+   rtc_tm->tm_mon += 1;
+
+   ret = da9055_reg_update(da9055, DA9055_REG_ALARM_MI,
+   DA9055_RTC_ALM_MIN, rtc_tm->tm_min);
+   if (ret != 0) {
+   dev_err(da9055->dev, &qu

[Patch v3 2/7] Regulator: DA9055 Regulator driver

2012-10-11 Thread Ashish Jangam
This is the Regulator patch for the DA9055 PMIC and has got dependency on
the DA9055 MFD core.

This patch support all of the DA9055 regulators. The output voltages are
fully programmable through I2C interface only. The platform data with regulation
constraints is passed down from the board to the regulator.

This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation board
was connected to the SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v3:
- Use of regulator framework API regulator_map_voltage_linear()
   and regulator_list_voltage_linear().
- Remove struct members min and max from the struct da9055_regulator_info.
- Modify comments to indicate GPIO pins are muxed.
- Get the GPIO number from platform data.
changes since v2:
- restructuring of GPIO regulator initialization code.
---
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  654 ++
 include/linux/mfd/da9055/pdata.h |   27 ++-
 4 files changed, 689 insertions(+), 3 deletions(-)
 create mode 100644 drivers/regulator/da9055-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 129c827..0bd6db1 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -109,6 +109,16 @@ config REGULATOR_DA9052
  This driver supports the voltage regulators of DA9052-BC and
  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA9055
+   tristate "Dialog Semiconductor DA9055 regulators"
+   depends on MFD_DA9055
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9055-regulator.
+
 config REGULATOR_ANATOP
tristate "Freescale i.MX on-chip ANATOP LDO regulators"
depends on MFD_ANATOP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 3a0dbc5..950b38b 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
new file mode 100644
index 000..a5da4f7
--- /dev/null
+++ b/drivers/regulator/da9055-regulator.c
@@ -0,0 +1,654 @@
+/*
+* Regulator driver for DA9055 PMIC
+*
+* Copyright(c) 2012 Dialog Semiconductor Ltd.
+*
+* Author: David Dajun Chen 
+*
+* 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
+* (at your option) any later version.
+*
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DA9055_MIN_UA  0
+#define DA9055_MAX_UA  3
+
+#define DA9055_LDO_MODE_SYNC   0
+#define DA9055_LDO_MODE_SLEEP  1
+
+#define DA9055_BUCK_MODE_SLEEP 1
+#define DA9055_BUCK_MODE_SYNC  2
+#define DA9055_BUCK_MODE_AUTO  3
+
+/* DA9055 REGULATOR IDs */
+#define DA9055_ID_BUCK10
+#define DA9055_ID_BUCK21
+#define DA9055_ID_LDO1 2
+#define DA9055_ID_LDO2 3
+#define DA9055_ID_LDO3 4
+#define DA9055_ID_LDO4 5
+#define DA9055_ID_LDO5 6
+#define DA9055_ID_LDO6 7
+
+/* DA9055 BUCK current limit */
+static const int da9055_current_limits[] = { 50, 60, 70, 80 };
+
+struct da9055_conf_reg {
+   int reg;
+   int sel_mask;
+   int en_mask;
+};
+
+struct da9055_volt_reg {
+   int reg_a;
+   int reg_b;
+   int sl_shift;
+   int v_offset;
+   int v_mask;
+   int v_shift;
+};
+
+struct da9055_mode_reg {
+   int reg;
+   int mask;
+   int shift;
+};
+
+struct da9055_regulator_info {
+   struct regulator_desc reg_desc;
+   struct da9055_conf_reg conf;
+   struct da9055_volt_reg volt;
+   struct da9055_mode_reg mode;
+};
+
+struct da9055_regulator {
+   struct da9055 *da9055;
+   struct da9055_regulator_info *info;
+   struct regulator_dev *rdev;
+   enum gpio_select reg_rselect;
+};
+
+static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev)
+{
+   struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
+   struct da9055_regulator_info *info = regulator->info;
+   int ret, mode = 0;
+
+   ret = da9055_reg_read(regulator->da9055, info->m

Re: [Patch v3 2/7] Regulator: DA9055 Regulator driver

2012-10-11 Thread Ashish Jangam
Recalling this post. Wrong patch version got included.
On Thu, 2012-10-11 at 12:06 +0530, Ashish Jangam wrote:
> This is the Regulator patch for the DA9055 PMIC and has got dependency on
> the DA9055 MFD core.
> 
> This patch support all of the DA9055 regulators. The output voltages are
> fully programmable through I2C interface only. The platform data with 
> regulation
> constraints is passed down from the board to the regulator.
> 
> This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation board
> was connected to the SMDK6410 board.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
> changes since version v3:
> - Use of regulator framework API regulator_map_voltage_linear()
>and regulator_list_voltage_linear().
> - Modify comments to indicate GPIO pins are muxed.
> - Get the GPIO number from platform data.
> changes since v2:
> - restructuring of GPIO regulator initialization code.
> ---
>  drivers/regulator/Kconfig|   10 +
>  drivers/regulator/Makefile   |1 +
>  drivers/regulator/da9055-regulator.c |  659 
> ++
>  include/linux/mfd/da9055/pdata.h |   27 ++-
>  4 files changed, 694 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/regulator/da9055-regulator.c
> 
> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index 129c827..0bd6db1 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -109,6 +109,16 @@ config REGULATOR_DA9052
> This driver supports the voltage regulators of DA9052-BC and
> DA9053-AA/Bx PMIC.
>  
> +config REGULATOR_DA9055
> + tristate "Dialog Semiconductor DA9055 regulators"
> + depends on MFD_DA9055
> + help
> +   Say y here to support the BUCKs and LDOs regulators found on
> +   Dialog Semiconductor DA9055 PMIC.
> +
> +   This driver can also be built as a module. If so, the module
> +   will be called da9055-regulator.
> +
>  config REGULATOR_ANATOP
>   tristate "Freescale i.MX on-chip ANATOP LDO regulators"
>   depends on MFD_ANATOP
> diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
> index 3a0dbc5..950b38b 100644
> --- a/drivers/regulator/Makefile
> +++ b/drivers/regulator/Makefile
> @@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
>  obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
>  obj-$(CONFIG_REGULATOR_DA903X)   += da903x.o
>  obj-$(CONFIG_REGULATOR_DA9052)   += da9052-regulator.o
> +obj-$(CONFIG_REGULATOR_DA9055)   += da9055-regulator.o
>  obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
>  obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
>  obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
> diff --git a/drivers/regulator/da9055-regulator.c 
> b/drivers/regulator/da9055-regulator.c
> new file mode 100644
> index 000..9129b27
> --- /dev/null
> +++ b/drivers/regulator/da9055-regulator.c
> @@ -0,0 +1,659 @@
> +/*
> +* Regulator driver for DA9055 PMIC
> +*
> +* Copyright(c) 2012 Dialog Semiconductor Ltd.
> +*
> +* Author: David Dajun Chen 
> +*
> +* 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
> +* (at your option) any later version.
> +*
> +*/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#define DA9055_MIN_UA0
> +#define DA9055_MAX_UA3
> +
> +#define DA9055_LDO_MODE_SYNC 0
> +#define DA9055_LDO_MODE_SLEEP1
> +
> +#define DA9055_BUCK_MODE_SLEEP   1
> +#define DA9055_BUCK_MODE_SYNC2
> +#define DA9055_BUCK_MODE_AUTO3
> +
> +/* DA9055 REGULATOR IDs */
> +#define DA9055_ID_BUCK1  0
> +#define DA9055_ID_BUCK2  1
> +#define DA9055_ID_LDO1   2
> +#define DA9055_ID_LDO2   3
> +#define DA9055_ID_LDO3   4
> +#define DA9055_ID_LDO4   5
> +#define DA9055_ID_LDO5   6
> +#define DA9055_ID_LDO6   7
> +
> +/* DA9055 BUCK current limit */
> +static const int da9055_current_limits[] = { 50, 60, 70, 80 
> };
> +
> +struct da9055_conf_reg {
> + int reg;
> + int sel_mask;
> + int en_mask;
> +};
> +
> +struct da9055_volt_reg {
> + int reg_a;
> + int reg_b;
> + int sl_shift;
> + int v_offset;
> + int v_mask;
> + int v_shift;
> +};
>

[Patch v3 2/7] Regulator: DA9055 Regulator driver

2012-10-10 Thread Ashish Jangam
This is the Regulator patch for the DA9055 PMIC and has got dependency on
the DA9055 MFD core.

This patch support all of the DA9055 regulators. The output voltages are
fully programmable through I2C interface only. The platform data with regulation
constraints is passed down from the board to the regulator.

This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation board
was connected to the SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
changes since version v3:
- Use of regulator framework API regulator_map_voltage_linear()
   and regulator_list_voltage_linear().
- Modify comments to indicate GPIO pins are muxed.
- Get the GPIO number from platform data.
changes since v2:
- restructuring of GPIO regulator initialization code.
---
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  659 ++
 include/linux/mfd/da9055/pdata.h |   27 ++-
 4 files changed, 694 insertions(+), 3 deletions(-)
 create mode 100644 drivers/regulator/da9055-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 129c827..0bd6db1 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -109,6 +109,16 @@ config REGULATOR_DA9052
  This driver supports the voltage regulators of DA9052-BC and
  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA9055
+   tristate "Dialog Semiconductor DA9055 regulators"
+   depends on MFD_DA9055
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9055-regulator.
+
 config REGULATOR_ANATOP
tristate "Freescale i.MX on-chip ANATOP LDO regulators"
depends on MFD_ANATOP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 3a0dbc5..950b38b 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
new file mode 100644
index 000..9129b27
--- /dev/null
+++ b/drivers/regulator/da9055-regulator.c
@@ -0,0 +1,659 @@
+/*
+* Regulator driver for DA9055 PMIC
+*
+* Copyright(c) 2012 Dialog Semiconductor Ltd.
+*
+* Author: David Dajun Chen 
+*
+* 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
+* (at your option) any later version.
+*
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DA9055_MIN_UA  0
+#define DA9055_MAX_UA  3
+
+#define DA9055_LDO_MODE_SYNC   0
+#define DA9055_LDO_MODE_SLEEP  1
+
+#define DA9055_BUCK_MODE_SLEEP 1
+#define DA9055_BUCK_MODE_SYNC  2
+#define DA9055_BUCK_MODE_AUTO  3
+
+/* DA9055 REGULATOR IDs */
+#define DA9055_ID_BUCK10
+#define DA9055_ID_BUCK21
+#define DA9055_ID_LDO1 2
+#define DA9055_ID_LDO2 3
+#define DA9055_ID_LDO3 4
+#define DA9055_ID_LDO4 5
+#define DA9055_ID_LDO5 6
+#define DA9055_ID_LDO6 7
+
+/* DA9055 BUCK current limit */
+static const int da9055_current_limits[] = { 50, 60, 70, 80 };
+
+struct da9055_conf_reg {
+   int reg;
+   int sel_mask;
+   int en_mask;
+};
+
+struct da9055_volt_reg {
+   int reg_a;
+   int reg_b;
+   int sl_shift;
+   int v_offset;
+   int v_mask;
+   int v_shift;
+};
+
+struct da9055_mode_reg {
+   int reg;
+   int mask;
+   int shift;
+};
+
+struct da9055_regulator_info {
+   struct regulator_desc reg_desc;
+   int step_uV;
+   int min_uV;
+   int max_uV;
+   struct da9055_conf_reg conf;
+   struct da9055_volt_reg volt;
+   struct da9055_mode_reg mode;
+};
+
+struct da9055_regulator {
+   struct da9055 *da9055;
+   struct da9055_regulator_info *info;
+   struct regulator_dev *rdev;
+   enum gpio_select reg_rselect;
+};
+
+static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev)
+{
+   struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
+   struct da9055_regulator_info *info = regulator->info;
+   int ret, mode = 0;
+
+   ret = da9055_reg_read(regulator->da9055, info->m

Re: [Patch v2 2/7] Regulator: DA9055 Regulator driver

2012-10-10 Thread Ashish Jangam
On Wed, 2012-10-10 at 12:56 +0900, Mark Brown wrote:
> On Tue, Oct 09, 2012 at 04:30:16PM +0530, Ashish Jangam wrote:
> > On Tue, 2012-10-09 at 15:37 +0530, Mark Brown wrote:
> > > On Mon, Oct 08, 2012 at 07:00:39PM +0530, Ashish Jangam wrote:
> 
> > > > +   /* Set the GPIO I/P pin for controlling the regulator 
> > > > state. */
> > > > +   ret = devm_gpio_request_one(config->dev, gpio, 
> > > > GPIOF_DIR_IN,
> > > > +   name);
> > > > +   if (ret < 0)
> > > > +   goto err;
> 
> > > We never actually appear to use this GPIO anywhere...  why are we
> > > requesting it?
> 
> > DA9055 regulator changes its state by detecting the rising/failing edge at
> > GPI DA9055. Therefore we just need to set the DA9055 GPIO direction to 
> > input.
> 
> Right, so there's several problems here.  One is that this code is very
> obscure - you're really doing pinmux here rather than actually using it
> as a GPIO, a better comment would clarify this.  The other is that
> you're requiring a defined gpio_base in platform data, it would be
> better to allow this to be dynamically assigned as the driver can find
> it's own GPIOs easily enough.
Ok, will modify the comments and instead of taking gpio offset I will
take gpio number from the platform data.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v2 2/7] Regulator: DA9055 Regulator driver

2012-10-09 Thread Ashish Jangam
On Tue, 2012-10-09 at 15:37 +0530, Mark Brown wrote:
> On Mon, Oct 08, 2012 at 07:00:39PM +0530, Ashish Jangam wrote:
> 
> Mostly OK, but there's a few issues including yet more reimplementation
> of framework features.
> 
> > +static int da9055_list_voltage(struct regulator_dev *rdev,
> > +   unsigned int selector)
> > +{
> > +   struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
> > +   struct da9055_regulator_info *info = regulator->info;
> > +   int volt_uV;
> > +
> > +   volt_uV = (selector * info->step_uV) + info->min_uV;
> > +
> > +   if (volt_uV > info->max_uV)
> > +   return -EINVAL;
> > +
> > +   return volt_uV;
> > +}
> 
> This is regulator_list_voltage_linear()
Agree.
> 
> > +static int da9055_map_voltage(struct regulator_dev *rdev,
> > + int min_uV, int max_uV)
> > +{
> > +   struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
> > +   struct da9055_regulator_info *info = regulator->info;
> > +   int ret, sel;
> > +
> > +   ret = verify_range(info, min_uV, max_uV);
> > +   if (ret < 0)
> > +   return ret;
> > +
> > +   if (min_uV < info->min_uV)
> > +   min_uV = info->min_uV;
> > +
> > +   sel = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
> > +
> > +   ret = da9055_list_voltage(rdev, sel);
> > +   if (ret < 0)
> > +   return ret;
> > +
> > +   return sel;
> > +}
> 
> This is regulator_map_voltage_linear().
Agree.
> 
> > + int gpio = pdata->gpio_base + pdata->gpio_ren[id];
> 
> > +   sprintf(name, "DA9055 REG %d STATE", id);
> 
> snprintf().
> 
> > +   /* Set the GPIO I/P pin for controlling the regulator state. */
> > +   ret = devm_gpio_request_one(config->dev, gpio, GPIOF_DIR_IN,
> > +   name);
> > +   if (ret < 0)
> > +   goto err;
> 
> We never actually appear to use this GPIO anywhere...  why are we
> requesting it?
DA9055 regulator changes its state by detecting the rising/failing edge at
GPI DA9055. Therefore we just need to set the DA9055 GPIO direction to input.
>   Also, why is the ability to read the regulator state via
> a GPIO associated with controlling it via a GPIO, it's unusual for these
> things to be tied together.
> 
There is no connection between state just to differentiate between two 
strings/labels.
If required I can change the string.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[Patch v2 2/7] Regulator: DA9055 Regulator driver

2012-10-08 Thread Ashish Jangam
This is the Regulator patch for the DA9055 PMIC and has got dependency on
the DA9055 MFD core.

This patch support all of the DA9055 regulators. The output voltages are
fully programmable through I2C interface only. The platform data with regulation
constraints is passed down from the board to the regulator.

This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation board
was connected to the SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
- restructuring of GPIO regulator initialization code.
---
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  704 ++
 include/linux/mfd/da9055/pdata.h |1 +
 4 files changed, 716 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/da9055-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 129c827..0bd6db1 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -109,6 +109,16 @@ config REGULATOR_DA9052
  This driver supports the voltage regulators of DA9052-BC and
  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA9055
+   tristate "Dialog Semiconductor DA9055 regulators"
+   depends on MFD_DA9055
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9055-regulator.
+
 config REGULATOR_ANATOP
tristate "Freescale i.MX on-chip ANATOP LDO regulators"
depends on MFD_ANATOP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 3a0dbc5..950b38b 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
new file mode 100644
index 000..2dbb273
--- /dev/null
+++ b/drivers/regulator/da9055-regulator.c
@@ -0,0 +1,704 @@
+/*
+* Regulator driver for DA9055 PMIC
+*
+* Copyright(c) 2012 Dialog Semiconductor Ltd.
+*
+* Author: David Dajun Chen 
+*
+* 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
+* (at your option) any later version.
+*
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DA9055_MIN_UA  0
+#define DA9055_MAX_UA  3
+
+#define DA9055_LDO_MODE_SYNC   0
+#define DA9055_LDO_MODE_SLEEP  1
+
+#define DA9055_BUCK_MODE_SLEEP 1
+#define DA9055_BUCK_MODE_SYNC  2
+#define DA9055_BUCK_MODE_AUTO  3
+
+/* DA9055 REGULATOR IDs */
+#define DA9055_ID_BUCK10
+#define DA9055_ID_BUCK21
+#define DA9055_ID_LDO1 2
+#define DA9055_ID_LDO2 3
+#define DA9055_ID_LDO3 4
+#define DA9055_ID_LDO4 5
+#define DA9055_ID_LDO5 6
+#define DA9055_ID_LDO6 7
+
+/* DA9055 BUCK current limit */
+static const int da9055_current_limits[] = { 50, 60, 70, 80 };
+
+struct da9055_conf_reg {
+   int reg;
+   int sel_mask;
+   int en_mask;
+};
+
+struct da9055_volt_reg {
+   int reg_a;
+   int reg_b;
+   int sl_shift;
+   int v_offset;
+   int v_mask;
+   int v_shift;
+};
+
+struct da9055_mode_reg {
+   int reg;
+   int mask;
+   int shift;
+};
+
+struct da9055_regulator_info {
+   struct regulator_desc reg_desc;
+   int step_uV;
+   int min_uV;
+   int max_uV;
+   struct da9055_conf_reg conf;
+   struct da9055_volt_reg volt;
+   struct da9055_mode_reg mode;
+};
+
+struct da9055_regulator {
+   struct da9055 *da9055;
+   struct da9055_regulator_info *info;
+   struct regulator_dev *rdev;
+   enum gpio_select gpio_rselect;
+};
+
+static int verify_range(struct da9055_regulator_info *info,
+int min_uV, int max_uV)
+{
+   if (min_uV > info->max_uV || max_uV < info->min_uV)
+   return -EINVAL;
+
+   return 0;
+}
+
+static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev)
+{
+   struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
+   struct da9055_regulator_info *info = regulator->info;
+   int ret, mode = 0;
+
+   ret = da9055_reg_read(regulator->da9055, info->mode.reg);
+ 

[PATCH] [PATCH v3] mfd: da9052-core: Use regmap_irq_get_virq() and fix the probe

2012-10-03 Thread Ashish Jangam
Fix for da9052-core driver probe fail on a mx53qsb dt-kernel
da9052 1-0048: DA9052 ADC IRQ failed ret=-22

Signed-off-by: Ashish Jangam 
---
changes since v3:
- remove element "irq" from struct da9052
- add inline da9052_map_irq() that calls regmap_irq_get_virq()
Changes since v2:
- Use regmap_irq_get_virq() instead of relying on irq_base
---
 drivers/mfd/da9052-core.c |   31 ---
 include/linux/mfd/da9052/da9052.h |5 +
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 2544910..e38c2e0 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -772,7 +772,7 @@ EXPORT_SYMBOL_GPL(da9052_regmap_config);
 int __devinit da9052_device_init(struct da9052 *da9052, u8 chip_id)
 {
struct da9052_pdata *pdata = da9052->dev->platform_data;
-   int ret;
+   int ret, adc_irq;
 
mutex_init(&da9052->auxadc_lock);
init_completion(&da9052->done);
@@ -782,25 +782,26 @@ int __devinit da9052_device_init(struct da9052 *da9052, 
u8 chip_id)
 
da9052->chip_id = chip_id;
 
-   if (!pdata || !pdata->irq_base)
-   da9052->irq_base = -1;
-   else
-   da9052->irq_base = pdata->irq_base;
-
ret = regmap_add_irq_chip(da9052->regmap, da9052->chip_irq,
  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- da9052->irq_base, &da9052_regmap_irq_chip,
+ -1, &da9052_regmap_irq_chip,
  &da9052->irq_data);
-   if (ret < 0)
+   if (ret < 0) {
+   dev_err(da9052->dev, "regmap_add_irq_chip failed: %d\n", ret);
goto regmap_err;
+   }
 
da9052->irq_base = regmap_irq_chip_get_base(da9052->irq_data);
 
-   ret = request_threaded_irq(DA9052_IRQ_ADC_EOM, NULL, da9052_auxadc_irq,
-  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-  "adc irq", da9052);
-   if (ret != 0)
-   dev_err(da9052->dev, "DA9052 ADC IRQ failed ret=%d\n", ret);
+   adc_irq = da9052_map_irq(da9052, DA9052_IRQ_ADC_EOM);
+   if (adc_irq >= 0) {
+   ret = request_threaded_irq(adc_irq, NULL, da9052_auxadc_irq,
+  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+  "adc-irq", da9052);
+   if (ret != 0)
+   dev_err(da9052->dev, "DA9052 ADC IRQ failed ret=%d\n",
+   ret);
+   }
 
ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info,
  ARRAY_SIZE(da9052_subdev_info), NULL, 0);
@@ -810,7 +811,7 @@ int __devinit da9052_device_init(struct da9052 *da9052, u8 
chip_id)
return 0;
 
 err:
-   free_irq(DA9052_IRQ_ADC_EOM, da9052);
+   free_irq(adc_irq, da9052);
mfd_remove_devices(da9052->dev);
 regmap_err:
return ret;
@@ -818,7 +819,7 @@ regmap_err:
 
 void da9052_device_exit(struct da9052 *da9052)
 {
-   free_irq(DA9052_IRQ_ADC_EOM, da9052);
+   free_irq(da9052_map_irq(da9052, DA9052_IRQ_ADC_EOM), da9052);
regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);
mfd_remove_devices(da9052->dev);
 }
diff --git a/include/linux/mfd/da9052/da9052.h 
b/include/linux/mfd/da9052/da9052.h
index 0507c4c..1abce88 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -141,6 +141,11 @@ static inline int da9052_reg_update(struct da9052 *da9052, 
unsigned char reg,
return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
 }
 
+static inline int da9052_map_irq(struct da9052 *da9052, int irq)
+{
+   return regmap_irq_get_virq(da9052->irq_data, irq);
+}
+
 int da9052_device_init(struct da9052 *da9052, u8 chip_id);
 void da9052_device_exit(struct da9052 *da9052);
 
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch v1 6/7] DA9055 Watchdog driver

2012-09-24 Thread Ashish Jangam
Any update on this patch?
On Fri, 2012-09-14 at 19:03 +0530, Ashish Jangam wrote:
> This is the Watchdog patch for the DA9055 PMIC. This patch has got
> dependency on the DA9055 MFD core.
> 
> This patch is functionally tested on SMDK6410
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
>  drivers/watchdog/Kconfig  |   10 ++
>  drivers/watchdog/Makefile |1 +
>  drivers/watchdog/da9055_wdt.c |  227 
> +
>  3 files changed, 238 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/watchdog/da9055_wdt.c
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 53d7571..eb51bf2 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -76,6 +76,16 @@ config DA9052_WATCHDOG
>Alternatively say M to compile the driver as a module,
>which will be called da9052_wdt.
>  
> +config DA9055_WATCHDOG
> + tristate "Dialog Semiconductor DA9055 Watchdog"
> + depends on MFD_DA9055
> + help
> +   If you say yes here you get support for watchdog on the Dialog
> +   Semiconductor DA9055 PMIC.
> +
> +   This driver can also be built as a module.  If so, the module
> +   will be called da9055_wdt.
> +
>  config WM831X_WATCHDOG
>   tristate "WM831x watchdog"
>   depends on MFD_WM831X
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index 572b39b..97bbdb3 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -164,6 +164,7 @@ obj-$(CONFIG_XEN_WDT) += xen_wdt.o
>  
>  # Architecture Independent
>  obj-$(CONFIG_DA9052_WATCHDOG) += da9052_wdt.o
> +obj-$(CONFIG_DA9055_WATCHDOG) += da9055_wdt.o
>  obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o
>  obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
>  obj-$(CONFIG_MAX63XX_WATCHDOG) += max63xx_wdt.o
> diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c
> new file mode 100644
> index 000..4cb8689
> --- /dev/null
> +++ b/drivers/watchdog/da9055_wdt.c
> @@ -0,0 +1,227 @@
> +/*
> + * System monitoring driver for DA9055 PMICs.
> + *
> + * Copyright(c) 2012 Dialog Semiconductor Ltd.
> + *
> + * Author: David Dajun Chen 
> + *
> + * 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
> + * (at your option) any later version.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +static bool nowayout = WATCHDOG_NOWAYOUT;
> +module_param(nowayout, bool, 0);
> +MODULE_PARM_DESC(nowayout,
> +  "Watchdog cannot be stopped once started (default="
> +  __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
> +
> +#define DA9055_DEF_TIMEOUT   4
> +#define DA9055_TWDMIN256
> +
> +struct da9055_wdt_data {
> + struct watchdog_device wdt;
> + struct da9055 *da9055;
> + struct kref kref;
> +};
> +
> +static const struct {
> + u8 reg_val;
> + int user_time;  /* In seconds */
> +} da9055_wdt_maps[] = {
> + { 0, 0 },
> + { 1, 2 },
> + { 2, 4 },
> + { 3, 8 },
> + { 4, 16 },
> + { 5, 32 },
> + { 5, 33 },  /* Actual time  32.768s so included both 32s and 33s */
> + { 6, 65 },
> + { 6, 66 },  /* Actual time 65.536s so include both, 65s and 66s */
> + { 7, 131 },
> +};
> +
> +static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,
> +   unsigned int timeout)
> +{
> + struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
> + struct da9055 *da9055 = driver_data->da9055;
> + int ret, i;
> +
> + for (i = 0; i < ARRAY_SIZE(da9055_wdt_maps); i++)
> + if (da9055_wdt_maps[i].user_time == timeout)
> + break;
> +
> + if (i == ARRAY_SIZE(da9055_wdt_maps))
> + ret = -EINVAL;
> + else
> + ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_B,
> + DA9055_TWDSCALE_MASK,
> + da9055_wdt_maps[i].reg_val <<
> + DA9055_TWDSCALE_SHIFT);
> + if (ret < 0)
> + dev_err(da9055->dev,
> + "Failed to update timescale bit, %d\n", ret);
> +
> + wdt_dev->timeout = timeout;
> +
> + return ret;
> +}

Re: [Patch v1 3/7] DA9055 RTC driver

2012-09-24 Thread Ashish Jangam
Any update on this patch?
On Fri, 2012-09-14 at 18:58 +0530, Ashish Jangam wrote:
> This is the RTC patch for the DA9055 PMIC. This patch has got dependency
> on the DA9055 MFD core.
> 
> This patch is functionally tested on Samsung SMDKV6410.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
>  drivers/rtc/Kconfig  |   10 +
>  drivers/rtc/Makefile |1 +
>  drivers/rtc/rtc-da9055.c |  430 
> ++
>  3 files changed, 441 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 drivers/rtc/Kconfig
>  create mode 100644 drivers/rtc/rtc-da9055.c
> 
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> old mode 100644
> new mode 100755
> index fabc99a..6050f8b
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -571,6 +571,16 @@ config RTC_DRV_DA9052
> Say y here to support the RTC driver for Dialog Semiconductor
> DA9052-BC and DA9053-AA/Bx PMICs.
>  
> +config RTC_DRV_DA9055
> + tristate "Dialog Semiconductor DA9055 RTC"
> + depends on MFD_DA9055
> + help
> +   If you say yes here you will get support for the
> +   RTC of the Dialog DA9055 PMIC.
> +
> +   This driver can also be built as a module. If so, the module
> +   will be called rtc-da9055
> +
>  config RTC_DRV_EFI
>   tristate "EFI RTC"
>   depends on IA64
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index 0d5b2b6..b4c162f 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -29,6 +29,7 @@ obj-$(CONFIG_RTC_DRV_BQ4802)+= rtc-bq4802.o
>  obj-$(CONFIG_RTC_DRV_CMOS)   += rtc-cmos.o
>  obj-$(CONFIG_RTC_DRV_COH901331)  += rtc-coh901331.o
>  obj-$(CONFIG_RTC_DRV_DA9052) += rtc-da9052.o
> +obj-$(CONFIG_RTC_DRV_DA9055) += rtc-da9055.o
>  obj-$(CONFIG_RTC_DRV_DAVINCI)+= rtc-davinci.o
>  obj-$(CONFIG_RTC_DRV_DM355EVM)   += rtc-dm355evm.o
>  obj-$(CONFIG_RTC_DRV_VRTC)   += rtc-mrst.o
> diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
> new file mode 100644
> index 000..80f7738
> --- /dev/null
> +++ b/drivers/rtc/rtc-da9055.c
> @@ -0,0 +1,430 @@
> +/*
> + * Real time clock driver for DA9055
> + *
> + * Copyright(c) 2012 Dialog Semiconductor Ltd.
> + *
> + * Author: Dajun Dajun Chen 
> + *
> + * 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
> + * (at your option) any later version.
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +struct da9055_rtc {
> + struct rtc_device *rtc;
> + struct da9055 *da9055;
> + int alarm_enable;
> +};
> +
> +static int da9055_rtc_enable_alarm(struct da9055_rtc *rtc, bool enable)
> +{
> + int ret;
> + if (enable) {
> + ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
> + DA9055_RTC_ALM_EN,
> + DA9055_RTC_ALM_EN);
> + if (ret != 0)
> + dev_err(rtc->da9055->dev, "Failed to enable ALM: %d\n",
> + ret);
> + rtc->alarm_enable = 1;
> + } else {
> + ret = da9055_reg_update(rtc->da9055, DA9055_REG_ALARM_Y,
> + DA9055_RTC_ALM_EN, 0);
> + if (ret != 0)
> + dev_err(rtc->da9055->dev,
> + "Failed to disable ALM: %d\n", ret);
> + rtc->alarm_enable = 0;
> + }
> + return ret;
> +}
> +
> +static irqreturn_t da9055_rtc_alm_irq(int irq, void *data)
> +{
> + struct da9055_rtc *rtc = data;
> +
> + da9055_rtc_enable_alarm(rtc, 0);
> + rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static int da9055_read_alarm(struct da9055 *da9055, struct rtc_time *rtc_tm)
> +{
> + int ret;
> + uint8_t v[5];
> +
> + ret = da9055_group_read(da9055, DA9055_REG_ALARM_MI, 5, v);
> + if (ret != 0) {
> + dev_err(da9055->dev, "Failed to group read ALM: %d\n", ret);
> + return ret;
> + }
> +
> + rtc_tm->tm_year = (v[4] & DA9055_RTC_ALM_YEAR) + 100;
> + rtc_tm->tm_mon  = (v[3] & DA9055_RTC_ALM_MONTH) - 1;
> + rtc_tm->tm_mday = v[2] & DA9055_RTC_ALM_DAY;
> + rtc_tm->tm_hour = v[1] & DA9055_RTC_ALM_HOUR;
> +

Re: [Patch v1 2/7] DA9055 Regulator driver

2012-09-24 Thread Ashish Jangam
Any update on this patch?
On Fri, 2012-09-14 at 18:57 +0530, Ashish Jangam wrote:
> This is the Regulator patch for the DA9055 PMIC and has got dependency
> on the DA9055 MFD core.
> 
> This patch support all of the DA9055 regulators. The output voltages are
> fully programmable through I2C interface only. The platform data with
> regulation constraints is passed down from the board to the regulator.
> 
> This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation
> board was connected to the SMDK6410 board.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
>  drivers/regulator/Kconfig|   10 +
>  drivers/regulator/Makefile   |1 +
>  drivers/regulator/da9055-regulator.c |  727 
> ++
>  3 files changed, 738 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/regulator/da9055-regulator.c
> 
> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
> index 129c827..0bd6db1 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -109,6 +109,16 @@ config REGULATOR_DA9052
> This driver supports the voltage regulators of DA9052-BC and
> DA9053-AA/Bx PMIC.
>  
> +config REGULATOR_DA9055
> + tristate "Dialog Semiconductor DA9055 regulators"
> + depends on MFD_DA9055
> + help
> +   Say y here to support the BUCKs and LDOs regulators found on
> +   Dialog Semiconductor DA9055 PMIC.
> +
> +   This driver can also be built as a module. If so, the module
> +   will be called da9055-regulator.
> +
>  config REGULATOR_ANATOP
>   tristate "Freescale i.MX on-chip ANATOP LDO regulators"
>   depends on MFD_ANATOP
> diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
> index 3a0dbc5..950b38b 100644
> --- a/drivers/regulator/Makefile
> +++ b/drivers/regulator/Makefile
> @@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
>  obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
>  obj-$(CONFIG_REGULATOR_DA903X)   += da903x.o
>  obj-$(CONFIG_REGULATOR_DA9052)   += da9052-regulator.o
> +obj-$(CONFIG_REGULATOR_DA9055)   += da9055-regulator.o
>  obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
>  obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
>  obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
> diff --git a/drivers/regulator/da9055-regulator.c 
> b/drivers/regulator/da9055-regulator.c
> new file mode 100644
> index 000..630b664
> --- /dev/null
> +++ b/drivers/regulator/da9055-regulator.c
> @@ -0,0 +1,727 @@
> +/*
> +* Regulator driver for DA9055 PMIC
> +*
> +* Copyright(c) 2012 Dialog Semiconductor Ltd.
> +*
> +* Author: David Dajun Chen 
> +*
> +* 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
> +* (at your option) any later version.
> +*
> +*/
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#define DA9055_MIN_UA0
> +#define DA9055_MAX_UA3
> +
> +#define DA9055_LDO_MODE_SYNC 0
> +#define DA9055_LDO_MODE_SLEEP1
> +
> +#define DA9055_BUCK_MODE_SLEEP   1
> +#define DA9055_BUCK_MODE_SYNC2
> +#define DA9055_BUCK_MODE_AUTO3
> +
> +/* DA9055 REGULATOR IDs */
> +#define DA9055_ID_BUCK1  0
> +#define DA9055_ID_BUCK2  1
> +#define DA9055_ID_LDO1   2
> +#define DA9055_ID_LDO2   3
> +#define DA9055_ID_LDO3   4
> +#define DA9055_ID_LDO4   5
> +#define DA9055_ID_LDO5   6
> +#define DA9055_ID_LDO6   7
> +
> +/* DA9055 GPIO OFFSET */
> +#define DA9055_GPIO_1_OFFSET 0x01
> +#define DA9055_GPIO_2_OFFSET 0x02
> +
> +/* DA9055 BUCK current limit */
> +static const int da9055_current_limits[] = { 50, 60, 70, 80 
> };
> +
> +struct da9055_conf_reg {
> + int reg;
> + int sel_mask;
> + int en_mask;
> +};
> +
> +struct da9055_volt_reg {
> + int reg_a;
> + int reg_b;
> + int sl_shift;
> + int v_offset;
> + int v_mask;
> + int v_shift;
> +};
> +
> +struct da9055_mode_reg {
> + int reg;
> + int mask;
> + int shift;
> +};
> +
> +struct da9055_regulator_info {
> + struct regulator_desc reg_desc;
> + int step_uV;
> + int min_uV;
> + int max_uV;
> + struct da9055_conf_reg

Re: [Patch v1 1/7] DA9055 MFD core driver

2012-09-24 Thread Ashish Jangam
Any update on this patch?
On Fri, 2012-09-14 at 18:54 +0530, Ashish Jangam wrote:
> This is the DA9055 MFD core driver that instantiate all the dependent
> component
> drivers and provides them the device access via I2C.
> 
> This patch is functionally tested on Samsung SMDK6410.
> 
> Signed-off-by: David Dajun Chen 
> Signed-off-by: Ashish Jangam 
> ---
>  drivers/mfd/Kconfig  |   17 +
>  drivers/mfd/Makefile |3 +
>  drivers/mfd/da9055-core.c|  423 +++
>  drivers/mfd/da9055-i2c.c |   93 +
>  include/linux/mfd/da9055/core.h  |   94 +
>  include/linux/mfd/da9055/pdata.h |   32 ++
>  include/linux/mfd/da9055/reg.h   |  699 
> ++
>  7 files changed, 1361 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/mfd/da9055-core.c
>  create mode 100644 drivers/mfd/da9055-i2c.c
>  create mode 100644 include/linux/mfd/da9055/core.h
>  create mode 100644 include/linux/mfd/da9055/pdata.h
>  create mode 100644 include/linux/mfd/da9055/reg.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index b1a1462..34a539f 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -441,6 +441,23 @@ config MFD_DA9052_I2C
> for accessing the device, additional drivers must be enabled in
> order to use the functionality of the device.
>  
> +config MFD_DA9055
> + bool "Dialog Semiconductor DA9055 PMIC Support"
> + select REGMAP_I2C
> + select REGMAP_IRQ
> + select PMIC_DA9055
> + select MFD_CORE
> + depends on I2C=y
> + help
> +   Say yes here for support of Dialog Semiconductor DA9055. This is
> +   a Power Management IC. This driver provides common support for
> +   accessing the device as well as the I2C interface to the chip itself.
> +   Additional drivers must be enabled in order to use the functionality
> +   of the device.
> +
> +   This driver can be built as a module. If built as a module it will be
> +   called "da9055"
> +
>  config PMIC_ADP5520
>   bool "Analog Devices ADP5520/01 MFD PMIC Core Support"
>   depends on I2C=y
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 79dd22d..339cbb4 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -90,6 +90,9 @@ obj-$(CONFIG_PMIC_DA9052)   += da9052-core.o
>  obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
>  obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
>  
> +da9055-objs  := da9055-core.o da9055-i2c.o
> +obj-$(CONFIG_MFD_DA9055) += da9055.o
> +
>  obj-$(CONFIG_MFD_MAX77686)   += max77686.o max77686-irq.o
>  obj-$(CONFIG_MFD_MAX77693)   += max77693.o max77693-irq.o
>  max8925-objs := max8925-core.o max8925-i2c.o
> diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
> new file mode 100644
> index 000..6297bc0
> --- /dev/null
> +++ b/drivers/mfd/da9055-core.c
> @@ -0,0 +1,423 @@
> +/*
> + * Device access for Dialog DA9055 PMICs.
> + *
> + * Copyright(c) 2012 Dialog Semiconductor Ltd.
> + *
> + * Author: David Dajun Chen 
> + *
> + *  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 (at your
> + *  option) any later version.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define DA9055_IRQ_NONKEY_MASK   0x01
> +#define DA9055_IRQ_ALM_MASK  0x02
> +#define DA9055_IRQ_TICK_MASK 0x04
> +#define DA9055_IRQ_ADC_MASK  0x08
> +#define DA9055_IRQ_BUCK_ILIM_MASK0x08
> +
> +static bool da9055_register_readable(struct device *dev, unsigned int reg)
> +{
> + switch (reg) {
> + case DA9055_REG_STATUS_A:
> + case DA9055_REG_STATUS_B:
> + case DA9055_REG_EVENT_A:
> + case DA9055_REG_EVENT_B:
> + case DA9055_REG_EVENT_C:
> + case DA9055_REG_IRQ_MASK_A:
> + case DA9055_REG_IRQ_MASK_B:
> + case DA9055_REG_IRQ_MASK_C:
> +
> + case DA9055_REG_CONTROL_A:
> + case DA9055_REG_CONTROL_B:
> + case DA9055_REG_CONTROL_C:
> + case DA9055_REG_CONTROL_D:
> + case DA9055_REG_CONTROL_E:
> +
> + case DA9055_REG_ADC_MAN:
> + case DA9055_REG_ADC_CONT:
> + case DA9055_REG_VSYS_MON:
> + case DA9055_REG_ADC_RES_L:
> + case DA9055_REG_ADC_RES_H:
> + case DA9055_REG_VSYS_RES:
> + case DA9055_REG_ADCIN1_RES:
> + case DA9055_REG_ADC

[Patch v1 2/7] DA9055 Regulator driver

2012-09-14 Thread Ashish Jangam
This is the Regulator patch for the DA9055 PMIC and has got dependency
on the DA9055 MFD core.

This patch support all of the DA9055 regulators. The output voltages are
fully programmable through I2C interface only. The platform data with
regulation constraints is passed down from the board to the regulator.

This patch is functionaly tested on SMDK6410 board. DA9055 Evaluation
board was connected to the SMDK6410 board.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  727 ++
 3 files changed, 738 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/da9055-regulator.c

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 129c827..0bd6db1 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -109,6 +109,16 @@ config REGULATOR_DA9052
  This driver supports the voltage regulators of DA9052-BC and
  DA9053-AA/Bx PMIC.
 
+config REGULATOR_DA9055
+   tristate "Dialog Semiconductor DA9055 regulators"
+   depends on MFD_DA9055
+   help
+ Say y here to support the BUCKs and LDOs regulators found on
+ Dialog Semiconductor DA9055 PMIC.
+
+ This driver can also be built as a module. If so, the module
+ will be called da9055-regulator.
+
 config REGULATOR_ANATOP
tristate "Freescale i.MX on-chip ANATOP LDO regulators"
depends on MFD_ANATOP
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 3a0dbc5..950b38b 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
 obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
 obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
 obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
+obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
 obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
 obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
 obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o
diff --git a/drivers/regulator/da9055-regulator.c 
b/drivers/regulator/da9055-regulator.c
new file mode 100644
index 000..630b664
--- /dev/null
+++ b/drivers/regulator/da9055-regulator.c
@@ -0,0 +1,727 @@
+/*
+* Regulator driver for DA9055 PMIC
+*
+* Copyright(c) 2012 Dialog Semiconductor Ltd.
+*
+* Author: David Dajun Chen 
+*
+* 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
+* (at your option) any later version.
+*
+*/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define DA9055_MIN_UA  0
+#define DA9055_MAX_UA  3
+
+#define DA9055_LDO_MODE_SYNC   0
+#define DA9055_LDO_MODE_SLEEP  1
+
+#define DA9055_BUCK_MODE_SLEEP 1
+#define DA9055_BUCK_MODE_SYNC  2
+#define DA9055_BUCK_MODE_AUTO  3
+
+/* DA9055 REGULATOR IDs */
+#define DA9055_ID_BUCK10
+#define DA9055_ID_BUCK21
+#define DA9055_ID_LDO1 2
+#define DA9055_ID_LDO2 3
+#define DA9055_ID_LDO3 4
+#define DA9055_ID_LDO4 5
+#define DA9055_ID_LDO5 6
+#define DA9055_ID_LDO6 7
+
+/* DA9055 GPIO OFFSET */
+#define DA9055_GPIO_1_OFFSET   0x01
+#define DA9055_GPIO_2_OFFSET   0x02
+
+/* DA9055 BUCK current limit */
+static const int da9055_current_limits[] = { 50, 60, 70, 80 };
+
+struct da9055_conf_reg {
+   int reg;
+   int sel_mask;
+   int en_mask;
+};
+
+struct da9055_volt_reg {
+   int reg_a;
+   int reg_b;
+   int sl_shift;
+   int v_offset;
+   int v_mask;
+   int v_shift;
+};
+
+struct da9055_mode_reg {
+   int reg;
+   int mask;
+   int shift;
+};
+
+struct da9055_regulator_info {
+   struct regulator_desc reg_desc;
+   int step_uV;
+   int min_uV;
+   int max_uV;
+   struct da9055_conf_reg conf;
+   struct da9055_volt_reg volt;
+   struct da9055_mode_reg mode;
+};
+
+struct da9055_regulator {
+   struct da9055 *da9055;
+   struct da9055_regulator_info *info;
+   struct regulator_dev *rdev;
+   int gpio_1;
+   int gpio_2;
+   enum gpio_select gpio_rsel;
+   enum gpio_select gpio_ren;
+};
+
+static int verify_range(struct da9055_regulator_info *info,
+int min_uV, int max_uV)
+{
+   if (min_uV > info->max_uV || max_uV < info->min_uV)
+   return -EINVAL;
+
+   return 0;
+}
+
+static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev)
+{
+   struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
+   struct da9055_regulator_info *info = regulator->info;
+

[Patch v1 1/7] DA9055 MFD core driver

2012-09-14 Thread Ashish Jangam
This is the DA9055 MFD core driver that instantiate all the dependent
component
drivers and provides them the device access via I2C.

This patch is functionally tested on Samsung SMDK6410.

Signed-off-by: David Dajun Chen 
Signed-off-by: Ashish Jangam 
---
 drivers/mfd/Kconfig  |   17 +
 drivers/mfd/Makefile |3 +
 drivers/mfd/da9055-core.c|  423 +++
 drivers/mfd/da9055-i2c.c |   93 +
 include/linux/mfd/da9055/core.h  |   94 +
 include/linux/mfd/da9055/pdata.h |   32 ++
 include/linux/mfd/da9055/reg.h   |  699 ++
 7 files changed, 1361 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/da9055-core.c
 create mode 100644 drivers/mfd/da9055-i2c.c
 create mode 100644 include/linux/mfd/da9055/core.h
 create mode 100644 include/linux/mfd/da9055/pdata.h
 create mode 100644 include/linux/mfd/da9055/reg.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b1a1462..34a539f 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -441,6 +441,23 @@ config MFD_DA9052_I2C
  for accessing the device, additional drivers must be enabled in
  order to use the functionality of the device.
 
+config MFD_DA9055
+   bool "Dialog Semiconductor DA9055 PMIC Support"
+   select REGMAP_I2C
+   select REGMAP_IRQ
+   select PMIC_DA9055
+   select MFD_CORE
+   depends on I2C=y
+   help
+ Say yes here for support of Dialog Semiconductor DA9055. This is
+ a Power Management IC. This driver provides common support for
+ accessing the device as well as the I2C interface to the chip itself.
+ Additional drivers must be enabled in order to use the functionality
+ of the device.
+
+ This driver can be built as a module. If built as a module it will be
+ called "da9055"
+
 config PMIC_ADP5520
bool "Analog Devices ADP5520/01 MFD PMIC Core Support"
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 79dd22d..339cbb4 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -90,6 +90,9 @@ obj-$(CONFIG_PMIC_DA9052) += da9052-core.o
 obj-$(CONFIG_MFD_DA9052_SPI)   += da9052-spi.o
 obj-$(CONFIG_MFD_DA9052_I2C)   += da9052-i2c.o
 
+da9055-objs:= da9055-core.o da9055-i2c.o
+obj-$(CONFIG_MFD_DA9055)   += da9055.o
+
 obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o
 obj-$(CONFIG_MFD_MAX77693) += max77693.o max77693-irq.o
 max8925-objs   := max8925-core.o max8925-i2c.o
diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
new file mode 100644
index 000..6297bc0
--- /dev/null
+++ b/drivers/mfd/da9055-core.c
@@ -0,0 +1,423 @@
+/*
+ * Device access for Dialog DA9055 PMICs.
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: David Dajun Chen 
+ *
+ *  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 (at your
+ *  option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define DA9055_IRQ_NONKEY_MASK 0x01
+#define DA9055_IRQ_ALM_MASK0x02
+#define DA9055_IRQ_TICK_MASK   0x04
+#define DA9055_IRQ_ADC_MASK0x08
+#define DA9055_IRQ_BUCK_ILIM_MASK  0x08
+
+static bool da9055_register_readable(struct device *dev, unsigned int reg)
+{
+   switch (reg) {
+   case DA9055_REG_STATUS_A:
+   case DA9055_REG_STATUS_B:
+   case DA9055_REG_EVENT_A:
+   case DA9055_REG_EVENT_B:
+   case DA9055_REG_EVENT_C:
+   case DA9055_REG_IRQ_MASK_A:
+   case DA9055_REG_IRQ_MASK_B:
+   case DA9055_REG_IRQ_MASK_C:
+
+   case DA9055_REG_CONTROL_A:
+   case DA9055_REG_CONTROL_B:
+   case DA9055_REG_CONTROL_C:
+   case DA9055_REG_CONTROL_D:
+   case DA9055_REG_CONTROL_E:
+
+   case DA9055_REG_ADC_MAN:
+   case DA9055_REG_ADC_CONT:
+   case DA9055_REG_VSYS_MON:
+   case DA9055_REG_ADC_RES_L:
+   case DA9055_REG_ADC_RES_H:
+   case DA9055_REG_VSYS_RES:
+   case DA9055_REG_ADCIN1_RES:
+   case DA9055_REG_ADCIN2_RES:
+   case DA9055_REG_ADCIN3_RES:
+
+   case DA9055_REG_COUNT_S:
+   case DA9055_REG_COUNT_MI:
+   case DA9055_REG_COUNT_H:
+   case DA9055_REG_COUNT_D:
+   case DA9055_REG_COUNT_MO:
+   case DA9055_REG_COUNT_Y:
+   case DA9055_REG_ALARM_H:
+   case DA9055_REG_ALARM_D:
+   case DA9055_REG_ALARM_MI:
+   case DA9055_REG_ALARM_MO:
+   case DA9055_REG_ALARM_Y:
+
+   case DA9055_REG_GPIO0_1:
+   case DA9055_REG_GPIO2:
+   case DA9055_REG_GPIO_MODE0_2:
+
+   case DA9055_REG_BCORE_CONT:
+   case DA9055_REG_BMEM_CONT:
+   case DA90

[Patch v1 0/7] DA9055 PMIC driver

2012-09-14 Thread Ashish Jangam
The following patch series adds support to the DA9055 PMIC.

The DA9055 is a low power Power Management Integrated Circuit. This PMIC
device is only controlled from an I2C device.

The driver for the DA9055 consists of a core (i2c) device driver and its
dependent component device drivers for:
regulator - 2 BUCKS, 6 LDOs
rtc - low power clock
gpio - 3 pins
hwmon - 5 ADC channels
watchdog - system monitor
onkey - button device

These drivers has been tested on a Samsung SMDK6410.

Ashish Jangam (7):
  DA9058 MFD core
  DA9058 REGULATOR driver
  DA9058 RTC driver
  DA9058 GPIO driver
  DA9058 HWMON driver
  DA9058 WATCHDOG driver
  DA9058 ONKEY driver

 Documentation/hwmon/da9055   |   47 +++
 drivers/gpio/Kconfig |   11 +
 drivers/gpio/Makefile|1 +
 drivers/gpio/gpio-da9055.c   |  204 ++
 drivers/hwmon/Kconfig|   10 +
 drivers/hwmon/Makefile   |1 +
 drivers/hwmon/da9055-hwmon.c |  342 
 drivers/input/misc/Kconfig   |   10 +
 drivers/input/misc/Makefile  |1 +
 drivers/input/misc/da9055_onkey.c|  121 ++
 drivers/mfd/Kconfig  |   17 +
 drivers/mfd/Makefile |3 +
 drivers/mfd/da9055-core.c|  423 
 drivers/mfd/da9055-i2c.c |   93 +
 drivers/regulator/Kconfig|   10 +
 drivers/regulator/Makefile   |1 +
 drivers/regulator/da9055-regulator.c |  727
++
 drivers/rtc/Kconfig  |   10 +
 drivers/rtc/Makefile |1 +
 drivers/rtc/rtc-da9055.c |  430 
 drivers/watchdog/Kconfig |   10 +
 drivers/watchdog/Makefile|1 +
 drivers/watchdog/da9055_wdt.c|  227 +++
 include/linux/mfd/da9055/core.h  |   94 +
 include/linux/mfd/da9055/pdata.h |   32 ++
 include/linux/mfd/da9055/reg.h   |  699

 26 files changed, 3526 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/hwmon/da9055
 create mode 100644 drivers/gpio/gpio-da9055.c
 create mode 100644 drivers/hwmon/da9055-hwmon.c
 create mode 100644 drivers/input/misc/da9055_onkey.c
 create mode 100644 drivers/mfd/da9055-core.c
 create mode 100644 drivers/mfd/da9055-i2c.c
 create mode 100644 drivers/regulator/da9055-regulator.c
 mode change 100644 => 100755 drivers/rtc/Kconfig
 create mode 100644 drivers/rtc/rtc-da9055.c
 create mode 100644 drivers/watchdog/da9055_wdt.c
 create mode 100644 include/linux/mfd/da9055/core.h
 create mode 100644 include/linux/mfd/da9055/pdata.h
 create mode 100644 include/linux/mfd/da9055/reg.h


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/