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

Commit cd6a5983 authored by Fenglin Wu's avatar Fenglin Wu
Browse files

gpio: qpnp-pin: Fix reading the GPIO mode for GPIO_LV_MV subtype



GPIO_LV_MV subtype has different MODE_SEL mask with other existing
subtypes. Correct the MODE_SEL mask in qpnp_pin_get() function to
make sure it could get the correct status for LV_MV subtype GPIOs.

CRs-Fixed: 1081831
Change-Id: Ibeb5d34412d4333f9c7f21d2fc7df1d3b1d4e72e
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 8992f7dd
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -827,8 +827,16 @@ static int qpnp_pin_get(struct gpio_chip *gpio_chip, unsigned offset)
	if (WARN_ON(!q_spec))
		return -ENODEV;

	if (is_gpio_lv_mv(q_spec)) {
		mask = Q_REG_LV_MV_MODE_SEL_MASK;
		shift = Q_REG_LV_MV_MODE_SEL_SHIFT;
	} else {
		mask = Q_REG_MODE_SEL_MASK;
		shift = Q_REG_MODE_SEL_SHIFT;
	}

	/* gpio val is from RT status iff input is enabled */
	if ((q_spec->regs[Q_REG_I_MODE_CTL] & Q_REG_MODE_SEL_MASK)
	if (q_reg_get(&q_spec->regs[Q_REG_I_MODE_CTL], shift, mask)
					== QPNP_PIN_MODE_DIG_IN) {
		rc = regmap_read(q_chip->regmap,
				 Q_REG_ADDR(q_spec, Q_REG_STATUS1), &val);