Commit bd8856c6 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: gmin_platform: Make DMI quirks take precedence over the _DSM table

On some devices the _DSM sensor-info table contains wrong info,
move the DMI quirk handling up to above the _DSM table check
to allow DMI quirks to override wrong info in the _DSM table.
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 2f2fce05
...@@ -1353,37 +1353,22 @@ static int gmin_get_config_var(struct device *maindev, ...@@ -1353,37 +1353,22 @@ static int gmin_get_config_var(struct device *maindev,
const char *var, const char *var,
char *out, size_t *out_len) char *out, size_t *out_len)
{ {
struct acpi_device *adev = ACPI_COMPANION(maindev);
efi_char16_t var16[CFG_VAR_NAME_MAX]; efi_char16_t var16[CFG_VAR_NAME_MAX];
const struct dmi_system_id *id; const struct dmi_system_id *id;
struct device *dev = maindev;
char var8[CFG_VAR_NAME_MAX]; char var8[CFG_VAR_NAME_MAX];
efi_status_t status; efi_status_t status;
int i, ret; int i, ret;
/* For sensors, try first to use the _DSM table */ if (!is_gmin && adev)
if (!is_gmin) { ret = snprintf(var8, sizeof(var8), "%s_%s", acpi_dev_name(adev), var);
ret = gmin_get_config_dsm_var(maindev, var, out, out_len);
if (!ret)
return 0;
}
/* Fall-back to other approaches */
if (!is_gmin && ACPI_COMPANION(dev))
dev = &ACPI_COMPANION(dev)->dev;
if (!is_gmin)
ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var);
else else
ret = snprintf(var8, sizeof(var8), "gmin_%s", var); ret = snprintf(var8, sizeof(var8), "gmin_%s", var);
if (ret < 0 || ret >= sizeof(var8) - 1) if (ret < 0 || ret >= sizeof(var8) - 1)
return -EINVAL; return -EINVAL;
/* First check a hard-coded list of board-specific variables. /* DMI based quirks override both the _DSM table and EFI variables */
* Some device firmwares lack the ability to set EFI variables at
* runtime.
*/
id = dmi_first_match(gmin_vars); id = dmi_first_match(gmin_vars);
if (id) { if (id) {
ret = gmin_get_hardcoded_var(maindev, id->driver_data, var8, ret = gmin_get_hardcoded_var(maindev, id->driver_data, var8,
...@@ -1392,6 +1377,13 @@ static int gmin_get_config_var(struct device *maindev, ...@@ -1392,6 +1377,13 @@ static int gmin_get_config_var(struct device *maindev,
return 0; return 0;
} }
/* For sensors, try first to use the _DSM table */
if (!is_gmin) {
ret = gmin_get_config_dsm_var(maindev, var, out, out_len);
if (!ret)
return 0;
}
/* Our variable names are ASCII by construction, but EFI names /* Our variable names are ASCII by construction, but EFI names
* are wide chars. Convert and zero-pad. * are wide chars. Convert and zero-pad.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment