#ifndef _ATOPCASE_VAR_H_
#define _ATOPCASE_VAR_H_
#include "opt_hid.h"
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/taskqueue.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <dev/acpica/acpivar.h>
#include <dev/backlight/backlight.h>
#include <dev/hid/hid.h>
struct atopcase_child {
device_t hidbus;
struct hid_device_info hw;
uint8_t device;
uint8_t name[80];
uint8_t rdesc[ATOPCASE_MSG_SIZE];
size_t rdesc_len;
hid_intr_t *intr_handler;
void *intr_ctx;
bool open;
};
struct atopcase_softc {
device_t sc_dev;
ACPI_HANDLE sc_handle;
int sc_gpe_bit;
int sc_irq_rid;
struct resource *sc_irq_res;
void *sc_irq_ih;
volatile unsigned int sc_intr_cnt;
struct timeout_task sc_task;
struct taskqueue *sc_tq;
bool sc_booted;
bool sc_wait_for_status;
uint8_t sc_hid[HID_PNP_ID_SIZE];
uint8_t sc_vendor[80];
uint8_t sc_product[80];
uint8_t sc_serial[80];
uint16_t sc_vid;
uint16_t sc_pid;
uint16_t sc_ver;
struct sx sc_write_sx;
struct sx sc_sx;
struct mtx sc_mtx;
struct atopcase_child sc_kb;
struct atopcase_child sc_tp;
struct cdev *sc_backlight;
uint32_t sc_backlight_level;
uint16_t sc_msg_len;
uint8_t sc_msg[ATOPCASE_MSG_SIZE];
struct atopcase_packet sc_buf;
struct atopcase_packet sc_junk;
};
#ifdef HID_DEBUG
enum atopcase_log_level {
ATOPCASE_LLEVEL_DISABLED = 0,
ATOPCASE_LLEVEL_INFO,
ATOPCASE_LLEVEL_DEBUG,
ATOPCASE_LLEVEL_TRACE,
};
extern enum atopcase_log_level atopcase_debug;
#endif
int atopcase_receive_packet(struct atopcase_softc *);
int atopcase_init(struct atopcase_softc *);
int atopcase_destroy(struct atopcase_softc *sc);
int atopcase_intr(struct atopcase_softc *);
void atopcase_intr_setup(device_t, device_t, hid_intr_t, void *,
struct hid_rdesc_info *);
void atopcase_intr_unsetup(device_t, device_t);
int atopcase_intr_start(device_t, device_t);
int atopcase_intr_stop(device_t, device_t);
void atopcase_intr_poll(device_t, device_t);
int atopcase_get_rdesc(device_t, device_t, void *, hid_size_t);
int atopcase_set_report(device_t, device_t, const void *, hid_size_t, uint8_t,
uint8_t);
int atopcase_backlight_update_status(device_t, struct backlight_props *);
int atopcase_backlight_get_status(device_t, struct backlight_props *);
int atopcase_backlight_get_info(device_t, struct backlight_info *);
#endif