From 87521e16a7abbf3fa337f56cb4d1e18247f15e8a Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 16 Jun 2015 16:27:48 +0200 Subject: acpi-video-detect: Rewrite backlight interface selection logic Currently we have 2 kernel commandline options + dmi-quirks in 3 places all interacting (in interesting ways) to select which which backlight interface to use. On the commandline we've acpi_backlight=[video|vendor] and video.use_native_backlight=[0|1]. DMI quirks we have in acpi/video-detect.c, acpi/video.c and drivers/platform/x86/*.c . This commit is the first step to cleaning this up, replacing the 2 cmdline options with just acpi_backlight=[video|vendor|native|none], and adds a new API to video_detect.c to reflect this. Follow up commits will also move other related code, like unregistering the acpi_video backlight interface if it was registered before other drivers which take priority over it are loaded, to video_detect.c where this logic really belongs. Signed-off-by: Hans de Goede Acked-by: Darren Hart Signed-off-by: Rafael J. Wysocki --- include/acpi/video.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/acpi') diff --git a/include/acpi/video.h b/include/acpi/video.h index 843ef1adfbfa..01b5cc78efd8 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -16,6 +16,14 @@ struct acpi_device; #define ACPI_VIDEO_DISPLAY_LEGACY_PANEL 0x0110 #define ACPI_VIDEO_DISPLAY_LEGACY_TV 0x0200 +enum acpi_backlight_type { + acpi_backlight_undef = -1, + acpi_backlight_none = 0, + acpi_backlight_video, + acpi_backlight_vendor, + acpi_backlight_native, +}; + #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) extern int acpi_video_register(void); extern void acpi_video_unregister(void); @@ -23,6 +31,8 @@ extern void acpi_video_unregister_backlight(void); extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern bool acpi_video_verify_backlight_support(void); +extern enum acpi_backlight_type acpi_video_get_backlight_type(void); +extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); #else static inline int acpi_video_register(void) { return 0; } static inline void acpi_video_unregister(void) { return; } @@ -33,6 +43,13 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type, return -ENODEV; } static inline bool acpi_video_verify_backlight_support(void) { return false; } +static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) +{ + return acpi_backlight_vendor; +} +static void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) +{ +} #endif #endif -- cgit v1.2.3 From 3bd6bce36975f571cb47fa9d0aac9e06f94f4028 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 16 Jun 2015 16:27:51 +0200 Subject: ACPI / video: Port to new backlight interface selection API Most of the patch is moving the dmi quirks for forcing use of the acpi-video / the native backlight interface to video_detect.c. What remains is a nice cleanup. Signed-off-by: Hans de Goede Acked-by: Darren Hart Signed-off-by: Rafael J. Wysocki --- include/acpi/video.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/video.h b/include/acpi/video.h index 01b5cc78efd8..47c7ad6594c8 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -30,7 +30,6 @@ extern void acpi_video_unregister(void); extern void acpi_video_unregister_backlight(void); extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); -extern bool acpi_video_verify_backlight_support(void); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); #else @@ -42,7 +41,6 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type, { return -ENODEV; } -static inline bool acpi_video_verify_backlight_support(void) { return false; } static inline enum acpi_backlight_type acpi_video_get_backlight_type(void) { return acpi_backlight_vendor; -- cgit v1.2.3 From e7d024c00a4a7b617390db863bdd5b9dc65821f7 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 16 Jun 2015 16:28:13 +0200 Subject: ACPI / video: Make acpi_video_unregister_backlight() private acpi_video_unregister_backlight() is now only used by video_detect.c which is part of the same acpi_video module as video.c, make acpi_video_unregister_backlight() private to this module. Signed-off-by: Hans de Goede Acked-by: Darren Hart Signed-off-by: Rafael J. Wysocki --- include/acpi/video.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/acpi') diff --git a/include/acpi/video.h b/include/acpi/video.h index 47c7ad6594c8..a7d7f1043e9c 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -27,7 +27,6 @@ enum acpi_backlight_type { #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) extern int acpi_video_register(void); extern void acpi_video_unregister(void); -extern void acpi_video_unregister_backlight(void); extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); @@ -35,7 +34,6 @@ extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); #else static inline int acpi_video_register(void) { return 0; } static inline void acpi_video_unregister(void) { return; } -static inline void acpi_video_unregister_backlight(void) { return; } static inline int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid) { -- cgit v1.2.3