Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
bq27x00_battery.c File Reference
#include <linux/module.h>
#include <linux/param.h>
#include <linux/jiffies.h>
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/idr.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
#include <linux/power/bq27x00_battery.h>

Go to the source code of this file.

Data Structures

struct  bq27x00_access_methods
 
struct  bq27x00_reg_cache
 
struct  bq27x00_device_info
 

Macros

#define DRIVER_VERSION   "1.2.0"
 
#define BQ27x00_REG_TEMP   0x06
 
#define BQ27x00_REG_VOLT   0x08
 
#define BQ27x00_REG_AI   0x14
 
#define BQ27x00_REG_FLAGS   0x0A
 
#define BQ27x00_REG_TTE   0x16
 
#define BQ27x00_REG_TTF   0x18
 
#define BQ27x00_REG_TTECP   0x26
 
#define BQ27x00_REG_NAC   0x0C /* Nominal available capacity */
 
#define BQ27x00_REG_LMD   0x12 /* Last measured discharge */
 
#define BQ27x00_REG_CYCT   0x2A /* Cycle count total */
 
#define BQ27x00_REG_AE   0x22 /* Available energy */
 
#define BQ27x00_POWER_AVG   0x24
 
#define BQ27000_REG_RSOC   0x0B /* Relative State-of-Charge */
 
#define BQ27000_REG_ILMD   0x76 /* Initial last measured discharge */
 
#define BQ27000_FLAG_EDVF   BIT(0) /* Final End-of-Discharge-Voltage flag */
 
#define BQ27000_FLAG_EDV1   BIT(1) /* First End-of-Discharge-Voltage flag */
 
#define BQ27000_FLAG_CI   BIT(4) /* Capacity Inaccurate flag */
 
#define BQ27000_FLAG_FC   BIT(5)
 
#define BQ27000_FLAG_CHGS   BIT(7) /* Charge state flag */
 
#define BQ27500_REG_SOC   0x2C
 
#define BQ27500_REG_DCAP   0x3C /* Design capacity */
 
#define BQ27500_FLAG_DSC   BIT(0)
 
#define BQ27500_FLAG_SOCF   BIT(1) /* State-of-Charge threshold final */
 
#define BQ27500_FLAG_SOC1   BIT(2) /* State-of-Charge threshold 1 */
 
#define BQ27500_FLAG_FC   BIT(9)
 
#define BQ27500_FLAG_OTC   BIT(15)
 
#define BQ27425_REG_OFFSET   0x04
 
#define BQ27425_REG_SOC   0x18 /* Register address plus offset */
 
#define BQ27000_RS   20 /* Resistor sense */
 
#define BQ27x00_POWER_CONSTANT   (256 * 29200 / 1000)
 
#define to_bq27x00_device_info(x)
 

Enumerations

enum  bq27x00_chip { BQ27000, BQ27500, BQ27425 }
 

