Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
twl4030_charger.c File Reference
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/i2c/twl.h>
#include <linux/power_supply.h>
#include <linux/notifier.h>
#include <linux/usb/otg.h>
#include <linux/regulator/machine.h>

Go to the source code of this file.

Data Structures

struct  twl4030_bci
 

Macros

#define TWL4030_BCIMSTATEC   0x02
 
#define TWL4030_BCIICHG   0x08
 
#define TWL4030_BCIVAC   0x0a
 
#define TWL4030_BCIVBUS   0x0c
 
#define TWL4030_BCIMFSTS4   0x10
 
#define TWL4030_BCICTL1   0x23
 
#define TWL4030_BB_CFG   0x12
 
#define TWL4030_BCIAUTOWEN   BIT(5)
 
#define TWL4030_CONFIG_DONE   BIT(4)
 
#define TWL4030_BCIAUTOUSB   BIT(1)
 
#define TWL4030_BCIAUTOAC   BIT(0)
 
#define TWL4030_CGAIN   BIT(5)
 
#define TWL4030_USBFASTMCHG   BIT(2)
 
#define TWL4030_STS_VBUS   BIT(7)
 
#define TWL4030_STS_USB_ID   BIT(2)
 
#define TWL4030_BBCHEN   BIT(4)
 
#define TWL4030_BBSEL_MASK   0x0c
 
#define TWL4030_BBSEL_2V5   0x00
 
#define TWL4030_BBSEL_3V0   0x04
 
#define TWL4030_BBSEL_3V1   0x08
 
#define TWL4030_BBSEL_3V2   0x0c
 
#define TWL4030_BBISEL_MASK   0x03
 
#define TWL4030_BBISEL_25uA   0x00
 
#define TWL4030_BBISEL_150uA   0x01
 
#define TWL4030_BBISEL_500uA   0x02
 
#define TWL4030_BBISEL_1000uA   0x03
 
#define TWL4030_WOVF   BIT(0) /* Watchdog overflow */
 
#define TWL4030_TMOVF   BIT(1) /* Timer overflow */
 
#define TWL4030_ICHGHIGH   BIT(2) /* Battery charge current high */
 
#define TWL4030_ICHGLOW   BIT(3) /* Battery cc. low / FSM state change */
 
#define TWL4030_ICHGEOC   BIT(4) /* Battery current end-of-charge */
 
#define TWL4030_TBATOR2   BIT(5) /* Battery temperature out of range 2 */
 
#define TWL4030_TBATOR1   BIT(6) /* Battery temperature out of range 1 */
 
#define TWL4030_BATSTS   BIT(7) /* Battery status */
 
#define TWL4030_VBATLVL   BIT(0) /* VBAT level */
 
#define TWL4030_VBATOV   BIT(1) /* VBAT overvoltage */
 
#define TWL4030_VBUSOV   BIT(2) /* VBUS overvoltage */
 
#define TWL4030_ACCHGOV   BIT(3) /* Ac charger overvoltage */
 
#define TWL4030_MSTATEC_USB   BIT(4)
 
#define TWL4030_MSTATEC_AC   BIT(5)
 
#define TWL4030_MSTATEC_MASK   0x0f
 
#define TWL4030_MSTATEC_QUICK1   0x02
 
#define TWL4030_MSTATEC_QUICK7   0x07
 
#define TWL4030_MSTATEC_COMPLETE1   0x0b
 
#define TWL4030_MSTATEC_COMPLETE4   0x0e
 

