drivers: power: report battery voltage in AOSP compatible format
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / musbfsh.h
1 /*
2 * This is used to for host and peripheral modes of the driver for
3 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
4 *
5 * Board initialization should put one of these into dev->platform_data,
6 * probably on some platform_device named "musbfsh_hdrc". It encapsulates
7 * key configuration differences between boards.
8 */
9
10 #ifndef __LINUX_USB_MUSBFSH_H
11 #define __LINUX_USB_MUSBFSH_H
12
13 /* The USB role is defined by the connector used on the board, so long as
14 * standards are being followed. (Developer boards sometimes won't.)
15 */
16 enum musbfsh_mode {
17 MUSBFSH_UNDEFINED = 0,
18 MUSBFSH_HOST, /* A or Mini-A connector */
19 MUSBFSH_PERIPHERAL, /* B or Mini-B connector */
20 MUSBFSH_OTG /* Mini-AB connector */
21 };
22
23 struct clk;
24 enum musbfsh_fifo_style {
25 FIFO_RXTX,
26 FIFO_TX,
27 FIFO_RX
28 } __attribute__ ((packed));
29
30 enum musbfsh_buf_mode {
31 BUF_SINGLE,
32 BUF_DOUBLE
33 } __attribute__ ((packed));
34
35 struct musbfsh_fifo_cfg {
36 u8 hw_ep_num;
37 enum musbfsh_fifo_style style;
38 enum musbfsh_buf_mode mode;
39 u16 maxpacket;
40 };
41
42 #define MUSBFSH_EP_FIFO(ep, st, m, pkt) \
43 { \
44 .hw_ep_num = ep, \
45 .style = st, \
46 .mode = m, \
47 .maxpacket = pkt, \
48 }
49
50 #define MUSBFSH_EP_FIFO_SINGLE(ep, st, pkt) \
51 MUSBFSH_EP_FIFO(ep, st, BUF_SINGLE, pkt)
52
53 #define MUSBFSH_EP_FIFO_DOUBLE(ep, st, pkt) \
54 MUSBFSH_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
55
56 struct musbfsh_hdrc_eps_bits {
57 const char name[16];
58 u8 bits;
59 };
60
61 struct musbfsh_hdrc_config {
62 struct musbfsh_fifo_cfg *fifo_cfg; /* board fifo configuration */
63 unsigned fifo_cfg_size; /* size of the fifo configuration */
64
65 /* MUSB configuration-specific details */
66 unsigned multipoint:1; /* multipoint device */
67 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
68 unsigned soft_con:1 __deprecated; /* soft connect required */
69 unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
70 unsigned big_endian:1; /* true if CPU uses big-endian */
71 unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
72 unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
73 unsigned high_iso_tx:1; /* Tx ep required for HB iso */
74 unsigned high_iso_rx:1; /* Rx ep required for HD iso */
75 unsigned dma:1 __deprecated; /* supports DMA */
76 unsigned vendor_req:1 __deprecated; /* vendor registers required */
77
78 u8 num_eps; /* number of endpoints _with_ ep0 */
79 u8 dma_channels __deprecated; /* number of dma channels */
80 u8 dyn_fifo_size; /* dynamic size in bytes */
81 u8 vendor_ctrl __deprecated; /* vendor control reg width */
82 u8 vendor_stat __deprecated; /* vendor status reg witdh */
83 u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
84 u8 ram_bits; /* ram address size */
85
86 struct musbfsh_hdrc_eps_bits *eps_bits __deprecated;
87
88 };
89
90 struct musbfsh_hdrc_platform_data {
91 /* MUSBFSH_HOST, MUSBFSH_PERIPHERAL, or MUSBFSH_OTG */
92 u8 mode;
93
94 const char *clock;
95 /* (HOST or OTG) switch VBUS on/off */
96 int (*set_vbus) (struct device *dev, int is_on);
97
98 /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
99 u8 power;
100
101 u8 min_power;
102 u8 potpgt;
103 /* (HOST or OTG) program PHY for external Vbus */
104 unsigned extvbus:1;
105
106 /* Power the device on or off */
107 int (*set_power) (int state);
108
109 /* MUSB configuration-specific details */
110 struct musbfsh_hdrc_config *config;
111
112 void *board_data;
113 const void *platform_ops;
114 };
115
116 #endif /* __LINUX_USB_MUSBFSH_H */