[PATCH 0/5] drm/tinydrm: Add tinydrm_panel abstraction

Noralf Trønnes noralf at tronnes.org
Sat Mar 11 21:35:31 UTC 2017


Add support for displays that have a register interface and can be
operated using a simple vtable.

I have looked through the staging/fbtft drivers and it seems that,
except the MIPI controllers, most if not all controllers are operated
through a register. And since most controllers have more than one bus
interface option, regmap seems like a good choice to describe the
interface (tested[1,2]).
MIPI DCS can't be represented using regmap since some commands doesn't
have a parameter. That would be like a register without a value, which
doesn't make sense.

In my second RFC of tinydrm I used drm_panel to decribe the panels
since it was a good match to the fbtft displays. I was then told that
drm_panel wasn't supposed to used like that, so I dropped it and have
tried to use the drm_simple_display_pipe_funcs vtable directly. This
hasn't been all successful, since I ended up using devm_add_action() to
power down the controller at the right time. Thierry Reding wasn't
happy with this and suggested "to add an explicit callback somewhere".
My solution has been to copy the drm_panel_funcs vtable.
Since I now have a vtable, I also added a callback to flush the
framebuffer. So presumably all the fbtft drivers can now be operated
through the tinydrm_panel_funcs vtable.


After having done this the question arises:
Why not extend tinydrm_device instead of subclassing it?

The benefit of subclassing is that it keeps the door open for drivers
that can use tinydrm_device, but not tinydrm_panel. But I don't know of
such a driver now, then again who knows what the future brings.
Something that might or might not happen isn't a good reason, so it
seems that I want it this way because I just like it. And it's easy to
merge the two should it be that no one uses tinydrm_device directly
three years down the line. But I'm actually not sure what's best.

To recap:

tinydrm_device
- Combines drm_simple_display_pipe with CMA backed framebuffer and fbdev.
- Optional pipe setup with a connector with one mode, but the driver
  can do it's own.

tinydrm_panel
- All drm operations are distilled down to tinydrm_panel_funcs.
- Some common driver properties


Noralf.

[1] https://github.com/notro/tinydrm/blob/master/tinydrm-ili9325.c
[2] https://github.com/notro/tinydrm/blob/master/fb_ili9325.c


Noralf Trønnes (5):
  drm/tinydrm: Add tinydrm_rgb565_buf_copy()
  drm/tinydrm: Add tinydrm_panel abstraction
  drm/tinydrm/mipi-dbi: Start conversion to tinydrm_panel
  drm/tinydrm/mi0283qt: Use tinydrm_panel
  drm/tinydrm/mipi-dbi: Clean up after tinydrm_panel conversion

 Documentation/gpu/tinydrm.rst                  |  12 +
 drivers/gpu/drm/tinydrm/Kconfig                |   1 +
 drivers/gpu/drm/tinydrm/core/Makefile          |   2 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c |  56 ++-
 drivers/gpu/drm/tinydrm/core/tinydrm-panel.c   | 532 +++++++++++++++++++++++++
 drivers/gpu/drm/tinydrm/mi0283qt.c             | 113 ++----
 drivers/gpu/drm/tinydrm/mipi-dbi.c             | 246 ++++--------
 include/drm/tinydrm/mipi-dbi.h                 |  35 +-
 include/drm/tinydrm/tinydrm-helpers.h          |   2 +
 include/drm/tinydrm/tinydrm-panel.h            | 153 +++++++
 10 files changed, 867 insertions(+), 285 deletions(-)
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-panel.c
 create mode 100644 include/drm/tinydrm/tinydrm-panel.h

--
2.10.2



More information about the dri-devel mailing list