Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
smb347-charger.c File Reference
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/power_supply.h>
#include <linux/power/smb347-charger.h>
#include <linux/regmap.h>

Go to the source code of this file.

Data Structures

struct  smb347_charger
 

Macros

#define CFG_CHARGE_CURRENT   0x00
 
#define CFG_CHARGE_CURRENT_FCC_MASK   0xe0
 
#define CFG_CHARGE_CURRENT_FCC_SHIFT   5
 
#define CFG_CHARGE_CURRENT_PCC_MASK   0x18
 
#define CFG_CHARGE_CURRENT_PCC_SHIFT   3
 
#define CFG_CHARGE_CURRENT_TC_MASK   0x07
 
#define CFG_CURRENT_LIMIT   0x01
 
#define CFG_CURRENT_LIMIT_DC_MASK   0xf0
 
#define CFG_CURRENT_LIMIT_DC_SHIFT   4
 
#define CFG_CURRENT_LIMIT_USB_MASK   0x0f
 
#define CFG_FLOAT_VOLTAGE   0x03
 
#define CFG_FLOAT_VOLTAGE_FLOAT_MASK   0x3f
 
#define CFG_FLOAT_VOLTAGE_THRESHOLD_MASK   0xc0
 
#define CFG_FLOAT_VOLTAGE_THRESHOLD_SHIFT   6
 
#define CFG_STAT   0x05
 
#define CFG_STAT_DISABLED   BIT(5)
 
#define CFG_STAT_ACTIVE_HIGH   BIT(7)
 
#define CFG_PIN   0x06
 
#define CFG_PIN_EN_CTRL_MASK   0x60
 
#define CFG_PIN_EN_CTRL_ACTIVE_HIGH   0x40
 
#define CFG_PIN_EN_CTRL_ACTIVE_LOW   0x60
 
#define CFG_PIN_EN_APSD_IRQ   BIT(1)
 
#define CFG_PIN_EN_CHARGER_ERROR   BIT(2)
 
#define CFG_THERM   0x07
 
#define CFG_THERM_SOFT_HOT_COMPENSATION_MASK   0x03
 
#define CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT   0
 
#define CFG_THERM_SOFT_COLD_COMPENSATION_MASK   0x0c
 
#define CFG_THERM_SOFT_COLD_COMPENSATION_SHIFT   2
 
#define CFG_THERM_MONITOR_DISABLED   BIT(4)
 
#define CFG_SYSOK   0x08
 
#define CFG_SYSOK_SUSPEND_HARD_LIMIT_DISABLED   BIT(2)
 
#define CFG_OTHER   0x09
 
#define CFG_OTHER_RID_MASK   0xc0
 
#define CFG_OTHER_RID_ENABLED_AUTO_OTG   0xc0
 
#define CFG_OTG   0x0a
 
#define CFG_OTG_TEMP_THRESHOLD_MASK   0x30
 
#define CFG_OTG_TEMP_THRESHOLD_SHIFT   4
 
#define CFG_OTG_CC_COMPENSATION_MASK   0xc0
 
#define CFG_OTG_CC_COMPENSATION_SHIFT   6
 
#define CFG_TEMP_LIMIT   0x0b
 
#define CFG_TEMP_LIMIT_SOFT_HOT_MASK   0x03
 
#define CFG_TEMP_LIMIT_SOFT_HOT_SHIFT   0
 
#define CFG_TEMP_LIMIT_SOFT_COLD_MASK   0x0c
 
#define CFG_TEMP_LIMIT_SOFT_COLD_SHIFT   2
 
#define CFG_TEMP_LIMIT_HARD_HOT_MASK   0x30
 
#define CFG_TEMP_LIMIT_HARD_HOT_SHIFT   4
 
#define CFG_TEMP_LIMIT_HARD_COLD_MASK   0xc0
 
#define CFG_TEMP_LIMIT_HARD_COLD_SHIFT   6
 
#define CFG_FAULT_IRQ   0x0c
 
#define CFG_FAULT_IRQ_DCIN_UV   BIT(2)
 
#define CFG_STATUS_IRQ   0x0d
 
#define CFG_STATUS_IRQ_TERMINATION_OR_TAPER   BIT(4)
 
#define CFG_STATUS_IRQ_CHARGE_TIMEOUT   BIT(7)
 
#define CFG_ADDRESS   0x0e
 
#define CMD_A   0x30
 
#define CMD_A_CHG_ENABLED   BIT(1)
 
#define CMD_A_SUSPEND_ENABLED   BIT(2)
 
#define CMD_A_ALLOW_WRITE   BIT(7)
 
#define CMD_B   0x31
 
#define CMD_C   0x33
 
#define IRQSTAT_A   0x35
 
#define IRQSTAT_C   0x37
 
#define IRQSTAT_C_TERMINATION_STAT   BIT(0)
 
#define IRQSTAT_C_TERMINATION_IRQ   BIT(1)
 
#define IRQSTAT_C_TAPER_IRQ   BIT(3)
 
#define IRQSTAT_D   0x38
 
#define IRQSTAT_D_CHARGE_TIMEOUT_STAT   BIT(2)
 
#define IRQSTAT_D_CHARGE_TIMEOUT_IRQ   BIT(3)
 
#define IRQSTAT_E   0x39
 
#define IRQSTAT_E_USBIN_UV_STAT   BIT(0)
 
#define IRQSTAT_E_USBIN_UV_IRQ   BIT(1)
 
#define IRQSTAT_E_DCIN_UV_STAT   BIT(4)
 
#define IRQSTAT_E_DCIN_UV_IRQ   BIT(5)
 
#define IRQSTAT_F   0x3a
 
#define STAT_A   0x3b
 
#define STAT_A_FLOAT_VOLTAGE_MASK   0x3f
 
#define STAT_B   0x3c
 
#define STAT_C   0x3d
 
#define STAT_C_CHG_ENABLED   BIT(0)
 
#define STAT_C_HOLDOFF_STAT   BIT(3)
 
#define STAT_C_CHG_MASK   0x06
 
#define STAT_C_CHG_SHIFT   1
 
#define STAT_C_CHG_TERM   BIT(5)
 
#define STAT_C_CHARGER_ERROR   BIT(6)
 
#define STAT_E   0x3f
 
#define SMB347_MAX_REGISTER   0x3f
 

Functions

 MODULE_DEVICE_TABLE (i2c, smb347_id)
 
 module_i2c_driver (smb347_driver)
 
 MODULE_AUTHOR ("Bruce E. Robertson <[email protected]>")
 
 MODULE_AUTHOR ("Mika Westerberg <[email protected]>")
 
 MODULE_DESCRIPTION ("SMB347 battery charger driver")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("i2c:smb347")
 

Macro Definition Documentation

#define CFG_ADDRESS   0x0e

Definition at line 84 of file smb347-charger.c.

#define CFG_CHARGE_CURRENT   0x00

Definition at line 31 of file smb347-charger.c.

#define CFG_CHARGE_CURRENT_FCC_MASK   0xe0

Definition at line 32 of file smb347-charger.c.

#define CFG_CHARGE_CURRENT_FCC_SHIFT   5

Definition at line 33 of file smb347-charger.c.

#define CFG_CHARGE_CURRENT_PCC_MASK   0x18

Definition at line 34 of file smb347-charger.c.

#define CFG_CHARGE_CURRENT_PCC_SHIFT   3

Definition at line 35 of file smb347-charger.c.

#define CFG_CHARGE_CURRENT_TC_MASK   0x07

Definition at line 36 of file smb347-charger.c.

#define CFG_CURRENT_LIMIT   0x01

Definition at line 37 of file smb347-charger.c.

#define CFG_CURRENT_LIMIT_DC_MASK   0xf0

Definition at line 38 of file smb347-charger.c.

#define CFG_CURRENT_LIMIT_DC_SHIFT   4

Definition at line 39 of file smb347-charger.c.

#define CFG_CURRENT_LIMIT_USB_MASK   0x0f

Definition at line 40 of file smb347-charger.c.

#define CFG_FAULT_IRQ   0x0c

Definition at line 79 of file smb347-charger.c.

#define CFG_FAULT_IRQ_DCIN_UV   BIT(2)

Definition at line 80 of file smb347-charger.c.

#define CFG_FLOAT_VOLTAGE   0x03

Definition at line 41 of file smb347-charger.c.

