[PATCH v1 09/19] drm/panel: jdi: use DRM_DEV*

Sam Ravnborg sam at ravnborg.org
Thu Jan 31 19:26:09 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-jdi-lt070me05000.c | 64 ++++++++++++++------------
 1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index fecdda0b99a5..6e172b5d7dff 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -31,6 +31,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
 
@@ -77,19 +78,19 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT << 4);
 	if (ret < 0) {
-		dev_err(dev, "failed to set pixel format: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set pixel format: %d\n", ret);
 		return ret;
 	}
 
 	ret = mipi_dsi_dcs_set_column_address(dsi, 0, jdi->mode->hdisplay - 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to set column address: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set column address: %d\n", ret);
 		return ret;
 	}
 
 	ret = mipi_dsi_dcs_set_page_address(dsi, 0, jdi->mode->vdisplay - 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to set page address: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set page address: %d\n", ret);
 		return ret;
 	}
 
@@ -102,7 +103,8 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 	ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY,
 				 (u8[]){ 0x24 }, 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to write control display: %d\n", ret);
+		DRM_DEV_ERROR(dev,
+			      "failed to write control display: %d\n", ret);
 		return ret;
 	}
 
@@ -110,13 +112,13 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 	ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_POWER_SAVE,
 				 (u8[]){ 0x00 }, 1);
 	if (ret < 0) {
-		dev_err(dev, "failed to set cabc off: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set cabc off: %d\n", ret);
 		return ret;
 	}
 
 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
 	if (ret < 0) {
-		dev_err(dev, "failed to set exit sleep mode: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set exit sleep mode: %d\n", ret);
 		return ret;
 	}
 
@@ -124,7 +126,7 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_generic_write(dsi, (u8[]){0xB0, 0x00}, 2);
 	if (ret < 0) {
-		dev_err(dev, "failed to set mcap: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set mcap: %d\n", ret);
 		return ret;
 	}
 
@@ -134,8 +136,9 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 	ret = mipi_dsi_generic_write(dsi, (u8[])
 				     {0xB3, 0x26, 0x08, 0x00, 0x20, 0x00}, 6);
 	if (ret < 0) {
-		dev_err(dev, "failed to set display interface setting: %d\n"
-			, ret);
+		DRM_DEV_ERROR(dev,
+			      "failed to set display interface setting: %d\n",
+			      ret);
 		return ret;
 	}
 
@@ -143,8 +146,9 @@ static int jdi_panel_init(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_generic_write(dsi, (u8[]){0xB0, 0x03}, 2);
 	if (ret < 0) {
-		dev_err(dev, "failed to set default values for mcap: %d\n"
-			, ret);
+		DRM_DEV_ERROR(dev,
+			      "failed to set default values for mcap: %d\n",
+			      ret);
 		return ret;
 	}
 
@@ -161,7 +165,7 @@ static int jdi_panel_on(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_dcs_set_display_on(dsi);
 	if (ret < 0)
-		dev_err(dev, "failed to set display on: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set display on: %d\n", ret);
 
 	return ret;
 }
@@ -176,11 +180,11 @@ static void jdi_panel_off(struct jdi_panel *jdi)
 
 	ret = mipi_dsi_dcs_set_display_off(dsi);
 	if (ret < 0)
-		dev_err(dev, "failed to set display off: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set display off: %d\n", ret);
 
 	ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
 	if (ret < 0)
-		dev_err(dev, "failed to enter sleep mode: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to enter sleep mode: %d\n", ret);
 
 	msleep(100);
 }
@@ -212,7 +216,7 @@ static int jdi_panel_unprepare(struct drm_panel *panel)
 
 	ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
 	if (ret < 0)
-		dev_err(dev, "regulator disable failed, %d\n", ret);
+		DRM_DEV_ERROR(dev, "regulator disable failed, %d\n", ret);
 
 	gpiod_set_value(jdi->enable_gpio, 0);
 
@@ -236,7 +240,7 @@ static int jdi_panel_prepare(struct drm_panel *panel)
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
 	if (ret < 0) {
-		dev_err(dev, "regulator enable failed, %d\n", ret);
+		DRM_DEV_ERROR(dev, "regulator enable failed, %d\n", ret);
 		return ret;
 	}
 
@@ -253,13 +257,13 @@ static int jdi_panel_prepare(struct drm_panel *panel)
 
 	ret = jdi_panel_init(jdi);
 	if (ret < 0) {
-		dev_err(dev, "failed to init panel: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to init panel: %d\n", ret);
 		goto poweroff;
 	}
 
 	ret = jdi_panel_on(jdi);
 	if (ret < 0) {
-		dev_err(dev, "failed to set panel on: %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to set panel on: %d\n", ret);
 		goto poweroff;
 	}
 
@@ -270,7 +274,7 @@ static int jdi_panel_prepare(struct drm_panel *panel)
 poweroff:
 	ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
 	if (ret < 0)
-		dev_err(dev, "regulator disable failed, %d\n", ret);
+		DRM_DEV_ERROR(dev, "regulator disable failed, %d\n", ret);
 
 	gpiod_set_value(jdi->enable_gpio, 0);
 
@@ -317,9 +321,9 @@ static int jdi_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(dev, "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -414,35 +418,35 @@ static int jdi_panel_add(struct jdi_panel *jdi)
 	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(jdi->supplies),
 				      jdi->supplies);
 	if (ret < 0) {
-		dev_err(dev, "failed to init regulator, ret=%d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to init regulator, ret=%d\n", ret);
 		return ret;
 	}
 
 	jdi->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
 	if (IS_ERR(jdi->enable_gpio)) {
 		ret = PTR_ERR(jdi->enable_gpio);
-		dev_err(dev, "cannot get enable-gpio %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get enable-gpio %d\n", ret);
 		return ret;
 	}
 
 	jdi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(jdi->reset_gpio)) {
 		ret = PTR_ERR(jdi->reset_gpio);
-		dev_err(dev, "cannot get reset-gpios %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get reset-gpios %d\n", ret);
 		return ret;
 	}
 
 	jdi->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
 	if (IS_ERR(jdi->dcdc_en_gpio)) {
 		ret = PTR_ERR(jdi->dcdc_en_gpio);
-		dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
+		DRM_DEV_ERROR(dev, "cannot get dcdc-en-gpio %d\n", ret);
 		return ret;
 	}
 
 	jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi);
 	if (IS_ERR(jdi->backlight)) {
 		ret = PTR_ERR(jdi->backlight);
-		dev_err(dev, "failed to register backlight %d\n", ret);
+		DRM_DEV_ERROR(dev, "failed to register backlight %d\n", ret);
 		return ret;
 	}
 
@@ -493,12 +497,12 @@ static int jdi_panel_remove(struct mipi_dsi_device *dsi)
 
 	ret = jdi_panel_disable(&jdi->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);
 
 	jdi_panel_del(jdi);
 
-- 
2.12.0



More information about the dri-devel mailing list