Functions

 module_param (poll_interval, uint, 0644)
 
 MODULE_PARM_DESC (poll_interval,"battery poll interval in seconds - ""0 disables polling")
 
 module_init (bq27x00_battery_init)
 
 module_exit (bq27x00_battery_exit)
 
 MODULE_AUTHOR ("Rodolfo Giometti <[email protected]>")
 
 MODULE_DESCRIPTION ("BQ27x00 battery monitor driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define BQ27000_FLAG_CHGS   BIT(7) /* Charge state flag */

Definition at line 63 of file bq27x00_battery.c.

#define BQ27000_FLAG_CI   BIT(4) /* Capacity Inaccurate flag */

Definition at line 61 of file bq27x00_battery.c.

#define BQ27000_FLAG_EDV1   BIT(1) /* First End-of-Discharge-Voltage flag */

Definition at line 60 of file bq27x00_battery.c.

#define BQ27000_FLAG_EDVF   BIT(0) /* Final End-of-Discharge-Voltage flag */

Definition at line 59 of file bq27x00_battery.c.

#define BQ27000_FLAG_FC   BIT(5)

Definition at line 62 of file bq27x00_battery.c.

#define BQ27000_REG_ILMD   0x76 /* Initial last measured discharge */

Definition at line 58 of file bq27x00_battery.c.

#define BQ27000_REG_RSOC   0x0B /* Relative State-of-Charge */

Definition at line 57 of file bq27x00_battery.c.

#define BQ27000_RS   20 /* Resistor sense */

Definition at line 77 of file bq27x00_battery.c.

#define BQ27425_REG_OFFSET   0x04

Definition at line 74 of file bq27x00_battery.c.

#define BQ27425_REG_SOC   0x18 /* Register address plus offset */

Definition at line 75 of file bq27x00_battery.c.

#define BQ27500_FLAG_DSC   BIT(0)

Definition at line 67 of file bq27x00_battery.c.

#define BQ27500_FLAG_FC   BIT(9)

Definition at line 70 of file bq27x00_battery.c.

#define BQ27500_FLAG_OTC   BIT(15)

Definition at line 71 of file bq27x00_battery.c.

#define BQ27500_FLAG_SOC1   BIT(2) /* State-of-Charge threshold 1 */

Definition at line 69 of file bq27x00_battery.c.

#define BQ27500_FLAG_SOCF   BIT(1) /* State-of-Charge threshold final */

Definition at line 68 of file bq27x00_battery.c.

#define BQ27500_REG_DCAP   0x3C /* Design capacity */

Definition at line 66 of file bq27x00_battery.c.

#define BQ27500_REG_SOC   0x2C

Definition at line 65 of file bq27x00_battery.c.

#define BQ27x00_POWER_AVG   0x24

Definition at line 55 of file bq27x00_battery.c.

#define BQ27x00_POWER_CONSTANT   (256 * 29200 / 1000)

Definition at line 78 of file bq27x00_battery.c.

#define BQ27x00_REG_AE   0x22 /* Available energy */

Definition at line 54 of file bq27x00_battery.c.

#define BQ27x00_REG_AI   0x14

Definition at line 46 of file bq27x00_battery.c.

#define BQ27x00_REG_CYCT   0x2A /* Cycle count total */

Definition at line 53 of file bq27x00_battery.c.

#define BQ27x00_REG_FLAGS   0x0A

Definition at line 47 of file bq27x00_battery.c.

#define BQ27x00_REG_LMD   0x12 /* Last measured discharge */

Definition at line 52 of file bq27x00_battery.c.

#define BQ27x00_REG_NAC   0x0C /* Nominal available capacity */

Definition at line 51 of file bq27x00_battery.c.

#define BQ27x00_REG_TEMP   0x06

Definition at line 44 of file bq27x00_battery.c.

#define BQ27x00_REG_TTE   0x16

Definition at line 48 of file bq27x00_battery.c.

#define BQ27x00_REG_TTECP   0x26

Definition at line 50 of file bq27x00_battery.c.

#define BQ27x00_REG_TTF   0x18

Definition at line 49 of file bq27x00_battery.c.

#define BQ27x00_REG_VOLT   0x08

Definition at line 45 of file bq27x00_battery.c.

#define DRIVER_VERSION   "1.2.0"

Definition at line 42 of file bq27x00_battery.c.

#define to_bq27x00_device_info (   x)
Value:
struct bq27x00_device_info, bat);

Definition at line 596 of file bq27x00_battery.c.

Enumeration Type Documentation

Enumerator:
BQ27000 
BQ27500 
BQ27425 

Definition at line 85 of file bq27x00_battery.c.

Function Documentation

MODULE_AUTHOR ( "Rodolfo Giometti <[email protected]>"  )
MODULE_DESCRIPTION ( "BQ27x00 battery monitor driver )
module_exit ( bq27x00_battery_exit  )
module_init ( bq27x00_battery_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( poll_interval  ,
uint  ,
0644   
)
MODULE_PARM_DESC ( poll_interval  ,
"battery poll interval in seconds - ""0 disables polling"   
)