#define CFG_FLOAT_VOLTAGE_FLOAT_MASK   0x3f

Definition at line 42 of file smb347-charger.c.

#define CFG_FLOAT_VOLTAGE_THRESHOLD_MASK   0xc0

Definition at line 43 of file smb347-charger.c.

#define CFG_FLOAT_VOLTAGE_THRESHOLD_SHIFT   6

Definition at line 44 of file smb347-charger.c.

#define CFG_OTG   0x0a

Definition at line 65 of file smb347-charger.c.

#define CFG_OTG_CC_COMPENSATION_MASK   0xc0

Definition at line 68 of file smb347-charger.c.

#define CFG_OTG_CC_COMPENSATION_SHIFT   6

Definition at line 69 of file smb347-charger.c.

#define CFG_OTG_TEMP_THRESHOLD_MASK   0x30

Definition at line 66 of file smb347-charger.c.

#define CFG_OTG_TEMP_THRESHOLD_SHIFT   4

Definition at line 67 of file smb347-charger.c.

#define CFG_OTHER   0x09

Definition at line 62 of file smb347-charger.c.

#define CFG_OTHER_RID_ENABLED_AUTO_OTG   0xc0

Definition at line 64 of file smb347-charger.c.

#define CFG_OTHER_RID_MASK   0xc0

Definition at line 63 of file smb347-charger.c.

#define CFG_PIN   0x06

Definition at line 48 of file smb347-charger.c.

#define CFG_PIN_EN_APSD_IRQ   BIT(1)

Definition at line 52 of file smb347-charger.c.

#define CFG_PIN_EN_CHARGER_ERROR   BIT(2)

Definition at line 53 of file smb347-charger.c.

#define CFG_PIN_EN_CTRL_ACTIVE_HIGH   0x40

Definition at line 50 of file smb347-charger.c.

#define CFG_PIN_EN_CTRL_ACTIVE_LOW   0x60

Definition at line 51 of file smb347-charger.c.

#define CFG_PIN_EN_CTRL_MASK   0x60

Definition at line 49 of file smb347-charger.c.

#define CFG_STAT   0x05

Definition at line 45 of file smb347-charger.c.

#define CFG_STAT_ACTIVE_HIGH   BIT(7)

Definition at line 47 of file smb347-charger.c.

#define CFG_STAT_DISABLED   BIT(5)

Definition at line 46 of file smb347-charger.c.

#define CFG_STATUS_IRQ   0x0d

Definition at line 81 of file smb347-charger.c.

#define CFG_STATUS_IRQ_CHARGE_TIMEOUT   BIT(7)

Definition at line 83 of file smb347-charger.c.

#define CFG_STATUS_IRQ_TERMINATION_OR_TAPER   BIT(4)

Definition at line 82 of file smb347-charger.c.

#define CFG_SYSOK   0x08

Definition at line 60 of file smb347-charger.c.

#define CFG_SYSOK_SUSPEND_HARD_LIMIT_DISABLED   BIT(2)

Definition at line 61 of file smb347-charger.c.

#define CFG_TEMP_LIMIT   0x0b

Definition at line 70 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_HARD_COLD_MASK   0xc0

Definition at line 77 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_HARD_COLD_SHIFT   6

Definition at line 78 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_HARD_HOT_MASK   0x30

Definition at line 75 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_HARD_HOT_SHIFT   4

Definition at line 76 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_SOFT_COLD_MASK   0x0c

Definition at line 73 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_SOFT_COLD_SHIFT   2

Definition at line 74 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_SOFT_HOT_MASK   0x03

Definition at line 71 of file smb347-charger.c.

#define CFG_TEMP_LIMIT_SOFT_HOT_SHIFT   0

Definition at line 72 of file smb347-charger.c.

#define CFG_THERM   0x07

Definition at line 54 of file smb347-charger.c.

#define CFG_THERM_MONITOR_DISABLED   BIT(4)

Definition at line 59 of file smb347-charger.c.

#define CFG_THERM_SOFT_COLD_COMPENSATION_MASK   0x0c

Definition at line 57 of file smb347-charger.c.

#define CFG_THERM_SOFT_COLD_COMPENSATION_SHIFT   2

