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

pwm: tiehrpwm: 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/9badd116d0e26a5656b222c5b4adad7e111a53c7.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 4e1c8593
...@@ -256,7 +256,7 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -256,7 +256,7 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
if (i == pwm->hwpwm) if (i == pwm->hwpwm)
continue; continue;
dev_err(chip->dev, dev_err(pwmchip_parent(chip),
"period value conflicts with channel %u\n", "period value conflicts with channel %u\n",
i); i);
return -EINVAL; return -EINVAL;
...@@ -268,11 +268,11 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -268,11 +268,11 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
/* Configure clock prescaler to support Low frequency PWM wave */ /* Configure clock prescaler to support Low frequency PWM wave */
if (set_prescale_div(period_cycles/PERIOD_MAX, &ps_divval, if (set_prescale_div(period_cycles/PERIOD_MAX, &ps_divval,
&tb_divval)) { &tb_divval)) {
dev_err(chip->dev, "Unsupported values\n"); dev_err(pwmchip_parent(chip), "Unsupported values\n");
return -EINVAL; return -EINVAL;
} }
pm_runtime_get_sync(chip->dev); pm_runtime_get_sync(pwmchip_parent(chip));
/* Update clock prescaler values */ /* Update clock prescaler values */
ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_CLKDIV_MASK, tb_divval); ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_CLKDIV_MASK, tb_divval);
...@@ -299,7 +299,7 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -299,7 +299,7 @@ static int ehrpwm_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
ehrpwm_write(pc->mmio_base, cmp_reg, duty_cycles); ehrpwm_write(pc->mmio_base, cmp_reg, duty_cycles);
pm_runtime_put_sync(chip->dev); pm_runtime_put_sync(pwmchip_parent(chip));
return 0; return 0;
} }
...@@ -323,7 +323,7 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -323,7 +323,7 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
int ret; int ret;
/* Leave clock enabled on enabling PWM */ /* Leave clock enabled on enabling PWM */
pm_runtime_get_sync(chip->dev); pm_runtime_get_sync(pwmchip_parent(chip));
/* Disabling Action Qualifier on PWM output */ /* Disabling Action Qualifier on PWM output */
if (pwm->hwpwm) { if (pwm->hwpwm) {
...@@ -346,8 +346,8 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -346,8 +346,8 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
/* Enable TBCLK */ /* Enable TBCLK */
ret = clk_enable(pc->tbclk); ret = clk_enable(pc->tbclk);
if (ret) { if (ret) {
dev_err(chip->dev, "Failed to enable TBCLK for %s: %d\n", dev_err(pwmchip_parent(chip), "Failed to enable TBCLK for %s: %d\n",
dev_name(chip->dev), ret); dev_name(pwmchip_parent(chip)), ret);
return ret; return ret;
} }
...@@ -385,7 +385,7 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -385,7 +385,7 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
clk_disable(pc->tbclk); clk_disable(pc->tbclk);
/* Disable clock on PWM disable */ /* Disable clock on PWM disable */
pm_runtime_put_sync(chip->dev); pm_runtime_put_sync(pwmchip_parent(chip));
} }
static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
...@@ -393,8 +393,8 @@ static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -393,8 +393,8 @@ static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip); struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
if (pwm_is_enabled(pwm)) { if (pwm_is_enabled(pwm)) {
dev_warn(chip->dev, "Removing PWM device without disabling\n"); dev_warn(pwmchip_parent(chip), "Removing PWM device without disabling\n");
pm_runtime_put_sync(chip->dev); pm_runtime_put_sync(pwmchip_parent(chip));
} }
/* set period value to zero on free */ /* set period value to zero on free */
...@@ -528,7 +528,7 @@ static void ehrpwm_pwm_save_context(struct pwm_chip *chip) ...@@ -528,7 +528,7 @@ static void ehrpwm_pwm_save_context(struct pwm_chip *chip)
{ {
struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip); struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
pm_runtime_get_sync(chip->dev); pm_runtime_get_sync(pwmchip_parent(chip));
pc->ctx.tbctl = ehrpwm_read(pc->mmio_base, TBCTL); pc->ctx.tbctl = ehrpwm_read(pc->mmio_base, TBCTL);
pc->ctx.tbprd = ehrpwm_read(pc->mmio_base, TBPRD); pc->ctx.tbprd = ehrpwm_read(pc->mmio_base, TBPRD);
...@@ -539,7 +539,7 @@ static void ehrpwm_pwm_save_context(struct pwm_chip *chip) ...@@ -539,7 +539,7 @@ static void ehrpwm_pwm_save_context(struct pwm_chip *chip)
pc->ctx.aqsfrc = ehrpwm_read(pc->mmio_base, AQSFRC); pc->ctx.aqsfrc = ehrpwm_read(pc->mmio_base, AQSFRC);
pc->ctx.aqcsfrc = ehrpwm_read(pc->mmio_base, AQCSFRC); pc->ctx.aqcsfrc = ehrpwm_read(pc->mmio_base, AQCSFRC);
pm_runtime_put_sync(chip->dev); pm_runtime_put_sync(pwmchip_parent(chip));
} }
static void ehrpwm_pwm_restore_context(struct pwm_chip *chip) static void ehrpwm_pwm_restore_context(struct pwm_chip *chip)
......
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