Skip to content

Commit

Permalink
drm/privacy-screen: Use connector name in lookup
Browse files Browse the repository at this point in the history
ATM the drm privacy-screen code is not using connector names to lookup
drm privacy-screen providers, drm_privacy_screen_get() does support this,
but before this change the con_id is set to NULL everywhere which is
treated as a wildcard.

There are some worries that we may see devices with 2 displays with
a privacy-screen, be it 2 internal displays or 1 internal + 1 external.

All laptop-models which currently are supported by the drm_privacy_screen
code use an eDP display connected to eDP-1.

This commits enables the use of the con_id parameter, hardcoding this to
"eDP-1" in the lookup tables in drivers/gpu/drm/drm_privacy_screen_x86.c
and adjusting the i915 driver to match.

Using the con_id parameter paves the way for potentially having another
display (attached to a different connector) which also has a builtin
privacy-screen.

This was tested by Hans de Goede on a ThinkPad and by Rajat Jain on
an Intel Chromebook (both with builtin privacy-screens).

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Rajat Jain <rajatja@google.com>
Tested-by: Rajat Jain <rajatja@google.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
jwrdegoede committed Mar 24, 2024
1 parent dee0507 commit a606b07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/drm_privacy_screen_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static const struct arch_init_data arch_init_data[] __initconst = {
{
.lookup = {
.dev_id = NULL,
.con_id = NULL,
.con_id = "eDP-1",
.provider = "privacy_screen-thinkpad_acpi",
},
.detect = detect_thinkpad_privacy_screen,
Expand All @@ -72,7 +72,7 @@ static const struct arch_init_data arch_init_data[] __initconst = {
{
.lookup = {
.dev_id = NULL,
.con_id = NULL,
.con_id = "eDP-1",
.provider = "privacy_screen-GOOG0010:00",
},
.detect = detect_chromeos_privacy_screen,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/display/intel_ddi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4394,7 +4394,7 @@ intel_ddi_init_dp_connector(struct intel_digital_port *dig_port)
struct drm_device *dev = dig_port->base.base.dev;
struct drm_privacy_screen *privacy_screen;

privacy_screen = drm_privacy_screen_get(dev->dev, NULL);
privacy_screen = drm_privacy_screen_get(dev->dev, connector->base.name);
if (!IS_ERR(privacy_screen)) {
drm_connector_attach_privacy_screen_provider(&connector->base,
privacy_screen);
Expand Down
15 changes: 11 additions & 4 deletions drivers/gpu/drm/i915/display/intel_display_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@

bool intel_display_driver_probe_defer(struct pci_dev *pdev)
{
static const char * const internal_panel_connector_names[] = {
"eDP-1",
};
struct drm_privacy_screen *privacy_screen;
int i;

/*
* apple-gmux is needed on dual GPU MacBook Pro
Expand All @@ -68,11 +72,14 @@ bool intel_display_driver_probe_defer(struct pci_dev *pdev)
return true;

/* If the LCD panel has a privacy-screen, wait for it */
privacy_screen = drm_privacy_screen_get(&pdev->dev, NULL);
if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER)
return true;
for (i = 0; i < ARRAY_SIZE(internal_panel_connector_names); i++) {
privacy_screen = drm_privacy_screen_get(&pdev->dev,
internal_panel_connector_names[i]);
if (IS_ERR(privacy_screen) && PTR_ERR(privacy_screen) == -EPROBE_DEFER)
return true;

drm_privacy_screen_put(privacy_screen);
drm_privacy_screen_put(privacy_screen);
}

return false;
}
Expand Down

0 comments on commit a606b07

Please sign in to comment.