Definition at line 58 of file smb347-charger.c.

#define CFG_THERM_SOFT_HOT_COMPENSATION_MASK   0x03

Definition at line 55 of file smb347-charger.c.

#define CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT   0

Definition at line 56 of file smb347-charger.c.

#define CMD_A   0x30

Definition at line 87 of file smb347-charger.c.

#define CMD_A_ALLOW_WRITE   BIT(7)

Definition at line 90 of file smb347-charger.c.

#define CMD_A_CHG_ENABLED   BIT(1)

Definition at line 88 of file smb347-charger.c.

#define CMD_A_SUSPEND_ENABLED   BIT(2)

Definition at line 89 of file smb347-charger.c.

#define CMD_B   0x31

Definition at line 91 of file smb347-charger.c.

#define CMD_C   0x33

Definition at line 92 of file smb347-charger.c.

#define IRQSTAT_A   0x35

Definition at line 95 of file smb347-charger.c.

#define IRQSTAT_C   0x37

Definition at line 96 of file smb347-charger.c.

#define IRQSTAT_C_TAPER_IRQ   BIT(3)

Definition at line 99 of file smb347-charger.c.

#define IRQSTAT_C_TERMINATION_IRQ   BIT(1)

Definition at line 98 of file smb347-charger.c.

#define IRQSTAT_C_TERMINATION_STAT   BIT(0)

Definition at line 97 of file smb347-charger.c.

#define IRQSTAT_D   0x38

Definition at line 100 of file smb347-charger.c.

#define IRQSTAT_D_CHARGE_TIMEOUT_IRQ   BIT(3)

Definition at line 102 of file smb347-charger.c.

#define IRQSTAT_D_CHARGE_TIMEOUT_STAT   BIT(2)

Definition at line 101 of file smb347-charger.c.

#define IRQSTAT_E   0x39

Definition at line 103 of file smb347-charger.c.

#define IRQSTAT_E_DCIN_UV_IRQ   BIT(5)

Definition at line 107 of file smb347-charger.c.

#define IRQSTAT_E_DCIN_UV_STAT   BIT(4)

Definition at line 106 of file smb347-charger.c.

#define IRQSTAT_E_USBIN_UV_IRQ   BIT(1)

Definition at line 105 of file smb347-charger.c.

#define IRQSTAT_E_USBIN_UV_STAT   BIT(0)

Definition at line 104 of file smb347-charger.c.

#define IRQSTAT_F   0x3a

Definition at line 108 of file smb347-charger.c.

#define SMB347_MAX_REGISTER   0x3f

Definition at line 123 of file smb347-charger.c.

#define STAT_A   0x3b

Definition at line 111 of file smb347-charger.c.

#define STAT_A_FLOAT_VOLTAGE_MASK   0x3f

Definition at line 112 of file smb347-charger.c.

#define STAT_B   0x3c

Definition at line 113 of file smb347-charger.c.

#define STAT_C   0x3d

Definition at line 114 of file smb347-charger.c.

#define STAT_C_CHARGER_ERROR   BIT(6)

Definition at line 120 of file smb347-charger.c.

#define STAT_C_CHG_ENABLED   BIT(0)

Definition at line 115 of file smb347-charger.c.

#define STAT_C_CHG_MASK   0x06

Definition at line 117 of file smb347-charger.c.

#define STAT_C_CHG_SHIFT   1

Definition at line 118 of file smb347-charger.c.

#define STAT_C_CHG_TERM   BIT(5)

Definition at line 119 of file smb347-charger.c.

#define STAT_C_HOLDOFF_STAT   BIT(3)

Definition at line 116 of file smb347-charger.c.

#define STAT_E   0x3f

Definition at line 121 of file smb347-charger.c.

Function Documentation

MODULE_ALIAS ( "i2c:smb347"  )
MODULE_AUTHOR ( "Bruce E. Robertson <[email protected]>"  )
MODULE_AUTHOR ( "Mika Westerberg <[email protected]>"  )
MODULE_DESCRIPTION ( "SMB347 battery charger driver )
MODULE_DEVICE_TABLE ( i2c  ,
smb347_id   
)
module_i2c_driver ( smb347_driver  )
MODULE_LICENSE ( "GPL"  )