Skip to content
Permalink
Browse files

Add dwiic, a driver for the Synopsys DesignWare i2c controller found

on the Samsung ATIV Book 9 laptop.  This initial version only
supports ACPI config/attachment.

Add ihidev, a HID-over-i2c driver largely based on uhidev.  dwiic
handles attaching ihidev devices found in ACPI.

Add ims, a HID-over-i2c mouse/trackpad driver to get basic cursor
and button functionality from HID-compliant i2c trackpads.

ok kettenis deraadt
  • Loading branch information...
jcs committed Jan 12, 2016
1 parent 8c25cac commit b037e2e685617ea799730cc90b409f2ecfb7e368
@@ -1,4 +1,4 @@
# $OpenBSD: GENERIC,v 1.410 2016/01/11 22:06:50 kettenis Exp $
# $OpenBSD: GENERIC,v 1.411 2016/01/12 01:11:15 jcs Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -125,6 +125,8 @@ nviic* at pci? # NVIDIA nForce2/3/4 SMBus controller
iic* at nviic?
amdpm* at pci? # AMD-7xx/8111 and NForce SMBus controller
iic* at amdpm?
dwiic* at acpi? # DesignWare Synopsys i2c controller
iic* at dwiic?

itherm* at pci? # Intel 3400 Thermal Sensor
adc* at iic? # Analog Devices AD7416/AD7417/7418
@@ -148,6 +150,9 @@ spdmem* at iic? # SPD memory eeproms
sdtemp* at iic? # SO-DIMM (JC-42.4) temperature
wbng* at iic? # Winbond W83793G
nvt* at iic? # Novoton W83795G
ihidev* at iic? # HID-over-i2c
ims* at ihidev? # i2c mouse/trackpad
wsmouse* at ims? mux 0

skgpio0 at isa? port 0x680 # Soekris net6501 GPIO and LEDs
gpio* at skgpio?
@@ -1,4 +1,4 @@
/* $OpenBSD: acpi.c,v 1.300 2016/01/11 22:06:00 kettenis Exp $ */
/* $OpenBSD: acpi.c,v 1.301 2016/01/12 01:11:15 jcs Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2659,15 +2659,12 @@ acpi_foundsony(struct aml_node *node, void *arg)
#ifndef SMALL_KERNEL

int
acpi_foundhid(struct aml_node *node, void *arg)
acpi_parsehid(struct aml_node *node, void *arg, char *outcdev, char *outdev,
size_t devlen)
{
struct acpi_softc *sc = (struct acpi_softc *)arg;
struct device *self = (struct device *)arg;
const char *dev;
char cdev[16];
struct aml_value res;
struct acpi_attach_args aaa;
int i;
const char *dev;

/* NB aml_eisaid returns a static buffer, this must come first */
if (aml_evalname(acpi_softc, node->parent, "_CID", 0, NULL, &res) == 0) {
@@ -2682,17 +2679,17 @@ acpi_foundhid(struct aml_node *node, void *arg)
dev = "unknown";
break;
}
strlcpy(cdev, dev, sizeof(cdev));
strlcpy(outcdev, dev, devlen);
aml_freevalue(&res);
dnprintf(10, "compatible with device: %s\n", cdev);

dnprintf(10, "compatible with device: %s\n", outcdev);
} else {
cdev[0] = '\0';
outcdev[0] = '\0';
}

dnprintf(10, "found hid device: %s ", node->parent->name);
if (aml_evalnode(sc, node, 0, NULL, &res) != 0)
return 0;
return (1);

switch (res.type) {
case AML_OBJTYPE_STRING:
@@ -2707,36 +2704,63 @@ acpi_foundhid(struct aml_node *node, void *arg)
}
dnprintf(10, " device: %s\n", dev);

strlcpy(outdev, dev, devlen);

aml_freevalue(&res);

return (0);
}

