summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2020-08-10 00:51:03 +0300
committerLinus Walleij <linus.walleij@linaro.org>2020-09-05 02:24:26 +0300
commit91867ac7d6724c31f32c3a63e2bb5db978893eaf (patch)
treefe74aa328935fcca5446aa09f28416a935f63f75 /drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
parent435e06c06cb2e3bd2f650a52641ddb13a95a1624 (diff)
downloadlinux-91867ac7d6724c31f32c3a63e2bb5db978893eaf.tar.xz
drm/panel: s6e63m0: Add reading functionality
This adds code to send read commands to read a single byte from the display, in order to perform MTP ID look-up of the mounted panel on the s6e63m0 controller. This is needed for proper biasing on the DSI variants. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Stephan Gerhold <stephan@gerhold.net> Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com> Acked-by: Paul Cercueil <paul@crapouillou.net> Link: https://patchwork.freedesktop.org/patch/msgid/20200809215104.1830206-4-linus.walleij@linaro.org
Diffstat (limited to 'drivers/gpu/drm/panel/panel-samsung-s6e63m0.c')
-rw-r--r--drivers/gpu/drm/panel/panel-samsung-s6e63m0.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index 260c51642b25..c53706edee44 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -86,6 +86,7 @@ static u8 const s6e63m0_gamma_22[NUM_GAMMA_LEVELS][GAMMA_TABLE_COUNT] = {
struct s6e63m0 {
struct device *dev;
+ int (*dcs_read)(struct device *dev, const u8 cmd, u8 *val);
int (*dcs_write)(struct device *dev, const u8 *data, size_t len);
struct drm_panel panel;
struct backlight_device *bl_dev;
@@ -134,6 +135,14 @@ static int s6e63m0_clear_error(struct s6e63m0 *ctx)
return ret;
}
+static void s6e63m0_dcs_read(struct s6e63m0 *ctx, const u8 cmd, u8 *data)
+{
+ if (ctx->error < 0)
+ return;
+
+ ctx->error = ctx->dcs_read(ctx->dev, cmd, data);
+}
+
static void s6e63m0_dcs_write(struct s6e63m0 *ctx, const u8 *data, size_t len)
{
if (ctx->error < 0 || len == 0)
@@ -400,6 +409,7 @@ static int s6e63m0_backlight_register(struct s6e63m0 *ctx)
}
int s6e63m0_probe(struct device *dev,
+ int (*dcs_read)(struct device *dev, const u8 cmd, u8 *val),
int (*dcs_write)(struct device *dev, const u8 *data, size_t len),
bool dsi_mode)
{
@@ -410,6 +420,7 @@ int s6e63m0_probe(struct device *dev,
if (!ctx)
return -ENOMEM;
+ ctx->dcs_read = dcs_read;
ctx->dcs_write = dcs_write;
dev_set_drvdata(dev, ctx);