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

The MIPI DBI standard support more pixel formats than what this helper
supports. Add an init function that lets the driver use different
format(s). This avoids open coding mipi_dbi_init() in st7586.

st7586 sets preferred_depth but this is not necessary since it only
supports one format.

v2: Forgot to remove the mipi->rotation assignment in st7586,
    mipi_dbi_init_with_formats() handles it.

Cc: David Lechner <[email protected]>
Acked-by: David Lechner <[email protected]>
Signed-off-by: Noralf Trønnes <[email protected]>
Tested-by: David Lechner <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
This commit is contained in:
Noralf Trønnes 2019-07-19 17:59:15 +02:00
commit cc43121271
3 changed files with 59 additions and 40 deletions

View file

@ -69,6 +69,11 @@ 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 *mipi,
struct gpio_desc *dc);
int mipi_dbi_init_with_formats(struct mipi_dbi *mipi,
const struct drm_simple_display_pipe_funcs *funcs,
const uint32_t *formats, unsigned int format_count,
const struct drm_display_mode *mode,
unsigned int rotation, size_t tx_buf_size);
int mipi_dbi_init(struct mipi_dbi *mipi,
const struct drm_simple_display_pipe_funcs *funcs,
const struct drm_display_mode *mode, unsigned int rotation);