Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branches 'acpi-cppc', 'acpi-video' and 'acpi-utils'

* acpi-cppc:
ACPI: CPPC: Replace cppc_attr with kobj_attribute
ACPI: CPPC: Add emtpy stubs of functions for CONFIG_ACPI_CPPC_LIB unset

* acpi-video:
ACPI: video: use native backlight for GA401/GA502/GA503
ACPI: video: Check LCD flag on ACPI-reduced-hardware devices
ACPI: utils: Add acpi_reduced_hardware() helper

* acpi-utils:
ACPI: utils: Capitalize abbreviations in the comments
ACPI: utils: Document for_each_acpi_dev_match() macro

+132 -29
+26 -13
drivers/acpi/acpi_video.c
··· 2182 2182 return false; 2183 2183 } 2184 2184 2185 + /* 2186 + * We're seeing a lot of bogus backlight interfaces on newer machines 2187 + * without a LCD such as desktops, servers and HDMI sticks. Checking the 2188 + * lcd flag fixes this, enable this by default on any machines which are: 2189 + * 1. Win8 ready (where we also prefer the native backlight driver, so 2190 + * normally the acpi_video code should not register there anyways); *and* 2191 + * 2.1 Report a desktop/server DMI chassis-type, or 2192 + * 2.2 Are an ACPI-reduced-hardware platform (and thus won't use the EC for 2193 + backlight control) 2194 + */ 2195 + static bool should_check_lcd_flag(void) 2196 + { 2197 + if (!acpi_osi_is_win8()) 2198 + return false; 2199 + 2200 + if (dmi_is_desktop()) 2201 + return true; 2202 + 2203 + if (acpi_reduced_hardware()) 2204 + return true; 2205 + 2206 + return false; 2207 + } 2208 + 2185 2209 int acpi_video_register(void) 2186 2210 { 2187 2211 int ret = 0; ··· 2219 2195 goto leave; 2220 2196 } 2221 2197 2222 - /* 2223 - * We're seeing a lot of bogus backlight interfaces on newer machines 2224 - * without a LCD such as desktops, servers and HDMI sticks. Checking 2225 - * the lcd flag fixes this, so enable this on any machines which are 2226 - * win8 ready (where we also prefer the native backlight driver, so 2227 - * normally the acpi_video code should not register there anyways). 2228 - */ 2229 - if (only_lcd == -1) { 2230 - if (dmi_is_desktop() && acpi_osi_is_win8()) 2231 - only_lcd = true; 2232 - else 2233 - only_lcd = false; 2234 - } 2198 + if (only_lcd == -1) 2199 + only_lcd = should_check_lcd_flag(); 2235 2200 2236 2201 dmi_check_system(video_dmi_table); 2237 2202
+3 -12
drivers/acpi/cppc_acpi.c
··· 33 33 34 34 #define pr_fmt(fmt) "ACPI CPPC: " fmt 35 35 36 - #include <linux/cpufreq.h> 37 36 #include <linux/delay.h> 38 37 #include <linux/iopoll.h> 39 38 #include <linux/ktime.h> ··· 118 119 */ 119 120 #define NUM_RETRIES 500ULL 120 121 121 - struct cppc_attr { 122 - struct attribute attr; 123 - ssize_t (*show)(struct kobject *kobj, 124 - struct attribute *attr, char *buf); 125 - ssize_t (*store)(struct kobject *kobj, 126 - struct attribute *attr, const char *c, ssize_t count); 127 - }; 128 - 129 122 #define define_one_cppc_ro(_name) \ 130 - static struct cppc_attr _name = \ 123 + static struct kobj_attribute _name = \ 131 124 __ATTR(_name, 0444, show_##_name, NULL) 132 125 133 126 #define to_cpc_desc(a) container_of(a, struct cpc_desc, kobj) 134 127 135 128 #define show_cppc_data(access_fn, struct_name, member_name) \ 136 129 static ssize_t show_##member_name(struct kobject *kobj, \ 137 - struct attribute *attr, char *buf) \ 130 + struct kobj_attribute *attr, char *buf) \ 138 131 { \ 139 132 struct cpc_desc *cpc_ptr = to_cpc_desc(kobj); \ 140 133 struct struct_name st_name = {0}; \ ··· 152 161 show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time); 153 162 154 163 static ssize_t show_feedback_ctrs(struct kobject *kobj, 155 - struct attribute *attr, char *buf) 164 + struct kobj_attribute *attr, char *buf) 156 165 { 157 166 struct cpc_desc *cpc_ptr = to_cpc_desc(kobj); 158 167 struct cppc_perf_fb_ctrs fb_ctrs = {0};
+19 -4
drivers/acpi/utils.c
··· 811 811 * Note that if the device is pluggable, it may since have disappeared. 812 812 * 813 813 * Note that unlike acpi_dev_found() this function checks the status 814 - * of the device. So for devices which are present in the dsdt, but 814 + * of the device. So for devices which are present in the DSDT, but 815 815 * which are disabled (their _STA callback returns 0) this function 816 816 * will return false. 817 817 * ··· 838 838 839 839 /** 840 840 * acpi_dev_get_next_match_dev - Return the next match of ACPI device 841 - * @adev: Pointer to the previous acpi_device matching this @hid, @uid and @hrv 841 + * @adev: Pointer to the previous ACPI device matching this @hid, @uid and @hrv 842 842 * @hid: Hardware ID of the device. 843 843 * @uid: Unique ID of the device, pass NULL to not check _UID 844 844 * @hrv: Hardware Revision of the device, pass -1 to not check _HRV ··· 846 846 * Return the next match of ACPI device if another matching device was present 847 847 * at the moment of invocation, or NULL otherwise. 848 848 * 849 - * The caller is responsible to call put_device() on the returned device. 849 + * FIXME: The function does not tolerate the sudden disappearance of @adev, e.g. 850 + * in the case of a hotplug event. That said, the caller should ensure that 851 + * this will never happen. 852 + * 853 + * The caller is responsible for invoking acpi_dev_put() on the returned device. 850 854 * 851 855 * See additional information in acpi_dev_present() as well. 852 856 */ ··· 879 875 * Return the first match of ACPI device if a matching device was present 880 876 * at the moment of invocation, or NULL otherwise. 881 877 * 882 - * The caller is responsible to call put_device() on the returned device. 878 + * The caller is responsible for invoking acpi_dev_put() on the returned device. 883 879 * 884 880 * See additional information in acpi_dev_present() as well. 885 881 */ ··· 889 885 return acpi_dev_get_next_match_dev(NULL, hid, uid, hrv); 890 886 } 891 887 EXPORT_SYMBOL(acpi_dev_get_first_match_dev); 888 + 889 + /** 890 + * acpi_reduced_hardware - Return if this is an ACPI-reduced-hw machine 891 + * 892 + * Return true when running on an ACPI-reduced-hw machine, false otherwise. 893 + */ 894 + bool acpi_reduced_hardware(void) 895 + { 896 + return acpi_gbl_reduced_hardware; 897 + } 898 + EXPORT_SYMBOL_GPL(acpi_reduced_hardware); 892 899 893 900 /* 894 901 * acpi_backlight= handling, this is done here rather then in video_detect.c
+24
drivers/acpi/video_detect.c
··· 385 385 DMI_MATCH(DMI_BOARD_NAME, "BA51_MV"), 386 386 }, 387 387 }, 388 + { 389 + .callback = video_detect_force_native, 390 + .ident = "ASUSTeK COMPUTER INC. GA401", 391 + .matches = { 392 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 393 + DMI_MATCH(DMI_PRODUCT_NAME, "GA401"), 394 + }, 395 + }, 396 + { 397 + .callback = video_detect_force_native, 398 + .ident = "ASUSTeK COMPUTER INC. GA502", 399 + .matches = { 400 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 401 + DMI_MATCH(DMI_PRODUCT_NAME, "GA502"), 402 + }, 403 + }, 404 + { 405 + .callback = video_detect_force_native, 406 + .ident = "ASUSTeK COMPUTER INC. GA503", 407 + .matches = { 408 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 409 + DMI_MATCH(DMI_PRODUCT_NAME, "GA503"), 410 + }, 411 + }, 388 412 389 413 /* 390 414 * Desktops which falsely report a backlight and which our heuristics
+15
include/acpi/acpi_bus.h
··· 78 78 79 79 bool acpi_dev_found(const char *hid); 80 80 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv); 81 + bool acpi_reduced_hardware(void); 81 82 82 83 #ifdef CONFIG_ACPI 83 84 ··· 690 689 struct acpi_device * 691 690 acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv); 692 691 692 + /** 693 + * for_each_acpi_dev_match - iterate over ACPI devices that matching the criteria 694 + * @adev: pointer to the matching ACPI device, NULL at the end of the loop 695 + * @hid: Hardware ID of the device. 696 + * @uid: Unique ID of the device, pass NULL to not check _UID 697 + * @hrv: Hardware Revision of the device, pass -1 to not check _HRV 698 + * 699 + * The caller is responsible for invoking acpi_dev_put() on the returned device. 700 + * 701 + * FIXME: Due to above requirement there is a window that may invalidate @adev 702 + * and next iteration will use a dangling pointer, e.g. in the case of a 703 + * hotplug event. That said, the caller should ensure that this will never 704 + * happen. 705 + */ 693 706 #define for_each_acpi_dev_match(adev, hid, uid, hrv) \ 694 707 for (adev = acpi_dev_get_first_match_dev(hid, uid, hrv); \ 695 708 adev; \
+40
include/acpi/cppc_acpi.h
··· 11 11 #define _CPPC_ACPI_H 12 12 13 13 #include <linux/acpi.h> 14 + #include <linux/cpufreq.h> 14 15 #include <linux/types.h> 15 16 16 17 #include <acpi/pcc.h> ··· 133 132 cpumask_var_t shared_cpu_map; 134 133 }; 135 134 135 + #ifdef CONFIG_ACPI_CPPC_LIB 136 136 extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf); 137 137 extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs); 138 138 extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); ··· 144 142 extern bool cpc_ffh_supported(void); 145 143 extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); 146 144 extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); 145 + #else /* !CONFIG_ACPI_CPPC_LIB */ 146 + static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf) 147 + { 148 + return -ENOTSUPP; 149 + } 150 + static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs) 151 + { 152 + return -ENOTSUPP; 153 + } 154 + static inline int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) 155 + { 156 + return -ENOTSUPP; 157 + } 158 + static inline int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps) 159 + { 160 + return -ENOTSUPP; 161 + } 162 + static inline bool acpi_cpc_valid(void) 163 + { 164 + return false; 165 + } 166 + static inline unsigned int cppc_get_transition_latency(int cpu) 167 + { 168 + return CPUFREQ_ETERNAL; 169 + } 170 + static inline bool cpc_ffh_supported(void) 171 + { 172 + return false; 173 + } 174 + static inline int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val) 175 + { 176 + return -ENOTSUPP; 177 + } 178 + static inline int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val) 179 + { 180 + return -ENOTSUPP; 181 + } 182 + #endif /* !CONFIG_ACPI_CPPC_LIB */ 147 183 148 184 #endif /* _CPPC_ACPI_H*/
+5
include/linux/acpi.h
··· 748 748 return NULL; 749 749 } 750 750 751 + static inline bool acpi_reduced_hardware(void) 752 + { 753 + return false; 754 + } 755 + 751 756 static inline void acpi_dev_put(struct acpi_device *adev) {} 752 757 753 758 static inline bool is_acpi_node(const struct fwnode_handle *fwnode)