mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
power: supply: qti_battery_charger: add more properties for wireless psy
Add more power supply properties related to wireless charging. - /sys/class/power_supply/wireless/input_current_limit - /sys/class/power_supply/wireless/temp - /sys/class/qcom-battery/wireless_type This is useful for testing. Change-Id: I5fe57c0eafbd43fe19863c9b38a1292af4ba5360 Signed-off-by: Subbaraman Narayanamurthy <quic_subbaram@quicinc.com>
This commit is contained in:
parent
cdb44b2824
commit
63b27a40b8
|
|
@ -122,6 +122,10 @@ enum wireless_property_id {
|
|||
WLS_CURR_MAX,
|
||||
WLS_TYPE,
|
||||
WLS_BOOST_EN,
|
||||
WLS_HBOOST_VMAX,
|
||||
WLS_INPUT_CURR_LIMIT,
|
||||
WLS_ADAP_TYPE,
|
||||
WLS_CONN_TEMP,
|
||||
WLS_PROP_MAX,
|
||||
};
|
||||
|
||||
|
|
@ -298,6 +302,8 @@ static const int wls_prop_map[WLS_PROP_MAX] = {
|
|||
[WLS_VOLT_MAX] = POWER_SUPPLY_PROP_VOLTAGE_MAX,
|
||||
[WLS_CURR_NOW] = POWER_SUPPLY_PROP_CURRENT_NOW,
|
||||
[WLS_CURR_MAX] = POWER_SUPPLY_PROP_CURRENT_MAX,
|
||||
[WLS_INPUT_CURR_LIMIT] = POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
|
||||
[WLS_CONN_TEMP] = POWER_SUPPLY_PROP_TEMP,
|
||||
};
|
||||
|
||||
/* Standard usb_type definitions similar to power_supply_sysfs.c */
|
||||
|
|
@ -311,6 +317,11 @@ static const char * const qc_power_supply_usb_type_text[] = {
|
|||
"HVDCP", "HVDCP_3", "HVDCP_3P5"
|
||||
};
|
||||
|
||||
/* wireless_type definitions */
|
||||
static const char * const qc_power_supply_wls_type_text[] = {
|
||||
"Unknown", "BPP", "EPP", "HPP"
|
||||
};
|
||||
|
||||
static RAW_NOTIFIER_HEAD(hboost_notifier);
|
||||
|
||||
int register_hboost_event_notifier(struct notifier_block *nb)
|
||||
|
|
@ -901,6 +912,8 @@ static enum power_supply_property wls_props[] = {
|
|||
POWER_SUPPLY_PROP_VOLTAGE_MAX,
|
||||
POWER_SUPPLY_PROP_CURRENT_NOW,
|
||||
POWER_SUPPLY_PROP_CURRENT_MAX,
|
||||
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
|
||||
POWER_SUPPLY_PROP_TEMP,
|
||||
};
|
||||
|
||||
static const struct power_supply_desc wls_psy_desc = {
|
||||
|
|
@ -913,6 +926,14 @@ static const struct power_supply_desc wls_psy_desc = {
|
|||
.property_is_writeable = wls_psy_prop_is_writeable,
|
||||
};
|
||||
|
||||
static const char *get_wls_type_name(u32 wls_type)
|
||||
{
|
||||
if (wls_type >= ARRAY_SIZE(qc_power_supply_wls_type_text))
|
||||
return "Unknown";
|
||||
|
||||
return qc_power_supply_wls_type_text[wls_type];
|
||||
}
|
||||
|
||||
static const char *get_usb_type_name(u32 usb_type)
|
||||
{
|
||||
u32 i;
|
||||
|
|
@ -1583,6 +1604,23 @@ static ssize_t wireless_fw_update_store(struct class *c,
|
|||
}
|
||||
static CLASS_ATTR_WO(wireless_fw_update);
|
||||
|
||||
static ssize_t wireless_type_show(struct class *c,
|
||||
struct class_attribute *attr, char *buf)
|
||||
{
|
||||
struct battery_chg_dev *bcdev = container_of(c, struct battery_chg_dev,
|
||||
battery_class);
|
||||
struct psy_state *pst = &bcdev->psy_list[PSY_TYPE_WLS];
|
||||
int rc;
|
||||
|
||||
rc = read_property_id(bcdev, pst, WLS_ADAP_TYPE);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%s\n",
|
||||
get_wls_type_name(pst->prop[WLS_ADAP_TYPE]));
|
||||
}
|
||||
static CLASS_ATTR_RO(wireless_type);
|
||||
|
||||
static ssize_t usb_typec_compliant_show(struct class *c,
|
||||
struct class_attribute *attr, char *buf)
|
||||
{
|
||||
|
|
@ -1867,6 +1905,7 @@ static struct attribute *battery_class_attrs[] = {
|
|||
&class_attr_wireless_fw_version.attr,
|
||||
&class_attr_wireless_fw_crc.attr,
|
||||
&class_attr_wireless_fw_update_time_ms.attr,
|
||||
&class_attr_wireless_type.attr,
|
||||
&class_attr_ship_mode_en.attr,
|
||||
&class_attr_restrict_chg.attr,
|
||||
&class_attr_restrict_cur.attr,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user