driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
	linux-pwm@vger.kernel.org,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	devicetree <devicetree@vger.kernel.org>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	linux-input <linux-input@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	"Stefan Wahren" <wahrenst@gmx.net>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	"linux-arm Mailing List" <linux-arm-kernel@lists.infradead.org>,
	linux-rpi-kernel <linux-rpi-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 10/10] pwm: Add Raspberry Pi Firmware based PWM bus
Date: Mon, 26 Oct 2020 15:02:58 +0100	[thread overview]
Message-ID: <13068cff8e3a994df5d8fbe19deb068a741365f3.camel@suse.de> (raw)
In-Reply-To: <CAHp75VcB5oxXs38UH5taVGj21wUi3sHYdRPOj3wxa3yXg0vmUA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2155 bytes --]

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@suse.de> 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 #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

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

      reply	other threads:[~2020-10-26 14:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 15:58 [PATCH v2 00/10] Raspberry Pi PoE HAT fan support Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 01/10] firmware: raspberrypi: Introduce rpi_firmware_put() Nicolas Saenz Julienne
2020-10-22 18:46   ` Andy Shevchenko
2020-10-26 16:26     ` Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 02/10] clk: bcm: rpi: Release firmware handle on unbind Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 03/10] gpio: raspberrypi-exp: " Nicolas Saenz Julienne
2020-10-26 14:40   ` Bartosz Golaszewski
2020-10-26 14:42     ` Nicolas Saenz Julienne
2020-10-26 14:45       ` Bartosz Golaszewski
2020-10-22 15:58 ` [PATCH v2 04/10] reset: raspberrypi: " Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 05/10] soc: bcm: raspberrypi-power: " Nicolas Saenz Julienne
2020-10-26 14:31   ` Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 06/10] staging: vchiq: " Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 07/10] input: raspberrypi-ts: Release firmware handle when not needed Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 08/10] dt-bindings: pwm: Add binding for RPi firmware PWM bus Nicolas Saenz Julienne
2020-10-30 15:37   ` Rob Herring
2020-10-22 15:58 ` [PATCH v2 09/10] DO NOT MERGE: ARM: dts: Add RPi's official PoE hat support Nicolas Saenz Julienne
2020-10-22 15:58 ` [PATCH v2 10/10] pwm: Add Raspberry Pi Firmware based PWM bus Nicolas Saenz Julienne
2020-10-22 18:53   ` Andy Shevchenko
2020-10-26 14:02     ` Nicolas Saenz Julienne [this message]

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=13068cff8e3a994df5d8fbe19deb068a741365f3.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wahrenst@gmx.net \
    /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;
as well as URLs for NNTP newsgroup(s).