Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
si4713-i2c.h
Go to the documentation of this file.
1 /*
2  * drivers/media/radio/si4713-i2c.h
3  *
4  * Property and commands definitions for Si4713 radio transmitter chip.
5  *
6  * Copyright (c) 2008 Instituto Nokia de Tecnologia - INdT
7  * Contact: Eduardo Valentin <[email protected]>
8  *
9  * This file is licensed under the terms of the GNU General Public License
10  * version 2. This program is licensed "as is" without any warranty of any
11  * kind, whether express or implied.
12  *
13  */
14 
15 #ifndef SI4713_I2C_H
16 #define SI4713_I2C_H
17 
18 #include <media/v4l2-subdev.h>
19 #include <media/si4713.h>
20 
21 #define SI4713_PRODUCT_NUMBER 0x0D
22 
23 /* Command Timeouts */
24 #define DEFAULT_TIMEOUT 500
25 #define TIMEOUT_SET_PROPERTY 20
26 #define TIMEOUT_TX_TUNE_POWER 30000
27 #define TIMEOUT_TX_TUNE 110000
28 #define TIMEOUT_POWER_UP 200000
29 
30 /*
31  * Command and its arguments definitions
32  */
33 #define SI4713_PWUP_CTSIEN (1<<7)
34 #define SI4713_PWUP_GPO2OEN (1<<6)
35 #define SI4713_PWUP_PATCH (1<<5)
36 #define SI4713_PWUP_XOSCEN (1<<4)
37 #define SI4713_PWUP_FUNC_TX 0x02
38 #define SI4713_PWUP_FUNC_PATCH 0x0F
39 #define SI4713_PWUP_OPMOD_ANALOG 0x50
40 #define SI4713_PWUP_OPMOD_DIGITAL 0x0F
41 #define SI4713_PWUP_NARGS 2
42 #define SI4713_PWUP_NRESP 1
43 #define SI4713_CMD_POWER_UP 0x01
44 
45 #define SI4713_GETREV_NRESP 9
46 #define SI4713_CMD_GET_REV 0x10
47 
48 #define SI4713_PWDN_NRESP 1
49 #define SI4713_CMD_POWER_DOWN 0x11
50 
51 #define SI4713_SET_PROP_NARGS 5
52 #define SI4713_SET_PROP_NRESP 1
53 #define SI4713_CMD_SET_PROPERTY 0x12
54 
55 #define SI4713_GET_PROP_NARGS 3
56 #define SI4713_GET_PROP_NRESP 4
57 #define SI4713_CMD_GET_PROPERTY 0x13
58 
59 #define SI4713_GET_STATUS_NRESP 1
60 #define SI4713_CMD_GET_INT_STATUS 0x14
61 
62 #define SI4713_CMD_PATCH_ARGS 0x15
63 #define SI4713_CMD_PATCH_DATA 0x16
64 
65 #define SI4713_MAX_FREQ 10800
66 #define SI4713_MIN_FREQ 7600
67 #define SI4713_TXFREQ_NARGS 3
68 #define SI4713_TXFREQ_NRESP 1
69 #define SI4713_CMD_TX_TUNE_FREQ 0x30
70 
71 #define SI4713_MAX_POWER 120
72 #define SI4713_MIN_POWER 88
73 #define SI4713_MAX_ANTCAP 191
74 #define SI4713_MIN_ANTCAP 0
75 #define SI4713_TXPWR_NARGS 4
76 #define SI4713_TXPWR_NRESP 1
77 #define SI4713_CMD_TX_TUNE_POWER 0x31
78 
79 #define SI4713_TXMEA_NARGS 4
80 #define SI4713_TXMEA_NRESP 1
81 #define SI4713_CMD_TX_TUNE_MEASURE 0x32
82 
83 #define SI4713_INTACK_MASK 0x01
84 #define SI4713_TXSTATUS_NARGS 1
85 #define SI4713_TXSTATUS_NRESP 8
86 #define SI4713_CMD_TX_TUNE_STATUS 0x33
87 
88 #define SI4713_OVERMOD_BIT (1 << 2)
89 #define SI4713_IALH_BIT (1 << 1)
90 #define SI4713_IALL_BIT (1 << 0)
91 #define SI4713_ASQSTATUS_NARGS 1
92 #define SI4713_ASQSTATUS_NRESP 5
93 #define SI4713_CMD_TX_ASQ_STATUS 0x34
94 
95 #define SI4713_RDSBUFF_MODE_MASK 0x87
96 #define SI4713_RDSBUFF_NARGS 7
97 #define SI4713_RDSBUFF_NRESP 6
98 #define SI4713_CMD_TX_RDS_BUFF 0x35
99 
100 #define SI4713_RDSPS_PSID_MASK 0x1F
101 #define SI4713_RDSPS_NARGS 5
102 #define SI4713_RDSPS_NRESP 1
103 #define SI4713_CMD_TX_RDS_PS 0x36
104 
105 #define SI4713_CMD_GPO_CTL 0x80
106 #define SI4713_CMD_GPO_SET 0x81
107 
108 /*
109  * Bits from status response
110  */
111 #define SI4713_CTS (1<<7)
112 #define SI4713_ERR (1<<6)
113 #define SI4713_RDS_INT (1<<2)
114 #define SI4713_ASQ_INT (1<<1)
115 #define SI4713_STC_INT (1<<0)
116 
117 /*
118  * Property definitions
119  */
120 #define SI4713_GPO_IEN 0x0001
121 #define SI4713_DIG_INPUT_FORMAT 0x0101
122 #define SI4713_DIG_INPUT_SAMPLE_RATE 0x0103
123 #define SI4713_REFCLK_FREQ 0x0201
124 #define SI4713_REFCLK_PRESCALE 0x0202
125 #define SI4713_TX_COMPONENT_ENABLE 0x2100
126 #define SI4713_TX_AUDIO_DEVIATION 0x2101
127 #define SI4713_TX_PILOT_DEVIATION 0x2102
128 #define SI4713_TX_RDS_DEVIATION 0x2103
129 #define SI4713_TX_LINE_INPUT_LEVEL 0x2104
130 #define SI4713_TX_LINE_INPUT_MUTE 0x2105
131 #define SI4713_TX_PREEMPHASIS 0x2106
132 #define SI4713_TX_PILOT_FREQUENCY 0x2107
133 #define SI4713_TX_ACOMP_ENABLE 0x2200
134 #define SI4713_TX_ACOMP_THRESHOLD 0x2201
135 #define SI4713_TX_ACOMP_ATTACK_TIME 0x2202
136 #define SI4713_TX_ACOMP_RELEASE_TIME 0x2203
137 #define SI4713_TX_ACOMP_GAIN 0x2204
138 #define SI4713_TX_LIMITER_RELEASE_TIME 0x2205
139 #define SI4713_TX_ASQ_INTERRUPT_SOURCE 0x2300
140 #define SI4713_TX_ASQ_LEVEL_LOW 0x2301
141 #define SI4713_TX_ASQ_DURATION_LOW 0x2302
142 #define SI4713_TX_ASQ_LEVEL_HIGH 0x2303
143 #define SI4713_TX_ASQ_DURATION_HIGH 0x2304
144 #define SI4713_TX_RDS_INTERRUPT_SOURCE 0x2C00
145 #define SI4713_TX_RDS_PI 0x2C01
146 #define SI4713_TX_RDS_PS_MIX 0x2C02
147 #define SI4713_TX_RDS_PS_MISC 0x2C03
148 #define SI4713_TX_RDS_PS_REPEAT_COUNT 0x2C04
149 #define SI4713_TX_RDS_PS_MESSAGE_COUNT 0x2C05
150 #define SI4713_TX_RDS_PS_AF 0x2C06
151 #define SI4713_TX_RDS_FIFO_SIZE 0x2C07
152 
153 #define PREEMPHASIS_USA 75
154 #define PREEMPHASIS_EU 50
155 #define PREEMPHASIS_DISABLED 0
156 #define FMPE_USA 0x00
157 #define FMPE_EU 0x01
158 #define FMPE_DISABLED 0x02
159 
160 #define POWER_UP 0x01
161 #define POWER_DOWN 0x00
162 
163 struct rds_info {
165 #define MAX_RDS_PTY 31
167 #define MAX_RDS_DEVIATION 90000
169 /*
170  * PSNAME is known to be defined as 8 character sized (RDS Spec).
171  * However, there is receivers which scroll PSNAME 8xN sized.
172  */
173 #define MAX_RDS_PS_NAME 96
175 /*
176  * MAX_RDS_RADIO_TEXT is known to be defined as 32 (2A group) or 64 (2B group)
177  * character sized (RDS Spec).
178  * However, there is receivers which scroll them as well.
179  */
180 #define MAX_RDS_RADIO_TEXT 384
183 };
184 
185 struct limiter_info {
186 #define MAX_LIMITER_RELEASE_TIME 102390
188 #define MAX_LIMITER_DEVIATION 90000
191 };
192 
193 struct pilot_info {
194 #define MAX_PILOT_DEVIATION 90000
196 #define MAX_PILOT_FREQUENCY 19000
199 };
200 
201 struct acomp_info {
202 #define MAX_ACOMP_RELEASE_TIME 1000000
204 #define MAX_ACOMP_ATTACK_TIME 5000
206 #define MAX_ACOMP_THRESHOLD 0
207 #define MIN_ACOMP_THRESHOLD (-40)
209 #define MAX_ACOMP_GAIN 20
212 };
213 
214 #define SI4713_NUM_SUPPLIES 2
215 
216 /*
217  * si4713_device - private data
218  */
220  /* v4l2_subdev and i2c reference (v4l2_subdev priv data) */
221  struct v4l2_subdev sd;
222  /* private data structures */
223  struct mutex mutex;
224  struct completion work;
239 };
240 #endif /* ifndef SI4713_I2C_H */