blob: aea31dbfc624c4003e2bd88df6c80f368ad84b8b [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
Kiran Kandic3b24402012-06-11 00:05:59 -07002 *
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#ifndef WCD9320_H
13#define WCD9320_H
14
15#include <sound/soc.h>
16#include <sound/jack.h>
17#include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h>
Joonwoo Parka8890262012-10-15 12:04:27 -070018#include "wcd9xxx-mbhc.h"
19#include "wcd9xxx-resmgr.h"
Kiran Kandic3b24402012-06-11 00:05:59 -070020
21#define TAIKO_NUM_REGISTERS 0x400
22#define TAIKO_MAX_REGISTER (TAIKO_NUM_REGISTERS-1)
23#define TAIKO_CACHE_SIZE TAIKO_NUM_REGISTERS
24
25#define TAIKO_REG_VAL(reg, val) {reg, 0, val}
Venkat Sudhira41630a2012-10-27 00:57:31 -070026#define TAIKO_MCLK_ID 0
Kiran Kandic3b24402012-06-11 00:05:59 -070027
Kiran Kandic3b24402012-06-11 00:05:59 -070028extern const u8 taiko_reg_readable[TAIKO_CACHE_SIZE];
Kiran Kandi7b7d2ff2012-09-14 14:52:14 -070029extern const u8 taiko_reset_reg_defaults[TAIKO_CACHE_SIZE];
Joonwoo Parka8890262012-10-15 12:04:27 -070030struct taiko_codec_dai_data {
31 u32 rate;
32 u32 *ch_num;
33 u32 ch_act;
34 u32 ch_tot;
Kiran Kandic3b24402012-06-11 00:05:59 -070035};
36
37enum taiko_pid_current {
38 TAIKO_PID_MIC_2P5_UA,
39 TAIKO_PID_MIC_5_UA,
40 TAIKO_PID_MIC_10_UA,
41 TAIKO_PID_MIC_20_UA,
42};
43
44struct taiko_reg_mask_val {
45 u16 reg;
46 u8 mask;
47 u8 val;
48};
49
Kiran Kandic3b24402012-06-11 00:05:59 -070050enum taiko_mbhc_analog_pwr_cfg {
51 TAIKO_ANALOG_PWR_COLLAPSED = 0,
52 TAIKO_ANALOG_PWR_ON,
53 TAIKO_NUM_ANALOG_PWR_CONFIGS,
54};
55
Kuirong Wang906ac472012-07-09 12:54:44 -070056/* Number of input and output Slimbus port */
57enum {
58 TAIKO_RX1 = 0,
59 TAIKO_RX2,
60 TAIKO_RX3,
61 TAIKO_RX4,
62 TAIKO_RX5,
63 TAIKO_RX6,
64 TAIKO_RX7,
65 TAIKO_RX8,
66 TAIKO_RX9,
67 TAIKO_RX10,
68 TAIKO_RX11,
69 TAIKO_RX12,
70 TAIKO_RX13,
71 TAIKO_RX_MAX,
72};
73
74enum {
75 TAIKO_TX1 = 0,
76 TAIKO_TX2,
77 TAIKO_TX3,
78 TAIKO_TX4,
79 TAIKO_TX5,
80 TAIKO_TX6,
81 TAIKO_TX7,
82 TAIKO_TX8,
83 TAIKO_TX9,
84 TAIKO_TX10,
85 TAIKO_TX11,
86 TAIKO_TX12,
87 TAIKO_TX13,
88 TAIKO_TX14,
89 TAIKO_TX15,
90 TAIKO_TX16,
91 TAIKO_TX_MAX,
92};
93
Kiran Kandic3b24402012-06-11 00:05:59 -070094struct anc_header {
95 u32 reserved[3];
96 u32 num_anc_slots;
97};
98
99extern int taiko_mclk_enable(struct snd_soc_codec *codec, int mclk_enable,
100 bool dapm);
Joonwoo Parka8890262012-10-15 12:04:27 -0700101extern int taiko_hs_detect(struct snd_soc_codec *codec,
102 struct wcd9xxx_mbhc_config *mbhc_cfg);
Kiran Kandic3b24402012-06-11 00:05:59 -0700103
104#endif