[PATCH v1 18/19] drm/panel: sharp: use DRM_DEV*

Sam Ravnborg sam at ravnborg.org
Thu Jan 31 19:26:18 UTC 2019


Introduce use of DRM_DEV* for logging.
This makes logging in the drm subsystem more consistent.

Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
Cc: Thierry Reding <thierry.reding at gmail.com>
Cc: David Airlie <airlied at linux.ie>
Cc: Daniel Vetter <daniel at ffwll.ch>
---
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 63 ++++++++++++++++---------
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 24 ++++++----
 2 files changed, 55 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index 2ed11d86c10e..98788750084c 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -17,6 +17,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -58,14 +59,16 @@ static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value)
 
 	err = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
 	if (err < 0) {
-		dev_err(&dsi->dev, "failed to write %02x to %04x: %zd\n",
-			value, offset, err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to write %02x to %04x: %zd\n",
+			      value, offset, err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_nop(dsi);
 	if (err < 0) {
-		dev_err(&dsi->dev, "failed to send DCS nop: %zd\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to send DCS nop: %zd\n", err);
 		return err;
 	}
 
@@ -84,8 +87,9 @@ static __maybe_unused int sharp_panel_read(struct sharp_panel *sharp,
 	err = mipi_dsi_generic_read(sharp->link1, &offset, sizeof(offset),
 				    value, sizeof(*value));
 	if (err < 0)
-		dev_err(&sharp->link1->dev, "failed to read from %04x: %zd\n",
-			offset, err);
+		DRM_DEV_ERROR(&sharp->link1->dev,
+			      "failed to read from %04x: %zd\n",
+			      offset, err);
 
 	return err;
 }
@@ -116,11 +120,13 @@ static int sharp_panel_unprepare(struct drm_panel *panel)
 
 	err = mipi_dsi_dcs_set_display_off(sharp->link1);
 	if (err < 0)
-		dev_err(panel->dev, "failed to set display off: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set display off: %d\n", err);
 
 	err = mipi_dsi_dcs_enter_sleep_mode(sharp->link1);
 	if (err < 0)
-		dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to enter sleep mode: %d\n", err);
 
 	msleep(120);
 
@@ -139,26 +145,30 @@ static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,
 
 	err = mipi_dsi_dcs_set_column_address(left, 0, mode->hdisplay / 2 - 1);
 	if (err < 0) {
-		dev_err(&left->dev, "failed to set column address: %d\n", err);
+		DRM_DEV_ERROR(&left->dev,
+			      "failed to set column address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_page_address(left, 0, mode->vdisplay - 1);
 	if (err < 0) {
-		dev_err(&left->dev, "failed to set page address: %d\n", err);
+		DRM_DEV_ERROR(&left->dev,
+			      "failed to set page address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_column_address(right, mode->hdisplay / 2,
 					      mode->hdisplay - 1);
 	if (err < 0) {
-		dev_err(&right->dev, "failed to set column address: %d\n", err);
+		DRM_DEV_ERROR(&right->dev,
+			      "failed to set column address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_page_address(right, 0, mode->vdisplay - 1);
 	if (err < 0) {
-		dev_err(&right->dev, "failed to set page address: %d\n", err);
+		DRM_DEV_ERROR(&right->dev,
+			      "failed to set page address: %d\n", err);
 		return err;
 	}
 
@@ -188,7 +198,8 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 
 	err = mipi_dsi_dcs_exit_sleep_mode(sharp->link1);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to exit sleep mode: %d\n", err);
 		goto poweroff;
 	}
 
@@ -204,20 +215,23 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 	/* set left-right mode */
 	err = sharp_panel_write(sharp, 0x1000, 0x2a);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set left-right mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set left-right mode: %d\n", err);
 		goto poweroff;
 	}
 
 	/* enable command mode */
 	err = sharp_panel_write(sharp, 0x1001, 0x01);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to enable command mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to enable command mode: %d\n", err);
 		goto poweroff;
 	}
 
 	err = mipi_dsi_dcs_set_pixel_format(sharp->link1, format);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set pixel format: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set pixel format: %d\n", err);
 		goto poweroff;
 	}
 
@@ -231,14 +245,16 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 	err = sharp_setup_symmetrical_split(sharp->link1, sharp->link2,
 					    sharp->mode);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set up symmetrical split: %d\n",
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set up symmetrical split: %d\n",
 			err);
 		goto poweroff;
 	}
 
 	err = mipi_dsi_dcs_set_display_on(sharp->link1);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set display on: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set display on: %d\n", err);
 		goto poweroff;
 	}
 
@@ -287,9 +303,10 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -413,11 +430,13 @@ static int sharp_panel_remove(struct mipi_dsi_device *dsi)
 
 	err = sharp_panel_disable(&sharp->base);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to disable panel: %d\n", err);
 
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", err);
 
 	sharp_panel_del(sharp);
 
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index e8e2277e934d..c34bb2a16f0e 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -29,6 +29,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -135,7 +136,8 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel)
 
 	ret = sharp_nt_panel_off(sharp_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to set panel off: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set panel off: %d\n", ret);
 		return ret;
 	}
 
@@ -173,13 +175,13 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel)
 
 	ret = sharp_nt_panel_init(sharp_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to init panel: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev, "failed to init panel: %d\n", ret);
 		goto poweroff;
 	}
 
 	ret = sharp_nt_panel_on(sharp_nt);
 	if (ret < 0) {
-		dev_err(panel->dev, "failed to set panel on: %d\n", ret);
+		DRM_DEV_ERROR(panel->dev, "failed to set panel on: %d\n", ret);
 		goto poweroff;
 	}
 
@@ -227,9 +229,10 @@ static int sharp_nt_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-				default_mode.hdisplay, default_mode.vdisplay,
-				default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -263,8 +266,8 @@ static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
 
 	sharp_nt->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(sharp_nt->reset_gpio)) {
-		dev_err(dev, "cannot get reset-gpios %ld\n",
-			PTR_ERR(sharp_nt->reset_gpio));
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %ld\n",
+			      PTR_ERR(sharp_nt->reset_gpio));
 		sharp_nt->reset_gpio = NULL;
 	} else {
 		gpiod_set_value(sharp_nt->reset_gpio, 0);
@@ -322,11 +325,12 @@ static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
 
 	ret = sharp_nt_panel_disable(&sharp_nt->base);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", ret);
 
 	ret = mipi_dsi_detach(dsi);
 	if (ret < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", ret);
 
 	sharp_nt_panel_del(sharp_nt);
 
-- 
2.12.0



More information about the dri-devel mailing list