Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Platform data for Arizona devices |
| 3 | * |
| 4 | * Copyright 2012 Wolfson Microelectronics. PLC. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #ifndef _ARIZONA_PDATA_H |
| 12 | #define _ARIZONA_PDATA_H |
| 13 | |
Charles Keepax | 4901033 | 2015-02-25 15:37:13 +0000 | [diff] [blame] | 14 | #include <dt-bindings/mfd/arizona.h> |
| 15 | |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 16 | #define ARIZONA_GPN_DIR_MASK 0x8000 /* GPN_DIR */ |
| 17 | #define ARIZONA_GPN_DIR_SHIFT 15 /* GPN_DIR */ |
| 18 | #define ARIZONA_GPN_DIR_WIDTH 1 /* GPN_DIR */ |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 19 | #define ARIZONA_GPN_PU_MASK 0x4000 /* GPN_PU */ |
| 20 | #define ARIZONA_GPN_PU_SHIFT 14 /* GPN_PU */ |
| 21 | #define ARIZONA_GPN_PU_WIDTH 1 /* GPN_PU */ |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 22 | #define ARIZONA_GPN_PD_MASK 0x2000 /* GPN_PD */ |
| 23 | #define ARIZONA_GPN_PD_SHIFT 13 /* GPN_PD */ |
| 24 | #define ARIZONA_GPN_PD_WIDTH 1 /* GPN_PD */ |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 25 | #define ARIZONA_GPN_LVL_MASK 0x0800 /* GPN_LVL */ |
| 26 | #define ARIZONA_GPN_LVL_SHIFT 11 /* GPN_LVL */ |
| 27 | #define ARIZONA_GPN_LVL_WIDTH 1 /* GPN_LVL */ |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 28 | #define ARIZONA_GPN_POL_MASK 0x0400 /* GPN_POL */ |
| 29 | #define ARIZONA_GPN_POL_SHIFT 10 /* GPN_POL */ |
| 30 | #define ARIZONA_GPN_POL_WIDTH 1 /* GPN_POL */ |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 31 | #define ARIZONA_GPN_OP_CFG_MASK 0x0200 /* GPN_OP_CFG */ |
| 32 | #define ARIZONA_GPN_OP_CFG_SHIFT 9 /* GPN_OP_CFG */ |
| 33 | #define ARIZONA_GPN_OP_CFG_WIDTH 1 /* GPN_OP_CFG */ |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 34 | #define ARIZONA_GPN_DB_MASK 0x0100 /* GPN_DB */ |
| 35 | #define ARIZONA_GPN_DB_SHIFT 8 /* GPN_DB */ |
| 36 | #define ARIZONA_GPN_DB_WIDTH 1 /* GPN_DB */ |
| 37 | #define ARIZONA_GPN_FN_MASK 0x007F /* GPN_FN - [6:0] */ |
| 38 | #define ARIZONA_GPN_FN_SHIFT 0 /* GPN_FN - [6:0] */ |
| 39 | #define ARIZONA_GPN_FN_WIDTH 7 /* GPN_FN - [6:0] */ |
| 40 | |
| 41 | #define ARIZONA_MAX_GPIO 5 |
| 42 | |
Mark Brown | e102bef | 2012-07-10 12:37:58 +0100 | [diff] [blame] | 43 | #define ARIZONA_MAX_INPUT 4 |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 44 | |
Mark Brown | 3d91f82 | 2013-01-29 00:47:37 +0800 | [diff] [blame] | 45 | #define ARIZONA_MAX_MICBIAS 3 |
| 46 | |
Mark Brown | e102bef | 2012-07-10 12:37:58 +0100 | [diff] [blame] | 47 | #define ARIZONA_MAX_OUTPUT 6 |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 48 | |
Mark Brown | c94aa30 | 2013-01-17 16:35:14 +0900 | [diff] [blame] | 49 | #define ARIZONA_MAX_AIF 3 |
| 50 | |
Mark Brown | 9dd555e | 2012-11-26 21:17:21 +0000 | [diff] [blame] | 51 | #define ARIZONA_HAP_ACT_ERM 0 |
| 52 | #define ARIZONA_HAP_ACT_LRA 2 |
| 53 | |
Mark Brown | 2a51da0 | 2012-07-09 19:33:14 +0100 | [diff] [blame] | 54 | #define ARIZONA_MAX_PDM_SPK 2 |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 55 | |
| 56 | struct regulator_init_data; |
| 57 | |
Mark Brown | 3d91f82 | 2013-01-29 00:47:37 +0800 | [diff] [blame] | 58 | struct arizona_micbias { |
| 59 | int mV; /** Regulated voltage */ |
| 60 | unsigned int ext_cap:1; /** External capacitor fitted */ |
| 61 | unsigned int discharge:1; /** Actively discharge */ |
Charles Keepax | f773fc6 | 2013-05-21 14:56:58 +0100 | [diff] [blame] | 62 | unsigned int soft_start:1; /** Disable aggressive startup ramp rate */ |
Mark Brown | 544c7aa | 2013-01-29 18:44:41 +0800 | [diff] [blame] | 63 | unsigned int bypass:1; /** Use bypass mode */ |
Mark Brown | 3d91f82 | 2013-01-29 00:47:37 +0800 | [diff] [blame] | 64 | }; |
| 65 | |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 66 | struct arizona_micd_config { |
| 67 | unsigned int src; |
| 68 | unsigned int bias; |
| 69 | bool gpio; |
| 70 | }; |
| 71 | |
Mark Brown | 6fed4d8 | 2013-04-01 22:03:06 +0100 | [diff] [blame] | 72 | struct arizona_micd_range { |
| 73 | int max; /** Ohms */ |
| 74 | int key; /** Key to report to input layer */ |
| 75 | }; |
| 76 | |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 77 | struct arizona_pdata { |
| 78 | int reset; /** GPIO controlling /RESET, if any */ |
| 79 | int ldoena; /** GPIO controlling LODENA, if any */ |
| 80 | |
| 81 | /** Regulator configuration for MICVDD */ |
| 82 | struct regulator_init_data *micvdd; |
| 83 | |
| 84 | /** Regulator configuration for LDO1 */ |
| 85 | struct regulator_init_data *ldo1; |
| 86 | |
| 87 | /** If a direct 32kHz clock is provided on an MCLK specify it here */ |
| 88 | int clk32k_src; |
| 89 | |
Mark Brown | f8a0941 | 2013-03-22 12:59:33 +0100 | [diff] [blame] | 90 | /** Mode for primary IRQ (defaults to active low) */ |
| 91 | unsigned int irq_flags; |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 92 | |
| 93 | /* Base GPIO */ |
| 94 | int gpio_base; |
| 95 | |
| 96 | /** Pin state for GPIO pins */ |
Charles Keepax | 6e00ff0 | 2015-03-29 12:45:42 +0100 | [diff] [blame] | 97 | unsigned int gpio_defaults[ARIZONA_MAX_GPIO]; |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 98 | |
Mark Brown | c94aa30 | 2013-01-17 16:35:14 +0900 | [diff] [blame] | 99 | /** |
| 100 | * Maximum number of channels clocks will be generated for, |
| 101 | * useful for systems where and I2S bus with multiple data |
| 102 | * lines is mastered. |
| 103 | */ |
| 104 | int max_channels_clocked[ARIZONA_MAX_AIF]; |
| 105 | |
Mark Brown | 92a4987 | 2013-01-11 08:55:39 +0900 | [diff] [blame] | 106 | /** GPIO5 is used for jack detection */ |
| 107 | bool jd_gpio5; |
| 108 | |
Mark Brown | e56a0a5 | 2013-04-01 19:03:52 +0100 | [diff] [blame] | 109 | /** Internal pull on GPIO5 is disabled when used for jack detection */ |
| 110 | bool jd_gpio5_nopull; |
| 111 | |
Richard Fitzgerald | a288d64 | 2014-05-23 12:54:57 +0100 | [diff] [blame] | 112 | /** set to true if jackdet contact opens on insert */ |
| 113 | bool jd_invert; |
| 114 | |
Mark Brown | dd235ee | 2013-01-11 08:55:51 +0900 | [diff] [blame] | 115 | /** Use the headphone detect circuit to identify the accessory */ |
| 116 | bool hpdet_acc_id; |
| 117 | |
Mark Brown | 9c2ba27 | 2013-02-25 23:42:31 +0000 | [diff] [blame] | 118 | /** Check for line output with HPDET method */ |
| 119 | bool hpdet_acc_id_line; |
| 120 | |
Mark Brown | 1eda6aa | 2013-01-11 08:55:54 +0900 | [diff] [blame] | 121 | /** GPIO used for mic isolation with HPDET */ |
| 122 | int hpdet_id_gpio; |
| 123 | |
Inha Song | 9e86b2a | 2015-05-04 13:42:13 +0900 | [diff] [blame^] | 124 | /** Channel to use for headphone detection */ |
| 125 | unsigned int hpdet_channel; |
| 126 | |
Mark Brown | cd59e79 | 2013-04-01 19:21:48 +0100 | [diff] [blame] | 127 | /** Extra debounce timeout used during initial mic detection (ms) */ |
| 128 | int micd_detect_debounce; |
| 129 | |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 130 | /** GPIO for mic detection polarity */ |
| 131 | int micd_pol_gpio; |
| 132 | |
Mark Brown | b17e546 | 2013-01-11 08:55:24 +0900 | [diff] [blame] | 133 | /** Mic detect ramp rate */ |
| 134 | int micd_bias_start_time; |
| 135 | |
Mark Brown | 2e033db | 2013-01-21 17:36:33 +0900 | [diff] [blame] | 136 | /** Mic detect sample rate */ |
| 137 | int micd_rate; |
| 138 | |
| 139 | /** Mic detect debounce level */ |
| 140 | int micd_dbtime; |
| 141 | |
Mark Brown | 7abd4e2 | 2013-04-01 19:25:55 +0100 | [diff] [blame] | 142 | /** Mic detect timeout (ms) */ |
| 143 | int micd_timeout; |
| 144 | |
Mark Brown | bbbd46e | 2013-01-10 19:38:43 +0000 | [diff] [blame] | 145 | /** Force MICBIAS on for mic detect */ |
| 146 | bool micd_force_micbias; |
| 147 | |
Mark Brown | 6fed4d8 | 2013-04-01 22:03:06 +0100 | [diff] [blame] | 148 | /** Mic detect level parameters */ |
| 149 | const struct arizona_micd_range *micd_ranges; |
| 150 | int num_micd_ranges; |
| 151 | |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 152 | /** Headset polarity configurations */ |
| 153 | struct arizona_micd_config *micd_configs; |
| 154 | int num_micd_configs; |
| 155 | |
| 156 | /** Reference voltage for DMIC inputs */ |
| 157 | int dmic_ref[ARIZONA_MAX_INPUT]; |
| 158 | |
Mark Brown | 3d91f82 | 2013-01-29 00:47:37 +0800 | [diff] [blame] | 159 | /** MICBIAS configurations */ |
| 160 | struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS]; |
| 161 | |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 162 | /** Mode of input structures */ |
| 163 | int inmode[ARIZONA_MAX_INPUT]; |
| 164 | |
| 165 | /** Mode for outputs */ |
| 166 | bool out_mono[ARIZONA_MAX_OUTPUT]; |
| 167 | |
| 168 | /** PDM speaker mute setting */ |
| 169 | unsigned int spk_mute[ARIZONA_MAX_PDM_SPK]; |
| 170 | |
| 171 | /** PDM speaker format */ |
| 172 | unsigned int spk_fmt[ARIZONA_MAX_PDM_SPK]; |
Mark Brown | 9dd555e | 2012-11-26 21:17:21 +0000 | [diff] [blame] | 173 | |
| 174 | /** Haptic actuator type */ |
| 175 | unsigned int hap_act; |
Mark Brown | 3092f80 | 2013-03-24 23:05:58 +0000 | [diff] [blame] | 176 | |
| 177 | /** GPIO for primary IRQ (used for edge triggered emulation) */ |
| 178 | int irq_gpio; |
Mark Brown | 3cc7298 | 2012-06-19 16:31:53 +0100 | [diff] [blame] | 179 | }; |
| 180 | |
| 181 | #endif |