diff options
Diffstat (limited to 'drivers/gpu/drm/tinydrm/ili9341.c')
-rw-r--r-- | drivers/gpu/drm/tinydrm/ili9341.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/gpu/drm/tinydrm/ili9341.c b/drivers/gpu/drm/tinydrm/ili9341.c index cb0a0ddbc090..05ba5ab17ec6 100644 --- a/drivers/gpu/drm/tinydrm/ili9341.c +++ b/drivers/gpu/drm/tinydrm/ili9341.c @@ -54,6 +54,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, struct drm_plane_state *plane_state) { struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); + struct mipi_dbi *dbi = mipi; u8 addr_mode; int ret, idx; @@ -68,47 +69,47 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, if (ret == 1) goto out_enable; - mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_OFF); + mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_OFF); - mipi_dbi_command(mipi, ILI9341_PWCTRLB, 0x00, 0xc1, 0x30); - mipi_dbi_command(mipi, ILI9341_PWRSEQ, 0x64, 0x03, 0x12, 0x81); - mipi_dbi_command(mipi, ILI9341_DTCTRLA, 0x85, 0x00, 0x78); - mipi_dbi_command(mipi, ILI9341_PWCTRLA, 0x39, 0x2c, 0x00, 0x34, 0x02); - mipi_dbi_command(mipi, ILI9341_PUMPCTRL, 0x20); - mipi_dbi_command(mipi, ILI9341_DTCTRLB, 0x00, 0x00); + mipi_dbi_command(dbi, ILI9341_PWCTRLB, 0x00, 0xc1, 0x30); + mipi_dbi_command(dbi, ILI9341_PWRSEQ, 0x64, 0x03, 0x12, 0x81); + mipi_dbi_command(dbi, ILI9341_DTCTRLA, 0x85, 0x00, 0x78); + mipi_dbi_command(dbi, ILI9341_PWCTRLA, 0x39, 0x2c, 0x00, 0x34, 0x02); + mipi_dbi_command(dbi, ILI9341_PUMPCTRL, 0x20); + mipi_dbi_command(dbi, ILI9341_DTCTRLB, 0x00, 0x00); /* Power Control */ - mipi_dbi_command(mipi, ILI9341_PWCTRL1, 0x23); - mipi_dbi_command(mipi, ILI9341_PWCTRL2, 0x10); + mipi_dbi_command(dbi, ILI9341_PWCTRL1, 0x23); + mipi_dbi_command(dbi, ILI9341_PWCTRL2, 0x10); /* VCOM */ - mipi_dbi_command(mipi, ILI9341_VMCTRL1, 0x3e, 0x28); - mipi_dbi_command(mipi, ILI9341_VMCTRL2, 0x86); + mipi_dbi_command(dbi, ILI9341_VMCTRL1, 0x3e, 0x28); + mipi_dbi_command(dbi, ILI9341_VMCTRL2, 0x86); /* Memory Access Control */ - mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT); + mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT); /* Frame Rate */ - mipi_dbi_command(mipi, ILI9341_FRMCTR1, 0x00, 0x1b); + mipi_dbi_command(dbi, ILI9341_FRMCTR1, 0x00, 0x1b); /* Gamma */ - mipi_dbi_command(mipi, ILI9341_EN3GAM, 0x00); - mipi_dbi_command(mipi, MIPI_DCS_SET_GAMMA_CURVE, 0x01); - mipi_dbi_command(mipi, ILI9341_PGAMCTRL, + mipi_dbi_command(dbi, ILI9341_EN3GAM, 0x00); + mipi_dbi_command(dbi, MIPI_DCS_SET_GAMMA_CURVE, 0x01); + mipi_dbi_command(dbi, ILI9341_PGAMCTRL, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00); - mipi_dbi_command(mipi, ILI9341_NGAMCTRL, + mipi_dbi_command(dbi, ILI9341_NGAMCTRL, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xc1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f); /* DDRAM */ - mipi_dbi_command(mipi, ILI9341_ETMOD, 0x07); + mipi_dbi_command(dbi, ILI9341_ETMOD, 0x07); /* Display */ - mipi_dbi_command(mipi, ILI9341_DISCTRL, 0x08, 0x82, 0x27, 0x00); - mipi_dbi_command(mipi, MIPI_DCS_EXIT_SLEEP_MODE); + mipi_dbi_command(dbi, ILI9341_DISCTRL, 0x08, 0x82, 0x27, 0x00); + mipi_dbi_command(dbi, MIPI_DCS_EXIT_SLEEP_MODE); msleep(100); - mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_ON); + mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON); msleep(100); out_enable: @@ -128,7 +129,7 @@ out_enable: break; } addr_mode |= ILI9341_MADCTL_BGR; - mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode); + mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode); mipi_dbi_enable_flush(mipi, crtc_state, plane_state); out_exit: drm_dev_exit(idx); @@ -177,6 +178,7 @@ static int ili9341_probe(struct spi_device *spi) struct device *dev = &spi->dev; struct drm_device *drm; struct mipi_dbi *mipi; + struct mipi_dbi *dbi; struct gpio_desc *dc; u32 rotation = 0; int ret; @@ -185,6 +187,7 @@ static int ili9341_probe(struct spi_device *spi) if (!mipi) return -ENOMEM; + dbi = mipi; drm = &mipi->drm; ret = devm_drm_dev_init(dev, drm, &ili9341_driver); if (ret) { @@ -194,10 +197,10 @@ static int ili9341_probe(struct spi_device *spi) drm_mode_config_init(drm); - mipi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(mipi->reset)) { + dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(dbi->reset)) { DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); - return PTR_ERR(mipi->reset); + return PTR_ERR(dbi->reset); } dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); @@ -212,7 +215,7 @@ static int ili9341_probe(struct spi_device *spi) device_property_read_u32(dev, "rotation", &rotation); - ret = mipi_dbi_spi_init(spi, mipi, dc); + ret = mipi_dbi_spi_init(spi, dbi, dc); if (ret) return ret; |