Linux 3.12.39
[linux/fpc-iii.git] / drivers / media / radio / si4713-i2c.h
blob25cdea26343b1854003df8bf2651532a751a7257
1 /*
2 * drivers/media/radio/si4713-i2c.h
4 * Property and commands definitions for Si4713 radio transmitter chip.
6 * Copyright (c) 2008 Instituto Nokia de Tecnologia - INdT
7 * Contact: Eduardo Valentin <eduardo.valentin@nokia.com>
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.
15 #ifndef SI4713_I2C_H
16 #define SI4713_I2C_H
18 #include <media/v4l2-subdev.h>
19 #include <media/v4l2-ctrls.h>
20 #include <media/si4713.h>
22 #define SI4713_PRODUCT_NUMBER 0x0D
24 /* Command Timeouts */
25 #define DEFAULT_TIMEOUT 500
26 #define TIMEOUT_SET_PROPERTY 20
27 #define TIMEOUT_TX_TUNE_POWER 30000
28 #define TIMEOUT_TX_TUNE 110000
29 #define TIMEOUT_POWER_UP 200000
32 * Command and its arguments definitions
34 #define SI4713_PWUP_CTSIEN (1<<7)
35 #define SI4713_PWUP_GPO2OEN (1<<6)
36 #define SI4713_PWUP_PATCH (1<<5)
37 #define SI4713_PWUP_XOSCEN (1<<4)
38 #define SI4713_PWUP_FUNC_TX 0x02
39 #define SI4713_PWUP_FUNC_PATCH 0x0F
40 #define SI4713_PWUP_OPMOD_ANALOG 0x50
41 #define SI4713_PWUP_OPMOD_DIGITAL 0x0F
42 #define SI4713_PWUP_NARGS 2
43 #define SI4713_PWUP_NRESP 1
44 #define SI4713_CMD_POWER_UP 0x01
46 #define SI4713_GETREV_NRESP 9
47 #define SI4713_CMD_GET_REV 0x10
49 #define SI4713_PWDN_NRESP 1
50 #define SI4713_CMD_POWER_DOWN 0x11
52 #define SI4713_SET_PROP_NARGS 5
53 #define SI4713_SET_PROP_NRESP 1
54 #define SI4713_CMD_SET_PROPERTY 0x12
56 #define SI4713_GET_PROP_NARGS 3
57 #define SI4713_GET_PROP_NRESP 4
58 #define SI4713_CMD_GET_PROPERTY 0x13
60 #define SI4713_GET_STATUS_NRESP 1
61 #define SI4713_CMD_GET_INT_STATUS 0x14
63 #define SI4713_CMD_PATCH_ARGS 0x15
64 #define SI4713_CMD_PATCH_DATA 0x16
66 #define SI4713_MAX_FREQ 10800
67 #define SI4713_MIN_FREQ 7600
68 #define SI4713_TXFREQ_NARGS 3
69 #define SI4713_TXFREQ_NRESP 1
70 #define SI4713_CMD_TX_TUNE_FREQ 0x30
72 #define SI4713_MAX_POWER 120
73 #define SI4713_MIN_POWER 88
74 #define SI4713_MAX_ANTCAP 191
75 #define SI4713_MIN_ANTCAP 0
76 #define SI4713_TXPWR_NARGS 4
77 #define SI4713_TXPWR_NRESP 1
78 #define SI4713_CMD_TX_TUNE_POWER 0x31
80 #define SI4713_TXMEA_NARGS 4
81 #define SI4713_TXMEA_NRESP 1
82 #define SI4713_CMD_TX_TUNE_MEASURE 0x32
84 #define SI4713_INTACK_MASK 0x01
85 #define SI4713_TXSTATUS_NARGS 1
86 #define SI4713_TXSTATUS_NRESP 8
87 #define SI4713_CMD_TX_TUNE_STATUS 0x33
89 #define SI4713_OVERMOD_BIT (1 << 2)
90 #define SI4713_IALH_BIT (1 << 1)
91 #define SI4713_IALL_BIT (1 << 0)
92 #define SI4713_ASQSTATUS_NARGS 1
93 #define SI4713_ASQSTATUS_NRESP 5
94 #define SI4713_CMD_TX_ASQ_STATUS 0x34
96 #define SI4713_RDSBUFF_MODE_MASK 0x87
97 #define SI4713_RDSBUFF_NARGS 7
98 #define SI4713_RDSBUFF_NRESP 6
99 #define SI4713_CMD_TX_RDS_BUFF 0x35
101 #define SI4713_RDSPS_PSID_MASK 0x1F
102 #define SI4713_RDSPS_NARGS 5
103 #define SI4713_RDSPS_NRESP 1
104 #define SI4713_CMD_TX_RDS_PS 0x36
106 #define SI4713_CMD_GPO_CTL 0x80
107 #define SI4713_CMD_GPO_SET 0x81
110 * Bits from status response
112 #define SI4713_CTS (1<<7)
113 #define SI4713_ERR (1<<6)
114 #define SI4713_RDS_INT (1<<2)
115 #define SI4713_ASQ_INT (1<<1)
116 #define SI4713_STC_INT (1<<0)
119 * Property definitions
121 #define SI4713_GPO_IEN 0x0001
122 #define SI4713_DIG_INPUT_FORMAT 0x0101
123 #define SI4713_DIG_INPUT_SAMPLE_RATE 0x0103
124 #define SI4713_REFCLK_FREQ 0x0201
125 #define SI4713_REFCLK_PRESCALE 0x0202
126 #define SI4713_TX_COMPONENT_ENABLE 0x2100
127 #define SI4713_TX_AUDIO_DEVIATION 0x2101
128 #define SI4713_TX_PILOT_DEVIATION 0x2102
129 #define SI4713_TX_RDS_DEVIATION 0x2103
130 #define SI4713_TX_LINE_INPUT_LEVEL 0x2104
131 #define SI4713_TX_LINE_INPUT_MUTE 0x2105
132 #define SI4713_TX_PREEMPHASIS 0x2106
133 #define SI4713_TX_PILOT_FREQUENCY 0x2107
134 #define SI4713_TX_ACOMP_ENABLE 0x2200
135 #define SI4713_TX_ACOMP_THRESHOLD 0x2201
136 #define SI4713_TX_ACOMP_ATTACK_TIME 0x2202
137 #define SI4713_TX_ACOMP_RELEASE_TIME 0x2203
138 #define SI4713_TX_ACOMP_GAIN 0x2204
139 #define SI4713_TX_LIMITER_RELEASE_TIME 0x2205
140 #define SI4713_TX_ASQ_INTERRUPT_SOURCE 0x2300
141 #define SI4713_TX_ASQ_LEVEL_LOW 0x2301
142 #define SI4713_TX_ASQ_DURATION_LOW 0x2302
143 #define SI4713_TX_ASQ_LEVEL_HIGH 0x2303
144 #define SI4713_TX_ASQ_DURATION_HIGH 0x2304
145 #define SI4713_TX_RDS_INTERRUPT_SOURCE 0x2C00
146 #define SI4713_TX_RDS_PI 0x2C01
147 #define SI4713_TX_RDS_PS_MIX 0x2C02
148 #define SI4713_TX_RDS_PS_MISC 0x2C03
149 #define SI4713_TX_RDS_PS_REPEAT_COUNT 0x2C04
150 #define SI4713_TX_RDS_PS_MESSAGE_COUNT 0x2C05
151 #define SI4713_TX_RDS_PS_AF 0x2C06
152 #define SI4713_TX_RDS_FIFO_SIZE 0x2C07
154 #define PREEMPHASIS_USA 75
155 #define PREEMPHASIS_EU 50
156 #define PREEMPHASIS_DISABLED 0
157 #define FMPE_USA 0x00
158 #define FMPE_EU 0x01
159 #define FMPE_DISABLED 0x02
161 #define POWER_UP 0x01
162 #define POWER_DOWN 0x00
164 #define MAX_RDS_PTY 31
165 #define MAX_RDS_DEVIATION 90000
168 * PSNAME is known to be defined as 8 character sized (RDS Spec).
169 * However, there is receivers which scroll PSNAME 8xN sized.
171 #define MAX_RDS_PS_NAME 96
174 * MAX_RDS_RADIO_TEXT is known to be defined as 32 (2A group) or 64 (2B group)
175 * character sized (RDS Spec).
176 * However, there is receivers which scroll them as well.
178 #define MAX_RDS_RADIO_TEXT 384
180 #define MAX_LIMITER_RELEASE_TIME 102390
181 #define MAX_LIMITER_DEVIATION 90000
183 #define MAX_PILOT_DEVIATION 90000
184 #define MAX_PILOT_FREQUENCY 19000
186 #define MAX_ACOMP_RELEASE_TIME 1000000
187 #define MAX_ACOMP_ATTACK_TIME 5000
188 #define MAX_ACOMP_THRESHOLD 0
189 #define MIN_ACOMP_THRESHOLD (-40)
190 #define MAX_ACOMP_GAIN 20
192 #define SI4713_NUM_SUPPLIES 2
195 * si4713_device - private data
197 struct si4713_device {
198 /* v4l2_subdev and i2c reference (v4l2_subdev priv data) */
199 struct v4l2_subdev sd;
200 struct v4l2_ctrl_handler ctrl_handler;
201 /* private data structures */
202 struct { /* si4713 control cluster */
203 /* This is one big cluster since the mute control
204 * powers off the device and after unmuting again all
205 * controls need to be set at once. The only way of doing
206 * that is by making it one big cluster. */
207 struct v4l2_ctrl *mute;
208 struct v4l2_ctrl *rds_ps_name;
209 struct v4l2_ctrl *rds_radio_text;
210 struct v4l2_ctrl *rds_pi;
211 struct v4l2_ctrl *rds_deviation;
212 struct v4l2_ctrl *rds_pty;
213 struct v4l2_ctrl *compression_enabled;
214 struct v4l2_ctrl *compression_threshold;
215 struct v4l2_ctrl *compression_gain;
216 struct v4l2_ctrl *compression_attack_time;
217 struct v4l2_ctrl *compression_release_time;
218 struct v4l2_ctrl *pilot_tone_enabled;
219 struct v4l2_ctrl *pilot_tone_freq;
220 struct v4l2_ctrl *pilot_tone_deviation;
221 struct v4l2_ctrl *limiter_enabled;
222 struct v4l2_ctrl *limiter_deviation;
223 struct v4l2_ctrl *limiter_release_time;
224 struct v4l2_ctrl *tune_preemphasis;
225 struct v4l2_ctrl *tune_pwr_level;
226 struct v4l2_ctrl *tune_ant_cap;
228 struct completion work;
229 struct regulator_bulk_data supplies[SI4713_NUM_SUPPLIES];
230 int gpio_reset;
231 u32 power_state;
232 u32 rds_enabled;
233 u32 frequency;
234 u32 preemphasis;
235 u32 stereo;
236 u32 tune_rnl;
238 #endif /* ifndef SI4713_I2C_H */