Re: [PATCH v4 1/3] mfd: intel_soc_pmic: Core driver

2014-05-30 Thread Zhu, Lejun


On 2014/5/30 17:28, Lee Jones wrote:
>> +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
>> +{"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
>> +{ }
>> +};
>> +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
>> +
>> +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
>> +{"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
>> +{ },
>> +};
>> +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
>
> Does ACPI have a match function to extact it's .driver_data attribute?
>
> If so, are you using it here? If not, why not?
>

 The ACPI table is used in i2c_device_match(), and the i2c table is used
 in i2c_device_probe(), so the id in the i2c table is actually fed to
 intel_soc_pmic_probe(). But I only found out now that having the i2c
 table alone is enough, because i2c_device_match will fallback to the i2c
 table if there's no ACPI table. So to keep it simple, I'll remove the
 ACPI table completely.
>>>
>>> Actually, can you do it the other way round?  Minimise the i2c table
>>> and populate the ACPI one.  I'm just about to work on a separate
>>> patch-set which deprecates the use of the i2c table on DT and/or ACPI
>>> only registered devices.
>>
>> Current i2c_device_probe will only feed driver_data from i2c_device_id
>> table to intel_soc_pmic_probe(), because it uses i2c_match_id(). So if I
>> remove "&intel_soc_pmic_config_crc" from the i2c table, I will get NULL
>> from id->driver_data until your new patch fixes it.
> 
> Right, which is why I asked if ACPI has a match function - I just
> looked and it does.  So what you need to do is supply a very simple
> i2c_device_id struct (just until my patch lands, then there'll be no
> reason to supply one at all) and use  acpi_match_device() instead of
> using id->driver_data.
> 

Oh I see. You mean calling acpi_match_device() in my own probe(). I'll
change my code to do that in next version.

Best Regards
Lejun

--
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 v4 1/3] mfd: intel_soc_pmic: Core driver

2014-05-30 Thread Lee Jones
>  +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
>  +{"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
>  +{ }
>  +};
>  +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
>  +
>  +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
>  +{"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
>  +{ },
>  +};
>  +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
> >>>
> >>> Does ACPI have a match function to extact it's .driver_data attribute?
> >>>
> >>> If so, are you using it here? If not, why not?
> >>>
> >>
> >> The ACPI table is used in i2c_device_match(), and the i2c table is used
> >> in i2c_device_probe(), so the id in the i2c table is actually fed to
> >> intel_soc_pmic_probe(). But I only found out now that having the i2c
> >> table alone is enough, because i2c_device_match will fallback to the i2c
> >> table if there's no ACPI table. So to keep it simple, I'll remove the
> >> ACPI table completely.
> > 
> > Actually, can you do it the other way round?  Minimise the i2c table
> > and populate the ACPI one.  I'm just about to work on a separate
> > patch-set which deprecates the use of the i2c table on DT and/or ACPI
> > only registered devices.
> 
> Current i2c_device_probe will only feed driver_data from i2c_device_id
> table to intel_soc_pmic_probe(), because it uses i2c_match_id(). So if I
> remove "&intel_soc_pmic_config_crc" from the i2c table, I will get NULL
> from id->driver_data until your new patch fixes it.

Right, which is why I asked if ACPI has a match function - I just
looked and it does.  So what you need to do is supply a very simple
i2c_device_id struct (just until my patch lands, then there'll be no
reason to supply one at all) and use  acpi_match_device() instead of
using id->driver_data.

> So for the driver to work for the i2c code both today and in the future,
> I think it's best to keep the driver_data populated in both tables. What
> do you think?


-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-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 v4 1/3] mfd: intel_soc_pmic: Core driver

2014-05-30 Thread Zhu, Lejun


On 2014/5/30 16:08, Lee Jones wrote:
 +static int intel_soc_pmic_find_gpio_irq(struct device *dev)
 +{
 +  struct gpio_desc *desc;
 +  int irq;
 +
 +  desc = devm_gpiod_get_index(dev, KBUILD_MODNAME, 0);
>>>
>>> What does "KBUILD_MODNAME" translate to?
>>
>> It translates into "intel_soc_pmic".
> 
> Can you just put that instead?

Sure. I'll fix it.

(...)

 +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
 +  {"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
 +  { }
 +};
 +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
 +
 +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
 +  {"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
 +  { },
 +};
 +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
>>>
>>> Does ACPI have a match function to extact it's .driver_data attribute?
>>>
>>> If so, are you using it here? If not, why not?
>>>
>>
>> The ACPI table is used in i2c_device_match(), and the i2c table is used
>> in i2c_device_probe(), so the id in the i2c table is actually fed to
>> intel_soc_pmic_probe(). But I only found out now that having the i2c
>> table alone is enough, because i2c_device_match will fallback to the i2c
>> table if there's no ACPI table. So to keep it simple, I'll remove the
>> ACPI table completely.
> 
> Actually, can you do it the other way round?  Minimise the i2c table
> and populate the ACPI one.  I'm just about to work on a separate
> patch-set which deprecates the use of the i2c table on DT and/or ACPI
> only registered devices.

Current i2c_device_probe will only feed driver_data from i2c_device_id
table to intel_soc_pmic_probe(), because it uses i2c_match_id(). So if I
remove "&intel_soc_pmic_config_crc" from the i2c table, I will get NULL
from id->driver_data until your new patch fixes it.

So for the driver to work for the i2c code both today and in the future,
I think it's best to keep the driver_data populated in both tables. What
do you think?

Best Regards
Lejun

--
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 v4 1/3] mfd: intel_soc_pmic: Core driver

