Re: [PATCH v2 10/10] pwm: Add Raspberry Pi Firmware based PWM bus

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

 



Hi Andy, thanks for the review!

On Thu, 2020-10-22 at 21:53 +0300, Andy Shevchenko wrote:
> On Thu, Oct 22, 2020 at 9:05 PM Nicolas Saenz Julienne
> <nsaenzjulienne@xxxxxxx> wrote:
> > Adds support to control the PWM bus available in official Raspberry Pi
> > PoE HAT. Only RPi's co-processor has access to it, so commands have to
> > be sent through RPi's firmware mailbox interface.
> >  drivers/pwm/pwm-raspberrypi.c | 221 ++++++++++++++++++++++++++++++++++
> 
> Name is completely confusing.
> Please, make it unique enough to understand that this is exactly the
> device it serves for.
> 
> For example, pwm-rpi-poe is better.

Sounds reasonable, I'll change that.

> 
> ...
> 
> > + *  - Only normal polarity
> 
> Can't it be emulated? Isn't it 100% - duty cycle % ?

I guess it can, OTOH given the rather specific use case, I doubt it'll be
worth the effort.

> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/pwm.h>
> 
> ...
> 
> > +       ret = rpi_firmware_property(firmware, RPI_FIRMWARE_SET_POE_HAT_VAL,
> > +                                   &msg, sizeof(msg));
> > +       if (ret)
> > +               return ret;
> > +       else if (msg.ret)
> 
> Redundant 'else'

Noted.

> > +       firmware_node = of_get_parent(dev->of_node);
> > +       if (!firmware_node) {
> > +               dev_err(dev, "Missing firmware node\n");
> > +               return -ENOENT;
> > +       }
> > +
> > +       firmware = rpi_firmware_get(firmware_node);
> > +       of_node_put(firmware_node);
> > +       if (!firmware)
> > +               return -EPROBE_DEFER;
> 
> Looks like a hack.

This is the pattern we've been using on all firmware dependent devices so far.
Feel free to suggest a better way, I'll be happy to look into it.

> 
> ...
> 
> > +       ret = pwmchip_remove(&rpipwm->chip);
> > +       if (!ret)
> > +               rpi_firmware_put(rpipwm->firmware);
> > +
> > +       return ret;
> 
> Can't you use the usual pattern?

Yes of course. Don't know why I went this way.

Regards,
Nicolas

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux