Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-07-09 Thread Paul Cercueil

Hi Daniel,

Le mer. 8 juil. 2020 à 9:23, Daniel Vetter  a écrit :

On Tue, Jul 07, 2020 at 04:32:25PM +0200, Noralf Trønnes wrote:

 (cc Dillon)

 Den 03.07.2020 19.26, skrev Sam Ravnborg:
 > Hi Noralf/Paul.
 >
 > Trying to stir up this discussion again.
 >
 > On Sun, Jun 14, 2020 at 06:36:22PM +0200, Noralf Trønnes wrote:
 >>
 >>
 >> Den 07.06.2020 15.38, skrev Paul Cercueil:
 >>> Hi,
 >>>
 >>> Here's a follow-up on the previous discussion about the current 
state of

 >>> DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.
 >>>
 >>> This patchset introduces the following:
 >>> * It slightly tweaks the MIPI DSI code so that it supports MIPI 
DBI over
 >>>   various buses. This patch has been tested with a non-upstream 
DRM
 >>>   panel driver for a ILI9331 DBI/8080 panel, written with the 
DSI
 >>>   framework (and doesn't include ), and 
non-upstream

 >>>   DSI/DBI host driver for the Ingenic SoCs.
 >>>
 >>> * A SPI DBI host driver, using the current MIPI DSI framework. 
It allows
 >>>   MIPI DSI/DBI drivers to be written with the DSI framework, 
even if
 >>>   they are connected over SPI, instead of registering as SPI 
device
 >>>   drivers. Since most of these panels can be connected over 
various
 >>>   buses, it permits to reuse the same driver independently of 
the bus

 >>>   used.
 >>>
 >>> * A TinyDRM driver for DSI/DBI panels, once again independent 
of the bus
 >>>   used; the only dependency (currently) being that the panel 
must

 >>>   understand DCS commands.
 >>>
 >>> * A DRM panel driver to test the stack. This driver controls 
Ilitek
 >>>   ILI9341 based DBI panels, like the Adafruit YX240QV29-T 
320x240 2.4"

 >>>   TFT LCD panel. This panel was converted from
 >>>   drivers/gpu/drm/tiny/ili9341.c.
 >>>
 >>> I would like to emphasize that while it has been 
compile-tested, I did

 >>> not test it with real hardware since I do not have any DBI panel
 >>> connected over SPI. I did runtime-test the code, just without 
any panel

 >>> connected.
 >>>
 >>> Another thing to note, is that it does not break Device Tree 
ABI. The

 >>> display node stays the same:
 >>>
 >>> display@0 {
 >>>   compatible = "adafruit,yx240qv29", "ilitek,ili9341";
 >>>   reg = <0>;
 >>>   spi-max-frequency = <3200>;
 >>>   dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
 >>>   reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
 >>>   rotation = <270>;
 >>>   backlight = <>;
 >>> };
 >>>
 >>> The reason it works, is that the "adafruit,yx240qv29" device is 
probed
 >>> on the SPI bus, so it will match with the SPI/DBI host driver. 
This will
 >>> in turn register the very same node with the DSI bus, and the 
ILI9341
 >>> DRM panel driver will probe. The driver will detect that no 
controller
 >>> is linked to the panel, and eventually register the DBI/DSI 
TinyDRM

 >>> driver.
 >>>
 >>> I can't stress it enough that this is a RFC, so it still has 
very rough

 >>> edges.
 >>>
 >>
 >> I don't know bridge and dsi drivers so I can't comment on that, 
but one
 >> thing I didn't like is that the DT compatible string has to be 
added to

 >> 2 different modules.
 >>
 >> As an example, a MI0283QT panel (ILI9341) supports these 
interface options:

 >>
 >> 1. SPI
 >>Panel setup/control and framebuffer upload over SPI
 >>
 >> 2. SPI + DPI
 >>Panel setup/control over SPI, framebuffer scanout over DPI
 >>
 >> 3. Parallel bus
 >>Panel setup/control and framebuffer upload over parallel bus
 >
 > To continue the configurations we should support:
 > - Panels where the chip can be configured to SPI, SPI+DPI, 
Parallel bus

 >   (as detailed by Noralf above)
 > - Panels that supports only 6800 or 8080 - connected via GPIO 
pins or

 >   memory mapped (maybe behind some special IP to support this)
 >   Command set is often special.
 >
 > We will see a number of chips with many different types of 
displays.
 > So the drivers should be chip specific with configuration 
depending on

 > the connected display.
 >
 > What I hope we can find a solution for is a single file/driver 
that can

 > support all the relevant interface types for a chip.
 > So we would end up with a single file that included the necessary
 > support for ili9341 in all interface configurations with the 
necessary

 > support for the relevant displays.
 >
 > I do not know how far we are from this as I have not dived into 
the

 > details of any of the proposals.

 In an ideal world I would have liked to see the MIPI DBI parallel
 interface implemented using a new Linux parallel bus type. It could 
have
 drivers for gpio bitbanging and mmio in addition to other hw 
specific
 drivers. Now we could have a drm_mipi_dbi DRM driver that registers 
as a

 SPI client driver and a Parallel bus client driver. Or it can be a
 component driver for the existing DRM driver on the SoC.

 I had plans to do this and made a prototype, but dropped it since it
 would probably require a lot of work getting in a new Linux bus 
type.


Channelling my inner Greg KH:

Please just create a new 

Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-07-08 Thread Noralf Trønnes


Den 08.07.2020 14.49, skrev Paul Cercueil:
> Hi Daniel,
> 
> Le mer. 8 juil. 2020 à 9:23, Daniel Vetter  a écrit :
>> On Tue, Jul 07, 2020 at 04:32:25PM +0200, Noralf Trønnes wrote:
>>>  (cc Dillon)
>>>
>>>  Den 03.07.2020 19.26, skrev Sam Ravnborg:
>>>  > Hi Noralf/Paul.
>>>  >
>>>  > Trying to stir up this discussion again.
>>>  >
>>>  > On Sun, Jun 14, 2020 at 06:36:22PM +0200, Noralf Trønnes wrote:
>>>  >>
>>>  >>
>>>  >> Den 07.06.2020 15.38, skrev Paul Cercueil:
>>>  >>> Hi,
>>>  >>>
>>>  >>> Here's a follow-up on the previous discussion about the current
>>> state of
>>>  >>> DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.
>>>  >>>
>>>  >>> This patchset introduces the following:
>>>  >>> * It slightly tweaks the MIPI DSI code so that it supports MIPI
>>> DBI over
>>>  >>>   various buses. This patch has been tested with a non-upstream DRM
>>>  >>>   panel driver for a ILI9331 DBI/8080 panel, written with the DSI
>>>  >>>   framework (and doesn't include ), and
>>> non-upstream
>>>  >>>   DSI/DBI host driver for the Ingenic SoCs.
>>>  >>>
>>>  >>> * A SPI DBI host driver, using the current MIPI DSI framework.
>>> It allows
>>>  >>>   MIPI DSI/DBI drivers to be written with the DSI framework,
>>> even if
>>>  >>>   they are connected over SPI, instead of registering as SPI device
>>>  >>>   drivers. Since most of these panels can be connected over various
>>>  >>>   buses, it permits to reuse the same driver independently of
>>> the bus
>>>  >>>   used.
>>>  >>>
>>>  >>> * A TinyDRM driver for DSI/DBI panels, once again independent of
>>> the bus
>>>  >>>   used; the only dependency (currently) being that the panel must
>>>  >>>   understand DCS commands.
>>>  >>>
>>>  >>> * A DRM panel driver to test the stack. This driver controls Ilitek
>>>  >>>   ILI9341 based DBI panels, like the Adafruit YX240QV29-T
>>> 320x240 2.4"
>>>  >>>   TFT LCD panel. This panel was converted from
>>>  >>>   drivers/gpu/drm/tiny/ili9341.c.
>>>  >>>
>>>  >>> I would like to emphasize that while it has been compile-tested,
>>> I did
>>>  >>> not test it with real hardware since I do not have any DBI panel
>>>  >>> connected over SPI. I did runtime-test the code, just without
>>> any panel
>>>  >>> connected.
>>>  >>>
>>>  >>> Another thing to note, is that it does not break Device Tree
>>> ABI. The
>>>  >>> display node stays the same:
>>>  >>>
>>>  >>> display@0 {
>>>  >>> compatible = "adafruit,yx240qv29", "ilitek,ili9341";
>>>  >>> reg = <0>;
>>>  >>> spi-max-frequency = <3200>;
>>>  >>> dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
>>>  >>> reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
>>>  >>> rotation = <270>;
>>>  >>> backlight = <>;
>>>  >>> };
>>>  >>>
>>>  >>> The reason it works, is that the "adafruit,yx240qv29" device is
>>> probed
>>>  >>> on the SPI bus, so it will match with the SPI/DBI host driver.
>>> This will
>>>  >>> in turn register the very same node with the DSI bus, and the
>>> ILI9341
>>>  >>> DRM panel driver will probe. The driver will detect that no
>>> controller
>>>  >>> is linked to the panel, and eventually register the DBI/DSI TinyDRM
>>>  >>> driver.
>>>  >>>
>>>  >>> I can't stress it enough that this is a RFC, so it still has
>>> very rough
>>>  >>> edges.
>>>  >>>
>>>  >>
>>>  >> I don't know bridge and dsi drivers so I can't comment on that,
>>> but one
>>>  >> thing I didn't like is that the DT compatible string has to be
>>> added to
>>>  >> 2 different modules.
>>>  >>
>>>  >> As an example, a MI0283QT panel (ILI9341) supports these
>>> interface options:
>>>  >>
>>>  >> 1. SPI
>>>  >>    Panel setup/control and framebuffer upload over SPI
>>>  >>
>>>  >> 2. SPI + DPI
>>>  >>    Panel setup/control over SPI, framebuffer scanout over DPI
>>>  >>
>>>  >> 3. Parallel bus
>>>  >>    Panel setup/control and framebuffer upload over parallel bus
>>>  >
>>>  > To continue the configurations we should support:
>>>  > - Panels where the chip can be configured to SPI, SPI+DPI,
>>> Parallel bus
>>>  >   (as detailed by Noralf above)
>>>  > - Panels that supports only 6800 or 8080 - connected via GPIO pins or
>>>  >   memory mapped (maybe behind some special IP to support this)
>>>  >   Command set is often special.
>>>  >
>>>  > We will see a number of chips with many different types of displays.
>>>  > So the drivers should be chip specific with configuration
>>> depending on
>>>  > the connected display.
>>>  >
>>>  > What I hope we can find a solution for is a single file/driver
>>> that can
>>>  > support all the relevant interface types for a chip.
>>>  > So we would end up with a single file that included the necessary
>>>  > support for ili9341 in all interface configurations with the
>>> necessary
>>>  > support for the relevant displays.
>>>  >
>>>  > I do not know how far we are from this as I have not dived into the
>>>  > details of any of the proposals.
>>>
>>>  In an ideal world I would have liked to see the MIPI DBI parallel
>>>  interface implemented 

Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-07-08 Thread Daniel Vetter
On Tue, Jul 07, 2020 at 04:32:25PM +0200, Noralf Trønnes wrote:
> (cc Dillon)
> 
> Den 03.07.2020 19.26, skrev Sam Ravnborg:
> > Hi Noralf/Paul.
> > 
> > Trying to stir up this discussion again.
> > 
> > On Sun, Jun 14, 2020 at 06:36:22PM +0200, Noralf Trønnes wrote:
> >>
> >>
> >> Den 07.06.2020 15.38, skrev Paul Cercueil:
> >>> Hi,
> >>>
> >>> Here's a follow-up on the previous discussion about the current state of
> >>> DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.
> >>>
> >>> This patchset introduces the following:
> >>> * It slightly tweaks the MIPI DSI code so that it supports MIPI DBI over
> >>>   various buses. This patch has been tested with a non-upstream DRM
> >>>   panel driver for a ILI9331 DBI/8080 panel, written with the DSI
> >>>   framework (and doesn't include ), and non-upstream
> >>>   DSI/DBI host driver for the Ingenic SoCs.
> >>>
> >>> * A SPI DBI host driver, using the current MIPI DSI framework. It allows
> >>>   MIPI DSI/DBI drivers to be written with the DSI framework, even if
> >>>   they are connected over SPI, instead of registering as SPI device
> >>>   drivers. Since most of these panels can be connected over various
> >>>   buses, it permits to reuse the same driver independently of the bus
> >>>   used.
> >>>
> >>> * A TinyDRM driver for DSI/DBI panels, once again independent of the bus
> >>>   used; the only dependency (currently) being that the panel must
> >>>   understand DCS commands.
> >>>
> >>> * A DRM panel driver to test the stack. This driver controls Ilitek
> >>>   ILI9341 based DBI panels, like the Adafruit YX240QV29-T 320x240 2.4"
> >>>   TFT LCD panel. This panel was converted from
> >>>   drivers/gpu/drm/tiny/ili9341.c.
> >>>
> >>> I would like to emphasize that while it has been compile-tested, I did
> >>> not test it with real hardware since I do not have any DBI panel
> >>> connected over SPI. I did runtime-test the code, just without any panel
> >>> connected.
> >>>
> >>> Another thing to note, is that it does not break Device Tree ABI. The
> >>> display node stays the same:
> >>>
> >>> display@0 {
> >>>   compatible = "adafruit,yx240qv29", "ilitek,ili9341";
> >>>   reg = <0>;
> >>>   spi-max-frequency = <3200>;
> >>>   dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
> >>>   reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
> >>>   rotation = <270>;
> >>>   backlight = <>;
> >>> };
> >>>
> >>> The reason it works, is that the "adafruit,yx240qv29" device is probed
> >>> on the SPI bus, so it will match with the SPI/DBI host driver. This will
> >>> in turn register the very same node with the DSI bus, and the ILI9341
> >>> DRM panel driver will probe. The driver will detect that no controller
> >>> is linked to the panel, and eventually register the DBI/DSI TinyDRM
> >>> driver.
> >>>
> >>> I can't stress it enough that this is a RFC, so it still has very rough
> >>> edges.
> >>>
> >>
> >> I don't know bridge and dsi drivers so I can't comment on that, but one
> >> thing I didn't like is that the DT compatible string has to be added to
> >> 2 different modules.
> >>
> >> As an example, a MI0283QT panel (ILI9341) supports these interface options:
> >>
> >> 1. SPI
> >>Panel setup/control and framebuffer upload over SPI
> >>
> >> 2. SPI + DPI
> >>Panel setup/control over SPI, framebuffer scanout over DPI
> >>
> >> 3. Parallel bus
> >>Panel setup/control and framebuffer upload over parallel bus
> > 
> > To continue the configurations we should support:
> > - Panels where the chip can be configured to SPI, SPI+DPI, Parallel bus
> >   (as detailed by Noralf above)
> > - Panels that supports only 6800 or 8080 - connected via GPIO pins or
> >   memory mapped (maybe behind some special IP to support this)
> >   Command set is often special.
> > 
> > We will see a number of chips with many different types of displays.
> > So the drivers should be chip specific with configuration depending on
> > the connected display.
> > 
> > What I hope we can find a solution for is a single file/driver that can
> > support all the relevant interface types for a chip.
> > So we would end up with a single file that included the necessary
> > support for ili9341 in all interface configurations with the necessary
> > support for the relevant displays.
> > 
> > I do not know how far we are from this as I have not dived into the
> > details of any of the proposals.
> 
> In an ideal world I would have liked to see the MIPI DBI parallel
> interface implemented using a new Linux parallel bus type. It could have
> drivers for gpio bitbanging and mmio in addition to other hw specific
> drivers. Now we could have a drm_mipi_dbi DRM driver that registers as a
> SPI client driver and a Parallel bus client driver. Or it can be a
> component driver for the existing DRM driver on the SoC.
> 
> I had plans to do this and made a prototype, but dropped it since it
> would probably require a lot of work getting in a new Linux bus type.

Channelling my inner Greg KH:

Please just create a new bus, 

Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-07-07 Thread Noralf Trønnes
(cc Dillon)

Den 03.07.2020 19.26, skrev Sam Ravnborg:
> Hi Noralf/Paul.
> 
> Trying to stir up this discussion again.
> 
> On Sun, Jun 14, 2020 at 06:36:22PM +0200, Noralf Trønnes wrote:
>>
>>
>> Den 07.06.2020 15.38, skrev Paul Cercueil:
>>> Hi,
>>>
>>> Here's a follow-up on the previous discussion about the current state of
>>> DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.
>>>
>>> This patchset introduces the following:
>>> * It slightly tweaks the MIPI DSI code so that it supports MIPI DBI over
>>>   various buses. This patch has been tested with a non-upstream DRM
>>>   panel driver for a ILI9331 DBI/8080 panel, written with the DSI
>>>   framework (and doesn't include ), and non-upstream
>>>   DSI/DBI host driver for the Ingenic SoCs.
>>>
>>> * A SPI DBI host driver, using the current MIPI DSI framework. It allows
>>>   MIPI DSI/DBI drivers to be written with the DSI framework, even if
>>>   they are connected over SPI, instead of registering as SPI device
>>>   drivers. Since most of these panels can be connected over various
>>>   buses, it permits to reuse the same driver independently of the bus
>>>   used.
>>>
>>> * A TinyDRM driver for DSI/DBI panels, once again independent of the bus
>>>   used; the only dependency (currently) being that the panel must
>>>   understand DCS commands.
>>>
>>> * A DRM panel driver to test the stack. This driver controls Ilitek
>>>   ILI9341 based DBI panels, like the Adafruit YX240QV29-T 320x240 2.4"
>>>   TFT LCD panel. This panel was converted from
>>>   drivers/gpu/drm/tiny/ili9341.c.
>>>
>>> I would like to emphasize that while it has been compile-tested, I did
>>> not test it with real hardware since I do not have any DBI panel
>>> connected over SPI. I did runtime-test the code, just without any panel
>>> connected.
>>>
>>> Another thing to note, is that it does not break Device Tree ABI. The
>>> display node stays the same:
>>>
>>> display@0 {
>>> compatible = "adafruit,yx240qv29", "ilitek,ili9341";
>>> reg = <0>;
>>> spi-max-frequency = <3200>;
>>> dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
>>> reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
>>> rotation = <270>;
>>> backlight = <>;
>>> };
>>>
>>> The reason it works, is that the "adafruit,yx240qv29" device is probed
>>> on the SPI bus, so it will match with the SPI/DBI host driver. This will
>>> in turn register the very same node with the DSI bus, and the ILI9341
>>> DRM panel driver will probe. The driver will detect that no controller
>>> is linked to the panel, and eventually register the DBI/DSI TinyDRM
>>> driver.
>>>
>>> I can't stress it enough that this is a RFC, so it still has very rough
>>> edges.
>>>
>>
>> I don't know bridge and dsi drivers so I can't comment on that, but one
>> thing I didn't like is that the DT compatible string has to be added to
>> 2 different modules.
>>
>> As an example, a MI0283QT panel (ILI9341) supports these interface options:
>>
>> 1. SPI
>>Panel setup/control and framebuffer upload over SPI
>>
>> 2. SPI + DPI
>>Panel setup/control over SPI, framebuffer scanout over DPI
>>
>> 3. Parallel bus
>>Panel setup/control and framebuffer upload over parallel bus
> 
> To continue the configurations we should support:
> - Panels where the chip can be configured to SPI, SPI+DPI, Parallel bus
>   (as detailed by Noralf above)
> - Panels that supports only 6800 or 8080 - connected via GPIO pins or
>   memory mapped (maybe behind some special IP to support this)
>   Command set is often special.
> 
> We will see a number of chips with many different types of displays.
> So the drivers should be chip specific with configuration depending on
> the connected display.
> 
> What I hope we can find a solution for is a single file/driver that can
> support all the relevant interface types for a chip.
> So we would end up with a single file that included the necessary
> support for ili9341 in all interface configurations with the necessary
> support for the relevant displays.
> 
> I do not know how far we are from this as I have not dived into the
> details of any of the proposals.

In an ideal world I would have liked to see the MIPI DBI parallel
interface implemented using a new Linux parallel bus type. It could have
drivers for gpio bitbanging and mmio in addition to other hw specific
drivers. Now we could have a drm_mipi_dbi DRM driver that registers as a
SPI client driver and a Parallel bus client driver. Or it can be a
component driver for the existing DRM driver on the SoC.

I had plans to do this and made a prototype, but dropped it since it
would probably require a lot of work getting in a new Linux bus type.

However if we're going to treat this parallel bus only as a MIPI DBI
display interface but support gpio bitbanging and mmio as well, then we
could add DRM drivers for each MIPI DBI bus (that don't have special
parallel bus hw):
- mipi-dbi-spi
- mipi-dbi-gpio
- mipi-dbi-mmio

These drivers will register as a mipi_dsi_host adapted like 

Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-07-03 Thread Sam Ravnborg
Hi Noralf/Paul.

Trying to stir up this discussion again.

On Sun, Jun 14, 2020 at 06:36:22PM +0200, Noralf Trønnes wrote:
> 
> 
> Den 07.06.2020 15.38, skrev Paul Cercueil:
> > Hi,
> > 
> > Here's a follow-up on the previous discussion about the current state of
> > DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.
> > 
> > This patchset introduces the following:
> > * It slightly tweaks the MIPI DSI code so that it supports MIPI DBI over
> >   various buses. This patch has been tested with a non-upstream DRM
> >   panel driver for a ILI9331 DBI/8080 panel, written with the DSI
> >   framework (and doesn't include ), and non-upstream
> >   DSI/DBI host driver for the Ingenic SoCs.
> > 
> > * A SPI DBI host driver, using the current MIPI DSI framework. It allows
> >   MIPI DSI/DBI drivers to be written with the DSI framework, even if
> >   they are connected over SPI, instead of registering as SPI device
> >   drivers. Since most of these panels can be connected over various
> >   buses, it permits to reuse the same driver independently of the bus
> >   used.
> > 
> > * A TinyDRM driver for DSI/DBI panels, once again independent of the bus
> >   used; the only dependency (currently) being that the panel must
> >   understand DCS commands.
> > 
> > * A DRM panel driver to test the stack. This driver controls Ilitek
> >   ILI9341 based DBI panels, like the Adafruit YX240QV29-T 320x240 2.4"
> >   TFT LCD panel. This panel was converted from
> >   drivers/gpu/drm/tiny/ili9341.c.
> > 
> > I would like to emphasize that while it has been compile-tested, I did
> > not test it with real hardware since I do not have any DBI panel
> > connected over SPI. I did runtime-test the code, just without any panel
> > connected.
> > 
> > Another thing to note, is that it does not break Device Tree ABI. The
> > display node stays the same:
> > 
> > display@0 {
> > compatible = "adafruit,yx240qv29", "ilitek,ili9341";
> > reg = <0>;
> > spi-max-frequency = <3200>;
> > dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
> > reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
> > rotation = <270>;
> > backlight = <>;
> > };
> > 
> > The reason it works, is that the "adafruit,yx240qv29" device is probed
> > on the SPI bus, so it will match with the SPI/DBI host driver. This will
> > in turn register the very same node with the DSI bus, and the ILI9341
> > DRM panel driver will probe. The driver will detect that no controller
> > is linked to the panel, and eventually register the DBI/DSI TinyDRM
> > driver.
> > 
> > I can't stress it enough that this is a RFC, so it still has very rough
> > edges.
> > 
> 
> I don't know bridge and dsi drivers so I can't comment on that, but one
> thing I didn't like is that the DT compatible string has to be added to
> 2 different modules.
> 
> As an example, a MI0283QT panel (ILI9341) supports these interface options:
> 
> 1. SPI
>Panel setup/control and framebuffer upload over SPI
> 
> 2. SPI + DPI
>Panel setup/control over SPI, framebuffer scanout over DPI
> 
> 3. Parallel bus
>Panel setup/control and framebuffer upload over parallel bus

To continue the configurations we should support:
- Panels where the chip can be configured to SPI, SPI+DPI, Parallel bus
  (as detailed by Noralf above)
- Panels that supports only 6800 or 8080 - connected via GPIO pins or
  memory mapped (maybe behind some special IP to support this)
  Command set is often special.

We will see a number of chips with many different types of displays.
So the drivers should be chip specific with configuration depending on
the connected display.

What I hope we can find a solution for is a single file/driver that can
support all the relevant interface types for a chip.
So we would end up with a single file that included the necessary
support for ili9341 in all interface configurations with the necessary
support for the relevant displays.

I do not know how far we are from this as I have not dived into the
details of any of the proposals.
> 
> My suggestion is to have one panel driver module that can support all of
> these like this:
So I think we agree here.

> 
> For 1. and 2. a SPI driver is registered and if I understand your
> example correctly of_graph_get_port_by_id() can be used during probe to
> distinguish between the 2 options and register a full DRM driver for 1.
> and add a DRM panel for 2.
> 
> For 3. a DSI driver is registered (adapted for DBI use like you're
> suggesting).
> 
> Note that the interface part of the controller initialization will
> differ between these, the panel side init will be the same I assume.

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


Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-06-19 Thread Paul Cercueil

Hi Emil,

Le mar. 16 juin 2020 à 18:47, Emil Velikov  
a écrit :

Hi all,

Allow me to compare this approach with some work Linus W [1] did a
while back, which I've just noticed.

Pauls' approach:

 - Perhaps the shortest one possible
Porting an existing DSI panel to DBI is 3 lines of code - compat line
in the SPI/DSI bridge, a bus_type and
mipi_dsi_maybe_register_tiny_driver() call
The clever use of the DSI type (equal to zero) means that things will
work w/o updating existing dsi hosts and devices in panel/. Yet in the
very unlikely case that the panel does not support DSI, we will still
allow it.


Actually the DSI type is not equal to zero, it's BIT(0) so 1. Right now 
in the patch, I added a WARN in mipi_dsi_attach() that checks that 
bus_type is non-zero.


-Paul

Although thinking about the type I wonder if it can accommodate all 
use-cases:

Since we can have a device (panel) capable of DSI+SPI it makes sense
for it to expose the type bitmask, not the host. Although, what if the
host itself supports DSI+SPI.?
Now we can extrapolate that with a host (say fimd/exynos I think)
which supports a SPI panel (s6e63m0) while having
of_graph_get_port_by_id(0)?

- Strange (ab)use of the DSI bus for DBI (SPI, 6800, 8080 etc)
We care about existing users (DT) and it sounds unlikely (based on
previous discussion) that DBI + SPI/6800... will make it into DT. So
the current approach seems quite reasonable IMHO.


Linus' approach:
- Clear separation of DSI/SPI
Compat strings are still duplicated, although in separate files

- Minor code motion and slightly more invasive porting overall
Much of the boilerplate can be reduced via helper lib and macros. Even
then it's unlikely we'll reach the 3 line delta as with Paul's
approach.

- Does not handle tiny-dsi (dummy) drm driver
It seems doable, with minor changes


Personally I'm on the fence and a deciding factor for me is if Paul's
approach can handle all the combinations of host/device type support.
That said, the input from people likely to do the work would be highly
appreciated.

Once a decision is made, an illustrative series + todo entry would be
great to have.
-Emil

[1] 
https://lists.freedesktop.org/archives/dri-devel/2020-May/266079.html



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


Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-06-17 Thread Paul Cercueil

Hi Emil,

Le mar. 16 juin 2020 à 18:47, Emil Velikov  
a écrit :

Hi all,

Allow me to compare this approach with some work Linus W [1] did a
while back, which I've just noticed.

Pauls' approach:

 - Perhaps the shortest one possible
Porting an existing DSI panel to DBI is 3 lines of code - compat line
in the SPI/DSI bridge, a bus_type and
mipi_dsi_maybe_register_tiny_driver() call
The clever use of the DSI type (equal to zero) means that things will
work w/o updating existing dsi hosts and devices in panel/. Yet in the
very unlikely case that the panel does not support DSI, we will still
allow it.


Is there such a case? I assumed that all current DSI device and host 
drivers are for DSI panels.


Although thinking about the type I wonder if it can accommodate all 
use-cases:

Since we can have a device (panel) capable of DSI+SPI it makes sense
for it to expose the type bitmask, not the host. Although, what if the
host itself supports DSI+SPI.?


Yes, hosts can support more than one type (mine does), so it should 
expose a bitmask. As for the panel, even though some can do DSI, SPI 
and I8080 DBI, as far as I know the bus used is always set in hardware 
(with specific pins set to VCC/GND to select the mode), so this is not 
something the host can select. Therefore, the panel driver should 
register the mipi_dsi_device with one particular bus type. Note that 
the panel driver could very well infer the bus type from the compatible 
string.


If the bus type can be changed at runtime (and there's a need for 
that), then we would need a bitmask on the panel driver side too, along 
with a 'set bus' callback, but I'm not sure it will be required.



Now we can extrapolate that with a host (say fimd/exynos I think)
which supports a SPI panel (s6e63m0) while having
of_graph_get_port_by_id(0)?


I'm not sure I understand, if there is a port #0 in the panel node, 
then the tinyDRM driver is not created, and the SPI panel will be 
registered with the fimd/exynos host driver. So that should already 
work fine.



- Strange (ab)use of the DSI bus for DBI (SPI, 6800, 8080 etc)
We care about existing users (DT) and it sounds unlikely (based on
previous discussion) that DBI + SPI/6800... will make it into DT. So
the current approach seems quite reasonable IMHO.


Linus' approach:
- Clear separation of DSI/SPI
Compat strings are still duplicated, although in separate files

- Minor code motion and slightly more invasive porting overall
Much of the boilerplate can be reduced via helper lib and macros. Even
then it's unlikely we'll reach the 3 line delta as with Paul's
approach.

- Does not handle tiny-dsi (dummy) drm driver
It seems doable, with minor changes


Personally I'm on the fence and a deciding factor for me is if Paul's
approach can handle all the combinations of host/device type support.
That said, the input from people likely to do the work would be highly
appreciated.

Once a decision is made, an illustrative series + todo entry would be
great to have.


Sure. Thanks for the feedback!

Cheers,
-Paul


-Emil

[1] 
https://lists.freedesktop.org/archives/dri-devel/2020-May/266079.html



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


Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-06-16 Thread Emil Velikov
Hi all,

Allow me to compare this approach with some work Linus W [1] did a
while back, which I've just noticed.

Pauls' approach:

 - Perhaps the shortest one possible
Porting an existing DSI panel to DBI is 3 lines of code - compat line
in the SPI/DSI bridge, a bus_type and
mipi_dsi_maybe_register_tiny_driver() call
The clever use of the DSI type (equal to zero) means that things will
work w/o updating existing dsi hosts and devices in panel/. Yet in the
very unlikely case that the panel does not support DSI, we will still
allow it.

Although thinking about the type I wonder if it can accommodate all use-cases:
Since we can have a device (panel) capable of DSI+SPI it makes sense
for it to expose the type bitmask, not the host. Although, what if the
host itself supports DSI+SPI.?
Now we can extrapolate that with a host (say fimd/exynos I think)
which supports a SPI panel (s6e63m0) while having
of_graph_get_port_by_id(0)?

- Strange (ab)use of the DSI bus for DBI (SPI, 6800, 8080 etc)
We care about existing users (DT) and it sounds unlikely (based on
previous discussion) that DBI + SPI/6800... will make it into DT. So
the current approach seems quite reasonable IMHO.


Linus' approach:
- Clear separation of DSI/SPI
Compat strings are still duplicated, although in separate files

- Minor code motion and slightly more invasive porting overall
Much of the boilerplate can be reduced via helper lib and macros. Even
then it's unlikely we'll reach the 3 line delta as with Paul's
approach.

- Does not handle tiny-dsi (dummy) drm driver
It seems doable, with minor changes


Personally I'm on the fence and a deciding factor for me is if Paul's
approach can handle all the combinations of host/device type support.
That said, the input from people likely to do the work would be highly
appreciated.

Once a decision is made, an illustrative series + todo entry would be
great to have.
-Emil

[1] https://lists.freedesktop.org/archives/dri-devel/2020-May/266079.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-06-15 Thread Paul Cercueil

Hi Noralf,


Le dim. 14 juin 2020 à 18:36, Noralf Trønnes  a 
écrit :



Den 07.06.2020 15.38, skrev Paul Cercueil:

 Hi,

 Here's a follow-up on the previous discussion about the current 
state of

 DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.

 This patchset introduces the following:
 * It slightly tweaks the MIPI DSI code so that it supports MIPI DBI 
over

   various buses. This patch has been tested with a non-upstream DRM
   panel driver for a ILI9331 DBI/8080 panel, written with the DSI
   framework (and doesn't include ), and 
non-upstream

   DSI/DBI host driver for the Ingenic SoCs.

 * A SPI DBI host driver, using the current MIPI DSI framework. It 
allows

   MIPI DSI/DBI drivers to be written with the DSI framework, even if
   they are connected over SPI, instead of registering as SPI device
   drivers. Since most of these panels can be connected over various
   buses, it permits to reuse the same driver independently of the 
bus

   used.

 * A TinyDRM driver for DSI/DBI panels, once again independent of 
the bus

   used; the only dependency (currently) being that the panel must
   understand DCS commands.

 * A DRM panel driver to test the stack. This driver controls Ilitek
   ILI9341 based DBI panels, like the Adafruit YX240QV29-T 320x240 
2.4"

   TFT LCD panel. This panel was converted from
   drivers/gpu/drm/tiny/ili9341.c.

 I would like to emphasize that while it has been compile-tested, I 
did

 not test it with real hardware since I do not have any DBI panel
 connected over SPI. I did runtime-test the code, just without any 
panel

 connected.

 Another thing to note, is that it does not break Device Tree ABI. 
The

 display node stays the same:

 display@0 {
compatible = "adafruit,yx240qv29", "ilitek,ili9341";
reg = <0>;
spi-max-frequency = <3200>;
dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
rotation = <270>;
backlight = <>;
 };

 The reason it works, is that the "adafruit,yx240qv29" device is 
probed
 on the SPI bus, so it will match with the SPI/DBI host driver. This 
will
 in turn register the very same node with the DSI bus, and the 
ILI9341
 DRM panel driver will probe. The driver will detect that no 
controller

 is linked to the panel, and eventually register the DBI/DSI TinyDRM
 driver.

 I can't stress it enough that this is a RFC, so it still has very 
rough

 edges.



I don't know bridge and dsi drivers so I can't comment on that, but 
one
thing I didn't like is that the DT compatible string has to be added 
to

2 different modules.


That's a minimal drawback for a perfectly architectured design ;)

As an example, a MI0283QT panel (ILI9341) supports these interface 
options:


1. SPI
   Panel setup/control and framebuffer upload over SPI

2. SPI + DPI
   Panel setup/control over SPI, framebuffer scanout over DPI

3. Parallel bus
   Panel setup/control and framebuffer upload over parallel bus

My suggestion is to have one panel driver module that can support all 
of

these like this:

For 1. and 2. a SPI driver is registered and if I understand your
example correctly of_graph_get_port_by_id() can be used during probe 
to
distinguish between the 2 options and register a full DRM driver for 
1.

and add a DRM panel for 2.

For 3. a DSI driver is registered (adapted for DBI use like you're
suggesting).


That means basically having two entry points per DBI driver, one as DSI 
device and one as SPI device, the latter doing the job of the current 
DBI-SPI bridge. I think i would be cleaner to just have duplicated 
strings with the DBI-SPI bridge.


Cheers,
-Paul


Note that the interface part of the controller initialization will
differ between these, the panel side init will be the same I assume.



Noralf.



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


Re: [RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-06-14 Thread Noralf Trønnes



Den 07.06.2020 15.38, skrev Paul Cercueil:
> Hi,
> 
> Here's a follow-up on the previous discussion about the current state of
> DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.
> 
> This patchset introduces the following:
> * It slightly tweaks the MIPI DSI code so that it supports MIPI DBI over
>   various buses. This patch has been tested with a non-upstream DRM
>   panel driver for a ILI9331 DBI/8080 panel, written with the DSI
>   framework (and doesn't include ), and non-upstream
>   DSI/DBI host driver for the Ingenic SoCs.
> 
> * A SPI DBI host driver, using the current MIPI DSI framework. It allows
>   MIPI DSI/DBI drivers to be written with the DSI framework, even if
>   they are connected over SPI, instead of registering as SPI device
>   drivers. Since most of these panels can be connected over various
>   buses, it permits to reuse the same driver independently of the bus
>   used.
> 
> * A TinyDRM driver for DSI/DBI panels, once again independent of the bus
>   used; the only dependency (currently) being that the panel must
>   understand DCS commands.
> 
> * A DRM panel driver to test the stack. This driver controls Ilitek
>   ILI9341 based DBI panels, like the Adafruit YX240QV29-T 320x240 2.4"
>   TFT LCD panel. This panel was converted from
>   drivers/gpu/drm/tiny/ili9341.c.
> 
> I would like to emphasize that while it has been compile-tested, I did
> not test it with real hardware since I do not have any DBI panel
> connected over SPI. I did runtime-test the code, just without any panel
> connected.
> 
> Another thing to note, is that it does not break Device Tree ABI. The
> display node stays the same:
> 
> display@0 {
>   compatible = "adafruit,yx240qv29", "ilitek,ili9341";
>   reg = <0>;
>   spi-max-frequency = <3200>;
>   dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
>   reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
>   rotation = <270>;
>   backlight = <>;
> };
> 
> The reason it works, is that the "adafruit,yx240qv29" device is probed
> on the SPI bus, so it will match with the SPI/DBI host driver. This will
> in turn register the very same node with the DSI bus, and the ILI9341
> DRM panel driver will probe. The driver will detect that no controller
> is linked to the panel, and eventually register the DBI/DSI TinyDRM
> driver.
> 
> I can't stress it enough that this is a RFC, so it still has very rough
> edges.
> 

I don't know bridge and dsi drivers so I can't comment on that, but one
thing I didn't like is that the DT compatible string has to be added to
2 different modules.

As an example, a MI0283QT panel (ILI9341) supports these interface options:

1. SPI
   Panel setup/control and framebuffer upload over SPI

2. SPI + DPI
   Panel setup/control over SPI, framebuffer scanout over DPI

3. Parallel bus
   Panel setup/control and framebuffer upload over parallel bus

My suggestion is to have one panel driver module that can support all of
these like this:

For 1. and 2. a SPI driver is registered and if I understand your
example correctly of_graph_get_port_by_id() can be used during probe to
distinguish between the 2 options and register a full DRM driver for 1.
and add a DRM panel for 2.

For 3. a DSI driver is registered (adapted for DBI use like you're
suggesting).

Note that the interface part of the controller initialization will
differ between these, the panel side init will be the same I assume.

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


[RFC PATCH 0/4] DSI/DBI and TinyDRM driver

2020-06-07 Thread Paul Cercueil
Hi,

Here's a follow-up on the previous discussion about the current state of
DSI/DBI panel drivers, TinyDRM, and the need of a cleanup.

This patchset introduces the following:
* It slightly tweaks the MIPI DSI code so that it supports MIPI DBI over
  various buses. This patch has been tested with a non-upstream DRM
  panel driver for a ILI9331 DBI/8080 panel, written with the DSI
  framework (and doesn't include ), and non-upstream
  DSI/DBI host driver for the Ingenic SoCs.

* A SPI DBI host driver, using the current MIPI DSI framework. It allows
  MIPI DSI/DBI drivers to be written with the DSI framework, even if
  they are connected over SPI, instead of registering as SPI device
  drivers. Since most of these panels can be connected over various
  buses, it permits to reuse the same driver independently of the bus
  used.

* A TinyDRM driver for DSI/DBI panels, once again independent of the bus
  used; the only dependency (currently) being that the panel must
  understand DCS commands.

* A DRM panel driver to test the stack. This driver controls Ilitek
  ILI9341 based DBI panels, like the Adafruit YX240QV29-T 320x240 2.4"
  TFT LCD panel. This panel was converted from
  drivers/gpu/drm/tiny/ili9341.c.

I would like to emphasize that while it has been compile-tested, I did
not test it with real hardware since I do not have any DBI panel
connected over SPI. I did runtime-test the code, just without any panel
connected.

Another thing to note, is that it does not break Device Tree ABI. The
display node stays the same:

display@0 {
compatible = "adafruit,yx240qv29", "ilitek,ili9341";
reg = <0>;
spi-max-frequency = <3200>;
dc-gpios = < 9 GPIO_ACTIVE_HIGH>;
reset-gpios = < 8 GPIO_ACTIVE_HIGH>;
rotation = <270>;
backlight = <>;
};

The reason it works, is that the "adafruit,yx240qv29" device is probed
on the SPI bus, so it will match with the SPI/DBI host driver. This will
in turn register the very same node with the DSI bus, and the ILI9341
DRM panel driver will probe. The driver will detect that no controller
is linked to the panel, and eventually register the DBI/DSI TinyDRM
driver.

I can't stress it enough that this is a RFC, so it still has very rough
edges.

Cheers,
-Paul

Paul Cercueil (4):
  gpu/drm: dsi: Let host and device specify supported bus
  gpu/drm: Add SPI DBI host driver
  gpu/drm: Add TinyDRM for DSI/DBI panels
  gpu/drm: Add Ilitek ILI9341 DBI panel driver

 drivers/gpu/drm/bridge/Kconfig   |   8 +
 drivers/gpu/drm/bridge/Makefile  |   1 +
 drivers/gpu/drm/bridge/dbi-spi.c | 159 +
 drivers/gpu/drm/drm_mipi_dsi.c   |   9 +
 drivers/gpu/drm/panel/Kconfig|   9 +
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 347 +++
 drivers/gpu/drm/tiny/Kconfig |   8 +
 drivers/gpu/drm/tiny/Makefile|   1 +
 drivers/gpu/drm/tiny/tiny-dsi.c  | 262 ++
 include/drm/drm_mipi_dsi.h   |  31 ++
 11 files changed, 836 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/dbi-spi.c
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
 create mode 100644 drivers/gpu/drm/tiny/tiny-dsi.c

-- 
2.26.2

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