blob: 1907b1f7953df3db8336a956453053928e5aeabc [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;
88 struct workqueue_struct *irqthread;
89 struct lp8727_platform_data *pdata;
90 struct lp8727_psy *psy;
91 struct lp8727_chg_param *chg_parm;
92 enum lp8727_dev_id devid;
Kim, Milo60fd57e2012-08-31 09:23:25 +000093 unsigned long debounce_jiffies;
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, Milo60fd57e2012-08-31 09:23:25 +0000241 queue_delayed_work(pchg->irqthread, &pchg->work,
242 pchg->debounce_jiffies);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400243
244 return IRQ_HANDLED;
245}
246
Kim, Milo7da63342012-01-26 22:58:30 -0800247static int lp8727_intr_config(struct lp8727_chg *pchg)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400248{
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
254 pchg->irqthread = create_singlethread_workqueue("lp8727-irqthd");
Kim, Milo7da63342012-01-26 22:58:30 -0800255 if (!pchg->irqthread) {
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400256 dev_err(pchg->dev, "can not create thread for lp8727\n");
Kim, Milo7da63342012-01-26 22:58:30 -0800257 return -ENOMEM;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400258 }
Kim, Milo7da63342012-01-26 22:58:30 -0800259
Kim, Milo60fd57e2012-08-31 09:23:25 +0000260 pchg->debounce_jiffies = msecs_to_jiffies(delay_msec);
261
Kim, Milo7da63342012-01-26 22:58:30 -0800262 return request_threaded_irq(pchg->client->irq,
263 NULL,
264 lp8727_isr_func,
Fengguang Wu7c577c02012-08-23 19:42:29 +0800265 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Kim, Milo7da63342012-01-26 22:58:30 -0800266 "lp8727_irq",
267 pchg);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400268}
269
270static enum power_supply_property lp8727_charger_prop[] = {
271 POWER_SUPPLY_PROP_ONLINE,
272};
273
274static enum power_supply_property lp8727_battery_prop[] = {
275 POWER_SUPPLY_PROP_STATUS,
276 POWER_SUPPLY_PROP_HEALTH,
277 POWER_SUPPLY_PROP_PRESENT,
278 POWER_SUPPLY_PROP_VOLTAGE_NOW,
279 POWER_SUPPLY_PROP_CAPACITY,
280 POWER_SUPPLY_PROP_TEMP,
281};
282
283static char *battery_supplied_to[] = {
284 "main_batt",
285};
286
287static int lp8727_charger_get_property(struct power_supply *psy,
288 enum power_supply_property psp,
289 union power_supply_propval *val)
290{
291 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
292
Kim, Miloce09aff2012-01-04 09:03:18 +0400293 if (psp == POWER_SUPPLY_PROP_ONLINE)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400294 val->intval = lp8727_is_charger_attached(psy->name,
295 pchg->devid);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400296
297 return 0;
298}
299
300static int lp8727_battery_get_property(struct power_supply *psy,
301 enum power_supply_property psp,
302 union power_supply_propval *val)
303{
304 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
Kim, Milo318cb382012-08-31 09:23:12 +0000305 struct lp8727_platform_data *pdata = pchg->pdata;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400306 u8 read;
307
308 switch (psp) {
309 case POWER_SUPPLY_PROP_STATUS:
310 if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
Kim, Milo27aefa32012-01-26 22:58:39 -0800311 lp8727_read_byte(pchg, STATUS1, &read);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400312 if (((read & CHGSTAT) >> 4) == EOC)
313 val->intval = POWER_SUPPLY_STATUS_FULL;
314 else
315 val->intval = POWER_SUPPLY_STATUS_CHARGING;
316 } else {
317 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
318 }
319 break;
320 case POWER_SUPPLY_PROP_HEALTH:
Kim, Milo27aefa32012-01-26 22:58:39 -0800321 lp8727_read_byte(pchg, STATUS2, &read);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400322 read = (read & TEMP_STAT) >> 5;
323 if (read >= 0x1 && read <= 0x3)
324 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
325 else
326 val->intval = POWER_SUPPLY_HEALTH_GOOD;
327 break;
328 case POWER_SUPPLY_PROP_PRESENT:
Kim, Milo318cb382012-08-31 09:23:12 +0000329 if (!pdata)
330 return -EINVAL;
331
332 if (pdata->get_batt_present)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400333 val->intval = pchg->pdata->get_batt_present();
334 break;
335 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
Kim, Milo318cb382012-08-31 09:23:12 +0000336 if (!pdata)
337 return -EINVAL;
338
339 if (pdata->get_batt_level)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400340 val->intval = pchg->pdata->get_batt_level();
341 break;
342 case POWER_SUPPLY_PROP_CAPACITY:
Kim, Milo318cb382012-08-31 09:23:12 +0000343 if (!pdata)
344 return -EINVAL;
345
346 if (pdata->get_batt_capacity)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400347 val->intval = pchg->pdata->get_batt_capacity();
348 break;
349 case POWER_SUPPLY_PROP_TEMP:
Kim, Milo318cb382012-08-31 09:23:12 +0000350 if (!pdata)
351 return -EINVAL;
352
353 if (pdata->get_batt_temp)
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400354 val->intval = pchg->pdata->get_batt_temp();
355 break;
356 default:
357 break;
358 }
359
360 return 0;
361}
362
363static void lp8727_charger_changed(struct power_supply *psy)
364{
365 struct lp8727_chg *pchg = dev_get_drvdata(psy->dev->parent);
366 u8 val;
367 u8 eoc_level, ichg;
368
369 if (lp8727_is_charger_attached(psy->name, pchg->devid)) {
370 if (pchg->chg_parm) {
371 eoc_level = pchg->chg_parm->eoc_level;
372 ichg = pchg->chg_parm->ichg;
373 val = (ichg << 4) | eoc_level;
Kim, Milo27aefa32012-01-26 22:58:39 -0800374 lp8727_write_byte(pchg, CHGCTRL2, val);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400375 }
376 }
377}
378
379static int lp8727_register_psy(struct lp8727_chg *pchg)
380{
381 struct lp8727_psy *psy;
382
Kim, Milo74727c52012-08-31 09:22:46 +0000383 psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400384 if (!psy)
Devendra Naga6297b5e2012-07-29 23:31:55 +0545385 return -ENOMEM;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400386
387 pchg->psy = psy;
388
389 psy->ac.name = "ac";
390 psy->ac.type = POWER_SUPPLY_TYPE_MAINS;
391 psy->ac.properties = lp8727_charger_prop;
392 psy->ac.num_properties = ARRAY_SIZE(lp8727_charger_prop);
393 psy->ac.get_property = lp8727_charger_get_property;
394 psy->ac.supplied_to = battery_supplied_to;
395 psy->ac.num_supplicants = ARRAY_SIZE(battery_supplied_to);
396
397 if (power_supply_register(pchg->dev, &psy->ac))
Devendra Naga6297b5e2012-07-29 23:31:55 +0545398 goto err_psy_ac;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400399
400 psy->usb.name = "usb";
401 psy->usb.type = POWER_SUPPLY_TYPE_USB;
402 psy->usb.properties = lp8727_charger_prop;
403 psy->usb.num_properties = ARRAY_SIZE(lp8727_charger_prop);
404 psy->usb.get_property = lp8727_charger_get_property;
405 psy->usb.supplied_to = battery_supplied_to;
406 psy->usb.num_supplicants = ARRAY_SIZE(battery_supplied_to);
407
408 if (power_supply_register(pchg->dev, &psy->usb))
Devendra Naga6297b5e2012-07-29 23:31:55 +0545409 goto err_psy_usb;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400410
411 psy->batt.name = "main_batt";
412 psy->batt.type = POWER_SUPPLY_TYPE_BATTERY;
413 psy->batt.properties = lp8727_battery_prop;
414 psy->batt.num_properties = ARRAY_SIZE(lp8727_battery_prop);
415 psy->batt.get_property = lp8727_battery_get_property;
416 psy->batt.external_power_changed = lp8727_charger_changed;
417
418 if (power_supply_register(pchg->dev, &psy->batt))
Devendra Naga6297b5e2012-07-29 23:31:55 +0545419 goto err_psy_batt;
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400420
421 return 0;
422
Devendra Naga6297b5e2012-07-29 23:31:55 +0545423err_psy_batt:
424 power_supply_unregister(&psy->usb);
425err_psy_usb:
426 power_supply_unregister(&psy->ac);
427err_psy_ac:
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400428 return -EPERM;
429}
430
431static void lp8727_unregister_psy(struct lp8727_chg *pchg)
432{
433 struct lp8727_psy *psy = pchg->psy;
434
Kim, Miloce09aff2012-01-04 09:03:18 +0400435 if (!psy)
436 return;
437
438 power_supply_unregister(&psy->ac);
439 power_supply_unregister(&psy->usb);
440 power_supply_unregister(&psy->batt);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400441}
442
443static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
444{
445 struct lp8727_chg *pchg;
446 int ret;
447
Kim, Milo998a8e72011-11-17 21:43:06 -0800448 if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
449 return -EIO;
450
Kim, Milo74727c52012-08-31 09:22:46 +0000451 pchg = devm_kzalloc(&cl->dev, sizeof(*pchg), GFP_KERNEL);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400452 if (!pchg)
453 return -ENOMEM;
454
455 pchg->client = cl;
456 pchg->dev = &cl->dev;
457 pchg->pdata = cl->dev.platform_data;
458 i2c_set_clientdata(cl, pchg);
459
460 mutex_init(&pchg->xfer_lock);
461
Kim, Milo7da63342012-01-26 22:58:30 -0800462 ret = lp8727_init_device(pchg);
463 if (ret) {
464 dev_err(pchg->dev, "i2c communication err: %d", ret);
Kim, Milofb9adc52012-08-31 09:23:03 +0000465 return ret;
Kim, Milo7da63342012-01-26 22:58:30 -0800466 }
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400467
468 ret = lp8727_register_psy(pchg);
Kim, Milo7da63342012-01-26 22:58:30 -0800469 if (ret) {
470 dev_err(pchg->dev, "power supplies register err: %d", ret);
Kim, Milofb9adc52012-08-31 09:23:03 +0000471 return ret;
472 }
473
474 ret = lp8727_intr_config(pchg);
475 if (ret) {
476 dev_err(pchg->dev, "irq handler err: %d", ret);
477 lp8727_unregister_psy(pchg);
478 return ret;
Kim, Milo7da63342012-01-26 22:58:30 -0800479 }
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400480
481 return 0;
482}
483
484static int __devexit lp8727_remove(struct i2c_client *cl)
485{
486 struct lp8727_chg *pchg = i2c_get_clientdata(cl);
487
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400488 free_irq(pchg->client->irq, pchg);
489 flush_workqueue(pchg->irqthread);
490 destroy_workqueue(pchg->irqthread);
Kim, Milofb9adc52012-08-31 09:23:03 +0000491 lp8727_unregister_psy(pchg);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400492 return 0;
493}
494
495static const struct i2c_device_id lp8727_ids[] = {
496 {"lp8727", 0},
Axel Lin455a0e22012-01-16 13:48:20 +0800497 { }
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400498};
Axel Line2c5f7d2012-01-12 20:45:02 +0800499MODULE_DEVICE_TABLE(i2c, lp8727_ids);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400500
501static struct i2c_driver lp8727_driver = {
502 .driver = {
503 .name = "lp8727",
504 },
505 .probe = lp8727_probe,
506 .remove = __devexit_p(lp8727_remove),
507 .id_table = lp8727_ids,
508};
Axel Lin5ff92e72012-01-21 14:42:54 +0800509module_i2c_driver(lp8727_driver);
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400510
Kim, Miloe39b8282012-01-29 17:28:18 -0800511MODULE_DESCRIPTION("TI/National Semiconductor LP8727 charger driver");
Kim, Milo73368802012-01-26 22:58:51 -0800512MODULE_AUTHOR("Woogyom Kim <milo.kim@ti.com>, "
513 "Daniel Jeong <daniel.jeong@ti.com>");
Woogyom Kim2165c8a2012-01-04 08:27:43 +0400514MODULE_LICENSE("GPL");