linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource
@ 2019-06-27 18:21 Paul Cercueil
  2019-06-27 18:21 ` [PATCH 2/3] DRM: ingenic: Add support for Sharp panels Paul Cercueil
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Paul Cercueil @ 2019-06-27 18:21 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Sam Ravnborg, dri-devel, linux-kernel, od, Paul Cercueil

Simplify a bit the probe function by using the newly introduced
devm_platform_ioremap_resource(), instead of having to call
platform_get_resource() followed by devm_ioremap_resource().

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
index a069579ca749..02c4788ef1c7 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -580,7 +580,6 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	struct drm_bridge *bridge;
 	struct drm_panel *panel;
 	struct drm_device *drm;
-	struct resource *mem;
 	void __iomem *base;
 	long parent_rate;
 	int ret, irq;
@@ -614,8 +613,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	drm->mode_config.max_height = 600;
 	drm->mode_config.funcs = &ingenic_drm_mode_config_funcs;
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(dev, mem);
+	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base)) {
 		dev_err(dev, "Failed to get memory resource");
 		return PTR_ERR(base);
-- 
2.21.0.593.g511ec345e18


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] DRM: ingenic: Add support for Sharp panels
  2019-06-27 18:21 [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Paul Cercueil
@ 2019-06-27 18:21 ` Paul Cercueil
  2019-06-30  8:20   ` Sam Ravnborg
  2019-06-27 18:21 ` [PATCH 3/3] DRM: ingenic: Add support for panels with 8-bit serial bus Paul Cercueil
  2019-06-30  8:18 ` [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Sam Ravnborg
  2 siblings, 1 reply; 8+ messages in thread
From: Paul Cercueil @ 2019-06-27 18:21 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Sam Ravnborg, dri-devel, linux-kernel, od, Paul Cercueil

Add support for the LCD panels that must be driven with the
Sharp-specific signals SPL, CLS, REV, PS.

An example of such panel is the LS020B1DD01D supported by the
panel-simple DRM panel driver.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 64 +++++++++++++++++----------
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
index 02c4788ef1c7..da966f3dc1f7 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -166,6 +166,8 @@ struct ingenic_drm {
 
 	struct ingenic_dma_hwdesc *dma_hwdesc;
 	dma_addr_t dma_hwdesc_phys;
+
+	bool panel_is_sharp;
 };
 
 static const u32 ingenic_drm_primary_formats[] = {
@@ -283,6 +285,13 @@ static void ingenic_drm_crtc_update_timings(struct ingenic_drm *priv,
 	regmap_write(priv->map, JZ_REG_LCD_DAV,
 		     vds << JZ_LCD_DAV_VDS_OFFSET |
 		     vde << JZ_LCD_DAV_VDE_OFFSET);
+
+	if (priv->panel_is_sharp) {
+		regmap_write(priv->map, JZ_REG_LCD_PS, hde << 16 | (hde + 1));
+		regmap_write(priv->map, JZ_REG_LCD_CLS, hde << 16 | (hde + 1));
+		regmap_write(priv->map, JZ_REG_LCD_SPL, hpe << 16 | (hpe + 1));
+		regmap_write(priv->map, JZ_REG_LCD_REV, mode->htotal << 16);
+	}
 }
 
 static void ingenic_drm_crtc_update_ctrl(struct ingenic_drm *priv,
@@ -378,11 +387,18 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
 {
 	struct ingenic_drm *priv = drm_encoder_get_priv(encoder);
 	struct drm_display_mode *mode = &crtc_state->adjusted_mode;
-	struct drm_display_info *info = &conn_state->connector->display_info;
-	unsigned int cfg = JZ_LCD_CFG_PS_DISABLE
-			 | JZ_LCD_CFG_CLS_DISABLE
-			 | JZ_LCD_CFG_SPL_DISABLE
-			 | JZ_LCD_CFG_REV_DISABLE;
+	struct drm_connector *conn = conn_state->connector;
+	struct drm_display_info *info = &conn->display_info;
+	unsigned int cfg;
+
+	priv->panel_is_sharp = info->bus_flags & DRM_BUS_FLAG_SHARP_SIGNALS;
+
+	if (priv->panel_is_sharp) {
+		cfg = JZ_LCD_CFG_MODE_SPECIAL_TFT_1 | JZ_LCD_CFG_REV_POLARITY;
+	} else {
+		cfg = JZ_LCD_CFG_PS_DISABLE | JZ_LCD_CFG_CLS_DISABLE
+		    | JZ_LCD_CFG_SPL_DISABLE | JZ_LCD_CFG_REV_DISABLE;
+	}
 
 	if (mode->flags & DRM_MODE_FLAG_NHSYNC)
 		cfg |= JZ_LCD_CFG_HSYNC_ACTIVE_LOW;
@@ -393,24 +409,26 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
 	if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
 		cfg |= JZ_LCD_CFG_PCLK_FALLING_EDGE;
 
-	if (conn_state->connector->connector_type == DRM_MODE_CONNECTOR_TV) {
-		if (mode->flags & DRM_MODE_FLAG_INTERLACE)
-			cfg |= JZ_LCD_CFG_MODE_TV_OUT_I;
-		else
-			cfg |= JZ_LCD_CFG_MODE_TV_OUT_P;
-	} else {
-		switch (*info->bus_formats) {
-		case MEDIA_BUS_FMT_RGB565_1X16:
-			cfg |= JZ_LCD_CFG_MODE_GENERIC_16BIT;
-			break;
-		case MEDIA_BUS_FMT_RGB666_1X18:
-			cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT;
-			break;
-		case MEDIA_BUS_FMT_RGB888_1X24:
-			cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT;
-			break;
-		default:
-			break;
+	if (!priv->panel_is_sharp) {
+		if (conn->connector_type == DRM_MODE_CONNECTOR_TV) {
+			if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+				cfg |= JZ_LCD_CFG_MODE_TV_OUT_I;
+			else
+				cfg |= JZ_LCD_CFG_MODE_TV_OUT_P;
+		} else {
+			switch (*info->bus_formats) {
+			case MEDIA_BUS_FMT_RGB565_1X16:
+				cfg |= JZ_LCD_CFG_MODE_GENERIC_16BIT;
+				break;
+			case MEDIA_BUS_FMT_RGB666_1X18:
+				cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT;
+				break;
+			case MEDIA_BUS_FMT_RGB888_1X24:
+				cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT;
+				break;
+			default:
+				break;
+			}
 		}
 	}
 
-- 
2.21.0.593.g511ec345e18


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] DRM: ingenic: Add support for panels with 8-bit serial bus
  2019-06-27 18:21 [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Paul Cercueil
  2019-06-27 18:21 ` [PATCH 2/3] DRM: ingenic: Add support for Sharp panels Paul Cercueil
