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]
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
34 #include <sys/types.h>
38 #include <sys/modctl.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>
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.
67 enum acpi_drv_type type
;
68 int index
; /* device index */
73 * hotkey driver soft-state structure
75 typedef struct hotkey_drv
{
76 struct acpi_drv_dev dev
;
78 void *private; /* Vendor specific structure */
79 kmutex_t
*hotkey_lock
;
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
;
91 * Collection of vendor specific hotkey support
93 struct vendor_hotkey_drv
{
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
,
122 int acpi_video_ioctl(void *vidp
, int cmd
, intptr_t arg
, int mode
, cred_t
*cr
,
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 *);
132 #endif /* _HOTKEY_DRV_H */