#include <linux/completion.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/input.h>
#include <linux/kfifo.h>
#include <linux/module.h>
#include <linux/olpc-ec.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/reboot.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/spi/spi.h>
struct ec_cmd_t { … };
enum ec_chan_t { … };
#define EVENT_AC_CHANGE …
#define EVENT_BATTERY_STATUS …
#define EVENT_BATTERY_CRITICAL …
#define EVENT_BATTERY_SOC_CHANGE …
#define EVENT_BATTERY_ERROR …
#define EVENT_POWER_PRESSED …
#define EVENT_POWER_PRESS_WAKE …
#define EVENT_TIMED_HOST_WAKE …
#define EVENT_OLS_HIGH_LIMIT …
#define EVENT_OLS_LOW_LIMIT …
#define CMD_GET_API_VERSION …
#define CMD_READ_VOLTAGE …
#define CMD_READ_CURRENT …
#define CMD_READ_ACR …
#define CMD_READ_BATT_TEMPERATURE …
#define CMD_READ_AMBIENT_TEMPERATURE …
#define CMD_READ_BATTERY_STATUS …
#define CMD_READ_SOC …
#define CMD_READ_GAUGE_ID …
#define CMD_READ_GAUGE_DATA …
#define CMD_READ_BOARD_ID …
#define CMD_READ_BATT_ERR_CODE …
#define CMD_SET_DCON_POWER …
#define CMD_RESET_EC …
#define CMD_READ_BATTERY_TYPE …
#define CMD_SET_AUTOWAK …
#define CMD_SET_EC_WAKEUP_TIMER …
#define CMD_READ_EXT_SCI_MASK …
#define CMD_WRITE_EXT_SCI_MASK …
#define CMD_CLEAR_EC_WAKEUP_TIMER …
#define CMD_ENABLE_RUNIN_DISCHARGE …
#define CMD_DISABLE_RUNIN_DISCHARGE …
#define CMD_READ_MPPT_ACTIVE …
#define CMD_READ_MPPT_LIMIT …
#define CMD_SET_MPPT_LIMIT …
#define CMD_DISABLE_MPPT …
#define CMD_ENABLE_MPPT …
#define CMD_READ_VIN …
#define CMD_EXT_SCI_QUERY …
#define RSP_KEYBOARD_DATA …
#define RSP_TOUCHPAD_DATA …
#define CMD_GET_FW_VERSION …
#define CMD_POWER_CYCLE …
#define CMD_POWER_OFF …
#define CMD_RESET_EC_SOFT …
#define CMD_READ_GAUGE_U16 …
#define CMD_ENABLE_MOUSE …
#define CMD_ECHO …
#define CMD_GET_FW_DATE …
#define CMD_GET_FW_USER …
#define CMD_TURN_OFF_POWER …
#define CMD_READ_OLS …
#define CMD_OLS_SMT_LEDON …
#define CMD_OLS_SMT_LEDOFF …
#define CMD_START_OLS_ASSY …
#define CMD_STOP_OLS_ASSY …
#define CMD_OLS_SMTTEST_STOP …
#define CMD_READ_VIN_SCALED …
#define CMD_READ_BAT_MIN_W …
#define CMD_READ_BAR_MAX_W …
#define CMD_RESET_BAT_MINMAX_W …
#define CMD_READ_LOCATION …
#define CMD_WRITE_LOCATION …
#define CMD_KEYBOARD_CMD …
#define CMD_TOUCHPAD_CMD …
#define CMD_GET_FW_HASH …
#define CMD_SUSPEND_HINT …
#define CMD_ENABLE_WAKE_TIMER …
#define CMD_SET_WAKE_TIMER …
#define CMD_ENABLE_WAKE_AUTORESET …
#define CMD_OLS_SET_LIMITS …
#define CMD_OLS_GET_LIMITS …
#define CMD_OLS_SET_CEILING …
#define CMD_OLS_GET_CEILING …
static const struct ec_cmd_t olpc_xo175_ec_cmds[] = …;
#define EC_MAX_CMD_DATA_LEN …
#define EC_MAX_RESP_LEN …
#define LOG_BUF_SIZE …
#define PM_WAKEUP_TIME …
#define EC_ALL_EVENTS …
enum ec_state_t { … };
struct olpc_xo175_ec_cmd { … };
struct olpc_xo175_ec_resp { … };
struct olpc_xo175_ec { … };
static struct platform_device *olpc_ec;
static int olpc_xo175_ec_resp_len(u8 cmd)
{ … }
static void olpc_xo175_ec_flush_logbuf(struct olpc_xo175_ec *priv)
{ … }
static void olpc_xo175_ec_complete(void *arg);
static void olpc_xo175_ec_send_command(struct olpc_xo175_ec *priv, void *cmd,
size_t cmdlen)
{ … }
static void olpc_xo175_ec_read_packet(struct olpc_xo175_ec *priv)
{ … }
static void olpc_xo175_ec_complete(void *arg)
{ … }
static int olpc_xo175_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *resp,
size_t resp_len, void *ec_cb_arg)
{ … }
static int olpc_xo175_ec_set_event_mask(unsigned int mask)
{ … }
static void olpc_xo175_ec_power_off(void)
{ … }
static int __maybe_unused olpc_xo175_ec_suspend(struct device *dev)
{ … }
static int __maybe_unused olpc_xo175_ec_resume_noirq(struct device *dev)
{ … }
static int __maybe_unused olpc_xo175_ec_resume(struct device *dev)
{ … }
static struct olpc_ec_driver olpc_xo175_ec_driver = …;
static void olpc_xo175_ec_remove(struct spi_device *spi)
{ … }
static int olpc_xo175_ec_probe(struct spi_device *spi)
{ … }
static const struct dev_pm_ops olpc_xo175_ec_pm_ops = …;
static const struct of_device_id olpc_xo175_ec_of_match[] = …;
MODULE_DEVICE_TABLE(of, olpc_xo175_ec_of_match);
static const struct spi_device_id olpc_xo175_ec_id_table[] = …;
MODULE_DEVICE_TABLE(spi, olpc_xo175_ec_id_table);
static struct spi_driver olpc_xo175_ec_spi_driver = …;
module_spi_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;