From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Sasha Levin" <sashal@kernel.org>, linux-pwm@vger.kernel.org, "Neil Armstrong" <narmstrong@baylibre.com>, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com>, "Thierry Reding" <thierry.reding@gmail.com>, "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 350/671] pwm: meson: Consider 128 a valid pre-divider Date: Thu, 16 Jan 2020 11:59:48 -0500 Message-ID: <20200116170509.12787-87-sashal@kernel.org> (raw) In-Reply-To: <20200116170509.12787-1-sashal@kernel.org> From: Martin Blumenstingl <martin.blumenstingl@googlemail.com> [ Upstream commit 51496e4446875726d50a5617a6e0e0dabbc2e6da ] The pre-divider allows configuring longer PWM periods compared to using the input clock directly. The pre-divider is 7 bit wide, meaning it's maximum value is 128 (the register value is off-by-one: 0x7f or 127). Change the loop to also allow for the maximum possible value to be considered valid. Fixes: 211ed630753d2f ("pwm: Add support for Meson PWM Controller") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/pwm/pwm-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index f6e738ad7bd9..4b708c1fcb1d 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -188,7 +188,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, do_div(fin_ps, fin_freq); /* Calc pre_div with the period */ - for (pre_div = 0; pre_div < MISC_CLK_DIV_MASK; pre_div++) { + for (pre_div = 0; pre_div <= MISC_CLK_DIV_MASK; pre_div++) { cnt = DIV_ROUND_CLOSEST_ULL((u64)period * 1000, fin_ps * (pre_div + 1)); dev_dbg(meson->chip.dev, "fin_ps=%llu pre_div=%u cnt=%u\n", @@ -197,7 +197,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, break; } - if (pre_div == MISC_CLK_DIV_MASK) { + if (pre_div > MISC_CLK_DIV_MASK) { dev_err(meson->chip.dev, "unable to get period pre_div\n"); return -EINVAL; } -- 2.20.1 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply index Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20200116170509.12787-1-sashal@kernel.org> 2020-01-16 16:58 ` [PATCH AUTOSEL 4.19 298/671] soc: amlogic: meson-gx-pwrc-vpu: Fix power on/off register bitmask Sasha Levin 2020-01-16 16:59 ` Sasha Levin [this message] 2020-01-16 16:59 ` [PATCH AUTOSEL 4.19 351/671] pwm: meson: Don't disable PWM when setting duty repeatedly Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 365/671] clk: meson: gxbb: no spread spectrum on mpll0 Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 366/671] clk: meson: axg: spread spectrum is on mpll2 Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 368/671] arm64: dts: meson: libretech-cc: set eMMC as removable Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 403/671] arm64: dts: meson-gxm-khadas-vim2: fix gpio-keys-polled node Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 404/671] arm64: dts: meson-gxm-khadas-vim2: fix Bluetooth support Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 410/671] ASoC: meson: axg-tdmin: right_j is not supported Sasha Levin 2020-01-16 17:00 ` [PATCH AUTOSEL 4.19 411/671] ASoC: meson: axg-tdmout: " Sasha Levin 2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 567/671] net: stmmac: dwmac-meson8b: Fix signedness bug in probe Sasha Levin 2020-01-16 17:04 ` [PATCH AUTOSEL 4.19 619/671] arm64: dts: meson-gxl-s905x-khadas-vim: fix gpio-keys-polled node Sasha Levin 2020-01-16 17:05 ` [PATCH AUTOSEL 4.19 671/671] arm64: dts: meson-gxm-khadas-vim2: fix uart_A bluetooth node Sasha Levin
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=20200116170509.12787-87-sashal@kernel.org \ --to=sashal@kernel.org \ --cc=linux-amlogic@lists.infradead.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pwm@vger.kernel.org \ --cc=martin.blumenstingl@googlemail.com \ --cc=narmstrong@baylibre.com \ --cc=stable@vger.kernel.org \ --cc=thierry.reding@gmail.com \ --cc=u.kleine-koenig@pengutronix.de \ /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
Linux-Amlogic Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \ linux-amlogic@lists.infradead.org public-inbox-index linux-amlogic Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic AGPL code for this site: git clone https://public-inbox.org/public-inbox.git