[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241124164427.6e787b2b@jic23-huawei>
Date: Sun, 24 Nov 2024 16:44:27 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Nuno Sá <nuno.sa@...log.com>, Uwe
Kleine-König <ukleinek@...nel.org>, Michael Hennerich
<Michael.Hennerich@...log.com>, Lars-Peter Clausen <lars@...afoo.de>, David
Jander <david@...tonic.nl>, Martin Sperl <kernel@...tin.sperl.org>,
linux-spi@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
linux-pwm@...r.kernel.org
Subject: Re: [PATCH v5 05/16] spi: offload-trigger: add PWM trigger driver
On Fri, 15 Nov 2024 14:18:44 -0600
David Lechner <dlechner@...libre.com> wrote:
> Add a new driver for a generic PWM trigger for SPI offloads.
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
Trivial thing to tidy up mentioned below.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> +static int spi_offload_trigger_pwm_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct spi_offload_trigger_info info = {
> + .fwnode = dev_fwnode(dev),
> + .ops = &spi_offload_trigger_pwm_ops,
> + };
> + struct spi_offload_trigger_pwm_state *st;
> + struct pwm_state state;
> + int ret;
> +
> + st = devm_kzalloc(&pdev->dev, sizeof(*st), GFP_KERNEL);
use dev.
> + if (!st)
> + return -ENOMEM;
> +
> + info.priv = st;
> + st->dev = dev;
> +
> + st->pwm = devm_pwm_get(&pdev->dev, NULL);
use dev.
> + if (IS_ERR(st->pwm))
> + return dev_err_probe(dev, PTR_ERR(st->pwm), "failed to get PWM\n");
> +
> + /* init with duty_cycle = 0, output enabled to ensure trigger off */
> + pwm_init_state(st->pwm, &state);
> + state.enabled = true;
> +
> + ret = pwm_apply_might_sleep(st->pwm, &state);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "failed to apply PWM state\n");
> +
> + ret = devm_add_action_or_reset(dev, spi_offload_trigger_pwm_release, st->pwm);
> + if (ret)
> + return ret;
> +
> + return devm_spi_offload_trigger_register(dev, &info);
> +}
Powered by blists - more mailing lists