All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] drm/tinydrm/ili9341: Support Adafruit 2.8" TFT display
@ 2019-02-25 14:45 Andy Shevchenko
  2019-02-25 15:07 ` Noralf Trønnes
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2019-02-25 14:45 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel, David Airlie, Daniel Vetter
  Cc: Andy Shevchenko

The Adafruit 2.8" TFT display [1] has different dimensions than 2.4" one.
Add support for it.

[1]: https://cdn-shop.adafruit.com/datasheets/MI0283QT-11+V1.1.PDF

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

- based on top of drm-tip

 drivers/gpu/drm/tinydrm/ili9341.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/ili9341.c b/drivers/gpu/drm/tinydrm/ili9341.c
index 3b7565a6311e..7e20d7f1b25f 100644
--- a/drivers/gpu/drm/tinydrm/ili9341.c
+++ b/drivers/gpu/drm/tinydrm/ili9341.c
@@ -140,6 +140,10 @@ static const struct drm_display_mode yx240qv29_mode = {
 	DRM_SIMPLE_MODE(240, 320, 37, 49),
 };
 
+static const struct drm_display_mode dt280qv10_mode = {
+	DRM_SIMPLE_MODE(240, 320, 43, 58),
+};
+
 DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
 
 static struct drm_driver ili9341_driver = {
@@ -155,25 +159,32 @@ static struct drm_driver ili9341_driver = {
 };
 
 static const struct of_device_id ili9341_of_match[] = {
-	{ .compatible = "adafruit,yx240qv29" },
+	{ .compatible = "adafruit,yx240qv29", .data = &yx240qv29_mode },
+	{ .compatible = "adafruit,dt280qv10", .data = &dt280qv10_mode },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ili9341_of_match);
 
 static const struct spi_device_id ili9341_id[] = {
-	{ "yx240qv29", 0 },
+	{ "yx240qv29", (kernel_ulong_t)&yx240qv29_mode },
+	{ "dt280qv10", (kernel_ulong_t)&dt280qv10_mode },
 	{ }
 };
 MODULE_DEVICE_TABLE(spi, ili9341_id);
 
 static int ili9341_probe(struct spi_device *spi)
 {
+	const struct drm_display_mode *mode;
 	struct device *dev = &spi->dev;
 	struct mipi_dbi *mipi;
 	struct gpio_desc *dc;
 	u32 rotation = 0;
 	int ret;
 
+	mode = device_get_match_data(dev);
+	if (!mode)
+		return -ENODEV;
+
 	mipi = devm_kzalloc(dev, sizeof(*mipi), GFP_KERNEL);
 	if (!mipi)
 		return -ENOMEM;
@@ -201,7 +212,7 @@ static int ili9341_probe(struct spi_device *spi)
 		return ret;
 
 	ret = mipi_dbi_init(&spi->dev, mipi, &ili9341_pipe_funcs,
-			    &ili9341_driver, &yx240qv29_mode, rotation);
+			    &ili9341_driver, mode, rotation);
 	if (ret)
 		return ret;
 
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] drm/tinydrm/ili9341: Support Adafruit 2.8" TFT display
  2019-02-25 14:45 [PATCH v1] drm/tinydrm/ili9341: Support Adafruit 2.8" TFT display Andy Shevchenko
@ 2019-02-25 15:07 ` Noralf Trønnes
  2019-02-26  8:14   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Noralf Trønnes @ 2019-02-25 15:07 UTC (permalink / raw)
  To: Andy Shevchenko, dri-devel, David Airlie, Daniel Vetter



Den 25.02.2019 15.45, skrev Andy Shevchenko:
> The Adafruit 2.8" TFT display [1] has different dimensions than 2.4" one.
> Add support for it.
> 
> [1]: https://cdn-shop.adafruit.com/datasheets/MI0283QT-11+V1.1.PDF

This one is supported by drivers/gpu/drm/tinydrm/mi0283qt.c. It was the
first tinydrm driver and was named after the panel. Later we have
grouped the panels by controller driver.

So ideally mi0283qt.c should have been merged with ili9341.c.

I know that this Adafruit display didn't always use a MI0283QT panel, so
maybe earlier they did use the dt280qv10 panel you mention her.

The Watterott rpi-display also uses a MI0283QT panel.

