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

Commit 9a3a6c36 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Harry Yang
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 5bb8e7fb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -44,10 +44,10 @@ 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"
		"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"
+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
@@ -3160,8 +3160,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
@@ -4372,8 +4372,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
@@ -544,7 +544,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,
+11 −3
Original line number Diff line number Diff line
@@ -105,6 +105,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,
@@ -259,9 +265,11 @@ enum power_supply_type {
	POWER_SUPPLY_TYPE_USB_ACA,	/* Accessory Charger Adapters */
	POWER_SUPPLY_TYPE_USB_HVDCP,	/* High Voltage DCP */
	POWER_SUPPLY_TYPE_USB_HVDCP_3,	/* Efficient High Voltage DCP */
	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 */