diff options
Diffstat (limited to 'drivers/power/ds2782_battery.c')
-rw-r--r-- | drivers/power/ds2782_battery.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c index c665e8007235..d762a0cbc6af 100644 --- a/drivers/power/ds2782_battery.c +++ b/drivers/power/ds2782_battery.c | |||
@@ -300,13 +300,18 @@ static int ds278x_battery_remove(struct i2c_client *client) | |||
300 | return 0; | 300 | return 0; |
301 | } | 301 | } |
302 | 302 | ||
303 | enum ds278x_num_id { | ||
304 | DS2782 = 0, | ||
305 | DS2786, | ||
306 | }; | ||
307 | |||
303 | static struct ds278x_battery_ops ds278x_ops[] = { | 308 | static struct ds278x_battery_ops ds278x_ops[] = { |
304 | [0] = { | 309 | [DS2782] = { |
305 | .get_current = ds2782_get_current, | 310 | .get_current = ds2782_get_current, |
306 | .get_voltage = ds2782_get_voltage, | 311 | .get_voltage = ds2782_get_voltage, |
307 | .get_capacity = ds2782_get_capacity, | 312 | .get_capacity = ds2782_get_capacity, |
308 | }, | 313 | }, |
309 | [1] = { | 314 | [DS2786] = { |
310 | .get_current = ds2786_get_current, | 315 | .get_current = ds2786_get_current, |
311 | .get_voltage = ds2786_get_voltage, | 316 | .get_voltage = ds2786_get_voltage, |
312 | .get_capacity = ds2786_get_capacity, | 317 | .get_capacity = ds2786_get_capacity, |
@@ -325,7 +330,7 @@ static int ds278x_battery_probe(struct i2c_client *client, | |||
325 | * ds2786 should have the sense resistor value set | 330 | * ds2786 should have the sense resistor value set |
326 | * in the platform data | 331 | * in the platform data |
327 | */ | 332 | */ |
328 | if (id->driver_data == 1 && !pdata) { | 333 | if (id->driver_data == DS2786 && !pdata) { |
329 | dev_err(&client->dev, "missing platform data for ds2786\n"); | 334 | dev_err(&client->dev, "missing platform data for ds2786\n"); |
330 | return -EINVAL; | 335 | return -EINVAL; |
331 | } | 336 | } |
@@ -355,7 +360,7 @@ static int ds278x_battery_probe(struct i2c_client *client, | |||
355 | goto fail_name; | 360 | goto fail_name; |
356 | } | 361 | } |
357 | 362 | ||
358 | if (id->driver_data == 1) | 363 | if (id->driver_data == DS2786) |
359 | info->rsns = pdata->rsns; | 364 | info->rsns = pdata->rsns; |
360 | 365 | ||
361 | i2c_set_clientdata(client, info); | 366 | i2c_set_clientdata(client, info); |
@@ -385,8 +390,8 @@ fail_id: | |||
385 | } | 390 | } |
386 | 391 | ||
387 | static const struct i2c_device_id ds278x_id[] = { | 392 | static const struct i2c_device_id ds278x_id[] = { |
388 | {"ds2782", 0}, | 393 | {"ds2782", DS2782}, |
389 | {"ds2786", 1}, | 394 | {"ds2786", DS2786}, |
390 | {}, | 395 | {}, |
391 | }; | 396 | }; |
392 | 397 | ||