utils.c (1a68b346a2c9969c05e80a3b99a9ab160b5655c0) | utils.c (ba46e42e925b5d09b4e441f8de3db119cc7df58f) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * X86 ACPI Utility Functions 4 * 5 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> 6 * 7 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: 8 * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. --- 24 unchanged lines hidden (view full) --- 33 * avoid potentially causing trouble on other models and because some HIDs 34 * are re-used on different SoCs for completely different devices. 35 */ 36struct override_status_id { 37 struct acpi_device_id hid[2]; 38 struct x86_cpu_id cpu_ids[2]; 39 struct dmi_system_id dmi_ids[2]; /* Optional */ 40 const char *uid; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * X86 ACPI Utility Functions 4 * 5 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> 6 * 7 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: 8 * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. --- 24 unchanged lines hidden (view full) --- 33 * avoid potentially causing trouble on other models and because some HIDs 34 * are re-used on different SoCs for completely different devices. 35 */ 36struct override_status_id { 37 struct acpi_device_id hid[2]; 38 struct x86_cpu_id cpu_ids[2]; 39 struct dmi_system_id dmi_ids[2]; /* Optional */ 40 const char *uid; |
41 const char *path; |
|
41 unsigned long long status; 42}; 43 | 42 unsigned long long status; 43}; 44 |
44#define ENTRY(status, hid, uid, cpu_model, dmi...) { \ | 45#define ENTRY(status, hid, uid, path, cpu_model, dmi...) { \ |
45 { { hid, }, {} }, \ 46 { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ 47 { { .matches = dmi }, {} }, \ 48 uid, \ | 46 { { hid, }, {} }, \ 47 { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ 48 { { .matches = dmi }, {} }, \ 49 uid, \ |
50 path, \ |
|
49 status, \ 50} 51 52#define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ | 51 status, \ 52} 53 54#define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ |
53 ENTRY(ACPI_STA_DEFAULT, hid, uid, cpu_model, dmi) | 55 ENTRY(ACPI_STA_DEFAULT, hid, uid, NULL, cpu_model, dmi) |
54 55#define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ | 56 57#define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ |
56 ENTRY(0, hid, uid, cpu_model, dmi) | 58 ENTRY(0, hid, uid, NULL, cpu_model, dmi) |
57 | 59 |
60#define PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ 61 ENTRY(ACPI_STA_DEFAULT, "", NULL, path, cpu_model, dmi) 62 63#define NOT_PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ 64 ENTRY(0, "", NULL, path, cpu_model, dmi) 65 |
|
58static const struct override_status_id override_status_ids[] = { 59 /* 60 * Bay / Cherry Trail PWM directly poked by GPU driver in win10, 61 * but Linux uses a separate PWM driver, harmless if not used. 62 */ 63 PRESENT_ENTRY_HID("80860F09", "1", ATOM_SILVERMONT, {}), 64 PRESENT_ENTRY_HID("80862288", "1", ATOM_AIRMONT, {}), 65 --- 49 unchanged lines hidden (view full) --- 115}; 116 117bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status) 118{ 119 bool ret = false; 120 unsigned int i; 121 122 for (i = 0; i < ARRAY_SIZE(override_status_ids); i++) { | 66static const struct override_status_id override_status_ids[] = { 67 /* 68 * Bay / Cherry Trail PWM directly poked by GPU driver in win10, 69 * but Linux uses a separate PWM driver, harmless if not used. 70 */ 71 PRESENT_ENTRY_HID("80860F09", "1", ATOM_SILVERMONT, {}), 72 PRESENT_ENTRY_HID("80862288", "1", ATOM_AIRMONT, {}), 73 --- 49 unchanged lines hidden (view full) --- 123}; 124 125bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status) 126{ 127 bool ret = false; 128 unsigned int i; 129 130 for (i = 0; i < ARRAY_SIZE(override_status_ids); i++) { |
123 if (acpi_match_device_ids(adev, override_status_ids[i].hid)) 124 continue; 125 126 if (!adev->pnp.unique_id || 127 strcmp(adev->pnp.unique_id, override_status_ids[i].uid)) 128 continue; 129 | |
130 if (!x86_match_cpu(override_status_ids[i].cpu_ids)) 131 continue; 132 133 if (override_status_ids[i].dmi_ids[0].matches[0].slot && 134 !dmi_check_system(override_status_ids[i].dmi_ids)) 135 continue; 136 | 131 if (!x86_match_cpu(override_status_ids[i].cpu_ids)) 132 continue; 133 134 if (override_status_ids[i].dmi_ids[0].matches[0].slot && 135 !dmi_check_system(override_status_ids[i].dmi_ids)) 136 continue; 137 |
138 if (override_status_ids[i].path) { 139 struct acpi_buffer path = { ACPI_ALLOCATE_BUFFER, NULL }; 140 bool match; 141 142 if (acpi_get_name(adev->handle, ACPI_FULL_PATHNAME, &path)) 143 continue; 144 145 match = strcmp((char *)path.pointer, override_status_ids[i].path) == 0; 146 kfree(path.pointer); 147 148 if (!match) 149 continue; 150 } else { 151 if (acpi_match_device_ids(adev, override_status_ids[i].hid)) 152 continue; 153 154 if (!adev->pnp.unique_id || 155 strcmp(adev->pnp.unique_id, override_status_ids[i].uid)) 156 continue; 157 } 158 |
|
137 *status = override_status_ids[i].status; 138 ret = true; 139 break; 140 } 141 142 return ret; 143} 144 --- 24 unchanged lines hidden --- | 159 *status = override_status_ids[i].status; 160 ret = true; 161 break; 162 } 163 164 return ret; 165} 166 --- 24 unchanged lines hidden --- |