Functions

 module_param (allow_usb, bool, 0644)
 
 MODULE_PARM_DESC (allow_usb,"Allow USB charge drawing default current")
 
 module_init (twl4030_bci_init)
 
 module_exit (twl4030_bci_exit)
 
 MODULE_AUTHOR ("Gražvydas Ignotas")
 
 MODULE_DESCRIPTION ("TWL4030 Battery Charger Interface driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("platform:twl4030_bci")
 

Macro Definition Documentation

#define TWL4030_ACCHGOV   BIT(3) /* Ac charger overvoltage */

Definition at line 68 of file twl4030_charger.c.

#define TWL4030_BATSTS   BIT(7) /* Battery status */

Definition at line 63 of file twl4030_charger.c.

#define TWL4030_BB_CFG   0x12

Definition at line 33 of file twl4030_charger.c.

#define TWL4030_BBCHEN   BIT(4)

Definition at line 43 of file twl4030_charger.c.

#define TWL4030_BBISEL_1000uA   0x03

Definition at line 53 of file twl4030_charger.c.

#define TWL4030_BBISEL_150uA   0x01

Definition at line 51 of file twl4030_charger.c.

#define TWL4030_BBISEL_25uA   0x00

Definition at line 50 of file twl4030_charger.c.

#define TWL4030_BBISEL_500uA   0x02

Definition at line 52 of file twl4030_charger.c.

#define TWL4030_BBISEL_MASK   0x03

Definition at line 49 of file twl4030_charger.c.

#define TWL4030_BBSEL_2V5   0x00

Definition at line 45 of file twl4030_charger.c.

#define TWL4030_BBSEL_3V0   0x04

Definition at line 46 of file twl4030_charger.c.

#define TWL4030_BBSEL_3V1   0x08

Definition at line 47 of file twl4030_charger.c.

#define TWL4030_BBSEL_3V2   0x0c

Definition at line 48 of file twl4030_charger.c.

#define TWL4030_BBSEL_MASK   0x0c

Definition at line 44 of file twl4030_charger.c.

#define TWL4030_BCIAUTOAC   BIT(0)

Definition at line 38 of file twl4030_charger.c.

#define TWL4030_BCIAUTOUSB   BIT(1)

Definition at line 37 of file twl4030_charger.c.

#define TWL4030_BCIAUTOWEN   BIT(5)

Definition at line 35 of file twl4030_charger.c.

#define TWL4030_BCICTL1   0x23

Definition at line 32 of file twl4030_charger.c.

#define TWL4030_BCIICHG   0x08

Definition at line 28 of file twl4030_charger.c.

#define TWL4030_BCIMFSTS4   0x10

Definition at line 31 of file twl4030_charger.c.

#define TWL4030_BCIMSTATEC   0x02

Definition at line 27 of file twl4030_charger.c.

#define TWL4030_BCIVAC   0x0a

Definition at line 29 of file twl4030_charger.c.

#define TWL4030_BCIVBUS   0x0c

Definition at line 30 of file twl4030_charger.c.

#define TWL4030_CGAIN   BIT(5)

Definition at line 39 of file twl4030_charger.c.

#define TWL4030_CONFIG_DONE   BIT(4)

Definition at line 36 of file twl4030_charger.c.

#define TWL4030_ICHGEOC   BIT(4) /* Battery current end-of-charge */

Definition at line 60 of file twl4030_charger.c.

#define TWL4030_ICHGHIGH   BIT(2) /* Battery charge current high */

Definition at line 58 of file twl4030_charger.c.

#define TWL4030_ICHGLOW   BIT(3) /* Battery cc. low / FSM state change */

Definition at line 59 of file twl4030_charger.c.

#define TWL4030_MSTATEC_AC   BIT(5)

Definition at line 71 of file twl4030_charger.c.

#define TWL4030_MSTATEC_COMPLETE1   0x0b

Definition at line 75 of file twl4030_charger.c.

#define TWL4030_MSTATEC_COMPLETE4   0x0e

Definition at line 76 of file twl4030_charger.c.

#define TWL4030_MSTATEC_MASK   0x0f

Definition at line 72 of file twl4030_charger.c.

#define TWL4030_MSTATEC_QUICK1   0x02

Definition at line 73 of file twl4030_charger.c.

#define TWL4030_MSTATEC_QUICK7   0x07

Definition at line 74 of file twl4030_charger.c.

#define TWL4030_MSTATEC_USB   BIT(4)

Definition at line 70 of file twl4030_charger.c.

#define TWL4030_STS_USB_ID   BIT(2)

Definition at line 42 of file twl4030_charger.c.

#define TWL4030_STS_VBUS   BIT(7)

Definition at line 41 of file twl4030_charger.c.

#define TWL4030_TBATOR1   BIT(6) /* Battery temperature out of range 1 */

Definition at line 62 of file twl4030_charger.c.

#define TWL4030_TBATOR2   BIT(5) /* Battery temperature out of range 2 */

Definition at line 61 of file twl4030_charger.c.

#define TWL4030_TMOVF   BIT(1) /* Timer overflow */

Definition at line 57 of file twl4030_charger.c.

#define TWL4030_USBFASTMCHG   BIT(2)

Definition at line 40 of file twl4030_charger.c.

#define TWL4030_VBATLVL   BIT(0) /* VBAT level */

Definition at line 65 of file twl4030_charger.c.

#define TWL4030_VBATOV   BIT(1) /* VBAT overvoltage */

Definition at line 66 of file twl4030_charger.c.

#define TWL4030_VBUSOV   BIT(2) /* VBUS overvoltage */

Definition at line 67 of file twl4030_charger.c.

#define TWL4030_WOVF   BIT(0) /* Watchdog overflow */

Definition at line 56 of file twl4030_charger.c.

Function Documentation

MODULE_ALIAS ( "platform:twl4030_bci"  )
MODULE_AUTHOR ( "Gražvydas Ignotas"  )
MODULE_DESCRIPTION ( "TWL4030 Battery Charger Interface driver )
module_exit ( twl4030_bci_exit  )
module_init ( twl4030_bci_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( allow_usb  ,
bool  ,
0644   
)
MODULE_PARM_DESC ( allow_usb  ,
"Allow USB charge drawing default current  
)