Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
olpc_battery.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/err.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/jiffies.h>
#include <linux/sched.h>
#include <linux/olpc-ec.h>
#include <asm/olpc.h>

Go to the source code of this file.

Macros

#define EC_BAT_VOLTAGE   0x10 /* uint16_t, *9.76/32, mV */
 
#define EC_BAT_CURRENT   0x11 /* int16_t, *15.625/120, mA */
 
#define EC_BAT_ACR   0x12 /* int16_t, *6250/15, µAh */
 
#define EC_BAT_TEMP   0x13 /* uint16_t, *100/256, °C */
 
#define EC_AMB_TEMP   0x14 /* uint16_t, *100/256, °C */
 
#define EC_BAT_STATUS   0x15 /* uint8_t, bitmask */
 
#define EC_BAT_SOC   0x16 /* uint8_t, percentage */
 
#define EC_BAT_SERIAL   0x17 /* uint8_t[6] */
 
#define EC_BAT_EEPROM   0x18 /* uint8_t adr as input, uint8_t output */
 
#define EC_BAT_ERRCODE   0x1f /* uint8_t, bitmask */
 
#define BAT_STAT_PRESENT   0x01
 
#define BAT_STAT_FULL   0x02
 
#define BAT_STAT_LOW   0x04
 
#define BAT_STAT_DESTROY   0x08
 
#define BAT_STAT_AC   0x10
 
#define BAT_STAT_CHARGING   0x20
 
#define BAT_STAT_DISCHARGING   0x40
 
#define BAT_STAT_TRICKLE   0x80
 
#define BAT_ERR_INFOFAIL   0x02
 
#define BAT_ERR_OVERVOLTAGE   0x04
 
#define BAT_ERR_OVERTEMP   0x05
 
#define BAT_ERR_GAUGESTOP   0x06
 
#define BAT_ERR_OUT_OF_CONTROL   0x07
 
#define BAT_ERR_ID_FAIL   0x09
 
#define BAT_ERR_ACR_FAIL   0x10
 
#define BAT_ADDR_MFR_TYPE   0x5F
 
#define EEPROM_START   0x20
 
#define EEPROM_END   0x80
 
#define EEPROM_SIZE   (EEPROM_END - EEPROM_START)
 

Functions

 MODULE_DEVICE_TABLE (of, olpc_battery_ids)
 
 module_platform_driver (olpc_battery_driver)
 
 MODULE_AUTHOR ("David Woodhouse <[email protected]>")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DESCRIPTION ("Battery driver for One Laptop Per Child 'XO' machine")
 

Macro Definition Documentation

#define BAT_ADDR_MFR_TYPE   0x5F

Definition at line 52 of file olpc_battery.c.

#define BAT_ERR_ACR_FAIL   0x10

Definition at line 50 of file olpc_battery.c.

#define BAT_ERR_GAUGESTOP   0x06

Definition at line 47 of file olpc_battery.c.

#define BAT_ERR_ID_FAIL   0x09

Definition at line 49 of file olpc_battery.c.

#define BAT_ERR_INFOFAIL   0x02

Definition at line 44 of file olpc_battery.c.

#define BAT_ERR_OUT_OF_CONTROL   0x07

Definition at line 48 of file olpc_battery.c.

#define BAT_ERR_OVERTEMP   0x05

Definition at line 46 of file olpc_battery.c.

#define BAT_ERR_OVERVOLTAGE   0x04

Definition at line 45 of file olpc_battery.c.

#define BAT_STAT_AC   0x10

Definition at line 39 of file olpc_battery.c.

#define BAT_STAT_CHARGING   0x20

Definition at line 40 of file olpc_battery.c.

#define BAT_STAT_DESTROY   0x08

Definition at line 38 of file olpc_battery.c.

#define BAT_STAT_DISCHARGING   0x40

Definition at line 41 of file olpc_battery.c.

#define BAT_STAT_FULL   0x02

Definition at line 36 of file olpc_battery.c.

#define BAT_STAT_LOW   0x04

Definition at line 37 of file olpc_battery.c.

#define BAT_STAT_PRESENT   0x01

Definition at line 35 of file olpc_battery.c.

#define BAT_STAT_TRICKLE   0x80

Definition at line 42 of file olpc_battery.c.

#define EC_AMB_TEMP   0x14 /* uint16_t, *100/256, °C */

Definition at line 28 of file olpc_battery.c.

#define EC_BAT_ACR   0x12 /* int16_t, *6250/15, µAh */

Definition at line 26 of file olpc_battery.c.

#define EC_BAT_CURRENT   0x11 /* int16_t, *15.625/120, mA */

Definition at line 25 of file olpc_battery.c.

#define EC_BAT_EEPROM   0x18 /* uint8_t adr as input, uint8_t output */

Definition at line 32 of file olpc_battery.c.

#define EC_BAT_ERRCODE   0x1f /* uint8_t, bitmask */

Definition at line 33 of file olpc_battery.c.

#define EC_BAT_SERIAL   0x17 /* uint8_t[6] */

Definition at line 31 of file olpc_battery.c.

#define EC_BAT_SOC   0x16 /* uint8_t, percentage */

Definition at line 30 of file olpc_battery.c.

#define EC_BAT_STATUS   0x15 /* uint8_t, bitmask */

Definition at line 29 of file olpc_battery.c.

#define EC_BAT_TEMP   0x13 /* uint16_t, *100/256, °C */

Definition at line 27 of file olpc_battery.c.

#define EC_BAT_VOLTAGE   0x10 /* uint16_t, *9.76/32, mV */

Definition at line 24 of file olpc_battery.c.

#define EEPROM_END   0x80

Definition at line 512 of file olpc_battery.c.

#define EEPROM_SIZE   (EEPROM_END - EEPROM_START)

Definition at line 513 of file olpc_battery.c.

#define EEPROM_START   0x20

Definition at line 511 of file olpc_battery.c.

Function Documentation

MODULE_AUTHOR ( "David Woodhouse <[email protected]>"  )
MODULE_DESCRIPTION ( "Battery driver for One Laptop Per Child 'XO' machine )
MODULE_DEVICE_TABLE ( of  ,
olpc_battery_ids   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( olpc_battery_driver  )