blob: db76294049280e848cd2c72e93dd99cfda0f6c97 [file] [log] [blame]
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -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
13#ifndef __MFD_TABLA_PDATA_H__
14
15#define __MFD_TABLA_PDATA_H__
16
17#include <linux/slimbus/slimbus.h>
18
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053019#define SITAR_LDOH_1P95_V 0x0
20#define SITAR_LDOH_2P35_V 0x1
21#define SITAR_LDOH_2P75_V 0x2
22#define SITAR_LDOH_2P85_V 0x3
23
24#define SITAR_CFILT1_SEL 0x0
25#define SITAR_CFILT2_SEL 0x1
26#define SITAR_CFILT3_SEL 0x2
27
Patrick Lai3043fba2011-08-01 14:15:57 -070028#define TABLA_LDOH_1P95_V 0x0
29#define TABLA_LDOH_2P35_V 0x1
30#define TABLA_LDOH_2P75_V 0x2
31#define TABLA_LDOH_2P85_V 0x3
32
33#define TABLA_CFILT1_SEL 0x0
34#define TABLA_CFILT2_SEL 0x1
35#define TABLA_CFILT3_SEL 0x2
36
Santosh Mardi22920282011-10-26 02:38:40 +053037#define MAX_AMIC_CHANNEL 7
38
Patrick Lai49efeac2011-11-03 11:01:12 -070039#define TABLA_OCP_300_MA 0x0
40#define TABLA_OCP_350_MA 0x2
41#define TABLA_OCP_365_MA 0x3
42#define TABLA_OCP_150_MA 0x4
43#define TABLA_OCP_190_MA 0x6
44#define TABLA_OCP_220_MA 0x7
45
46#define TABLA_DCYCLE_255 0x0
47#define TABLA_DCYCLE_511 0x1
48#define TABLA_DCYCLE_767 0x2
49#define TABLA_DCYCLE_1023 0x3
50#define TABLA_DCYCLE_1279 0x4
51#define TABLA_DCYCLE_1535 0x5
52#define TABLA_DCYCLE_1791 0x6
53#define TABLA_DCYCLE_2047 0x7
54#define TABLA_DCYCLE_2303 0x8
55#define TABLA_DCYCLE_2559 0x9
56#define TABLA_DCYCLE_2815 0xA
57#define TABLA_DCYCLE_3071 0xB
58#define TABLA_DCYCLE_3327 0xC
59#define TABLA_DCYCLE_3583 0xD
60#define TABLA_DCYCLE_3839 0xE
61#define TABLA_DCYCLE_4095 0xF
62
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053063struct wcd9xxx_amic {
Santosh Mardi22920282011-10-26 02:38:40 +053064 /*legacy mode, txfe_enable and txfe_buff take 7 input
65 * each bit represent the channel / TXFE number
66 * and numbered as below
67 * bit 0 = channel 1 / TXFE1_ENABLE / TXFE1_BUFF
68 * bit 1 = channel 2 / TXFE2_ENABLE / TXFE2_BUFF
69 * ...
70 * bit 7 = channel 7 / TXFE7_ENABLE / TXFE7_BUFF
71 */
72 u8 legacy_mode:MAX_AMIC_CHANNEL;
73 u8 txfe_enable:MAX_AMIC_CHANNEL;
74 u8 txfe_buff:MAX_AMIC_CHANNEL;
75 u8 use_pdata:MAX_AMIC_CHANNEL;
76};
77
Patrick Lai3043fba2011-08-01 14:15:57 -070078/* Each micbias can be assigned to one of three cfilters
79 * Vbatt_min >= .15V + ldoh_v
80 * ldoh_v >= .15v + cfiltx_mv
81 * If ldoh_v = 1.95 160 mv < cfiltx_mv < 1800 mv
82 * If ldoh_v = 2.35 200 mv < cfiltx_mv < 2200 mv
83 * If ldoh_v = 2.75 240 mv < cfiltx_mv < 2600 mv
84 * If ldoh_v = 2.85 250 mv < cfiltx_mv < 2700 mv
85 */
86
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053087struct wcd9xxx_micbias_setting {
Patrick Lai3043fba2011-08-01 14:15:57 -070088 u8 ldoh_v;
89 u32 cfilt1_mv; /* in mv */
90 u32 cfilt2_mv; /* in mv */
91 u32 cfilt3_mv; /* in mv */
92 u8 bias1_cfilt_sel;
93 u8 bias2_cfilt_sel;
94 u8 bias3_cfilt_sel;
95 u8 bias4_cfilt_sel;
96};
97
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053098struct wcd9xxx_ocp_setting {
Patrick Lai49efeac2011-11-03 11:01:12 -070099 unsigned int use_pdata:1; /* 0 - use sys default as recommended */
100 unsigned int num_attempts:4; /* up to 15 attempts */
101 unsigned int run_time:4; /* in duty cycle */
102 unsigned int wait_time:4; /* in duty cycle */
103 unsigned int hph_ocp_limit:3; /* Headphone OCP current limit */
104};
105
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530106#define MAX_REGULATOR 6
107/*
108 * format : TABLA_<POWER_SUPPLY_PIN_NAME>_CUR_MAX
109 *
110 * <POWER_SUPPLY_PIN_NAME> from Tabla objective spec
111*/
112
113#define WCD9XXX_CDC_VDDA_CP_CUR_MAX 500000
114#define WCD9XXX_CDC_VDDA_RX_CUR_MAX 20000
115#define WCD9XXX_CDC_VDDA_TX_CUR_MAX 20000
116#define WCD9XXX_VDDIO_CDC_CUR_MAX 5000
117
118#define WCD9XXX_VDDD_CDC_D_CUR_MAX 5000
119#define WCD9XXX_VDDD_CDC_A_CUR_MAX 5000
120
121struct wcd9xxx_regulator {
122 const char *name;
123 int min_uV;
124 int max_uV;
125 int optimum_uA;
126 struct regulator *regulator;
127};
128
129struct wcd9xxx_pdata {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700130 int irq;
131 int irq_base;
132 int num_irqs;
133 int reset_gpio;
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530134 struct wcd9xxx_amic amic_settings;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700135 struct slim_device slimbus_slave_device;
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530136 struct wcd9xxx_micbias_setting micbias;
137 struct wcd9xxx_ocp_setting ocp;
138 struct wcd9xxx_regulator regulator[MAX_REGULATOR];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700139};
140
141#endif