Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e07e2f7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power_supply: add HW_CURRENT_MAX power_supply property"

parents 3efdb599 8e2afd27
Loading
Loading
Loading
Loading
+58 −7
Original line number Diff line number Diff line
@@ -43,11 +43,11 @@ static struct device_attribute power_supply_attrs[];
static ssize_t power_supply_show_property(struct device *dev,
					  struct device_attribute *attr,
					  char *buf) {
	static char *type_text[] = {
		"Unknown", "Battery", "UPS", "Mains", "USB",
		"USB_DCP", "USB_CDP", "USB_ACA",
		"USB_HVDCP", "USB_HVDCP_3", "Wireless", "BMS", "USB_Parallel",
		"Wipower", "TYPEC", "TYPEC_UFP", "TYPEC_DFP"
	static const char * const type_text[] = {
		"Unknown", "Battery", "UPS", "Mains", "USB", "USB_DCP",
		"USB_CDP", "USB_ACA", "USB_HVDCP", "USB_HVDCP_3", "USB_PD",
		"Wireless", "BMS", "Parallel", "Main", "Wipower",
		"TYPEC", "TYPEC_UFP", "TYPEC_DFP"
	};
	static char *status_text[] = {
		"Unknown", "Charging", "Discharging", "Not charging", "Full"
@@ -60,7 +60,7 @@ static ssize_t power_supply_show_property(struct device *dev,
		"Unknown", "Good", "Overheat", "Dead", "Over voltage",
		"Unspecified failure", "Cold", "Watchdog timer expire",
		"Safety timer expire",
		"Warm", "Cool"
		"Warm", "Cool", "Hot"
	};
	static char *technology_text[] = {
		"Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
@@ -72,6 +72,17 @@ static ssize_t power_supply_show_property(struct device *dev,
	static char *scope_text[] = {
		"Unknown", "System", "Device"
	};
	static const char * const typec_text[] = {
		"Nothing attached", "Sink attached", "Powered cable w/ sink",
		"Debug Accessory", "Audio Adapter", "Powered cable w/o sink",
		"Source attached (default current)",
		"Source attached (medium current)",
		"Source attached (high current)",
		"Non compliant",
	};
	static const char * const typec_pr_text[] = {
		"none", "dual power role", "sink", "source"
	};
	ssize_t ret = 0;
	struct power_supply *psy = dev_get_drvdata(dev);
	const ptrdiff_t off = attr - power_supply_attrs;
@@ -107,6 +118,18 @@ static ssize_t power_supply_show_property(struct device *dev,
		return sprintf(buf, "%s\n", type_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_SCOPE)
		return sprintf(buf, "%s\n", scope_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_TYPEC_MODE)
		return snprintf(buf, PAGE_SIZE,
					"%s\n", typec_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_TYPEC_POWER_ROLE)
		return snprintf(buf, PAGE_SIZE,
					"%s\n", typec_pr_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_DIE_HEALTH)
		return snprintf(buf, PAGE_SIZE,
					"%s\n", health_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_CONNECTOR_HEALTH)
		return snprintf(buf, PAGE_SIZE,
					"%s\n", health_text[value.intval]);
	else if (off >= POWER_SUPPLY_PROP_MODEL_NAME)
		return sprintf(buf, "%s\n", value.strval);

@@ -210,14 +233,17 @@ static struct device_attribute power_supply_attrs[] = {
	/* Local extensions */
	POWER_SUPPLY_ATTR(usb_hc),
	POWER_SUPPLY_ATTR(usb_otg),
	POWER_SUPPLY_ATTR(charge_enabled),
	POWER_SUPPLY_ATTR(battery_charging_enabled),
	POWER_SUPPLY_ATTR(charging_enabled),
	POWER_SUPPLY_ATTR(step_charging_enabled),
	POWER_SUPPLY_ATTR(step_charging_step),
	POWER_SUPPLY_ATTR(pin_enabled),
	POWER_SUPPLY_ATTR(input_suspend),
	POWER_SUPPLY_ATTR(input_voltage_regulation),
	POWER_SUPPLY_ATTR(input_current_max),
	POWER_SUPPLY_ATTR(input_current_trim),
	POWER_SUPPLY_ATTR(input_current_settled),
	POWER_SUPPLY_ATTR(input_voltage_settled),
	POWER_SUPPLY_ATTR(bypass_vchg_loop_debouncer),
	POWER_SUPPLY_ATTR(charge_counter_shadow),
	POWER_SUPPLY_ATTR(hi_power),
@@ -232,6 +258,8 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(flash_current_max),
	POWER_SUPPLY_ATTR(update_now),
	POWER_SUPPLY_ATTR(esr_count),
	POWER_SUPPLY_ATTR(buck_freq),
	POWER_SUPPLY_ATTR(boost_current),
	POWER_SUPPLY_ATTR(safety_timer_enabled),
	POWER_SUPPLY_ATTR(charge_done),
	POWER_SUPPLY_ATTR(flash_active),
@@ -240,6 +268,9 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(dp_dm),
	POWER_SUPPLY_ATTR(input_current_limited),
	POWER_SUPPLY_ATTR(input_current_now),
	POWER_SUPPLY_ATTR(charge_qnovo_enable),
	POWER_SUPPLY_ATTR(current_qnovo),
	POWER_SUPPLY_ATTR(voltage_qnovo),
	POWER_SUPPLY_ATTR(rerun_aicl),
	POWER_SUPPLY_ATTR(cycle_count_id),
	POWER_SUPPLY_ATTR(safety_timer_expired),
@@ -254,6 +285,26 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(enable_jeita_detection),
	POWER_SUPPLY_ATTR(battery_info),
	POWER_SUPPLY_ATTR(battery_info_id),
	POWER_SUPPLY_ATTR(typec_cc_orientation),
	POWER_SUPPLY_ATTR(typec_power_role),
	POWER_SUPPLY_ATTR(pd_allowed),
	POWER_SUPPLY_ATTR(pd_active),
	POWER_SUPPLY_ATTR(pd_in_hard_reset),
	POWER_SUPPLY_ATTR(pd_current_max),
	POWER_SUPPLY_ATTR(pd_usb_suspend_supported),
	POWER_SUPPLY_ATTR(charger_temp),
	POWER_SUPPLY_ATTR(charger_temp_max),
	POWER_SUPPLY_ATTR(parallel_disable),
	POWER_SUPPLY_ATTR(pe_start),
	POWER_SUPPLY_ATTR(set_ship_mode),
	POWER_SUPPLY_ATTR(debug_battery),
	POWER_SUPPLY_ATTR(fcc_delta),
	POWER_SUPPLY_ATTR(icl_reduction),
	POWER_SUPPLY_ATTR(parallel_mode),
	POWER_SUPPLY_ATTR(ctm_current_max),
	POWER_SUPPLY_ATTR(die_health),
	POWER_SUPPLY_ATTR(connector_health),
	POWER_SUPPLY_ATTR(hw_current_max),
	/* Local extensions of type int64_t */
	POWER_SUPPLY_ATTR(charge_counter_ext),
	/* Properties of type `const char *' */
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -3134,8 +3134,8 @@ static int qpnp_lbc_parallel_probe(struct spmi_device *spmi)
		return rc;
	}

	chip->parallel_psy.name		= "usb-parallel";
	chip->parallel_psy.type		= POWER_SUPPLY_TYPE_USB_PARALLEL;
	chip->parallel_psy.name		= "parallel";
	chip->parallel_psy.type		= POWER_SUPPLY_TYPE_PARALLEL;
	chip->parallel_psy.get_property	= qpnp_lbc_parallel_get_property;
	chip->parallel_psy.set_property	= qpnp_lbc_parallel_set_property;
	chip->parallel_psy.properties	= qpnp_lbc_parallel_properties;
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -4668,8 +4668,8 @@ static int smb1351_parallel_slave_probe(struct i2c_client *client,
	i2c_set_clientdata(client, chip);
	mutex_init(&chip->parallel_config_lock);

	chip->parallel_psy.name		= "usb-parallel";
	chip->parallel_psy.type		= POWER_SUPPLY_TYPE_USB_PARALLEL;
	chip->parallel_psy.name		= "parallel";
	chip->parallel_psy.type		= POWER_SUPPLY_TYPE_PARALLEL;
	chip->parallel_psy.get_property	= smb1351_parallel_get_property;
	chip->parallel_psy.set_property	= smb1351_parallel_set_property;
	chip->parallel_psy.properties	= smb1351_parallel_properties;
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -4454,8 +4454,8 @@ static int smb135x_parallel_charger_probe(struct i2c_client *client,

	i2c_set_clientdata(client, chip);

	chip->parallel_psy.name		= "usb-parallel";
	chip->parallel_psy.type		= POWER_SUPPLY_TYPE_USB_PARALLEL;
	chip->parallel_psy.name		= "parallel";
	chip->parallel_psy.type		= POWER_SUPPLY_TYPE_PARALLEL;
	chip->parallel_psy.get_property	= smb135x_parallel_get_property;
	chip->parallel_psy.set_property	= smb135x_parallel_set_property;
	chip->parallel_psy.properties	= smb135x_parallel_properties;
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2016 The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1326,8 +1326,8 @@ static int smb138x_init_parallel_psy(struct smb138x *chip)
	int rc = 0;
	struct smb_charger *chg = &chip->chg;

	chg->parallel_psy.name		= "usb-parallel";
	chg->parallel_psy.type		= POWER_SUPPLY_TYPE_USB_PARALLEL;
	chg->parallel_psy.name		= "parallel";
	chg->parallel_psy.type		= POWER_SUPPLY_TYPE_PARALLEL;
	chg->parallel_psy.properties	= smb138x_parallel_props;
	chg->parallel_psy.num_properties	=
					ARRAY_SIZE(smb138x_parallel_props);
Loading