pwm: meson: Make use of pwmchip_parent() accessor

BugLink: https://bugs.launchpad.net/bugs/2071621

[ Upstream commit e369035a98894a7327e78ebd01ec859c6654fc52 ]

struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

Link: https://lore.kernel.org/r/02d5f32001c4d0817fa79f5831cfd16b7e345f00.1707900770.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Stable-dep-of: 3e551115aee0 ("pwm: meson: Add check for error from clk_round_rate()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
This commit is contained in:
Uwe Kleine-König
2024-02-14 10:31:58 +01:00
committed by Stefan Bader
parent 738bf73b2a
commit dece632d94
+8 -8
View File
@@ -122,7 +122,7 @@ static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
{
struct meson_pwm *meson = to_meson_pwm(chip);
struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm];
struct device *dev = chip->dev;
struct device *dev = pwmchip_parent(chip);
int err;
err = clk_prepare_enable(channel->clk);
@@ -170,19 +170,19 @@ static int meson_pwm_calc(struct pwm_chip *chip, struct pwm_device *pwm,
fin_freq = clk_round_rate(channel->clk, freq);
if (fin_freq == 0) {
dev_err(chip->dev, "invalid source clock frequency\n");
dev_err(pwmchip_parent(chip), "invalid source clock frequency\n");
return -EINVAL;
}
dev_dbg(chip->dev, "fin_freq: %lu Hz\n", fin_freq);
dev_dbg(pwmchip_parent(chip), "fin_freq: %lu Hz\n", fin_freq);
cnt = div_u64(fin_freq * period, NSEC_PER_SEC);
if (cnt > 0xffff) {
dev_err(chip->dev, "unable to get period cnt\n");
dev_err(pwmchip_parent(chip), "unable to get period cnt\n");
return -EINVAL;
}
dev_dbg(chip->dev, "period=%llu cnt=%u\n", period, cnt);
dev_dbg(pwmchip_parent(chip), "period=%llu cnt=%u\n", period, cnt);
if (duty == period) {
channel->hi = cnt;
@@ -193,7 +193,7 @@ static int meson_pwm_calc(struct pwm_chip *chip, struct pwm_device *pwm,
} else {
duty_cnt = div_u64(fin_freq * duty, NSEC_PER_SEC);
dev_dbg(chip->dev, "duty=%llu duty_cnt=%u\n", duty, duty_cnt);
dev_dbg(pwmchip_parent(chip), "duty=%llu duty_cnt=%u\n", duty, duty_cnt);
channel->hi = duty_cnt;
channel->lo = cnt - duty_cnt;
@@ -217,7 +217,7 @@ static void meson_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
err = clk_set_rate(channel->clk, channel->rate);
if (err)
dev_err(chip->dev, "setting clock rate failed\n");
dev_err(pwmchip_parent(chip), "setting clock rate failed\n");
spin_lock_irqsave(&meson->lock, flags);
@@ -439,7 +439,7 @@ static int meson_pwm_init_channels(struct pwm_chip *chip)
{
struct meson_pwm *meson = to_meson_pwm(chip);
struct clk_parent_data mux_parent_data[MESON_MAX_MUX_PARENTS] = {};
struct device *dev = chip->dev;
struct device *dev = pwmchip_parent(chip);
unsigned int i;
char name[255];
int err;