Skip to content

Commit

Permalink
drm/panel: sitronix: 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: Jagan Teki <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Guido Günther <[email protected]>
Cc: Linus Walleij <[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 c8cf699 commit 65d5c86
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 44 deletions.
10 changes: 4 additions & 6 deletions drivers/gpu/drm/panel/panel-sitronix-st7701.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>

#include <linux/gpio/consumer.h>
#include <linux/delay.h>
Expand Down Expand Up @@ -269,10 +268,9 @@ static int st7701_get_modes(struct drm_panel *panel,

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

Expand Down Expand Up @@ -358,7 +356,7 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)

st7701->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(st7701->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(st7701->reset);
}

Expand Down
61 changes: 23 additions & 38 deletions drivers/gpu/drm/panel/panel-sitronix-st7703.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>

#define DRV_NAME "panel-sitronix-st7703"

Expand Down Expand Up @@ -364,16 +363,15 @@ static int st7703_enable(struct drm_panel *panel)

ret = ctx->desc->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);
return ret;
}

msleep(20);

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);
return ret;
}

Expand All @@ -384,7 +382,7 @@ static int st7703_enable(struct drm_panel *panel)
if (ret)
return ret;

DRM_DEV_DEBUG_DRIVER(ctx->dev, "Panel init sequence done\n");
dev_dbg(ctx->dev, "Panel init sequence done\n");

return 0;
}
Expand All @@ -397,13 +395,11 @@ static int st7703_disable(struct drm_panel *panel)

ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret < 0)
DRM_DEV_ERROR(ctx->dev,
"Failed to turn off the display: %d\n", ret);
dev_err(ctx->dev, "Failed to turn off the display: %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 0;
}
Expand Down Expand Up @@ -431,17 +427,15 @@ static int st7703_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->vcc);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev,
"Failed to enable vcc supply: %d\n", ret);
dev_err(ctx->dev, "Failed to enable vcc 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_vcc;
}

Expand All @@ -467,9 +461,9 @@ static int st7703_get_modes(struct drm_panel *panel,

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

Expand All @@ -496,7 +490,7 @@ static int allpixelson_set(void *data, u64 val)
struct st7703 *ctx = data;
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);

DRM_DEV_DEBUG_DRIVER(ctx->dev, "Setting all pixels on\n");
dev_dbg(ctx->dev, "Setting all pixels on\n");
dsi_generic_write_seq(dsi, ST7703_CMD_ALL_PIXEL_ON);
msleep(val * 1000);
/* Reset the panel to get video back */
Expand Down Expand Up @@ -537,7 +531,7 @@ static int st7703_probe(struct mipi_dsi_device *dsi)

ctx->reset_gpio = devm_gpiod_get(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);
}

Expand All @@ -554,18 +548,14 @@ static int st7703_probe(struct mipi_dsi_device *dsi)
if (IS_ERR(ctx->vcc)) {
ret = PTR_ERR(ctx->vcc);
if (ret != -EPROBE_DEFER)
DRM_DEV_ERROR(dev,
"Failed to request vcc regulator: %d\n",
ret);
dev_err(dev, "Failed to request vcc 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 @@ -580,17 +570,15 @@ static int st7703_probe(struct mipi_dsi_device *dsi)

ret = mipi_dsi_attach(dsi);
if (ret < 0) {
DRM_DEV_ERROR(dev,
"mipi_dsi_attach failed (%d). Is host ready?\n",
ret);
dev_err(dev, "mipi_dsi_attach failed (%d). Is host ready?\n", ret);
drm_panel_remove(&ctx->panel);
return ret;
}

DRM_DEV_INFO(dev, "%ux%u@%u %ubpp dsi %udl - ready\n",
ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
drm_mode_vrefresh(ctx->desc->mode),
mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);
dev_info(dev, "%ux%u@%u %ubpp dsi %udl - ready\n",
ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
drm_mode_vrefresh(ctx->desc->mode),
mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes);

st7703_debugfs_init(ctx);
return 0;
Expand All @@ -603,13 +591,11 @@ static void st7703_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 st7703_remove(struct mipi_dsi_device *dsi)
Expand All @@ -621,8 +607,7 @@ static int st7703_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

0 comments on commit 65d5c86

Please sign in to comment.