77 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef _LINUX_OLPC_EC_H3#define _LINUX_OLPC_EC_H4 5#include <linux/bits.h>6 7/* XO-1 EC commands */8#define EC_FIRMWARE_REV 0x089#define EC_WRITE_SCI_MASK 0x1b10#define EC_WAKE_UP_WLAN 0x2411#define EC_WLAN_LEAVE_RESET 0x2512#define EC_DCON_POWER_MODE 0x2613#define EC_READ_EB_MODE 0x2a14#define EC_SET_SCI_INHIBIT 0x3215#define EC_SET_SCI_INHIBIT_RELEASE 0x3416#define EC_WLAN_ENTER_RESET 0x3517#define EC_WRITE_EXT_SCI_MASK 0x3818#define EC_SCI_QUERY 0x8419#define EC_EXT_SCI_QUERY 0x8520 21/* SCI source values */22#define EC_SCI_SRC_GAME BIT(0)23#define EC_SCI_SRC_BATTERY BIT(1)24#define EC_SCI_SRC_BATSOC BIT(2)25#define EC_SCI_SRC_BATERR BIT(3)26#define EC_SCI_SRC_EBOOK BIT(4) /* XO-1 only */27#define EC_SCI_SRC_WLAN BIT(5) /* XO-1 only */28#define EC_SCI_SRC_ACPWR BIT(6)29#define EC_SCI_SRC_BATCRIT BIT(7)30#define EC_SCI_SRC_GPWAKE BIT(8) /* XO-1.5 only */31#define EC_SCI_SRC_ALL GENMASK(8, 0)32 33struct platform_device;34 35struct olpc_ec_driver {36 int (*suspend)(struct platform_device *);37 int (*resume)(struct platform_device *);38 39 int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *);40 41 bool wakeup_available;42};43 44#ifdef CONFIG_OLPC_EC45 46extern void olpc_ec_driver_register(struct olpc_ec_driver *drv, void *arg);47 48extern int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,49 size_t outlen);50 51extern void olpc_ec_wakeup_set(u16 value);52extern void olpc_ec_wakeup_clear(u16 value);53 54extern int olpc_ec_mask_write(u16 bits);55extern int olpc_ec_sci_query(u16 *sci_value);56 57extern bool olpc_ec_wakeup_available(void);58 59asmlinkage int xo1_do_sleep(u8 sleep_state);60 61#else62 63static inline int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf,64 size_t outlen) { return -ENODEV; }65 66static inline void olpc_ec_wakeup_set(u16 value) { }67static inline void olpc_ec_wakeup_clear(u16 value) { }68 69static inline bool olpc_ec_wakeup_available(void)70{71 return false;72}73 74#endif /* CONFIG_OLPC_EC */75 76#endif /* _LINUX_OLPC_EC_H */77