diff options
author | Noralf Trønnes <noralf@tronnes.org> | 2019-07-19 17:59:15 +0200 |
---|---|---|
committer | Noralf Trønnes <noralf@tronnes.org> | 2019-07-23 15:49:39 +0200 |
commit | cc431212710860143b13877a0aa9d11a42598f49 (patch) | |
tree | 7cbf6a32656c1411c3f9ec59ebc972d2896abe74 /drivers/gpu/drm/tinydrm/st7586.c | |
parent | drm/tinydrm/repaper: Don't use tinydrm_display_pipe_init() (diff) | |
download | linux-cc431212710860143b13877a0aa9d11a42598f49.tar.xz linux-cc431212710860143b13877a0aa9d11a42598f49.zip |
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 <david@lechnology.com>
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: David Lechner <david@lechnology.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190719155916.62465-11-noralf@tronnes.org
Diffstat (limited to 'drivers/gpu/drm/tinydrm/st7586.c')
-rw-r--r-- | drivers/gpu/drm/tinydrm/st7586.c | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c index 7ae39004aa88..4046b0fc3f7a 100644 --- a/drivers/gpu/drm/tinydrm/st7586.c +++ b/drivers/gpu/drm/tinydrm/st7586.c @@ -24,7 +24,6 @@ #include <drm/drm_rect.h> #include <drm/drm_vblank.h> #include <drm/tinydrm/mipi-dbi.h> -#include <drm/tinydrm/tinydrm-helpers.h> /* controller-specific commands */ #define ST7586_DISP_MODE_GRAY 0x38 @@ -283,12 +282,6 @@ static const struct drm_simple_display_pipe_funcs st7586_pipe_funcs = { .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb, }; -static const struct drm_mode_config_funcs st7586_mode_config_funcs = { - .fb_create = drm_gem_fb_create_with_dirty, - .atomic_check = drm_atomic_helper_check, - .atomic_commit = drm_atomic_helper_commit, -}; - static const struct drm_display_mode st7586_mode = { DRM_SIMPLE_MODE(178, 128, 37, 27), }; @@ -342,15 +335,8 @@ static int st7586_probe(struct spi_device *spi) } drm_mode_config_init(drm); - drm->mode_config.preferred_depth = 32; - drm->mode_config.funcs = &st7586_mode_config_funcs; - - mutex_init(&mipi->cmdlock); bufsize = (st7586_mode.vdisplay + 2) / 3 * st7586_mode.hdisplay; - mipi->tx_buf = devm_kmalloc(dev, bufsize, GFP_KERNEL); - if (!mipi->tx_buf) - return -ENOMEM; mipi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(mipi->reset)) { @@ -365,7 +351,6 @@ static int st7586_probe(struct spi_device *spi) } device_property_read_u32(dev, "rotation", &rotation); - mipi->rotation = rotation; ret = mipi_dbi_spi_init(spi, mipi, a0); if (ret) @@ -374,6 +359,12 @@ static int st7586_probe(struct spi_device *spi) /* Cannot read from this controller via SPI */ mipi->read_commands = NULL; + ret = mipi_dbi_init_with_formats(mipi, &st7586_pipe_funcs, + st7586_formats, ARRAY_SIZE(st7586_formats), + &st7586_mode, rotation, bufsize); + if (ret) + return ret; + /* * we are using 8-bit data, so we are not actually swapping anything, * but setting mipi->swap_bytes makes mipi_dbi_typec3_command() do the @@ -383,15 +374,6 @@ static int st7586_probe(struct spi_device *spi) */ mipi->swap_bytes = true; - ret = tinydrm_display_pipe_init(drm, &mipi->pipe, &st7586_pipe_funcs, - DRM_MODE_CONNECTOR_SPI, - st7586_formats, ARRAY_SIZE(st7586_formats), - &st7586_mode, rotation); - if (ret) - return ret; - - drm_plane_enable_fb_damage_clips(&mipi->pipe.plane); - drm_mode_config_reset(drm); ret = drm_dev_register(drm, 0); @@ -400,9 +382,6 @@ static int st7586_probe(struct spi_device *spi) spi_set_drvdata(spi, drm); - DRM_DEBUG_KMS("preferred_depth=%u, rotation = %u\n", - drm->mode_config.preferred_depth, rotation); - drm_fbdev_generic_setup(drm, 0); return 0; |