@ 2019-06-27 18:21 ` Paul Cercueil
  2019-06-30  8:21   ` Sam Ravnborg
  2019-06-30  8:18 ` [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Sam Ravnborg
  2 siblings, 1 reply; 8+ messages in thread
From: Paul Cercueil @ 2019-06-27 18:21 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Sam Ravnborg, dri-devel, linux-kernel, od, Paul Cercueil

Add support for the LCD panels with a serial 8-bit bus, where the color
components of each 24-bit pixel are sent sequentially.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
index da966f3dc1f7..ce1fae3a78a9 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -426,6 +426,9 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
 			case MEDIA_BUS_FMT_RGB888_1X24:
 				cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT;
 				break;
+			case MEDIA_BUS_FMT_RGB888_3X8:
+				cfg |= JZ_LCD_CFG_MODE_8BIT_SERIAL;
+				break;
 			default:
 				break;
 			}
@@ -451,6 +454,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
 	case MEDIA_BUS_FMT_RGB565_1X16:
 	case MEDIA_BUS_FMT_RGB666_1X18:
 	case MEDIA_BUS_FMT_RGB888_1X24:
+	case MEDIA_BUS_FMT_RGB888_3X8:
 		return 0;
 	default:
 		return -EINVAL;
-- 
2.21.0.593.g511ec345e18


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource
  2019-06-27 18:21 [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Paul Cercueil
  2019-06-27 18:21 ` [PATCH 2/3] DRM: ingenic: Add support for Sharp panels Paul Cercueil
  2019-06-27 18:21 ` [PATCH 3/3] DRM: ingenic: Add support for panels with 8-bit serial bus Paul Cercueil
@ 2019-06-30  8:18 ` Sam Ravnborg
  2019-06-30 11:09   ` Paul Cercueil
  2 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2019-06-30  8:18 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, od, linux-kernel, dri-devel

Hi Paul.

On Thu, Jun 27, 2019 at 08:21:12PM +0200, Paul Cercueil wrote:
> Simplify a bit the probe function by using the newly introduced
> devm_platform_ioremap_resource(), instead of having to call
> platform_get_resource() followed by devm_ioremap_resource().
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
> index a069579ca749..02c4788ef1c7 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
> @@ -580,7 +580,6 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>  	struct drm_bridge *bridge;
>  	struct drm_panel *panel;
>  	struct drm_device *drm;
> -	struct resource *mem;
>  	void __iomem *base;
>  	long parent_rate;
>  	int ret, irq;
> @@ -614,8 +613,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>  	drm->mode_config.max_height = 600;
>  	drm->mode_config.funcs = &ingenic_drm_mode_config_funcs;
>  
> -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	base = devm_ioremap_resource(dev, mem);
> +	base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(base)) {
>  		dev_err(dev, "Failed to get memory resource");
Consider to include the error code in the error message here.
>  		return PTR_ERR(base);

With the above fixed/considered:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] DRM: ingenic: Add support for Sharp panels
  2019-06-27 18:21 ` [PATCH 2/3] DRM: ingenic: Add support for Sharp panels Paul Cercueil
@ 2019-06-30  8:20   ` Sam Ravnborg
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2019-06-30  8:20 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, od, linux-kernel, dri-devel

On Thu, Jun 27, 2019 at 08:21:13PM +0200, Paul Cercueil wrote:
> Add support for the LCD panels that must be driven with the
> Sharp-specific signals SPL, CLS, REV, PS.
> 
> An example of such panel is the LS020B1DD01D supported by the
> panel-simple DRM panel driver.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/ingenic/ingenic-drm.c | 64 +++++++++++++++++----------
>  1 file changed, 41 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
> index 02c4788ef1c7..da966f3dc1f7 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
> @@ -166,6 +166,8 @@ struct ingenic_drm {
>  
>  	struct ingenic_dma_hwdesc *dma_hwdesc;
>  	dma_addr_t dma_hwdesc_phys;
> +
> +	bool panel_is_sharp;
>  };
>  
>  static const u32 ingenic_drm_primary_formats[] = {
> @@ -283,6 +285,13 @@ static void ingenic_drm_crtc_update_timings(struct ingenic_drm *priv,
>  	regmap_write(priv->map, JZ_REG_LCD_DAV,
>  		     vds << JZ_LCD_DAV_VDS_OFFSET |
>  		     vde << JZ_LCD_DAV_VDE_OFFSET);
> +
> +	if (priv->panel_is_sharp) {
> +		regmap_write(priv->map, JZ_REG_LCD_PS, hde << 16 | (hde + 1));
> +		regmap_write(priv->map, JZ_REG_LCD_CLS, hde << 16 | (hde + 1));
> +		regmap_write(priv->map, JZ_REG_LCD_SPL, hpe << 16 | (hpe + 1));
> +		regmap_write(priv->map, JZ_REG_LCD_REV, mode->htotal << 16);
> +	}
>  }
>  
>  static void ingenic_drm_crtc_update_ctrl(struct ingenic_drm *priv,
> @@ -378,11 +387,18 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
>  {
>  	struct ingenic_drm *priv = drm_encoder_get_priv(encoder);
>  	struct drm_display_mode *mode = &crtc_state->adjusted_mode;
> -	struct drm_display_info *info = &conn_state->connector->display_info;
> -	unsigned int cfg = JZ_LCD_CFG_PS_DISABLE
> -			 | JZ_LCD_CFG_CLS_DISABLE
> -			 | JZ_LCD_CFG_SPL_DISABLE
> -			 | JZ_LCD_CFG_REV_DISABLE;
> +	struct drm_connector *conn = conn_state->connector;
> +	struct drm_display_info *info = &conn->display_info;
> +	unsigned int cfg;
> +
> +	priv->panel_is_sharp = info->bus_flags & DRM_BUS_FLAG_SHARP_SIGNALS;
> +
> +	if (priv->panel_is_sharp) {
> +		cfg = JZ_LCD_CFG_MODE_SPECIAL_TFT_1 | JZ_LCD_CFG_REV_POLARITY;
> +	} else {
> +		cfg = JZ_LCD_CFG_PS_DISABLE | JZ_LCD_CFG_CLS_DISABLE
> +		    | JZ_LCD_CFG_SPL_DISABLE | JZ_LCD_CFG_REV_DISABLE;
> +	}
>  
>  	if (mode->flags & DRM_MODE_FLAG_NHSYNC)
>  		cfg |= JZ_LCD_CFG_HSYNC_ACTIVE_LOW;
> @@ -393,24 +409,26 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
>  	if (info->bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE)
>  		cfg |= JZ_LCD_CFG_PCLK_FALLING_EDGE;
>  
> -	if (conn_state->connector->connector_type == DRM_MODE_CONNECTOR_TV) {
> -		if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> -			cfg |= JZ_LCD_CFG_MODE_TV_OUT_I;
> -		else
> -			cfg |= JZ_LCD_CFG_MODE_TV_OUT_P;
> -	} else {
> -		switch (*info->bus_formats) {
> -		case MEDIA_BUS_FMT_RGB565_1X16:
> -			cfg |= JZ_LCD_CFG_MODE_GENERIC_16BIT;
> -			break;
> -		case MEDIA_BUS_FMT_RGB666_1X18:
> -			cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT;
> -			break;
> -		case MEDIA_BUS_FMT_RGB888_1X24:
> -			cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT;
> -			break;
> -		default:
> -			break;
> +	if (!priv->panel_is_sharp) {
> +		if (conn->connector_type == DRM_MODE_CONNECTOR_TV) {
> +			if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> +				cfg |= JZ_LCD_CFG_MODE_TV_OUT_I;
> +			else
> +				cfg |= JZ_LCD_CFG_MODE_TV_OUT_P;
> +		} else {
> +			switch (*info->bus_formats) {
> +			case MEDIA_BUS_FMT_RGB565_1X16:
> +				cfg |= JZ_LCD_CFG_MODE_GENERIC_16BIT;
> +				break;
> +			case MEDIA_BUS_FMT_RGB666_1X18:
> +				cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT;
> +				break;
> +			case MEDIA_BUS_FMT_RGB888_1X24:
> +				cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT;
> +				break;
> +			default:
> +				break;
> +			}
>  		}
>  	}
>  
> -- 
> 2.21.0.593.g511ec345e18
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] DRM: ingenic: Add support for panels with 8-bit serial bus
  2019-06-27 18:21 ` [PATCH 3/3] DRM: ingenic: Add support for panels with 8-bit serial bus Paul Cercueil
