Re: [PATCH 2/2] pwm: Add driver for AXI PWM generator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux