From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
Thierry Reding <thierry.reding@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
f.fainelli@gmail.com, linux-pwm@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
wahrenst@gmx.net, linux-input@vger.kernel.org,
dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org,
devel@driverdev.osuosl.org, p.zabel@pengutronix.de,
linux-gpio@vger.kernel.org, linus.walleij@linaro.org,
linux-clk@vger.kernel.org, sboyd@kernel.org,
linux-rpi-kernel@lists.infradead.org, bgolaszewski@baylibre.com,
andy.shevchenko@gmail.com
Subject: Re: [PATCH v6 11/11] pwm: Add Raspberry Pi Firmware based PWM bus
Date: Thu, 14 Jan 2021 19:44:46 +0100 [thread overview]
Message-ID: <99a7d6e80646ff7ac6c1fc615146fc4ad1428552.camel@suse.de> (raw)
In-Reply-To: <20210112091842.3th64ardbqjafvuq@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]
Hi Uwe, thanks for the review.
On Tue, 2021-01-12 at 10:18 +0100, Uwe Kleine-König wrote:
[...]
> > + duty_cycle = DIV_ROUND_CLOSEST_ULL(state->duty_cycle * RPI_PWM_MAX_DUTY,
> > + RPI_PWM_PERIOD_NS);
>
> ... and round down here.
>
> Just to be sure: writing RPI_PWM_MAX_DUTY (i.e. 255) yields 100% duty
> cycle, right?
Yes, at 255 the signal is flat.
> > + else
> > + duty_cycle = RPI_PWM_MAX_DUTY;
> > +
> > + if (duty_cycle == rpipwm->duty_cycle)
> > + return 0;
> > +
> > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_CUR_DUTY_REG,
> > + duty_cycle);
> > + if (ret) {
> > + dev_err(chip->dev, "Failed to set duty cycle: %d\n", ret);
> > + return ret;
> > + }
> > +
> > + /*
> > + * This sets the default duty cycle after resetting the board, we
> > + * updated it every time to mimic Raspberry Pi's downstream's driver
> > + * behaviour.
> > + */
> > + ret = raspberrypi_pwm_set_property(rpipwm->firmware, RPI_PWM_DEF_DUTY_REG,
> > + duty_cycle);
> > + if (ret) {
> > + dev_err(chip->dev, "Failed to set default duty cycle: %d\n", ret);
> > + return ret;
> > + }
> > +
> > + rpipwm->duty_cycle = duty_cycle;
>
> Please use tabs for indention. (The general hint is to use checkpatch
> which (I hope) tells you about problems like this.)
Sorry for that.
I took note of the rest of comments and will update the code.
Regards,
Nicolas
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-01-14 18:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 16:47 [PATCH v6 00/11] Raspberry Pi PoE HAT fan support Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 01/11] firmware: raspberrypi: Keep count of all consumers Nicolas Saenz Julienne
2020-12-13 5:14 ` Stephen Boyd
2020-12-16 10:37 ` Bartosz Golaszewski
2020-12-11 16:47 ` [PATCH v6 02/11] firmware: raspberrypi: Introduce devm_rpi_firmware_get() Nicolas Saenz Julienne
2020-12-16 10:35 ` Bartosz Golaszewski
2020-12-16 10:37 ` Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 03/11] clk: bcm: rpi: Release firmware handle on unbind Nicolas Saenz Julienne
2020-12-13 5:12 ` Stephen Boyd
2020-12-11 16:47 ` [PATCH v6 04/11] gpio: raspberrypi-exp: " Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 05/11] reset: raspberrypi: " Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 06/11] soc: bcm: raspberrypi-power: " Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 07/11] staging: vchiq: " Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 08/11] input: raspberrypi-ts: Release firmware handle when not needed Nicolas Saenz Julienne
2020-12-11 18:17 ` Florian Fainelli
2020-12-11 16:47 ` [PATCH v6 09/11] dt-bindings: pwm: Add binding for RPi firmware PWM bus Nicolas Saenz Julienne
2020-12-11 16:47 ` [PATCH v6 10/11] DO NOT MERGE: ARM: dts: Add RPi's official PoE hat support Nicolas Saenz Julienne
2020-12-11 16:48 ` [PATCH v6 11/11] pwm: Add Raspberry Pi Firmware based PWM bus Nicolas Saenz Julienne
2021-01-12 9:18 ` Uwe Kleine-König
2021-01-14 18:44 ` Nicolas Saenz Julienne [this message]
2021-01-11 21:02 ` [PATCH v6 00/11] Raspberry Pi PoE HAT fan support Nicolas Saenz Julienne
2021-01-12 8:52 ` Linus Walleij
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=99a7d6e80646ff7ac6c1fc615146fc4ad1428552.camel@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=andy.shevchenko@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bgolaszewski@baylibre.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).