Skip to content

Commit

Permalink
drm/dbi: Print errors for mipi_dbi_command()
Browse files Browse the repository at this point in the history
The macro mipi_dbi_command() does not report errors unless you wrap it
in another macro to do the error reporting.

Report a rate-limited error so we know what is going on.

Drop the only user in DRM using mipi_dbi_command() and actually checking
the error explicitly, let it use mipi_dbi_command_buf() directly
instead.

After this any code wishing to send command arrays can rely on
mipi_dbi_command() providing an appropriate error message if something
goes wrong.

Suggested-by: Noralf Trønnes <noralf@tronnes.org>
Suggested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
linusw authored and intel-lab-lkp committed Jul 2, 2021
1 parent 3dbdb38 commit 42d93a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_mipi_dbi.c
Expand Up @@ -645,7 +645,7 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool
return 1;

mipi_dbi_hw_reset(dbi);
ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET);
ret = mipi_dbi_command_buf(dbi, MIPI_DCS_SOFT_RESET, NULL, 0);
if (ret) {
DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret);
if (dbidev->regulator)
Expand Down
6 changes: 5 additions & 1 deletion include/drm/drm_mipi_dbi.h
Expand Up @@ -183,7 +183,11 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
#define mipi_dbi_command(dbi, cmd, seq...) \
({ \
const u8 d[] = { seq }; \
mipi_dbi_command_stackbuf(dbi, cmd, d, ARRAY_SIZE(d)); \
struct device *dev = &dbi->spi->dev; \
int ret; \
ret = mipi_dbi_command_stackbuf(dbi, cmd, d, ARRAY_SIZE(d)); \
if (ret) \
dev_err_ratelimited(dev, "error %d when sending command\n", ret); \
})

#ifdef CONFIG_DEBUG_FS
Expand Down

0 comments on commit 42d93a5

Please sign in to comment.