All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/4] Linking DRM Connectors to Backlight Devices
@ 2014-09-10 15:54 ` David Herrmann
  0 siblings, 0 replies; 38+ messages in thread
From: David Herrmann @ 2014-09-10 15:54 UTC (permalink / raw)
  To: dri-devel
  Cc: Dave Airlie, Daniel Vetter, Jingoo Han, Bryan Wu, Lee Jones,
	Matthew Garrett, Adam Jackson, linux-kernel, David Herrmann

Hi

This series introduces a link between DRM connectors and backlight-class
devices. It tries to solve some long standing issues:

 * User-space currently has a hard-time figuring out which backlight device to
   use, and which backlight device belongs to which display. So far, most
   systems only provide backlight-devices for internal displays, so figuring out
   the connection is easy, but that might change with more capable external
   connectors.
   If multiple backlights are available, the easiest solution is to simply write
   to all of them and hope at least one of them works. This obviously fails if
   the devices interact badly, so it's not really a solution.

 * User-space needs root privileges to write to sysfs. There are no char-devs
   that can be used to control access-management to the backlight API, so /sys
   is the only interface available. So far, udev policy has been "/sys is
   read-only for non-root" and it's not going to change. char-devs are *THE*
   standard way to provide non-root user-space APIs, so use them!

Several solutions have been discussed so far, but we never agreed on one. I'm
aware of at least the following solutions:

 * Provide char-devs for backlight devices and a sysfs link from connectors to
   backlight devices. This way, user-space can managed access to char-devs *and*
   get proper topology information.
   However, this might be an n:m relationship (n:1 for displays exposed as
   multiple connectors, 1:m for boards with multiple backlights? whatever..) and
   it sounds like a waste of resources to add char-devs just to write brightness
   values.

 * Do everything in privileged user-space. One daemon that provides an
   unprivileged-API and forwards writes to /sys. It reads topology information
   from udev hwdb.
   This circumvents the ugly sysfs API and not really solves the problem. It
   should work, though ugly.

 * Add a DRM connector property that takes brightness values.
   This is the nicest solution for user-space, but introduces a whole lot of
   issues on the kernel side. There already is a backlight-class and we had a
   hard-time trying to move it into DRM drivers, so no-one ever did the work.

This series tries to solve this problem with a much simpler approach:
Instead of moving backlights into DRM, we simply link DRM properties to a
backlight device. That is, the kernel manages a link between a connector and a
backlight device (or n backlight devices) which can be modified by udev in case
the kernel got it wrong (we don't want huge board-fixup-tables in the kernel).
User-space can now use the simpl DRM API to manage backlights, and the kernel
does not need any special driver code to make it work.

Patch #1 and #2 are cleanups and can be applied right away. #3 adds in-kernel
backlight APIs and #4 implements the connector-backlight link.

Comments welcome!
David

David Herrmann (4):
  backlight: use static initializers
  backlight: use spin-lock to protect device list
  backlight: add kernel-internal backlight API
  drm: link connectors to backlight devices

 drivers/gpu/drm/Kconfig             |   1 +
 drivers/gpu/drm/Makefile            |   2 +-
 drivers/gpu/drm/drm_backlight.c     | 387 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_crtc.c          |  45 +++--
 drivers/gpu/drm/drm_drv.c           |  11 +
 drivers/gpu/drm/drm_sysfs.c         |  53 +++++
 drivers/video/backlight/backlight.c |  91 +++++++--
 include/drm/drm_backlight.h         |  44 ++++
 include/drm/drm_crtc.h              |   3 +
 include/linux/backlight.h           |  17 ++
 10 files changed, 622 insertions(+), 32 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_backlight.c
 create mode 100644 include/drm/drm_backlight.h

-- 
2.1.0


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

end of thread, other threads:[~2016-10-24 14:33 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10 15:54 [PATCH RFC 0/4] Linking DRM Connectors to Backlight Devices David Herrmann
2014-09-10 15:54 ` David Herrmann
2014-09-10 15:54 ` [PATCH RFC 1/4] backlight: use static initializers David Herrmann
2014-09-10 15:54   ` David Herrmann
2014-09-11  8:59   ` Jani Nikula
2014-09-11  8:59     ` Jani Nikula
2014-09-10 15:54 ` [PATCH RFC 2/4] backlight: use spin-lock to protect device list David Herrmann
2014-09-10 15:54   ` David Herrmann
2014-09-11  9:00   ` Jani Nikula
2014-09-11  9:00     ` Jani Nikula
2014-09-10 15:54 ` [PATCH RFC 3/4] backlight: add kernel-internal backlight API David Herrmann
2014-09-11 11:10   ` Thierry Reding
2014-09-11 11:10     ` Thierry Reding
2014-09-11 11:14     ` David Herrmann
2014-09-11 11:14       ` David Herrmann
2014-09-11 11:21       ` Thierry Reding
2014-09-11 11:21         ` Thierry Reding
2014-09-10 15:54 ` [PATCH RFC 4/4] drm: link connectors to backlight devices David Herrmann
2014-09-10 15:54   ` David Herrmann
2014-09-11  6:48   ` Daniel Vetter
2014-09-11  6:48     ` Daniel Vetter
2014-09-11 12:22     ` David Herrmann
2014-09-11 13:06       ` Daniel Vetter
2014-09-11 13:06         ` Daniel Vetter
2014-09-11 16:07         ` David Herrmann
2014-09-11 12:46     ` Jani Nikula
2014-09-10 20:40 ` [PATCH RFC 0/4] Linking DRM Connectors to Backlight Devices Matthew Garrett
2014-09-10 20:40   ` Matthew Garrett
2014-09-11 12:48   ` David Herrmann
2014-09-11 12:48     ` David Herrmann
2016-10-24 13:08 ` [PATCH 0/6] Rebase of David Herrmann drm connector link to backlight device Marta Lofstedt
2016-10-24 13:08   ` [PATCH 1/6] backlight: use static initializers Marta Lofstedt
2016-10-24 13:08   ` [PATCH 2/6] backlight: use spin-lock to protect device list Marta Lofstedt
2016-10-24 13:08   ` [PATCH 3/6] backlight: add kernel-internal backlight API Marta Lofstedt
2016-10-24 13:08   ` [PATCH 4/6] drm: link connectors to backlight devices Marta Lofstedt
2016-10-24 13:08   ` [PATCH 5/6] i915: Use drm backlight Marta Lofstedt
2016-10-24 13:08   ` [PATCH 6/6] drm: drm_backlight use the connect value to set brightness property Marta Lofstedt
2016-10-24 14:33   ` [PATCH 0/6] Rebase of David Herrmann drm connector link to backlight device Daniel Vetter

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.