Skip to content

Commit 596de87

Browse files
author
Uwe Kleine-König
committed
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: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/a56cbaf049f5f23c0e0fe36b0799dd20189675e0.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 4867424 commit 596de87

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

drivers/gpu/drm/bridge/ti-sn65dsi86.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ struct ti_sn65dsi86 {
197197
DECLARE_BITMAP(gchip_output, SN_NUM_GPIOS);
198198
#endif
199199
#if defined(CONFIG_PWM)
200-
struct pwm_chip pchip;
200+
struct pwm_chip *pchip;
201201
bool pwm_enabled;
202202
atomic_t pwm_pin_busy;
203203
#endif
@@ -1374,7 +1374,7 @@ static void ti_sn_pwm_pin_release(struct ti_sn65dsi86 *pdata)
13741374

13751375
static struct ti_sn65dsi86 *pwm_chip_to_ti_sn_bridge(struct pwm_chip *chip)
13761376
{
1377-
return container_of(chip, struct ti_sn65dsi86, pchip);
1377+
return pwmchip_get_drvdata(chip);
13781378
}
13791379

13801380
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 = {
15851585
static int ti_sn_pwm_probe(struct auxiliary_device *adev,
15861586
const struct auxiliary_device_id *id)
15871587
{
1588+
struct pwm_chip *chip;
15881589
struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent);
15891590

1590-
pdata->pchip.dev = &adev->dev;
1591-
pdata->pchip.ops = &ti_sn_pwm_ops;
1592-
pdata->pchip.npwm = 1;
1593-
pdata->pchip.of_xlate = of_pwm_single_xlate;
1591+
pdata->pchip = chip = devm_pwmchip_alloc(&adev->dev, 1, 0);
1592+
if (IS_ERR(chip))
1593+
return PTR_ERR(chip);
1594+
1595+
pwmchip_set_drvdata(chip, pdata);
1596+
1597+
chip->ops = &ti_sn_pwm_ops;
1598+
chip->of_xlate = of_pwm_single_xlate;
15941599

15951600
devm_pm_runtime_enable(&adev->dev);
15961601

1597-
return pwmchip_add(&pdata->pchip);
1602+
return pwmchip_add(chip);
15981603
}
15991604

16001605
static void ti_sn_pwm_remove(struct auxiliary_device *adev)
16011606
{
16021607
struct ti_sn65dsi86 *pdata = dev_get_drvdata(adev->dev.parent);
16031608

1604-
pwmchip_remove(&pdata->pchip);
1609+
pwmchip_remove(pdata->pchip);
16051610

16061611
if (pdata->pwm_enabled)
16071612
pm_runtime_put_sync(&adev->dev);

0 commit comments

Comments
 (0)