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

Commit c2ccc0e9 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar
Browse files

power_supply: Add type and properties for parallel charger



USB Main charger type represents the main charging path. This will
be used to control charging parameters on the main charger.

FCC_DELTA property will be used to indicate whether hw implements
any FCC mitigation. This will be used to calculate the effective FCC
and set the FCC on the PMI.

PARALLEL_MODE property indicates whether the parallel charger chip is
configured in a mid-mid or usbin-usbin configuration.

ICL_REDUCTION property indicates by how much should the main charger
reduce its input current.

Change-Id: I3b064314e6b5c28a7ea9f79ac52f3a26749605fb
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent ea4719da
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ static ssize_t power_supply_show_property(struct device *dev,
	static char *type_text[] = {
		"Unknown", "Battery", "UPS", "Mains", "USB", "USB_DCP",
		"USB_CDP", "USB_ACA", "USB_HVDCP", "USB_HVDCP_3", "USB_PD",
		"Wireless", "BMS", "USB_Parallel", "Wipower",
		"Wireless", "BMS", "Parallel", "Main", "Wipower",
		"TYPEC", "TYPEC_UFP", "TYPEC_DFP"
	};
	static char *status_text[] = {
@@ -280,6 +280,9 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(set_ship_mode),
	POWER_SUPPLY_ATTR(soc_reporting_ready),
	POWER_SUPPLY_ATTR(debug_battery),
	POWER_SUPPLY_ATTR(fcc_delta),
	POWER_SUPPLY_ATTR(icl_reduction),
	POWER_SUPPLY_ATTR(parallel_mode),
	/* 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) 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
@@ -3158,8 +3158,8 @@ static int smb1351_parallel_charger_probe(struct i2c_client *client,

	i2c_set_clientdata(client, chip);

	chip->parallel_psy_d.name = "usb-parallel";
	chip->parallel_psy_d.type = POWER_SUPPLY_TYPE_USB_PARALLEL;
	chip->parallel_psy_d.name = "parallel";
	chip->parallel_psy_d.type = POWER_SUPPLY_TYPE_PARALLEL;
	chip->parallel_psy_d.get_property = smb1351_parallel_get_property;
	chip->parallel_psy_d.set_property = smb1351_parallel_set_property;
	chip->parallel_psy_d.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
@@ -4378,8 +4378,8 @@ static int smb135x_parallel_charger_probe(struct i2c_client *client,

	i2c_set_clientdata(client, chip);

	chip->parallel_psy_d.name = "usb-parallel";
	chip->parallel_psy_d.type = POWER_SUPPLY_TYPE_USB_PARALLEL;
	chip->parallel_psy_d.name = "parallel";
	chip->parallel_psy_d.type = POWER_SUPPLY_TYPE_PARALLEL;
	chip->parallel_psy_d.get_property = smb135x_parallel_get_property;
	chip->parallel_psy_d.set_property = smb135x_parallel_set_property;
	chip->parallel_psy_d.properties	= smb135x_parallel_properties;
+1 −1
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ static int smb138x_parallel_prop_is_writeable(struct power_supply *psy,

static const struct power_supply_desc parallel_psy_desc = {
	.name			= "parallel",
	.type			= POWER_SUPPLY_TYPE_USB_PARALLEL,
	.type			= POWER_SUPPLY_TYPE_PARALLEL,
	.properties		= smb138x_parallel_props,
	.num_properties		= ARRAY_SIZE(smb138x_parallel_props),
	.get_property		= smb138x_parallel_get_prop,
+13 −3
Original line number Diff line number Diff line
@@ -104,6 +104,12 @@ enum {
	POWER_SUPPLY_DP_DM_ICL_UP = 12,
};

enum {
	POWER_SUPPLY_PARALLEL_NONE,
	POWER_SUPPLY_PARALLEL_USBIN_USBIN,
	POWER_SUPPLY_PARALLEL_MID_MID,
};

enum power_supply_property {
	/* Properties of type `int' */
	POWER_SUPPLY_PROP_STATUS = 0,
@@ -229,6 +235,9 @@ enum power_supply_property {
	POWER_SUPPLY_PROP_SET_SHIP_MODE,
	POWER_SUPPLY_PROP_SOC_REPORTING_READY,
	POWER_SUPPLY_PROP_DEBUG_BATTERY,
	POWER_SUPPLY_PROP_FCC_DELTA,
	POWER_SUPPLY_PROP_ICL_REDUCTION,
	POWER_SUPPLY_PROP_PARALLEL_MODE,
	/* Local extensions of type int64_t */
	POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
	/* Properties of type `const char *' */
@@ -252,7 +261,8 @@ enum power_supply_type {
	POWER_SUPPLY_TYPE_USB_PD,	/* Power Delivery */
	POWER_SUPPLY_TYPE_WIRELESS,	/* Accessory Charger Adapters */
	POWER_SUPPLY_TYPE_BMS,		/* Battery Monitor System */
	POWER_SUPPLY_TYPE_USB_PARALLEL,		/* USB Parallel Path */
	POWER_SUPPLY_TYPE_PARALLEL,	/* Parallel Path */
	POWER_SUPPLY_TYPE_MAIN,		/* Main Path */
	POWER_SUPPLY_TYPE_WIPOWER,	/* Wipower */
	POWER_SUPPLY_TYPE_TYPEC,	/* Type-C */
	POWER_SUPPLY_TYPE_UFP,		/* Type-C UFP */