diff options
author | Pradeep Goudagunta <pgoudagunta@nvidia.com> | 2012-11-20 15:22:11 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-11-21 08:55:31 -0800 |
commit | cd676acb4018c3b0952015c5516b5b958b1ab69b (patch) | |
tree | cdd60d9edbe91eb066f85af61bac764cece09f0d /drivers/mfd | |
parent | d2dd86adf8a51ba8f02df546d2a4e30bffa8c0a8 (diff) |
mfd: max77665: Make irqf selection from pdata
-Make irqf selection from platform data.
-Avoid i2c trasactions in atomic context.
Bug 1011298
Change-Id: I122e6222b810b471e8307dbf6638f27fa7dacce4
Signed-off-by: Pradeep Goudagunta <pgoudagunta@nvidia.com>
Reviewed-on: http://git-master/r/162908
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/max77665.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/mfd/max77665.c b/drivers/mfd/max77665.c index 12a046ae26ec..73ebadfd6ad5 100644 --- a/drivers/mfd/max77665.c +++ b/drivers/mfd/max77665.c @@ -34,6 +34,8 @@ #define MAX77665_MUIC 0x00 ... 0x0E #define MAX77665_HAPTIC 0x00 ... 0x10 +static u8 int_mask_reg = 0xff; + static u8 max77665_i2c_slave_address[] = { [MAX77665_I2C_SLAVE_PMIC] = 0x66, [MAX77665_I2C_SLAVE_MUIC] = 0x25, @@ -75,13 +77,8 @@ static void max77665_irq_mask(struct irq_data *irq_data) struct max77665 *max77665 = irq_data_get_irq_chip_data(irq_data); unsigned int __irq = irq_data->irq - max77665->irq_base; const struct max77665_irq_data *data = &max77665_irqs[__irq]; - int ret; - ret = max77665_set_bits(max77665->dev, MAX77665_I2C_SLAVE_PMIC, - MAX77665_INT_MSK, data->bit); - if (ret < 0) - dev_err(max77665->dev, - "Clearing mask reg failed e = %d\n", ret); + int_mask_reg |= (1 << data->bit); } static void max77665_irq_unmask(struct irq_data *irq_data) @@ -89,20 +86,22 @@ static void max77665_irq_unmask(struct irq_data *irq_data) struct max77665 *max77665 = irq_data_get_irq_chip_data(irq_data); unsigned int __irq = irq_data->irq - max77665->irq_base; const struct max77665_irq_data *data = &max77665_irqs[__irq]; - int ret; - ret = max77665_clr_bits(max77665->dev, MAX77665_I2C_SLAVE_PMIC, - MAX77665_INT_MSK, data->bit); - if (ret < 0) - dev_err(max77665->dev, - "Setting mask reg failed e = %d\n", ret); + int_mask_reg &= ~(1 << data->bit); } static void max77665_irq_sync_unlock(struct irq_data *data) { struct max77665 *max77665 = irq_data_get_irq_chip_data(data); + int ret; mutex_unlock(&max77665->irq_lock); + ret = max77665_write(max77665->dev, MAX77665_I2C_SLAVE_PMIC, + MAX77665_INT_MSK, int_mask_reg); + if (ret < 0) { + dev_err(max77665->dev, + "Int mask reg write failed, e %d\n", ret); + } } static irqreturn_t max77665_irq(int irq, void *data) @@ -139,7 +138,7 @@ static int max77665_irq_set_wake(struct irq_data *data, unsigned int enable) #endif static int __devinit max77665_irq_init(struct max77665 *max77665, int irq, - int irq_base) + int irq_base, unsigned long irq_flag) { int i, ret; @@ -177,7 +176,7 @@ static int __devinit max77665_irq_init(struct max77665 *max77665, int irq, #endif } - ret = request_threaded_irq(irq, NULL, max77665_irq, IRQF_ONESHOT, + ret = request_threaded_irq(irq, NULL, max77665_irq, irq_flag, "max77665", max77665); if (ret < 0) { dev_err(max77665->dev, "Int registration failed, e %d\n", ret); @@ -295,7 +294,8 @@ static int __devinit max77665_i2c_probe(struct i2c_client *client, } if (client->irq > 0) - max77665_irq_init(max77665, client->irq, pdata->irq_base); + max77665_irq_init(max77665, client->irq, + pdata->irq_base, pdata->irq_flag); max77665s[MAX77665_CELL_CHARGER].platform_data = pdata->charger_platform_data.pdata; @@ -318,7 +318,7 @@ static int __devinit max77665_i2c_probe(struct i2c_client *client, pdata->haptic_platform_data.size; ret = mfd_add_devices(max77665->dev, -1, max77665s, - ARRAY_SIZE(max77665s), NULL, 0); + ARRAY_SIZE(max77665s), NULL, pdata->irq_base); if (ret) { dev_err(&client->dev, "add mfd devices failed with err: %d\n", ret); |