aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/max8998.c
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2010-09-10 12:36:39 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-28 18:29:03 -0400
commit2c7e6f5797140b33ec2b967ff28941e1c7eff4b2 (patch)
treec05033ac7712ab253981dc43ac512577113c91c4 /drivers/mfd/max8998.c
parent676e02d7a2ed9bb02994670a07df533a29a99de6 (diff)
mfd: Add MAX8998 interrupts support
Use genirq and provide seperated file for interrupts support. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/max8998.c')
-rw-r--r--drivers/mfd/max8998.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
index 3b8a5076d351..49c140a78ba9 100644
--- a/drivers/mfd/max8998.c
+++ b/drivers/mfd/max8998.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * max8698.c - mfd core driver for the Maxim 8998 2 * max8998.c - mfd core driver for the Maxim 8998
3 * 3 *
4 * Copyright (C) 2009-2010 Samsung Electronics 4 * Copyright (C) 2009-2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
@@ -53,6 +53,21 @@ int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
53} 53}
54EXPORT_SYMBOL(max8998_read_reg); 54EXPORT_SYMBOL(max8998_read_reg);
55 55
56int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count, u8 *buf)
57{
58 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
59 int ret;
60
61 mutex_lock(&max8998->iolock);
62 ret = i2c_smbus_read_i2c_block_data(i2c, reg, count, buf);
63 mutex_unlock(&max8998->iolock);
64 if (ret < 0)
65 return ret;
66
67 return 0;
68}
69EXPORT_SYMBOL(max8998_bulk_read);
70
56int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value) 71int max8998_write_reg(struct i2c_client *i2c, u8 reg, u8 value)
57{ 72{
58 struct max8998_dev *max8998 = i2c_get_clientdata(i2c); 73 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
@@ -87,6 +102,7 @@ EXPORT_SYMBOL(max8998_update_reg);
87static int max8998_i2c_probe(struct i2c_client *i2c, 102static int max8998_i2c_probe(struct i2c_client *i2c,
88 const struct i2c_device_id *id) 103 const struct i2c_device_id *id)
89{ 104{
105 struct max8998_platform_data *pdata = i2c->dev.platform_data;
90 struct max8998_dev *max8998; 106 struct max8998_dev *max8998;
91 int ret = 0; 107 int ret = 0;
92 108
@@ -97,8 +113,15 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
97 i2c_set_clientdata(i2c, max8998); 113 i2c_set_clientdata(i2c, max8998);
98 max8998->dev = &i2c->dev; 114 max8998->dev = &i2c->dev;
99 max8998->i2c = i2c; 115 max8998->i2c = i2c;
116 max8998->irq = i2c->irq;
117 if (pdata) {
118 max8998->ono = pdata->ono;
119 max8998->irq_base = pdata->irq_base;
120 }
100 mutex_init(&max8998->iolock); 121 mutex_init(&max8998->iolock);
101 122
123 max8998_irq_init(max8998);
124
102 ret = mfd_add_devices(max8998->dev, -1, 125 ret = mfd_add_devices(max8998->dev, -1,
103 max8998_devs, ARRAY_SIZE(max8998_devs), 126 max8998_devs, ARRAY_SIZE(max8998_devs),
104 NULL, 0); 127 NULL, 0);