Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tinydrm backport #2119

Merged
merged 14 commits into from
Jul 22, 2017
Merged

tinydrm backport #2119

merged 14 commits into from
Jul 22, 2017

Conversation

notro
Copy link
Contributor

@notro notro commented Jul 16, 2017

This is a backport of drivers/gpu/tinydrm which was added in 4.11, a couple of patches from 4.12 and a driver from (to be) 4.14.

tinydrm is the future of drivers/staging/fbtft. fbtft can't move out of staging since fbdev is closed for new drivers.

This PR has 2 drivers:

mi0283qt

Works with rpi-display by Watterott and pitft28 by Adafruit.
This driver provides one main benefit over fbtft and that is PRIME support which makes it possible to do rendering on vc4 and scanout on these SPI connected displays. However, I haven't been able to make it work with real life applications yet (X windows): vc4 issue #10. The driver might also perform better depending on use case.

Here are overlays if someone wants to try:

repaper

Works with PaPiRus ePaper Screens by Pi Supply. fbtft doesn't support these and this the main motivation for doing this backport.

DRM core patches

During rebasing I've tried to avoid touching core drm files to keep this as contained as possible.
I was left with 2 patches:

drm: debugfs: Remove all files automatically on cleanup
For vc4 this patch doesn't change anything.

drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out to drivers
I have stripped this down to just adding the macro, not touching drivers.

I get this warning that I don't know how to get rid of:

  DTCO    arch/arm/boot/dts/overlays/papirus.dtbo
Warning (model_is_string): "model" property in /__overrides__ is not a string

notro and others added 13 commits July 15, 2017 14:02
Instead of having the drivers call drm_debugfs_remove_files() in
their drm_driver->debugfs_cleanup hook, do it automatically by
traversing minor->debugfs_list.
Also use debugfs_remove_recursive() so drivers who add their own
debugfs files don't have to keep track of them for removal.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-2-noralf@tronnes.org
[rebased on 4.9]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
tinydrm provides helpers for very simple displays that can use
CMA backed framebuffers and need flushing on changes.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
[rebased on 4.9]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add common functionality needed by many tinydrm drivers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
[rebased on 4.9]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add support for MIPI DBI compatible controllers.
Interface type C option 1 and 3 are supported (SPI).

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Thierry Reding <treding@nvidia.com>
[rebased on 4.9]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add driver to support the Multi-Inno MI0283QT display panel.
It has an ILI9341 MIPI DBI compatible display controller.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Fix this warning:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:
drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = mipi_dbi_command_buf(mipi, cmd, parameters, i);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cmd can't be used uninitialized, but to satisfy the compiler,
initialize it to zero.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This warning is seen on 64-bit builds in functions:
   'mipi_dbi_typec1_command':
   'mipi_dbi_typec3_command_read':
   'mipi_dbi_typec3_command':

>> drivers/gpu/drm/tinydrm/mipi-dbi.c:65:20: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
      DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, len, data); \
                       ^
   include/drm/drmP.h:228:40: note: in definition of macro 'DRM_DEBUG_DRIVER'
     drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
                                           ^~~
>> drivers/gpu/drm/tinydrm/mipi-dbi.c:671:2: note: in expansion of macro 'MIPI_DBI_DEBUG_COMMAND'
     MIPI_DBI_DEBUG_COMMAND(cmd, parameters, num);
     ^~~~~~~~~~~~~~~~~~~~~~

Fix by casting 'len' to int in the macro MIPI_DBI_DEBUG_COMMAND().
There is no chance of overflow.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
BACKLIGHT_CLASS_DEVICE was selected in the last version of the
tinydrm patchset to fix the backlight dependency, but the
ifdef CONFIG_BACKLIGHT_CLASS_DEVICE was forgotten. Fix that.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Less code ftw.

This converts all drivers except the tinydrm helper module. That one
needs more work, since it gets the THIS_MODULE reference from
tinydrm.ko instead of the actual driver module like it should.
Probably needs a similar trick like I used here with generating the
entire struct with a macro.

Cc: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
[rebased on 4.9, only macro no driver changes]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
drm_driver.fops can't be shared since the owner then becomes tinydrm.ko.
Move the fops declaration to the driver.

v2: Use DEFINE_DRM_GEM_CMA_FOPS

Reported-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170326142529.16938-1-noralf@tronnes.org
Drm has no monochrome or greyscale support so add a conversion
from the common format XR24.

Also reorder includes into the common order.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
[rebase on 4.9]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
This adds support for the Pervasive Displays RePaper branded displays.
The controller code is taken from the userspace driver available
through repaper.org. Only the V231 film is supported since the others
are EOL.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
[rebase on 4.9]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Enable tinydrm library, mi0283qt and repaper drivers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Copy link
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the two minor points it looks OK, i.e. it compiles, and anyway it's basically a module so how bad could it be?

@@ -1001,6 +1001,17 @@ Params: speed Display SPI bus speed
xohms Touchpanel sensitivity (X-plate resistance)


Name: papirus
Info: PaPiRus ePaper Screen by Pi Supply (both HAT and pHAT)
Load: dtoverlay=papirus,model=<val>
Copy link
Contributor

@pelwell pelwell Jul 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Can you make this say <param>=<val> to match the others?

};

__overrides__ {
model = <&repaper>, "compatible";
Copy link
Contributor

@pelwell pelwell Jul 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you find a different name for this parameter - panel, perhaps? model is a standard property name and dtc warns about the declaration because it isn't just a string (it starts with a symbol reference).

Add Device Tree overlay for the PaPiRus ePaper Screens by Pi Supply.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
@notro notro force-pushed the tinydrm-49-backport branch from 4ca6f47 to adb9a23 Compare July 22, 2017 11:56
@notro
Copy link
Contributor Author

notro commented Jul 22, 2017

I've adressed your comments and now the warning went away.

@pelwell
Copy link
Contributor

pelwell commented Jul 22, 2017

Thanks - I'm happy now. @popcornmix ?

@popcornmix popcornmix merged commit f4a6fb4 into raspberrypi:rpi-4.9.y Jul 22, 2017
@popcornmix
Copy link
Collaborator

Yes, it looks like a useful PR - thanks!

popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 22, 2017
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 22, 2017
@popcornmix
Copy link
Collaborator

rpi-update now includes this if anyone wants to try it.

@notro
Copy link
Contributor Author

notro commented Jul 22, 2017

Thank you, rpi-update worked fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants