Commit b7ab6b91 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-resource', 'acpi-pmic', 'acpi-battery' and 'acpi-apei'

Merge ACPI resources handling changes, ACPI PMIC and battery drivers
changes and ACPI APEI changes for 6.3-rc1:

 - Add two more entries to the ACPI IRQ override quirk list (Adam
   Niederer, Werner Sembach).

 - Add a pmic_i2c_address entry for Intel Bay Trail Crystal Cove to
   allow intel_soc_pmic_exec_mipi_pmic_seq_element() to be used with
   the Bay Trail Crystal Cove PMIC OpRegion driver (Hans de Goede).

 - Add comments with DSDT power OpRegion field names to the ACPI PMIC
   driver (Hans de Goede).

 - Fix string termination handling in the ACPI battery driver (Armin
   Wolf).

 - Limit error type to 32-bit width in the ACPI APEI error injection
   code (Shuai Xue).

* acpi-resource:
  ACPI: resource: Do IRQ override on all TongFang GMxRGxx
  ACPI: resource: Add IRQ overrides for MAINGEAR Vector Pro 2 models

* acpi-pmic:
  ACPI: PMIC: Add comments with DSDT power opregion field names
  ACPI: PMIC: Add pmic_i2c_address to BYT Crystal Cove support

* acpi-battery:
  ACPI: battery: Increase maximum string length
  ACPI: battery: Fix buffer overread if not NUL-terminated
  ACPI: battery: Fix missing NUL-termination with large strings

* acpi-apei:
  ACPI: APEI: EINJ: Limit error type to 32-bit width
...@@ -616,6 +616,10 @@ static int error_type_set(void *data, u64 val) ...@@ -616,6 +616,10 @@ static int error_type_set(void *data, u64 val)
u32 available_error_type = 0; u32 available_error_type = 0;
u32 tval, vendor; u32 tval, vendor;
/* Only low 32 bits for error type are valid */
if (val & GENMASK_ULL(63, 32))
return -EINVAL;
/* /*
* Vendor defined types have 0x80000000 bit set, and * Vendor defined types have 0x80000000 bit set, and
* are not enumerated by ACPI_EINJ_GET_ERROR_TYPE * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#define ACPI_BATTERY_STATE_CHARGING 0x2 #define ACPI_BATTERY_STATE_CHARGING 0x2
#define ACPI_BATTERY_STATE_CRITICAL 0x4 #define ACPI_BATTERY_STATE_CRITICAL 0x4
#define MAX_STRING_LENGTH 64
MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>"); MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
MODULE_DESCRIPTION("ACPI Battery Driver"); MODULE_DESCRIPTION("ACPI Battery Driver");
...@@ -118,10 +120,10 @@ struct acpi_battery { ...@@ -118,10 +120,10 @@ struct acpi_battery {
int capacity_granularity_1; int capacity_granularity_1;
int capacity_granularity_2; int capacity_granularity_2;
int alarm; int alarm;
char model_number[32]; char model_number[MAX_STRING_LENGTH];
char serial_number[32]; char serial_number[MAX_STRING_LENGTH];
char type[32]; char type[MAX_STRING_LENGTH];
char oem_info[32]; char oem_info[MAX_STRING_LENGTH];
int state; int state;
int power_unit; int power_unit;
unsigned long flags; unsigned long flags;
...@@ -437,16 +439,25 @@ static int extract_package(struct acpi_battery *battery, ...@@ -437,16 +439,25 @@ static int extract_package(struct acpi_battery *battery,
element = &package->package.elements[i]; element = &package->package.elements[i];
if (offsets[i].mode) { if (offsets[i].mode) {
u8 *ptr = (u8 *)battery + offsets[i].offset; u8 *ptr = (u8 *)battery + offsets[i].offset;
u32 len = MAX_STRING_LENGTH;
switch (element->type) {
case ACPI_TYPE_BUFFER:
if (len > element->buffer.length + 1)
len = element->buffer.length + 1;
fallthrough;
case ACPI_TYPE_STRING:
strscpy(ptr, element->string.pointer, len);
break;
case ACPI_TYPE_INTEGER:
strscpy(ptr, (u8 *)&element->integer.value, sizeof(u64) + 1);
if (element->type == ACPI_TYPE_STRING || break;
element->type == ACPI_TYPE_BUFFER) default:
strncpy(ptr, element->string.pointer, 32);
else if (element->type == ACPI_TYPE_INTEGER) {
strncpy(ptr, (u8 *)&element->integer.value,
sizeof(u64));
ptr[sizeof(u64)] = 0;
} else
*ptr = 0; /* don't have value */ *ptr = 0; /* don't have value */
}
} else { } else {
int *x = (int *)((u8 *)battery + offsets[i].offset); int *x = (int *)((u8 *)battery + offsets[i].offset);
*x = (element->type == ACPI_TYPE_INTEGER) ? *x = (element->type == ACPI_TYPE_INTEGER) ?
......
...@@ -283,6 +283,7 @@ static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = { ...@@ -283,6 +283,7 @@ static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
.power_table_count= ARRAY_SIZE(power_table), .power_table_count= ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
.thermal_table_count = ARRAY_SIZE(thermal_table), .thermal_table_count = ARRAY_SIZE(thermal_table),
.pmic_i2c_address = 0x6e,
}; };
static int intel_crc_pmic_opregion_probe(struct platform_device *pdev) static int intel_crc_pmic_opregion_probe(struct platform_device *pdev)
......
...@@ -20,19 +20,19 @@ ...@@ -20,19 +20,19 @@
#define CHTDC_TI_GPADC 0x5a #define CHTDC_TI_GPADC 0x5a
static struct pmic_table chtdc_ti_power_table[] = { static struct pmic_table chtdc_ti_power_table[] = {
{ .address = 0x00, .reg = 0x41 }, { .address = 0x00, .reg = 0x41 }, /* LDO1 */
{ .address = 0x04, .reg = 0x42 }, { .address = 0x04, .reg = 0x42 }, /* LDO2 */
{ .address = 0x08, .reg = 0x43 }, { .address = 0x08, .reg = 0x43 }, /* LDO3 */
{ .address = 0x0c, .reg = 0x45 }, { .address = 0x0c, .reg = 0x45 }, /* LDO5 */
{ .address = 0x10, .reg = 0x46 }, { .address = 0x10, .reg = 0x46 }, /* LDO6 */
{ .address = 0x14, .reg = 0x47 }, { .address = 0x14, .reg = 0x47 }, /* LDO7 */
{ .address = 0x18, .reg = 0x48 }, { .address = 0x18, .reg = 0x48 }, /* LDO8 */
{ .address = 0x1c, .reg = 0x49 }, { .address = 0x1c, .reg = 0x49 }, /* LDO9 */
{ .address = 0x20, .reg = 0x4a }, { .address = 0x20, .reg = 0x4a }, /* LD10 */
{ .address = 0x24, .reg = 0x4b }, { .address = 0x24, .reg = 0x4b }, /* LD11 */
{ .address = 0x28, .reg = 0x4c }, { .address = 0x28, .reg = 0x4c }, /* LD12 */
{ .address = 0x2c, .reg = 0x4d }, { .address = 0x2c, .reg = 0x4d }, /* LD13 */
{ .address = 0x30, .reg = 0x4e }, { .address = 0x30, .reg = 0x4e }, /* LD14 */
}; };
static struct pmic_table chtdc_ti_thermal_table[] = { static struct pmic_table chtdc_ti_thermal_table[] = {
......
...@@ -467,17 +467,34 @@ static const struct dmi_system_id lenovo_laptop[] = { ...@@ -467,17 +467,34 @@ static const struct dmi_system_id lenovo_laptop[] = {
{ } { }
}; };
static const struct dmi_system_id schenker_gm_rg[] = { static const struct dmi_system_id tongfang_gm_rg[] = {
{ {
.ident = "XMG CORE 15 (M22)", .ident = "TongFang GMxRGxx/XMG CORE 15 (M22)/TUXEDO Stellaris 15 Gen4 AMD",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SchenkerTechnologiesGmbH"),
DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"), DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"),
}, },
}, },
{ } { }
}; };
static const struct dmi_system_id maingear_laptop[] = {
{
.ident = "MAINGEAR Vector Pro 2 15",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"),
DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-15A3070T"),
}
},
{
.ident = "MAINGEAR Vector Pro 2 17",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro Electronics Inc"),
DMI_MATCH(DMI_PRODUCT_NAME, "MG-VCP2-17A3070T"),
},
},
{ }
};
struct irq_override_cmp { struct irq_override_cmp {
const struct dmi_system_id *system; const struct dmi_system_id *system;
unsigned char irq; unsigned char irq;
...@@ -492,7 +509,8 @@ static const struct irq_override_cmp override_table[] = { ...@@ -492,7 +509,8 @@ static const struct irq_override_cmp override_table[] = {
{ asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false }, { asus_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
{ lenovo_laptop, 6, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, { lenovo_laptop, 6, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true },
{ lenovo_laptop, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true }, { lenovo_laptop, 10, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, true },
{ schenker_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true }, { tongfang_gm_rg, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
{ maingear_laptop, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
}; };
static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity, static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
......
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