int
acpi_foundhid(struct aml_node *node, void *arg)
{
struct acpi_softc *sc = (struct acpi_softc *)arg;
struct device *self = (struct device *)arg;
char cdev[16];
char dev[16];
struct acpi_attach_args aaa;
int i;

if (acpi_parsehid(node, arg, cdev, dev, 16) != 0)
return (0);

memset(&aaa, 0, sizeof(aaa));
aaa.aaa_iot = sc->sc_iot;
aaa.aaa_memt = sc->sc_memt;
aaa.aaa_node = node->parent;
aaa.aaa_dev = dev;

if (!strcmp(dev, ACPI_DEV_AC))
if (!strcmp(dev, ACPI_DEV_AC)) {
aaa.aaa_name = "acpiac";
else if (!strcmp(dev, ACPI_DEV_CMB))
} else if (!strcmp(dev, ACPI_DEV_CMB)) {
aaa.aaa_name = "acpibat";
else if (!strcmp(dev, ACPI_DEV_LD) ||
} else if (!strcmp(dev, ACPI_DEV_LD) ||
!strcmp(dev, ACPI_DEV_PBD) ||
!strcmp(dev, ACPI_DEV_SBD))
!strcmp(dev, ACPI_DEV_SBD)) {
aaa.aaa_name = "acpibtn";
else if (!strcmp(dev, ACPI_DEV_ASUS) || !strcmp(dev, ACPI_DEV_ASUS1)) {
} else if (!strcmp(dev, ACPI_DEV_ASUS) ||
!strcmp(dev, ACPI_DEV_ASUS1)) {
aaa.aaa_name = "acpiasus";
acpi_asus_enabled = 1;
} else if (!strcmp(dev, ACPI_DEV_IBM) ||
!strcmp(dev, ACPI_DEV_LENOVO)) {
aaa.aaa_name = "acpithinkpad";
acpi_thinkpad_enabled = 1;
} else if (!strcmp(dev, ACPI_DEV_ASUSAIBOOSTER))
} else if (!strcmp(dev, ACPI_DEV_ASUSAIBOOSTER)) {
aaa.aaa_name = "aibs";
else if (!strcmp(dev, ACPI_DEV_TOSHIBA_LIBRETTO) ||
} else if (!strcmp(dev, ACPI_DEV_TOSHIBA_LIBRETTO) ||
!strcmp(dev, ACPI_DEV_TOSHIBA_DYNABOOK) ||
!strcmp(dev, ACPI_DEV_TOSHIBA_SPA40)) {
aaa.aaa_name = "acpitoshiba";
acpi_toshiba_enabled = 1;
} else if (!strcmp(dev, "80860F14") || !strcmp(dev, "PNP0FFF"))
} else if (!strcmp(dev, "80860F14") || !strcmp(dev, "PNP0FFF")) {
aaa.aaa_name = "sdhc";
} else if (!strcmp(dev, ACPI_DEV_DWIIC1) ||
!strcmp(dev, ACPI_DEV_DWIIC2) ||
!strcmp(dev, ACPI_DEV_DWIIC3) ||
!strcmp(dev, ACPI_DEV_DWIIC4)) {
aaa.aaa_name = "dwiic";
}

if (!strcmp(cdev, ACPI_DEV_MOUSE)) {
for (i = 0; i < nitems(sbtn_pnp); i++) {
@@ -2750,9 +2774,7 @@ acpi_foundhid(struct aml_node *node, void *arg)
if (aaa.aaa_name)
config_found(self, &aaa, acpi_print);

aml_freevalue(&res);

return 0;
return (0);
}

int
@@ -1,4 +1,4 @@
/* $OpenBSD: acpireg.h,v 1.31 2016/01/09 11:00:01 kettenis Exp $ */
/* $OpenBSD: acpireg.h,v 1.32 2016/01/12 01:11:15 jcs Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
@@ -730,6 +730,8 @@ struct acpi_ivrs {
#define ACPI_DEV_LD "PNP0C0D" /* Lid Device */
#define ACPI_DEV_SBD "PNP0C0E" /* Sleep Button Device */
#define ACPI_DEV_PILD "PNP0C0F" /* PCI Interrupt Link Device */
#define ACPI_DEV_HIDI2C "PNP0C50" /* HID over I2C device */
#define ACPI_DEV_HIDI2C2 "ACPI0C50" /* HID over I2C device */
#define ACPI_DEV_MEMD "PNP0C80" /* Memory Device */
#define ACPI_DEV_MOUSE "PNP0F13" /* PS/2 Mouse */
#define ACPI_DEV_SHC "ACPI0001" /* SMBus 1.0 Host Controller */
@@ -754,4 +756,10 @@ struct acpi_ivrs {
#define ACPI_DEV_TOSHIBA_DYNABOOK "TOS6207" /* Toshiba Dynabook support */
#define ACPI_DEV_TOSHIBA_SPA40 "TOS6208" /* Toshiba SPA40 support */

/* Synopsys DesignWare I2C controllers */
#define ACPI_DEV_DWIIC1 "INT33C2"
#define ACPI_DEV_DWIIC2 "INT33C3"
#define ACPI_DEV_DWIIC3 "INT3432"
#define ACPI_DEV_DWIIC4 "INT3433"

#endif /* !_DEV_ACPI_ACPIREG_H_ */
@@ -1,4 +1,4 @@
/* $OpenBSD: acpivar.h,v 1.81 2016/01/10 16:59:41 kettenis Exp $ */
/* $OpenBSD: acpivar.h,v 1.82 2016/01/12 01:11:15 jcs Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -341,7 +341,8 @@ void acpi_write_pmreg(struct acpi_softc *, int, int, int);
void acpi_poll(void *);
void acpi_sleep(int, char *);

int acpi_matchhids(struct acpi_attach_args *, const char *[], const char *);
int acpi_matchhids(struct acpi_attach_args *, const char *[], const char *);
int acpi_parsehid(struct aml_node *, void *, char *, char *, size_t);

int acpi_record_event(struct acpi_softc *, u_int);

0 comments on commit b037e2e

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