thinkpad_acpi.h

来自「linux 内核源代码」· C头文件 代码 · 共 607 行 · 第 1/2 页

H
607
字号
/* * Beep subdriver */static acpi_handle beep_handle;static int beep_read(char *p);static int beep_write(char *buf);/* * Bluetooth subdriver */enum {	/* ACPI GBDC/SBDC bits */	TP_ACPI_BLUETOOTH_HWPRESENT	= 0x01,	/* Bluetooth hw available */	TP_ACPI_BLUETOOTH_RADIOSSW	= 0x02,	/* Bluetooth radio enabled */	TP_ACPI_BLUETOOTH_UNK		= 0x04,	/* unknown function */};static int bluetooth_init(struct ibm_init_struct *iibm);static int bluetooth_get_radiosw(void);static int bluetooth_set_radiosw(int radio_on);static int bluetooth_read(char *p);static int bluetooth_write(char *buf);/* * Brightness (backlight) subdriver */#define TPACPI_BACKLIGHT_DEV_NAME "thinkpad_screen"static struct backlight_device *ibm_backlight_device;static int brightness_offset = 0x31;static int brightness_mode;static unsigned int brightness_enable;	/* 0 = no, 1 = yes, 2 = auto */static int brightness_init(struct ibm_init_struct *iibm);static void brightness_exit(void);static int brightness_get(struct backlight_device *bd);static int brightness_set(int value);static int brightness_update_status(struct backlight_device *bd);static int brightness_read(char *p);static int brightness_write(char *buf);/* * CMOS subdriver */static int cmos_read(char *p);static int cmos_write(char *buf);/* * Dock subdriver */#ifdef CONFIG_THINKPAD_ACPI_DOCKstatic acpi_handle pci_handle;static acpi_handle dock_handle;static void dock_notify(struct ibm_struct *ibm, u32 event);static int dock_read(char *p);static int dock_write(char *buf);#endif /* CONFIG_THINKPAD_ACPI_DOCK *//* * EC dump subdriver */static int ecdump_read(char *p) ;static int ecdump_write(char *buf);/* * Fan subdriver */enum {					/* Fan control constants */	fan_status_offset = 0x2f,	/* EC register 0x2f */	fan_rpm_offset = 0x84,		/* EC register 0x84: LSB, 0x85 MSB (RPM)					 * 0x84 must be read before 0x85 */	TP_EC_FAN_FULLSPEED = 0x40,	/* EC fan mode: full speed */	TP_EC_FAN_AUTO	    = 0x80,	/* EC fan mode: auto fan control */	TPACPI_FAN_LAST_LEVEL = 0x100,	/* Use cached last-seen fan level */};enum fan_status_access_mode {	TPACPI_FAN_NONE = 0,		/* No fan status or control */	TPACPI_FAN_RD_ACPI_GFAN,	/* Use ACPI GFAN */	TPACPI_FAN_RD_TPEC,		/* Use ACPI EC regs 0x2f, 0x84-0x85 */};enum fan_control_access_mode {	TPACPI_FAN_WR_NONE = 0,		/* No fan control */	TPACPI_FAN_WR_ACPI_SFAN,	/* Use ACPI SFAN */	TPACPI_FAN_WR_TPEC,		/* Use ACPI EC reg 0x2f */	TPACPI_FAN_WR_ACPI_FANS,	/* Use ACPI FANS and EC reg 0x2f */};enum fan_control_commands {	TPACPI_FAN_CMD_SPEED 	= 0x0001,	/* speed command */	TPACPI_FAN_CMD_LEVEL 	= 0x0002,	/* level command  */	TPACPI_FAN_CMD_ENABLE	= 0x0004,	/* enable/disable cmd,						 * and also watchdog cmd */};static int fan_control_allowed;static enum fan_status_access_mode fan_status_access_mode;static enum fan_control_access_mode fan_control_access_mode;static enum fan_control_commands fan_control_commands;static u8 fan_control_initial_status;static u8 fan_control_desired_level;static int fan_watchdog_maxinterval;static struct mutex fan_mutex;static acpi_handle fans_handle, gfan_handle, sfan_handle;static int fan_init(struct ibm_init_struct *iibm);static void fan_exit(void);static int fan_get_status(u8 *status);static int fan_get_status_safe(u8 *status);static int fan_get_speed(unsigned int *speed);static void fan_update_desired_level(u8 status);static void fan_watchdog_fire(struct work_struct *ignored);static void fan_watchdog_reset(void);static int fan_set_level(int level);static int fan_set_level_safe(int level);static int fan_set_enable(void);static int fan_set_disable(void);static int fan_set_speed(int speed);static int fan_read(char *p);static int fan_write(char *buf);static int fan_write_cmd_level(const char *cmd, int *rc);static int fan_write_cmd_enable(const char *cmd, int *rc);static int fan_write_cmd_disable(const char *cmd, int *rc);static int fan_write_cmd_speed(const char *cmd, int *rc);static int fan_write_cmd_watchdog(const char *cmd, int *rc);/* * Hotkey subdriver */static int hotkey_orig_status;static u32 hotkey_orig_mask;static struct mutex hotkey_mutex;static int hotkey_init(struct ibm_init_struct *iibm);static void hotkey_exit(void);static int hotkey_get(int *status, u32 *mask);static int hotkey_set(int status, u32 mask);static void hotkey_notify(struct ibm_struct *ibm, u32 event);static int hotkey_read(char *p);static int hotkey_write(char *buf);/* * LED subdriver */enum led_access_mode {	TPACPI_LED_NONE = 0,	TPACPI_LED_570,	/* 570 */	TPACPI_LED_OLD,	/* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */	TPACPI_LED_NEW,	/* all others */};enum {	/* For TPACPI_LED_OLD */	TPACPI_LED_EC_HLCL = 0x0c,	/* EC reg to get led to power on */	TPACPI_LED_EC_HLBL = 0x0d,	/* EC reg to blink a lit led */	TPACPI_LED_EC_HLMS = 0x0e,	/* EC reg to select led to command */};static enum led_access_mode led_supported;static acpi_handle led_handle;static int led_init(struct ibm_init_struct *iibm);static int led_read(char *p);static int led_write(char *buf);/* * Light (thinklight) subdriver */static acpi_handle lght_handle, ledb_handle;static int light_init(struct ibm_init_struct *iibm);static int light_read(char *p);static int light_write(char *buf);/* * Thermal subdriver */enum thermal_access_mode {	TPACPI_THERMAL_NONE = 0,	/* No thermal support */	TPACPI_THERMAL_ACPI_TMP07,	/* Use ACPI TMP0-7 */	TPACPI_THERMAL_ACPI_UPDT,	/* Use ACPI TMP0-7 with UPDT */	TPACPI_THERMAL_TPEC_8,		/* Use ACPI EC regs, 8 sensors */	TPACPI_THERMAL_TPEC_16,		/* Use ACPI EC regs, 16 sensors */};enum { /* TPACPI_THERMAL_TPEC_* */	TP_EC_THERMAL_TMP0 = 0x78,	/* ACPI EC regs TMP 0..7 */	TP_EC_THERMAL_TMP8 = 0xC0,	/* ACPI EC regs TMP 8..15 */	TP_EC_THERMAL_TMP_NA = -128,	/* ACPI EC sensor not available */};#define TPACPI_MAX_THERMAL_SENSORS 16	/* Max thermal sensors supported */struct ibm_thermal_sensors_struct {	s32 temp[TPACPI_MAX_THERMAL_SENSORS];};static enum thermal_access_mode thermal_read_mode;static int thermal_init(struct ibm_init_struct *iibm);static int thermal_get_sensor(int idx, s32 *value);static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s);static int thermal_read(char *p);/* * Video subdriver */enum video_access_mode {	TPACPI_VIDEO_NONE = 0,	TPACPI_VIDEO_570,	/* 570 */	TPACPI_VIDEO_770,	/* 600e/x, 770e, 770x */	TPACPI_VIDEO_NEW,	/* all others */};enum {	/* video status flags, based on VIDEO_570 */	TP_ACPI_VIDEO_S_LCD = 0x01,	/* LCD output enabled */	TP_ACPI_VIDEO_S_CRT = 0x02,	/* CRT output enabled */	TP_ACPI_VIDEO_S_DVI = 0x08,	/* DVI output enabled */};enum {  /* TPACPI_VIDEO_570 constants */	TP_ACPI_VIDEO_570_PHSCMD = 0x87,	/* unknown magic constant :( */	TP_ACPI_VIDEO_570_PHSMASK = 0x03,	/* PHS bits that map to						 * video_status_flags */	TP_ACPI_VIDEO_570_PHS2CMD = 0x8b,	/* unknown magic constant :( */	TP_ACPI_VIDEO_570_PHS2SET = 0x80,	/* unknown magic constant :( */};static enum video_access_mode video_supported;static int video_orig_autosw;static acpi_handle vid_handle, vid2_handle;static int video_init(struct ibm_init_struct *iibm);static void video_exit(void);static int video_outputsw_get(void);static int video_outputsw_set(int status);static int video_autosw_get(void);static int video_autosw_set(int enable);static int video_outputsw_cycle(void);static int video_expand_toggle(void);static int video_read(char *p);static int video_write(char *buf);/* * Volume subdriver */static int volume_offset = 0x30;static int volume_read(char *p);static int volume_write(char *buf);/* * Wan subdriver */enum {	/* ACPI GWAN/SWAN bits */	TP_ACPI_WANCARD_HWPRESENT	= 0x01,	/* Wan hw available */	TP_ACPI_WANCARD_RADIOSSW	= 0x02,	/* Wan radio enabled */	TP_ACPI_WANCARD_UNK		= 0x04,	/* unknown function */};static int wan_init(struct ibm_init_struct *iibm);static int wan_get_radiosw(void);static int wan_set_radiosw(int radio_on);static int wan_read(char *p);static int wan_write(char *buf);#endif /* __THINKPAD_ACPI_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?