Commit 2afa62ea authored by Haojian Zhuang's avatar Haojian Zhuang Committed by Samuel Ortiz

mfd: Use genirq in 88pm860x

Use genirq to simplify IRQ handling in 88pm860x. Remove the interface of
mask/free IRQs on 88pm860x. All these work is taken by genirq. Update the
touchscreen driver of 88pm860x since IRQ handling is changed.
Signed-off-by: default avatarHaojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 7731074a
......@@ -54,7 +54,6 @@ static irqreturn_t pm860x_touch_handler(int irq, void *data)
int z1, z2, rt = 0;
int ret;
pm860x_mask_irq(chip, irq);
ret = pm860x_bulk_read(touch->i2c, MEAS_TSIX_1, MEAS_LEN, buf);
if (ret < 0)
goto out;
......@@ -83,7 +82,6 @@ static irqreturn_t pm860x_touch_handler(int irq, void *data)
dev_dbg(chip->dev, "pen release\n");
}
input_sync(touch->idev);
pm860x_unmask_irq(chip, irq);
out:
return IRQ_HANDLED;
......@@ -92,7 +90,6 @@ static irqreturn_t pm860x_touch_handler(int irq, void *data)
static int pm860x_touch_open(struct input_dev *dev)
{
struct pm860x_touch *touch = input_get_drvdata(dev);
struct pm860x_chip *chip = touch->chip;
int data, ret;
data = MEAS_PD_EN | MEAS_TSIX_EN | MEAS_TSIY_EN
......@@ -100,7 +97,6 @@ static int pm860x_touch_open(struct input_dev *dev)
ret = pm860x_set_bits(touch->i2c, MEAS_EN3, data, data);
if (ret < 0)
goto out;
pm860x_unmask_irq(chip, touch->irq);
return 0;
out:
return ret;
......@@ -109,13 +105,11 @@ static int pm860x_touch_open(struct input_dev *dev)
static void pm860x_touch_close(struct input_dev *dev)
{
struct pm860x_touch *touch = input_get_drvdata(dev);
struct pm860x_chip *chip = touch->chip;
int data;
data = MEAS_PD_EN | MEAS_TSIX_EN | MEAS_TSIY_EN
| MEAS_TSIZ1_EN | MEAS_TSIZ2_EN;
pm860x_set_bits(touch->i2c, MEAS_EN3, data, 0);
pm860x_mask_irq(chip, touch->irq);
}
static int __devinit pm860x_touch_probe(struct platform_device *pdev)
......@@ -164,11 +158,12 @@ static int __devinit pm860x_touch_probe(struct platform_device *pdev)
touch->idev->close = pm860x_touch_close;
touch->chip = chip;
touch->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
touch->irq = irq;
touch->irq = irq + chip->irq_base;
touch->res_x = pdata->res_x;
input_set_drvdata(touch->idev, touch);
ret = pm860x_request_irq(chip, irq, pm860x_touch_handler, touch);
ret = request_threaded_irq(touch->irq, NULL, pm860x_touch_handler,
IRQF_ONESHOT, "touch", touch);
if (ret < 0)
goto out_irq;
......@@ -194,7 +189,7 @@ static int __devinit pm860x_touch_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, touch);
return 0;
out_rg:
pm860x_free_irq(chip, irq);
free_irq(touch->irq, touch);
out_irq:
input_free_device(touch->idev);
out:
......@@ -207,7 +202,7 @@ static int __devexit pm860x_touch_remove(struct platform_device *pdev)
struct pm860x_touch *touch = platform_get_drvdata(pdev);
input_unregister_device(touch->idev);
pm860x_free_irq(touch->chip, touch->irq);
free_irq(touch->irq, touch);
platform_set_drvdata(pdev, NULL);
kfree(touch);
return 0;
......
This diff is collapsed.
......@@ -262,12 +262,13 @@ enum {
/* Interrupt Number in 88PM8607 */
enum {
PM8607_IRQ_ONKEY = 0,
PM8607_IRQ_ONKEY,
PM8607_IRQ_EXTON,
PM8607_IRQ_CHG,
PM8607_IRQ_BAT,
PM8607_IRQ_RTC,
PM8607_IRQ_VBAT = 8,
PM8607_IRQ_CC,
PM8607_IRQ_VBAT,
PM8607_IRQ_VCHG,
PM8607_IRQ_VSYS,
PM8607_IRQ_TINT,
......@@ -275,7 +276,7 @@ enum {
PM8607_IRQ_GPADC1,
PM8607_IRQ_GPADC2,
PM8607_IRQ_GPADC3,
PM8607_IRQ_AUDIO_SHORT = 16,
PM8607_IRQ_AUDIO_SHORT,
PM8607_IRQ_PEN,
PM8607_IRQ_HEADSET,
PM8607_IRQ_HOOK,
......@@ -291,26 +292,19 @@ enum {
PM8607_CHIP_B0 = 0x48,
};
#define PM860X_NUM_IRQ 24
struct pm860x_irq {
irq_handler_t handler;
void *data;
};
struct pm860x_chip {
struct device *dev;
struct mutex io_lock;
struct mutex irq_lock;
struct i2c_client *client;
struct i2c_client *companion; /* companion chip client */
struct pm860x_irq irq[PM860X_NUM_IRQ];
int buck3_double; /* DVC ramp slope double */
unsigned short companion_addr;
int id;
int irq_mode;
int chip_irq;
int irq_base;
int core_irq;
unsigned char chip_version;
};
......@@ -347,14 +341,20 @@ struct pm860x_touch_pdata {
unsigned long flags;
};
struct pm860x_power_pdata {
unsigned fast_charge; /* charge current */
};
struct pm860x_platform_data {
struct pm860x_backlight_pdata *backlight;
struct pm860x_led_pdata *led;
struct pm860x_touch_pdata *touch;
struct pm860x_power_pdata *power;
unsigned short companion_addr; /* I2C address of companion chip */
int i2c_port; /* Controlled by GI2C or PI2C */
int irq_mode; /* Clear interrupt by read/write(0/1) */
int irq_base; /* IRQ base number of 88pm860x */
struct regulator_init_data *regulator[PM8607_MAX_REGULATOR];
};
......@@ -368,12 +368,6 @@ extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *);
extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
unsigned char);
extern int pm860x_mask_irq(struct pm860x_chip *, int);
extern int pm860x_unmask_irq(struct pm860x_chip *, int);
extern int pm860x_request_irq(struct pm860x_chip *, int,
irq_handler_t handler, void *);
extern int pm860x_free_irq(struct pm860x_chip *, int);
extern int pm860x_device_init(struct pm860x_chip *chip,
struct pm860x_platform_data *pdata);
extern void pm860x_device_exit(struct pm860x_chip *chip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment