Commit 4f834798 authored by Noralf Trønnes's avatar Noralf Trønnes

drm/tinydrm/mipi-dbi: Add drm_to_mipi_dbi()

Add a function to derive mipi_dbi from drm_device now that tinydrm_device
is going away.
Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190210131039.52664-8-noralf@tronnes.org
parent d0a51634
...@@ -47,8 +47,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -47,8 +47,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
u8 addr_mode; u8 addr_mode;
int ret; int ret;
......
...@@ -82,8 +82,7 @@ static inline int ili9225_command(struct mipi_dbi *mipi, u8 cmd, u16 data) ...@@ -82,8 +82,7 @@ static inline int ili9225_command(struct mipi_dbi *mipi, 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 tinydrm_device *tdev = fb->dev->dev_private; struct mipi_dbi *mipi = drm_to_mipi_dbi(fb->dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
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;
bool swap = mipi->swap_bytes; bool swap = mipi->swap_bytes;
...@@ -182,10 +181,9 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -182,10 +181,9 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct device *dev = tdev->drm->dev; struct device *dev = pipe->crtc.dev->dev;
struct drm_rect rect = { struct drm_rect rect = {
.x1 = 0, .x1 = 0,
.x2 = fb->width, .x2 = fb->width,
...@@ -285,8 +283,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -285,8 +283,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
......
...@@ -53,8 +53,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe, ...@@ -53,8 +53,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
u8 addr_mode; u8 addr_mode;
int ret; int ret;
......
...@@ -55,8 +55,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, ...@@ -55,8 +55,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
u8 addr_mode; u8 addr_mode;
int ret; int ret;
......
...@@ -216,8 +216,7 @@ EXPORT_SYMBOL(mipi_dbi_buf_copy); ...@@ -216,8 +216,7 @@ 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 tinydrm_device *tdev = fb->dev->dev_private; struct mipi_dbi *mipi = drm_to_mipi_dbi(fb->dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
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;
bool swap = mipi->swap_bytes; bool swap = mipi->swap_bytes;
...@@ -342,8 +341,7 @@ static void mipi_dbi_blank(struct mipi_dbi *mipi) ...@@ -342,8 +341,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
...@@ -1088,8 +1086,7 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = { ...@@ -1088,8 +1086,7 @@ static const struct file_operations mipi_dbi_debugfs_command_fops = {
*/ */
int mipi_dbi_debugfs_init(struct drm_minor *minor) int mipi_dbi_debugfs_init(struct drm_minor *minor)
{ {
struct tinydrm_device *tdev = minor->dev->dev_private; struct mipi_dbi *mipi = drm_to_mipi_dbi(minor->dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
umode_t mode = S_IFREG | S_IWUSR; umode_t mode = S_IFREG | S_IWUSR;
if (mipi->read_commands) if (mipi->read_commands)
......
...@@ -117,8 +117,7 @@ static int st7586_buf_copy(void *dst, struct drm_framebuffer *fb, ...@@ -117,8 +117,7 @@ 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 tinydrm_device *tdev = fb->dev->dev_private; struct mipi_dbi *mipi = drm_to_mipi_dbi(fb->dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
int start, end; int start, end;
int ret = 0; int ret = 0;
...@@ -176,8 +175,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -176,8 +175,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
struct drm_framebuffer *fb = plane_state->fb; struct drm_framebuffer *fb = plane_state->fb;
struct drm_rect rect = { struct drm_rect rect = {
.x1 = 0, .x1 = 0,
...@@ -249,8 +247,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -249,8 +247,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe,
static void st7586_pipe_disable(struct drm_simple_display_pipe *pipe) static void st7586_pipe_disable(struct drm_simple_display_pipe *pipe)
{ {
struct tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
DRM_DEBUG_KMS("\n"); DRM_DEBUG_KMS("\n");
......
...@@ -42,8 +42,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe, ...@@ -42,8 +42,7 @@ 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 tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = drm_to_mipi_dbi(pipe->crtc.dev);
struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
int ret; int ret;
u8 addr_mode; u8 addr_mode;
......
...@@ -56,9 +56,10 @@ struct mipi_dbi { ...@@ -56,9 +56,10 @@ struct mipi_dbi {
struct regulator *regulator; struct regulator *regulator;
}; };
static inline struct mipi_dbi * static inline struct mipi_dbi *drm_to_mipi_dbi(struct drm_device *drm)
mipi_dbi_from_tinydrm(struct tinydrm_device *tdev)
{ {
struct tinydrm_device *tdev = drm->dev_private;
return container_of(tdev, struct mipi_dbi, tinydrm); return container_of(tdev, struct mipi_dbi, tinydrm);
} }
......
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