Skip to content

Commit

Permalink
drm/panel: Use dev_ based logging
Browse files Browse the repository at this point in the history
Standardize on the dev_ based logging and drop the include of drm_print.h.
Fix a few cases where "x@" was used when printing the mode.

Signed-off-by: Sam Ravnborg <[email protected]>
Reviewed-by: Guido Günther <[email protected]>
Cc: Jerry Han <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jagan Teki <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Guido Günther <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
sravnborg committed Aug 18, 2020
1 parent 65d5c86 commit a25b6b2
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 345 deletions.
44 changes: 15 additions & 29 deletions drivers/gpu/drm/panel/panel-boe-himax8279d.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>

#include <video/mipi_display.h>

Expand Down Expand Up @@ -93,8 +92,7 @@ static int boe_panel_disable(struct drm_panel *panel)

err = mipi_dsi_dcs_set_display_off(pinfo->link);
if (err < 0) {
DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
err);
dev_err(panel->dev, "failed to set display off: %d\n", err);
return err;
}

Expand All @@ -113,13 +111,11 @@ static int boe_panel_unprepare(struct drm_panel *panel)

err = mipi_dsi_dcs_set_display_off(pinfo->link);
if (err < 0)
DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
err);
dev_err(panel->dev, "failed to set display off: %d\n", err);

err = mipi_dsi_dcs_enter_sleep_mode(pinfo->link);
if (err < 0)
DRM_DEV_ERROR(panel->dev, "failed to enter sleep mode: %d\n",
err);
dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);

/* sleep_mode_delay: 1ms - 2ms */
usleep_range(1000, 2000);
Expand Down Expand Up @@ -163,15 +159,13 @@ static int boe_panel_prepare(struct drm_panel *panel)
/* send init code */
err = send_mipi_cmds(panel, pinfo->desc->on_cmds);
if (err < 0) {
DRM_DEV_ERROR(panel->dev, "failed to send DCS Init Code: %d\n",
err);
dev_err(panel->dev, "failed to send DCS Init Code: %d\n", err);
goto poweroff;
}

err = mipi_dsi_dcs_exit_sleep_mode(pinfo->link);
if (err < 0) {
DRM_DEV_ERROR(panel->dev, "failed to exit sleep mode: %d\n",
err);
dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
goto poweroff;
}

Expand All @@ -180,8 +174,7 @@ static int boe_panel_prepare(struct drm_panel *panel)

err = mipi_dsi_dcs_set_display_on(pinfo->link);
if (err < 0) {
DRM_DEV_ERROR(panel->dev, "failed to set display on: %d\n",
err);
dev_err(panel->dev, "failed to set display on: %d\n", err);
goto poweroff;
}

Expand Down Expand Up @@ -209,8 +202,7 @@ static int boe_panel_enable(struct drm_panel *panel)

ret = mipi_dsi_dcs_set_display_on(pinfo->link);
if (ret < 0) {
DRM_DEV_ERROR(panel->dev, "failed to set display on: %d\n",
ret);
dev_err(panel->dev, "failed to set display on: %d\n", ret);
return ret;
}

Expand All @@ -228,8 +220,8 @@ static int boe_panel_get_modes(struct drm_panel *panel,

mode = drm_mode_duplicate(connector->dev, m);
if (!mode) {
DRM_DEV_ERROR(pinfo->base.dev, "failed to add mode %ux%u@%u\n",
m->hdisplay, m->vdisplay, drm_mode_vrefresh(m));
dev_err(pinfo->base.dev, "failed to add mode %ux%u@%u\n",
m->hdisplay, m->vdisplay, drm_mode_vrefresh(m));
return -ENOMEM;
}

Expand Down Expand Up @@ -865,26 +857,23 @@ static int panel_add(struct panel_info *pinfo)
if (IS_ERR(pinfo->pp18_gpio)) {
ret = PTR_ERR(pinfo->pp18_gpio);
if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev, "failed to get pp18 gpio: %d\n",
ret);
dev_err(dev, "failed to get pp18 gpio: %d\n", ret);
return ret;
}

pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->pp33_gpio)) {
ret = PTR_ERR(pinfo->pp33_gpio);
if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev, "failed to get pp33 gpio: %d\n",
ret);
dev_err(dev, "failed to get pp33 gpio: %d\n", ret);
return ret;
}

pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(pinfo->enable_gpio)) {
ret = PTR_ERR(pinfo->enable_gpio);
if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev, "failed to get enable gpio: %d\n",
ret);
dev_err(dev, "failed to get enable gpio: %d\n", ret);
return ret;
}

Expand Down Expand Up @@ -937,18 +926,15 @@ static int panel_remove(struct mipi_dsi_device *dsi)

err = boe_panel_disable(&pinfo->base);
if (err < 0)
DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n",
err);
dev_err(&dsi->dev, "failed to disable panel: %d\n", err);

err = boe_panel_unprepare(&pinfo->base);
if (err < 0)
DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
err);
dev_err(&dsi->dev, "failed to unprepare panel: %d\n", err);

err = mipi_dsi_detach(dsi);
if (err < 0)
DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
err);
dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);

drm_panel_remove(&pinfo->base);

Expand Down
51 changes: 19 additions & 32 deletions drivers/gpu/drm/panel/panel-elida-kd35t133.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>

/* Manufacturer specific Commands send via DSI */
#define KD35T133_CMD_INTERFACEMODECTRL 0xb0
Expand Down Expand Up @@ -89,7 +88,7 @@ static int kd35t133_init_sequence(struct kd35t133 *ctx)
0xa9, 0x51, 0x2c, 0x82);
mipi_dsi_dcs_write(dsi, MIPI_DCS_ENTER_INVERT_MODE, NULL, 0);

DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n");
dev_dbg(dev, "Panel init sequence done\n");
return 0;
}

Expand All @@ -104,13 +103,11 @@ static int kd35t133_unprepare(struct drm_panel *panel)

ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret < 0)
DRM_DEV_ERROR(ctx->dev, "failed to set display off: %d\n",
ret);
dev_err(ctx->dev, "failed to set display off: %d\n", ret);

ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev, "failed to enter sleep mode: %d\n",
ret);
dev_err(ctx->dev, "failed to enter sleep mode: %d\n", ret);
return ret;
}

Expand All @@ -131,18 +128,16 @@ static int kd35t133_prepare(struct drm_panel *panel)
if (ctx->prepared)
return 0;

DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n");
dev_dbg(ctx->dev, "Resetting the panel\n");
ret = regulator_enable(ctx->vdd);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev,
"Failed to enable vdd supply: %d\n", ret);
dev_err(ctx->dev, "Failed to enable vdd supply: %d\n", ret);
return ret;
}

ret = regulator_enable(ctx->iovcc);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev,
"Failed to enable iovcc supply: %d\n", ret);
dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret);
goto disable_vdd;
}

Expand All @@ -156,22 +151,21 @@ static int kd35t133_prepare(struct drm_panel *panel)

ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
goto disable_iovcc;
}

msleep(250);

ret = kd35t133_init_sequence(ctx);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev, "Panel init sequence failed: %d\n",
ret);
dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret);
goto disable_iovcc;
}

ret = mipi_dsi_dcs_set_display_on(dsi);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev, "Failed to set display on: %d\n", ret);
dev_err(ctx->dev, "Failed to set display on: %d\n", ret);
goto disable_iovcc;
}

Expand Down Expand Up @@ -210,9 +204,9 @@ static int kd35t133_get_modes(struct drm_panel *panel,

mode = drm_mode_duplicate(connector->dev, &default_mode);
if (!mode) {
DRM_DEV_ERROR(ctx->dev, "Failed to add mode %ux%u@%u\n",
default_mode.hdisplay, default_mode.vdisplay,
drm_mode_vrefresh(&default_mode));
dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n",
default_mode.hdisplay, default_mode.vdisplay,
drm_mode_vrefresh(&default_mode));
return -ENOMEM;
}

Expand Down Expand Up @@ -244,27 +238,23 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)

ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ctx->reset_gpio)) {
DRM_DEV_ERROR(dev, "cannot get reset gpio\n");
dev_err(dev, "cannot get reset gpio\n");
return PTR_ERR(ctx->reset_gpio);
}

ctx->vdd = devm_regulator_get(dev, "vdd");
if (IS_ERR(ctx->vdd)) {
ret = PTR_ERR(ctx->vdd);
if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev,
"Failed to request vdd regulator: %d\n",
ret);
dev_err(dev, "Failed to request vdd regulator: %d\n", ret);
return ret;
}

ctx->iovcc = devm_regulator_get(dev, "iovcc");
if (IS_ERR(ctx->iovcc)) {
ret = PTR_ERR(ctx->iovcc);
if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev,
"Failed to request iovcc regulator: %d\n",
ret);
dev_err(dev, "Failed to request iovcc regulator: %d\n", ret);
return ret;
}

Expand All @@ -288,7 +278,7 @@ static int kd35t133_probe(struct mipi_dsi_device *dsi)

ret = mipi_dsi_attach(dsi);
if (ret < 0) {
DRM_DEV_ERROR(dev, "mipi_dsi_attach failed: %d\n", ret);
dev_err(dev, "mipi_dsi_attach failed: %d\n", ret);
drm_panel_remove(&ctx->panel);
return ret;
}
Expand All @@ -303,13 +293,11 @@ static void kd35t133_shutdown(struct mipi_dsi_device *dsi)

ret = drm_panel_unprepare(&ctx->panel);
if (ret < 0)
DRM_DEV_ERROR(&dsi->dev, "Failed to unprepare panel: %d\n",
ret);
dev_err(&dsi->dev, "Failed to unprepare panel: %d\n", ret);

ret = drm_panel_disable(&ctx->panel);
if (ret < 0)
DRM_DEV_ERROR(&dsi->dev, "Failed to disable panel: %d\n",
ret);
dev_err(&dsi->dev, "Failed to disable panel: %d\n", ret);
}

static int kd35t133_remove(struct mipi_dsi_device *dsi)
Expand All @@ -321,8 +309,7 @@ static int kd35t133_remove(struct mipi_dsi_device *dsi)

ret = mipi_dsi_detach(dsi);
if (ret < 0)
DRM_DEV_ERROR(&dsi->dev, "Failed to detach from DSI host: %d\n",
ret);
dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);

drm_panel_remove(&ctx->panel);

Expand Down
19 changes: 8 additions & 11 deletions drivers/gpu/drm/panel/panel-feixin-k101-im2ba02.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>

#define K101_IM2BA02_INIT_CMD_LEN 2

Expand Down Expand Up @@ -374,13 +373,11 @@ static int k101_im2ba02_unprepare(struct drm_panel *panel)

ret = mipi_dsi_dcs_set_display_off(ctx->dsi);
if (ret < 0)
DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
ret);
dev_err(panel->dev, "failed to set display off: %d\n", ret);

ret = mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
if (ret < 0)
DRM_DEV_ERROR(panel->dev, "failed to enter sleep mode: %d\n",
ret);
dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret);

msleep(200);

Expand Down Expand Up @@ -416,10 +413,10 @@ static int k101_im2ba02_get_modes(struct drm_panel *panel,

mode = drm_mode_duplicate(connector->dev, &k101_im2ba02_default_mode);
if (!mode) {
DRM_DEV_ERROR(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n",
k101_im2ba02_default_mode.hdisplay,
k101_im2ba02_default_mode.vdisplay,
drm_mode_vrefresh(&k101_im2ba02_default_mode));
dev_err(&ctx->dsi->dev, "failed to add mode %ux%u@%u\n",
k101_im2ba02_default_mode.hdisplay,
k101_im2ba02_default_mode.vdisplay,
drm_mode_vrefresh(&k101_im2ba02_default_mode));
return -ENOMEM;
}

Expand Down Expand Up @@ -460,13 +457,13 @@ static int k101_im2ba02_dsi_probe(struct mipi_dsi_device *dsi)
ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx->supplies),
ctx->supplies);
if (ret < 0) {
DRM_DEV_ERROR(&dsi->dev, "Couldn't get regulators\n");
dev_err(&dsi->dev, "Couldn't get regulators\n");
return ret;
}

ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ctx->reset)) {
DRM_DEV_ERROR(&dsi->dev, "Couldn't get our reset GPIO\n");
dev_err(&dsi->dev, "Couldn't get our reset GPIO\n");
return PTR_ERR(ctx->reset);
}

Expand Down
Loading

0 comments on commit a25b6b2

Please sign in to comment.