Commit 53bdebf7 authored by Daniel Vetter's avatar Daniel Vetter

drm/mipi-dbi: Move drm_mode_config_init into mipi library

7/7 drivers agree that's the right choice, let's do this.

This avoids duplicating the same old error checking code over all 7
drivers, which is the motivation here.
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Tested-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>
Cc: David Lechner <david@lechnology.com>
Cc: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-48-daniel.vetter@ffwll.ch
parent be9f2b03
...@@ -511,6 +511,10 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev, ...@@ -511,6 +511,10 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
if (!dbidev->dbi.command) if (!dbidev->dbi.command)
return -EINVAL; return -EINVAL;
ret = drm_mode_config_init(drm);
if (ret)
return ret;
dbidev->tx_buf = devm_kmalloc(drm->dev, tx_buf_size, GFP_KERNEL); dbidev->tx_buf = devm_kmalloc(drm->dev, tx_buf_size, GFP_KERNEL);
if (!dbidev->tx_buf) if (!dbidev->tx_buf)
return -ENOMEM; return -ENOMEM;
......
...@@ -239,8 +239,6 @@ static int hx8357d_probe(struct spi_device *spi) ...@@ -239,8 +239,6 @@ static int hx8357d_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW); dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
if (IS_ERR(dc)) { if (IS_ERR(dc)) {
DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n"); DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
......
...@@ -390,8 +390,6 @@ static int ili9225_probe(struct spi_device *spi) ...@@ -390,8 +390,6 @@ static int ili9225_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(dbi->reset)) { if (IS_ERR(dbi->reset)) {
DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
......
...@@ -197,8 +197,6 @@ static int ili9341_probe(struct spi_device *spi) ...@@ -197,8 +197,6 @@ static int ili9341_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(dbi->reset)) { if (IS_ERR(dbi->reset)) {
DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
......
...@@ -211,8 +211,6 @@ static int ili9486_probe(struct spi_device *spi) ...@@ -211,8 +211,6 @@ static int ili9486_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(dbi->reset)) { if (IS_ERR(dbi->reset)) {
DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
......
...@@ -201,8 +201,6 @@ static int mi0283qt_probe(struct spi_device *spi) ...@@ -201,8 +201,6 @@ static int mi0283qt_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(dbi->reset)) { if (IS_ERR(dbi->reset)) {
DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
......
...@@ -331,8 +331,6 @@ static int st7586_probe(struct spi_device *spi) ...@@ -331,8 +331,6 @@ static int st7586_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
bufsize = (st7586_mode.vdisplay + 2) / 3 * st7586_mode.hdisplay; bufsize = (st7586_mode.vdisplay + 2) / 3 * st7586_mode.hdisplay;
dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
......
...@@ -212,8 +212,6 @@ static int st7735r_probe(struct spi_device *spi) ...@@ -212,8 +212,6 @@ static int st7735r_probe(struct spi_device *spi)
} }
drmm_add_final_kfree(drm, dbidev); drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm);
dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(dbi->reset)) { if (IS_ERR(dbi->reset)) {
DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n"); DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
......
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