~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mfd/wl1273-core.h

Version: ~ [ linux-5.14-rc3 ] ~ [ linux-5.13.5 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.53 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.135 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.198 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.240 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.276 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.276 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * include/linux/mfd/wl1273-core.h
  3  *
  4  * Some definitions for the wl1273 radio receiver/transmitter chip.
  5  *
  6  * Copyright (C) 2010 Nokia Corporation
  7  * Author: Matti J. Aaltonen <matti.j.aaltonen@nokia.com>
  8  *
  9  * This program is free software; you can redistribute it and/or
 10  * modify it under the terms of the GNU General Public License
 11  * version 2 as published by the Free Software Foundation.
 12  *
 13  * This program is distributed in the hope that it will be useful, but
 14  * WITHOUT ANY WARRANTY; without even the implied warranty of
 15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16  * General Public License for more details.
 17  *
 18  * You should have received a copy of the GNU General Public License
 19  * along with this program; if not, write to the Free Software
 20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 21  * 02110-1301 USA
 22  */
 23 
 24 #ifndef WL1273_CORE_H
 25 #define WL1273_CORE_H
 26 
 27 #include <linux/i2c.h>
 28 #include <linux/mfd/core.h>
 29 
 30 #define WL1273_FM_DRIVER_NAME   "wl1273-fm"
 31 #define RX71_FM_I2C_ADDR        0x22
 32 
 33 #define WL1273_STEREO_GET               0
 34 #define WL1273_RSSI_LVL_GET             1
 35 #define WL1273_IF_COUNT_GET             2
 36 #define WL1273_FLAG_GET                 3
 37 #define WL1273_RDS_SYNC_GET             4
 38 #define WL1273_RDS_DATA_GET             5
 39 #define WL1273_FREQ_SET                 10
 40 #define WL1273_AF_FREQ_SET              11
 41 #define WL1273_MOST_MODE_SET            12
 42 #define WL1273_MOST_BLEND_SET           13
 43 #define WL1273_DEMPH_MODE_SET           14
 44 #define WL1273_SEARCH_LVL_SET           15
 45 #define WL1273_BAND_SET                 16
 46 #define WL1273_MUTE_STATUS_SET          17
 47 #define WL1273_RDS_PAUSE_LVL_SET        18
 48 #define WL1273_RDS_PAUSE_DUR_SET        19
 49 #define WL1273_RDS_MEM_SET              20
 50 #define WL1273_RDS_BLK_B_SET            21
 51 #define WL1273_RDS_MSK_B_SET            22
 52 #define WL1273_RDS_PI_MASK_SET          23
 53 #define WL1273_RDS_PI_SET               24
 54 #define WL1273_RDS_SYSTEM_SET           25
 55 #define WL1273_INT_MASK_SET             26
 56 #define WL1273_SEARCH_DIR_SET           27
 57 #define WL1273_VOLUME_SET               28
 58 #define WL1273_AUDIO_ENABLE             29
 59 #define WL1273_PCM_MODE_SET             30
 60 #define WL1273_I2S_MODE_CONFIG_SET      31
 61 #define WL1273_POWER_SET                32
 62 #define WL1273_INTX_CONFIG_SET          33
 63 #define WL1273_PULL_EN_SET              34
 64 #define WL1273_HILO_SET                 35
 65 #define WL1273_SWITCH2FREF              36
 66 #define WL1273_FREQ_DRIFT_REPORT        37
 67 
 68 #define WL1273_PCE_GET                  40
 69 #define WL1273_FIRM_VER_GET             41
 70 #define WL1273_ASIC_VER_GET             42
 71 #define WL1273_ASIC_ID_GET              43
 72 #define WL1273_MAN_ID_GET               44
 73 #define WL1273_TUNER_MODE_SET           45
 74 #define WL1273_STOP_SEARCH              46
 75 #define WL1273_RDS_CNTRL_SET            47
 76 
 77 #define WL1273_WRITE_HARDWARE_REG       100
 78 #define WL1273_CODE_DOWNLOAD            101
 79 #define WL1273_RESET                    102
 80 
 81 #define WL1273_FM_POWER_MODE            254
 82 #define WL1273_FM_INTERRUPT             255
 83 
 84 /* Transmitter API */
 85 
 86 #define WL1273_CHANL_SET                        55
 87 #define WL1273_SCAN_SPACING_SET                 56
 88 #define WL1273_REF_SET                          57
 89 #define WL1273_POWER_ENB_SET                    90
 90 #define WL1273_POWER_ATT_SET                    58
 91 #define WL1273_POWER_LEV_SET                    59
 92 #define WL1273_AUDIO_DEV_SET                    60
 93 #define WL1273_PILOT_DEV_SET                    61
 94 #define WL1273_RDS_DEV_SET                      62
 95 #define WL1273_PUPD_SET                         91
 96 #define WL1273_AUDIO_IO_SET                     63
 97 #define WL1273_PREMPH_SET                       64
 98 #define WL1273_MONO_SET                         66
 99 #define WL1273_MUTE                             92
100 #define WL1273_MPX_LMT_ENABLE                   67
101 #define WL1273_PI_SET                           93
102 #define WL1273_ECC_SET                          69
103 #define WL1273_PTY                              70
104 #define WL1273_AF                               71
105 #define WL1273_DISPLAY_MODE                     74
106 #define WL1273_RDS_REP_SET                      77
107 #define WL1273_RDS_CONFIG_DATA_SET              98
108 #define WL1273_RDS_DATA_SET                     99
109 #define WL1273_RDS_DATA_ENB                     94
110 #define WL1273_TA_SET                           78
111 #define WL1273_TP_SET                           79
112 #define WL1273_DI_SET                           80
113 #define WL1273_MS_SET                           81
114 #define WL1273_PS_SCROLL_SPEED                  82
115 #define WL1273_TX_AUDIO_LEVEL_TEST              96
116 #define WL1273_TX_AUDIO_LEVEL_TEST_THRESHOLD    73
117 #define WL1273_TX_AUDIO_INPUT_LEVEL_RANGE_SET   54
118 #define WL1273_RX_ANTENNA_SELECT                87
119 #define WL1273_I2C_DEV_ADDR_SET                 86
120 #define WL1273_REF_ERR_CALIB_PARAM_SET          88
121 #define WL1273_REF_ERR_CALIB_PERIODICITY_SET    89
122 #define WL1273_SOC_INT_TRIGGER                  52
123 #define WL1273_SOC_AUDIO_PATH_SET               83
124 #define WL1273_SOC_PCMI_OVERRIDE                84
125 #define WL1273_SOC_I2S_OVERRIDE                 85
126 #define WL1273_RSSI_BLOCK_SCAN_FREQ_SET         95
127 #define WL1273_RSSI_BLOCK_SCAN_START            97
128 #define WL1273_RSSI_BLOCK_SCAN_DATA_GET         5
129 #define WL1273_READ_FMANT_TUNE_VALUE            104
130 
131 #define WL1273_RDS_OFF          0
132 #define WL1273_RDS_ON           1
133 #define WL1273_RDS_RESET        2
134 
135 #define WL1273_AUDIO_DIGITAL    0
136 #define WL1273_AUDIO_ANALOG     1
137 
138 #define WL1273_MODE_RX          BIT(0)
139 #define WL1273_MODE_TX          BIT(1)
140 #define WL1273_MODE_OFF         BIT(2)
141 #define WL1273_MODE_SUSPENDED   BIT(3)
142 
143 #define WL1273_RADIO_CHILD      BIT(0)
144 #define WL1273_CODEC_CHILD      BIT(1)
145 
146 #define WL1273_RX_MONO          1
147 #define WL1273_RX_STEREO        0
148 #define WL1273_TX_MONO          0
149 #define WL1273_TX_STEREO        1
150 
151 #define WL1273_MAX_VOLUME       0xffff
152 #define WL1273_DEFAULT_VOLUME   0x78b8
153 
154 /* I2S protocol, left channel first, data width 16 bits */
155 #define WL1273_PCM_DEF_MODE             0x00
156 
157 /* Rx */
158 #define WL1273_AUDIO_ENABLE_I2S         BIT(0)
159 #define WL1273_AUDIO_ENABLE_ANALOG      BIT(1)
160 
161 /* Tx */
162 #define WL1273_AUDIO_IO_SET_ANALOG      0
163 #define WL1273_AUDIO_IO_SET_I2S         1
164 
165 #define WL1273_PUPD_SET_OFF             0x00
166 #define WL1273_PUPD_SET_ON              0x01
167 #define WL1273_PUPD_SET_RETENTION       0x10
168 
169 /* I2S mode */
170 #define WL1273_IS2_WIDTH_32     0x0
171 #define WL1273_IS2_WIDTH_40     0x1
172 #define WL1273_IS2_WIDTH_22_23  0x2
173 #define WL1273_IS2_WIDTH_23_22  0x3
174 #define WL1273_IS2_WIDTH_48     0x4
175 #define WL1273_IS2_WIDTH_50     0x5
176 #define WL1273_IS2_WIDTH_60     0x6
177 #define WL1273_IS2_WIDTH_64     0x7
178 #define WL1273_IS2_WIDTH_80     0x8
179 #define WL1273_IS2_WIDTH_96     0x9
180 #define WL1273_IS2_WIDTH_128    0xa
181 #define WL1273_IS2_WIDTH        0xf
182 
183 #define WL1273_IS2_FORMAT_STD   (0x0 << 4)
184 #define WL1273_IS2_FORMAT_LEFT  (0x1 << 4)
185 #define WL1273_IS2_FORMAT_RIGHT (0x2 << 4)
186 #define WL1273_IS2_FORMAT_USER  (0x3 << 4)
187 
188 #define WL1273_IS2_MASTER       (0x0 << 6)
189 #define WL1273_IS2_SLAVEW       (0x1 << 6)
190 
191 #define WL1273_IS2_TRI_AFTER_SENDING    (0x0 << 7)
192 #define WL1273_IS2_TRI_ALWAYS_ACTIVE    (0x1 << 7)
193 
194 #define WL1273_IS2_SDOWS_RR     (0x0 << 8)
195 #define WL1273_IS2_SDOWS_RF     (0x1 << 8)
196 #define WL1273_IS2_SDOWS_FR     (0x2 << 8)
197 #define WL1273_IS2_SDOWS_FF     (0x3 << 8)
198 
199 #define WL1273_IS2_TRI_OPT      (0x0 << 10)
200 #define WL1273_IS2_TRI_ALWAYS   (0x1 << 10)
201 
202 #define WL1273_IS2_RATE_48K     (0x0 << 12)
203 #define WL1273_IS2_RATE_44_1K   (0x1 << 12)
204 #define WL1273_IS2_RATE_32K     (0x2 << 12)
205 #define WL1273_IS2_RATE_22_05K  (0x4 << 12)
206 #define WL1273_IS2_RATE_16K     (0x5 << 12)
207 #define WL1273_IS2_RATE_12K     (0x8 << 12)
208 #define WL1273_IS2_RATE_11_025  (0x9 << 12)
209 #define WL1273_IS2_RATE_8K      (0xa << 12)
210 #define WL1273_IS2_RATE         (0xf << 12)
211 
212 #define WL1273_I2S_DEF_MODE     (WL1273_IS2_WIDTH_32 | \
213                                  WL1273_IS2_FORMAT_STD | \
214                                  WL1273_IS2_MASTER | \
215                                  WL1273_IS2_TRI_AFTER_SENDING | \
216                                  WL1273_IS2_SDOWS_RR | \
217                                  WL1273_IS2_TRI_OPT | \
218                                  WL1273_IS2_RATE_48K)
219 
220 #define SCHAR_MIN (-128)
221 #define SCHAR_MAX 127
222 
223 #define WL1273_FR_EVENT                 BIT(0)
224 #define WL1273_BL_EVENT                 BIT(1)
225 #define WL1273_RDS_EVENT                BIT(2)
226 #define WL1273_BBLK_EVENT               BIT(3)
227 #define WL1273_LSYNC_EVENT              BIT(4)
228 #define WL1273_LEV_EVENT                BIT(5)
229 #define WL1273_IFFR_EVENT               BIT(6)
230 #define WL1273_PI_EVENT                 BIT(7)
231 #define WL1273_PD_EVENT                 BIT(8)
232 #define WL1273_STIC_EVENT               BIT(9)
233 #define WL1273_MAL_EVENT                BIT(10)
234 #define WL1273_POW_ENB_EVENT            BIT(11)
235 #define WL1273_SCAN_OVER_EVENT          BIT(12)
236 #define WL1273_ERROR_EVENT              BIT(13)
237 
238 #define TUNER_MODE_STOP_SEARCH          0
239 #define TUNER_MODE_PRESET               1
240 #define TUNER_MODE_AUTO_SEEK            2
241 #define TUNER_MODE_AF                   3
242 #define TUNER_MODE_AUTO_SEEK_PI         4
243 #define TUNER_MODE_AUTO_SEEK_BULK       5
244 
245 #define RDS_BLOCK_SIZE  3
246 
247 struct wl1273_fm_platform_data {
248         int (*request_resources) (struct i2c_client *client);
249         void (*free_resources) (void);
250         void (*enable) (void);
251         void (*disable) (void);
252 
253         u8 forbidden_modes;
254         unsigned int children;
255 };
256 
257 #define WL1273_FM_CORE_CELLS    2
258 
259 #define WL1273_BAND_OTHER       0
260 #define WL1273_BAND_JAPAN       1
261 
262 #define WL1273_BAND_JAPAN_LOW   76000
263 #define WL1273_BAND_JAPAN_HIGH  90000
264 #define WL1273_BAND_OTHER_LOW   87500
265 #define WL1273_BAND_OTHER_HIGH  108000
266 
267 #define WL1273_BAND_TX_LOW      76000
268 #define WL1273_BAND_TX_HIGH     108000
269 
270 struct wl1273_core {
271         struct mfd_cell cells[WL1273_FM_CORE_CELLS];
272         struct wl1273_fm_platform_data *pdata;
273 
274         unsigned int mode;
275         unsigned int i2s_mode;
276         unsigned int volume;
277         unsigned int audio_mode;
278         unsigned int channel_number;
279         struct mutex lock; /* for serializing fm radio operations */
280 
281         struct i2c_client *client;
282 
283         int (*read)(struct wl1273_core *core, u8, u16 *);
284         int (*write)(struct wl1273_core *core, u8, u16);
285         int (*write_data)(struct wl1273_core *core, u8 *, u16);
286         int (*set_audio)(struct wl1273_core *core, unsigned int);
287         int (*set_volume)(struct wl1273_core *core, unsigned int);
288 };
289 
290 #endif  /* ifndef WL1273_CORE_H */
291 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp