diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2020-11-11 00:46:50 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2020-11-16 00:48:09 +0100 |
commit | 1b72ea1eaa9e4168d7486d85463fbd2d57a1452c (patch) | |
tree | 7b433a380e62f8269650e4240a7c5fc7c87a1adc /drivers | |
parent | 49ef0c6d7dd2bdc3cee3dc004545a373742cd752 (diff) |
drm/panel: s6e63m0: Implement reading from panel
This code was found in the Samsung vendor tree for the
Samsung GT-I9070 mobile phone. Let's support reading before
we implement the 3WIRE protocol for both reading and
writing.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201110234653.2248594-3-linus.walleij@linaro.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c index 75f00ed4810b..94ae4ac5a88e 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c @@ -13,13 +13,20 @@ static int s6e63m0_spi_dcs_read(struct device *dev, const u8 cmd, u8 *data) { - /* - * FIXME: implement reading DCS commands over SPI so we can - * properly identify which physical panel is connected. - */ - *data = 0; + struct spi_device *spi = to_spi_device(dev); + u16 buf[1]; + u16 rbuf[1]; + int ret; - return 0; + /* SPI buffers are always in CPU order */ + buf[0] = (u16)cmd; + ret = spi_write_then_read(spi, buf, 2, rbuf, 2); + dev_dbg(dev, "READ CMD: %04x RET: %04x\n", buf[0], rbuf[0]); + if (!ret) + /* These high 8 bits of the 9 contains the readout */ + *data = (rbuf[0] & 0x1ff) >> 1; + + return ret; } static int s6e63m0_spi_write_word(struct device *dev, u16 data) |