Noralf.

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 
> - based on top of drm-tip
> 
>  drivers/gpu/drm/tinydrm/ili9341.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tinydrm/ili9341.c b/drivers/gpu/drm/tinydrm/ili9341.c
> index 3b7565a6311e..7e20d7f1b25f 100644
> --- a/drivers/gpu/drm/tinydrm/ili9341.c
> +++ b/drivers/gpu/drm/tinydrm/ili9341.c
> @@ -140,6 +140,10 @@ static const struct drm_display_mode yx240qv29_mode = {
>  	DRM_SIMPLE_MODE(240, 320, 37, 49),
>  };
>  
> +static const struct drm_display_mode dt280qv10_mode = {
> +	DRM_SIMPLE_MODE(240, 320, 43, 58),
> +};
> +
>  DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
>  
>  static struct drm_driver ili9341_driver = {
> @@ -155,25 +159,32 @@ static struct drm_driver ili9341_driver = {
>  };
>  
>  static const struct of_device_id ili9341_of_match[] = {
> -	{ .compatible = "adafruit,yx240qv29" },
> +	{ .compatible = "adafruit,yx240qv29", .data = &yx240qv29_mode },
> +	{ .compatible = "adafruit,dt280qv10", .data = &dt280qv10_mode },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, ili9341_of_match);
>  
>  static const struct spi_device_id ili9341_id[] = {
> -	{ "yx240qv29", 0 },
> +	{ "yx240qv29", (kernel_ulong_t)&yx240qv29_mode },
> +	{ "dt280qv10", (kernel_ulong_t)&dt280qv10_mode },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, ili9341_id);
>  
>  static int ili9341_probe(struct spi_device *spi)
>  {
> +	const struct drm_display_mode *mode;
>  	struct device *dev = &spi->dev;
>  	struct mipi_dbi *mipi;
>  	struct gpio_desc *dc;
>  	u32 rotation = 0;
>  	int ret;
>  
> +	mode = device_get_match_data(dev);
> +	if (!mode)
> +		return -ENODEV;
> +
>  	mipi = devm_kzalloc(dev, sizeof(*mipi), GFP_KERNEL);
>  	if (!mipi)
>  		return -ENOMEM;
> @@ -201,7 +212,7 @@ static int ili9341_probe(struct spi_device *spi)
>  		return ret;
>  
>  	ret = mipi_dbi_init(&spi->dev, mipi, &ili9341_pipe_funcs,
> -			    &ili9341_driver, &yx240qv29_mode, rotation);
> +			    &ili9341_driver, mode, rotation);
>  	if (ret)
>  		return ret;
>  
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] drm/tinydrm/ili9341: Support Adafruit 2.8" TFT display
  2019-02-25 15:07 ` Noralf Trønnes
@ 2019-02-26  8:14   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2019-02-26  8:14 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: David Airlie, dri-devel

On Mon, Feb 25, 2019 at 04:07:05PM +0100, Noralf Trønnes wrote:
> 
> 
> Den 25.02.2019 15.45, skrev Andy Shevchenko:
> > The Adafruit 2.8" TFT display [1] has different dimensions than 2.4" one.
> > Add support for it.
> > 
> > [1]: https://cdn-shop.adafruit.com/datasheets/MI0283QT-11+V1.1.PDF
> 
> This one is supported by drivers/gpu/drm/tinydrm/mi0283qt.c. It was the
> first tinydrm driver and was named after the panel. Later we have
> grouped the panels by controller driver.

Yeah, thanks. It works.

> So ideally mi0283qt.c should have been merged with ili9341.c.

Yes, that's would be nice! Though we need still some unified compatible
strings, while leaving old in place.

> I know that this Adafruit display didn't always use a MI0283QT panel, so
> maybe earlier they did use the dt280qv10 panel you mention her.

The datasheet they point me to is for mi0283qt, but on the panel itself it's
written dt280qv10. I dunno if it refers to the same or not.

> The Watterott rpi-display also uses a MI0283QT panel.

-- 
With Best Regards,
Andy Shevchenko


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-26  8:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-25 14:45 [PATCH v1] drm/tinydrm/ili9341: Support Adafruit 2.8" TFT display Andy Shevchenko
2019-02-25 15:07 ` Noralf Trønnes
2019-02-26  8:14   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.