[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <C66K5YFY5LGN.1S3H72H0QQQAI@arch-vps>
Date: Wed, 07 Oct 2020 09:40:45 +0000
From: "Luca Weiss" <luca@...tu.xyz>
To: "Bjorn Andersson" <bjorn.andersson@...aro.org>,
"Pavel Machek" <pavel@....cz>, "Dan Murphy" <dmurphy@...com>,
"Rob Herring" <robh+dt@...nel.org>,
"Andy Gross" <agross@...nel.org>,
"Thierry Reding" <thierry.reding@...il.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
"Lee Jones" <lee.jones@...aro.org>,
"Martin Botka" <martin.botka1@...il.com>
Cc: <linux-leds@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<linux-pwm@...r.kernel.org>
Subject: Re: [PATCH v4 2/4] leds: Add driver for Qualcomm LPG
Hi Bjorn,
On Mon Sep 28, 2020 at 8:15 PM, Bjorn Andersson wrote:
> The Light Pulse Generator (LPG) is a PWM-block found in a wide range of
> PMICs from Qualcomm. It can operate on fixed parameters or based on a
> lookup-table, altering the duty cycle over time - which provides the
> means for e.g. hardware assisted transitions of LED brightness.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> ---
>
> Changes since v3:
> - Adopt multicolor model
> - Simplified hw_pattern implementation
>
> drivers/leds/Kconfig | 9 +
> drivers/leds/Makefile | 1 +
> drivers/leds/leds-qcom-lpg.c | 1213 ++++++++++++++++++++++++++++++++++
> 3 files changed, 1223 insertions(+)
> create mode 100644 drivers/leds/leds-qcom-lpg.c
<snip>
> +static int lpg_pwm_request(struct pwm_chip *chip, struct pwm_device
> *pwm)
> +{
> + struct lpg *lpg = container_of(chip, struct lpg, pwm);
> + struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
> +
> + return chan->in_use ? -EBUSY : 0;
> +}
> +
> +static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> + const struct pwm_state *state)
> +{
> + struct lpg *lpg = container_of(chip, struct lpg, pwm);
> + struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
> +
> + lpg_calc_freq(chan, state->period / NSEC_PER_USEC);
> + lpg_calc_duty(chan, state->duty_cycle / NSEC_PER_USEC);
As written on IRC this has to be wrapped div_u64() to compile on arm32;
should also fix the buildbot failure.
> + chan->enabled = state->enabled;
> +
> + lpg_apply(chan);
> +
> + triled_set(lpg, chan->triled_mask, chan->enabled);
> +
> + return 0;
> +}
Other than that, this works great on msm8974-fairphone-fp2 (pm8941)
with reg 7 (red), 6 (green) & 5 (blue). Thanks for updating this
patchset!
Regards
Luca
Powered by blists - more mailing lists