Skip to content
Permalink
Browse files

Add support to ACPI-hinted iicbus(4) driver (not publically available…

… yet)

It can be enabled with adding of -DHAVE_ACPI_IICBUS to CFLAGS
  • Loading branch information...
wulf7 committed Aug 11, 2019
1 parent 36b1184 commit 6f5c3d3eb008848ab9d18e1dcf8fd35ca80e517e
Showing with 22 additions and 0 deletions.
  1. +18 −0 iichid.c
  2. +2 −0 iichid.h
  3. +2 −0 imt.c
@@ -100,6 +100,7 @@ acpi_is_iichid(ACPI_HANDLE handle)
return (false);
}

#ifndef HAVE_ACPI_IICBUS
static ACPI_STATUS
iichid_addr_cb(ACPI_RESOURCE *res, void *context)
{
@@ -127,6 +128,7 @@ acpi_get_iichid_addr(ACPI_HANDLE handle)

return (addr);
}
#endif /* HAVE_ACPI_IICBUS */

static int
iichid_get_hw(ACPI_HANDLE handle, struct iichid_hw *hw)
@@ -216,6 +218,7 @@ iichid_set_acpi_power(ACPI_HANDLE handle, int state)
return (AcpiEvaluateObject(method_handle, NULL, NULL, NULL));
}

#ifndef HAVE_ACPI_IICBUS
static ACPI_STATUS
iichid_get_handle_cb(ACPI_HANDLE handle, UINT32 level, void *context,
void **retval)
@@ -252,6 +255,7 @@ iichid_get_handle(device_t dev)

return (dev_handle);
}
#endif /* HAVE_ACPI_IICBUS */

static int
iichid_fetch_buffer(device_t dev, void* cmd, int cmdlen, void *buf, int buflen)
@@ -812,17 +816,26 @@ iichid_probe(device_t dev)
sc->probe_done = true;
sc->probe_result = ENXIO;

if (acpi_disabled("iichid"))
return (ENXIO);
if (addr == 0)
return (ENXIO);

sc->dev = dev;
sc->ibuf = NULL;

/* Fetch hardware settings from ACPI */
#ifdef HAVE_ACPI_IICBUS
handle = acpi_get_handle(dev);
#else
handle = iichid_get_handle(dev);
#endif
if (handle == NULL)
return (ENXIO);

if (!acpi_is_iichid(handle))
return (ENXIO);

if (ACPI_FAILURE(iichid_get_hw(handle, &sc->hw)))
return (ENXIO);

@@ -904,6 +917,7 @@ iichid_detach(device_t dev)
return (0);
}

#ifndef HAVE_ACPI_IICBUS
static ACPI_STATUS
iichid_identify_cb(ACPI_HANDLE handle, UINT32 level, void *context,
void **status)
@@ -977,6 +991,7 @@ iichid_identify(driver_t *driver, device_t parent)
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ctrl_handle,
1, iichid_identify_cb, NULL, parent, NULL);
}
#endif /* HAVE_ACPI_IICBUS */

int
iichid_suspend(device_t dev)
@@ -1030,6 +1045,7 @@ MODULE_DEPEND(iichid, acpi, 1, 1, 1);
MODULE_DEPEND(iichid, usb, 1, 1, 1);
MODULE_VERSION(iichid, 1);

#ifndef HAVE_ACPI_IICBUS
/*
* Dummy ACPI driver. Used as bus resources holder for iichid.
*/
@@ -1088,3 +1104,5 @@ static driver_t acpi_iichid_driver = {
DRIVER_MODULE(acpi_iichid, acpi, acpi_iichid_driver, acpi_iichid_devclass, NULL, 0);
MODULE_DEPEND(acpi_iichid, acpi, 1, 1, 1);
MODULE_VERSION(acpi_iichid, 1);

#endif /* HAVE_ACPI_IICBUS */
@@ -140,7 +140,9 @@ int iichid_get_report(device_t, void *, int, uint8_t, uint8_t);
int iichid_set_report(device_t, void *, int, uint8_t, uint8_t);

/* Newbus device method stubs */
#ifndef HAVE_ACPI_IICBUS
device_identify_t iichid_identify;
#endif
device_probe_t iichid_probe;
device_attach_t iichid_attach;
device_detach_t iichid_detach;
2 imt.c
@@ -265,7 +265,9 @@ static devclass_t imt_devclass;

static device_method_t imt_methods[] = {

#ifndef HAVE_ACPI_IICBUS
DEVMETHOD(device_identify, iichid_identify),
#endif
DEVMETHOD(device_probe, imt_probe),
DEVMETHOD(device_attach, imt_attach),
DEVMETHOD(device_detach, imt_detach),

0 comments on commit 6f5c3d3

Please sign in to comment.
You can’t perform that action at this time.