docs/how-to-build.md: use proper markup for directory names
[unleashed/tickless.git] / include / sys / hotkey_drv.h
blobdc036eefcf2c791efb0731641d38bee6c2d9951c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _HOTKEY_DRV_H
28 #define _HOTKEY_DRV_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include <sys/types.h>
35 #include <sys/conf.h>
36 #include <sys/stat.h>
37 #include <sys/note.h>
38 #include <sys/modctl.h>
39 #include <sys/ddi.h>
40 #include <sys/sunddi.h>
41 #include <sys/acpi/acpi.h>
42 #include <sys/acpica.h>
43 #include <sys/sysevent/eventdefs.h>
44 #include <sys/acpi_drv.h>
47 #define ID_LEN 9
49 struct acpi_drv_dev {
50 ACPI_HANDLE hdl;
51 char hid[ID_LEN]; /* ACPI HardwareId */
52 char uid[ID_LEN]; /* ACPI UniqueId */
53 ACPI_INTEGER adr; /* Bus device Id */
54 int valid; /* the device state is valid */
57 * Unlike most other devices, when a battery is inserted or
58 * removed from the system, the device itself(the battery bay)
59 * is still considered to be present in the system.
61 * Value:
62 * 0 -- Off-line
63 * 1 -- On-line
64 * -1 -- Unknown
66 int present;
67 enum acpi_drv_type type;
68 int index; /* device index */
69 int minor;
73 * hotkey driver soft-state structure
75 typedef struct hotkey_drv {
76 struct acpi_drv_dev dev;
77 dev_info_t *dip;
78 void *private; /* Vendor specific structure */
79 kmutex_t *hotkey_lock;
80 int hotkey_method;
81 int modid;
82 int (*vendor_ioctl)(struct hotkey_drv *,
83 int cmd, intptr_t arg, int mode,
84 cred_t *cr, int *rval);
85 int (*vendor_fini)(struct hotkey_drv *);
86 boolean_t check_acpi_video;
87 void *acpi_video;
88 } hotkey_drv_t;
91 * Collection of vendor specific hotkey support
93 struct vendor_hotkey_drv {
94 const char *vid;
95 const char *module;
96 boolean_t enable;
99 #define HOTKEY_DRV_OK 0
100 #define HOTKEY_DRV_ERR -1
101 #define HOTKEY_DBG_NOTICE 0x8000
102 #define HOTKEY_DBG_WARN 0x0001
104 #define HOTKEY_METHOD_NONE 0x0
105 #define HOTKEY_METHOD_VENDOR 0x1
106 #define HOTKEY_METHOD_ACPI_VIDEO 0x2
107 #define HOTKEY_METHOD_MISC (HOTKEY_METHOD_VENDOR | \
108 HOTKEY_METHOD_ACPI_VIDEO)
110 * Inter-source-file linkage ...
112 extern struct hotkey_drv acpi_hotkey;
113 extern int hotkey_drv_debug;
114 int acpi_drv_set_int(ACPI_HANDLE dev, char *method, uint32_t aint);
115 void acpi_drv_gen_sysevent(struct acpi_drv_dev *devp, char *ev, uint32_t val);
116 int acpi_drv_dev_init(struct acpi_drv_dev *p);
118 int hotkey_init(hotkey_drv_t *htkp);
119 int hotkey_fini(hotkey_drv_t *htkp);
120 int acpi_drv_hotkey_ioctl(int cmd, intptr_t arg, int mode, cred_t *cr,
121 int *rval);
122 int acpi_video_ioctl(void *vidp, int cmd, intptr_t arg, int mode, cred_t *cr,
123 int *rval);
124 int hotkey_brightness_inc(hotkey_drv_t *htkp);
125 int hotkey_brightness_dec(hotkey_drv_t *htkp);
126 void hotkey_drv_gen_sysevent(dev_info_t *, char *);
128 #ifdef __cplusplus
130 #endif
132 #endif /* _HOTKEY_DRV_H */