Commit 440961d2 authored by Noralf Trønnes's avatar Noralf Trønnes

drm/tinydrm: Rename remaining variable mipi -> dbidev

struct mipi_dbi is going to be split into an interface part and a display
pipeline part. The interface part can be used by drivers that need to
initialize the controller, but that won't upload the framebuffer over
this interface.

tinydrm uses the variable name 'mipi' but this is not a good name since
MIPI refers to a lot of standards. This patch changes the variable name
to 'dbidev' where it refers to the pipeline part of struct mipi_dbi.

Cc: Eric Anholt <eric@anholt.net>
Cc: David Lechner <david@lechnology.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Acked-by: default avatarDavid Lechner <david@lechnology.com>
Acked-by: default avatarEric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190722104312.16184-4-noralf@tronnes.org
parent 36b50572
...@@ -47,8 +47,8 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -47,8 +47,8 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
u8 addr_mode; u8 addr_mode;
int ret, idx; int ret, idx;
...@@ -57,7 +57,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -57,7 +57,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
ret = mipi_dbi_poweron_conditional_reset(mipi); ret = mipi_dbi_poweron_conditional_reset(dbidev);
if (ret < 0) if (ret < 0)
goto out_exit; goto out_exit;
if (ret == 1) if (ret == 1)
...@@ -159,7 +159,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -159,7 +159,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
usleep_range(5000, 7000); usleep_range(5000, 7000);
out_enable: out_enable:
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
addr_mode = HX8357D_MADCTL_MX | HX8357D_MADCTL_MY; addr_mode = HX8357D_MADCTL_MX | HX8357D_MADCTL_MY;
break; break;
...@@ -174,7 +174,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -174,7 +174,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
break; break;
} }
mipi_dbi_command(dbi, 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); mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
out_exit: out_exit:
drm_dev_exit(idx); drm_dev_exit(idx);
} }
...@@ -220,20 +220,20 @@ MODULE_DEVICE_TABLE(spi, hx8357d_id); ...@@ -220,20 +220,20 @@ MODULE_DEVICE_TABLE(spi, hx8357d_id);
static int hx8357d_probe(struct spi_device *spi) static int hx8357d_probe(struct spi_device *spi)
{ {
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
struct mipi_dbi *dbidev;
struct drm_device *drm; struct drm_device *drm;
struct mipi_dbi *mipi;
struct gpio_desc *dc; struct gpio_desc *dc;
u32 rotation = 0; u32 rotation = 0;
int ret; int ret;
mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
if (!mipi) if (!dbidev)
return -ENOMEM; return -ENOMEM;
drm = &mipi->drm; drm = &dbidev->drm;
ret = devm_drm_dev_init(dev, drm, &hx8357d_driver); ret = devm_drm_dev_init(dev, drm, &hx8357d_driver);
if (ret) { if (ret) {
kfree(mipi); kfree(dbidev);
return ret; return ret;
} }
...@@ -245,17 +245,17 @@ static int hx8357d_probe(struct spi_device *spi) ...@@ -245,17 +245,17 @@ static int hx8357d_probe(struct spi_device *spi)
return PTR_ERR(dc); return PTR_ERR(dc);
} }
mipi->backlight = devm_of_find_backlight(dev); dbidev->backlight = devm_of_find_backlight(dev);
if (IS_ERR(mipi->backlight)) if (IS_ERR(dbidev->backlight))
return PTR_ERR(mipi->backlight); return PTR_ERR(dbidev->backlight);
device_property_read_u32(dev, "rotation", &rotation); device_property_read_u32(dev, "rotation", &rotation);
ret = mipi_dbi_spi_init(spi, mipi, dc); ret = mipi_dbi_spi_init(spi, dbidev, dc);
if (ret) if (ret)
return ret; return ret;
ret = mipi_dbi_init(mipi, &hx8357d_pipe_funcs, &yx350hv15_mode, rotation); ret = mipi_dbi_init(dbidev, &hx8357d_pipe_funcs, &yx350hv15_mode, rotation);
if (ret) if (ret)
return ret; return ret;
......
...@@ -78,10 +78,10 @@ static inline int ili9225_command(struct mipi_dbi *dbi, u8 cmd, u16 data) ...@@ -78,10 +78,10 @@ static inline int ili9225_command(struct mipi_dbi *dbi, u8 cmd, u16 data)
static void ili9225_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) static void ili9225_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
{ {
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
struct mipi_dbi *mipi = drm_to_mipi_dbi(fb->dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(fb->dev);
unsigned int height = rect->y2 - rect->y1; unsigned int height = rect->y2 - rect->y1;
unsigned int width = rect->x2 - rect->x1; unsigned int width = rect->x2 - rect->x1;
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
bool swap = dbi->swap_bytes; bool swap = dbi->swap_bytes;
u16 x_start, y_start; u16 x_start, y_start;
u16 x1, x2, y1, y2; u16 x1, x2, y1, y2;
...@@ -89,7 +89,7 @@ static void ili9225_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) ...@@ -89,7 +89,7 @@ static void ili9225_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
bool full; bool full;
void *tr; void *tr;
if (!mipi->enabled) if (!dbidev->enabled)
return; return;
if (!drm_dev_enter(fb->dev, &idx)) if (!drm_dev_enter(fb->dev, &idx))
...@@ -101,15 +101,15 @@ static void ili9225_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) ...@@ -101,15 +101,15 @@ static void ili9225_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
if (!dbi->dc || !full || swap || if (!dbi->dc || !full || swap ||
fb->format->format == DRM_FORMAT_XRGB8888) { fb->format->format == DRM_FORMAT_XRGB8888) {
tr = mipi->tx_buf; tr = dbidev->tx_buf;
ret = mipi_dbi_buf_copy(mipi->tx_buf, fb, rect, swap); ret = mipi_dbi_buf_copy(dbidev->tx_buf, fb, rect, swap);
if (ret) if (ret)
goto err_msg; goto err_msg;
} else { } else {
tr = cma_obj->vaddr; tr = cma_obj->vaddr;
} }
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
x1 = rect->x1; x1 = rect->x1;
x2 = rect->x2 - 1; x2 = rect->x2 - 1;
...@@ -183,10 +183,10 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -183,10 +183,10 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct device *dev = pipe->crtc.dev->dev; struct device *dev = pipe->crtc.dev->dev;
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
struct drm_rect rect = { struct drm_rect rect = {
.x1 = 0, .x1 = 0,
.x2 = fb->width, .x2 = fb->width,
...@@ -233,7 +233,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -233,7 +233,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
msleep(50); msleep(50);
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
am_id = 0x30; am_id = 0x30;
break; break;
...@@ -283,7 +283,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -283,7 +283,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
ili9225_command(dbi, ILI9225_DISPLAY_CONTROL_1, 0x1017); ili9225_command(dbi, ILI9225_DISPLAY_CONTROL_1, 0x1017);
mipi->enabled = true; dbidev->enabled = true;
ili9225_fb_dirty(fb, &rect); ili9225_fb_dirty(fb, &rect);
out_exit: out_exit:
drm_dev_exit(idx); drm_dev_exit(idx);
...@@ -291,8 +291,8 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -291,8 +291,8 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe,
static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
...@@ -303,7 +303,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) ...@@ -303,7 +303,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe)
* unplug. * unplug.
*/ */
if (!mipi->enabled) if (!dbidev->enabled)
return; return;
ili9225_command(dbi, ILI9225_DISPLAY_CONTROL_1, 0x0000); ili9225_command(dbi, ILI9225_DISPLAY_CONTROL_1, 0x0000);
...@@ -312,7 +312,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) ...@@ -312,7 +312,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe)
msleep(50); msleep(50);
ili9225_command(dbi, ILI9225_POWER_CONTROL_1, 0x0a02); ili9225_command(dbi, ILI9225_POWER_CONTROL_1, 0x0a02);
mipi->enabled = false; dbidev->enabled = false;
} }
static int ili9225_dbi_command(struct mipi_dbi *dbi, u8 *cmd, u8 *par, static int ili9225_dbi_command(struct mipi_dbi *dbi, u8 *cmd, u8 *par,
...@@ -378,22 +378,22 @@ MODULE_DEVICE_TABLE(spi, ili9225_id); ...@@ -378,22 +378,22 @@ MODULE_DEVICE_TABLE(spi, ili9225_id);
static int ili9225_probe(struct spi_device *spi) static int ili9225_probe(struct spi_device *spi)
{ {
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
struct mipi_dbi *dbidev;
struct drm_device *drm; struct drm_device *drm;
struct mipi_dbi *mipi;
struct mipi_dbi *dbi; struct mipi_dbi *dbi;
struct gpio_desc *rs; struct gpio_desc *rs;
u32 rotation = 0; u32 rotation = 0;
int ret; int ret;
mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
if (!mipi) if (!dbidev)
return -ENOMEM; return -ENOMEM;
dbi = mipi; dbi = dbidev;
drm = &mipi->drm; drm = &dbidev->drm;
ret = devm_drm_dev_init(dev, drm, &ili9225_driver); ret = devm_drm_dev_init(dev, drm, &ili9225_driver);
if (ret) { if (ret) {
kfree(mipi); kfree(dbidev);
return ret; return ret;
} }
...@@ -420,7 +420,7 @@ static int ili9225_probe(struct spi_device *spi) ...@@ -420,7 +420,7 @@ static int ili9225_probe(struct spi_device *spi)
/* override the command function set in mipi_dbi_spi_init() */ /* override the command function set in mipi_dbi_spi_init() */
dbi->command = ili9225_dbi_command; dbi->command = ili9225_dbi_command;
ret = mipi_dbi_init(mipi, &ili9225_pipe_funcs, &ili9225_mode, rotation); ret = mipi_dbi_init(dbidev, &ili9225_pipe_funcs, &ili9225_mode, rotation);
if (ret) if (ret)
return ret; return ret;
......
...@@ -53,8 +53,8 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -53,8 +53,8 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
u8 addr_mode; u8 addr_mode;
int ret, idx; int ret, idx;
...@@ -63,7 +63,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -63,7 +63,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
ret = mipi_dbi_poweron_conditional_reset(mipi); ret = mipi_dbi_poweron_conditional_reset(dbidev);
if (ret < 0) if (ret < 0)
goto out_exit; goto out_exit;
if (ret == 1) if (ret == 1)
...@@ -113,7 +113,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -113,7 +113,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
msleep(100); msleep(100);
out_enable: out_enable:
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
addr_mode = ILI9341_MADCTL_MX; addr_mode = ILI9341_MADCTL_MX;
break; break;
...@@ -130,7 +130,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -130,7 +130,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
} }
addr_mode |= ILI9341_MADCTL_BGR; addr_mode |= ILI9341_MADCTL_BGR;
mipi_dbi_command(dbi, 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); mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
out_exit: out_exit:
drm_dev_exit(idx); drm_dev_exit(idx);
} }
...@@ -176,22 +176,22 @@ MODULE_DEVICE_TABLE(spi, ili9341_id); ...@@ -176,22 +176,22 @@ MODULE_DEVICE_TABLE(spi, ili9341_id);
static int ili9341_probe(struct spi_device *spi) static int ili9341_probe(struct spi_device *spi)
{ {
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
struct mipi_dbi *dbidev;
struct drm_device *drm; struct drm_device *drm;
struct mipi_dbi *mipi;
struct mipi_dbi *dbi; struct mipi_dbi *dbi;
struct gpio_desc *dc; struct gpio_desc *dc;
u32 rotation = 0; u32 rotation = 0;
int ret; int ret;
mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
if (!mipi) if (!dbidev)
return -ENOMEM; return -ENOMEM;
dbi = mipi; dbi = dbidev;
drm = &mipi->drm; drm = &dbidev->drm;
ret = devm_drm_dev_init(dev, drm, &ili9341_driver); ret = devm_drm_dev_init(dev, drm, &ili9341_driver);
if (ret) { if (ret) {
kfree(mipi); kfree(dbidev);
return ret; return ret;
} }
...@@ -209,9 +209,9 @@ static int ili9341_probe(struct spi_device *spi) ...@@ -209,9 +209,9 @@ static int ili9341_probe(struct spi_device *spi)
return PTR_ERR(dc); return PTR_ERR(dc);
} }
mipi->backlight = devm_of_find_backlight(dev); dbidev->backlight = devm_of_find_backlight(dev);
if (IS_ERR(mipi->backlight)) if (IS_ERR(dbidev->backlight))
return PTR_ERR(mipi->backlight); return PTR_ERR(dbidev->backlight);
device_property_read_u32(dev, "rotation", &rotation); device_property_read_u32(dev, "rotation", &rotation);
...@@ -219,7 +219,7 @@ static int ili9341_probe(struct spi_device *spi) ...@@ -219,7 +219,7 @@ static int ili9341_probe(struct spi_device *spi)
if (ret) if (ret)
return ret; return ret;
ret = mipi_dbi_init(mipi, &ili9341_pipe_funcs, &yx240qv29_mode, rotation); ret = mipi_dbi_init(dbidev, &ili9341_pipe_funcs, &yx240qv29_mode, rotation);
if (ret) if (ret)
return ret; return ret;
......
...@@ -51,8 +51,8 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, ...@@ -51,8 +51,8 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
u8 addr_mode; u8 addr_mode;
int ret, idx; int ret, idx;
...@@ -61,7 +61,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, ...@@ -61,7 +61,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
ret = mipi_dbi_poweron_conditional_reset(mipi); ret = mipi_dbi_poweron_conditional_reset(dbidev);
if (ret < 0) if (ret < 0)
goto out_exit; goto out_exit;
if (ret == 1) if (ret == 1)
...@@ -117,7 +117,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, ...@@ -117,7 +117,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
* As a result, we need to always apply the rotation value * As a result, we need to always apply the rotation value
* regardless of the display "on/off" state. * regardless of the display "on/off" state.
*/ */
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY | addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
ILI9341_MADCTL_MX; ILI9341_MADCTL_MX;
...@@ -134,7 +134,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, ...@@ -134,7 +134,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
} }
addr_mode |= ILI9341_MADCTL_BGR; addr_mode |= ILI9341_MADCTL_BGR;
mipi_dbi_command(dbi, 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); mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
out_exit: out_exit:
drm_dev_exit(idx); drm_dev_exit(idx);
} }
...@@ -180,22 +180,22 @@ MODULE_DEVICE_TABLE(spi, mi0283qt_id); ...@@ -180,22 +180,22 @@ MODULE_DEVICE_TABLE(spi, mi0283qt_id);
static int mi0283qt_probe(struct spi_device *spi) static int mi0283qt_probe(struct spi_device *spi)
{ {
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
struct mipi_dbi *dbidev;
struct drm_device *drm; struct drm_device *drm;
struct mipi_dbi *mipi;
struct mipi_dbi *dbi; struct mipi_dbi *dbi;
struct gpio_desc *dc; struct gpio_desc *dc;
u32 rotation = 0; u32 rotation = 0;
int ret; int ret;
mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
if (!mipi) if (!dbidev)
return -ENOMEM; return -ENOMEM;
dbi = mipi; dbi = dbidev;
drm = &mipi->drm; drm = &dbidev->drm;
ret = devm_drm_dev_init(dev, drm, &mi0283qt_driver); ret = devm_drm_dev_init(dev, drm, &mi0283qt_driver);
if (ret) { if (ret) {
kfree(mipi); kfree(dbidev);
return ret; return ret;
} }
...@@ -213,13 +213,13 @@ static int mi0283qt_probe(struct spi_device *spi) ...@@ -213,13 +213,13 @@ static int mi0283qt_probe(struct spi_device *spi)
return PTR_ERR(dc); return PTR_ERR(dc);
} }
mipi->regulator = devm_regulator_get(dev, "power"); dbidev->regulator = devm_regulator_get(dev, "power");
if (IS_ERR(mipi->regulator)) if (IS_ERR(dbidev->regulator))
return PTR_ERR(mipi->regulator); return PTR_ERR(dbidev->regulator);
mipi->backlight = devm_of_find_backlight(dev); dbidev->backlight = devm_of_find_backlight(dev);
if (IS_ERR(mipi->backlight)) if (IS_ERR(dbidev->backlight))
return PTR_ERR(mipi->backlight); return PTR_ERR(dbidev->backlight);
device_property_read_u32(dev, "rotation", &rotation); device_property_read_u32(dev, "rotation", &rotation);
...@@ -227,7 +227,7 @@ static int mi0283qt_probe(struct spi_device *spi) ...@@ -227,7 +227,7 @@ static int mi0283qt_probe(struct spi_device *spi)
if (ret) if (ret)
return ret; return ret;
ret = mipi_dbi_init(mipi, &mi0283qt_pipe_funcs, &mi0283qt_mode, rotation); ret = mipi_dbi_init(dbidev, &mi0283qt_pipe_funcs, &mi0283qt_mode, rotation);
if (ret) if (ret)
return ret; return ret;
......
...@@ -241,16 +241,16 @@ EXPORT_SYMBOL(mipi_dbi_buf_copy); ...@@ -241,16 +241,16 @@ EXPORT_SYMBOL(mipi_dbi_buf_copy);
static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
{ {
struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
struct mipi_dbi *mipi = drm_to_mipi_dbi(fb->dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(fb->dev);
unsigned int height = rect->y2 - rect->y1; unsigned int height = rect->y2 - rect->y1;
unsigned int width = rect->x2 - rect->x1; unsigned int width = rect->x2 - rect->x1;
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
bool swap = dbi->swap_bytes; bool swap = dbi->swap_bytes;
int idx, ret = 0; int idx, ret = 0;
bool full; bool full;
void *tr; void *tr;
if (!mipi->enabled) if (!dbidev->enabled)
return; return;
if (!drm_dev_enter(fb->dev, &idx)) if (!drm_dev_enter(fb->dev, &idx))
...@@ -262,8 +262,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) ...@@ -262,8 +262,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
if (!dbi->dc || !full || swap || if (!dbi->dc || !full || swap ||
fb->format->format == DRM_FORMAT_XRGB8888) { fb->format->format == DRM_FORMAT_XRGB8888) {
tr = mipi->tx_buf; tr = dbidev->tx_buf;
ret = mipi_dbi_buf_copy(mipi->tx_buf, fb, rect, swap); ret = mipi_dbi_buf_copy(dbidev->tx_buf, fb, rect, swap);
if (ret) if (ret)
goto err_msg; goto err_msg;
} else { } else {
...@@ -315,7 +315,7 @@ EXPORT_SYMBOL(mipi_dbi_pipe_update); ...@@ -315,7 +315,7 @@ EXPORT_SYMBOL(mipi_dbi_pipe_update);
/** /**
* mipi_dbi_enable_flush - MIPI DBI enable helper * mipi_dbi_enable_flush - MIPI DBI enable helper
* @mipi: MIPI DBI structure * @dbidev: MIPI DBI device structure
* @crtc_state: CRTC state * @crtc_state: CRTC state
* @plane_state: Plane state * @plane_state: Plane state
* *
...@@ -327,7 +327,7 @@ EXPORT_SYMBOL(mipi_dbi_pipe_update); ...@@ -327,7 +327,7 @@ EXPORT_SYMBOL(mipi_dbi_pipe_update);
* framebuffer flushing, can't use this function since they both use the same * framebuffer flushing, can't use this function since they both use the same
* flushing code. * flushing code.
*/ */
void mipi_dbi_enable_flush(struct mipi_dbi *mipi, void mipi_dbi_enable_flush(struct mipi_dbi *dbidev,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
...@@ -340,37 +340,37 @@ void mipi_dbi_enable_flush(struct mipi_dbi *mipi, ...@@ -340,37 +340,37 @@ void mipi_dbi_enable_flush(struct mipi_dbi *mipi,
}; };
int idx; int idx;
if (!drm_dev_enter(&mipi->drm, &idx)) if (!drm_dev_enter(&dbidev->drm, &idx))
return; return;
mipi->enabled = true; dbidev->enabled = true;
mipi_dbi_fb_dirty(fb, &rect); mipi_dbi_fb_dirty(fb, &rect);
backlight_enable(mipi->backlight); backlight_enable(dbidev->backlight);
drm_dev_exit(idx); drm_dev_exit(idx);
} }
EXPORT_SYMBOL(mipi_dbi_enable_flush); EXPORT_SYMBOL(mipi_dbi_enable_flush);
static void mipi_dbi_blank(struct mipi_dbi *mipi) static void mipi_dbi_blank(struct mipi_dbi *dbidev)
{ {
struct drm_device *drm = &mipi->drm; struct drm_device *drm = &dbidev->drm;
u16 height = drm->mode_config.min_height; u16 height = drm->mode_config.min_height;
u16 width = drm->mode_config.min_width; u16 width = drm->mode_config.min_width;
size_t len = width * height * 2; size_t len = width * height * 2;
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
int idx; int idx;
if (!drm_dev_enter(drm, &idx)) if (!drm_dev_enter(drm, &idx))
return; return;
memset(mipi->tx_buf, 0, len); memset(dbidev->tx_buf, 0, len);
mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0, mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0,
(width >> 8) & 0xFF, (width - 1) & 0xFF); (width >> 8) & 0xFF, (width - 1) & 0xFF);
mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0, mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0,
(height >> 8) & 0xFF, (height - 1) & 0xFF); (height >> 8) & 0xFF, (height - 1) & 0xFF);
mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
(u8 *)mipi->tx_buf, len); (u8 *)dbidev->tx_buf, len);
drm_dev_exit(idx); drm_dev_exit(idx);
} }
...@@ -385,31 +385,31 @@ static void mipi_dbi_blank(struct mipi_dbi *mipi) ...@@ -385,31 +385,31 @@ static void mipi_dbi_blank(struct mipi_dbi *mipi)
*/ */
void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe) void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
if (!mipi->enabled) if (!dbidev->enabled)
return; return;
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
mipi->enabled = false; dbidev->enabled = false;
if (mipi->backlight) if (dbidev->backlight)
backlight_disable(mipi->backlight); backlight_disable(dbidev->backlight);
else else
mipi_dbi_blank(mipi); mipi_dbi_blank(dbidev);
if (mipi->regulator) if (dbidev->regulator)
regulator_disable(mipi->regulator); regulator_disable(dbidev->regulator);
} }
EXPORT_SYMBOL(mipi_dbi_pipe_disable); EXPORT_SYMBOL(mipi_dbi_pipe_disable);
static int mipi_dbi_connector_get_modes(struct drm_connector *connector) static int mipi_dbi_connector_get_modes(struct drm_connector *connector)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(connector->dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(connector->dev);
struct drm_display_mode *mode; struct drm_display_mode *mode;
mode = drm_mode_duplicate(connector->dev, &mipi->mode); mode = drm_mode_duplicate(connector->dev, &dbidev->mode);
if (!mode) { if (!mode) {
DRM_ERROR("Failed to duplicate mode\n"); DRM_ERROR("Failed to duplicate mode\n");
return 0; return 0;
...@@ -471,7 +471,7 @@ static const uint32_t mipi_dbi_formats[] = { ...@@ -471,7 +471,7 @@ static const uint32_t mipi_dbi_formats[] = {
/** /**
* mipi_dbi_init_with_formats - MIPI DBI initialization with custom formats * mipi_dbi_init_with_formats - MIPI DBI initialization with custom formats
* @mipi: &mipi_dbi structure to initialize * @dbidev: MIPI DBI device structure to initialize
* @funcs: Display pipe functions * @funcs: Display pipe functions
* @formats: Array of supported formats (DRM_FORMAT\_\*). * @formats: Array of supported formats (DRM_FORMAT\_\*).
* @format_count: Number of elements in @formats * @format_count: Number of elements in @formats
...@@ -492,7 +492,7 @@ static const uint32_t mipi_dbi_formats[] = { ...@@ -492,7 +492,7 @@ static const uint32_t mipi_dbi_formats[] = {
* Returns: * Returns:
* Zero on success, negative error code on failure. * Zero on success, negative error code on failure.
*/ */
int mipi_dbi_init_with_formats(struct mipi_dbi *mipi, int mipi_dbi_init_with_formats(struct mipi_dbi *dbidev,
const struct drm_simple_display_pipe_funcs *funcs, const struct drm_simple_display_pipe_funcs *funcs,
const uint32_t *formats, unsigned int format_count, const uint32_t *formats, unsigned int format_count,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
...@@ -502,42 +502,42 @@ int mipi_dbi_init_with_formats(struct mipi_dbi *mipi, ...@@ -502,42 +502,42 @@ int mipi_dbi_init_with_formats(struct mipi_dbi *mipi,
DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_LINEAR,
DRM_FORMAT_MOD_INVALID DRM_FORMAT_MOD_INVALID
}; };
struct drm_device *drm = &mipi->drm; struct drm_device *drm = &dbidev->drm;
int ret; int ret;
if (!mipi->command) if (!dbidev->command)
return -EINVAL; return -EINVAL;
mipi->tx_buf = devm_kmalloc(drm->dev, tx_buf_size, GFP_KERNEL); dbidev->tx_buf = devm_kmalloc(drm->dev, tx_buf_size, GFP_KERNEL);
if (!mipi->tx_buf) if (!dbidev->tx_buf)
return -ENOMEM; return -ENOMEM;
drm_mode_copy(&mipi->mode, mode); drm_mode_copy(&dbidev->mode, mode);
ret = mipi_dbi_rotate_mode(&mipi->mode, rotation); ret = mipi_dbi_rotate_mode(&dbidev->mode, rotation);
if (ret) { if (ret) {
DRM_ERROR("Illegal rotation value %u\n", rotation); DRM_ERROR("Illegal rotation value %u\n", rotation);
return -EINVAL; return -EINVAL;
} }
drm_connector_helper_add(&mipi->connector, &mipi_dbi_connector_hfuncs); drm_connector_helper_add(&dbidev->connector, &mipi_dbi_connector_hfuncs);
ret = drm_connector_init(drm, &mipi->connector, &mipi_dbi_connector_funcs, ret = drm_connector_init(drm, &dbidev->connector, &mipi_dbi_connector_funcs,
DRM_MODE_CONNECTOR_SPI); DRM_MODE_CONNECTOR_SPI);
if (ret) if (ret)
return ret; return ret;
ret = drm_simple_display_pipe_init(drm, &mipi->pipe, funcs, formats, format_count, ret = drm_simple_display_pipe_init(drm, &dbidev->pipe, funcs, formats, format_count,
modifiers, &mipi->connector); modifiers, &dbidev->connector);
if (ret) if (ret)
return ret; return ret;
drm_plane_enable_fb_damage_clips(&mipi->pipe.plane); drm_plane_enable_fb_damage_clips(&dbidev->pipe.plane);
drm->mode_config.funcs = &mipi_dbi_mode_config_funcs; drm->mode_config.funcs = &mipi_dbi_mode_config_funcs;
drm->mode_config.min_width = mipi->mode.hdisplay; drm->mode_config.min_width = dbidev->mode.hdisplay;
drm->mode_config.max_width = mipi->mode.hdisplay; drm->mode_config.max_width = dbidev->mode.hdisplay;
drm->mode_config.min_height = mipi->mode.vdisplay; drm->mode_config.min_height = dbidev->mode.vdisplay;
drm->mode_config.max_height = mipi->mode.vdisplay; drm->mode_config.max_height = dbidev->mode.vdisplay;
mipi->rotation = rotation; dbidev->rotation = rotation;
DRM_DEBUG_KMS("rotation = %u\n", rotation); DRM_DEBUG_KMS("rotation = %u\n", rotation);
...@@ -547,7 +547,7 @@ EXPORT_SYMBOL(mipi_dbi_init_with_formats); ...@@ -547,7 +547,7 @@ EXPORT_SYMBOL(mipi_dbi_init_with_formats);
/** /**
* mipi_dbi_init - MIPI DBI initialization * mipi_dbi_init - MIPI DBI initialization
* @mipi: &mipi_dbi structure to initialize * @dbidev: MIPI DBI device structure to initialize
* @funcs: Display pipe functions * @funcs: Display pipe functions
* @mode: Display mode * @mode: Display mode
* @rotation: Initial rotation in degrees Counter Clock Wise * @rotation: Initial rotation in degrees Counter Clock Wise
...@@ -562,15 +562,15 @@ EXPORT_SYMBOL(mipi_dbi_init_with_formats); ...@@ -562,15 +562,15 @@ EXPORT_SYMBOL(mipi_dbi_init_with_formats);
* Returns: * Returns:
* Zero on success, negative error code on failure. * Zero on success, negative error code on failure.
*/ */
int mipi_dbi_init(struct mipi_dbi *mipi, int mipi_dbi_init(struct mipi_dbi *dbidev,
const struct drm_simple_display_pipe_funcs *funcs, const struct drm_simple_display_pipe_funcs *funcs,
const struct drm_display_mode *mode, unsigned int rotation) const struct drm_display_mode *mode, unsigned int rotation)
{ {
size_t bufsize = mode->vdisplay * mode->hdisplay * sizeof(u16); size_t bufsize = mode->vdisplay * mode->hdisplay * sizeof(u16);
mipi->drm.mode_config.preferred_depth = 16; dbidev->drm.mode_config.preferred_depth = 16;
return mipi_dbi_init_with_formats(mipi, funcs, mipi_dbi_formats, return mipi_dbi_init_with_formats(dbidev, funcs, mipi_dbi_formats,
ARRAY_SIZE(mipi_dbi_formats), mode, ARRAY_SIZE(mipi_dbi_formats), mode,
rotation, bufsize); rotation, bufsize);
} }
...@@ -646,14 +646,14 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi) ...@@ -646,14 +646,14 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *dbi)
} }
EXPORT_SYMBOL(mipi_dbi_display_is_on); EXPORT_SYMBOL(mipi_dbi_display_is_on);
static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond) static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *dbidev, bool cond)
{ {
struct device *dev = mipi->drm.dev; struct device *dev = dbidev->drm.dev;
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
int ret; int ret;
if (mipi->regulator) { if (dbidev->regulator) {
ret = regulator_enable(mipi->regulator); ret = regulator_enable(dbidev->regulator);
if (ret) { if (ret) {
DRM_DEV_ERROR(dev, "Failed to enable regulator (%d)\n", ret); DRM_DEV_ERROR(dev, "Failed to enable regulator (%d)\n", ret);
return ret; return ret;
...@@ -667,8 +667,8 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond) ...@@ -667,8 +667,8 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond)
ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET); ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET);
if (ret) { if (ret) {
DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret); DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret);
if (mipi->regulator) if (dbidev->regulator)
regulator_disable(mipi->regulator); regulator_disable(dbidev->regulator);
return ret; return ret;
} }
...@@ -687,7 +687,7 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond) ...@@ -687,7 +687,7 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond)
/** /**
* mipi_dbi_poweron_reset - MIPI DBI poweron and reset * mipi_dbi_poweron_reset - MIPI DBI poweron and reset
* @mipi: MIPI DBI structure * @dbidev: MIPI DBI device structure
* *
* This function enables the regulator if used and does a hardware and software * This function enables the regulator if used and does a hardware and software
* reset. * reset.
...@@ -695,15 +695,15 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond) ...@@ -695,15 +695,15 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond)
* Returns: * Returns:
* Zero on success, or a negative error code. * Zero on success, or a negative error code.
*/ */
int mipi_dbi_poweron_reset(struct mipi_dbi *mipi) int mipi_dbi_poweron_reset(struct mipi_dbi *dbidev)
{ {
return mipi_dbi_poweron_reset_conditional(mipi, false); return mipi_dbi_poweron_reset_conditional(dbidev, false);
} }
EXPORT_SYMBOL(mipi_dbi_poweron_reset); EXPORT_SYMBOL(mipi_dbi_poweron_reset);
/** /**
* mipi_dbi_poweron_conditional_reset - MIPI DBI poweron and conditional reset * mipi_dbi_poweron_conditional_reset - MIPI DBI poweron and conditional reset
* @mipi: MIPI DBI structure * @dbidev: MIPI DBI device structure
* *
* This function enables the regulator if used and if the display is off, it * This function enables the regulator if used and if the display is off, it
* does a hardware and software reset. If mipi_dbi_display_is_on() determines * does a hardware and software reset. If mipi_dbi_display_is_on() determines
...@@ -713,9 +713,9 @@ EXPORT_SYMBOL(mipi_dbi_poweron_reset); ...@@ -713,9 +713,9 @@ EXPORT_SYMBOL(mipi_dbi_poweron_reset);
* Zero if the controller was reset, 1 if the display was already on, or a * Zero if the controller was reset, 1 if the display was already on, or a
* negative error code. * negative error code.
*/ */
int mipi_dbi_poweron_conditional_reset(struct mipi_dbi *mipi) int mipi_dbi_poweron_conditional_reset(struct mipi_dbi *dbidev)
{ {
return mipi_dbi_poweron_reset_conditional(mipi, true); return mipi_dbi_poweron_reset_conditional(dbidev, true);
} }
EXPORT_SYMBOL(mipi_dbi_poweron_conditional_reset); EXPORT_SYMBOL(mipi_dbi_poweron_conditional_reset);
......
...@@ -114,11 +114,11 @@ static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb, ...@@ -114,11 +114,11 @@ static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb,
static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(fb->dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(fb->dev);
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
int start, end, idx, ret = 0; int start, end, idx, ret = 0;
if (!mipi->enabled) if (!dbidev->enabled)
return; return;
if (!drm_dev_enter(fb->dev, &idx)) if (!drm_dev_enter(fb->dev, &idx))
...@@ -130,7 +130,7 @@ static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) ...@@ -130,7 +130,7 @@ static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect)); DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
ret = st7586_buf_copy(mipi->tx_buf, fb, rect); ret = st7586_buf_copy(dbidev->tx_buf, fb, rect);
if (ret) if (ret)
goto err_msg; goto err_msg;
...@@ -146,7 +146,7 @@ static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect) ...@@ -146,7 +146,7 @@ static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
(rect->y2 >> 8) & 0xFF, (rect->y2 - 1) & 0xFF); (rect->y2 >> 8) & 0xFF, (rect->y2 - 1) & 0xFF);
ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
(u8 *)mipi->tx_buf, (u8 *)dbidev->tx_buf,
(end - start) * (rect->y2 - rect->y1)); (end - start) * (rect->y2 - rect->y1));
err_msg: err_msg:
if (ret) if (ret)
...@@ -177,9 +177,9 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -177,9 +177,9 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
struct drm_rect rect = { struct drm_rect rect = {
.x1 = 0, .x1 = 0,
.x2 = fb->width, .x2 = fb->width,
...@@ -194,7 +194,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -194,7 +194,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
ret = mipi_dbi_poweron_reset(mipi); ret = mipi_dbi_poweron_reset(dbidev);
if (ret) if (ret)
goto out_exit; goto out_exit;
...@@ -222,7 +222,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -222,7 +222,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
mipi_dbi_command(dbi, ST7586_DISP_MODE_GRAY); mipi_dbi_command(dbi, ST7586_DISP_MODE_GRAY);
mipi_dbi_command(dbi, ST7586_ENABLE_DDRAM, 0x02); mipi_dbi_command(dbi, ST7586_ENABLE_DDRAM, 0x02);
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
addr_mode = 0x00; addr_mode = 0x00;
break; break;
...@@ -245,7 +245,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -245,7 +245,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
msleep(100); msleep(100);
mipi->enabled = true; dbidev->enabled = true;
st7586_fb_dirty(fb, &rect); st7586_fb_dirty(fb, &rect);
mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON); mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON);
...@@ -318,23 +318,23 @@ MODULE_DEVICE_TABLE(spi, st7586_id); ...@@ -318,23 +318,23 @@ MODULE_DEVICE_TABLE(spi, st7586_id);
static int st7586_probe(struct spi_device *spi) static int st7586_probe(struct spi_device *spi)
{ {
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
struct mipi_dbi *dbidev;
struct drm_device *drm; struct drm_device *drm;
struct mipi_dbi *mipi;
struct mipi_dbi *dbi; struct mipi_dbi *dbi;
struct gpio_desc *a0; struct gpio_desc *a0;
u32 rotation = 0; u32 rotation = 0;
size_t bufsize; size_t bufsize;
int ret; int ret;
mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
if (!mipi) if (!dbidev)
return -ENOMEM; return -ENOMEM;
dbi = mipi; dbi = dbidev;
drm = &mipi->drm; drm = &dbidev->drm;
ret = devm_drm_dev_init(dev, drm, &st7586_driver); ret = devm_drm_dev_init(dev, drm, &st7586_driver);
if (ret) { if (ret) {
kfree(mipi); kfree(dbidev);
return ret; return ret;
} }
...@@ -363,7 +363,7 @@ static int st7586_probe(struct spi_device *spi) ...@@ -363,7 +363,7 @@ static int st7586_probe(struct spi_device *spi)
/* Cannot read from this controller via SPI */ /* Cannot read from this controller via SPI */
dbi->read_commands = NULL; dbi->read_commands = NULL;
ret = mipi_dbi_init_with_formats(mipi, &st7586_pipe_funcs, ret = mipi_dbi_init_with_formats(dbidev, &st7586_pipe_funcs,
st7586_formats, ARRAY_SIZE(st7586_formats), st7586_formats, ARRAY_SIZE(st7586_formats),
&st7586_mode, rotation, bufsize); &st7586_mode, rotation, bufsize);
if (ret) if (ret)
......
...@@ -42,8 +42,8 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -42,8 +42,8 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plane_state) struct drm_plane_state *plane_state)
{ {
struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev); struct mipi_dbi *dbidev = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *dbi = mipi; struct mipi_dbi *dbi = dbidev;
int ret, idx; int ret, idx;
u8 addr_mode; u8 addr_mode;
...@@ -52,7 +52,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -52,7 +52,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
ret = mipi_dbi_poweron_reset(mipi); ret = mipi_dbi_poweron_reset(dbidev);
if (ret) if (ret)
goto out_exit; goto out_exit;
...@@ -73,7 +73,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -73,7 +73,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
mipi_dbi_command(dbi, ST7735R_PWCTR5, 0x8a, 0xee); mipi_dbi_command(dbi, ST7735R_PWCTR5, 0x8a, 0xee);
mipi_dbi_command(dbi, ST7735R_VMCTR1, 0x0e); mipi_dbi_command(dbi, ST7735R_VMCTR1, 0x0e);
mipi_dbi_command(dbi, MIPI_DCS_EXIT_INVERT_MODE); mipi_dbi_command(dbi, MIPI_DCS_EXIT_INVERT_MODE);
switch (mipi->rotation) { switch (dbidev->rotation) {
default: default:
addr_mode = ST7735R_MX | ST7735R_MY; addr_mode = ST7735R_MX | ST7735R_MY;
break; break;
...@@ -104,7 +104,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -104,7 +104,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
msleep(20); msleep(20);
mipi_dbi_enable_flush(mipi, crtc_state, plane_state); mipi_dbi_enable_flush(dbidev, crtc_state, plane_state);
out_exit: out_exit:
drm_dev_exit(idx); drm_dev_exit(idx);
} }
...@@ -150,22 +150,22 @@ MODULE_DEVICE_TABLE(spi, st7735r_id); ...@@ -150,22 +150,22 @@ MODULE_DEVICE_TABLE(spi, st7735r_id);
static int st7735r_probe(struct spi_device *spi) static int st7735r_probe(struct spi_device *spi)
{ {
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
struct mipi_dbi *dbidev;
struct drm_device *drm; struct drm_device *drm;
struct mipi_dbi *mipi;
struct mipi_dbi *dbi; struct mipi_dbi *dbi;
struct gpio_desc *dc; struct gpio_desc *dc;
u32 rotation = 0; u32 rotation = 0;
int ret; int ret;
mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
if (!mipi) if (!dbidev)
return -ENOMEM; return -ENOMEM;
dbi = mipi; dbi = dbidev;
drm = &mipi->drm; drm = &dbidev->drm;
ret = devm_drm_dev_init(dev, drm, &st7735r_driver); ret = devm_drm_dev_init(dev, drm, &st7735r_driver);
if (ret) { if (ret) {
kfree(mipi); kfree(dbidev);
return ret; return ret;
} }
...@@ -183,9 +183,9 @@ static int st7735r_probe(struct spi_device *spi) ...@@ -183,9 +183,9 @@ static int st7735r_probe(struct spi_device *spi)
return PTR_ERR(dc); return PTR_ERR(dc);
} }
mipi->backlight = devm_of_find_backlight(dev); dbidev->backlight = devm_of_find_backlight(dev);
if (IS_ERR(mipi->backlight)) if (IS_ERR(dbidev->backlight))
return PTR_ERR(mipi->backlight); return PTR_ERR(dbidev->backlight);
device_property_read_u32(dev, "rotation", &rotation); device_property_read_u32(dev, "rotation", &rotation);
...@@ -196,7 +196,7 @@ static int st7735r_probe(struct spi_device *spi) ...@@ -196,7 +196,7 @@ static int st7735r_probe(struct spi_device *spi)
/* Cannot read from Adafruit 1.8" display via SPI */ /* Cannot read from Adafruit 1.8" display via SPI */
dbi->read_commands = NULL; dbi->read_commands = NULL;
ret = mipi_dbi_init(mipi, &jd_t18003_t01_pipe_funcs, &jd_t18003_t01_mode, rotation); ret = mipi_dbi_init(dbidev, &jd_t18003_t01_pipe_funcs, &jd_t18003_t01_mode, rotation);
if (ret) if (ret)
return ret; return ret;
......
...@@ -79,25 +79,25 @@ static inline struct mipi_dbi *drm_to_mipi_dbi(struct drm_device *drm) ...@@ -79,25 +79,25 @@ static inline struct mipi_dbi *drm_to_mipi_dbi(struct drm_device *drm)
int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *dbi, int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *dbi,
struct gpio_desc *dc); struct gpio_desc *dc);
int mipi_dbi_init_with_formats(struct mipi_dbi *mipi, int mipi_dbi_init_with_formats(struct mipi_dbi *dbidev,
const struct drm_simple_display_pipe_funcs *funcs, const struct drm_simple_display_pipe_funcs *funcs,
const uint32_t *formats, unsigned int format_count, const uint32_t *formats, unsigned int format_count,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
unsigned int rotation, size_t tx_buf_size); unsigned int rotation, size_t tx_buf_size);
int mipi_dbi_init(struct mipi_dbi *mipi, int mipi_dbi_init(struct mipi_dbi *dbidev,
const struct drm_simple_display_pipe_funcs *funcs, const struct drm_simple_display_pipe_funcs *funcs,
const struct drm_display_mode *mode, unsigned int rotation); const struct drm_display_mode *mode, unsigned int rotation);
void mipi_dbi_release(struct drm_device *drm); void mipi_dbi_release(struct drm_device *drm);
void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe, void mipi_dbi_pipe_update(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *old_state); struct drm_plane_state *old_state);
void mipi_dbi_enable_flush(struct mipi_dbi *mipi, void mipi_dbi_enable_flush(struct mipi_dbi *dbidev,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_plane_state *plan_state); struct drm_plane_state *plan_state);
void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe); void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe);
void mipi_dbi_hw_reset(struct mipi_dbi *dbi); void mipi_dbi_hw_reset(struct mipi_dbi *dbi);
bool mipi_dbi_display_is_on(struct mipi_dbi *dbi); bool mipi_dbi_display_is_on(struct mipi_dbi *dbi);
int mipi_dbi_poweron_reset(struct mipi_dbi *mipi); int mipi_dbi_poweron_reset(struct mipi_dbi *dbidev);
int mipi_dbi_poweron_conditional_reset(struct mipi_dbi *mipi); int mipi_dbi_poweron_conditional_reset(struct mipi_dbi *dbidev);
u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len); u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len);
int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz, int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment