aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/mediatek/hdmi/Sii8338/smartbook.h
blob: d59ffb626e34939c4d2c39b88f87bed12133ec43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef __SMARTBOOK_H__
#define __SMARTBOOK_H__

/* #define HID_CRYPTO                    // enable scratchpad cryptiion (deprecated) */
/* #define SBK_FAKE_BATTERY              // faking 2nd battery data */
#define HID_BUF   64
#define HID_SIZE  8		/* 16               // HID_SIZE = Protocol used Registers count. */
#define KB_MODLEN 8
#define KB_LEN    250
#define HID_COMMAND_PAYLOAD_LEN 6


/* CBUS command define */
#define SCRATCHPAD_OFFSET     0x40
#define WRITEBURST_MAX_LEN    0x8
#define CA_PMU_LEN

/* Category */
#define CA_INPUT_DEV    0x1
#define CA_MISC         0x2
#define CA_PMU          0x80

/* COMMAND */
#define INPUT_MOUSE       0x2
#define INPUT_KEYBOARD    0x3
#define INPUT_TOUCHPAD    0x4
#define MISC_MOUSE        0x2
#define MISC_KEYBOARD     0x3
#define MISC_TOUCHPAD     0x4
#define MISC_UNSUPPORT    0xff
#define MISC_HANDSHAKE    0x3c
#define MISC_LATENCY      0xaa
#define PMU_BATTERY       0x3
#define PMU_SCREEN        0x55

#define ID_LEN            6
/* ID */
#define SMB_SOURCE_ID_0   0x66
#define SMB_SOURCE_ID_1   0x19
#define SMB_SOURCE_ID_2   0x5a
#define SMB_SOURCE_ID_3   0x22
#define SMB_SOURCE_ID_4   0xba
#define SMB_SOURCE_ID_5   0x51
#define SMB_SINK_ID_0     0x22
#define SMB_SINK_ID_1     0x45
#define SMB_SINK_ID_2     0x43
#define SMB_SINK_ID_3     0x69
#define SMB_SINK_ID_4     0x77
#define SMB_SINK_ID_5     0x26


typedef struct {
	unsigned char category;
	unsigned char command;
	unsigned char payload[HID_COMMAND_PAYLOAD_LEN];
} HIDCommand;

typedef enum {
	ImmediateOff = 0,
	DownCount = 1,
	CancelDownCount = 2
} ScreenOffType;

typedef enum {
	Init = 0,
	Ack = 1
} HandshakeType;

typedef enum {
	NotConnect = 0,
	SmartBook = 1,
	MonitorTV = 2,
	Unknown = 3
} SinkType;

#define DEBUG_LOG

#ifdef DEBUG_LOG
#define smb_print(fmt, args...) printk(KERN_INFO "[SMB] " fmt, ##args)
#else
#define smb_print(fmt, args...)
#endif

/* export function */
extern SinkType SMBGetSinkStatus(void);
extern int SiiHandshakeCommand(HandshakeType ComType);
extern void SiiHidSuspend(int flag);

/* others function */
extern void update_battery_2nd_info(int status_2nd, int capacity_2nd, int present_2nd);
extern void RecordStamp(bool dump, char tag);

#endif