Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: arizona: Provide platform data for MICBIAS configuration

Allow the MICBIAS voltages and other attributes to be configured by the
platform.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Mark Brown and committed by
Samuel Ortiz
3d91f828 648a9880

+35
+23
drivers/mfd/arizona-core.c
··· 510 510 goto err_reset; 511 511 } 512 512 513 + for (i = 0; i < ARIZONA_MAX_MICBIAS; i++) { 514 + if (!arizona->pdata.micbias[i].mV) 515 + continue; 516 + 517 + val = (arizona->pdata.micbias[i].mV - 1500) / 100; 518 + val <<= ARIZONA_MICB1_LVL_SHIFT; 519 + 520 + if (arizona->pdata.micbias[i].ext_cap) 521 + val |= ARIZONA_MICB1_EXT_CAP; 522 + 523 + if (arizona->pdata.micbias[i].discharge) 524 + val |= ARIZONA_MICB1_DISCH; 525 + 526 + if (arizona->pdata.micbias[i].fast_start) 527 + val |= ARIZONA_MICB1_RATE; 528 + 529 + regmap_update_bits(arizona->regmap, 530 + ARIZONA_MIC_BIAS_CTRL_1 + i, 531 + ARIZONA_MICB1_LVL_MASK | 532 + ARIZONA_MICB1_DISCH | 533 + ARIZONA_MICB1_RATE, val); 534 + } 535 + 513 536 for (i = 0; i < ARIZONA_MAX_INPUT; i++) { 514 537 /* Default for both is 0 so noop with defaults */ 515 538 val = arizona->pdata.dmic_ref[i]
+12
include/linux/mfd/arizona/pdata.h
··· 56 56 #define ARIZONA_DMIC_MICBIAS2 2 57 57 #define ARIZONA_DMIC_MICBIAS3 3 58 58 59 + #define ARIZONA_MAX_MICBIAS 3 60 + 59 61 #define ARIZONA_INMODE_DIFF 0 60 62 #define ARIZONA_INMODE_SE 1 61 63 #define ARIZONA_INMODE_DMIC 2 ··· 70 68 #define ARIZONA_MAX_PDM_SPK 2 71 69 72 70 struct regulator_init_data; 71 + 72 + struct arizona_micbias { 73 + int mV; /** Regulated voltage */ 74 + unsigned int ext_cap:1; /** External capacitor fitted */ 75 + unsigned int discharge:1; /** Actively discharge */ 76 + unsigned int fast_start:1; /** Enable aggressive startup ramp rate */ 77 + }; 73 78 74 79 struct arizona_micd_config { 75 80 unsigned int src; ··· 114 105 115 106 /** Reference voltage for DMIC inputs */ 116 107 int dmic_ref[ARIZONA_MAX_INPUT]; 108 + 109 + /** MICBIAS configurations */ 110 + struct arizona_micbias micbias[ARIZONA_MAX_MICBIAS]; 117 111 118 112 /** Mode of input structures */ 119 113 int inmode[ARIZONA_MAX_INPUT];