FreeBSD kernel IICBUS device code
|
#include <sys/cdefs.h>
#include "opt_hid.h"
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/callout.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/rman.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <machine/resource.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <dev/acpica/acpivar.h>
#include <dev/evdev/input.h>
#include <dev/hid/hid.h>
#include <dev/hid/hidquirk.h>
#include <dev/iicbus/iic.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>
#include "hid_if.h"
Go to the source code of this file.
Data Structures | |
struct | i2c_hid_desc |
struct | iichid_id |
struct | iichid_softc |
Macros | |
#define | DPRINTFN(...) do {} while (0) |
#define | DPRINTF(...) do {} while (0) |
#define | IICHID_SIZE_MAX (UINT16_MAX - 2) |
#define | I2C_HID_POWER_ON 0x0 |
#define | I2C_HID_POWER_OFF 0x1 |
#define | IICHID_SAMPLING_RATE_FAST 60 |
#define | IICHID_SAMPLING_RATE_SLOW 10 |
#define | IICHID_SAMPLING_HYSTERESIS 1 |
#define | IICHID_REG_NONE -1 |
#define | IICHID_REG_ACPI (UINT16_MAX + 1) |
#define | IICHID_REG_ELAN 0x0001 |
#define | suspend_thread taskqueue_thread |
Typedefs | |
typedef hid_size_t | iichid_size_t |
Enumerations | |
enum | { I2C_HID_CMD_DESCR = 0x0 , I2C_HID_CMD_RESET = 0x1 , I2C_HID_CMD_GET_REPORT = 0x2 , I2C_HID_CMD_SET_REPORT = 0x3 , I2C_HID_CMD_GET_IDLE = 0x4 , I2C_HID_CMD_SET_IDLE = 0x5 , I2C_HID_CMD_GET_PROTO = 0x6 , I2C_HID_CMD_SET_PROTO = 0x7 , I2C_HID_CMD_SET_POWER = 0x8 } |
enum | iichid_powerstate_how { IICHID_PS_NULL , IICHID_PS_ON , IICHID_PS_OFF } |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | iichid_suspend_task (void *, int) |
static int | acpi_is_iichid (ACPI_HANDLE handle) |
static ACPI_STATUS | iichid_get_config_reg (ACPI_HANDLE handle, uint16_t *config_reg) |
static int | iichid_cmd_read (struct iichid_softc *sc, void *buf, iichid_size_t maxlen, iichid_size_t *actual_len) |
static int | iichid_cmd_write (struct iichid_softc *sc, const void *buf, iichid_size_t len) |
static int | iichid_cmd_get_hid_desc (struct iichid_softc *sc, uint16_t config_reg, struct i2c_hid_desc *hid_desc) |
static int | iichid_set_power (struct iichid_softc *sc, uint8_t param) |
static int | iichid_reset (struct iichid_softc *sc) |
static int | iichid_cmd_get_report_desc (struct iichid_softc *sc, void *buf, iichid_size_t len) |
static int | iichid_cmd_get_report (struct iichid_softc *sc, void *buf, iichid_size_t maxlen, iichid_size_t *actual_len, uint8_t type, uint8_t id) |
static int | iichid_cmd_set_report (struct iichid_softc *sc, const void *buf, iichid_size_t len, uint8_t type, uint8_t id) |
static void | iichid_intr (void *context) |
static int | iichid_set_power_state (struct iichid_softc *sc, enum iichid_powerstate_how how_open, enum iichid_powerstate_how how_suspend) |
static int | iichid_setup_interrupt (struct iichid_softc *sc) |
static void | iichid_teardown_interrupt (struct iichid_softc *sc) |
static void | iichid_intr_setup (device_t dev, hid_intr_t intr, void *context, struct hid_rdesc_info *rdesc) |
static void | iichid_intr_unsetup (device_t dev) |
static int | iichid_intr_start (device_t dev) |
static int | iichid_intr_stop (device_t dev) |
static void | iichid_intr_poll (device_t dev) |
static int | iichid_get_rdesc (device_t dev, void *buf, hid_size_t len) |
static int | iichid_read (device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen) |
static int | iichid_write (device_t dev, const void *buf, hid_size_t len) |
static int | iichid_get_report (device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen, uint8_t type, uint8_t id) |
static int | iichid_set_report (device_t dev, const void *buf, hid_size_t len, uint8_t type, uint8_t id) |
static int | iichid_set_idle (device_t dev, uint16_t duration, uint8_t id) |
static int | iichid_set_protocol (device_t dev, uint16_t protocol) |
static int | iichid_ioctl (device_t dev, unsigned long cmd, uintptr_t data) |
static int | iichid_fill_device_info (struct i2c_hid_desc *desc, ACPI_HANDLE handle, struct hid_device_info *hw) |
static int | iichid_probe (device_t dev) |
static int | iichid_attach (device_t dev) |
static int | iichid_detach (device_t dev) |
static int | iichid_suspend (device_t dev) |
static int | iichid_resume (device_t dev) |
DRIVER_MODULE (iichid, iicbus, iichid_driver, iichid_devclass, NULL, 0) | |
MODULE_DEPEND (iichid, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER) | |
MODULE_DEPEND (iichid, acpi, 1, 1, 1) | |
MODULE_DEPEND (iichid, hid, 1, 1, 1) | |
MODULE_DEPEND (iichid, hidbus, 1, 1, 1) | |
MODULE_VERSION (iichid, 1) | |
IICBUS_ACPI_PNP_INFO (iichid_ids) | |
Variables | |
struct i2c_hid_desc | __packed |
static const struct iichid_id | iichid_ids [] |
static device_probe_t | iichid_probe |
static device_attach_t | iichid_attach |
static device_detach_t | iichid_detach |
static device_resume_t | iichid_resume |
static device_suspend_t | iichid_suspend |
static devclass_t | iichid_devclass |
static device_method_t | iichid_methods [] |
static driver_t | iichid_driver |
#define suspend_thread taskqueue_thread |
typedef hid_size_t iichid_size_t |
anonymous enum |
__FBSDID | ( | "$FreeBSD$" | ) |
|
inlinestatic |
Definition at line 209 of file iichid.c.
References iichid_id::id, iichid_ids, IICHID_REG_NONE, and iichid_id::reg.
Referenced by iichid_probe().
DRIVER_MODULE | ( | iichid | , |
iicbus | , | ||
iichid_driver | , | ||
iichid_devclass | , | ||
NULL | , | ||
0 | |||
) |
IICBUS_ACPI_PNP_INFO | ( | iichid_ids | ) |
|
static |
Definition at line 1087 of file iichid.c.
References iichid_softc::dev, dev, DPRINTF, iichid_softc::hw, I2C_HID_POWER_OFF, I2C_HID_POWER_ON, iichid_cmd_read(), iichid_detach, iichid_reset(), IICHID_SAMPLING_HYSTERESIS, IICHID_SAMPLING_RATE_FAST, IICHID_SAMPLING_RATE_SLOW, iichid_set_power(), iichid_setup_interrupt(), iichid_suspend_task(), iichid_softc::irq_res, iichid_softc::irq_rid, iichid_softc::power_on, and iichid_softc::suspend_task.
|
static |
Definition at line 337 of file iichid.c.
References iichid_softc::addr, iichid_softc::dev, DPRINTF, IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, iicbus_transfer(), and msgs.
Referenced by iichid_probe().
|
static |
Definition at line 415 of file iichid.c.
References iichid_softc::addr, buf, iichid_softc::desc, iichid_softc::dev, DPRINTF, I2C_HID_CMD_GET_REPORT, IIC_M_NOSTART, IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, iicbus_transfer(), msgs, i2c_hid_desc::wCommandRegister, and i2c_hid_desc::wDataRegister.
Referenced by iichid_get_report().
|
static |
Definition at line 392 of file iichid.c.
References iichid_softc::addr, buf, iichid_softc::desc, iichid_softc::dev, DPRINTF, IIC_M_NOSTOP, IIC_M_RD, IIC_M_WR, iicbus_transfer(), len, msgs, and i2c_hid_desc::wReportDescRegister.
Referenced by iichid_get_rdesc().
|
static |
Definition at line 266 of file iichid.c.
References iichid_softc::addr, iic_msg::buf, buf, iichid_softc::dev, DPRINTF, DPRINTFN, IIC_M_NOSTART, IIC_M_NOSTOP, IIC_M_RD, iicbus_transfer(), len, and msgs.
Referenced by iichid_attach(), iichid_intr(), iichid_intr_poll(), and iichid_read().
|
static |
Definition at line 485 of file iichid.c.
References iichid_softc::addr, buf, iichid_softc::desc, iichid_softc::dev, DPRINTF, I2C_HID_CMD_SET_REPORT, IIC_M_NOSTART, IIC_M_NOSTOP, IIC_M_WR, iicbus_transfer(), len, msgs, i2c_hid_desc::wCommandRegister, and i2c_hid_desc::wDataRegister.
Referenced by iichid_set_report().
|
static |
Definition at line 314 of file iichid.c.
References iichid_softc::desc, len, and i2c_hid_desc::wOutputRegister.
Referenced by iichid_write().
|
static |
Definition at line 1198 of file iichid.c.
References dev, iichid_teardown_interrupt(), iichid_softc::irq_res, and iichid_softc::irq_rid.
|
static |
Definition at line 980 of file iichid.c.
References iichid_softc::desc, iichid_softc::hw, i2c_hid_desc::wMaxOutputLength, i2c_hid_desc::wOutputRegister, i2c_hid_desc::wProductID, i2c_hid_desc::wReportDescLength, i2c_hid_desc::wVendorID, and i2c_hid_desc::wVersionID.
Referenced by iichid_probe().
|
static |
Definition at line 236 of file iichid.c.
Referenced by iichid_probe().
|
static |
Definition at line 881 of file iichid.c.
References buf, dev, DPRINTF, iic2errno(), iichid_cmd_get_report_desc(), and len.
|
static |
Definition at line 925 of file iichid.c.
References buf, dev, iic2errno(), iichid_cmd_get_report(), and IICHID_SIZE_MAX.
|
static |
Definition at line 566 of file iichid.c.
References iichid_softc::dev, DPRINTF, IIC_DONTWAIT, iicbus_release_bus(), iicbus_request_bus(), iichid_cmd_read(), iichid_softc::intr_buf, iichid_softc::intr_bufsize, iichid_softc::intr_ctx, iichid_softc::intr_handler, and iichid_softc::power_on.
Referenced by iichid_setup_interrupt().
|
static |
Definition at line 865 of file iichid.c.
References dev, iichid_cmd_read(), iichid_softc::intr_buf, iichid_softc::intr_bufsize, iichid_softc::intr_ctx, and iichid_softc::intr_handler.
|
static |
Definition at line 794 of file iichid.c.
References iichid_softc::dev, dev, IICHID_SIZE_MAX, intr, iichid_softc::intr_buf, iichid_softc::intr_bufsize, iichid_softc::intr_ctx, and iichid_softc::intr_handler.
|
static |
Definition at line 835 of file iichid.c.
References dev, DPRINTF, IICHID_PS_NULL, IICHID_PS_ON, and iichid_set_power_state().
|
static |
Definition at line 847 of file iichid.c.
References dev, DPRINTF, IICHID_PS_NULL, IICHID_PS_OFF, and iichid_set_power_state().
|
static |
Definition at line 823 of file iichid.c.
References dev, and iichid_softc::intr_buf.
|
static |
Definition at line 962 of file iichid.c.
References data, dev, I2CRDWR, iic2errno(), iicbus_transfer(), msgs, and nmsgs.
|
static |
Definition at line 1015 of file iichid.c.
References acpi_is_iichid(), iichid_softc::addr, i2c_hid_desc::bcdVersion, buf, iichid_softc::desc, iichid_softc::dev, dev, DPRINTF, iichid_softc::hw, iichid_cmd_get_hid_desc(), iichid_fill_device_info(), iichid_get_config_reg(), IICHID_REG_ACPI, IICHID_REG_NONE, iichid_softc::probe_done, iichid_softc::probe_result, and i2c_hid_desc::wHIDDescLength.
|
static |
Definition at line 895 of file iichid.c.
References buf, iichid_softc::dev, dev, iic2errno(), IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), iichid_cmd_read(), and IICHID_SIZE_MAX.
|
static |
Definition at line 378 of file iichid.c.
References iichid_softc::desc, I2C_HID_CMD_RESET, and i2c_hid_desc::wCommandRegister.
Referenced by iichid_attach().
|
static |
Definition at line 1270 of file iichid.c.
References dev, DPRINTF, IICHID_PS_NULL, IICHID_PS_ON, iichid_set_power_state(), and iichid_setup_interrupt().
|
static |
|
static |
Definition at line 364 of file iichid.c.
References iichid_softc::desc, I2C_HID_CMD_SET_POWER, and i2c_hid_desc::wCommandRegister.
Referenced by iichid_attach(), and iichid_set_power_state().
|
static |
Definition at line 609 of file iichid.c.
References iichid_softc::dev, I2C_HID_POWER_OFF, I2C_HID_POWER_ON, IIC_INTRWAIT, IIC_WAIT, iicbus_release_bus(), iicbus_request_bus(), IICHID_PS_NULL, IICHID_PS_OFF, IICHID_PS_ON, iichid_set_power(), iichid_softc::intr_handler, iichid_softc::open, iichid_softc::power_on, and iichid_softc::suspend.
Referenced by iichid_intr_start(), iichid_intr_stop(), iichid_resume(), and iichid_suspend().
|
static |
|
static |
Definition at line 938 of file iichid.c.
References buf, dev, iic2errno(), iichid_cmd_set_report(), IICHID_SIZE_MAX, and len.
|
static |
Definition at line 677 of file iichid.c.
References iichid_softc::dev, DPRINTF, iichid_intr(), iichid_softc::irq_cookie, and iichid_softc::irq_res.
Referenced by iichid_attach(), and iichid_resume().
|
static |
Definition at line 1228 of file iichid.c.
References dev, DPRINTF, IICHID_PS_NULL, IICHID_PS_OFF, iichid_set_power_state(), iichid_softc::suspend_task, and suspend_thread.
|
static |
Definition at line 1220 of file iichid.c.
References iichid_teardown_interrupt().
Referenced by iichid_attach().
|
static |
Definition at line 692 of file iichid.c.
References iichid_softc::dev, iichid_softc::irq_cookie, and iichid_softc::irq_res.
Referenced by iichid_detach(), and iichid_suspend_task().
|
static |
Definition at line 914 of file iichid.c.
References buf, dev, iic2errno(), iichid_cmd_write(), IICHID_SIZE_MAX, and len.
MODULE_DEPEND | ( | iichid | , |
acpi | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | iichid | , |
hid | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | iichid | , |
hidbus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | iichid | , |
iicbus | , | ||
IICBUS_MINVER | , | ||
IICBUS_PREFVER | , | ||
IICBUS_MAXVER | |||
) |
MODULE_VERSION | ( | iichid | , |
1 | |||
) |
struct i2c_hid_desc __packed |
|
static |
Definition at line 196 of file iichid.c.
Referenced by iichid_attach().
|
static |
|
static |
Referenced by acpi_is_iichid().
|
static |