Commit 96f2a9ae authored by Noralf Trønnes's avatar Noralf Trønnes

drm/tinydrm: tinydrm_display_pipe_init() don't use tinydrm_device

Rework function signature so tinydrm_device can be avoided.

Move definition to tinydrm-helpers.h so tinydrm.h can be deleted in a
later patch.
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-6-noralf@tronnes.org
parent 06db4b8b
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <drm/drm_modes.h> #include <drm/drm_modes.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_print.h> #include <drm/drm_print.h>
#include <drm/tinydrm/tinydrm.h> #include <drm/drm_simple_kms_helper.h>
struct tinydrm_connector { struct tinydrm_connector {
struct drm_connector base; struct drm_connector base;
...@@ -129,7 +129,8 @@ static int tinydrm_rotate_mode(struct drm_display_mode *mode, ...@@ -129,7 +129,8 @@ static int tinydrm_rotate_mode(struct drm_display_mode *mode,
/** /**
* tinydrm_display_pipe_init - Initialize display pipe * tinydrm_display_pipe_init - Initialize display pipe
* @tdev: tinydrm device * @drm: DRM device
* @pipe: Display pipe
* @funcs: Display pipe functions * @funcs: Display pipe functions
* @connector_type: Connector type * @connector_type: Connector type
* @formats: Array of supported formats (DRM_FORMAT\_\*) * @formats: Array of supported formats (DRM_FORMAT\_\*)
...@@ -143,16 +144,15 @@ static int tinydrm_rotate_mode(struct drm_display_mode *mode, ...@@ -143,16 +144,15 @@ static int tinydrm_rotate_mode(struct drm_display_mode *mode,
* Returns: * Returns:
* Zero on success, negative error code on failure. * Zero on success, negative error code on failure.
*/ */
int int tinydrm_display_pipe_init(struct drm_device *drm,
tinydrm_display_pipe_init(struct tinydrm_device *tdev, struct drm_simple_display_pipe *pipe,
const struct drm_simple_display_pipe_funcs *funcs, const struct drm_simple_display_pipe_funcs *funcs,
int connector_type, int connector_type,
const uint32_t *formats, const uint32_t *formats,
unsigned int format_count, unsigned int format_count,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
unsigned int rotation) unsigned int rotation)
{ {
struct drm_device *drm = tdev->drm;
struct drm_display_mode mode_copy; struct drm_display_mode mode_copy;
struct drm_connector *connector; struct drm_connector *connector;
int ret; int ret;
...@@ -177,7 +177,7 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev, ...@@ -177,7 +177,7 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev,
if (IS_ERR(connector)) if (IS_ERR(connector))
return PTR_ERR(connector); return PTR_ERR(connector);
return drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats, return drm_simple_display_pipe_init(drm, pipe, funcs, formats,
format_count, modifiers, connector); format_count, modifiers, connector);
} }
EXPORT_SYMBOL(tinydrm_display_pipe_init); EXPORT_SYMBOL(tinydrm_display_pipe_init);
...@@ -407,7 +407,7 @@ int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi, ...@@ -407,7 +407,7 @@ int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi,
return ret; return ret;
/* TODO: Maybe add DRM_MODE_CONNECTOR_SPI */ /* TODO: Maybe add DRM_MODE_CONNECTOR_SPI */
ret = tinydrm_display_pipe_init(tdev, pipe_funcs, ret = tinydrm_display_pipe_init(tdev->drm, &tdev->pipe, pipe_funcs,
DRM_MODE_CONNECTOR_VIRTUAL, DRM_MODE_CONNECTOR_VIRTUAL,
mipi_dbi_formats, mipi_dbi_formats,
ARRAY_SIZE(mipi_dbi_formats), mode, ARRAY_SIZE(mipi_dbi_formats), mode,
......
...@@ -1069,7 +1069,7 @@ static int repaper_probe(struct spi_device *spi) ...@@ -1069,7 +1069,7 @@ static int repaper_probe(struct spi_device *spi)
if (ret) if (ret)
return ret; return ret;
ret = tinydrm_display_pipe_init(tdev, &repaper_pipe_funcs, ret = tinydrm_display_pipe_init(tdev->drm, &tdev->pipe, &repaper_pipe_funcs,
DRM_MODE_CONNECTOR_VIRTUAL, DRM_MODE_CONNECTOR_VIRTUAL,
repaper_formats, repaper_formats,
ARRAY_SIZE(repaper_formats), mode, 0); ARRAY_SIZE(repaper_formats), mode, 0);
......
...@@ -283,7 +283,7 @@ static int st7586_init(struct device *dev, struct mipi_dbi *mipi, ...@@ -283,7 +283,7 @@ static int st7586_init(struct device *dev, struct mipi_dbi *mipi,
if (ret) if (ret)
return ret; return ret;
ret = tinydrm_display_pipe_init(tdev, pipe_funcs, ret = tinydrm_display_pipe_init(tdev->drm, &tdev->pipe, pipe_funcs,
DRM_MODE_CONNECTOR_VIRTUAL, DRM_MODE_CONNECTOR_VIRTUAL,
st7586_formats, st7586_formats,
ARRAY_SIZE(st7586_formats), ARRAY_SIZE(st7586_formats),
......
...@@ -11,8 +11,12 @@ ...@@ -11,8 +11,12 @@
#define __LINUX_TINYDRM_HELPERS_H #define __LINUX_TINYDRM_HELPERS_H
struct backlight_device; struct backlight_device;
struct drm_device;
struct drm_display_mode;
struct drm_framebuffer; struct drm_framebuffer;
struct drm_rect; struct drm_rect;
struct drm_simple_display_pipe;
struct drm_simple_display_pipe_funcs;
struct spi_transfer; struct spi_transfer;
struct spi_message; struct spi_message;
struct spi_device; struct spi_device;
...@@ -33,6 +37,15 @@ static inline bool tinydrm_machine_little_endian(void) ...@@ -33,6 +37,15 @@ static inline bool tinydrm_machine_little_endian(void)
#endif #endif
} }
int tinydrm_display_pipe_init(struct drm_device *drm,
struct drm_simple_display_pipe *pipe,
const struct drm_simple_display_pipe_funcs *funcs,
int connector_type,
const uint32_t *formats,
unsigned int format_count,
const struct drm_display_mode *mode,
unsigned int rotation);
void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb, void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
struct drm_rect *clip); struct drm_rect *clip);
void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb, void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
......
...@@ -40,13 +40,4 @@ int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev, ...@@ -40,13 +40,4 @@ int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
int devm_tinydrm_register(struct tinydrm_device *tdev); int devm_tinydrm_register(struct tinydrm_device *tdev);
void tinydrm_shutdown(struct tinydrm_device *tdev); void tinydrm_shutdown(struct tinydrm_device *tdev);
int
tinydrm_display_pipe_init(struct tinydrm_device *tdev,
const struct drm_simple_display_pipe_funcs *funcs,
int connector_type,
const uint32_t *formats,
unsigned int format_count,
const struct drm_display_mode *mode,
unsigned int rotation);
#endif /* __LINUX_TINYDRM_H */ #endif /* __LINUX_TINYDRM_H */
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