Commit 0f83bfd8 authored by Uwe Kleine-König's avatar Uwe Kleine-König

pwm: lpss: Make use of pwmchip_parent() accessor

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/77617ba84bed7807a05779109432a292dd79f72f.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent ac4b44ca
...@@ -106,7 +106,7 @@ static int pwm_lpss_wait_for_update(struct pwm_device *pwm) ...@@ -106,7 +106,7 @@ static int pwm_lpss_wait_for_update(struct pwm_device *pwm)
*/ */
err = readl_poll_timeout(addr, val, !(val & PWM_SW_UPDATE), 40, ms); err = readl_poll_timeout(addr, val, !(val & PWM_SW_UPDATE), 40, ms);
if (err) if (err)
dev_err(pwm->chip->dev, "PWM_SW_UPDATE was not cleared\n"); dev_err(pwmchip_parent(pwm->chip), "PWM_SW_UPDATE was not cleared\n");
return err; return err;
} }
...@@ -114,7 +114,7 @@ static int pwm_lpss_wait_for_update(struct pwm_device *pwm) ...@@ -114,7 +114,7 @@ static int pwm_lpss_wait_for_update(struct pwm_device *pwm)
static inline int pwm_lpss_is_updating(struct pwm_device *pwm) static inline int pwm_lpss_is_updating(struct pwm_device *pwm)
{ {
if (pwm_lpss_read(pwm) & PWM_SW_UPDATE) { if (pwm_lpss_read(pwm) & PWM_SW_UPDATE) {
dev_err(pwm->chip->dev, "PWM_SW_UPDATE is still set, skipping update\n"); dev_err(pwmchip_parent(pwm->chip), "PWM_SW_UPDATE is still set, skipping update\n");
return -EBUSY; return -EBUSY;
} }
...@@ -190,16 +190,16 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -190,16 +190,16 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (state->enabled) { if (state->enabled) {
if (!pwm_is_enabled(pwm)) { if (!pwm_is_enabled(pwm)) {
pm_runtime_get_sync(chip->dev); pm_runtime_get_sync(pwmchip_parent(chip));
ret = pwm_lpss_prepare_enable(lpwm, pwm, state); ret = pwm_lpss_prepare_enable(lpwm, pwm, state);
if (ret) if (ret)
pm_runtime_put(chip->dev); pm_runtime_put(pwmchip_parent(chip));
} else { } else {
ret = pwm_lpss_prepare_enable(lpwm, pwm, state); ret = pwm_lpss_prepare_enable(lpwm, pwm, state);
} }
} else if (pwm_is_enabled(pwm)) { } else if (pwm_is_enabled(pwm)) {
pwm_lpss_write(pwm, pwm_lpss_read(pwm) & ~PWM_ENABLE); pwm_lpss_write(pwm, pwm_lpss_read(pwm) & ~PWM_ENABLE);
pm_runtime_put(chip->dev); pm_runtime_put(pwmchip_parent(chip));
} }
return ret; return ret;
...@@ -213,7 +213,7 @@ static int pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -213,7 +213,7 @@ static int pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
unsigned long long base_unit, freq, on_time_div; unsigned long long base_unit, freq, on_time_div;
u32 ctrl; u32 ctrl;
pm_runtime_get_sync(chip->dev); pm_runtime_get_sync(pwmchip_parent(chip));
base_unit_range = BIT(lpwm->info->base_unit_bits); base_unit_range = BIT(lpwm->info->base_unit_bits);
...@@ -235,7 +235,7 @@ static int pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -235,7 +235,7 @@ static int pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
state->polarity = PWM_POLARITY_NORMAL; state->polarity = PWM_POLARITY_NORMAL;
state->enabled = !!(ctrl & PWM_ENABLE); state->enabled = !!(ctrl & PWM_ENABLE);
pm_runtime_put(chip->dev); pm_runtime_put(pwmchip_parent(chip));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment