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

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

Merge "power: qcom: smb1390: Add IREV IRQ handler to toggle switcher"

parents 25d55691 9045b11b
Loading
Loading
Loading
Loading
+73 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. SMB1390 Charger Specific Bindings

SMB1390 charge pump is paired with QTI family of standalone chargers to
enable a high current, high efficiency Li+ battery charging system.

=======================
Required Node Structure
=======================

SMB1390 Charger must be described in two levels of device nodes.

==================================
First Level Node - SMB1390 Charger
==================================

Charger specific properties:
- compatible
  Usage:      required
  Value type: <string>
  Definition: "qcom,smb1390-charger".

- qcom,pmic-revid
  Usage:      required
  Value type: phandle
  Definition: Should specify the phandle of SMB's revid module. This is used
	      to identify the SMB subtype.

- qcom,channel-num
  Usage:      required
  Value type: <u32>
  Definition: Specifies the ADC channel number for reading die temperature.

================================================
Second Level Nodes - SMB1390 Charger Peripherals
================================================

Peripheral specific properties:
- interrupts
  Usage:      required
  Value type: <prop-encoded-array>
  Definition: Peripheral interrupt specifier.

- interrupt-names
  Usage:      required
  Value type: <stringlist>
  Definition: Interrupt names.  This list must match up 1-to-1 with the
	      interrupts specified in the 'interrupts' property.

=======
Example
=======

smb1390_charger: qcom,charge_pump {
	compatible = "qcom,smb1390-charger";
	qcom,pmic-revid = <&smb1390_revid>;
	qcom,channel-num = <15>
	interrupt-parent = <&smb1390>;
	qcom,smb-vadc = <&pm8998_vadc>;
	status = "disabled";

	qcom,core {
		interrupts = <0x10 0x0 IRQ_TYPE_EDGE_RISING>,
			     <0x10 0x1 IRQ_TYPE_EDGE_RISING>,
			     <0x10 0x2 IRQ_TYPE_EDGE_RISING>,
			     <0x10 0x3 IRQ_TYPE_EDGE_RISING>,
			     <0x10 0x4 IRQ_TYPE_EDGE_RISING>;
		interrupt-names = "switcher-off-window",
				  "switcher-off-fault",
				  "vph-ov-soft",
				  "ilim",
				  "temp-alarm";
	};
};
+1 −0
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(batt_profile_version),
	POWER_SUPPLY_ATTR(batt_full_current),
	POWER_SUPPLY_ATTR(recharge_soc),
	POWER_SUPPLY_ATTR(toggle_stat),
	/* Local extensions of type int64_t */
	POWER_SUPPLY_ATTR(charge_counter_ext),
	/* Properties of type `const char *' */
+8 −0
Original line number Diff line number Diff line
@@ -124,4 +124,12 @@ config QPNP_QG
	  to determine the battery state-of-charge (SOC) and supports other
	  battery management features.

config SMB1390_CHARGE_PUMP
	tristate "SMB1390 Charge Pump"
	depends on MFD_I2C_PMIC
	help
	  Say Y to include support for SMB1390 Charge Pump.
	  SMB1390 is a div2 charge pump capable of delivering 6A charge current
	  with very high efficiency.

endmenu
+1 −0
Original line number Diff line number Diff line
@@ -10,3 +10,4 @@ obj-$(CONFIG_QPNP_QG) += qpnp-qg.o pmic-voter.o qg-util.o qg-soc.o qg-sdam.o qg
obj-$(CONFIG_QPNP_QNOVO)	+= qpnp-qnovo.o battery.o
obj-$(CONFIG_QPNP_TYPEC)	+= qpnp-typec.o
obj-$(CONFIG_QPNP_SMB5)		+= step-chg-jeita.o battery.o qpnp-smb5.o smb5-lib.o pmic-voter.o storm-watch.o schgm-flash.o
obj-$(CONFIG_SMB1390_CHARGE_PUMP)	+= smb1390-charger.o pmic-voter.o
+25 −0
Original line number Diff line number Diff line
@@ -716,6 +716,7 @@ static enum power_supply_property smb2_usb_main_props[] = {
	POWER_SUPPLY_PROP_INPUT_VOLTAGE_SETTLED,
	POWER_SUPPLY_PROP_FCC_DELTA,
	POWER_SUPPLY_PROP_CURRENT_MAX,
	POWER_SUPPLY_PROP_TOGGLE_STAT,
	/*
	 * TODO move the TEMP and TEMP_MAX properties here,
	 * and update the thermal balancer to look here
@@ -753,6 +754,9 @@ static int smb2_usb_main_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CURRENT_MAX:
		rc = smblib_get_icl_current(chg, &val->intval);
		break;
	case POWER_SUPPLY_PROP_TOGGLE_STAT:
		val->intval = 0;
		break;
	default:
		pr_debug("get prop %d is not supported in usb-main\n", psp);
		rc = -EINVAL;
@@ -783,6 +787,9 @@ static int smb2_usb_main_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CURRENT_MAX:
		rc = smblib_set_icl_current(chg, val->intval);
		break;
	case POWER_SUPPLY_PROP_TOGGLE_STAT:
		rc = smblib_toggle_stat(chg, val->intval);
		break;
	default:
		pr_err("set prop %d is not supported\n", psp);
		rc = -EINVAL;
@@ -792,6 +799,23 @@ static int smb2_usb_main_set_prop(struct power_supply *psy,
	return rc;
}

static int smb2_usb_main_prop_is_writeable(struct power_supply *psy,
				enum power_supply_property psp)
{
	int rc;

	switch (psp) {
	case POWER_SUPPLY_PROP_TOGGLE_STAT:
		rc = 1;
		break;
	default:
		rc = 0;
		break;
	}

	return rc;
}

static const struct power_supply_desc usb_main_psy_desc = {
	.name		= "main",
	.type		= POWER_SUPPLY_TYPE_MAIN,
@@ -799,6 +823,7 @@ static const struct power_supply_desc usb_main_psy_desc = {
	.num_properties	= ARRAY_SIZE(smb2_usb_main_props),
	.get_property	= smb2_usb_main_get_prop,
	.set_property	= smb2_usb_main_set_prop,
	.property_is_writeable = smb2_usb_main_prop_is_writeable,
};

static int smb2_init_usb_main_psy(struct smb2 *chip)
Loading