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

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

Merge "power: smb135x-charger: stay awake during i2c transactions"

parents 705b950c 801b18de
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -266,7 +266,6 @@ Optional Properties:
- qcom,skip-usb-notification	A boolean property to be used when usb gets present
				and type from other means. Especially true on
				liquid hardware, where usb presence is detected based on GPIO.
- qcom,enable-hvdcp-9v		A bool property to enable 9V HVDCP 2.0 detection.

Example:
	qcom,qpnp-smbcharger {
+7 −5
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ struct smbchg_chip {
	bool				cfg_chg_led_sw_ctrl;
	bool				vbat_above_headroom;
	bool				force_aicl_rerun;
	bool				enable_hvdcp_9v;
	bool				hvdcp3_supported;
	u8				original_usbin_allowance;
	struct parallel_usb_cfg		parallel;
	struct delayed_work		parallel_en_work;
@@ -4030,8 +4030,8 @@ static void smbchg_hvdcp_det_work(struct work_struct *work)
	int rc;

	if (is_hvdcp_present(chip)) {
		if (chip->enable_hvdcp_9v
				&& (chip->wa_flags & SMBCHG_HVDCP_9V_EN_WA)) {
		if (!chip->hvdcp3_supported &&
			(chip->wa_flags & SMBCHG_HVDCP_9V_EN_WA)) {
			/* force HVDCP 2.0 */
			rc = force_9v_hvdcp(chip);
			if (rc)
@@ -5057,6 +5057,10 @@ static int smbchg_dp_dm(struct smbchg_chip *chip, int val)
			chip->pulse_cnt--;
		pr_smb(PR_MISC, "pulse_cnt = %d\n", chip->pulse_cnt);
		break;
	case POWER_SUPPLY_DP_DM_HVDCP3_SUPPORTED:
		chip->hvdcp3_supported = true;
		pr_smb(PR_MISC, "HVDCP3 supported\n");
		break;
	default:
		break;
	}
@@ -6577,8 +6581,6 @@ static int smb_parse_dt(struct smbchg_chip *chip)
					"qcom,low-volt-dcin");
	chip->force_aicl_rerun = of_property_read_bool(node,
					"qcom,force-aicl-rerun");
	chip->enable_hvdcp_9v = of_property_read_bool(node,
					"qcom,enable-hvdcp-9v");

	/* parse the battery missing detection pin source */
	rc = of_property_read_string(chip->spmi->dev.of_node,
+7 −0
Original line number Diff line number Diff line
@@ -541,13 +541,16 @@ static int smb1351_read_reg(struct smb1351_charger *chip, int reg, u8 *val)
{
	s32 ret;

	pm_stay_awake(chip->dev);
	ret = i2c_smbus_read_byte_data(chip->client, reg);
	if (ret < 0) {
		pr_err("i2c read fail: can't read from %02x: %d\n", reg, ret);
		pm_relax(chip->dev);
		return ret;
	} else {
		*val = ret;
	}
	pm_relax(chip->dev);
	pr_debug("Reading 0x%02x=0x%02x\n", reg, *val);
	return 0;
}
@@ -556,12 +559,15 @@ static int smb1351_write_reg(struct smb1351_charger *chip, int reg, u8 val)
{
	s32 ret;

	pm_stay_awake(chip->dev);
	ret = i2c_smbus_write_byte_data(chip->client, reg, val);
	if (ret < 0) {
		pr_err("i2c write fail: can't write %02x to %02x: %d\n",
			val, reg, ret);
		pm_relax(chip->dev);
		return ret;
	}
	pm_relax(chip->dev);
	pr_debug("Writing 0x%02x=0x%02x\n", reg, val);
	return 0;
}
@@ -2791,6 +2797,7 @@ static int smb1351_main_charger_probe(struct i2c_client *client,
	chip->usb_psy = usb_psy;
	chip->fake_battery_soc = -EINVAL;
	INIT_DELAYED_WORK(&chip->chg_remove_work, smb1351_chg_remove_work);
	device_init_wakeup(chip->dev, true);

	/* probe the device to check if its actually connected */
	rc = smb1351_read_reg(chip, CHG_REVISION_REG, &reg);
+5 −0
Original line number Diff line number Diff line
@@ -479,7 +479,9 @@ static int smb135x_read(struct smb135x_chg *chip, int reg,
		return 0;
	}
	mutex_lock(&chip->read_write_lock);
	pm_stay_awake(chip->dev);
	rc = __smb135x_read(chip, reg, val);
	pm_relax(chip->dev);
	mutex_unlock(&chip->read_write_lock);

	return rc;
@@ -494,7 +496,9 @@ static int smb135x_write(struct smb135x_chg *chip, int reg,
		return 0;

	mutex_lock(&chip->read_write_lock);
	pm_stay_awake(chip->dev);
	rc = __smb135x_write(chip, reg, val);
	pm_relax(chip->dev);
	mutex_unlock(&chip->read_write_lock);

	return rc;
@@ -4128,6 +4132,7 @@ static int smb135x_main_charger_probe(struct i2c_client *client,
	mutex_init(&chip->current_change_lock);
	mutex_init(&chip->read_write_lock);
	mutex_init(&chip->otg_oc_count_lock);
	device_init_wakeup(chip->dev, true);
	/* probe the device to check if its actually connected */
	rc = smb135x_read(chip, CFG_4_REG, &reg);
	if (rc) {
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ enum {
	POWER_SUPPLY_DP_DM_DP0P6_DM3P3 = 7,
	POWER_SUPPLY_DP_DM_DPF_DMF = 8,
	POWER_SUPPLY_DP_DM_DPR_DMR = 9,
	POWER_SUPPLY_DP_DM_HVDCP3_SUPPORTED = 10,
};

enum power_supply_property {