[acpi_ibm] Add support for newer Thinkpad models
Add support for newer Thinkpad models with id LEN0268. Was tested on Thinkpad T480 and ThinkPad X1 Yoga 2nd gen. PR: 229120 Submitted by: Ali Abdallah <aliovx@gmail.com> MFC after: 1 week
This commit is contained in:
parent
0661cd79ca
commit
cc1ac7fcda
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346647
@ -349,7 +349,7 @@ static devclass_t acpi_ibm_devclass;
|
||||
DRIVER_MODULE(acpi_ibm, acpi, acpi_ibm_driver, acpi_ibm_devclass,
|
||||
0, 0);
|
||||
MODULE_DEPEND(acpi_ibm, acpi, 1, 1, 1);
|
||||
static char *ibm_ids[] = {"IBM0068", "LEN0068", NULL};
|
||||
static char *ibm_ids[] = {"IBM0068", "LEN0068", "LEN0268", NULL};
|
||||
|
||||
static void
|
||||
ibm_led(void *softc, int onoff)
|
||||
@ -428,9 +428,14 @@ static int
|
||||
acpi_ibm_attach(device_t dev)
|
||||
{
|
||||
int i;
|
||||
int hkey;
|
||||
struct acpi_ibm_softc *sc;
|
||||
char *maker, *product;
|
||||
devclass_t ec_devclass;
|
||||
ACPI_OBJECT_LIST input;
|
||||
ACPI_OBJECT params[1];
|
||||
ACPI_OBJECT out_obj;
|
||||
ACPI_BUFFER result;
|
||||
devclass_t ec_devclass;
|
||||
|
||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
|
||||
|
||||
@ -465,15 +470,42 @@ acpi_ibm_attach(device_t dev)
|
||||
"initialmask", CTLFLAG_RD,
|
||||
&sc->events_initialmask, 0, "Initial eventmask");
|
||||
|
||||
/* The availmask is the bitmask of supported events */
|
||||
if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
|
||||
IBM_NAME_EVENTS_AVAILMASK, &sc->events_availmask)))
|
||||
if (ACPI_SUCCESS (acpi_GetInteger(sc->handle, "MHKV", &hkey))) {
|
||||
device_printf(dev, "Firmware version is 0x%X\n", hkey);
|
||||
switch(hkey >> 8)
|
||||
{
|
||||
case 1:
|
||||
/* The availmask is the bitmask of supported events */
|
||||
if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
|
||||
IBM_NAME_EVENTS_AVAILMASK, &sc->events_availmask)))
|
||||
sc->events_availmask = 0xffffffff;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
result.Length = sizeof(out_obj);
|
||||
result.Pointer = &out_obj;
|
||||
params[0].Type = ACPI_TYPE_INTEGER;
|
||||
params[0].Integer.Value = 1;
|
||||
input.Pointer = params;
|
||||
input.Count = 1;
|
||||
|
||||
sc->events_availmask = 0xffffffff;
|
||||
|
||||
if (ACPI_SUCCESS(AcpiEvaluateObject (sc->handle,
|
||||
IBM_NAME_EVENTS_AVAILMASK, &input, &result)))
|
||||
sc->events_availmask = out_obj.Integer.Value;
|
||||
break;
|
||||
default:
|
||||
device_printf(dev, "Unknown firmware version 0x%x\n", hkey);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
sc->events_availmask = 0xffffffff;
|
||||
|
||||
SYSCTL_ADD_UINT(sc->sysctl_ctx,
|
||||
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
|
||||
"availmask", CTLFLAG_RD,
|
||||
&sc->events_availmask, 0, "Mask of supported events");
|
||||
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
|
||||
"availmask", CTLFLAG_RD,
|
||||
&sc->events_availmask, 0, "Mask of supported events");
|
||||
}
|
||||
|
||||
/* Hook up proc nodes */
|
||||
|
Loading…
Reference in New Issue
Block a user