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

pwm: tegra: Drop duplicated tracking of the parent device

The pwmchip stores a pointer to the parent device, so there is no need
to store another copy in driver private data. Drop struct
tegra_pwm_chip::dev and use the pwm_chip's parent pointer instead.

Link: https://lore.kernel.org/r/225f4bfcb15fb69eb818ddb71d623157c447180a.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 11ee0a12
...@@ -66,7 +66,6 @@ struct tegra_pwm_soc { ...@@ -66,7 +66,6 @@ struct tegra_pwm_soc {
struct tegra_pwm_chip { struct tegra_pwm_chip {
struct pwm_chip chip; struct pwm_chip chip;
struct device *dev;
struct clk *clk; struct clk *clk;
struct reset_control*rst; struct reset_control*rst;
...@@ -158,7 +157,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -158,7 +157,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
*/ */
required_clk_rate *= 2; required_clk_rate *= 2;
err = dev_pm_opp_set_rate(pc->dev, required_clk_rate); err = dev_pm_opp_set_rate(pwmchip_parent(chip), required_clk_rate);
if (err < 0) if (err < 0)
return -EINVAL; return -EINVAL;
...@@ -194,7 +193,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -194,7 +193,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
* before writing the register. Otherwise, keep it enabled. * before writing the register. Otherwise, keep it enabled.
*/ */
if (!pwm_is_enabled(pwm)) { if (!pwm_is_enabled(pwm)) {
err = pm_runtime_resume_and_get(pc->dev); err = pm_runtime_resume_and_get(pwmchip_parent(chip));
if (err) if (err)
return err; return err;
} else } else
...@@ -206,7 +205,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -206,7 +205,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
* If the PWM is not enabled, turn the clock off again to save power. * If the PWM is not enabled, turn the clock off again to save power.
*/ */
if (!pwm_is_enabled(pwm)) if (!pwm_is_enabled(pwm))
pm_runtime_put(pc->dev); pm_runtime_put(pwmchip_parent(chip));
return 0; return 0;
} }
...@@ -217,7 +216,7 @@ static int tegra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -217,7 +216,7 @@ static int tegra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
int rc = 0; int rc = 0;
u32 val; u32 val;
rc = pm_runtime_resume_and_get(pc->dev); rc = pm_runtime_resume_and_get(pwmchip_parent(chip));
if (rc) if (rc)
return rc; return rc;
...@@ -237,7 +236,7 @@ static void tegra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) ...@@ -237,7 +236,7 @@ static void tegra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
val &= ~PWM_ENABLE; val &= ~PWM_ENABLE;
pwm_writel(pc, pwm->hwpwm, val); pwm_writel(pc, pwm->hwpwm, val);
pm_runtime_put_sync(pc->dev); pm_runtime_put_sync(pwmchip_parent(chip));
} }
static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
...@@ -280,7 +279,6 @@ static int tegra_pwm_probe(struct platform_device *pdev) ...@@ -280,7 +279,6 @@ static int tegra_pwm_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
pc->soc = of_device_get_match_data(&pdev->dev); pc->soc = of_device_get_match_data(&pdev->dev);
pc->dev = &pdev->dev;
pc->regs = devm_platform_ioremap_resource(pdev, 0); pc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(pc->regs)) if (IS_ERR(pc->regs))
...@@ -302,7 +300,7 @@ static int tegra_pwm_probe(struct platform_device *pdev) ...@@ -302,7 +300,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
return ret; return ret;
/* Set maximum frequency of the IP */ /* Set maximum frequency of the IP */
ret = dev_pm_opp_set_rate(pc->dev, pc->soc->max_frequency); ret = dev_pm_opp_set_rate(&pdev->dev, pc->soc->max_frequency);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Failed to set max frequency: %d\n", ret); dev_err(&pdev->dev, "Failed to set max frequency: %d\n", ret);
goto put_pm; goto put_pm;
......
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