Skip to contentSkip to conversation

drm/i915/backlight: switch to unique backlight device names

RFC In review Jani Nikula 3 participants 6 messages Apr 7, 2021 – Apr 28, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 drm/i915/backlight: switch to unique backlight device names

Change the backlight device names from intel_backlight to card%d-%s-backlight format, for example card0-eDP-1-backlight, to make them unique. Otherwise, registering multiple backlight devices with intel_backlight name will fail, regardless of whether they're two connectors in the same device or two different devices.

---

Is the name "intel_backlight" part of the UABI? In theory the userspace should only look at the names and types available under /sys/class/backlight, not the exact names.

---
 drivers/gpu/drm/i915/display/intel_panel.c | 29 ++++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_panel.c +18 -11
index 10022d1575e1..5ebf8cb0e8e3 100644
@@ -1372,6 +1372,8 @@ int intel_backlight_device_register(struct intel_connector *connector)
 	struct drm_i915_private *i915 = to_i915(connector->base.dev);
 	struct intel_panel *panel = &connector->panel;
 	struct backlight_properties props;
+	const char *name;
+	int ret = 0;
 
 	if (WARN_ON(panel->backlight.device))
 		return -ENODEV;
@@ -1398,28 +1400,33 @@ int intel_backlight_device_register(struct intel_connector *connector)
 	else
 		props.power = FB_BLANK_POWERDOWN;
 
-	/*
-	 * Note: using the same name independent of the connector prevents
-	 * registration of multiple backlight devices in the driver.
-	 */
+	name = kasprintf(GFP_KERNEL, "card%d-%s-backlight", i915->drm.primary->index,
+			 connector->base.name);
+	if (!name)
+		return -ENOMEM;
+
 	panel->backlight.device =
-		backlight_device_register("intel_backlight",
+		backlight_device_register(name,
 					  connector->base.kdev,
 					  connector,
 					  &intel_backlight_device_ops, &props);
 
 	if (IS_ERR(panel->backlight.device)) {
-		drm_err(&i915->drm, "Failed to register backlight: %ld\n",
-			PTR_ERR(panel->backlight.device));
+		drm_err(&i915->drm, "Failed to register backlight %s: %ld\n",
+			name, PTR_ERR(panel->backlight.device));
 		panel->backlight.device = NULL;
-		return -ENODEV;
+		ret = -ENODEV;
+		goto out;
 	}
 
 	drm_dbg_kms(&i915->drm,
-		    "Connector %s backlight sysfs interface registered\n",
-		    connector->base.name);
+		    "Connector %s backlight sysfs interface %s registered\n",
+		    name, connector->base.name);
 
-	return 0;
+out:
+	kfree(name);
+
+	return ret;
 }
 
 void intel_backlight_device_unregister(struct intel_connector *connector)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/backlight: switch to unique backlight device names

== Series Details ==

== Series Details ==

Series: drm/i915/backlight: switch to unique backlight device names
URL : https://patchwork.freedesktop.org/series/88798/
State : warning

== Summary ==

$ make htmldocs 2>&1 > /dev/null | grep i915
./drivers/gpu/drm/i915/gem/i915_gem_shrinker.c:102: warning: Function parameter or member 'ww' not described in 'i915_gem_shrink'
./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Excess function parameter 'trampoline' description in 'intel_engine_cmd_parser'
./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Function parameter or member 'jump_whitelist' not described in 'intel_engine_cmd_parser'
./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Function parameter or member 'shadow_map' not described in 'intel_engine_cmd_parser'
./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Function parameter or member 'batch_map' not described in 'intel_engine_cmd_parser'
./drivers/gpu/drm/i915/i915_cmd_parser.c:1420: warning: Excess function parameter 'trampoline' description in 'intel_engine_cmd_parser'

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/backlight: switch to unique backlight device names

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/i915/backlight: switch to unique backlight device names
URL : https://patchwork.freedesktop.org/series/88798/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9931 -> Patchwork_19897
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_19897 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_19897, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_19897:

### IGT changes ###

#### Possible regressions ####

