Damir Didjusto | 1a353ce | 2013-04-02 11:45:47 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | #ifndef __MFD_TABLA_PDATA_H__ |
| 14 | |
| 15 | #define __MFD_TABLA_PDATA_H__ |
| 16 | |
| 17 | #include <linux/slimbus/slimbus.h> |
| 18 | |
Bhalchandra Gajare | 15dbeaa | 2012-06-26 12:53:07 -0700 | [diff] [blame] | 19 | #define MICBIAS_EXT_BYP_CAP 0x00 |
| 20 | #define MICBIAS_NO_EXT_BYP_CAP 0x01 |
| 21 | |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 22 | #define SITAR_LDOH_1P95_V 0x0 |
| 23 | #define SITAR_LDOH_2P35_V 0x1 |
| 24 | #define SITAR_LDOH_2P75_V 0x2 |
| 25 | #define SITAR_LDOH_2P85_V 0x3 |
| 26 | |
| 27 | #define SITAR_CFILT1_SEL 0x0 |
| 28 | #define SITAR_CFILT2_SEL 0x1 |
| 29 | #define SITAR_CFILT3_SEL 0x2 |
| 30 | |
Joonwoo Park | a889026 | 2012-10-15 12:04:27 -0700 | [diff] [blame] | 31 | #define WCD9XXX_LDOH_1P95_V 0x0 |
| 32 | #define WCD9XXX_LDOH_2P35_V 0x1 |
| 33 | #define WCD9XXX_LDOH_2P75_V 0x2 |
| 34 | #define WCD9XXX_LDOH_2P85_V 0x3 |
| 35 | #define WCD9XXX_LDOH_3P0_V 0x3 |
| 36 | |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 37 | #define TABLA_LDOH_1P95_V 0x0 |
| 38 | #define TABLA_LDOH_2P35_V 0x1 |
| 39 | #define TABLA_LDOH_2P75_V 0x2 |
| 40 | #define TABLA_LDOH_2P85_V 0x3 |
| 41 | |
| 42 | #define TABLA_CFILT1_SEL 0x0 |
| 43 | #define TABLA_CFILT2_SEL 0x1 |
| 44 | #define TABLA_CFILT3_SEL 0x2 |
| 45 | |
Santosh Mardi | 2292028 | 2011-10-26 02:38:40 +0530 | [diff] [blame] | 46 | #define MAX_AMIC_CHANNEL 7 |
| 47 | |
Patrick Lai | 49efeac | 2011-11-03 11:01:12 -0700 | [diff] [blame] | 48 | #define TABLA_OCP_300_MA 0x0 |
| 49 | #define TABLA_OCP_350_MA 0x2 |
| 50 | #define TABLA_OCP_365_MA 0x3 |
| 51 | #define TABLA_OCP_150_MA 0x4 |
| 52 | #define TABLA_OCP_190_MA 0x6 |
| 53 | #define TABLA_OCP_220_MA 0x7 |
| 54 | |
| 55 | #define TABLA_DCYCLE_255 0x0 |
| 56 | #define TABLA_DCYCLE_511 0x1 |
| 57 | #define TABLA_DCYCLE_767 0x2 |
| 58 | #define TABLA_DCYCLE_1023 0x3 |
| 59 | #define TABLA_DCYCLE_1279 0x4 |
| 60 | #define TABLA_DCYCLE_1535 0x5 |
| 61 | #define TABLA_DCYCLE_1791 0x6 |
| 62 | #define TABLA_DCYCLE_2047 0x7 |
| 63 | #define TABLA_DCYCLE_2303 0x8 |
| 64 | #define TABLA_DCYCLE_2559 0x9 |
| 65 | #define TABLA_DCYCLE_2815 0xA |
| 66 | #define TABLA_DCYCLE_3071 0xB |
| 67 | #define TABLA_DCYCLE_3327 0xC |
| 68 | #define TABLA_DCYCLE_3583 0xD |
| 69 | #define TABLA_DCYCLE_3839 0xE |
| 70 | #define TABLA_DCYCLE_4095 0xF |
| 71 | |
Damir Didjusto | 1a353ce | 2013-04-02 11:45:47 -0700 | [diff] [blame] | 72 | #define TAIKO_MCLK_CLK_12P288MHZ 12288000 |
| 73 | #define TAIKO_MCLK_CLK_9P6HZ 9600000 |
| 74 | |
| 75 | /* Only valid for 9.6 MHz mclk */ |
| 76 | #define TAIKO_DMIC_SAMPLE_RATE_2P4MHZ 2400000 |
| 77 | #define TAIKO_DMIC_SAMPLE_RATE_3P2MHZ 3200000 |
| 78 | #define TAIKO_DMIC_SAMPLE_RATE_4P8MHZ 4800000 |
| 79 | |
| 80 | /* Only valid for 12.288 MHz mclk */ |
| 81 | #define TAIKO_DMIC_SAMPLE_RATE_3P072MHZ 3072000 |
| 82 | #define TAIKO_DMIC_SAMPLE_RATE_4P096MHZ 4096000 |
| 83 | #define TAIKO_DMIC_SAMPLE_RATE_6P144MHZ 6144000 |
| 84 | |
| 85 | #define TAIKO_DMIC_SAMPLE_RATE_UNDEFINED 0 |
| 86 | |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 87 | struct wcd9xxx_amic { |
Santosh Mardi | 2292028 | 2011-10-26 02:38:40 +0530 | [diff] [blame] | 88 | /*legacy mode, txfe_enable and txfe_buff take 7 input |
| 89 | * each bit represent the channel / TXFE number |
| 90 | * and numbered as below |
| 91 | * bit 0 = channel 1 / TXFE1_ENABLE / TXFE1_BUFF |
| 92 | * bit 1 = channel 2 / TXFE2_ENABLE / TXFE2_BUFF |
| 93 | * ... |
| 94 | * bit 7 = channel 7 / TXFE7_ENABLE / TXFE7_BUFF |
| 95 | */ |
| 96 | u8 legacy_mode:MAX_AMIC_CHANNEL; |
| 97 | u8 txfe_enable:MAX_AMIC_CHANNEL; |
| 98 | u8 txfe_buff:MAX_AMIC_CHANNEL; |
| 99 | u8 use_pdata:MAX_AMIC_CHANNEL; |
| 100 | }; |
| 101 | |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 102 | /* Each micbias can be assigned to one of three cfilters |
| 103 | * Vbatt_min >= .15V + ldoh_v |
| 104 | * ldoh_v >= .15v + cfiltx_mv |
| 105 | * If ldoh_v = 1.95 160 mv < cfiltx_mv < 1800 mv |
| 106 | * If ldoh_v = 2.35 200 mv < cfiltx_mv < 2200 mv |
| 107 | * If ldoh_v = 2.75 240 mv < cfiltx_mv < 2600 mv |
| 108 | * If ldoh_v = 2.85 250 mv < cfiltx_mv < 2700 mv |
| 109 | */ |
| 110 | |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 111 | struct wcd9xxx_micbias_setting { |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 112 | u8 ldoh_v; |
| 113 | u32 cfilt1_mv; /* in mv */ |
| 114 | u32 cfilt2_mv; /* in mv */ |
| 115 | u32 cfilt3_mv; /* in mv */ |
Bhalchandra Gajare | 15dbeaa | 2012-06-26 12:53:07 -0700 | [diff] [blame] | 116 | /* Different WCD9xxx series codecs may not |
| 117 | * have 4 mic biases. If a codec has fewer |
| 118 | * mic biases, some of these properties will |
| 119 | * not be used. |
| 120 | */ |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 121 | u8 bias1_cfilt_sel; |
| 122 | u8 bias2_cfilt_sel; |
| 123 | u8 bias3_cfilt_sel; |
| 124 | u8 bias4_cfilt_sel; |
Bhalchandra Gajare | 15dbeaa | 2012-06-26 12:53:07 -0700 | [diff] [blame] | 125 | u8 bias1_cap_mode; |
| 126 | u8 bias2_cap_mode; |
| 127 | u8 bias3_cap_mode; |
| 128 | u8 bias4_cap_mode; |
Joonwoo Park | 88bfa84 | 2013-04-15 16:59:21 -0700 | [diff] [blame] | 129 | bool bias2_is_headset_only; |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 130 | }; |
| 131 | |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 132 | struct wcd9xxx_ocp_setting { |
Patrick Lai | 49efeac | 2011-11-03 11:01:12 -0700 | [diff] [blame] | 133 | unsigned int use_pdata:1; /* 0 - use sys default as recommended */ |
| 134 | unsigned int num_attempts:4; /* up to 15 attempts */ |
| 135 | unsigned int run_time:4; /* in duty cycle */ |
| 136 | unsigned int wait_time:4; /* in duty cycle */ |
| 137 | unsigned int hph_ocp_limit:3; /* Headphone OCP current limit */ |
| 138 | }; |
| 139 | |
Joonwoo Park | 5d170a4 | 2013-04-10 15:16:36 -0700 | [diff] [blame] | 140 | #define WCD9XXX_MAX_REGULATOR 8 |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 141 | /* |
| 142 | * format : TABLA_<POWER_SUPPLY_PIN_NAME>_CUR_MAX |
| 143 | * |
| 144 | * <POWER_SUPPLY_PIN_NAME> from Tabla objective spec |
| 145 | */ |
| 146 | |
| 147 | #define WCD9XXX_CDC_VDDA_CP_CUR_MAX 500000 |
| 148 | #define WCD9XXX_CDC_VDDA_RX_CUR_MAX 20000 |
| 149 | #define WCD9XXX_CDC_VDDA_TX_CUR_MAX 20000 |
| 150 | #define WCD9XXX_VDDIO_CDC_CUR_MAX 5000 |
| 151 | |
| 152 | #define WCD9XXX_VDDD_CDC_D_CUR_MAX 5000 |
| 153 | #define WCD9XXX_VDDD_CDC_A_CUR_MAX 5000 |
| 154 | |
Joonwoo Park | 448a8fc | 2013-04-10 15:25:58 -0700 | [diff] [blame] | 155 | #define WCD9XXX_VDD_SPKDRV_NAME "cdc-vdd-spkdrv" |
| 156 | |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 157 | struct wcd9xxx_regulator { |
| 158 | const char *name; |
| 159 | int min_uV; |
| 160 | int max_uV; |
| 161 | int optimum_uA; |
Joonwoo Park | 5d170a4 | 2013-04-10 15:16:36 -0700 | [diff] [blame] | 162 | bool ondemand; |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 163 | struct regulator *regulator; |
| 164 | }; |
| 165 | |
| 166 | struct wcd9xxx_pdata { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 167 | int irq; |
| 168 | int irq_base; |
| 169 | int num_irqs; |
| 170 | int reset_gpio; |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 171 | struct wcd9xxx_amic amic_settings; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 172 | struct slim_device slimbus_slave_device; |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 173 | struct wcd9xxx_micbias_setting micbias; |
| 174 | struct wcd9xxx_ocp_setting ocp; |
Joonwoo Park | 5d170a4 | 2013-04-10 15:16:36 -0700 | [diff] [blame] | 175 | struct wcd9xxx_regulator regulator[WCD9XXX_MAX_REGULATOR]; |
Venkat Sudhir | a50a376 | 2012-11-26 12:12:15 -0800 | [diff] [blame] | 176 | u32 mclk_rate; |
Damir Didjusto | 1a353ce | 2013-04-02 11:45:47 -0700 | [diff] [blame] | 177 | u32 dmic_sample_rate; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | #endif |