All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
	Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Hoegeun Kwon" <hoegeun.kwon@samsung.com>,
	"Inki Dae" <inki.dae@samsung.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Jyri Sarha" <jsarha@ti.com>,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Konrad Dybcio" <konradybcio@gmail.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	linux-renesas-soc@vger.kernel.org,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Manasi Navare" <manasi.d.navare@intel.com>,
	"Neil Armstrong" <narmstrong@baylibre.com>,
	"Patrik Jakobsson" <patrik.r.jakobsson@gmail.com>,
	"Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>,
	"Philippe CORNU" <philippe.cornu@st.com>,
	"Rob Clark" <robdclark@gmail.com>,
	"Robert Chiras" <robert.chiras@nxp.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Sebastian Reichel" <sebastian.reichel@collabora.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Vinay Simha BN" <simhavcs@gmail.com>,
	"Wambui Karuga" <wambui.karugax@gmail.com>,
	"Zheng Bin" <zhengbin13@huawei.com>
Subject: [PATCH v2 0/24] backlight: add init macros and accessors
Date: Sun, 23 Aug 2020 12:45:08 +0200	[thread overview]
Message-ID: <20200823104532.1024798-1-sam@ravnborg.org> (raw)

The first patch trims backlight_update_status() so it can be called with a NULL
backlight_device. Then the caller do not need to add this check just to avoid
a NULL reference.

The backlight drivers uses several different patterns when registering
a backlight:

- Register backlight and assign properties later
- Define a local backlight_properties variable and use memset
- Define a const backlight_properties and assign relevant properties

On top of this there was differences in what members was assigned.

To align how backlight drivers are initialized introduce following helper macros:
- DECLARE_BACKLIGHT_INIT_FIRMWARE()
- DECLARE_BACKLIGHT_INIT_PLATFORM()
- DECLARE_BACKLIGHT_INIT_RAW()

The macros are introduced in patch 2.

The backlight drivers used direct access to backlight_properties.
Encapsulate these in get/set access operations resulting in following benefits:
- The access methods can be called with a NULL pointer so logic around the
  access can be made simpler.
- The update_brightness and enable_brightness simplifies the users
- The code is in most cases more readable with the access operations.
- When everyone uses the access methods refactoring in the backlight core is simpler.

The get/set operations are introduced in patch 3.

The gpio backlight driver received a small overhaul in a set of three patches.
The result is a smaller and more readable driver.

