blob: 134ed5c7dde59136f9be35f21dd3818c14f546f4 [file] [log] [blame]
Woogyom Kim2165c8a2012-01-04 08:27:43 +04001/*
Kim, Milof7bae492012-01-26 22:59:08 -08002 * Driver for LP8727 Micro/Mini USB IC with integrated charger
Woogyom Kim2165c8a2012-01-04 08:27:43 +04003 *
Kim, Miloe39b8282012-01-29 17:28:18 -08004 * Copyright (C) 2011 Texas Instruments
Woogyom Kim2165c8a2012-01-04 08:27:43 +04005 * Copyright (C) 2011 National Semiconductor
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13#include <linux/module.h>
14#include <linux/slab.h>
15#include <linux/interrupt.h>
16#include <linux/i2c.h>
17#include <linux/power_supply.h>
Kim, Milo1aebb092012-07-03 01:19:03 +000018#include <linux/platform_data/lp8727.h>
Woogyom Kim2165c8a2012-01-04 08:27:43 +040019
Kim, Milo60fd57e2012-08-31 09:23:25 +000020#define DEFAULT_DEBOUNCE_MSEC 270
Woogyom Kim2165c8a2012-01-04 08:27:43 +040021
22/* Registers */
23#define CTRL1 0x1
24#define CTRL2 0x2
25#define SWCTRL 0x3
26#define INT1 0x4
27#define INT2 0x5
28#define STATUS1 0x6
Kim, Milo73368802012-01-26 22:58:51 -080029#define STATUS2 0x7
Woogyom Kim2165c8a2012-01-04 08:27:43 +040030#define CHGCTRL2 0x9
31
32/* CTRL1 register */
33#define CP_EN (1 << 0)
34#define ADC_EN (1 << 1)
35#define ID200_EN (1 << 4)
36
37/* CTRL2 register */
38#define CHGDET_EN (1 << 1)
39#define INT_EN (1 << 6)
40
41/* SWCTRL register */
42#define SW_DM1_DM (0x0 << 0)
43#define SW_DM1_U1 (0x1 << 0)
44#define SW_DM1_HiZ (0x7 << 0)
45#define SW_DP2_DP (0x0 << 3)
46#define SW_DP2_U2 (0x1 << 3)
47#define SW_DP2_HiZ (0x7 << 3)
48
49/* INT1 register */
50#define IDNO (0xF << 0)
51#define VBUS (1 << 4)
52
53/* STATUS1 register */
54#define CHGSTAT (3 << 4)
55#define CHPORT (1 << 6)
56#define DCPORT (1 << 7)
57
58/* STATUS2 register */
59#define TEMP_STAT (3 << 5)
60
61enum lp8727_dev_id {
62 ID_NONE,
63 ID_TA,
64 ID_DEDICATED_CHG,
65 ID_USB_CHG,
66 ID_USB_DS,
67 ID_MAX,
68};
69
70enum lp8727_chg_stat {
71 PRECHG,
72 CC,
73 CV,
74 EOC,
75};
76
77struct lp8727_psy {
78 struct power_supply ac;
79 struct power_supply usb;
80 struct power_supply batt;
81};
82
83struct lp8727_chg {
84 struct device *dev;
85 struct i2c_client *client;
86 struct mutex xfer_lock;
87 struct delayed_work work;
Woogyom Kim2165c8a2012-01-04 08:27:43 +040088 struct lp8727_platform_data *pdata;
89 struct lp8727_psy *psy;
90 struct lp8727_chg_param *chg_parm;
91 enum lp8727_dev_id devid;
Kim, Milo60fd57e2012-08-31 09:23:25 +000092 unsigned long debounce_jiffies;
Kim, Milod71fda02012-08-31 09:23:57 +000093 int irq;
Woogyom Kim2165c8a2012-01-04 08:27:43 +040094};
95
Kim, Milo27aefa32012-01-26 22:58:39 -080096static int lp8727_read_bytes(struct lp8727_chg *pchg, u8 reg, u8 *data, u8 len)
Woogyom Kim2165c8a2012-01-04 08:27:43 +040097{
98 s32 ret;
99
100 mutex_lock(&pchg->xfer_lock);
101 ret = i2c_smbus_read_i2c_block_data(pchg->client, reg, len, data);
102 mutex_unlock(&pchg->xfer_lock);
103
104 return (ret != len) ? -EIO : 0;
105}
106
Kim, Milo27aefa32012-01-26 22:58:39 -0800107static inline int lp8727_read_byte(struct lp8727_chg *pchg, u8 reg, u8 *data)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400108{
Kim, Milo27aefa32012-01-26 22:58:39 -0800109 return lp8727_read_bytes(pchg, reg, data, 1);
110}
111
112static int lp8727_write_byte(struct lp8727_chg *pchg, u8 reg, u8 data)
113{
114 int ret;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400115
116 mutex_lock(&pchg->xfer_lock);
Kim, Milo27aefa32012-01-26 22:58:39 -0800117 ret = i2c_smbus_write_byte_data(pchg->client, reg, data);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400118 mutex_unlock(&pchg->xfer_lock);
119
120 return ret;
121}
122
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400123static int lp8727_is_charger_attached(const char *name, int id)
124{
125 if (name) {
126 if (!strcmp(name, "ac"))
127 return (id == ID_TA || id == ID_DEDICATED_CHG) ? 1 : 0;
128 else if (!strcmp(name, "usb"))
129 return (id == ID_USB_CHG) ? 1 : 0;
130 }
131
132 return (id >= ID_TA && id <= ID_USB_CHG) ? 1 : 0;
133}
134
Kim, Milo7da63342012-01-26 22:58:30 -0800135static int lp8727_init_device(struct lp8727_chg *pchg)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400136{
137 u8 val;
Kim, Milo7da63342012-01-26 22:58:30 -0800138 int ret;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400139
140 val = ID200_EN | ADC_EN | CP_EN;
Kim, Milo27aefa32012-01-26 22:58:39 -0800141 ret = lp8727_write_byte(pchg, CTRL1, val);
Kim, Milo7da63342012-01-26 22:58:30 -0800142 if (ret)
143 return ret;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400144
145 val = INT_EN | CHGDET_EN;
Kim, Milo27aefa32012-01-26 22:58:39 -0800146 ret = lp8727_write_byte(pchg, CTRL2, val);
Kim, Milo7da63342012-01-26 22:58:30 -0800147 if (ret)
148 return ret;
149
150 return 0;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400151}
152
153static int lp8727_is_dedicated_charger(struct lp8727_chg *pchg)
154{
155 u8 val;
Kim, Milo27aefa32012-01-26 22:58:39 -0800156 lp8727_read_byte(pchg, STATUS1, &val);
Kim, Milo73368802012-01-26 22:58:51 -0800157 return val & DCPORT;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400158}
159
160static int lp8727_is_usb_charger(struct lp8727_chg *pchg)
161{
162 u8 val;
Kim, Milo27aefa32012-01-26 22:58:39 -0800163 lp8727_read_byte(pchg, STATUS1, &val);
Kim, Milo73368802012-01-26 22:58:51 -0800164 return val & CHPORT;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400165}
166
167static void lp8727_ctrl_switch(struct lp8727_chg *pchg, u8 sw)
168{
Kim, Milo27aefa32012-01-26 22:58:39 -0800169 lp8727_write_byte(pchg, SWCTRL, sw);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400170}
171
172static void lp8727_id_detection(struct lp8727_chg *pchg, u8 id, int vbusin)
173{
Kim, Milo318cb382012-08-31 09:23:12 +0000174 struct lp8727_platform_data *pdata = pchg->pdata;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400175 u8 devid = ID_NONE;
176 u8 swctrl = SW_DM1_HiZ | SW_DP2_HiZ;
177
178 switch (id) {
179 case 0x5:
180 devid = ID_TA;
Kim, Milo318cb382012-08-31 09:23:12 +0000181 pchg->chg_parm = pdata ? pdata->ac : NULL;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400182 break;
183 case 0xB:
184 if (lp8727_is_dedicated_charger(pchg)) {
Kim, Milo318cb382012-08-31 09:23:12 +0000185 pchg->chg_parm = pdata ? pdata->ac : NULL;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400186 devid = ID_DEDICATED_CHG;
187 } else if (lp8727_is_usb_charger(pchg)) {
Kim, Milo318cb382012-08-31 09:23:12 +0000188 pchg->chg_parm = pdata ? pdata->usb : NULL;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400189 devid = ID_USB_CHG;
190 swctrl = SW_DM1_DM | SW_DP2_DP;
191 } else if (vbusin) {
192 devid = ID_USB_DS;
193 swctrl = SW_DM1_DM | SW_DP2_DP;
194 }
195 break;
196 default:
197 devid = ID_NONE;
198 pchg->chg_parm = NULL;
199 break;
200 }
201
202 pchg->devid = devid;
203 lp8727_ctrl_switch(pchg, swctrl);
204}
205
206static void lp8727_enable_chgdet(struct lp8727_chg *pchg)
207{
208 u8 val;
209
Kim, Milo27aefa32012-01-26 22:58:39 -0800210 lp8727_read_byte(pchg, CTRL2, &val);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400211 val |= CHGDET_EN;
Kim, Milo27aefa32012-01-26 22:58:39 -0800212 lp8727_write_byte(pchg, CTRL2, val);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400213}
214
215static void lp8727_delayed_func(struct work_struct *_work)
216{
217 u8 intstat[2], idno, vbus;
218 struct lp8727_chg *pchg =
219 container_of(_work, struct lp8727_chg, work.work);
220
Kim, Milo27aefa32012-01-26 22:58:39 -0800221 if (lp8727_read_bytes(pchg, INT1, intstat, 2)) {
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400222 dev_err(pchg->dev, "can not read INT registers\n");
223 return;
224 }
225
226 idno = intstat[0] & IDNO;
227 vbus = intstat[0] & VBUS;
228
229 lp8727_id_detection(pchg, idno, vbus);
230 lp8727_enable_chgdet(pchg);
231
232 power_supply_changed(&pchg->psy->ac);
233 power_supply_changed(&pchg->psy->usb);
234 power_supply_changed(&pchg->psy->batt);
235}
236
237static irqreturn_t lp8727_isr_func(int irq, void *ptr)
238{
239 struct lp8727_chg *pchg = ptr;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400240
Kim, Milo2a092582012-08-31 09:23:41 +0000241 schedule_delayed_work(&pchg->work, pchg->debounce_jiffies);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400242 return IRQ_HANDLED;
243}
244
Kim, Milod71fda02012-08-31 09:23:57 +0000245static int lp8727_setup_irq(struct lp8727_chg *pchg)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400246{
Kim, Milod71fda02012-08-31 09:23:57 +0000247 int ret;
248 int irq = pchg->client->irq;
Kim, Milo60fd57e2012-08-31 09:23:25 +0000249 unsigned delay_msec = pchg->pdata ? pchg->pdata->debounce_msec :
250 DEFAULT_DEBOUNCE_MSEC;
251
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400252 INIT_DELAYED_WORK(&pchg->work, lp8727_delayed_func);
253
Kim, Milod71fda02012-08-31 09:23:57 +0000254 if (irq <= 0) {
255 dev_warn(pchg->dev, "invalid irq number: %d\n", irq);
256 return 0;
257 }
258
259 ret = request_threaded_irq(irq, NULL, lp8727_isr_func,
260 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
261 "lp8727_irq", pchg);
262
263 if (ret)
264 return ret;
265
266 pchg->irq = irq;
Kim, Milo60fd57e2012-08-31 09:23:25 +0000267 pchg->debounce_jiffies = msecs_to_jiffies(delay_msec);
268
Kim, Milod71fda02012-08-31 09:23:57 +0000269 return 0;
270}
271
272static void lp8727_release_irq(struct lp8727_chg *pchg)
273{
274 cancel_delayed_work_sync(&pchg->work);
275
276 if (pchg->irq)
277 free_irq(pchg->irq, pchg);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400278}
279
280static enum power_supply_property lp8727_charger_prop[] = {
281 POWER_SUPPLY_PROP_ONLINE,
282};
283
284static enum power_supply_property lp8727_battery_prop[] = {
285 POWER_SUPPLY_PROP_STATUS,
286 POWER_SUPPLY_PROP_HEALTH,
287 POWER_SUPPLY_PROP_PRESENT,
288 POWER_SUPPLY_PROP_VOLTAGE_NOW,
289 POWER_SUPPLY_PROP_CAPACITY,
290 POWER_SUPPLY_PROP_TEMP,
291};
292
293static char *battery_supplied_to[] = {
294 "main_batt",
295};
296
297static int lp8727_charger_get_property(struct power_supply *psy,
298 enum power_supply_property psp,
299 union power_supply_propval *val)
300{
301 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
302
Kim, Miloce09aff2012-01-04 09:03:18 +0400303 if (psp == POWER_SUPPLY_PROP_ONLINE)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400304 val->intval = lp8727_is_charger_attached(psy->name,
305 pchg->devid);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400306
307 return 0;
308}
309
310static int lp8727_battery_get_property(struct power_supply *psy,
311 enum power_supply_property psp,
312 union power_supply_propval *val)
313{
314 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
Kim, Milo318cb382012-08-31 09:23:12 +0000315 struct lp8727_platform_data *pdata = pchg->pdata;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400316 u8 read;
317
318 switch (psp) {
319 case POWER_SUPPLY_PROP_STATUS:
320 if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
Kim, Milo27aefa32012-01-26 22:58:39 -0800321 lp8727_read_byte(pchg, STATUS1, &read);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400322 if (((read & CHGSTAT) >> 4) == EOC)
323 val->intval = POWER_SUPPLY_STATUS_FULL;
324 else
325 val->intval = POWER_SUPPLY_STATUS_CHARGING;
326 } else {
327 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
328 }
329 break;
330 case POWER_SUPPLY_PROP_HEALTH:
Kim, Milo27aefa32012-01-26 22:58:39 -0800331 lp8727_read_byte(pchg, STATUS2, &read);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400332 read = (read & TEMP_STAT) >> 5;
333 if (read >= 0x1 && read <= 0x3)
334 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
335 else
336 val->intval = POWER_SUPPLY_HEALTH_GOOD;
337 break;
338 case POWER_SUPPLY_PROP_PRESENT:
Kim, Milo318cb382012-08-31 09:23:12 +0000339 if (!pdata)
340 return -EINVAL;
341
342 if (pdata->get_batt_present)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400343 val->intval = pchg->pdata->get_batt_present();
344 break;
345 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
Kim, Milo318cb382012-08-31 09:23:12 +0000346 if (!pdata)
347 return -EINVAL;
348
349 if (pdata->get_batt_level)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400350 val->intval = pchg->pdata->get_batt_level();
351 break;
352 case POWER_SUPPLY_PROP_CAPACITY:
Kim, Milo318cb382012-08-31 09:23:12 +0000353 if (!pdata)
354 return -EINVAL;
355
356 if (pdata->get_batt_capacity)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400357 val->intval = pchg->pdata->get_batt_capacity();
358 break;
359 case POWER_SUPPLY_PROP_TEMP:
Kim, Milo318cb382012-08-31 09:23:12 +0000360 if (!pdata)
361 return -EINVAL;
362
363 if (pdata->get_batt_temp)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400364 val->intval = pchg->pdata->get_batt_temp();
365 break;
366 default:
367 break;
368 }
369
370 return 0;
371}
372
373static void lp8727_charger_changed(struct power_supply *psy)
374{
375 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
376 u8 val;
377 u8 eoc_level, ichg;
378
379 if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
380 if (pchg->chg_parm) {
381 eoc_level = pchg->chg_parm->eoc_level;
382 ichg = pchg->chg_parm->ichg;
383 val = (ichg << 4) | eoc_level;
Kim, Milo27aefa32012-01-26 22:58:39 -0800384 lp8727_write_byte(pchg, CHGCTRL2, val);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400385 }
386 }
387}
388
389static int lp8727_register_psy(struct lp8727_chg *pchg)
390{
391 struct lp8727_psy *psy;
392
Kim, Milo74727c52012-08-31 09:22:46 +0000393 psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400394 if (!psy)
Devendra Naga6297b5e2012-07-29 23:31:55 +0545395 return -ENOMEM;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400396
397 pchg->psy = psy;
398
399 psy->ac.name = "ac";
400 psy->ac.type = POWER_SUPPLY_TYPE_MAINS;
401 psy->ac.properties = lp8727_charger_prop;
402 psy->ac.num_properties = ARRAY_SIZE(lp8727_charger_prop);
403 psy->ac.get_property = lp8727_charger_get_property;
404 psy->ac.supplied_to = battery_supplied_to;
405 psy->ac.num_supplicants = ARRAY_SIZE(battery_supplied_to);
406
407 if (power_supply_register(pchg->dev, &psy->ac))
Devendra Naga6297b5e2012-07-29 23:31:55 +0545408 goto err_psy_ac;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400409
410 psy->usb.name = "usb";
411 psy->usb.type = POWER_SUPPLY_TYPE_USB;
412 psy->usb.properties = lp8727_charger_prop;
413 psy->usb.num_properties = ARRAY_SIZE(lp8727_charger_prop);
414 psy->usb.get_property = lp8727_charger_get_property;
415 psy->usb.supplied_to = battery_supplied_to;
416 psy->usb.num_supplicants = ARRAY_SIZE(battery_supplied_to);
417
418 if (power_supply_register(pchg->dev, &psy->usb))
Devendra Naga6297b5e2012-07-29 23:31:55 +0545419 goto err_psy_usb;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400420
421 psy->batt.name = "main_batt";
422 psy->batt.type = POWER_SUPPLY_TYPE_BATTERY;
423 psy->batt.properties = lp8727_battery_prop;
424 psy->batt.num_properties = ARRAY_SIZE(lp8727_battery_prop);
425 psy->batt.get_property = lp8727_battery_get_property;
426 psy->batt.external_power_changed = lp8727_charger_changed;
427
428 if (power_supply_register(pchg->dev, &psy->batt))
Devendra Naga6297b5e2012-07-29 23:31:55 +0545429 goto err_psy_batt;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400430
431 return 0;
432
Devendra Naga6297b5e2012-07-29 23:31:55 +0545433err_psy_batt:
434 power_supply_unregister(&psy->usb);
435err_psy_usb:
436 power_supply_unregister(&psy->ac);
437err_psy_ac:
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400438 return -EPERM;
439}
440
441static void lp8727_unregister_psy(struct lp8727_chg *pchg)
442{
443 struct lp8727_psy *psy = pchg->psy;
444
Kim, Miloce09aff2012-01-04 09:03:18 +0400445 if (!psy)
446 return;
447
448 power_supply_unregister(&psy->ac);
449 power_supply_unregister(&psy->usb);
450 power_supply_unregister(&psy->batt);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400451}
452
453static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
454{
455 struct lp8727_chg *pchg;
456 int ret;
457
Kim, Milo998a8e72011-11-17 21:43:06 -0800458 if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
459 return -EIO;
460
Kim, Milo74727c52012-08-31 09:22:46 +0000461 pchg = devm_kzalloc(&cl->dev, sizeof(*pchg), GFP_KERNEL);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400462 if (!pchg)
463 return -ENOMEM;
464
465 pchg->client = cl;
466 pchg->dev = &cl->dev;
467 pchg->pdata = cl->dev.platform_data;
468 i2c_set_clientdata(cl, pchg);
469
470 mutex_init(&pchg->xfer_lock);
471
Kim, Milo7da63342012-01-26 22:58:30 -0800472 ret = lp8727_init_device(pchg);
473 if (ret) {
474 dev_err(pchg->dev, "i2c communication err: %d", ret);
Kim, Milofb9adc52012-08-31 09:23:03 +0000475 return ret;
Kim, Milo7da63342012-01-26 22:58:30 -0800476 }
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400477
478 ret = lp8727_register_psy(pchg);
Kim, Milo7da63342012-01-26 22:58:30 -0800479 if (ret) {
480 dev_err(pchg->dev, "power supplies register err: %d", ret);
Kim, Milofb9adc52012-08-31 09:23:03 +0000481 return ret;
482 }
483
Kim, Milod71fda02012-08-31 09:23:57 +0000484 ret = lp8727_setup_irq(pchg);
Kim, Milofb9adc52012-08-31 09:23:03 +0000485 if (ret) {
486 dev_err(pchg->dev, "irq handler err: %d", ret);
487 lp8727_unregister_psy(pchg);
488 return ret;
Kim, Milo7da63342012-01-26 22:58:30 -0800489 }
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400490
491 return 0;
492}
493
494static int __devexit lp8727_remove(struct i2c_client *cl)
495{
496 struct lp8727_chg *pchg = i2c_get_clientdata(cl);
497
Kim, Milod71fda02012-08-31 09:23:57 +0000498 lp8727_release_irq(pchg);
Kim, Milofb9adc52012-08-31 09:23:03 +0000499 lp8727_unregister_psy(pchg);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400500 return 0;
501}
502
503static const struct i2c_device_id lp8727_ids[] = {
504 {"lp8727", 0},
Axel Lin455a0e22012-01-16 13:48:20 +0800505 { }
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400506};
Axel Line2c5f7d2012-01-12 20:45:02 +0800507MODULE_DEVICE_TABLE(i2c, lp8727_ids);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400508
509static struct i2c_driver lp8727_driver = {
510 .driver = {
511 .name = "lp8727",
512 },
513 .probe = lp8727_probe,
514 .remove = __devexit_p(lp8727_remove),
515 .id_table = lp8727_ids,
516};
Axel Lin5ff92e72012-01-21 14:42:54 +0800517module_i2c_driver(lp8727_driver);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400518
Kim, Miloe39b8282012-01-29 17:28:18 -0800519MODULE_DESCRIPTION("TI/National Semiconductor LP8727 charger driver");
Kim, Milo73368802012-01-26 22:58:51 -0800520MODULE_AUTHOR("Woogyom Kim <milo.kim@ti.com>, "
521 "Daniel Jeong <daniel.jeong@ti.com>");
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400522MODULE_LICENSE("GPL");