mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Trevor Gamblin <tgamblin@baylibre.com>,
	linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	michael.hennerich@analog.com, nuno.sa@analog.com,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
Subject: Re: [PATCH 2/2] pwm: Add driver for AXI PWM generator
Date: Tue, 16 Jan 2024 08:28:06 +0000	[thread overview]
Message-ID: <ZaY-FjeRV2qPL0wz@gofer.mess.org> (raw)
In-Reply-To: <gbessnmierg5gvdguhwauoe2mxr3krwcfk2afhazrqvz45md64@itbchezepncg>

On Mon, Jan 15, 2024 at 10:18:04PM +0100, Uwe Kleine-König wrote:
> On Mon, Jan 15, 2024 at 03:12:21PM -0500, Trevor Gamblin wrote:
> > +static int axi_pwmgen_probe(struct platform_device *pdev)
> > +{
> > +	struct axi_pwmgen *pwm;
> > +	void __iomem *io_base;
> > +	int ret;
> > +
> > +	pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL);
> > +	if (!pwm)
> > +		return -ENOMEM;
> > +
> > +	io_base = devm_platform_ioremap_resource(pdev, 0);
> > +	if (IS_ERR(io_base))
> > +		return PTR_ERR(io_base);
> > +
> > +	pwm->regmap = devm_regmap_init_mmio(&pdev->dev, io_base, &axi_pwm_regmap_config);
> > +	if (IS_ERR(pwm->regmap))
> > +		return dev_err_probe(&pdev->dev, PTR_ERR(pwm->regmap),
> > +				     "failed to init register map\n");
> > +
> > +	pwm->clk = devm_clk_get_enabled(&pdev->dev, NULL);
> > +	if (IS_ERR(pwm->clk))
> > +		return dev_err_probe(&pdev->dev, PTR_ERR(pwm->clk), "failed to get clock\n");
> 
> Please call clk_rate_exclusive_get() on pwm->clk and cache the rate in
> struct axi_pwmgen.
> 
> > +	pwm->chip.dev = &pdev->dev;
> > +	pwm->chip.ops = &axi_pwmgen_pwm_ops;

In that case pwm->chip.atomic = true; can be set too (although this should
be tested with CONFIG_DEBUG_ATOMIC_SLEEP and CONFIG_PWM_DEBUG).

Thanks,

Sean

  reply	other threads:[~2024-01-16  8:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 20:12 [PATCH 0/2] pwm: add axi-pwm-gen driver Trevor Gamblin
2024-01-15 20:12 ` [PATCH 1/2] dt-bindings: pwm: Add bindings for AXI PWM generator Trevor Gamblin
2024-01-16  7:38   ` Krzysztof Kozlowski
2024-01-15 20:12 ` [PATCH 2/2] pwm: Add driver " Trevor Gamblin
2024-01-15 21:18   ` Uwe Kleine-König
2024-01-16  8:28     ` Sean Young [this message]
2024-01-16 12:49       ` Uwe Kleine-König
2024-01-17 12:51     ` Trevor Gamblin
2024-01-17 14:18       ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZaY-FjeRV2qPL0wz@gofer.mess.org \
    --to=sean@mess.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=robh+dt@kernel.org \
    --cc=tgamblin@baylibre.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®