From: Lucas Stach Date: Mon, 8 Jul 2019 12:41:29 +0000 (+0200) Subject: backlight: rave-sp: Leave initial state and register with correct device X-Git-Tag: v5.4-rc1~62^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=865cac14c2dac2fa5f16d1781ca2746b0d323796;p=platform%2Fkernel%2Flinux-rpi.git backlight: rave-sp: Leave initial state and register with correct device This way the backlight can be referenced through its device node and enabling/disabling can be managed through the panel driver. Signed-off-by: Lucas Stach Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones --- diff --git a/drivers/video/backlight/rave-sp-backlight.c b/drivers/video/backlight/rave-sp-backlight.c index 462f14a..05b5f00 100644 --- a/drivers/video/backlight/rave-sp-backlight.c +++ b/drivers/video/backlight/rave-sp-backlight.c @@ -48,14 +48,20 @@ static int rave_sp_backlight_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct backlight_device *bd; - bd = devm_backlight_device_register(dev, pdev->name, dev->parent, + bd = devm_backlight_device_register(dev, pdev->name, dev, dev_get_drvdata(dev->parent), &rave_sp_backlight_ops, &rave_sp_backlight_props); if (IS_ERR(bd)) return PTR_ERR(bd); - backlight_update_status(bd); + /* + * If there is a phandle pointing to the device node we can + * assume that another device will manage the status changes. + * If not we make sure the backlight is in a consistent state. + */ + if (!dev->of_node->phandle) + backlight_update_status(bd); return 0; }