Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 
0003 /*
0004  * Core definitions for RAVE SP MFD driver.
0005  *
0006  * Copyright (C) 2017 Zodiac Inflight Innovations
0007  */
0008 
0009 #ifndef _LINUX_RAVE_SP_H_
0010 #define _LINUX_RAVE_SP_H_
0011 
0012 #include <linux/notifier.h>
0013 
0014 enum rave_sp_command {
0015     RAVE_SP_CMD_GET_FIRMWARE_VERSION    = 0x20,
0016     RAVE_SP_CMD_GET_BOOTLOADER_VERSION  = 0x21,
0017     RAVE_SP_CMD_BOOT_SOURCE         = 0x26,
0018     RAVE_SP_CMD_GET_BOARD_COPPER_REV    = 0x2B,
0019     RAVE_SP_CMD_GET_GPIO_STATE      = 0x2F,
0020 
0021     RAVE_SP_CMD_STATUS          = 0xA0,
0022     RAVE_SP_CMD_SW_WDT          = 0xA1,
0023     RAVE_SP_CMD_PET_WDT         = 0xA2,
0024     RAVE_SP_CMD_RMB_EEPROM          = 0xA4,
0025     RAVE_SP_CMD_SET_BACKLIGHT       = 0xA6,
0026     RAVE_SP_CMD_RESET           = 0xA7,
0027     RAVE_SP_CMD_RESET_REASON        = 0xA8,
0028 
0029     RAVE_SP_CMD_REQ_COPPER_REV      = 0xB6,
0030     RAVE_SP_CMD_GET_I2C_DEVICE_STATUS   = 0xBA,
0031     RAVE_SP_CMD_GET_SP_SILICON_REV      = 0xB9,
0032     RAVE_SP_CMD_CONTROL_EVENTS      = 0xBB,
0033 
0034     RAVE_SP_EVNT_BASE           = 0xE0,
0035 };
0036 
0037 struct rave_sp;
0038 
0039 static inline unsigned long rave_sp_action_pack(u8 event, u8 value)
0040 {
0041     return ((unsigned long)value << 8) | event;
0042 }
0043 
0044 static inline u8 rave_sp_action_unpack_event(unsigned long action)
0045 {
0046     return action;
0047 }
0048 
0049 static inline u8 rave_sp_action_unpack_value(unsigned long action)
0050 {
0051     return action >> 8;
0052 }
0053 
0054 int rave_sp_exec(struct rave_sp *sp,
0055          void *__data,  size_t data_size,
0056          void *reply_data, size_t reply_data_size);
0057 
0058 struct device;
0059 int devm_rave_sp_register_event_notifier(struct device *dev,
0060                      struct notifier_block *nb);
0061 
0062 #endif /* _LINUX_RAVE_SP_H_ */