Re: [PATCH v6 2/2] pinctrl: qcom: lpass-lpi: Switch to PM clock framework for runtime PM

From: Nathan Chancellor

Date: Tue Jun 09 2026 - 19:13:56 EST


Hi Ajay,

On Sat, May 23, 2026 at 02:16:44AM +0530, Ajay Kumar Nandam wrote:
...
> diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
> index 15ced5027579..4d758fd117c4 100644
> --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
> +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
...
> @@ -48,22 +49,48 @@ static int lpi_gpio_read(struct lpi_pinctrl *state, unsigned int pin,
> else
> pin_offset = LPI_TLMM_REG_OFFSET * pin;
>
> - return ioread32(state->tlmm_base + pin_offset + addr);
> + return state->tlmm_base + pin_offset + addr;
> +}
> +
> +static void __lpi_gpio_read(struct lpi_pinctrl *state,
> + unsigned int pin, unsigned int addr, u32 *val)
> +{
> + *val = ioread32(lpi_gpio_reg(state, pin, addr));
> +}
> +
> +static void __lpi_gpio_write(struct lpi_pinctrl *state,
> + unsigned int pin, unsigned int addr,
> + unsigned int val)
> +{
> + iowrite32(val, lpi_gpio_reg(state, pin, addr));
> +}
> +
> +static int lpi_gpio_read(struct lpi_pinctrl *state, unsigned int pin,
> + unsigned int addr, u32 *val)
> +{
> + int ret;
> +
> + ret = pm_runtime_resume_and_get(state->dev);
> + if (ret < 0)
> + return ret;
> +
> + __lpi_gpio_read(state, pin, addr, val);
> +
> + return pm_runtime_put_autosuspend(state->dev);
> }
>
> static int lpi_gpio_write(struct lpi_pinctrl *state, unsigned int pin,
> unsigned int addr, unsigned int val)
> {
> - u32 pin_offset;
> + int ret;
>
> - if (state->data->flags & LPI_FLAG_USE_PREDEFINED_PIN_OFFSET)
> - pin_offset = state->data->groups[pin].pin_offset;
> - else
> - pin_offset = LPI_TLMM_REG_OFFSET * pin;
> + ret = pm_runtime_resume_and_get(state->dev);
> + if (ret < 0)
> + return ret;
>
> - iowrite32(val, state->tlmm_base + pin_offset + addr);
> + __lpi_gpio_write(state, pin, addr, val);
>
> - return 0;
> + return pm_runtime_put_autosuspend(state->dev);
> }
>
> static const struct pinctrl_ops lpi_gpio_pinctrl_ops = {

After this change landed in -next as commit b719ede389d8 ("pinctrl:
qcom: lpass-lpi: Switch to PM clock framework for runtime PM"), there is
a warning that lpi_gpio_write() is completely unused, breaking the
build:

drivers/pinctrl/qcom/pinctrl-lpass-lpi.c:82:12: error: 'lpi_gpio_write' defined but not used [-Werror=unused-function]
82 | static int lpi_gpio_write(struct lpi_pinctrl *state, unsigned int pin,
| ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Seems legitimate, is this intended?

$ rg lpi_gpio_write drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
61:static void __lpi_gpio_write(struct lpi_pinctrl *state,
82:static int lpi_gpio_write(struct lpi_pinctrl *state, unsigned int pin,
91: __lpi_gpio_write(state, pin, addr, val);
167: __lpi_gpio_write(pctrl, group,
172: __lpi_gpio_write(pctrl, group,
179: __lpi_gpio_write(pctrl, pin, LPI_GPIO_CFG_REG, val);
340: __lpi_gpio_write(pctrl, group, LPI_GPIO_VALUE_REG, val);
350: __lpi_gpio_write(pctrl, group, LPI_GPIO_CFG_REG, val);

--
Cheers,
Nathan