diff options
Diffstat (limited to 'drivers/mfd/twl-core.c')
-rw-r--r-- | drivers/mfd/twl-core.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 764c5b5d914..eb9bd203e49 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 */ |
1182 | static int __devinit | 1182 | static int __devinit |
1183 | twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | 1183 | twl_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) | |||
1292 | fail: | 1296 | fail: |
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 | ||