Lines Matching refs:wm8903
270 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_dcs_event() local
274 wm8903->dcs_pending |= 1 << w->shift; in wm8903_dcs_event()
291 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_seq_notifier() local
296 if (wm8903->dcs_pending) { 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()
308 3 - i, wm8903->dcs_cache[i]); in wm8903_seq_notifier()
311 wm8903->dcs_cache[i] & 0xff); 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()
348 wm8903->dcs_cache[i] = val; in wm8903_seq_notifier()
357 wm8903->dcs_pending = 0; in wm8903_seq_notifier()
373 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_class_w_put() local
381 if (wm8903->class_w_users == 0) { in wm8903_class_w_put()
386 wm8903->class_w_users++; in wm8903_class_w_put()
394 if (wm8903->class_w_users == 1) { in wm8903_class_w_put()
399 wm8903->class_w_users--; in wm8903_class_w_put()
403 wm8903->class_w_users); in wm8903_class_w_put()
417 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_set_deemph() local
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()
448 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_get_deemph() local
450 ucontrol->value.integer.value[0] = wm8903->deemph; in wm8903_get_deemph()
459 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_put_deemph() local
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()
1215 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_set_dai_sysclk() local
1217 wm8903->sysclk = freq; in wm8903_set_dai_sysclk()
1442 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_hw_params() local
1504 wm8903->sysclk, fs); in wm8903_hw_params()
1511 best_val = abs((wm8903->sysclk / in wm8903_hw_params()
1515 cur_val = abs((wm8903->sysclk / in wm8903_hw_params()
1527 clk_sys = wm8903->sysclk / 2; in wm8903_hw_params()
1530 clk_sys = wm8903->sysclk; in wm8903_hw_params()
1570 wm8903->fs = params_rate(params); in wm8903_hw_params()
1603 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_mic_detect() local
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()
1642 struct wm8903_priv *wm8903 = data; in wm8903_irq() local
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()
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()
1765 struct wm8903_priv *wm8903 = snd_soc_component_get_drvdata(component); in wm8903_resume() local
1767 regcache_sync(wm8903->regmap); in wm8903_resume()
1783 struct wm8903_priv *wm8903 = gpiochip_get_data(chip); in wm8903_gpio_direction_in() local
1791 ret = regmap_update_bits(wm8903->regmap, in wm8903_gpio_direction_in()
1801 struct wm8903_priv *wm8903 = gpiochip_get_data(chip); in wm8903_gpio_get() local
1804 regmap_read(wm8903->regmap, WM8903_GPIO_CONTROL_1 + offset, ®); in wm8903_gpio_get()
1812 struct wm8903_priv *wm8903 = gpiochip_get_data(chip); in wm8903_gpio_direction_out() local
1820 ret = regmap_update_bits(wm8903->regmap, in wm8903_gpio_direction_out()
1830 struct wm8903_priv *wm8903 = gpiochip_get_data(chip); in wm8903_gpio_set() local
1832 regmap_update_bits(wm8903->regmap, WM8903_GPIO_CONTROL_1 + offset, in wm8903_gpio_set()
1848 static void wm8903_init_gpio(struct wm8903_priv *wm8903) in wm8903_init_gpio() argument
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()
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()
1867 static void wm8903_free_gpio(struct wm8903_priv *wm8903) in wm8903_free_gpio() argument
1869 gpiochip_remove(&wm8903->gpio_chip); in wm8903_free_gpio()
1872 static void wm8903_init_gpio(struct wm8903_priv *wm8903) in wm8903_init_gpio() argument
1876 static void wm8903_free_gpio(struct wm8903_priv *wm8903) in wm8903_free_gpio() argument
1985 struct wm8903_priv *wm8903; in wm8903_i2c_probe() local
1991 wm8903 = devm_kzalloc(&i2c->dev, sizeof(*wm8903), GFP_KERNEL); in wm8903_i2c_probe()
1992 if (wm8903 == NULL) 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()
2006 i2c_set_clientdata(i2c, wm8903); 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()
2018 ret = wm8903_set_pdata_irq_trigger(i2c, wm8903->pdata); 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()
2042 ret = regulator_bulk_enable(ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_probe()
2043 wm8903->supplies); in wm8903_i2c_probe()
2049 ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); in wm8903_i2c_probe()
2060 ret = regmap_read(wm8903->regmap, WM8903_REVISION_NUMBER, &val); in wm8903_i2c_probe()
2069 regmap_write(wm8903->regmap, WM8903_SW_RESET_AND_ID, 0x8903); in wm8903_i2c_probe()
2071 wm8903_init_gpio(wm8903); in wm8903_i2c_probe()
2079 regmap_write(wm8903->regmap, WM8903_GPIO_CONTROL_1 + i, in wm8903_i2c_probe()
2096 regmap_write(wm8903->regmap, WM8903_MIC_BIAS_CONTROL_0, in wm8903_i2c_probe()
2101 regmap_update_bits(wm8903->regmap, WM8903_WRITE_SEQUENCER_0, in wm8903_i2c_probe()
2112 wm8903->mic_delay = pdata->micdet_delay; in wm8903_i2c_probe()
2123 regmap_update_bits(wm8903->regmap, WM8903_INTERRUPT_CONTROL, in wm8903_i2c_probe()
2128 "wm8903", wm8903); 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()
2179 regulator_bulk_disable(ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_probe()
2180 wm8903->supplies); in wm8903_i2c_probe()
2186 struct wm8903_priv *wm8903 = i2c_get_clientdata(client); in wm8903_i2c_remove() local
2188 regulator_bulk_disable(ARRAY_SIZE(wm8903->supplies), in wm8903_i2c_remove()
2189 wm8903->supplies); in wm8903_i2c_remove()
2191 free_irq(client->irq, wm8903); in wm8903_i2c_remove()
2192 wm8903_free_gpio(wm8903); in wm8903_i2c_remove()