The remaining patches updates all backlight users in drivers/gpu/drm/*
With this patch set all of drivers/gpu/drm/:
- All backlight references to FB_BLANK* are gone from drm/*
- All direct references to backlight properties are gone
- All panel drivers uses the devm_ variant for registering backlight
  Daniel Vetter had some concerns with this for future updates,
  but we are aligned now and can update if refoctoring demands it
- All panel drivers uses the backlight support in drm_panel

Individual patches are only sent to the people listed in the patch + a few more.
Please check https://lore.kernel.org/dri-devel/ for the full series.

v2:
  - Documented BACKLIGHT_PROPS as it may be used by drivers
  - Dropped backlight_set_power_{on,off}, they were a mistake (Daniel)
  - Added backlight_update_brightness() and use it (Daniel)
  - Added backlight_enable_brightness() and use it
  - Moved remaining drm_panel driver to use backlight support in drm_panel
  - gpio backlight driver overhaul

The patches are made on top of the for-backlight-next branch at
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
The branch needs v5.8-rc1 backported to build as dev_err_probe()
is used.

The first 6 patches are candidates for the backlight tree.
If they are applied then this should preferably be to an immutable
branch we can merge to drm-misc-next where the drm patches shall go.

The drm patches has known conflics and shall *not* be applied to the
backlight tree, they are included in this patchset to show how the
new functions are used.

Diffstat for the drm bits alone looks nice:
 25 files changed, 243 insertions(+), 460 deletions(-)

Feedback welcome!

	Sam

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Konrad Dybcio <konradybcio@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-renesas-soc@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Cc: Philippe CORNU <philippe.cornu@st.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Vinay Simha BN <simhavcs@gmail.com>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Zheng Bin <zhengbin13@huawei.com>

Sam Ravnborg (24):
      backlight: Silently fail backlight_update_status() if no device
      backlight: Add DECLARE_* macro for device registration
      backlight: Add get/set operations for brightness properties
      backlight: gpio: Introduce backlight_{enable,disable}
      backlight: gpio: Use dev_err_probe()
      backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW
      drm/gma500: Backlight update
      drm/panel: asus-z00t-tm5p5-n35596: Backlight update
      drm/panel: jdi-lt070me05000: Backlight update
      drm/panel: novatek-nt35510: Backlight update
      drm/panel: orisetech-otm8009a: Backlight update
      drm/panel: raydium-rm67191: Backlight update
      drm/panel: samsung-s6e63m0: Backlight update
      drm/panel: samsung-s6e63j0x03: Backlight update
      drm/panel: samsung-s6e3ha2: Backlight update
      drm/panel: sony-acx424akp: Backlight update
      drm/panel: sony-acx565akm: Backlight update
      drm/bridge: parade-ps8622: Backlight update
      drm/tilcdc: Backlight update
      drm/radeon: Backlight update
      drm/amdgpu/atom: Backlight update
      drm/i915: Backlight update
      drm/omap: display: Backlight update
      drm/shmobile: Backlight update

 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c     |  19 +--
 drivers/gpu/drm/bridge/parade-ps8622.c             |  43 ++++---
 drivers/gpu/drm/gma500/backlight.c                 |  34 +----
 drivers/gpu/drm/gma500/cdv_device.c                |  24 ++--
 drivers/gpu/drm/gma500/mdfld_device.c              |   9 +-
 drivers/gpu/drm/gma500/oaktrail_device.c           |  10 +-
 drivers/gpu/drm/gma500/opregion.c                  |   2 +-
 drivers/gpu/drm/gma500/psb_device.c                |  10 +-
 drivers/gpu/drm/gma500/psb_drv.c                   |   7 +-
 drivers/gpu/drm/i915/display/intel_panel.c         |  88 ++++++-------
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c    |  37 +-----
 .../gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c   |  15 +--
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     |  54 ++------
 drivers/gpu/drm/panel/panel-novatek-nt35510.c      |   9 +-
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   |  14 +--
 drivers/gpu/drm/panel/panel-raydium-rm67191.c      |  11 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      |  70 +++++------
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   |  53 ++++----
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c      |  25 ++--
 drivers/gpu/drm/panel/panel-sony-acx424akp.c       |  49 ++------
 drivers/gpu/drm/panel/panel-sony-acx565akm.c       |  47 +++----
 drivers/gpu/drm/radeon/atombios_encoders.c         |  24 ++--
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c    |  16 +--
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c     |  20 ++-
 drivers/gpu/drm/tilcdc/tilcdc_panel.c              |   9 +-
 drivers/video/backlight/gpio_backlight.c           |  41 +++---
 include/linux/backlight.h                          | 140 +++++++++++++++++++++
 27 files changed, 400 insertions(+), 480 deletions(-)



WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
	Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>
Cc: "Neil Armstrong" <narmstrong@baylibre.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Sebastian Reichel" <sebastian.reichel@collabora.com>,
	"Manasi Navare" <manasi.d.navare@intel.com>,
	"Konrad Dybcio" <konradybcio@gmail.com>,
	amd-gfx@lists.freedesktop.org,
	"Zheng Bin" <zhengbin13@huawei.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
	"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
	"Robert Chiras" <robert.chiras@nxp.com>,
	"Vinay Simha BN" <simhavcs@gmail.com>,
	"Hoegeun Kwon" <hoegeun.kwon@samsung.com>,
	"Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Jyri Sarha" <jsarha@ti.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Philippe CORNU" <philippe.cornu@st.com>,
	linux-renesas-soc@vger.kernel.org,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Wambui Karuga" <wambui.karugax@gmail.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH v2 0/24] backlight: add init macros and accessors
Date: Sun, 23 Aug 2020 12:45:08 +0200	[thread overview]
Message-ID: <20200823104532.1024798-1-sam@ravnborg.org> (raw)

The first patch trims backlight_update_status() so it can be called with a NULL
backlight_device. Then the caller do not need to add this check just to avoid
a NULL reference.

The backlight drivers uses several different patterns when registering
a backlight:

- Register backlight and assign properties later
- Define a local backlight_properties variable and use memset
- Define a const backlight_properties and assign relevant properties

On top of this there was differences in what members was assigned.

To align how backlight drivers are initialized introduce following helper macros:
- DECLARE_BACKLIGHT_INIT_FIRMWARE()
- DECLARE_BACKLIGHT_INIT_PLATFORM()
- DECLARE_BACKLIGHT_INIT_RAW()

The macros are introduced in patch 2.

The backlight drivers used direct access to backlight_properties.
Encapsulate these in get/set access operations resulting in following benefits:
- The access methods can be called with a NULL pointer so logic around the
  access can be made simpler.
- The update_brightness and enable_brightness simplifies the users
- The code is in most cases more readable with the access operations.
- When everyone uses the access methods refactoring in the backlight core is simpler.

The get/set operations are introduced in patch 3.

The gpio backlight driver received a small overhaul in a set of three patches.
The result is a smaller and more readable driver.

The remaining patches updates all backlight users in drivers/gpu/drm/*
With this patch set all of drivers/gpu/drm/:
- All backlight references to FB_BLANK* are gone from drm/*
- All direct references to backlight properties are gone
- All panel drivers uses the devm_ variant for registering backlight
  Daniel Vetter had some concerns with this for future updates,
  but we are aligned now and can update if refoctoring demands it
- All panel drivers uses the backlight support in drm_panel

Individual patches are only sent to the people listed in the patch + a few more.
Please check https://lore.kernel.org/dri-devel/ for the full series.

v2:
  - Documented BACKLIGHT_PROPS as it may be used by drivers
  - Dropped backlight_set_power_{on,off}, they were a mistake (Daniel)
  - Added backlight_update_brightness() and use it (Daniel)
  - Added backlight_enable_brightness() and use it
  - Moved remaining drm_panel driver to use backlight support in drm_panel
  - gpio backlight driver overhaul

The patches are made on top of the for-backlight-next branch at
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
The branch needs v5.8-rc1 backported to build as dev_err_probe()
is used.

The first 6 patches are candidates for the backlight tree.
If they are applied then this should preferably be to an immutable
branch we can merge to drm-misc-next where the drm patches shall go.

The drm patches has known conflics and shall *not* be applied to the
backlight tree, they are included in this patchset to show how the
new functions are used.

Diffstat for the drm bits alone looks nice:
 25 files changed, 243 insertions(+), 460 deletions(-)

Feedback welcome!

	Sam

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Konrad Dybcio <konradybcio@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-renesas-soc@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Cc: Philippe CORNU <philippe.cornu@st.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Vinay Simha BN <simhavcs@gmail.com>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Zheng Bin <zhengbin13@huawei.com>

Sam Ravnborg (24):
      backlight: Silently fail backlight_update_status() if no device
      backlight: Add DECLARE_* macro for device registration
      backlight: Add get/set operations for brightness properties
      backlight: gpio: Introduce backlight_{enable,disable}
      backlight: gpio: Use dev_err_probe()
      backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW
      drm/gma500: Backlight update
      drm/panel: asus-z00t-tm5p5-n35596: Backlight update
      drm/panel: jdi-lt070me05000: Backlight update
      drm/panel: novatek-nt35510: Backlight update
      drm/panel: orisetech-otm8009a: Backlight update
      drm/panel: raydium-rm67191: Backlight update
      drm/panel: samsung-s6e63m0: Backlight update
      drm/panel: samsung-s6e63j0x03: Backlight update
      drm/panel: samsung-s6e3ha2: Backlight update
      drm/panel: sony-acx424akp: Backlight update
      drm/panel: sony-acx565akm: Backlight update
      drm/bridge: parade-ps8622: Backlight update
      drm/tilcdc: Backlight update
      drm/radeon: Backlight update
      drm/amdgpu/atom: Backlight update
      drm/i915: Backlight update
      drm/omap: display: Backlight update
      drm/shmobile: Backlight update

 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c     |  19 +--
 drivers/gpu/drm/bridge/parade-ps8622.c             |  43 ++++---
 drivers/gpu/drm/gma500/backlight.c                 |  34 +----
 drivers/gpu/drm/gma500/cdv_device.c                |  24 ++--
 drivers/gpu/drm/gma500/mdfld_device.c              |   9 +-
 drivers/gpu/drm/gma500/oaktrail_device.c           |  10 +-
 drivers/gpu/drm/gma500/opregion.c                  |   2 +-
 drivers/gpu/drm/gma500/psb_device.c                |  10 +-
 drivers/gpu/drm/gma500/psb_drv.c                   |   7 +-
 drivers/gpu/drm/i915/display/intel_panel.c         |  88 ++++++-------
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c    |  37 +-----
 .../gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c   |  15 +--
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     |  54 ++------
 drivers/gpu/drm/panel/panel-novatek-nt35510.c      |   9 +-
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   |  14 +--
 drivers/gpu/drm/panel/panel-raydium-rm67191.c      |  11 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      |  70 +++++------
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   |  53 ++++----
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c      |  25 ++--
 drivers/gpu/drm/panel/panel-sony-acx424akp.c       |  49 ++------
 drivers/gpu/drm/panel/panel-sony-acx565akm.c       |  47 +++----
 drivers/gpu/drm/radeon/atombios_encoders.c         |  24 ++--
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c    |  16 +--
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c     |  20 ++-
 drivers/gpu/drm/tilcdc/tilcdc_panel.c              |   9 +-
 drivers/video/backlight/gpio_backlight.c           |  41 +++---
 include/linux/backlight.h                          | 140 +++++++++++++++++++++
 27 files changed, 400 insertions(+), 480 deletions(-)


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

WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
	Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	Daniel Thompson <daniel.thompson@linaro.org>
Cc: "Neil Armstrong" <narmstrong@baylibre.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Sebastian Reichel" <sebastian.reichel@collabora.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Manasi Navare" <manasi.d.navare@intel.com>,
	"Konrad Dybcio" <konradybcio@gmail.com>,
	amd-gfx@lists.freedesktop.org,
	"Zheng Bin" <zhengbin13@huawei.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ti.com>,
	"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
	"Robert Chiras" <robert.chiras@nxp.com>,
	"Vinay Simha BN" <simhavcs@gmail.com>,
	"Hoegeun Kwon" <hoegeun.kwon@samsung.com>,
	"Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Inki Dae" <inki.dae@samsung.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Jyri Sarha" <jsarha@ti.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Jernej Skrabec" <jernej.skrabec@siol.net>,
	"Philippe CORNU" <philippe.cornu@st.com>,
	"Patrik Jakobsson" <patrik.r.jakobsson@gmail.com>,
	linux-renesas-soc@vger.kernel.org,
	"Rob Clark" <robdclark@gmail.com>,
	"Kieran Bingham" <kieran.bingham+renesas@ideasonboard.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Wambui Karuga" <wambui.karugax@gmail.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH v2 0/24] backlight: add init macros and accessors
Date: Sun, 23 Aug 2020 12:45:08 +0200	[thread overview]
Message-ID: <20200823104532.1024798-1-sam@ravnborg.org> (raw)

The first patch trims backlight_update_status() so it can be called with a NULL
backlight_device. Then the caller do not need to add this check just to avoid
a NULL reference.

The backlight drivers uses several different patterns when registering
a backlight:

- Register backlight and assign properties later
- Define a local backlight_properties variable and use memset
- Define a const backlight_properties and assign relevant properties

On top of this there was differences in what members was assigned.

To align how backlight drivers are initialized introduce following helper macros:
- DECLARE_BACKLIGHT_INIT_FIRMWARE()
- DECLARE_BACKLIGHT_INIT_PLATFORM()
- DECLARE_BACKLIGHT_INIT_RAW()

The macros are introduced in patch 2.

The backlight drivers used direct access to backlight_properties.
Encapsulate these in get/set access operations resulting in following benefits:
- The access methods can be called with a NULL pointer so logic around the
  access can be made simpler.
- The update_brightness and enable_brightness simplifies the users
- The code is in most cases more readable with the access operations.
- When everyone uses the access methods refactoring in the backlight core is simpler.

The get/set operations are introduced in patch 3.

The gpio backlight driver received a small overhaul in a set of three patches.
The result is a smaller and more readable driver.

The remaining patches updates all backlight users in drivers/gpu/drm/*
With this patch set all of drivers/gpu/drm/:
- All backlight references to FB_BLANK* are gone from drm/*
- All direct references to backlight properties are gone
- All panel drivers uses the devm_ variant for registering backlight
  Daniel Vetter had some concerns with this for future updates,
  but we are aligned now and can update if refoctoring demands it
- All panel drivers uses the backlight support in drm_panel

Individual patches are only sent to the people listed in the patch + a few more.
Please check https://lore.kernel.org/dri-devel/ for the full series.

v2:
  - Documented BACKLIGHT_PROPS as it may be used by drivers
  - Dropped backlight_set_power_{on,off}, they were a mistake (Daniel)
  - Added backlight_update_brightness() and use it (Daniel)
  - Added backlight_enable_brightness() and use it
  - Moved remaining drm_panel driver to use backlight support in drm_panel
  - gpio backlight driver overhaul

The patches are made on top of the for-backlight-next branch at
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
The branch needs v5.8-rc1 backported to build as dev_err_probe()
is used.

The first 6 patches are candidates for the backlight tree.
If they are applied then this should preferably be to an immutable
branch we can merge to drm-misc-next where the drm patches shall go.

The drm patches has known conflics and shall *not* be applied to the
backlight tree, they are included in this patchset to show how the
new functions are used.

Diffstat for the drm bits alone looks nice:
 25 files changed, 243 insertions(+), 460 deletions(-)

Feedback welcome!

	Sam

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Jyri Sarha <jsarha@ti.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: Konrad Dybcio <konradybcio@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-renesas-soc@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Cc: Philippe CORNU <philippe.cornu@st.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Robert Chiras <robert.chiras@nxp.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Vinay Simha BN <simhavcs@gmail.com>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Zheng Bin <zhengbin13@huawei.com>

Sam Ravnborg (24):
      backlight: Silently fail backlight_update_status() if no device
      backlight: Add DECLARE_* macro for device registration
      backlight: Add get/set operations for brightness properties
      backlight: gpio: Introduce backlight_{enable,disable}
      backlight: gpio: Use dev_err_probe()
      backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW
      drm/gma500: Backlight update
      drm/panel: asus-z00t-tm5p5-n35596: Backlight update
      drm/panel: jdi-lt070me05000: Backlight update
      drm/panel: novatek-nt35510: Backlight update
      drm/panel: orisetech-otm8009a: Backlight update
      drm/panel: raydium-rm67191: Backlight update
      drm/panel: samsung-s6e63m0: Backlight update
      drm/panel: samsung-s6e63j0x03: Backlight update
      drm/panel: samsung-s6e3ha2: Backlight update
      drm/panel: sony-acx424akp: Backlight update
      drm/panel: sony-acx565akm: Backlight update
      drm/bridge: parade-ps8622: Backlight update
      drm/tilcdc: Backlight update
      drm/radeon: Backlight update
      drm/amdgpu/atom: Backlight update
      drm/i915: Backlight update
      drm/omap: display: Backlight update
      drm/shmobile: Backlight update

 drivers/gpu/drm/amd/amdgpu/atombios_encoders.c     |  19 +--
 drivers/gpu/drm/bridge/parade-ps8622.c             |  43 ++++---
 drivers/gpu/drm/gma500/backlight.c                 |  34 +----
 drivers/gpu/drm/gma500/cdv_device.c                |  24 ++--
 drivers/gpu/drm/gma500/mdfld_device.c              |   9 +-
 drivers/gpu/drm/gma500/oaktrail_device.c           |  10 +-
 drivers/gpu/drm/gma500/opregion.c                  |   2 +-
 drivers/gpu/drm/gma500/psb_device.c                |  10 +-
 drivers/gpu/drm/gma500/psb_drv.c                   |   7 +-
 drivers/gpu/drm/i915/display/intel_panel.c         |  88 ++++++-------
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c    |  37 +-----
 .../gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c   |  15 +--
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c     |  54 ++------
 drivers/gpu/drm/panel/panel-novatek-nt35510.c      |   9 +-
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   |  14 +--
 drivers/gpu/drm/panel/panel-raydium-rm67191.c      |  11 +-
 drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c      |  70 +++++------
 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c   |  53 ++++----
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c      |  25 ++--
 drivers/gpu/drm/panel/panel-sony-acx424akp.c       |  49 ++------
 drivers/gpu/drm/panel/panel-sony-acx565akm.c       |  47 +++----
 drivers/gpu/drm/radeon/atombios_encoders.c         |  24 ++--
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c    |  16 +--
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c     |  20 ++-
 drivers/gpu/drm/tilcdc/tilcdc_panel.c              |   9 +-
 drivers/video/backlight/gpio_backlight.c           |  41 +++---
 include/linux/backlight.h                          | 140 +++++++++++++++++++++
 27 files changed, 400 insertions(+), 480 deletions(-)


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2020-08-23 10:45 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23 10:45 Sam Ravnborg [this message]
2020-08-23 10:45 ` [PATCH v2 0/24] backlight: add init macros and accessors Sam Ravnborg
2020-08-23 10:45 ` Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 01/24] backlight: Silently fail backlight_update_status() if no device Sam Ravnborg
2020-09-02 10:50   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 02/24] backlight: Add DECLARE_* macro for device registration Sam Ravnborg
2020-09-02 11:06   ` Daniel Thompson
2020-09-02 11:06     ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 03/24] backlight: Add get/set operations for brightness properties Sam Ravnborg
2020-09-02 11:30   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 04/24] backlight: gpio: Introduce backlight_{enable, disable} Sam Ravnborg
2020-09-02 11:11   ` [PATCH v2 04/24] backlight: gpio: Introduce backlight_{enable,disable} Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 05/24] backlight: gpio: Use dev_err_probe() Sam Ravnborg
2020-09-02 11:17   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 06/24] backlight: gpio: Use DECLARE_BACKLIGHT_INIT_RAW Sam Ravnborg
2020-09-02 11:21   ` Daniel Thompson
2020-08-23 10:45 ` [PATCH v2 07/24] drm/gma500: Backlight update Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 08/24] drm/panel: asus-z00t-tm5p5-n35596: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 09/24] drm/panel: jdi-lt070me05000: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 10/24] drm/panel: novatek-nt35510: " Sam Ravnborg
2020-08-27 22:33   ` Linus Walleij
2020-08-23 10:45 ` [PATCH v2 11/24] drm/panel: orisetech-otm8009a: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 12/24] drm/panel: raydium-rm67191: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 13/24] drm/panel: samsung-s6e63m0: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 14/24] drm/panel: samsung-s6e63j0x03: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 15/24] drm/panel: samsung-s6e3ha2: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 16/24] drm/panel: sony-acx424akp: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 17/24] drm/panel: sony-acx565akm: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 18/24] drm/bridge: parade-ps8622: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 19/24] drm/tilcdc: " Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 20/24] drm/radeon: " Sam Ravnborg
2020-08-23 10:45   ` Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 21/24] drm/amdgpu/atom: " Sam Ravnborg
2020-08-23 10:45   ` Sam Ravnborg
2020-08-23 10:45 ` [PATCH v2 22/24] drm/i915: " Sam Ravnborg
2020-09-02 12:56   ` Jani Nikula
2020-09-14  7:53   ` [drm/i915] 37bedbd445: suspend-stress.fail kernel test robot
2020-09-14  7:53     ` kernel test robot
2020-09-14  7:53     ` kernel test robot
2020-09-14  8:25     ` Jani Nikula
2020-09-14  8:25       ` Jani Nikula
2020-09-14  8:25       ` Jani Nikula
2020-08-23 10:45 ` [PATCH v2 23/24] drm/omap: display: Backlight update Sam Ravnborg
2020-08-28 11:55   ` Sebastian Reichel
2020-08-23 10:45 ` [PATCH v2 24/24] drm/shmobile: " Sam Ravnborg
2020-08-23 10:45   ` Sam Ravnborg
2020-08-28  9:40 ` [PATCH v2 0/24] backlight: add init macros and accessors Linus Walleij
2020-08-28  9:40   ` Linus Walleij
2020-08-28  9:40   ` Linus Walleij
2020-09-02 11:29   ` Daniel Thompson
2020-09-02 11:29     ` Daniel Thompson
2020-09-02 11:29     ` Daniel Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200823104532.1024798-1-sam@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=a.hajda@samsung.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=christian.koenig@amd.com \
    --cc=daniel.thompson@linaro.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=hdegoede@redhat.com \
    --cc=hoegeun.kwon@samsung.com \
    --cc=inki.dae@samsung.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jingoohan1@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=jsarha@ti.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=konradybcio@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=manasi.d.navare@intel.com \
    --cc=narmstrong@baylibre.com \
    --cc=patrik.r.jakobsson@gmail.com \
    --cc=pawel.mikolaj.chmiel@gmail.com \
    --cc=philippe.cornu@st.com \
    --cc=robdclark@gmail.com \
    --cc=robert.chiras@nxp.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=simhavcs@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=tomi.valkeinen@ti.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=wambui.karugax@gmail.com \
    --cc=zhengbin13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.