Skip to content

Commit

Permalink
mfd: Dialog DA9030 battery charger MFD driver
Browse files Browse the repository at this point in the history
This patch amends DA903x MFD driver with definitions and methods
needed for battery charger driver.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
  • Loading branch information
Mike Rapoport authored and Samuel Ortiz committed Jan 4, 2009
1 parent b8380c1 commit 856f6fd
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
12 changes: 12 additions & 0 deletions drivers/mfd/da903x.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,24 @@ int da903x_write(struct device *dev, int reg, uint8_t val)
}
EXPORT_SYMBOL_GPL(da903x_write);

int da903x_writes(struct device *dev, int reg, int len, uint8_t *val)
{
return __da903x_writes(to_i2c_client(dev), reg, len, val);
}
EXPORT_SYMBOL_GPL(da903x_writes);

int da903x_read(struct device *dev, int reg, uint8_t *val)
{
return __da903x_read(to_i2c_client(dev), reg, val);
}
EXPORT_SYMBOL_GPL(da903x_read);

int da903x_reads(struct device *dev, int reg, int len, uint8_t *val)
{
return __da903x_reads(to_i2c_client(dev), reg, len, val);
}
EXPORT_SYMBOL_GPL(da903x_reads);

int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask)
{
struct da903x_chip *chip = dev_get_drvdata(dev);
Expand Down
44 changes: 42 additions & 2 deletions include/linux/mfd/da903x.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enum {
DA9030_ID_LDO18,
DA9030_ID_LDO19,
DA9030_ID_LDO_INT, /* LDO Internal */
DA9030_ID_BAT, /* battery charger */

DA9034_ID_LED_1,
DA9034_ID_LED_2,
Expand Down Expand Up @@ -93,6 +94,43 @@ struct da9034_touch_pdata {
int y_inverted;
};

/* DA9030 battery charger data */
struct power_supply_info;

struct da9030_battery_info {
/* battery parameters */
struct power_supply_info *battery_info;

/* current and voltage to use for battery charging */
unsigned int charge_milliamp;
unsigned int charge_millivolt;

/* voltage thresholds (in millivolts) */
int vbat_low;
int vbat_crit;
int vbat_charge_start;
int vbat_charge_stop;
int vbat_charge_restart;

/* battery nominal minimal and maximal voltages in millivolts */
int vcharge_min;
int vcharge_max;

/* Temperature thresholds. These are DA9030 register values
"as is" and should be measured for each battery type */
int tbat_low;
int tbat_high;
int tbat_restart;


/* battery monitor interval (seconds) */
unsigned int batmon_interval;

/* platform callbacks for battery low and critical events */
void (*battery_low)(void);
void (*battery_critical)(void);
};

struct da903x_subdev_info {
int id;
const char *name;
Expand Down Expand Up @@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev,
extern int da903x_query_status(struct device *dev, unsigned int status);


/* NOTE: the two functions below are not intended for use outside
* of the DA9034 sub-device drivers
/* NOTE: the functions below are not intended for use outside
* of the DA903x sub-device drivers
*/
extern int da903x_write(struct device *dev, int reg, uint8_t val);
extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val);
extern int da903x_read(struct device *dev, int reg, uint8_t *val);
extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val);
extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
Expand Down

0 comments on commit 856f6fd

Please sign in to comment.