[01/13] drm/omap: panel-dpi: remove non-DT support

Submitted by Tomi Valkeinen on May 12, 2017, 10:41 a.m.

Details

Message ID 1494585702-9665-2-git-send-email-tomi.valkeinen@ti.com
State New
Headers show
Series "drm/omap: legacy cleanup" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Tomi Valkeinen May 12, 2017, 10:41 a.m.
Non-DT booting is no longer supported, so remove legacy code.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++-------------------------
 1 file changed, 6 insertions(+), 72 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index 04ce8c5f2954..75b98bb81de2 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -18,7 +18,6 @@ 
 #include <linux/regulator/consumer.h>
 #include <linux/backlight.h>
 
-#include <video/omap-panel-data.h>
 #include <video/of_display_timing.h>
 
 #include "../dss/omapdss.h"
@@ -33,9 +32,6 @@  struct panel_drv_data {
 
 	struct backlight_device *backlight;
 
-	/* used for non-DT boot, to be removed */
-	int backlight_gpio;
-
 	struct gpio_desc *enable_gpio;
 	struct regulator *vcc_supply;
 };
@@ -97,9 +93,6 @@  static int panel_dpi_enable(struct omap_dss_device *dssdev)
 
 	gpiod_set_value_cansleep(ddata->enable_gpio, 1);
 