2014-05-30 Thread Lee Jones
> >> +static int intel_soc_pmic_find_gpio_irq(struct device *dev)
> >> +{
> >> +  struct gpio_desc *desc;
> >> +  int irq;
> >> +
> >> +  desc = devm_gpiod_get_index(dev, KBUILD_MODNAME, 0);
> > 
> > What does "KBUILD_MODNAME" translate to?
> 
> It translates into "intel_soc_pmic".

Can you just put that instead?

> >> +  if (IS_ERR(desc)) {
> >> +  dev_dbg(dev, "Not using GPIO as interrupt.\n");
> > 
> > You can't have a debug print, then return an err - use dev_err().
> 
> Actually returning ENOENT here is just a hardware difference. On some
> boards the PMIC interrupt is from a GPIO line exposed by the CPU, on the
> rest (e.g. Asus T100TA) it's not. When -ENOENT is returned, probe() will
> simply use the IRQ provided by the I2C.
> 
> I will remove this line completely, and put a comment before the function.

That'll do, thanks.

> >> +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
> >> +  {"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
> >> +  { }
> >> +};
> >> +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
> >> +
> >> +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
> >> +  {"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
> >> +  { },
> >> +};
> >> +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
> > 
> > Does ACPI have a match function to extact it's .driver_data attribute?
> > 
> > If so, are you using it here? If not, why not?
> > 
> 
> The ACPI table is used in i2c_device_match(), and the i2c table is used
> in i2c_device_probe(), so the id in the i2c table is actually fed to
> intel_soc_pmic_probe(). But I only found out now that having the i2c
> table alone is enough, because i2c_device_match will fallback to the i2c
> table if there's no ACPI table. So to keep it simple, I'll remove the
> ACPI table completely.

Actually, can you do it the other way round?  Minimise the i2c table
and populate the ACPI one.  I'm just about to work on a separate
patch-set which deprecates the use of the i2c table on DT and/or ACPI
only registered devices.

> By the way, the GPIO child driver got reviewed-by from Linus Walleij,
> but can't be merged because it depends on intel_soc_pmic.h. May I
> include it in next version of the patch set and have it merged along
> with the MFD driver?

Yes, if it's okay with Linus and you aapply his Ack.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-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 v4 1/3] mfd: intel_soc_pmic: Core driver

2014-05-29 Thread Zhu, Lejun


On 5/29/2014 7:40 PM, Lee Jones wrote:
> [...]
> 
>> +static int intel_soc_pmic_find_gpio_irq(struct device *dev)
>> +{
>> +struct gpio_desc *desc;
>> +int irq;
>> +
>> +desc = devm_gpiod_get_index(dev, KBUILD_MODNAME, 0);
> 
> What does "KBUILD_MODNAME" translate to?

It translates into "intel_soc_pmic".

> 
>> +if (IS_ERR(desc)) {
>> +dev_dbg(dev, "Not using GPIO as interrupt.\n");
> 
> You can't have a debug print, then return an err - use dev_err().

Actually returning ENOENT here is just a hardware difference. On some
boards the PMIC interrupt is from a GPIO line exposed by the CPU, on the
rest (e.g. Asus T100TA) it's not. When -ENOENT is returned, probe() will
simply use the IRQ provided by the I2C.

I will remove this line completely, and put a comment before the function.

> 
> [...]
> 
>> +static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
>> +const struct i2c_device_id *id)
>> +{
>> +struct device *dev = &i2c->dev;
>> +struct intel_soc_pmic_config *config =
>> +(struct intel_soc_pmic_config *)id->driver_data;
>> +struct intel_soc_pmic *pmic;
>> +int ret;
>> +int irq;
>> +
>> +pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
>> +dev_set_drvdata(dev, pmic);
>> +
>> +pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
>> +
>> +irq = intel_soc_pmic_find_gpio_irq(dev);
>> +if (irq < 0)
>> +pmic->irq = i2c->irq;
>> +else
>> +pmic->irq = irq;
> 
> pmic->irq = (irq < 0) ? i2c->irq : irq;

I'll fix it.

>> +ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,
>> +  config->irq_flags | IRQF_ONESHOT,
>> +  0, config->irq_chip,
>> +  &pmic->irq_chip_data);
>> +if (ret)
>> +goto err;
> 
> Just return ret here and remove the 'err:' label.

I'll fix it.

> 
> [...]
> 
>> +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
>> +{"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
>> +{ }
>> +};
>> +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
>> +
>> +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
>> +{"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
>> +{ },
>> +};
>> +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
> 
> Does ACPI have a match function to extact it's .driver_data attribute?
> 
> If so, are you using it here? If not, why not?
> 

The ACPI table is used in i2c_device_match(), and the i2c table is used
in i2c_device_probe(), so the id in the i2c table is actually fed to
intel_soc_pmic_probe(). But I only found out now that having the i2c
table alone is enough, because i2c_device_match will fallback to the i2c
table if there's no ACPI table. So to keep it simple, I'll remove the
ACPI table completely.

By the way, the GPIO child driver got reviewed-by from Linus Walleij,
but can't be merged because it depends on intel_soc_pmic.h. May I
include it in next version of the patch set and have it merged along
with the MFD driver?

Best Regards
Lejun
--
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 v4 1/3] mfd: intel_soc_pmic: Core driver

2014-05-29 Thread Lee Jones
> This patch provides the common I2C driver code for Intel SoC PMICs.
> 
> Signed-off-by: Yang, Bin 
> Signed-off-by: Zhu, Lejun 
> ---
> v2:
> - Use regmap instead of creating our own I2C read/write callbacks.
> - Add one missing EXPORT_SYMBOL.
> - Remove duplicate code and put them into pmic_regmap_load_from_hw.
> v3:
> - Use regmap-irq. Remove our own pmic_regmap_* and IRQ handling code.
> - Remove intel_soc_pmic_dev() and intel_soc_pmic_set_pdata().
> - Use EXPORT_SYMBOL_GPL for exposed APIs.
> - Use gpiod interface instead of gpio numbers.
> - Remove redundant I2C IDs.
> - Use managed allocations.
> v4:
> - Remove all exported APIs which are wrappers of regmap API, export
>   the regmap in data structure instead.
> - Combine I2C and core .c files.
> - Clean up include files.
> - Use intel_soc_pmic_ prefix to replace pmic_ and intel_pmic_.
> - Fix various coding style issues.
> ---
>  drivers/mfd/intel_soc_pmic_core.c  | 164 
> +
>  drivers/mfd/intel_soc_pmic_core.h  |  32 
>  include/linux/mfd/intel_soc_pmic.h |  30 +++
>  3 files changed, 226 insertions(+)
>  create mode 100644 drivers/mfd/intel_soc_pmic_core.c
>  create mode 100644 drivers/mfd/intel_soc_pmic_core.h
>  create mode 100644 include/linux/mfd/intel_soc_pmic.h
> 
> diff --git a/drivers/mfd/intel_soc_pmic_core.c 
> b/drivers/mfd/intel_soc_pmic_core.c
> new file mode 100644
> index 000..664eaef
> --- /dev/null
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -0,0 +1,164 @@

[...]

> +static int intel_soc_pmic_find_gpio_irq(struct device *dev)
> +{
> + struct gpio_desc *desc;
> + int irq;
> +
> + desc = devm_gpiod_get_index(dev, KBUILD_MODNAME, 0);

What does "KBUILD_MODNAME" translate to?

> + if (IS_ERR(desc)) {
> + dev_dbg(dev, "Not using GPIO as interrupt.\n");

You can't have a debug print, then return an err - use dev_err().

[...]

> +static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
> + const struct i2c_device_id *id)
> +{
> + struct device *dev = &i2c->dev;
> + struct intel_soc_pmic_config *config =
> + (struct intel_soc_pmic_config *)id->driver_data;
> + struct intel_soc_pmic *pmic;
> + int ret;
> + int irq;
> +
> + pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
> + dev_set_drvdata(dev, pmic);
> +
> + pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
> +
> + irq = intel_soc_pmic_find_gpio_irq(dev);
> + if (irq < 0)
> + pmic->irq = i2c->irq;
> + else
> + pmic->irq = irq;

pmic->irq = (irq < 0) ? i2c->irq : irq;

> + ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,
> +   config->irq_flags | IRQF_ONESHOT,
> +   0, config->irq_chip,
> +   &pmic->irq_chip_data);
> + if (ret)
> + goto err;

Just return ret here and remove the 'err:' label.

[...]

> +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
> + {"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
> + { }
> +};
> +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
> +
> +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
> + {"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
> + { },
> +};
> +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);

Does ACPI have a match function to extact it's .driver_data attribute?

If so, are you using it here? If not, why not?

[...]

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-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 1/3] mfd: intel_soc_pmic: Core driver

2014-05-29 Thread Zhu, Lejun
This patch provides the common I2C driver code for Intel SoC PMICs.

Signed-off-by: Yang, Bin 
Signed-off-by: Zhu, Lejun 
---
v2:
- Use regmap instead of creating our own I2C read/write callbacks.
- Add one missing EXPORT_SYMBOL.
- Remove duplicate code and put them into pmic_regmap_load_from_hw.
v3:
- Use regmap-irq. Remove our own pmic_regmap_* and IRQ handling code.
- Remove intel_soc_pmic_dev() and intel_soc_pmic_set_pdata().
- Use EXPORT_SYMBOL_GPL for exposed APIs.
- Use gpiod interface instead of gpio numbers.
- Remove redundant I2C IDs.
- Use managed allocations.
v4:
- Remove all exported APIs which are wrappers of regmap API, export
  the regmap in data structure instead.
- Combine I2C and core .c files.
- Clean up include files.
- Use intel_soc_pmic_ prefix to replace pmic_ and intel_pmic_.
- Fix various coding style issues.
---
 drivers/mfd/intel_soc_pmic_core.c  | 164 +
 drivers/mfd/intel_soc_pmic_core.h  |  32 
 include/linux/mfd/intel_soc_pmic.h |  30 +++
 3 files changed, 226 insertions(+)
 create mode 100644 drivers/mfd/intel_soc_pmic_core.c
 create mode 100644 drivers/mfd/intel_soc_pmic_core.h
 create mode 100644 include/linux/mfd/intel_soc_pmic.h

diff --git a/drivers/mfd/intel_soc_pmic_core.c 
b/drivers/mfd/intel_soc_pmic_core.c
new file mode 100644
index 000..664eaef
--- /dev/null
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -0,0 +1,164 @@
+/*
+ * intel_soc_pmic_core.c - Intel SoC PMIC MFD Driver
+ *
+ * Copyright (C) 2013, 2014 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version
+ * 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Author: Yang, Bin 
+ * Author: Zhu, Lejun 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "intel_soc_pmic_core.h"
+
+static int intel_soc_pmic_find_gpio_irq(struct device *dev)
+{
+   struct gpio_desc *desc;
+   int irq;
+
+   desc = devm_gpiod_get_index(dev, KBUILD_MODNAME, 0);
+   if (IS_ERR(desc)) {
+   dev_dbg(dev, "Not using GPIO as interrupt.\n");
+   return -ENOENT;
+   }
+
+   irq = gpiod_to_irq(desc);
+   if (irq < 0)
+   dev_warn(dev, "Can't get irq: %d\n", irq);
+
+   return irq;
+}
+
+static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
+   const struct i2c_device_id *id)
+{
+   struct device *dev = &i2c->dev;
+   struct intel_soc_pmic_config *config =
+   (struct intel_soc_pmic_config *)id->driver_data;
+   struct intel_soc_pmic *pmic;
+   int ret;
+   int irq;
+
+   pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
+   dev_set_drvdata(dev, pmic);
+
+   pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
+
+   irq = intel_soc_pmic_find_gpio_irq(dev);
+   if (irq < 0)
+   pmic->irq = i2c->irq;
+   else
+   pmic->irq = irq;
+
+   ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,
+ config->irq_flags | IRQF_ONESHOT,
+ 0, config->irq_chip,
+ &pmic->irq_chip_data);
+   if (ret)
+   goto err;
+
+   ret = enable_irq_wake(pmic->irq);
+   if (ret)
+   dev_warn(dev, "Can't enable IRQ as wake source: %d\n", ret);
+
+   ret = mfd_add_devices(dev, -1, config->cell_dev,
+ config->n_cell_devs, NULL, 0,
+ regmap_irq_get_domain(pmic->irq_chip_data));
+   if (ret)
+   goto err_del_irq_chip;
+
+   return 0;
+
+err_del_irq_chip:
+   regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data);
+err:
+   return ret;
+}
+
+static int intel_soc_pmic_i2c_remove(struct i2c_client *i2c)
+{
+   struct intel_soc_pmic *pmic = dev_get_drvdata(&i2c->dev);
+
+   regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data);
+
+   mfd_remove_devices(&i2c->dev);
+
+   return 0;
+}
+
+static void intel_soc_pmic_shutdown(struct i2c_client *i2c)
+{
+   struct intel_soc_pmic *pmic = dev_get_drvdata(&i2c->dev);
+
+   disable_irq(pmic->irq);
+
+   return;
+}
+
+static int intel_soc_pmic_suspend(struct device *dev)
+{
+   struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
+
+   disable_irq(pmic->irq);
+
+   return 0;
+}
+
+static int intel_soc_pmic_resume(struct device *dev)
+{
+   struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
+
+   enable_irq(pmic->irq);
+
+   return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_