2 * fan5405.c -- FAN5405 Switching Charger driver
4 * Copyright (C) 2012 Fairchild semiconductor Co.Ltd
5 * Author: Bright Yang <bright.yang@fairchildsemi.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
14 #include <linux/device.h>
15 #include <linux/kernel.h>
16 #include <linux/i2c.h>
17 #include <linux/interrupt.h>
18 #include <linux/slab.h>
19 #include <linux/delay.h>
20 #include <linux/gpio.h>
21 #include <linux/timer.h>
22 #include <linux/param.h>
23 #include <linux/stat.h>
27 #define FAN5405_DEBUG_FS
30 /******************************************************************************
32 ******************************************************************************/
33 #define FAN5405_REG_CONTROL0 0
34 #define FAN5405_REG_CONTROL1 1
35 #define FAN5405_REG_OREG 2
36 #define FAN5405_REG_IC_INFO 3
37 #define FAN5405_REG_IBAT 4
38 #define FAN5405_REG_SP_CHARGER 5
39 #define FAN5405_REG_SAFETY 6
40 #define FAN5405_REG_MONITOR 16
42 /******************************************************************************
44 ******************************************************************************/
45 /* FAN5405_REG_CONTROL0 (0x00) */
46 #define FAN5405_FAULT (0x07)
47 #define FAN5405_FAULT_SHIFT 0
48 #define FAN5405_BOOST (0x01 << 3)
49 #define FAN5405_BOOST_SHIFT 3
50 #define FAN5405_STAT (0x3 << 4)
51 #define FAN5405_STAT_SHIFT 4
52 #define FAN5405_EN_STAT (0x01 << 6)
53 #define FAN5405_EN_STAT_SHIFT 6
54 #define FAN5405_TMR_RST_OTG (0x01 << 7) // writing a 1 resets the t32s timer, writing a 0 has no effect
55 #define FAN5405_TMR_RST_OTG_SHIFT 7
57 /* FAN5405_REG_CONTROL1 (0x01) */
58 #define FAN5405_OPA_MODE (0x01)
59 #define FAN5405_OPA_MODE_SHIFT 0
60 #define FAN5405_HZ_MODE (0x01 << 1)
61 #define FAN5405_HZ_MODE_SHIFT 1
62 #define FAN5405_CE_N (0x01 << 2)
63 #define FAN5405_CE_N_SHIFT 2
64 #define FAN5405_TE (0x01 << 3)
65 #define FAN5405_TE_SHIFT 3
66 #define FAN5405_VLOWV (0x03 << 4)
67 #define FAN5405_VLOWV_SHIFT 4
68 #define FAN5405_IINLIM (0x03 << 6)
69 #define FAN5405_IINLIM_SHIFT 6
71 /* FAN5405_REG_OREG (0x02) */
72 #define FAN5405_OTG_EN (0x01)
73 #define FAN5405_OTG_EN_SHIFT 0
74 #define FAN5405_OTG_PL (0x01 << 1)
75 #define FAN5405_OTG_PL_SHIFT 1
76 #define FAN5405_OREG (0x3f << 2)
77 #define FAN5405_OREG_SHIFT 2
79 /* FAN5405_REG_IC_INFO (0x03) */
80 #define FAN5405_REV (0x03)
81 #define FAN5405_REV_SHIFT 0
82 #define FAN5405_PN (0x07 << 2)
83 #define FAN5405_PN_SHIFT 2
84 #define FAN5405_VENDOR_CODE (0x07 << 5)
85 #define FAN5405_VENDOR_CODE_SHIFT 5
87 /* FAN5405_REG_IBAT (0x04) */
88 #define FAN5405_ITERM (0x07)
89 #define FAN5405_ITERM_SHIFT 0
90 #define FAN5405_IOCHARGE (0x07 << 4)
91 #define FAN5405_IOCHARGE_SHIFT 4
92 #define FAN5405_RESET (0x01 << 7)
93 #define FAN5405_RESET_SHIFT 7
95 /* FAN5405_REG_SP_CHARGER (0x05) */
96 #define FAN5405_VSP (0x07)
97 #define FAN5405_VSP_SHIFT 0
98 #define FAN5405_EN_LEVEL (0x01 << 3)
99 #define FAN5405_EN_LEVEL_SHIFT 3
100 #define FAN5405_SP (0x01 << 4)
101 #define FAN5405_SP_SHIFT 4
102 #define FAN5405_IO_LEVEL (0x01 << 5)
103 #define FAN5405_IO_LEVEL_SHIFT 5
104 #define FAN5405_DIS_VREG (0x01 << 6)
105 #define FAN5405_DIS_VREG_SHIFT 6
107 /* FAN5405_REG_SAFETY (0x06) */
108 #define FAN5405_VSAFE (0x0f)
109 #define FAN5405_VSAFE_SHIFT 0
110 #define FAN5405_ISAFE (0x07 << 4)
111 #define FAN5405_ISAFE_SHIFT 4
113 /* FAN5405_REG_MONITOR (0x10) */
114 #define FAN5405_CV (0x01)
115 #define FAN5405_CV_SHIFT 0
116 #define FAN5405_VBUS_VALID (0x01 << 1)
117 #define FAN5405_VBUS_VALID_SHIFT 1
118 #define FAN5405_IBUS (0x01 << 2)
119 #define FAN5405_IBUS_SHIFT 2
120 #define FAN5405_ICHG (0x01 << 3)
121 #define FAN5405_ICHG_SHIFT 3
122 #define FAN5405_T_120 (0x01 << 4)
123 #define FAN5405_T_120_SHIFT 4
124 #define FAN5405_LINCHG (0x01 << 5)
125 #define FAN5405_LINCHG_SHIFT 5
126 #define FAN5405_VBAT_CMP (0x01 << 6)
127 #define FAN5405_VBAT_CMP_SHIFT 6
128 #define FAN5405_ITERM_CMP (0x01 << 7)
129 #define FAN5405_ITERM_CMP_SHIFT 7
131 /******************************************************************************
133 ******************************************************************************/
134 /********** FAN5405_REG_CONTROL0 (0x00) **********/
141 /********** FAN5405_REG_CONTROL1 (0x01) **********/
165 /********** FAN5405_REG_OREG (0x02) **********/
170 #define OTGACTIVELOW 0
171 #define OTGACTIVEHIGH 1
173 #define VOREG4P2 35 // refer to table 3
175 /********** FAN5405_REG_IC_INFO (0x03) **********/
177 /********** FAN5405_REG_IBAT (0x04) **********/
178 // ITERM [2:0] - 68mOhm
187 // IOCHARGE [6:4] - 68mOhm
188 #define IOCHARGE550 0
189 #define IOCHARGE650 1
190 #define IOCHARGE750 2
191 #define IOCHARGE850 3
192 #define IOCHARGE1050 4
193 #define IOCHARGE1150 5
194 #define IOCHARGE1350 6
195 #define IOCHARGE1450 7
197 /********** FAN5405_REG_SP_CHARGER (0x05) **********/
214 /********** FAN5405_REG_SAFETY (0x06) **********/
229 // ISAFE [6:4] - 68mOhm
239 /* reset the T32s timer every 10 seconds */
240 #define T32S_RESET_INTERVAL 10
242 static struct timer_list t32s_timer;
243 static struct delayed_work fan_t32s_timer_work;
246 static const BYTE fan5405_def_reg[17] = {
247 0x40, // #0x00(CONTROL0)
248 0x30, // #0x01(CONTROL1)
250 0x84, // #0x03(IC_INFO)
251 0x09, // #0x04(IBAT) default is 0x89 but writing 1 to IBAT[7] resets charge parameters, except the safety reg, so
252 0x24, // #0x05(SP_CHARGER)
253 0x40, // #0x06(SAFETY)
254 0x00, // #0x07 - unused
255 0x00, // #0x08 - unused
256 0x00, // #0x09 - unused
257 0x00, // #0x0a - unused
258 0x00, // #0x0b - unused
259 0x00, // #0x0c - unused
260 0x00, // #0x0d - unused
261 0x00, // #0x0e - unused
262 0x00, // #0x0f - unused
263 0x00, // #0x10(MONITOR)
266 static BYTE fan5405_curr_reg[17];
268 static struct i2c_client *this_client;
269 static struct fan5405_platform_data *pdata;
272 static int reset_flag = 0; // use when assert reset
273 static int write_error_count = 0;
275 static int fan5405_WriteReg(int reg, int val)
278 printk("####pengwei writereg reg = %d val = %d\n",reg,val);
279 ret = i2c_smbus_write_byte_data(this_client, reg, val);
283 write_error_count ++;
284 pr_debug("%s: error = %d", __func__, ret);
287 if((reset_flag == 1) ||
288 ((reg == FAN5405_REG_IBAT) && (val & FAN5405_RESET)))
290 memcpy(fan5405_curr_reg,fan5405_def_reg,6); // resets charge paremeters, except the safety register(#6)
295 fan5405_curr_reg[reg] = val;
301 //pengwei added for i2c read error
302 static int read_err_flag = 0;
303 static int read_err_count = 0;
304 static int fan5405_ReadReg(int reg)
308 printk("######fan5405_readreg reg = %d value =%d\n",reg,ret);
310 ret = i2c_smbus_read_byte_data(this_client, reg);
316 pr_debug("%s: error = %d", __func__, ret);
323 static void fan5405_SetValue(BYTE reg, BYTE reg_bit,BYTE reg_shift, BYTE val)
327 tmp = fan5405_curr_reg[reg] & (~reg_bit);
328 printk("test value of i2c fan5405_curr_reg[%d] = 0x%x , temp = %d\n",reg,fan5405_curr_reg[reg],tmp);
329 tmp |= (val << reg_shift);
330 printk("continue test tmp =0x%x\n",tmp);
331 if(reg_bit == FAN5405_RESET)
336 fan5405_WriteReg(reg,tmp);
339 static BYTE fan5405_GetValue(BYTE reg, BYTE reg_bit, BYTE reg_shift)
343 tmp = (BYTE)fan5405_ReadReg(reg);
344 ret = (tmp & reg_bit) >> reg_shift;
352 /******************************************************************************
357 * Description: if VBUS present(charging & boost),write 1 every 10 seconds
359 ******************************************************************************/
360 static void fan5405_Reset32sTimer(unsigned long data)
362 printk("fan 5405 reset timer\n");
363 printk("#####################################read error times is %d\n,writ error times is %d\n",read_err_count,write_error_count);
364 fan5405_SetValue(FAN5405_REG_CONTROL0, FAN5405_TMR_RST_OTG,FAN5405_TMR_RST_OTG_SHIFT, RESET32S);
365 schedule_delayed_work(&fan_t32s_timer_work, HZ*10);
370 /******************************************************************************
375 * Description: if VBUS present(charging & boost),write 1 every 10 seconds
377 ******************************************************************************/
379 void fan5405_Reset32sTimer_ap(void)
381 printk("fan 5405 reset rimer for ap\n");
382 printk("#####################################read error times is %d\n,writ error times is %d\n",read_err_count,write_error_count);
383 fan5405_SetValue(FAN5405_REG_CONTROL0, FAN5405_TMR_RST_OTG,FAN5405_TMR_RST_OTG_SHIFT, RESET32S);
384 schedule_delayed_work(&fan_t32s_timer_work, HZ*10);
388 /******************************************************************************
389 * Function: FAN5405_Initialization
395 ******************************************************************************/
396 static void fan5405_Initialization(void)
398 memcpy(fan5405_curr_reg,fan5405_def_reg,sizeof(fan5405_curr_reg));
399 printk("pengwei test fan5405init\n");
400 /* Initialize timer */
401 /* start the timer */
403 init_timer(&t32s_timer);
404 t32s_timer.function = fan5405_Reset32sTimer;
406 mod_timer(&t32s_timer, jiffies + (T32S_RESET_INTERVAL * HZ));
409 fan5405_SetValue(FAN5405_REG_SAFETY, FAN5405_VSAFE,FAN5405_VSAFE_SHIFT, VSAFE4P20); // VSAFE = 4.20V
410 fan5405_SetValue(FAN5405_REG_SAFETY, FAN5405_ISAFE, FAN5405_ISAFE_SHIFT, ISAFE1450); // ISAFE = 1050mA (68mOhm)
412 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_VLOWV, FAN5405_VLOWV_SHIFT,VLOWV3P4); // VLOWV = 3.4V
413 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_IINLIM, FAN5405_IINLIM_SHIFT,IINLIM500); // INLIM = 500mA
415 fan5405_SetValue(FAN5405_REG_OREG, FAN5405_OREG,FAN5405_OREG_SHIFT, VOREG4P2); //OREG = 4.20V
417 fan5405_SetValue(FAN5405_REG_SP_CHARGER, FAN5405_IO_LEVEL,FAN5405_IO_LEVEL_SHIFT, ENIOLEVEL); //IO_LEVEL is 0. Output current is controlled by IOCHARGE bits.
419 fan5405_SetValue(FAN5405_REG_SP_CHARGER, FAN5405_VSP,FAN5405_VSP_SHIFT, VSP4P213);
423 void fan5405_init(void)
426 fan5405_SetValue(FAN5405_REG_SAFETY, FAN5405_VSAFE,FAN5405_VSAFE_SHIFT, VSAFE4P20); // VSAFE = 4.20V
427 fan5405_SetValue(FAN5405_REG_SAFETY, FAN5405_ISAFE, FAN5405_ISAFE_SHIFT, ISAFE1450); // ISAFE = 1050mA (68mOhm)
429 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_VLOWV, FAN5405_VLOWV_SHIFT,VLOWV3P4); // VLOWV = 3.4V
430 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_IINLIM, FAN5405_IINLIM_SHIFT,IINLIM500); // INLIM = 500mA
432 fan5405_SetValue(FAN5405_REG_OREG, FAN5405_OREG,FAN5405_OREG_SHIFT, VOREG4P2); //OREG = 4.20V
434 fan5405_SetValue(FAN5405_REG_SP_CHARGER, FAN5405_IO_LEVEL,FAN5405_IO_LEVEL_SHIFT, ENIOLEVEL); //IO_LEVEL is 0. Output current is controlled by IOCHARGE bits.
437 fan5405_SetValue(FAN5405_REG_SP_CHARGER, FAN5405_VSP,FAN5405_VSP_SHIFT, VSP4P213);
441 /******************************************************************************
442 * Function: fan5405_OTG_Enable
448 ******************************************************************************/
449 void fan5405_OTG_Enable(int enable)
451 printk("#######pengwei OTG enable\n");
452 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_OPA_MODE,FAN5405_OPA_MODE_SHIFT, enable);
455 fan5405_SetValue(FAN5405_REG_OREG, FAN5405_OTG_EN,FAN5405_OTG_EN_SHIFT, enable);
462 EXPORT_SYMBOL_GPL(fan5405_OTG_Enable);
466 /******************************************************************************
467 * Function: FAN5405_TA_StartCharging
473 ******************************************************************************/
474 void fan5405_TA_StartCharging(void)
476 printk("pengwei enter TA charging fan5405\n");
478 fan5405_SetValue(FAN5405_REG_IBAT, FAN5405_IOCHARGE,FAN5405_IOCHARGE_SHIFT, IOCHARGE1450); //1050mA
479 fan5405_SetValue(FAN5405_REG_IBAT, FAN5405_ITERM,FAN5405_ITERM_SHIFT, ITERM146); //146ma
480 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_IINLIM, FAN5405_IINLIM_SHIFT,NOLIMIT); // no limit
481 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_TE,FAN5405_TE_SHIFT, ENTE);
482 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_CE_N,FAN5405_CE_N_SHIFT, ENCHARGER);
484 EXPORT_SYMBOL_GPL(fan5405_TA_StartCharging);
486 /******************************************************************************
487 * Function: FAN5405_USB_StartCharging
493 ******************************************************************************/
494 void fan5405_USB_StartCharging(void)
496 printk("pengwei enter USB charging fan5405\n");
497 fan5405_SetValue(FAN5405_REG_IBAT, FAN5405_IOCHARGE,FAN5405_IOCHARGE_SHIFT, IOCHARGE550); //550mA
498 fan5405_SetValue(FAN5405_REG_IBAT, FAN5405_ITERM, FAN5405_ITERM_SHIFT,ITERM146); //146ma
499 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_IINLIM,FAN5405_IINLIM_SHIFT, IINLIM500); // limit 500mA (default)
500 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_TE,FAN5405_TE_SHIFT, ENTE);
501 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_CE_N,FAN5405_CE_N_SHIFT, ENCHARGER);
503 EXPORT_SYMBOL_GPL(fan5405_USB_StartCharging);
505 /******************************************************************************
512 ******************************************************************************/
513 void fan5405_StopCharging(void)
515 printk("pengwei STOP charging fan5405\n");
517 fan5405_SetValue(FAN5405_REG_CONTROL1, FAN5405_CE_N,FAN5405_CE_N_SHIFT, DISCHARGER);
519 EXPORT_SYMBOL_GPL(fan5405_StopCharging);
521 /******************************************************************************
522 * Function: FAN5405_Monitor
526 * Description: enable the host procdessor to monitor the status of the IC.
528 ******************************************************************************/
529 fan5405_monitor_status fan5405_Monitor(void)
531 fan5405_monitor_status status;
533 status = (fan5405_monitor_status)fan5405_ReadReg(FAN5405_REG_MONITOR);
536 case FAN5405_MONITOR_NONE:
538 case FAN5405_MONITOR_CV:
539 // if need something to do, add
541 case FAN5405_MONITOR_VBUS_VALID:
542 // if need something to do, add
544 case FAN5405_MONITOR_IBUS:
545 // if need something to do, add
547 case FAN5405_MONITOR_ICHG:
548 // if need something to do, add
550 case FAN5405_MONITOR_T_120:
551 // if need something to do, add
553 case FAN5405_MONITOR_LINCHG:
554 // if need something to do, add
556 case FAN5405_MONITOR_VBAT_CMP:
557 // if need something to do, add
559 case FAN5405_MONITOR_ITERM_CMP:
560 // if need something to do, add
569 EXPORT_SYMBOL_GPL(fan5405_Monitor);
571 static int stat_last = 0;
572 int fan5405_GetCharge_Stat(void)
576 for(num=6;num>=0;num--)
578 printk("###### pengwei test getcharge stat fan5405_ReadReg(%d) = 0x%x\n",num,fan5405_ReadReg(num));
580 printk("###### pengwei test getcharge stat value 0x10 = 0x%x\n",fan5405_ReadReg(0x10));
581 stat = fan5405_GetValue(FAN5405_REG_CONTROL0, FAN5405_STAT, FAN5405_STAT_SHIFT);
582 //pengwei added for i2c read err
583 if (read_err_flag == 1)
594 EXPORT_SYMBOL_GPL(fan5405_GetCharge_Stat);
596 #ifdef FAN5405_DEBUG_FS
598 static ssize_t set_regs_store(struct device *dev,
599 struct device_attribute *attr,
600 const char *buf, size_t count)
602 unsigned long set_value;
606 set_value = simple_strtoul(buf, NULL, 16);
608 reg = (set_value & 0xff00) >> 8;
609 val = set_value & 0xff;
610 printk("fan54015 set reg = %d value = %d\n",reg, val);
611 ret = fan5405_WriteReg(reg, val);
614 printk("set_regs_store error\n");
622 static ssize_t dump_regs_show(struct device *dev, struct device_attribute *attr,
625 const int regaddrs[] = {0x00, 0x01, 0x02, 0x03, 0x4, 0x05, 0x06, 0x10 };
626 const char str[] = "0123456789abcdef";
627 BYTE fan5405_regs[0x60];
632 for (i=0; i<0x60; i++) {
643 for ( i = 0; i<0x07; i++) {
644 fan5405_read_reg(usb_fan5405_chg->client, i, &fan5405_regs[i]);
646 fan5405_read_reg(usb_fan5405_chg->client, 0x10, &fan5405_regs[0x10]);
649 for ( i = 0; i<0x07; i++) {
650 fan5405_regs[i] = fan5405_ReadReg(i);
652 // fan5405_ReadReg(fan5405_regs[0x10]);
656 for (i=0; i<ARRAY_SIZE(regaddrs); i++) {
658 val = fan5405_regs[index];
659 buf[3*index] = str[(val&0xf0)>>4];
660 buf[3*index+1] = str[val&0x0f];
661 buf[3*index+1] = str[val&0x0f];
668 static DEVICE_ATTR(dump_regs, S_IRUGO | S_IWUSR, dump_regs_show, NULL);
669 static DEVICE_ATTR(set_regs, S_IRUGO | S_IWUSR, NULL, set_regs_store);
672 static void fan54015_start_type(int type)
675 fan5405_TA_StartCharging();
678 fan5405_USB_StartCharging();
682 struct sprd_ext_ic_operations sprd_extic_op ={
683 .ic_init = fan5405_init,
684 .charge_start_ext = fan54015_start_type,
685 .charge_stop_ext = fan5405_StopCharging,
686 .get_charging_status = fan5405_GetCharge_Stat,
687 .timer_callback_ext = fan5405_Reset32sTimer_ap,
688 .otg_charge_ext = fan5405_OTG_Enable,
691 const struct sprd_ext_ic_operations *sprd_get_ext_ic_ops(void){
692 return &sprd_extic_op;
695 extern int sprd_otg_enable_power_on(void);
699 static struct fan5405_platform_data *fan5405_parse_dt(struct device *dev)
701 // struct fan5405_platform_data *pdata;
702 struct device_node *np = dev->of_node;
704 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
706 dev_err(dev, "Could not allocate struct fan5405_platform_data");
716 static int fan5405_probe(
717 struct i2c_client *client, const struct i2c_device_id *id)
722 printk("@@@@@@@fan5405_probe\n");
723 pdata = client->dev.platform_data;
726 struct device_node *np = client->dev.of_node;
728 fan5405_parse_dt(&client->dev);
731 goto exit_alloc_platform_data_failed;
733 client->dev.platform_data = pdata;
738 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
741 pr_err("%s: platform data is NULL\n", __func__);
742 goto err_alloc_data_failed;
747 this_client = client;
749 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
750 pr_err("%s: i2c check functionality error\n", __func__);
752 goto check_funcionality_failed;
755 INIT_DELAYED_WORK(&fan_t32s_timer_work, fan5405_Reset32sTimer);
756 schedule_work(&fan_t32s_timer_work);
758 fan5405_Initialization();
759 if(sprd_otg_enable_power_on()){
760 printk("enable OTG mode when power on\n");
761 fan5405_OTG_Enable(1);
764 #ifdef FAN5405_DEBUG_FS
765 device_create_file(&client->dev, &dev_attr_dump_regs);
766 device_create_file(&client->dev, &dev_attr_set_regs);
768 printk("@@@@@@@fan5405_probe ok\n");
771 check_funcionality_failed:
773 err_alloc_data_failed:
776 exit_alloc_platform_data_failed:
780 static int fan5405_remove(struct i2c_client *client)
782 struct fan5405_platform_data *p54013data = i2c_get_clientdata(client);
784 del_timer(&t32s_timer);
789 static int fan5405_suspend(struct i2c_client *client, pm_message_t message)
794 static int fan5405_resume(struct i2c_client *client)
799 static const struct i2c_device_id fan5405_i2c_id[] = {
800 { "fairchild_fan5405", 0 },
805 static const struct of_device_id fan5405_of_match[] = {
806 {.compatible = "fairchild,fairchild_fan5405",},
811 static struct i2c_driver fan5405_i2c_driver = {
813 .name = "fairchild_fan5405",
814 .owner = THIS_MODULE,
816 .of_match_table = of_match_ptr(fan5405_of_match),
819 .probe = fan5405_probe,
820 // .remove = __devexit_p(fan5405_remove),
821 .remove = fan5405_remove,
822 .suspend = fan5405_suspend,
823 .resume = fan5405_resume,
824 .id_table = fan5405_i2c_id,
827 static __init int fan5405_i2c_init(void)
829 return i2c_add_driver(&fan5405_i2c_driver);
832 static __exit void fan5405_i2c_exit(void)
834 i2c_del_driver(&fan5405_i2c_driver);
837 module_init(fan5405_i2c_init);
838 module_exit(fan5405_i2c_exit);
840 //MODULE_AUTHOR("Bright Yang<bright.yang@fairchildsemi.com>");
841 //MODULE_DESCRIPTION("I2C bus driver for FAN5405 Switching Charger");
842 //MODULE_LICENSE("GPL v2");