@ 2019-06-30  8:21   ` Sam Ravnborg
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2019-06-30  8:21 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, od, linux-kernel, dri-devel

On Thu, Jun 27, 2019 at 08:21:14PM +0200, Paul Cercueil wrote:
> Add support for the LCD panels with a serial 8-bit bus, where the color
> components of each 24-bit pixel are sent sequentially.

There are strange bus formats...

> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/ingenic/ingenic-drm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
> index da966f3dc1f7..ce1fae3a78a9 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
> @@ -426,6 +426,9 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,
>  			case MEDIA_BUS_FMT_RGB888_1X24:
>  				cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT;
>  				break;
> +			case MEDIA_BUS_FMT_RGB888_3X8:
> +				cfg |= JZ_LCD_CFG_MODE_8BIT_SERIAL;
> +				break;
>  			default:
>  				break;
>  			}
> @@ -451,6 +454,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
>  	case MEDIA_BUS_FMT_RGB565_1X16:
>  	case MEDIA_BUS_FMT_RGB666_1X18:
>  	case MEDIA_BUS_FMT_RGB888_1X24:
> +	case MEDIA_BUS_FMT_RGB888_3X8:
>  		return 0;
>  	default:
>  		return -EINVAL;
> -- 
> 2.21.0.593.g511ec345e18
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource
  2019-06-30  8:18 ` [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Sam Ravnborg
@ 2019-06-30 11:09   ` Paul Cercueil
  2019-06-30 20:56     ` Sam Ravnborg
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Cercueil @ 2019-06-30 11:09 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, Daniel Vetter, od, linux-kernel, dri-devel



Le dim. 30 juin 2019 à 10:18, Sam Ravnborg <sam@ravnborg.org> a écrit 
:
> Hi Paul.
> 
> On Thu, Jun 27, 2019 at 08:21:12PM +0200, Paul Cercueil wrote:
>>  Simplify a bit the probe function by using the newly introduced
>>  devm_platform_ioremap_resource(), instead of having to call
>>  platform_get_resource() followed by devm_ioremap_resource().
>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm.c
>>  index a069579ca749..02c4788ef1c7 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
>>  @@ -580,7 +580,6 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>   	struct drm_bridge *bridge;
>>   	struct drm_panel *panel;
>>   	struct drm_device *drm;
>>  -	struct resource *mem;
>>   	void __iomem *base;
>>   	long parent_rate;
>>   	int ret, irq;
>>  @@ -614,8 +613,7 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>   	drm->mode_config.max_height = 600;
>>   	drm->mode_config.funcs = &ingenic_drm_mode_config_funcs;
>> 
>>  -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>  -	base = devm_ioremap_resource(dev, mem);
>>  +	base = devm_platform_ioremap_resource(pdev, 0);
>>   	if (IS_ERR(base)) {
>>   		dev_err(dev, "Failed to get memory resource");
> Consider to include the error code in the error message here.

I don't think it's needed; a non-zero error code in the probe function 
will
have the drivers core automatically print a message with the name of the
failing driver and the return code.


>>   		return PTR_ERR(base);
> 
> With the above fixed/considered:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource
  2019-06-30 11:09   ` Paul Cercueil
@ 2019-06-30 20:56     ` Sam Ravnborg
  0 siblings, 0 replies; 8+ messages in thread
From: Sam Ravnborg @ 2019-06-30 20:56 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, dri-devel, od, linux-kernel

Hi Paul.

> > > 
> > >  -	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > >  -	base = devm_ioremap_resource(dev, mem);
> > >  +	base = devm_platform_ioremap_resource(pdev, 0);
> > >   	if (IS_ERR(base)) {
> > >   		dev_err(dev, "Failed to get memory resource");
> > Consider to include the error code in the error message here.
> 
> I don't think it's needed; a non-zero error code in the probe function will
> have the drivers core automatically print a message with the name of the
> failing driver and the return code.

You are right, I continue to forget this.
So the above is fine.

	Sam

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-30 20:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 18:21 [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Paul Cercueil
2019-06-27 18:21 ` [PATCH 2/3] DRM: ingenic: Add support for Sharp panels Paul Cercueil
2019-06-30  8:20   ` Sam Ravnborg
2019-06-27 18:21 ` [PATCH 3/3] DRM: ingenic: Add support for panels with 8-bit serial bus Paul Cercueil
2019-06-30  8:21   ` Sam Ravnborg
2019-06-30  8:18 ` [PATCH 1/3] DRM: ingenic: Use devm_platform_ioremap_resource Sam Ravnborg
2019-06-30 11:09   ` Paul Cercueil
2019-06-30 20:56     ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).