[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcB5oxXs38UH5taVGj21wUi3sHYdRPOj3wxa3yXg0vmUA@mail.gmail.com>
Date: Thu, 22 Oct 2020 21:53:35 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
Cc: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thierry Reding <thierry.reding@...il.com>,
Lee Jones <lee.jones@...aro.org>,
Florian Fainelli <f.fainelli@...il.com>,
linux-pwm@...r.kernel.org,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
devicetree <devicetree@...r.kernel.org>,
Stefan Wahren <wahrenst@....net>,
linux-input <linux-input@...r.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"open list:STAGING SUBSYSTEM" <devel@...verdev.osuosl.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>,
linux-clk <linux-clk@...r.kernel.org>,
Stephen Boyd <sboyd@...nel.org>,
linux-rpi-kernel <linux-rpi-kernel@...ts.infradead.org>
Subject: Re: [PATCH v2 10/10] pwm: Add Raspberry Pi Firmware based PWM bus
On Thu, Oct 22, 2020 at 9:05 PM Nicolas Saenz Julienne
<nsaenzjulienne@...e.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.
...
> + * - Only normal polarity
Can't it be emulated? Isn't it 100% - duty cycle % ?
> +#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'
> + return -EIO;
...
> + ret = rpi_firmware_property(firmware, RPI_FIRMWARE_GET_POE_HAT_VAL,
> + &msg, sizeof(msg));
> + if (ret)
> + return ret;
> + else if (msg.ret)
Ditto.
> + return -EIO;
...
> + 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.
...
> + ret = pwmchip_remove(&rpipwm->chip);
> + if (!ret)
> + rpi_firmware_put(rpipwm->firmware);
> +
> + return ret;
Can't you use the usual pattern?
ret = ...
if (ret)
return ret;
...
return 0;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists