power: supply: qti_battery_charger: Guard power properties changes against Venus
* The XM properties in the power supply kernel driver header files must match the one in ADSP firmware * These properties are used to map ADSP FW properties so we can expose values like charging speed to kernel, and then expose them to userspace using nodes * Since most Xiaomi lahaina devices after Venus introduced major changes to the power supply kernel driver, these properties in header files got additions, this breaks reporting * Guard non-venus properties under the lack of a venus-specific flag Change-Id: Ic1d2256f7acdb624b8f913608cdd55285d3fff2d
This commit is contained in:
parent
4ac66c04c2
commit
d7a0b31461
@ -454,6 +454,12 @@ config RENOIR_FOR_BUILD
|
|||||||
help
|
help
|
||||||
Say Y here to enable renoir build debug
|
Say Y here to enable renoir build debug
|
||||||
|
|
||||||
|
config VENUS_FOR_BUILD
|
||||||
|
bool "venus build debug"
|
||||||
|
depends on QTI_BATTERY_CHARGER
|
||||||
|
help
|
||||||
|
Say Y here to enable venus build debug
|
||||||
|
|
||||||
config CHARGER_88PM860X
|
config CHARGER_88PM860X
|
||||||
tristate "Marvell 88PM860x Charger driver"
|
tristate "Marvell 88PM860x Charger driver"
|
||||||
depends on MFD_88PM860X && BATTERY_88PM860X
|
depends on MFD_88PM860X && BATTERY_88PM860X
|
||||||
|
@ -211,7 +211,9 @@ enum xm_property_id {
|
|||||||
XM_PROP_BQ2597X_BATTERY_VOLTAGE,
|
XM_PROP_BQ2597X_BATTERY_VOLTAGE,
|
||||||
XM_PROP_COOL_MODE,
|
XM_PROP_COOL_MODE,
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
XM_PROP_BT_TRANSFER_START,
|
XM_PROP_BT_TRANSFER_START,
|
||||||
|
#endif
|
||||||
XM_PROP_MASTER_SMB1396_ONLINE,
|
XM_PROP_MASTER_SMB1396_ONLINE,
|
||||||
XM_PROP_MASTER_SMB1396_IIN,
|
XM_PROP_MASTER_SMB1396_IIN,
|
||||||
XM_PROP_SLAVE_SMB1396_ONLINE,
|
XM_PROP_SLAVE_SMB1396_ONLINE,
|
||||||
@ -226,7 +228,9 @@ enum xm_property_id {
|
|||||||
XM_PROP_BT_STATE,
|
XM_PROP_BT_STATE,
|
||||||
XM_PROP_REVERSE_CHG_MODE,
|
XM_PROP_REVERSE_CHG_MODE,
|
||||||
XM_PROP_REVERSE_CHG_STATE,
|
XM_PROP_REVERSE_CHG_STATE,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
XM_PROP_WLS_FW_STATE,
|
XM_PROP_WLS_FW_STATE,
|
||||||
|
#endif
|
||||||
XM_PROP_RX_VOUT,
|
XM_PROP_RX_VOUT,
|
||||||
XM_PROP_RX_VRECT,
|
XM_PROP_RX_VRECT,
|
||||||
XM_PROP_RX_IOUT,
|
XM_PROP_RX_IOUT,
|
||||||
@ -234,7 +238,9 @@ enum xm_property_id {
|
|||||||
XM_PROP_OP_MODE,
|
XM_PROP_OP_MODE,
|
||||||
XM_PROP_WLS_DIE_TEMP,
|
XM_PROP_WLS_DIE_TEMP,
|
||||||
XM_PROP_WLS_CAR_ADAPTER,
|
XM_PROP_WLS_CAR_ADAPTER,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
XM_PROP_WLS_TX_SPEED,
|
XM_PROP_WLS_TX_SPEED,
|
||||||
|
#endif
|
||||||
/**********************/
|
/**********************/
|
||||||
XM_PROP_INPUT_SUSPEND,
|
XM_PROP_INPUT_SUSPEND,
|
||||||
XM_PROP_REAL_TYPE,
|
XM_PROP_REAL_TYPE,
|
||||||
@ -247,15 +253,19 @@ enum xm_property_id {
|
|||||||
XM_PROP_VDM_CMD_AUTHENTICATION,
|
XM_PROP_VDM_CMD_AUTHENTICATION,
|
||||||
XM_PROP_VDM_CMD_VERIFIED,
|
XM_PROP_VDM_CMD_VERIFIED,
|
||||||
XM_PROP_VDM_CMD_REMOVE_COMPENSATION,
|
XM_PROP_VDM_CMD_REMOVE_COMPENSATION,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
XM_PROP_VDM_CMD_REVERSE_AUTHEN,
|
XM_PROP_VDM_CMD_REVERSE_AUTHEN,
|
||||||
|
#endif
|
||||||
XM_PROP_CURRENT_STATE,
|
XM_PROP_CURRENT_STATE,
|
||||||
XM_PROP_ADAPTER_ID,
|
XM_PROP_ADAPTER_ID,
|
||||||
XM_PROP_ADAPTER_SVID,
|
XM_PROP_ADAPTER_SVID,
|
||||||
XM_PROP_PD_VERIFED,
|
XM_PROP_PD_VERIFED,
|
||||||
XM_PROP_PDO2,
|
XM_PROP_PDO2,
|
||||||
XM_PROP_UVDM_STATE,
|
XM_PROP_UVDM_STATE,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
/* use for MI SMART INTERCHG */
|
/* use for MI SMART INTERCHG */
|
||||||
XM_PROP_VDM_CMD_SINK_SOC,
|
XM_PROP_VDM_CMD_SINK_SOC,
|
||||||
|
#endif
|
||||||
/*****************/
|
/*****************/
|
||||||
XM_PROP_WLS_BIN,
|
XM_PROP_WLS_BIN,
|
||||||
XM_PROP_FASTCHGMODE,
|
XM_PROP_FASTCHGMODE,
|
||||||
@ -273,6 +283,7 @@ enum xm_property_id {
|
|||||||
XM_PROP_THERMAL_TEMP,
|
XM_PROP_THERMAL_TEMP,
|
||||||
XM_PROP_TYPEC_MODE,
|
XM_PROP_TYPEC_MODE,
|
||||||
XM_PROP_NIGHT_CHARGING,
|
XM_PROP_NIGHT_CHARGING,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
XM_PROP_SMART_BATT,
|
XM_PROP_SMART_BATT,
|
||||||
XM_PROP_FG1_QMAX,
|
XM_PROP_FG1_QMAX,
|
||||||
XM_PROP_FG1_RM,
|
XM_PROP_FG1_RM,
|
||||||
@ -288,6 +299,7 @@ enum xm_property_id {
|
|||||||
XM_PROP_FG1_TREMQ,
|
XM_PROP_FG1_TREMQ,
|
||||||
XM_PROP_FG1_TFULLQ,
|
XM_PROP_FG1_TFULLQ,
|
||||||
XM_PROP_FG_UPDATE_TIME,
|
XM_PROP_FG_UPDATE_TIME,
|
||||||
|
#endif
|
||||||
XM_PROP_MAX,
|
XM_PROP_MAX,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
|
@ -1289,6 +1289,7 @@ static ssize_t cool_mode_show(struct class *c, struct class_attribute *attr,
|
|||||||
static CLASS_ATTR_RW(cool_mode);
|
static CLASS_ATTR_RW(cool_mode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
static ssize_t bt_transfer_start_store(struct class *c,
|
static ssize_t bt_transfer_start_store(struct class *c,
|
||||||
struct class_attribute *attr,
|
struct class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
@ -1339,6 +1340,7 @@ static ssize_t bt_transfer_start_show(struct class *c,
|
|||||||
pst->prop[XM_PROP_BT_TRANSFER_START]);
|
pst->prop[XM_PROP_BT_TRANSFER_START]);
|
||||||
}
|
}
|
||||||
static CLASS_ATTR_RW(bt_transfer_start);
|
static CLASS_ATTR_RW(bt_transfer_start);
|
||||||
|
#endif
|
||||||
|
|
||||||
static ssize_t master_smb1396_online_show(struct class *c,
|
static ssize_t master_smb1396_online_show(struct class *c,
|
||||||
struct class_attribute *attr,
|
struct class_attribute *attr,
|
||||||
@ -1746,6 +1748,7 @@ out:
|
|||||||
}
|
}
|
||||||
static CLASS_ATTR_RW(reverse_chg_mode);
|
static CLASS_ATTR_RW(reverse_chg_mode);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
static ssize_t wls_tx_speed_store(struct class *c, struct class_attribute *attr,
|
static ssize_t wls_tx_speed_store(struct class *c, struct class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
@ -1777,6 +1780,7 @@ static ssize_t wls_tx_speed_show(struct class *c, struct class_attribute *attr,
|
|||||||
return scnprintf(buf, PAGE_SIZE, "%u", pst->prop[XM_PROP_WLS_TX_SPEED]);
|
return scnprintf(buf, PAGE_SIZE, "%u", pst->prop[XM_PROP_WLS_TX_SPEED]);
|
||||||
}
|
}
|
||||||
static CLASS_ATTR_RW(wls_tx_speed);
|
static CLASS_ATTR_RW(wls_tx_speed);
|
||||||
|
#endif
|
||||||
|
|
||||||
static ssize_t reverse_chg_state_show(struct class *c,
|
static ssize_t reverse_chg_state_show(struct class *c,
|
||||||
struct class_attribute *attr, char *buf)
|
struct class_attribute *attr, char *buf)
|
||||||
@ -2053,6 +2057,7 @@ static ssize_t night_charging_show(struct class *c,
|
|||||||
}
|
}
|
||||||
static CLASS_ATTR_RW(night_charging);
|
static CLASS_ATTR_RW(night_charging);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
static ssize_t smart_batt_store(struct class *c, struct class_attribute *attr,
|
static ssize_t smart_batt_store(struct class *c, struct class_attribute *attr,
|
||||||
const char *buf, size_t count)
|
const char *buf, size_t count)
|
||||||
{
|
{
|
||||||
@ -2089,6 +2094,7 @@ static ssize_t smart_batt_show(struct class *c, struct class_attribute *attr,
|
|||||||
return scnprintf(buf, PAGE_SIZE, "%u\n", pst->prop[XM_PROP_SMART_BATT]);
|
return scnprintf(buf, PAGE_SIZE, "%u\n", pst->prop[XM_PROP_SMART_BATT]);
|
||||||
}
|
}
|
||||||
static CLASS_ATTR_RW(smart_batt);
|
static CLASS_ATTR_RW(smart_batt);
|
||||||
|
#endif
|
||||||
|
|
||||||
static ssize_t verify_process_store(struct class *c,
|
static ssize_t verify_process_store(struct class *c,
|
||||||
struct class_attribute *attr,
|
struct class_attribute *attr,
|
||||||
@ -2166,12 +2172,14 @@ static void usbpd_request_vdm_cmd(struct battery_chg_dev *bcdev,
|
|||||||
val = *data;
|
val = *data;
|
||||||
pr_err("AUTHENTICATION:data = %d\n", val);
|
pr_err("AUTHENTICATION:data = %d\n", val);
|
||||||
break;
|
break;
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
case USBPD_UVDM_REVERSE_AUTHEN:
|
case USBPD_UVDM_REVERSE_AUTHEN:
|
||||||
prop_id = XM_PROP_VDM_CMD_REVERSE_AUTHEN;
|
prop_id = XM_PROP_VDM_CMD_REVERSE_AUTHEN;
|
||||||
usbpd_sha256_bitswap32(data, USBPD_UVDM_SS_LEN);
|
usbpd_sha256_bitswap32(data, USBPD_UVDM_SS_LEN);
|
||||||
val = *data;
|
val = *data;
|
||||||
pr_err("AUTHENTICATION:data = %d\n", val);
|
pr_err("AUTHENTICATION:data = %d\n", val);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case USBPD_UVDM_REMOVE_COMPENSATION:
|
case USBPD_UVDM_REMOVE_COMPENSATION:
|
||||||
prop_id = XM_PROP_VDM_CMD_REMOVE_COMPENSATION;
|
prop_id = XM_PROP_VDM_CMD_REMOVE_COMPENSATION;
|
||||||
val = *data;
|
val = *data;
|
||||||
@ -2623,6 +2631,7 @@ static ssize_t typec_mode_show(struct class *c, struct class_attribute *attr,
|
|||||||
}
|
}
|
||||||
static CLASS_ATTR_RO(typec_mode);
|
static CLASS_ATTR_RO(typec_mode);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
static ssize_t fg1_qmax_show(struct class *c, struct class_attribute *attr,
|
static ssize_t fg1_qmax_show(struct class *c, struct class_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
@ -2835,6 +2844,7 @@ static ssize_t fg1_tfullq_show(struct class *c, struct class_attribute *attr,
|
|||||||
return scnprintf(buf, PAGE_SIZE, "%d\n", pst->prop[XM_PROP_FG1_TFULLQ]);
|
return scnprintf(buf, PAGE_SIZE, "%d\n", pst->prop[XM_PROP_FG1_TFULLQ]);
|
||||||
}
|
}
|
||||||
static CLASS_ATTR_RO(fg1_tfullq);
|
static CLASS_ATTR_RO(fg1_tfullq);
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct attribute *xiaomi_battery_class_attrs[] = {
|
static struct attribute *xiaomi_battery_class_attrs[] = {
|
||||||
&class_attr_wireless_register.attr,
|
&class_attr_wireless_register.attr,
|
||||||
@ -2887,7 +2897,9 @@ static struct attribute *xiaomi_battery_class_attrs[] = {
|
|||||||
&class_attr_bq2597x_battery_voltage.attr,
|
&class_attr_bq2597x_battery_voltage.attr,
|
||||||
&class_attr_cool_mode.attr,
|
&class_attr_cool_mode.attr,
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
&class_attr_bt_transfer_start.attr,
|
&class_attr_bt_transfer_start.attr,
|
||||||
|
#endif
|
||||||
&class_attr_master_smb1396_online.attr,
|
&class_attr_master_smb1396_online.attr,
|
||||||
&class_attr_master_smb1396_iin.attr,
|
&class_attr_master_smb1396_iin.attr,
|
||||||
&class_attr_slave_smb1396_online.attr,
|
&class_attr_slave_smb1396_online.attr,
|
||||||
@ -2914,7 +2926,9 @@ static struct attribute *xiaomi_battery_class_attrs[] = {
|
|||||||
&class_attr_op_mode.attr,
|
&class_attr_op_mode.attr,
|
||||||
&class_attr_wls_die_temp.attr,
|
&class_attr_wls_die_temp.attr,
|
||||||
&class_attr_wls_car_adapter.attr,
|
&class_attr_wls_car_adapter.attr,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
&class_attr_wls_tx_speed.attr,
|
&class_attr_wls_tx_speed.attr,
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/*****************************/
|
/*****************************/
|
||||||
&class_attr_input_suspend.attr,
|
&class_attr_input_suspend.attr,
|
||||||
@ -2938,6 +2952,7 @@ static struct attribute *xiaomi_battery_class_attrs[] = {
|
|||||||
&class_attr_qbg_temp.attr,
|
&class_attr_qbg_temp.attr,
|
||||||
&class_attr_typec_mode.attr,
|
&class_attr_typec_mode.attr,
|
||||||
&class_attr_night_charging.attr,
|
&class_attr_night_charging.attr,
|
||||||
|
#if !defined(CONFIG_VENUS_FOR_BUILD)
|
||||||
&class_attr_smart_batt.attr,
|
&class_attr_smart_batt.attr,
|
||||||
&class_attr_fg1_qmax.attr,
|
&class_attr_fg1_qmax.attr,
|
||||||
&class_attr_fg1_rm.attr,
|
&class_attr_fg1_rm.attr,
|
||||||
@ -2952,6 +2967,7 @@ static struct attribute *xiaomi_battery_class_attrs[] = {
|
|||||||
&class_attr_fg1_tambient.attr,
|
&class_attr_fg1_tambient.attr,
|
||||||
&class_attr_fg1_tremq.attr,
|
&class_attr_fg1_tremq.attr,
|
||||||
&class_attr_fg1_tfullq.attr,
|
&class_attr_fg1_tfullq.attr,
|
||||||
|
#endif
|
||||||
&class_attr_power_max.attr,
|
&class_attr_power_max.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user