Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, 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 | #ifndef __MFD_TABLA_PDATA_H__ |
| 14 | |
| 15 | #define __MFD_TABLA_PDATA_H__ |
| 16 | |
| 17 | #include <linux/slimbus/slimbus.h> |
| 18 | |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 19 | #define TABLA_LDOH_1P95_V 0x0 |
| 20 | #define TABLA_LDOH_2P35_V 0x1 |
| 21 | #define TABLA_LDOH_2P75_V 0x2 |
| 22 | #define TABLA_LDOH_2P85_V 0x3 |
| 23 | |
| 24 | #define TABLA_CFILT1_SEL 0x0 |
| 25 | #define TABLA_CFILT2_SEL 0x1 |
| 26 | #define TABLA_CFILT3_SEL 0x2 |
| 27 | |
Santosh Mardi | 2292028 | 2011-10-26 02:38:40 +0530 | [diff] [blame] | 28 | #define MAX_AMIC_CHANNEL 7 |
| 29 | |
Patrick Lai | 49efeac | 2011-11-03 11:01:12 -0700 | [diff] [blame^] | 30 | #define TABLA_OCP_300_MA 0x0 |
| 31 | #define TABLA_OCP_350_MA 0x2 |
| 32 | #define TABLA_OCP_365_MA 0x3 |
| 33 | #define TABLA_OCP_150_MA 0x4 |
| 34 | #define TABLA_OCP_190_MA 0x6 |
| 35 | #define TABLA_OCP_220_MA 0x7 |
| 36 | |
| 37 | #define TABLA_DCYCLE_255 0x0 |
| 38 | #define TABLA_DCYCLE_511 0x1 |
| 39 | #define TABLA_DCYCLE_767 0x2 |
| 40 | #define TABLA_DCYCLE_1023 0x3 |
| 41 | #define TABLA_DCYCLE_1279 0x4 |
| 42 | #define TABLA_DCYCLE_1535 0x5 |
| 43 | #define TABLA_DCYCLE_1791 0x6 |
| 44 | #define TABLA_DCYCLE_2047 0x7 |
| 45 | #define TABLA_DCYCLE_2303 0x8 |
| 46 | #define TABLA_DCYCLE_2559 0x9 |
| 47 | #define TABLA_DCYCLE_2815 0xA |
| 48 | #define TABLA_DCYCLE_3071 0xB |
| 49 | #define TABLA_DCYCLE_3327 0xC |
| 50 | #define TABLA_DCYCLE_3583 0xD |
| 51 | #define TABLA_DCYCLE_3839 0xE |
| 52 | #define TABLA_DCYCLE_4095 0xF |
| 53 | |
Santosh Mardi | 2292028 | 2011-10-26 02:38:40 +0530 | [diff] [blame] | 54 | struct tabla_amic { |
| 55 | /*legacy mode, txfe_enable and txfe_buff take 7 input |
| 56 | * each bit represent the channel / TXFE number |
| 57 | * and numbered as below |
| 58 | * bit 0 = channel 1 / TXFE1_ENABLE / TXFE1_BUFF |
| 59 | * bit 1 = channel 2 / TXFE2_ENABLE / TXFE2_BUFF |
| 60 | * ... |
| 61 | * bit 7 = channel 7 / TXFE7_ENABLE / TXFE7_BUFF |
| 62 | */ |
| 63 | u8 legacy_mode:MAX_AMIC_CHANNEL; |
| 64 | u8 txfe_enable:MAX_AMIC_CHANNEL; |
| 65 | u8 txfe_buff:MAX_AMIC_CHANNEL; |
| 66 | u8 use_pdata:MAX_AMIC_CHANNEL; |
| 67 | }; |
| 68 | |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 69 | /* Each micbias can be assigned to one of three cfilters |
| 70 | * Vbatt_min >= .15V + ldoh_v |
| 71 | * ldoh_v >= .15v + cfiltx_mv |
| 72 | * If ldoh_v = 1.95 160 mv < cfiltx_mv < 1800 mv |
| 73 | * If ldoh_v = 2.35 200 mv < cfiltx_mv < 2200 mv |
| 74 | * If ldoh_v = 2.75 240 mv < cfiltx_mv < 2600 mv |
| 75 | * If ldoh_v = 2.85 250 mv < cfiltx_mv < 2700 mv |
| 76 | */ |
| 77 | |
| 78 | struct tabla_micbias_setting { |
| 79 | u8 ldoh_v; |
| 80 | u32 cfilt1_mv; /* in mv */ |
| 81 | u32 cfilt2_mv; /* in mv */ |
| 82 | u32 cfilt3_mv; /* in mv */ |
| 83 | u8 bias1_cfilt_sel; |
| 84 | u8 bias2_cfilt_sel; |
| 85 | u8 bias3_cfilt_sel; |
| 86 | u8 bias4_cfilt_sel; |
| 87 | }; |
| 88 | |
Patrick Lai | 49efeac | 2011-11-03 11:01:12 -0700 | [diff] [blame^] | 89 | struct tabla_ocp_setting { |
| 90 | unsigned int use_pdata:1; /* 0 - use sys default as recommended */ |
| 91 | unsigned int num_attempts:4; /* up to 15 attempts */ |
| 92 | unsigned int run_time:4; /* in duty cycle */ |
| 93 | unsigned int wait_time:4; /* in duty cycle */ |
| 94 | unsigned int hph_ocp_limit:3; /* Headphone OCP current limit */ |
| 95 | }; |
| 96 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 97 | struct tabla_pdata { |
| 98 | int irq; |
| 99 | int irq_base; |
| 100 | int num_irqs; |
| 101 | int reset_gpio; |
Santosh Mardi | 2292028 | 2011-10-26 02:38:40 +0530 | [diff] [blame] | 102 | struct tabla_amic amic_settings; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 103 | struct slim_device slimbus_slave_device; |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 104 | struct tabla_micbias_setting micbias; |
Patrick Lai | 49efeac | 2011-11-03 11:01:12 -0700 | [diff] [blame^] | 105 | struct tabla_ocp_setting ocp; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 106 | }; |
| 107 | |
| 108 | #endif |