aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Cousson <b-cousson@ti.com>2012-03-02 05:11:26 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-03-22 08:05:34 -0400
commitec1a07b3440cc28946a77a974c21570bbef6ffa1 (patch)
treefc238f2f59f991678c67e15ad4d87ff0ed389d88
parent5a903090e7aa561901b7f052eb744b480d6126d4 (diff)
mfd: Replace twl-* pr_ macros by the dev_ equivalent and do various cleanups
Since a structure device is available now, use the dev_ macros instead of the pr_ ones. Clean some badly formatted comments. Remove some unused variables. Move some variable to the place they belong. Clean some badly wrapped lines. Align variable definition Add missing braces in if-then-else block. Add blank line for better readability. Move stuff here and there... Conflicts: drivers/mfd/twl-core.c Signed-off-by: Benoit Cousson <b-cousson@ti.com> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/twl-core.c33
-rw-r--r--drivers/mfd/twl4030-irq.c19
-rw-r--r--drivers/mfd/twl6030-irq.c39
3 files changed, 46 insertions, 45 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 764c5b5d914e..eb9bd203e497 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -1178,17 +1178,15 @@ static int twl_remove(struct i2c_client *client)
1178 return 0; 1178 return 0;
1179} 1179}
1180 1180
1181/* NOTE: this driver only handles a single twl4030/tps659x0 chip */ 1181/* NOTE: This driver only handles a single twl4030/tps659x0 chip */
1182static int __devinit 1182static int __devinit
1183twl_probe(struct i2c_client *client, const struct i2c_device_id *id) 1183twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1184{ 1184{
1185 int irq_base;
1186 int status;
1187 unsigned i;
1188 struct twl4030_platform_data *pdata = client->dev.platform_data; 1185 struct twl4030_platform_data *pdata = client->dev.platform_data;
1189 struct device_node *node = client->dev.of_node; 1186 struct device_node *node = client->dev.of_node;
1190 u8 temp; 1187 int irq_base = 0;
1191 int ret = 0; 1188 int status;
1189 unsigned i;
1192 1190
1193 if (node && !pdata) { 1191 if (node && !pdata) {
1194 /* 1192 /*
@@ -1218,12 +1216,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1218 } 1216 }
1219 1217
1220 for (i = 0; i < TWL_NUM_SLAVES; i++) { 1218 for (i = 0; i < TWL_NUM_SLAVES; i++) {
1221 struct twl_client *twl = &twl_modules[i]; 1219 struct twl_client *twl = &twl_modules[i];
1222 1220
1223 twl->address = client->addr + i; 1221 twl->address = client->addr + i;
1224 if (i == 0) 1222 if (i == 0) {
1225 twl->client = client; 1223 twl->client = client;
1226 else { 1224 } else {
1227 twl->client = i2c_new_dummy(client->adapter, 1225 twl->client = i2c_new_dummy(client->adapter,
1228 twl->address); 1226 twl->address);
1229 if (!twl->client) { 1227 if (!twl->client) {
@@ -1235,7 +1233,9 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1235 } 1233 }
1236 mutex_init(&twl->xfer_lock); 1234 mutex_init(&twl->xfer_lock);
1237 } 1235 }
1236
1238 inuse = true; 1237 inuse = true;
1238
1239 if ((id->driver_data) & TWL6030_CLASS) { 1239 if ((id->driver_data) & TWL6030_CLASS) {
1240 twl_id = TWL6030_CLASS_ID; 1240 twl_id = TWL6030_CLASS_ID;
1241 twl_map = &twl6030_map[0]; 1241 twl_map = &twl6030_map[0];
@@ -1249,8 +1249,8 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1249 1249
1250 /* read TWL IDCODE Register */ 1250 /* read TWL IDCODE Register */
1251 if (twl_id == TWL4030_CLASS_ID) { 1251 if (twl_id == TWL4030_CLASS_ID) {
1252 ret = twl_read_idcode_register(); 1252 status = twl_read_idcode_register();
1253 WARN(ret < 0, "Error: reading twl_idcode register value\n"); 1253 WARN(status < 0, "Error: reading twl_idcode register value\n");
1254 } 1254 }
1255 1255
1256 /* load power event scripts */ 1256 /* load power event scripts */
@@ -1272,18 +1272,22 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1272 } 1272 }
1273 } 1273 }
1274 1274
1275 /* Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. 1275 /*
1276 * Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface.
1276 * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, 1277 * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0,
1277 * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. 1278 * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0.
1278 */ 1279 */
1279
1280 if (twl_class_is_4030()) { 1280 if (twl_class_is_4030()) {
1281 u8 temp;
1282
1281 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &temp, REG_GPPUPDCTR1); 1283 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &temp, REG_GPPUPDCTR1);
1282 temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \ 1284 temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \
1283 I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU); 1285 I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU);
1284 twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); 1286 twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1);
1285 } 1287 }
1286 1288
1289 status = -ENODEV;
1290
1287 if (node) 1291 if (node)
1288 status = of_platform_populate(node, NULL, NULL, &client->dev); 1292 status = of_platform_populate(node, NULL, NULL, &client->dev);
1289 if (status) 1293 if (status)
@@ -1292,6 +1296,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1292fail: 1296fail:
1293 if (status < 0) 1297 if (status < 0)
1294 twl_remove(client); 1298 twl_remove(client);
1299
1295 return status; 1300 return status;
1296} 1301}
1297 1302
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 3b748b71c0f3..5d656e814358 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -32,7 +32,6 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35
36#include <linux/of.h> 35#include <linux/of.h>
37#include <linux/irqdomain.h> 36#include <linux/irqdomain.h>
38#include <linux/i2c/twl.h> 37#include <linux/i2c/twl.h>
@@ -639,14 +638,14 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)
639 int status = -EINVAL; 638 int status = -EINVAL;
640 639
641 /* only support modules with standard clear-on-read for now */ 640 /* only support modules with standard clear-on-read for now */
642 for (sih_mod = 0, sih = sih_modules; 641 for (sih_mod = 0, sih = sih_modules; sih_mod < nr_sih_modules;
643 sih_mod < nr_sih_modules;
644 sih_mod++, sih++) { 642 sih_mod++, sih++) {
645 if (sih->module == module && sih->set_cor) { 643 if (sih->module == module && sih->set_cor) {
646 status = 0; 644 status = 0;
647 break; 645 break;
648 } 646 }
649 } 647 }
648
650 if (status < 0) 649 if (status < 0)
651 return status; 650 return status;
652 651
@@ -676,7 +675,7 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)
676 status = request_threaded_irq(irq, NULL, handle_twl4030_sih, 0, 675 status = request_threaded_irq(irq, NULL, handle_twl4030_sih, 0,
677 agent->irq_name ?: sih->name, NULL); 676 agent->irq_name ?: sih->name, NULL);
678 677
679 pr_info("twl4030: %s (irq %d) chaining IRQs %d..%d\n", sih->name, 678 dev_info(dev, "%s (irq %d) chaining IRQs %d..%d\n", sih->name,
680 irq, irq_base, irq_base + i - 1); 679 irq, irq_base, irq_base + i - 1);
681 680
682 return status < 0 ? status : irq_base; 681 return status < 0 ? status : irq_base;
@@ -692,12 +691,10 @@ int twl4030_sih_setup(struct device *dev, int module, int irq_base)
692int twl4030_init_irq(struct device *dev, int irq_num) 691int twl4030_init_irq(struct device *dev, int irq_num)
693{ 692{
694 static struct irq_chip twl4030_irq_chip; 693 static struct irq_chip twl4030_irq_chip;
694 int status, i;
695 int irq_base, irq_end, nr_irqs; 695 int irq_base, irq_end, nr_irqs;
696 struct device_node *node = dev->of_node; 696 struct device_node *node = dev->of_node;
697 697
698 int status;
699 int i;
700
701 /* 698 /*
702 * TWL core and pwr interrupts must be contiguous because 699 * TWL core and pwr interrupts must be contiguous because
703 * the hwirqs numbers are defined contiguously from 1 to 15. 700 * the hwirqs numbers are defined contiguously from 1 to 15.
@@ -727,7 +724,7 @@ int twl4030_init_irq(struct device *dev, int irq_num)
727 twl4030_irq_base = irq_base; 724 twl4030_irq_base = irq_base;
728 725
729 /* 726 /*
730 * install an irq handler for each of the SIH modules; 727 * Install an irq handler for each of the SIH modules;
731 * clone dummy irq_chip since PIH can't *do* anything