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

Unverified Commit bfd25ca9 authored by derfelot's avatar derfelot
Browse files

power: supply: Add Sony charger extension and Qnovo QNS wrapper

Taken from Sony 47.2.A.10.107 stock kernel
parent 8a9f70dc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -23,6 +23,11 @@
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
/*
 * NOTE: This file has been modified by Sony Mobile Communications Inc.
 * Modifications are Copyright (c) 2016 Sony Mobile Communications Inc,
 * and licensed under the license of the file.
 */

#include <linux/module.h>
#include <linux/types.h>
@@ -80,6 +85,8 @@ static const char *extcon_name[] = {
	[EXTCON_JIG]			= "JIG",
	[EXTCON_MECHANICAL]		= "MECHANICAL",

	/* Somc Extention */
	[EXTCON_VBUS_DROP]		= "VBUS-DROP",
	NULL,
};

+22 −1
Original line number Diff line number Diff line
@@ -10,6 +10,11 @@
 *
 *  You may use this code as per GPL version 2
 */
/*
 * NOTE: This file has been modified by Sony Mobile Communications Inc.
 * Modifications are Copyright (c) 2014 Sony Mobile Communications Inc,
 * and licensed under the license of the file.
 */

#include <linux/ctype.h>
#include <linux/device.h>
@@ -81,7 +86,7 @@ static ssize_t power_supply_show_property(struct device *dev,
		"Non compliant",
	};
	static char *typec_pr_text[] = {
		"none", "dual power role", "sink", "source"
		"none", "dual power role", "sink", "source", "sink_delay"
	};
	ssize_t ret = 0;
	struct power_supply *psy = dev_get_drvdata(dev);
@@ -312,6 +317,21 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(enable_jeita_detection),
	POWER_SUPPLY_ATTR(allow_hvdcp3),
	POWER_SUPPLY_ATTR(max_pulse_allowed),
	POWER_SUPPLY_ATTR(skin_temp),
	POWER_SUPPLY_ATTR(smart_charging_activation),
	POWER_SUPPLY_ATTR(smart_charging_interruption),
	POWER_SUPPLY_ATTR(smart_charging_status),
	POWER_SUPPLY_ATTR(lrc_enable),
	POWER_SUPPLY_ATTR(lrc_socmax),
	POWER_SUPPLY_ATTR(lrc_socmin),
	POWER_SUPPLY_ATTR(lrc_not_startup),
	POWER_SUPPLY_ATTR(max_charge_current),
	POWER_SUPPLY_ATTR(charge_full_raw),
	POWER_SUPPLY_ATTR(time_to_cap_learning),
	POWER_SUPPLY_ATTR(int_cld),
	POWER_SUPPLY_ATTR(monotonic_soc),
	POWER_SUPPLY_ATTR(legacy_cable_status),
	POWER_SUPPLY_ATTR(running_status),
	/* Local extensions of type int64_t */
	POWER_SUPPLY_ATTR(charge_counter_ext),
	/* Properties of type `const char *' */
@@ -319,6 +339,7 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(manufacturer),
	POWER_SUPPLY_ATTR(serial_number),
	POWER_SUPPLY_ATTR(battery_type),
	POWER_SUPPLY_ATTR(charger_type),
};

static struct attribute *
+14 −0
Original line number Diff line number Diff line
@@ -100,4 +100,18 @@ config QPNP_QNOVO
	  module. It also allows userspace code to read diagnostics of voltage
	  and current measured during certain phases of the pulses.

config QNS_SYSTEM
	bool "Qnovo QNS wrapper implementation"
	default n
	help
	  Say Y here to enable support for QNS system.
	  QNS is a battery charging controller and it necessary to access a
	  kernel driver for a battery charging.
	  This adds sysfs interface which enables QNS daemon to access it.

config SOMC_CHARGER_EXTENSION
	bool "Charger driver extension"
	help
	  Say Y here to enable extensional function of charger driver.

endmenu
+1 −0
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ obj-$(CONFIG_BATTERY_BCL) += battery_current_limit.o
obj-$(CONFIG_QPNP_SMB2)		+= step-chg-jeita.o battery.o qpnp-smb2.o smb-lib.o pmic-voter.o storm-watch.o
obj-$(CONFIG_SMB138X_CHARGER)	+= battery.o smb138x-charger.o smb-lib.o pmic-voter.o storm-watch.o
obj-$(CONFIG_QPNP_QNOVO)	+= battery.o qpnp-qnovo.o
obj-$(CONFIG_QNS_SYSTEM)	+= qns_system.o
+12 −0
Original line number Diff line number Diff line
@@ -9,6 +9,11 @@
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
/*
 * NOTE: This file has been modified by Sony Mobile Communications Inc.
 * Modifications are Copyright (c) 2017 Sony Mobile Communications Inc,
 * and licensed under the license of the file.
 */

#define pr_fmt(fmt) "QCOM-BATT: %s: " fmt, __func__

@@ -1359,9 +1364,16 @@ int qcom_batt_init(void)
		goto release_wakeup_source;
	}

#if !defined(CONFIG_SOMC_CHARGER_EXTENSION)
	chip->fv_votable = create_votable("FV", VOTE_MAX,
					pl_fv_vote_callback,
					chip);
#endif
#if defined(CONFIG_SOMC_CHARGER_EXTENSION)
	chip->fv_votable = create_votable("FV", VOTE_MIN,
					pl_fv_vote_callback,
					chip);
#endif
	if (IS_ERR(chip->fv_votable)) {
		rc = PTR_ERR(chip->fv_votable);
		goto destroy_votable;
Loading