Lines Matching +full:rate +full:- +full:np +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8903.c -- WM8903 ALSA SoC Audio driver
5 * Copyright 2008-12 Wolfson Microelectronics
6 * Copyright 2011-2012 NVIDIA, Inc.
11 * - TDM mode configuration.
41 { 4, 0x0018 }, /* R4 - Bias Control 0 */
42 { 5, 0x0000 }, /* R5 - VMID Control 0 */
43 { 6, 0x0000 }, /* R6 - Mic Bias Control 0 */
44 { 8, 0x0001 }, /* R8 - Analogue DAC 0 */
45 { 10, 0x0001 }, /* R10 - Analogue ADC 0 */
46 { 12, 0x0000 }, /* R12 - Power Management 0 */
47 { 13, 0x0000 }, /* R13 - Power Management 1 */
48 { 14, 0x0000 }, /* R14 - Power Management 2 */
49 { 15, 0x0000 }, /* R15 - Power Management 3 */
50 { 16, 0x0000 }, /* R16 - Power Management 4 */
51 { 17, 0x0000 }, /* R17 - Power Management 5 */
52 { 18, 0x0000 }, /* R18 - Power Management 6 */
53 { 20, 0x0400 }, /* R20 - Clock Rates 0 */
54 { 21, 0x0D07 }, /* R21 - Clock Rates 1 */
55 { 22, 0x0000 }, /* R22 - Clock Rates 2 */
56 { 24, 0x0050 }, /* R24 - Audio Interface 0 */
57 { 25, 0x0242 }, /* R25 - Audio Interface 1 */
58 { 26, 0x0008 }, /* R26 - Audio Interface 2 */
59 { 27, 0x0022 }, /* R27 - Audio Interface 3 */
60 { 30, 0x00C0 }, /* R30 - DAC Digital Volume Left */
61 { 31, 0x00C0 }, /* R31 - DAC Digital Volume Right */
62 { 32, 0x0000 }, /* R32 - DAC Digital 0 */
63 { 33, 0x0000 }, /* R33 - DAC Digital 1 */
64 { 36, 0x00C0 }, /* R36 - ADC Digital Volume Left */
65 { 37, 0x00C0 }, /* R37 - ADC Digital Volume Right */
66 { 38, 0x0000 }, /* R38 - ADC Digital 0 */
67 { 39, 0x0073 }, /* R39 - Digital Microphone 0 */
68 { 40, 0x09BF }, /* R40 - DRC 0 */
69 { 41, 0x3241 }, /* R41 - DRC 1 */
70 { 42, 0x0020 }, /* R42 - DRC 2 */
71 { 43, 0x0000 }, /* R43 - DRC 3 */
72 { 44, 0x0085 }, /* R44 - Analogue Left Input 0 */
73 { 45, 0x0085 }, /* R45 - Analogue Right Input 0 */
74 { 46, 0x0044 }, /* R46 - Analogue Left Input 1 */
75 { 47, 0x0044 }, /* R47 - Analogue Right Input 1 */
76 { 50, 0x0008 }, /* R50 - Analogue Left Mix 0 */
77 { 51, 0x0004 }, /* R51 - Analogue Right Mix 0 */
78 { 52, 0x0000 }, /* R52 - Analogue Spk Mix Left 0 */
79 { 53, 0x0000 }, /* R53 - Analogue Spk Mix Left 1 */
80 { 54, 0x0000 }, /* R54 - Analogue Spk Mix Right 0 */
81 { 55, 0x0000 }, /* R55 - Analogue Spk Mix Right 1 */
82 { 57, 0x002D }, /* R57 - Analogue OUT1 Left */
83 { 58, 0x002D }, /* R58 - Analogue OUT1 Right */
84 { 59, 0x0039 }, /* R59 - Analogue OUT2 Left */
85 { 60, 0x0039 }, /* R60 - Analogue OUT2 Right */
86 { 62, 0x0139 }, /* R62 - Analogue OUT3 Left */
87 { 63, 0x0139 }, /* R63 - Analogue OUT3 Right */
88 { 64, 0x0000 }, /* R65 - Analogue SPK Output Control 0 */
89 { 67, 0x0010 }, /* R67 - DC Servo 0 */
90 { 69, 0x00A4 }, /* R69 - DC Servo 2 */
91 { 90, 0x0000 }, /* R90 - Analogue HP 0 */
92 { 94, 0x0000 }, /* R94 - Analogue Lineout 0 */
93 { 98, 0x0000 }, /* R98 - Charge Pump 0 */
94 { 104, 0x0000 }, /* R104 - Class W 0 */
95 { 108, 0x0000 }, /* R108 - Write Sequencer 0 */
96 { 109, 0x0000 }, /* R109 - Write Sequencer 1 */
97 { 110, 0x0000 }, /* R110 - Write Sequencer 2 */
98 { 111, 0x0000 }, /* R111 - Write Sequencer 3 */
99 { 112, 0x0000 }, /* R112 - Write Sequencer 4 */
100 { 114, 0x0000 }, /* R114 - Control Interface */
101 { 116, 0x00A8 }, /* R116 - GPIO Control 1 */
102 { 117, 0x00A8 }, /* R117 - GPIO Control 2 */
103 { 118, 0x00A8 }, /* R118 - GPIO Control 3 */
104 { 119, 0x0220 }, /* R119 - GPIO Control 4 */
105 { 120, 0x01A0 }, /* R120 - GPIO Control 5 */
106 { 122, 0xFFFF }, /* R122 - Interrupt Status 1 Mask */
107 { 123, 0x0000 }, /* R123 - Interrupt Polarity 1 */
108 { 126, 0x0000 }, /* R126 - Interrupt Control */
109 { 129, 0x0000 }, /* R129 - Control Interface Test 1 */
110 { 149, 0x6810 }, /* R149 - Charge Pump Test 1 */
111 { 164, 0x0028 }, /* R164 - Clock Rate Test 4 */
112 { 172, 0x0000 }, /* R172 - Analogue Output Bias 0 */
269 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wm8903_dcs_event()
274 wm8903->dcs_pending |= 1 << w->shift; in wm8903_dcs_event()
278 1 << w->shift, 0); in wm8903_dcs_event()
296 if (wm8903->dcs_pending) { in wm8903_seq_notifier()
297 dev_dbg(component->dev, "Starting DC servo for %x\n", in wm8903_seq_notifier()
298 wm8903->dcs_pending); in wm8903_seq_notifier()
301 for (i = 0; i < ARRAY_SIZE(wm8903->dcs_cache); i++) { in wm8903_seq_notifier()
302 if (!(wm8903->dcs_pending & (1 << i))) in wm8903_seq_notifier()
305 if (wm8903->dcs_cache[i]) { in wm8903_seq_notifier()
306 dev_dbg(component->dev, in wm8903_seq_notifier()
308 3 - i, wm8903->dcs_cache[i]); in wm8903_seq_notifier()
311 wm8903->dcs_cache[i] & 0xff); in wm8903_seq_notifier()
313 dev_dbg(component->dev, in wm8903_seq_notifier()
314 "Calibrate DC servo %d\n", 3 - i); in wm8903_seq_notifier()
320 if (wm8903->class_w_users) in wm8903_seq_notifier()
327 WM8903_DCS_ENA_MASK, wm8903->dcs_pending); in wm8903_seq_notifier()
337 if (wm8903->class_w_users) in wm8903_seq_notifier()
340 for (i = 0; i < ARRAY_SIZE(wm8903->dcs_cache); i++) { in wm8903_seq_notifier()
341 if (!(wm8903->dcs_pending & (1 << i))) in wm8903_seq_notifier()
346 dev_dbg(component->dev, "DC servo %d: %x\n", in wm8903_seq_notifier()
347 3 - i, val); in wm8903_seq_notifier()
348 wm8903->dcs_cache[i] = val; in wm8903_seq_notifier()
357 wm8903->dcs_pending = 0; in wm8903_seq_notifier()
380 if (ucontrol->value.integer.value[0]) { in wm8903_class_w_put()
381 if (wm8903->class_w_users == 0) { in wm8903_class_w_put()
382 dev_dbg(component->dev, "Disabling Class W\n"); in wm8903_class_w_put()
386 wm8903->class_w_users++; in wm8903_class_w_put()
393 if (!ucontrol->value.integer.value[0]) { in wm8903_class_w_put()
394 if (wm8903->class_w_users == 1) { in wm8903_class_w_put()
395 dev_dbg(component->dev, "Enabling Class W\n"); in wm8903_class_w_put()
399 wm8903->class_w_users--; in wm8903_class_w_put()
402 dev_dbg(component->dev, "Bypass use count now %d\n", in wm8903_class_w_put()
403 wm8903->class_w_users); in wm8903_class_w_put()
421 * rate. in wm8903_set_deemph()
423 if (wm8903->deemph) { in wm8903_set_deemph()
426 if (abs(wm8903_deemph[i] - wm8903->fs) < in wm8903_set_deemph()
427 abs(wm8903_deemph[best] - wm8903->fs)) in wm8903_set_deemph()
437 dev_dbg(component->dev, "Set deemphasis %d (%dHz)\n", in wm8903_set_deemph()
450 ucontrol->value.integer.value[0] = wm8903->deemph; in wm8903_get_deemph()
460 unsigned int deemph = ucontrol->value.integer.value[0]; in wm8903_put_deemph()
464 return -EINVAL; in wm8903_put_deemph()
466 mutex_lock(&wm8903->lock); in wm8903_put_deemph()
467 if (wm8903->deemph != deemph) { in wm8903_put_deemph()
468 wm8903->deemph = deemph; in wm8903_put_deemph()
474 mutex_unlock(&wm8903->lock); in wm8903_put_deemph()
480 static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
484 static const DECLARE_TLV_DB_SCALE(digital_sidetone_tlv, -3600, 300, 0);
485 static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0);
488 static const DECLARE_TLV_DB_SCALE(drc_tlv_amp, -2250, 75, 0);
491 static const DECLARE_TLV_DB_SCALE(drc_tlv_startup, -300, 50, 0);
494 "Hi-fi", "Voice 1", "Voice 2", "Voice 3"
522 "363us", "762us", "1.45ms", "2.9ms", "5.8ms", "11.6ms", "23.2ms",
523 "46.4ms", "92.8ms", "185.6ms"
530 "186ms", "372ms", "743ms", "1.49s", "2.97s", "5.94s", "11.89s",
545 "0.725ms", "1.45ms", "5.8ms"
583 "Single-Ended", "Differential Line", "Differential Mic"
648 /* Input PGAs - No TLV since the scale depends on PGA mode */
675 SOC_ENUM("DRC Attack Rate", drc_attack),
676 SOC_ENUM("DRC Decay Rate", drc_decay),
681 SOC_ENUM("DRC QR Decay Rate", drc_qr_decay),
699 SOC_ENUM("DAC Soft Mute Rate", soft_mute),
960 { "Left Input Mode Mux", "Single-Ended", "Left Input Inverting Mux" },
970 { "Right Input Mode Mux", "Single-Ended",
1171 dev_dbg(component->dev, "Enabling Class W\n"); in wm8903_set_bias_level()
1214 struct snd_soc_component *component = codec_dai->component; in wm8903_set_dai_sysclk()
1217 wm8903->sysclk = freq; in wm8903_set_dai_sysclk()
1225 struct snd_soc_component *component = codec_dai->component; in wm8903_set_dai_fmt()
1244 return -EINVAL; in wm8903_set_dai_fmt()
1263 return -EINVAL; in wm8903_set_dai_fmt()
1278 return -EINVAL; in wm8903_set_dai_fmt()
1297 return -EINVAL; in wm8903_set_dai_fmt()
1301 return -EINVAL; in wm8903_set_dai_fmt()
1311 struct snd_soc_component *component = codec_dai->component; in wm8903_mute()
1331 int rate; member
1394 /* CLK_SYS/BCLK ratios - multiplied by 10 due to .5s */
1420 int rate; member
1441 struct snd_soc_component *component = dai->component; in wm8903_hw_params()
1466 /* Configure sample rate logic for DSP - choose nearest rate */ in wm8903_hw_params()
1468 best_val = abs(sample_rates[dsp_config].rate - fs); in wm8903_hw_params()
1470 cur_val = abs(sample_rates[i].rate - fs); in wm8903_hw_params()
1477 dev_dbg(component->dev, "DSP fs = %dHz\n", sample_rates[dsp_config].rate); in wm8903_hw_params()
1500 return -EINVAL; in wm8903_hw_params()
1503 dev_dbg(component->dev, "MCLK = %dHz, target sample rate = %dHz\n", in wm8903_hw_params()
1504 wm8903->sysclk, fs); in wm8903_hw_params()
1511 best_val = abs((wm8903->sysclk / in wm8903_hw_params()
1513 clk_sys_ratios[0].div)) - fs); in wm8903_hw_params()
1515 cur_val = abs((wm8903->sysclk / in wm8903_hw_params()
1517 clk_sys_ratios[i].div)) - fs); in wm8903_hw_params()
1527 clk_sys = wm8903->sysclk / 2; in wm8903_hw_params()
1530 clk_sys = wm8903->sysclk; in wm8903_hw_params()
1535 clock1 |= clk_sys_ratios[clk_config].rate << WM8903_CLK_SYS_RATE_SHIFT; in wm8903_hw_params()
1538 dev_dbg(component->dev, "CLK_SYS_RATE=%x, CLK_SYS_MODE=%x div=%d\n", in wm8903_hw_params()
1539 clk_sys_ratios[clk_config].rate, in wm8903_hw_params()
1543 dev_dbg(component->dev, "Actual CLK_SYS = %dHz\n", clk_sys); in wm8903_hw_params()
1553 cur_val = ((clk_sys * 10) / bclk_divs[i].ratio) - bclk; in wm8903_hw_params()
1563 dev_dbg(component->dev, "BCLK ratio %d for %dHz - actual BCLK = %dHz\n", in wm8903_hw_params()
1570 wm8903->fs = params_rate(params); in wm8903_hw_params()
1584 * wm8903_mic_detect - Enable microphone detection via the WM8903 IRQ
1606 dev_dbg(component->dev, "Enabling microphone detection: %x %x\n", in wm8903_mic_detect()
1610 wm8903->mic_jack = jack; in wm8903_mic_detect()
1611 wm8903->mic_det = det; in wm8903_mic_detect()
1612 wm8903->mic_short = shrt; in wm8903_mic_detect()
1646 ret = regmap_read(wm8903->regmap, WM8903_INTERRUPT_STATUS_1_MASK, in wm8903_irq()
1649 dev_err(wm8903->dev, "Failed to read IRQ mask: %d\n", ret); in wm8903_irq()
1653 ret = regmap_read(wm8903->regmap, WM8903_INTERRUPT_STATUS_1, &int_val); in wm8903_irq()
1655 dev_err(wm8903->dev, "Failed to read IRQ status: %d\n", ret); in wm8903_irq()
1662 dev_warn(wm8903->dev, "Write sequencer done\n"); in wm8903_irq()
1667 * invert the polarity of the interrupt after each event - to in wm8903_irq()
1672 mic_report = wm8903->mic_last_report; in wm8903_irq()
1673 ret = regmap_read(wm8903->regmap, WM8903_INTERRUPT_POLARITY_1, in wm8903_irq()
1676 dev_err(wm8903->dev, "Failed to read interrupt polarity: %d\n", in wm8903_irq()
1683 trace_snd_soc_jack_irq(dev_name(wm8903->dev)); in wm8903_irq()
1687 dev_dbg(wm8903->dev, "Microphone short (pol=%x)\n", int_pol); in wm8903_irq()
1689 mic_report ^= wm8903->mic_short; in wm8903_irq()
1694 dev_dbg(wm8903->dev, "Microphone detect (pol=%x)\n", int_pol); in wm8903_irq()
1696 mic_report ^= wm8903->mic_det; in wm8903_irq()
1699 msleep(wm8903->mic_delay); in wm8903_irq()
1702 regmap_update_bits(wm8903->regmap, WM8903_INTERRUPT_POLARITY_1, in wm8903_irq()
1705 snd_soc_jack_report(wm8903->mic_jack, mic_report, in wm8903_irq()
1706 wm8903->mic_short | wm8903->mic_det); in wm8903_irq()
1708 wm8903->mic_last_report = mic_report; in wm8903_irq()
1744 .name = "wm8903-hifi",
1767 regcache_sync(wm8903->regmap); in wm8903_resume()
1776 return -EINVAL; in wm8903_gpio_request()
1791 ret = regmap_update_bits(wm8903->regmap, in wm8903_gpio_direction_in()
1804 regmap_read(wm8903->regmap, WM8903_GPIO_CONTROL_1 + offset, ®); in wm8903_gpio_get()
1820 ret = regmap_update_bits(wm8903->regmap, in wm8903_gpio_direction_out()
1832 regmap_update_bits(wm8903->regmap, WM8903_GPIO_CONTROL_1 + offset, in wm8903_gpio_set()
1850 struct wm8903_platform_data *pdata = wm8903->pdata; in wm8903_init_gpio()
1853 wm8903->gpio_chip = wm8903_template_chip; in wm8903_init_gpio()
1854 wm8903->gpio_chip.ngpio = WM8903_NUM_GPIO; in wm8903_init_gpio()
1855 wm8903->gpio_chip.parent = wm8903->dev; in wm8903_init_gpio()
1857 if (pdata->gpio_base) in wm8903_init_gpio()
1858 wm8903->gpio_chip.base = pdata->gpio_base; in wm8903_init_gpio()
1860 wm8903->gpio_chip.base = -1; in wm8903_init_gpio()
1862 ret = gpiochip_add_data(&wm8903->gpio_chip, wm8903); in wm8903_init_gpio()
1864 dev_err(wm8903->dev, "Failed to add GPIOs: %d\n", ret); in wm8903_init_gpio()
1869 gpiochip_remove(&wm8903->gpio_chip); in wm8903_free_gpio()
1913 struct irq_data *irq_data = irq_get_irq_data(i2c->irq); in wm8903_set_pdata_irq_trigger()
1915 dev_err(&i2c->dev, "Invalid IRQ: %d\n", in wm8903_set_pdata_irq_trigger()
1916 i2c->irq); in wm8903_set_pdata_irq_trigger()
1917 return -EINVAL; in wm8903_set_pdata_irq_trigger()
1925 * so we are able to select active-high in wm8903_set_pdata_irq_trigger()
1929 pdata->irq_active_low = false; in wm8903_set_pdata_irq_trigger()
1932 pdata->irq_active_low = true; in wm8903_set_pdata_irq_trigger()
1942 const struct device_node *np = i2c->dev.of_node; in wm8903_set_pdata_from_of() local
1946 if (of_property_read_u32(np, "micdet-cfg", &val32) >= 0) in wm8903_set_pdata_from_of()
1947 pdata->micdet_cfg = val32; in wm8903_set_pdata_from_of()
1949 if (of_property_read_u32(np, "micdet-delay", &val32) >= 0) in wm8903_set_pdata_from_of()
1950 pdata->micdet_delay = val32; in wm8903_set_pdata_from_of()
1952 if (of_property_read_u32_array(np, "gpio-cfg", pdata->gpio_cfg, in wm8903_set_pdata_from_of()
1953 ARRAY_SIZE(pdata->gpio_cfg)) >= 0) { in wm8903_set_pdata_from_of()
1966 for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { in wm8903_set_pdata_from_of()
1967 if (pdata->gpio_cfg[i] == 0) { in wm8903_set_pdata_from_of()
1968 pdata->gpio_cfg[i] = WM8903_GPIO_CONFIG_ZERO; in wm8903_set_pdata_from_of()
1969 } else if (pdata->gpio_cfg[i] == 0xffffffff) { in wm8903_set_pdata_from_of()
1970 pdata->gpio_cfg[i] = 0; in wm8903_set_pdata_from_of()
1971 } else if (pdata->gpio_cfg[i] > 0x7fff) { in wm8903_set_pdata_from_of()
1972 dev_err(&i2c->dev, "Invalid gpio-cfg[%d] %x\n", in wm8903_set_pdata_from_of()
1973 i, pdata->gpio_cfg[i]); in wm8903_set_pdata_from_of()
1974 return -EINVAL; in wm8903_set_pdata_from_of()
1984 struct wm8903_platform_data *pdata = dev_get_platdata(&i2c->dev); in wm8903_i2c_probe()
1991 wm8903 = devm_kzalloc(&i2c->dev, sizeof(*wm8903), GFP_KERNEL); in wm8903_i2c_probe()
1993 return -ENOMEM; in wm8903_i2c_probe()
1995 mutex_init(&wm8903->lock); in wm8903_i2c_probe()
1996 wm8903->dev = &i2c->dev; in wm8903_i2c_probe()
1998 wm8903->regmap = devm_regmap_init_i2c(i2c, &wm8903_regmap); in wm8903_i2c_probe()
1999 if (IS_ERR(wm8903->regmap)) { in wm8903_i2c_probe()
2000 ret = PTR_ERR(wm8903->regmap); in wm8903_i2c_probe()
2001 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", in wm8903_i2c_probe()
2010 wm8903->pdata = pdata; in wm8903_i2c_probe()
2012 wm8903->pdata = devm_kzalloc(&i2c->dev, sizeof(*wm8903->pdata), in wm8903_i2c_probe()
2014 if (!wm8903->pdata) in wm8903_i2c_probe()
2015 return -ENOMEM; in wm8903_i2c_probe()
2017 if (i2c->irq) { in wm8903_i2c_probe()
2018 ret = wm8903_set_pdata_irq_trigger(i2c, wm8903->pdata); in wm8903_i2c_probe()
2023 if (i2c->dev.of_node) { in wm8903_i2c_probe()
2024 ret = wm8903_set_pdata_from_of(i2c, wm8903->pdata); in wm8903_i2c_probe()
2030 pdata = wm8903->pdata; in wm8903_i2c_probe()
2032 for (i = 0; i < ARRAY_SIZE(wm8903->supplies); i++) in wm8903_i2c_probe()
2033 wm8903->supplies[i].supply = wm8903_supply_names[i]; in wm8903_i2c_probe()
2035 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_probe()
2036 wm8903->supplies); in wm8903_i2c_probe()
2038 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); in wm8903_i2c_probe()
2042 ret = regulator_bulk_enable(ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_probe()
2043 wm8903->supplies); in wm8903_i2c_probe()
2045 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); in wm8903_i2c_probe()
2049 ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); in wm8903_i2c_probe()
2051 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); in wm8903_i2c_probe()
2055 dev_err(&i2c->dev, "Device with ID %x is not a WM8903\n", val); in wm8903_i2c_probe()
2056 ret = -ENODEV; in wm8903_i2c_probe()
2060 ret = regmap_read(wm8903->regmap, WM8903_REVISION_NUMBER, &val); in wm8903_i2c_probe()
2062 dev_err(&i2c->dev, "Failed to read chip revision: %d\n", ret); in wm8903_i2c_probe()
2065 dev_info(&i2c->dev, "WM8903 revision %c\n", in wm8903_i2c_probe()
2069 regmap_write(wm8903->regmap, WM8903_SW_RESET_AND_ID, 0x8903); in wm8903_i2c_probe()
2074 for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { in wm8903_i2c_probe()
2075 if ((!pdata->gpio_cfg[i]) || in wm8903_i2c_probe()
2076 (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO)) in wm8903_i2c_probe()
2079 regmap_write(wm8903->regmap, WM8903_GPIO_CONTROL_1 + i, in wm8903_i2c_probe()
2080 pdata->gpio_cfg[i] & 0x7fff); in wm8903_i2c_probe()
2082 val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK) in wm8903_i2c_probe()
2096 regmap_write(wm8903->regmap, WM8903_MIC_BIAS_CONTROL_0, in wm8903_i2c_probe()
2097 pdata->micdet_cfg); in wm8903_i2c_probe()
2100 if (pdata->micdet_cfg) in wm8903_i2c_probe()
2101 regmap_update_bits(wm8903->regmap, WM8903_WRITE_SEQUENCER_0, in wm8903_i2c_probe()
2110 WARN_ON(!mic_gpio && (pdata->micdet_cfg & WM8903_MICDET_ENA)); in wm8903_i2c_probe()
2112 wm8903->mic_delay = pdata->micdet_delay; in wm8903_i2c_probe()
2114 if (i2c->irq) { in wm8903_i2c_probe()
2115 if (pdata->irq_active_low) { in wm8903_i2c_probe()
2123 regmap_update_bits(wm8903->regmap, WM8903_INTERRUPT_CONTROL, in wm8903_i2c_probe()
2126 ret = request_threaded_irq(i2c->irq, NULL, wm8903_irq, in wm8903_i2c_probe()
2130 dev_err(wm8903->dev, "Failed to request IRQ: %d\n", in wm8903_i2c_probe()
2136 regmap_update_bits(wm8903->regmap, in wm8903_i2c_probe()
2142 regmap_update_bits(wm8903->regmap, WM8903_ADC_DIGITAL_VOLUME_LEFT, in wm8903_i2c_probe()
2144 regmap_update_bits(wm8903->regmap, WM8903_ADC_DIGITAL_VOLUME_RIGHT, in wm8903_i2c_probe()
2147 regmap_update_bits(wm8903->regmap, WM8903_DAC_DIGITAL_VOLUME_LEFT, in wm8903_i2c_probe()
2149 regmap_update_bits(wm8903->regmap, WM8903_DAC_DIGITAL_VOLUME_RIGHT, in wm8903_i2c_probe()
2152 regmap_update_bits(wm8903->regmap, WM8903_ANALOGUE_OUT1_LEFT, in wm8903_i2c_probe()
2154 regmap_update_bits(wm8903->regmap, WM8903_ANALOGUE_OUT1_RIGHT, in wm8903_i2c_probe()
2157 regmap_update_bits(wm8903->regmap, WM8903_ANALOGUE_OUT2_LEFT, in wm8903_i2c_probe()
2159 regmap_update_bits(wm8903->regmap, WM8903_ANALOGUE_OUT2_RIGHT, in wm8903_i2c_probe()
2162 regmap_update_bits(wm8903->regmap, WM8903_ANALOGUE_OUT3_LEFT, in wm8903_i2c_probe()
2164 regmap_update_bits(wm8903->regmap, WM8903_ANALOGUE_OUT3_RIGHT, in wm8903_i2c_probe()
2168 regmap_update_bits(wm8903->regmap, WM8903_DAC_DIGITAL_1, in wm8903_i2c_probe()
2172 ret = devm_snd_soc_register_component(&i2c->dev, in wm8903_i2c_probe()
2179 regulator_bulk_disable(ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_probe()
2180 wm8903->supplies); in wm8903_i2c_probe()
2188 regulator_bulk_disable(ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_remove()
2189 wm8903->supplies); in wm8903_i2c_remove()
2190 if (client->irq) in wm8903_i2c_remove()
2191 free_irq(client->irq, wm8903); in wm8903_i2c_remove()