htcleo: Back to our old battery driver. We have to find some stuff more about our battery to get it real good wrokring.

Revert "htcleo: fixed USB charging problems in some configurations and cleanups"

This reverts commit d28b1aa6d6f204a9184c06631228241593960a39.

Conflicts:

	arch/arm/mach-msm/board-htcleo.c
This commit is contained in:
Markinus 2010-11-14 18:26:50 +01:00
parent d71283a773
commit 0eba6e9d4d
3 changed files with 104 additions and 14 deletions

View File

@ -112,7 +112,6 @@ struct htc_battery_info {
int gpio_usb_id;
int gpio_mchg_en_n;
int gpio_iset;
int gpio_power;
int guage_driver;
int m2a_cable_detect;
int charger;
@ -336,20 +335,10 @@ static int init_batt_gpio(void)
if (htc_batt_info.gpio_mchg_en_n > 0 &&
gpio_request(htc_batt_info.gpio_mchg_en_n, "charger_en") < 0)
goto gpio_failed;
else
gpio_direction_output(htc_batt_info.gpio_mchg_en_n, 1);
if (htc_batt_info.gpio_iset > 0 &&
gpio_request(htc_batt_info.gpio_iset, "charge_current") < 0)
goto gpio_failed;
else
gpio_direction_output(htc_batt_info.gpio_iset, 1);
if (htc_batt_info.gpio_power > 0 &&
gpio_request(htc_batt_info.gpio_power, "usb_power") < 0)
goto gpio_failed;
else
gpio_direction_output(htc_batt_info.gpio_power, 0);
return 0;
gpio_failed:
@ -365,6 +354,7 @@ gpio_failed:
int battery_charging_ctrl(enum batt_ctl_t ctl)
{
int result = 0;
if (!htc_battery_initial) return 0;
switch (ctl) {
@ -1573,10 +1563,9 @@ static struct notifier_block ds2784_notifier = {
static int htc_battery_probe(struct platform_device *pdev)
{
struct htc_battery_platform_data *pdata = pdev->dev.platform_data;
htc_batt_info.device_id = pdev->id;
htc_batt_info.gpio_usb_id = pdata->gpio_usb_id;
htc_batt_info.gpio_power = pdata->gpio_power;
htc_batt_info.guage_driver = pdata->guage_driver;
htc_batt_info.m2a_cable_detect = pdata->m2a_cable_detect;
htc_batt_info.func_show_batt_attr = pdata->func_show_batt_attr;

View File

@ -0,0 +1,102 @@
#ifndef __LEO_BATTERY__
#define __LEO_BATTERY__
#include <linux/android_alarm.h>
#define LEO_BATTERY_CAPACITY 1230
#define LEO_BATTERY_EMPTY 500
// from board-htcleo-power.c
extern int is_ac_power_supplied(void);
// from board-htcleo-log.c
extern double log(double x);
#define RAW_DATA_SIZE 10
struct battery_status
{
int timestamp;
int voltage_uV; /* units of uV */
int current_uA; /* units of uA */
int current_avg_uA;
int charge_uAh;
s16 temp_C; /* units of 0.1 C */
u8 percentage; /* battery percentage */
u8 charge_source;
u8 status_reg;
u8 battery_full; /* battery full (don't charge) */
u8 cooldown; /* was overtemp */
u8 charge_mode;
} __attribute__((packed));
#define SOURCE_NONE 0
#define SOURCE_USB 1
#define SOURCE_AC 2
#define CHARGE_OFF 0
#define CHARGE_SLOW 1
#define CHARGE_FAST 2
#define TEMP_CRITICAL 600 /* no charging at all */
#define TEMP_HOT 500 /* no fast charge, no charge > 4.1v */
#define TEMP_WARM 450 /* no fast charge above this */
#define TEMP_HOT_MAX_MV 4100 /* stop charging here when hot */
#define TEMP_HOT_MIN_MV 3800 /* resume charging here when hot */
#define CE_DISABLE_MIN_MV 4100
/* When we're awake or running on wall power, sample the battery
* gauge every FAST_POLL seconds. If we're asleep and on battery
* power, sample every SLOW_POLL seconds
*/
#define FAST_POLL (1 * 60)
#define SLOW_POLL (10 * 60)
struct htcleo_device_info
{
struct device *dev;
/* DS2784 data, valid after calling htcleo_battery_read_status() */
char raw[RAW_DATA_SIZE]; /* raw HTCLEO data */
uint32_t raw_status;
struct battery_status status;
struct power_supply bat;
struct workqueue_struct *monitor_wqueue;
struct work_struct monitor_work;
struct alarm alarm;
struct wake_lock work_wake_lock;
// int (*charge)(int on, int fast);
// struct w1_slave *w1_slave;
struct i2c_client *client;
u8 dummy; /* dummy battery flag */
u8 last_charge_mode; /* previous charger state */
u8 slow_poll;
ktime_t last_poll;
ktime_t last_charge_seen;
};
static struct htcleo_device_info * mydi = NULL;
#define psy_to_dev_info(x) container_of((x), struct htcleo_device_info, bat)
static struct wake_lock vbus_wake_lock;
#define to_htcleo_device_info(x) container_of((x), struct htcleo_device_info, bat);
#endif

View File

@ -74,7 +74,6 @@ struct htc_battery_platform_data {
int gpio_usb_id;
int gpio_mchg_en_n;
int gpio_iset;
int gpio_power;
int guage_driver;
int m2a_cable_detect;
int charger;