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

drm/bridge: ti-sn65dsi86: Make use of devm_pwmchip_alloc() function

This prepares the pwm driver of the ti-sn65dsi86 to further changes of
the pwm core outlined in the commit introducing devm_pwmchip_alloc().
There is no intended semantical change and the driver should behave as
before.
Acked-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/a56cbaf049f5f23c0e0fe36b0799dd20189675e0.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 48674246
...@@ -197,7 +197,7 @@ struct ti_sn65dsi86 { ...@@ -197,7 +197,7 @@ struct ti_sn65dsi86 {
DECLARE_BITMAP(gchip_output, SN_NUM_GPIOS); DECLARE_BITMAP(gchip_output, SN_NUM_GPIOS);
#endif #endif
#if defined(CONFIG_PWM) #if defined(CONFIG_PWM)
struct pwm_chip pchip; struct pwm_chip *pchip;
bool pwm_enabled; bool pwm_enabled;
atomic_t pwm_pin_busy; atomic_t pwm_pin_busy;
#endif #endif
...@@ -1374,7 +1374,7 @@ static void ti_sn_pwm_pin_release(struct ti_sn65dsi86 *pdata) ...@@ -1374,7 +1374,7 @@ static void ti_sn_pwm_pin_release(struct ti_sn65dsi86 *pdata)
static struct ti_sn65dsi86 *pwm_chip_to_ti_sn_bridge(struct pwm_chip *chip) static struct ti_sn65dsi86 *pwm_chip_to_ti_sn_bridge(struct pwm_chip *chip)
{ {
return container_of(chip, struct ti_sn65dsi86, pchip); return pwmchip_get_drvdata(chip);
} }
static int ti_sn_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) static int ti_sn_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
...@@ -1585,23 +1585,28 @@ static const struct pwm_ops ti_sn_pwm_ops = { ...@@ -1585,23 +1585,28 @@ static const struct pwm_ops ti_sn_pwm_ops = {
static int ti_sn_pwm_probe(struct auxiliary_device *adev, static int ti_sn_pwm_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id) const struct auxiliary_device_id *id)
{ {
struct pwm_chip *chip;
struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent); struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent);
pdata->pchip.dev = &adev->dev; pdata->pchip = chip = devm_pwmchip_alloc(&adev->dev, 1, 0);
pdata->pchip.ops = &ti_sn_pwm_ops; if (IS_ERR(chip))
pdata->pchip.npwm = 1; return PTR_ERR(chip);
pdata->pchip.of_xlate = of_pwm_single_xlate;
pwmchip_set_drvdata(chip, pdata);
chip->ops = &ti_sn_pwm_ops;
chip->of_xlate = of_pwm_single_xlate;
devm_pm_runtime_enable(&adev->dev); devm_pm_runtime_enable(&adev->dev);
return pwmchip_add(&pdata->pchip); return pwmchip_add(chip);
} }
static void ti_sn_pwm_remove(struct auxiliary_device *adev) static void ti_sn_pwm_remove(struct auxiliary_device *adev)
{ {
struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent); struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent);
pwmchip_remove(&pdata->pchip); pwmchip_remove(pdata->pchip);
if (pdata->pwm_enabled) if (pdata->pwm_enabled)
pm_runtime_put_sync(&adev->dev); pm_runtime_put_sync(&adev->dev);
......
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