lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 Jan 2024 08:28:06 +0000
From: Sean Young <sean@...s.org>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Cc: Trevor Gamblin <tgamblin@...libre.com>, linux-pwm@...r.kernel.org,
	linux-kernel@...r.kernel.org, michael.hennerich@...log.com,
	nuno.sa@...log.com, devicetree@...r.kernel.org, robh+dt@...nel.org,
	krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org
Subject: Re: [PATCH 2/2] pwm: Add driver for AXI PWM generator

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