* igt@i915_pm_backlight@basic-brightness:
- fi-icl-u2: [PASS][1] -> [SKIP][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-icl-u2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-icl-u2/igt@[email protected]
- fi-cml-u2: [PASS][3] -> [SKIP][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-cml-u2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-cml-u2/igt@[email protected]
- fi-icl-y: [PASS][5] -> [SKIP][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-icl-y/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-icl-y/igt@[email protected]
- fi-tgl-y: [PASS][7] -> [SKIP][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-y/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-y/igt@[email protected]
- fi-cml-s: [PASS][9] -> [SKIP][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-cml-s/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-cml-s/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_pm_backlight@basic-brightness:
- {fi-ehl-1}: [PASS][11] -> [SKIP][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-ehl-1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-ehl-1/igt@[email protected]
- {fi-tgl-dsi}: [PASS][13] -> [SKIP][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-dsi/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-dsi/igt@[email protected]
- {fi-ehl-2}: [PASS][15] -> [SKIP][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-ehl-2/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-ehl-2/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_19897 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@fbdev@read:
- fi-tgl-y: [PASS][17] -> [DMESG-WARN][18] ([i915#402]) +2 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-y/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-y/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- fi-skl-6600u: [PASS][19] -> [SKIP][20] ([fdo#109271])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-skl-6600u/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-skl-6600u/igt@[email protected]
- fi-snb-2520m: [PASS][21] -> [SKIP][22] ([fdo#109271])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-snb-2520m/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-snb-2520m/igt@[email protected]
- fi-bxt-dsi: [PASS][23] -> [SKIP][24] ([fdo#109271])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-bxt-dsi/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-bxt-dsi/igt@[email protected]
- fi-kbl-r: [PASS][25] -> [SKIP][26] ([fdo#109271])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-kbl-r/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-kbl-r/igt@[email protected]
- fi-bsw-kefka: [PASS][27] -> [SKIP][28] ([fdo#109271])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-bsw-kefka/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-bsw-kefka/igt@[email protected]
- fi-glk-dsi: [PASS][29] -> [SKIP][30] ([fdo#109271])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-glk-dsi/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-glk-dsi/igt@[email protected]
- fi-kbl-soraka: [PASS][31] -> [SKIP][32] ([fdo#109271])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-kbl-soraka/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-kbl-soraka/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-snb-2600: [PASS][33] -> [INCOMPLETE][34] ([i915#2782])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-snb-2600/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-snb-2600/igt@i915_selftest@[email protected]

#### Possible fixes ####

* igt@prime_vgem@basic-gtt:
- fi-tgl-y: [DMESG-WARN][35] ([i915#402]) -> [PASS][36] +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-y/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-y/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402

Participating hosts (43 -> 40)
------------------------------

Missing (3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_9931 -> Patchwork_19897

CI-20190529: 20190529
CI_DRM_9931: 88d3a98ecbb1264e9046972e1103ac11b573bf83 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6059: fae783adafb5face387d2df7a983de5c1d752b45 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19897: 9a58db04f241c83503c0a25dd4d30b78424d3662 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

9a58db04f241 drm/i915/backlight: switch to unique backlight device names

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/backlight: switch to unique backlight device names

Quoted 34 lines · Patchwork

== Series Details ==

Series: drm/i915/backlight: switch to unique backlight device names
URL : https://patchwork.freedesktop.org/series/88798/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9931 -> Patchwork_19897
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_19897 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_19897, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_19897:

### IGT changes ###

#### Possible regressions ####

Quoted 16 lines

* igt@i915_pm_backlight@basic-brightness:
- fi-icl-u2: [PASS][1] -> [SKIP][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-icl-u2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-icl-u2/igt@[email protected]
- fi-cml-u2: [PASS][3] -> [SKIP][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-cml-u2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-cml-u2/igt@[email protected]
- fi-icl-y: [PASS][5] -> [SKIP][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-icl-y/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-icl-y/igt@[email protected]
- fi-tgl-y: [PASS][7] -> [SKIP][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-y/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-y/igt@[email protected]
- fi-cml-s: [PASS][9] -> [SKIP][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-cml-s/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-cml-s/igt@[email protected]

This is unsurprising, as igt is silly and uses a fixed "intel_backlight" path.

BR,
Jani.

Quoted 103 lines

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_pm_backlight@basic-brightness:
- {fi-ehl-1}: [PASS][11] -> [SKIP][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-ehl-1/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-ehl-1/igt@[email protected]
- {fi-tgl-dsi}: [PASS][13] -> [SKIP][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-dsi/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-dsi/igt@[email protected]
- {fi-ehl-2}: [PASS][15] -> [SKIP][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-ehl-2/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-ehl-2/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_19897 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@fbdev@read:
- fi-tgl-y: [PASS][17] -> [DMESG-WARN][18] ([i915#402]) +2 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-y/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-y/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- fi-skl-6600u: [PASS][19] -> [SKIP][20] ([fdo#109271])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-skl-6600u/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-skl-6600u/igt@[email protected]
- fi-snb-2520m: [PASS][21] -> [SKIP][22] ([fdo#109271])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-snb-2520m/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-snb-2520m/igt@[email protected]
- fi-bxt-dsi: [PASS][23] -> [SKIP][24] ([fdo#109271])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-bxt-dsi/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-bxt-dsi/igt@[email protected]
- fi-kbl-r: [PASS][25] -> [SKIP][26] ([fdo#109271])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-kbl-r/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-kbl-r/igt@[email protected]
- fi-bsw-kefka: [PASS][27] -> [SKIP][28] ([fdo#109271])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-bsw-kefka/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-bsw-kefka/igt@[email protected]
- fi-glk-dsi: [PASS][29] -> [SKIP][30] ([fdo#109271])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-glk-dsi/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-glk-dsi/igt@[email protected]
- fi-kbl-soraka: [PASS][31] -> [SKIP][32] ([fdo#109271])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-kbl-soraka/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-kbl-soraka/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-snb-2600: [PASS][33] -> [INCOMPLETE][34] ([i915#2782])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-snb-2600/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-snb-2600/igt@i915_selftest@[email protected]

#### Possible fixes ####

* igt@prime_vgem@basic-gtt:
- fi-tgl-y: [DMESG-WARN][35] ([i915#402]) -> [PASS][36] +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9931/fi-tgl-y/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/fi-tgl-y/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402

Participating hosts (43 -> 40)
------------------------------

Missing (3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_9931 -> Patchwork_19897

CI-20190529: 20190529
CI_DRM_9931: 88d3a98ecbb1264e9046972e1103ac11b573bf83 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6059: fae783adafb5face387d2df7a983de5c1d752b45 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19897: 9a58db04f241c83503c0a25dd4d30b78424d3662 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

9a58db04f241 drm/i915/backlight: switch to unique backlight device names

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19897/index.html

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
In reply to Jani Nikula
Quoted 10 lines · Jani Nikula

Change the backlight device names from intel_backlight to card%d-%s-backlight format, for example card0-eDP-1-backlight, to make them unique. Otherwise, registering multiple backlight devices with intel_backlight name will fail, regardless of whether they're two connectors in the same device or two different devices.

Quoted 5 lines

---

Is the name "intel_backlight" part of the UABI? In theory the userspace should only look at the names and types available under /sys/class/backlight, not the exact names.

Quick glance at some things suggest this might affect some custom setups people have.

There is an xorg.conf option in the intel ddx to force the backlight device selection. But I didn't see any hardcoding of the backlight device name, so unless the user has configured that knob things should keep working I think.

Also googling says systemd might have some backlight name to service name magic going on. But I was too lazy to actually read the code so don't know the details.

Quoted 64 lines
---
 drivers/gpu/drm/i915/display/intel_panel.c | 29 ++++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_panel.c +18 -11
index 10022d1575e1..5ebf8cb0e8e3 100644
@@ -1372,6 +1372,8 @@ int intel_backlight_device_register(struct intel_connector *connector)
 	struct drm_i915_private *i915 = to_i915(connector->base.dev);
 	struct intel_panel *panel = &connector->panel;
 	struct backlight_properties props;
+	const char *name;
+	int ret = 0;
 
 	if (WARN_ON(panel->backlight.device))
 		return -ENODEV;
@@ -1398,28 +1400,33 @@ int intel_backlight_device_register(struct intel_connector *connector)
 	else
 		props.power = FB_BLANK_POWERDOWN;
 
-	/*
-	 * Note: using the same name independent of the connector prevents
-	 * registration of multiple backlight devices in the driver.
-	 */
+	name = kasprintf(GFP_KERNEL, "card%d-%s-backlight", i915->drm.primary->index,
+			 connector->base.name);
+	if (!name)
+		return -ENOMEM;
+
 	panel->backlight.device =
-		backlight_device_register("intel_backlight",
+		backlight_device_register(name,
 					  connector->base.kdev,
 					  connector,
 					  &intel_backlight_device_ops, &props);
 
 	if (IS_ERR(panel->backlight.device)) {
-		drm_err(&i915->drm, "Failed to register backlight: %ld\n",
-			PTR_ERR(panel->backlight.device));
+		drm_err(&i915->drm, "Failed to register backlight %s: %ld\n",
+			name, PTR_ERR(panel->backlight.device));
 		panel->backlight.device = NULL;
-		return -ENODEV;
+		ret = -ENODEV;
+		goto out;
 	}
 
 	drm_dbg_kms(&i915->drm,
-		    "Connector %s backlight sysfs interface registered\n",
-		    connector->base.name);
+		    "Connector %s backlight sysfs interface %s registered\n",
+		    name, connector->base.name);
 
-	return 0;
+out:
+	kfree(name);
+
+	return ret;
 }
 
 void intel_backlight_device_unregister(struct intel_connector *connector)
Signature · 1 line
2.20.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 20 lines · Ville Syrjälä
Quoted 10 lines · Jani Nikula

Change the backlight device names from intel_backlight to card%d-%s-backlight format, for example card0-eDP-1-backlight, to make them unique. Otherwise, registering multiple backlight devices with intel_backlight name will fail, regardless of whether they're two connectors in the same device or two different devices.

Quoted 5 lines

---

Is the name "intel_backlight" part of the UABI? In theory the userspace should only look at the names and types available under /sys/class/backlight, not the exact names.

Quick glance at some things suggest this might affect some custom setups people have.

Quoted 8 lines

There is an xorg.conf option in the intel ddx to force the backlight device selection. But I didn't see any hardcoding of the backlight device name, so unless the user has configured that knob things should keep working I think.

Also googling says systemd might have some backlight name to service name magic going on. But I was too lazy to actually read the code so don't know the details.

Thanks, I switched to using intel_backlight first, and falling back to unique names after that [1].

BR,
Jani.

[1] https://patchwork.freedesktop.org/series/89578/

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx