Skip to content
Permalink
Browse files

huawei_battery: allow disabling BATT_ID and RESISTANCE_ID RPC

u8815 does not support this and it's very spammy.
  • Loading branch information
Dazzozo committed Oct 15, 2013
1 parent ecb80dd commit 55bea67e53faae2588d1c34a6f409ad00a1b57f0
Showing with 23 additions and 1 deletion.
  1. +1 −0 arch/arm/configs/u8815_defconfig
  2. +1 −0 arch/arm/configs/u8833_defconfig
  3. +6 −0 drivers/power/Kconfig
  4. +15 −1 drivers/power/huawei_battery.c
@@ -1744,6 +1744,7 @@ CONFIG_BATTERY_MSM=y
# CONFIG_CHARGER_SMB347 is not set
# CONFIG_HUAWEI_FEATURE_DC_DC_CHARGER is not set
CONFIG_HUAWEI_EVALUATE_POWER_CONSUMPTION=y
CONFIG_HUAWEI_NO_BATT_ID_RPC=y
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_HWMON_DEBUG_CHIP is not set
@@ -1750,6 +1750,7 @@ CONFIG_BATTERY_MSM=y
# CONFIG_CHARGER_SMB347 is not set
# CONFIG_HUAWEI_FEATURE_DC_DC_CHARGER is not set
CONFIG_HUAWEI_EVALUATE_POWER_CONSUMPTION=y
# CONFIG_HUAWEI_NO_BATT_ID_RPC is not set
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_HWMON_DEBUG_CHIP is not set
@@ -445,3 +445,9 @@ config HUAWEI_EVALUATE_POWER_CONSUMPTION
tristate "huawei_evaluate_power_consumption"
help
Say Y here if you want to support huawei evaluate power consumption.

config HUAWEI_NO_BATT_ID_RPC
bool "Disable BATT_ID and RESISTANCE_ID RPC"
help
Say Y here to disable BATT_ID and RESISTANCE_ID RPC on targets that
don't support it.
@@ -632,6 +632,7 @@ static int msm_batt_get_volt_ret_func(struct msm_rpc_client *batt_client,

return 0;
}
#ifndef CONFIG_HUAWEI_NO_BATT_ID_RPC
#ifdef CONFIG_HUAWEI_KERNEL
struct msm_batt_get_batt_id_data {
u32 batt_id ;
@@ -646,6 +647,7 @@ static int msm_batt_get_batt_id_func(struct msm_rpc_client *batt_client,
return 0;
}
#endif
#endif
static u32 msm_batt_get_vbatt_voltage(void)
{
int rc;
@@ -665,6 +667,7 @@ static u32 msm_batt_get_vbatt_voltage(void)

return rep.battery_voltage;
}
#ifndef CONFIG_HUAWEI_NO_BATT_ID_RPC
/*function is get battery limit voltage */
#ifdef CONFIG_HUAWEI_KERNEL
static u32 msm_batt_get_batt_id(void)
@@ -686,6 +689,7 @@ static u32 msm_batt_get_batt_id(void)
return rep.batt_id;
}
#endif
#endif
/* the RPC function to get the charge state from modem side */
struct msm_batt_get_charge_state_ret_data {
u32 chg_state;
@@ -779,6 +783,7 @@ static void msm_batt_update_psy_status(void)
struct power_supply *supp;

u32 battery_capacity;
#ifndef CONFIG_HUAWEI_NO_BATT_ID_RPC
u32 battery_max_voltage = 0;
if(CHG_LIMIT_VOLT==msm_batt_get_batt_id())
{
@@ -790,6 +795,7 @@ static void msm_batt_update_psy_status(void)
battery_max_voltage = HEALTH_VOLT_MAX ;
msm_batt_info.voltage_max_design = BATTERY_HIGH;
}
#endif
if (msm_batt_get_batt_chg_status())
return;

@@ -1009,7 +1015,11 @@ static void msm_batt_update_psy_status(void)
{
msm_batt_info.batt_health = POWER_SUPPLY_HEALTH_COLD;
}
else if(battery_voltage > battery_max_voltage)
#ifndef CONFIG_HUAWEI_NO_BATT_ID_RPC
else if(battery_voltage > battery_max_voltage)
#else
else if(battery_voltage > HEALTH_VOLT_MAX)
#endif
{
msm_batt_info.batt_health = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
}
@@ -1695,6 +1705,7 @@ static int msm_batt_set_chg_limit_current(u32 chg_limit_curent)
return 0;
}
#endif
#ifndef CONFIG_HUAWEI_NO_BATT_ID_RPC
/* rpc data struct for battery manufacturer id */
struct msm_batt_resistance_id_data {
u32 resistance_id;
@@ -1732,13 +1743,16 @@ static u32 msm_batt_manufacturer_id(void)

return rep.resistance_id;
}
#endif

/* return -1 means the battery no manufacturer id info*/
#define BATTERY_RESISTANCE_MV_DEFAULT 0xFF
hw_battery_id_mv get_battery_resistance_id(void)
{
hw_battery_id_mv batt_id = -1;
#ifndef CONFIG_HUAWEI_NO_BATT_ID_RPC
batt_id = (hw_battery_id_mv)msm_batt_manufacturer_id();
#endif
return batt_id;
}
static int msm_batt_cleanup(void)

0 comments on commit 55bea67

Please sign in to comment.
You can’t perform that action at this time.