mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
add rk30 adc battery checker
This commit is contained in:
22
arch/arm/mach-rk30/board-rk30-sdk.c
Executable file → Normal file
22
arch/arm/mach-rk30/board-rk30-sdk.c
Executable file → Normal file
@@ -1117,6 +1117,25 @@ static struct platform_device rk29sdk_rfkill = {
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_BATTERY_RK30_ADC
|
||||
static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
|
||||
.dc_det_pin = RK30_PIN6_PA5,
|
||||
.batt_low_pin = RK30_PIN6_PA0,
|
||||
.charge_set_pin = INVALID_GPIO,
|
||||
.charge_ok_pin = RK30_PIN6_PA6,
|
||||
.dc_det_level = GPIO_LOW,
|
||||
.charge_ok_level = GPIO_HIGH,
|
||||
};
|
||||
|
||||
static struct platform_device rk30_device_adc_battery = {
|
||||
.name = "rk30-battery",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk30_adc_battery_platdata,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
/**************************************************************************************************
|
||||
* the end of setting for SDMMC devices
|
||||
**************************************************************************************************/
|
||||
@@ -1149,6 +1168,9 @@ static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_RK29_SUPPORT_MODEM
|
||||
&rk30_device_modem,
|
||||
#endif
|
||||
#ifdef CONFIG_BATTERY_RK30_ADC
|
||||
&rk30_device_adc_battery,
|
||||
#endif
|
||||
};
|
||||
|
||||
// i2c
|
||||
|
||||
@@ -24,6 +24,24 @@ struct rk30_i2c_platform_data {
|
||||
int (*io_deinit)(void);
|
||||
};
|
||||
|
||||
/* adc battery */
|
||||
struct rk30_adc_battery_platform_data {
|
||||
int (*io_init)(void);
|
||||
int (*io_deinit)(void);
|
||||
|
||||
int dc_det_pin;
|
||||
int batt_low_pin;
|
||||
int charge_ok_pin;
|
||||
int charge_set_pin;
|
||||
|
||||
// int adc_channel;
|
||||
|
||||
int dc_det_level;
|
||||
int batt_low_level;
|
||||
int charge_ok_level;
|
||||
int charge_set_level;
|
||||
};
|
||||
|
||||
#ifndef _LINUX_WLAN_PLAT_H_
|
||||
struct wifi_platform_data {
|
||||
int (*set_power)(int val);
|
||||
|
||||
@@ -304,6 +304,24 @@ config BATTERY_RK29_AC_CHARGE
|
||||
help
|
||||
say Y to enable suspport for the AC battery charge
|
||||
|
||||
config BATTERY_RK30_ADC
|
||||
tristate "RK30 ADC Battery"
|
||||
depends on ADC_RK30
|
||||
help
|
||||
Say Y to enable support for the battery on the RK30.
|
||||
|
||||
config BATTERY_RK30_AC_CHARGE
|
||||
tristate "RK30 AC CHARGE"
|
||||
depends on BATTERY_RK30_ADC
|
||||
help
|
||||
say Y to enable suspport for the AC battery charge
|
||||
|
||||
config BATTERY_RK30_VOL3V8
|
||||
tristate "the battery voltage is 3.8V"
|
||||
depends on BATTERY_RK30_ADC
|
||||
help
|
||||
say Y to enable suspport for the battery voltage 3.8V
|
||||
|
||||
config POWER_ON_CHARGER_DISPLAY
|
||||
bool "Support charger display"
|
||||
|
||||
|
||||
@@ -42,4 +42,5 @@ obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
|
||||
obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o
|
||||
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
|
||||
obj-$(CONFIG_BATTERY_RK29_ADC) += rk29_adc_battery.o
|
||||
obj-$(CONFIG_BATTERY_RK30_ADC) += rk30_adc_battery.o
|
||||
obj-$(CONFIG_POWER_ON_CHARGER_DISPLAY) += rk29_charger_display.o
|
||||
|
||||
@@ -94,7 +94,7 @@ static int __init start_charge_logo_display(void)
|
||||
val_status.intval = POWER_SUPPLY_STATUS_CHARGING;
|
||||
|
||||
// low power and discharging
|
||||
|
||||
#if 0
|
||||
if((val_capacity.intval < pwr_on_thrsd )&&(val_status.intval != POWER_SUPPLY_STATUS_CHARGING))
|
||||
{
|
||||
printk("low power\n");
|
||||
@@ -102,8 +102,9 @@ static int __init start_charge_logo_display(void)
|
||||
while(1);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
//low power and charging
|
||||
if((val_capacity.intval < pwr_on_thrsd )&&(val_status.intval == POWER_SUPPLY_STATUS_CHARGING))
|
||||
{
|
||||
@@ -117,7 +118,7 @@ static int __init start_charge_logo_display(void)
|
||||
//printk("charging ... \n");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
if(val_status.intval == POWER_SUPPLY_STATUS_CHARGING)
|
||||
|
||||
1295
drivers/power/rk30_adc_battery.c
Executable file
1295
drivers/power/rk30_adc_battery.c
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user