-	if (gpio_is_valid(ddata->backlight_gpio))
-		gpio_set_value_cansleep(ddata->backlight_gpio, 1);
-
 	if (ddata->backlight) {
 		ddata->backlight->props.power = FB_BLANK_UNBLANK;
 		backlight_update_status(ddata->backlight);
@@ -118,9 +111,6 @@  static void panel_dpi_disable(struct omap_dss_device *dssdev)
 	if (!omapdss_device_is_enabled(dssdev))
 		return;
 
-	if (gpio_is_valid(ddata->backlight_gpio))
-		gpio_set_value_cansleep(ddata->backlight_gpio, 0);
-
 	if (ddata->backlight) {
 		ddata->backlight->props.power = FB_BLANK_POWERDOWN;
 		backlight_update_status(ddata->backlight);
@@ -177,47 +167,6 @@  static struct omap_dss_driver panel_dpi_ops = {
 	.get_resolution	= omapdss_default_get_resolution,
 };
 
-static int panel_dpi_probe_pdata(struct platform_device *pdev)
-{
-	const struct panel_dpi_platform_data *pdata;
-	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-	struct omap_dss_device *dssdev, *in;
-	int r;
-
-	pdata = dev_get_platdata(&pdev->dev);
-
-	in = omap_dss_find_output(pdata->source);
-	if (in == NULL) {
-		dev_err(&pdev->dev, "failed to find video source '%s'\n",
-				pdata->source);
-		return -EPROBE_DEFER;
-	}
-
-	ddata->in = in;
-
-	ddata->data_lines = pdata->data_lines;
-
-	videomode_from_timing(pdata->display_timing, &ddata->vm);
-
-	dssdev = &ddata->dssdev;
-	dssdev->name = pdata->name;
-
-	r = devm_gpio_request_one(&pdev->dev, pdata->enable_gpio,
-					GPIOF_OUT_INIT_LOW, "panel enable");
-	if (r)
-		goto err_gpio;
-
-	ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio);
-
-	ddata->backlight_gpio = pdata->backlight_gpio;
-
-	return 0;
-
-err_gpio:
-	omap_dss_put_device(ddata->in);
-	return r;
-}
-
 static int panel_dpi_probe_of(struct platform_device *pdev)
 {
 	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
@@ -248,8 +197,6 @@  static int panel_dpi_probe_of(struct platform_device *pdev)
 	if (IS_ERR(ddata->vcc_supply))
 		return PTR_ERR(ddata->vcc_supply);
 
-	ddata->backlight_gpio = -ENOENT;
-
 	bl_node = of_parse_phandle(node, "backlight", 0);
 	if (bl_node) {
 		ddata->backlight = of_find_backlight_by_node(bl_node);
@@ -291,30 +238,18 @@  static int panel_dpi_probe(struct platform_device *pdev)
 	struct omap_dss_device *dssdev;
 	int r;
 
+	if (!pdev->dev.of_node)
+		return -ENODEV;
+
 	ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
 	if (ddata == NULL)
 		return -ENOMEM;
 
 	platform_set_drvdata(pdev, ddata);
 
-	if (dev_get_platdata(&pdev->dev)) {
-		r = panel_dpi_probe_pdata(pdev);
-		if (r)
-			return r;
-	} else if (pdev->dev.of_node) {
-		r = panel_dpi_probe_of(pdev);
-		if (r)
-			return r;
-	} else {
-		return -ENODEV;
-	}
-
-	if (gpio_is_valid(ddata->backlight_gpio)) {
-		r = devm_gpio_request_one(&pdev->dev, ddata->backlight_gpio,
-				GPIOF_OUT_INIT_LOW, "panel backlight");
-		if (r)
-			goto err_gpio;
-	}
+	r = panel_dpi_probe_of(pdev);
+	if (r)
+		return r;
 
 	dssdev = &ddata->dssdev;
 	dssdev->dev = &pdev->dev;
@@ -333,7 +268,6 @@  static int panel_dpi_probe(struct platform_device *pdev)
 	return 0;
 
 err_reg:
-err_gpio:
 	omap_dss_put_device(ddata->in);
 	return r;
 }

Comments

Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:30 Tomi Valkeinen wrote:
> Non-DT booting is no longer supported, so remove legacy code.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++----------------------
>  1 file changed, 6 insertions(+), 72 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
> 04ce8c5f2954..75b98bb81de2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -18,7 +18,6 @@

I think you can drop linux/of_gpio.h.

>  #include <linux/regulator/consumer.h>
>  #include <linux/backlight.h>
> 
> -#include <video/omap-panel-data.h>
>  #include <video/of_display_timing.h>
> 
>  #include "../dss/omapdss.h"
> @@ -33,9 +32,6 @@ struct panel_drv_data {
> 
>  	struct backlight_device *backlight;
> 
> -	/* used for non-DT boot, to be removed */
> -	int backlight_gpio;
> -
>  	struct gpio_desc *enable_gpio;
>  	struct regulator *vcc_supply;
>  };
> @@ -97,9 +93,6 @@ static int panel_dpi_enable(struct omap_dss_device
> *dssdev)
> 
>  	gpiod_set_value_cansleep(ddata->enable_gpio, 1);
> 
> -	if (gpio_is_valid(ddata->backlight_gpio))
> -		gpio_set_value_cansleep(ddata->backlight_gpio, 1);
> -
>  	if (ddata->backlight) {
>  		ddata->backlight->props.power = FB_BLANK_UNBLANK;
>  		backlight_update_status(ddata->backlight);
> @@ -118,9 +111,6 @@ static void panel_dpi_disable(struct omap_dss_device
> *dssdev) if (!omapdss_device_is_enabled(dssdev))
>  		return;
> 
> -	if (gpio_is_valid(ddata->backlight_gpio))
> -		gpio_set_value_cansleep(ddata->backlight_gpio, 0);
> -
>  	if (ddata->backlight) {
>  		ddata->backlight->props.power = FB_BLANK_POWERDOWN;
>  		backlight_update_status(ddata->backlight);
> @@ -177,47 +167,6 @@ static struct omap_dss_driver panel_dpi_ops = {
>  	.get_resolution	= omapdss_default_get_resolution,
>  };
> 
> -static int panel_dpi_probe_pdata(struct platform_device *pdev)
> -{
> -	const struct panel_dpi_platform_data *pdata;
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> -	struct omap_dss_device *dssdev, *in;
> -	int r;
> -
> -	pdata = dev_get_platdata(&pdev->dev);
> -
> -	in = omap_dss_find_output(pdata->source);
> -	if (in == NULL) {
> -		dev_err(&pdev->dev, "failed to find video source '%s'\n",
> -				pdata->source);
> -		return -EPROBE_DEFER;
> -	}
> -
> -	ddata->in = in;
> -
> -	ddata->data_lines = pdata->data_lines;
> -
> -	videomode_from_timing(pdata->display_timing, &ddata->vm);
> -
> -	dssdev = &ddata->dssdev;
> -	dssdev->name = pdata->name;
> -
> -	r = devm_gpio_request_one(&pdev->dev, pdata->enable_gpio,
> -					GPIOF_OUT_INIT_LOW, "panel enable");
> -	if (r)
> -		goto err_gpio;
> -
> -	ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio);
> -
> -	ddata->backlight_gpio = pdata->backlight_gpio;
> -
> -	return 0;
> -
> -err_gpio:
> -	omap_dss_put_device(ddata->in);
> -	return r;
> -}
> -
>  static int panel_dpi_probe_of(struct platform_device *pdev)
>  {
>  	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> @@ -248,8 +197,6 @@ static int panel_dpi_probe_of(struct platform_device
> *pdev) if (IS_ERR(ddata->vcc_supply))
>  		return PTR_ERR(ddata->vcc_supply);
> 
> -	ddata->backlight_gpio = -ENOENT;
> -
>  	bl_node = of_parse_phandle(node, "backlight", 0);
>  	if (bl_node) {
>  		ddata->backlight = of_find_backlight_by_node(bl_node);
> @@ -291,30 +238,18 @@ static int panel_dpi_probe(struct platform_device
> *pdev) struct omap_dss_device *dssdev;
>  	int r;
> 
> +	if (!pdev->dev.of_node)
> +		return -ENODEV;
> +

This can't happen.

>  	ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
>  	if (ddata == NULL)
>  		return -ENOMEM;
> 
>  	platform_set_drvdata(pdev, ddata);
> 
> -	if (dev_get_platdata(&pdev->dev)) {
> -		r = panel_dpi_probe_pdata(pdev);
> -		if (r)
> -			return r;
> -	} else if (pdev->dev.of_node) {
> -		r = panel_dpi_probe_of(pdev);
> -		if (r)
> -			return r;
> -	} else {
> -		return -ENODEV;
> -	}
> -
> -	if (gpio_is_valid(ddata->backlight_gpio)) {
> -		r = devm_gpio_request_one(&pdev->dev, ddata->backlight_gpio,
> -				GPIOF_OUT_INIT_LOW, "panel backlight");
> -		if (r)
> -			goto err_gpio;
> -	}
> +	r = panel_dpi_probe_of(pdev);
> +	if (r)
> +		return r;
> 
>  	dssdev = &ddata->dssdev;
>  	dssdev->dev = &pdev->dev;
> @@ -333,7 +268,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
> return 0;
> 
>  err_reg:
> -err_gpio:
>  	omap_dss_put_device(ddata->in);
>  	return r;
>  }
Hi,

On 12/05/17 15:08, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Friday 12 May 2017 13:41:30 Tomi Valkeinen wrote:
>> Non-DT booting is no longer supported, so remove legacy code.
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
>> ---
>>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++----------------------
>>  1 file changed, 6 insertions(+), 72 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
>> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
>> 04ce8c5f2954..75b98bb81de2 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
>> @@ -18,7 +18,6 @@
> 
> I think you can drop linux/of_gpio.h.

Yep.

>> +	if (!pdev->dev.of_node)
>> +		return -ENODEV;
>> +
> 
> This can't happen.

True. I have removed that from the first three patches.

Do you want me to resend, or can I get your reviewed-by?

 Tomi
Hi Tomi,

On Friday 12 May 2017 15:29:38 Tomi Valkeinen wrote:
> On 12/05/17 15:08, Laurent Pinchart wrote:
> > On Friday 12 May 2017 13:41:30 Tomi Valkeinen wrote:
> >> Non-DT booting is no longer supported, so remove legacy code.
> >> 
> >> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> >> ---
> >> 
> >>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++-------------------
> >>  1 file changed, 6 insertions(+), 72 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
> >> 04ce8c5f2954..75b98bb81de2 100644
> >> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >> @@ -18,7 +18,6 @@
> > 
> > I think you can drop linux/of_gpio.h.
> 
> Yep.
> 
> >> +	if (!pdev->dev.of_node)
> >> +		return -ENODEV;
> >> +
> > 
> > This can't happen.
> 
> True. I have removed that from the first three patches.
> 
> Do you want me to resend, or can I get your reviewed-by?

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>