Skip to content

Commit 2c9f398

Browse files
committed
Merge back earlier ACPI backlight driver changes for v6.8.
2 parents 172c48c + ccd45fa commit 2c9f398

File tree

2 files changed

+16
-61
lines changed

2 files changed

+16
-61
lines changed

drivers/acpi/acpi_video.c

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(hw_changes_brightness,
6767
static bool device_id_scheme = false;
6868
module_param(device_id_scheme, bool, 0444);
6969

70-
static int only_lcd = -1;
70+
static int only_lcd;
7171
module_param(only_lcd, int, 0444);
7272

7373
static bool may_report_brightness_keys;
@@ -1713,12 +1713,12 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
17131713
return;
17141714
count++;
17151715

1716-
acpi_get_parent(device->dev->handle, &acpi_parent);
1717-
1718-
pdev = acpi_get_pci_dev(acpi_parent);
1719-
if (pdev) {
1720-
parent = &pdev->dev;
1721-
pci_dev_put(pdev);
1716+
if (ACPI_SUCCESS(acpi_get_parent(device->dev->handle, &acpi_parent))) {
1717+
pdev = acpi_get_pci_dev(acpi_parent);
1718+
if (pdev) {
1719+
parent = &pdev->dev;
1720+
pci_dev_put(pdev);
1721+
}
17221722
}
17231723

17241724
memset(&props, 0, sizeof(struct backlight_properties));
@@ -2137,57 +2137,6 @@ static int __init intel_opregion_present(void)
21372137
return opregion;
21382138
}
21392139

2140-
/* Check if the chassis-type indicates there is no builtin LCD panel */
2141-
static bool dmi_is_desktop(void)
2142-
{
2143-
const char *chassis_type;
2144-
unsigned long type;
2145-
2146-
chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
2147-
if (!chassis_type)
2148-
return false;
2149-
2150-
if (kstrtoul(chassis_type, 10, &type) != 0)
2151-
return false;
2152-
2153-
switch (type) {
2154-
case 0x03: /* Desktop */
2155-
case 0x04: /* Low Profile Desktop */
2156-
case 0x05: /* Pizza Box */
2157-
case 0x06: /* Mini Tower */
2158-
case 0x07: /* Tower */
2159-
case 0x10: /* Lunch Box */
2160-
case 0x11: /* Main Server Chassis */
2161-
return true;
2162-
}
2163-
2164-
return false;
2165-
}
2166-
2167-
/*
2168-
* We're seeing a lot of bogus backlight interfaces on newer machines
2169-
* without a LCD such as desktops, servers and HDMI sticks. Checking the
2170-
* lcd flag fixes this, enable this by default on any machines which are:
2171-
* 1. Win8 ready (where we also prefer the native backlight driver, so
2172-
* normally the acpi_video code should not register there anyways); *and*
2173-
* 2.1 Report a desktop/server DMI chassis-type, or
2174-
* 2.2 Are an ACPI-reduced-hardware platform (and thus won't use the EC for
2175-
backlight control)
2176-
*/
2177-
static bool should_check_lcd_flag(void)
2178-
{
2179-
if (!acpi_osi_is_win8())
2180-
return false;
2181-
2182-
if (dmi_is_desktop())
2183-
return true;
2184-
2185-
if (acpi_reduced_hardware())
2186-
return true;
2187-
2188-
return false;
2189-
}
2190-
21912140
int acpi_video_register(void)
21922141
{
21932142
int ret = 0;
@@ -2201,9 +2150,6 @@ int acpi_video_register(void)
22012150
goto leave;
22022151
}
22032152

2204-
if (only_lcd == -1)
2205-
only_lcd = should_check_lcd_flag();
2206-
22072153
dmi_check_system(video_dmi_table);
22082154

22092155
ret = acpi_bus_register_driver(&acpi_video_bus);

include/acpi/video.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
7575
return __acpi_video_get_backlight_type(false, NULL);
7676
}
7777

78+
/*
79+
* This function MUST only be called by GPU drivers to check if the driver
80+
* should register a backlight class device. This function not only checks
81+
* if a GPU native backlight device should be registered it *also* tells
82+
* the ACPI video-detect code that native GPU backlight control is available.
83+
* Therefor calling this from any place other then the GPU driver is wrong!
84+
* To check if GPU native backlight control is used in other places instead use:
85+
* if (acpi_video_get_backlight_type() == acpi_backlight_native) { ... }
86+
*/
7887
static inline bool acpi_video_backlight_use_native(void)
7988
{
8089
return __acpi_video_get_backlight_type(true, NULL) == acpi_backlight_native;

0 commit comments

Comments
 (0)