blob: 07a1ca0a53f4bca797183896e697ec7340a72335 [file] [log] [blame]
Asish Bhattacharyab86c3472012-02-15 08:31:52 +05301/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <sound/soc.h>
14#include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h>
15
16#define SITAR_VERSION_1_0 0x00
17
18#define SITAR_NUM_REGISTERS 0x3E0
19#define SITAR_MAX_REGISTER (SITAR_NUM_REGISTERS-1)
20#define SITAR_CACHE_SIZE SITAR_NUM_REGISTERS
21
22#define SITAR_REG_VAL(reg, val) {reg, 0, val}
23
24/* Local to the core only */
25#define SITAR_SLIM_MAX_RX_PORTS 5
26#define SITAR_SLIM_MAX_TX_PORTS 5
27
28extern const u8 sitar_reg_readable[SITAR_CACHE_SIZE];
29extern const u8 sitar_reg_defaults[SITAR_CACHE_SIZE];
30
31enum sitar_micbias_num {
32 SITAR_MICBIAS1,
33 SITAR_MICBIAS2,
34};
35
36enum sitar_pid_current {
37 SITAR_PID_MIC_2P5_UA,
38 SITAR_PID_MIC_5_UA,
39 SITAR_PID_MIC_10_UA,
40 SITAR_PID_MIC_20_UA,
41};
42
43struct sitar_mbhc_calibration {
44 enum sitar_micbias_num bias;
45 int tldoh;
46 int bg_fast_settle;
47 enum sitar_pid_current mic_current;
48 int mic_pid;
49 enum sitar_pid_current hph_current;
50 int setup_plug_removal_delay;
51 int shutdown_plug_removal;
52};
53
54struct sitar_reg_mask_val {
55 u16 reg;
56 u8 mask;
57 u8 val;
58};
59
60extern int sitar_hs_detect(struct snd_soc_codec *codec,
61 struct snd_soc_jack *headset_jack, struct snd_soc_jack *button_jack,
62 struct sitar_mbhc_calibration *calibration);
63
64#ifndef anc_header_dec
65struct anc_header {
66 u32 reserved[3];
67 u32 num_anc_slots;
68};
69#define anc_header_dec
70#endif
71
72extern int sitar_mclk_enable(struct snd_soc_codec *codec, int mclk_enable);