Lines Matching refs:codec

55 	struct snd_soc_codec *codec;  member
337 static void wm8996_set_retune_mobile(struct snd_soc_codec *codec, int block) in wm8996_set_retune_mobile() argument
339 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_set_retune_mobile()
349 if (snd_soc_read(codec, WM8996_POWER_MANAGEMENT_8) & in wm8996_set_retune_mobile()
357 if (snd_soc_read(codec, WM8996_POWER_MANAGEMENT_8) & in wm8996_set_retune_mobile()
383 dev_dbg(codec->dev, "ReTune Mobile %d %s/%dHz for %dHz sample rate\n", in wm8996_set_retune_mobile()
392 save = snd_soc_read(codec, base); in wm8996_set_retune_mobile()
396 snd_soc_update_bits(codec, base + i, 0xffff, in wm8996_set_retune_mobile()
399 snd_soc_update_bits(codec, base, WM8996_DSP1RX_EQ_ENA, save); in wm8996_set_retune_mobile()
415 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8996_put_retune_mobile_enum() local
416 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_put_retune_mobile_enum()
429 wm8996_set_retune_mobile(codec, block); in wm8996_put_retune_mobile_enum()
437 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8996_get_retune_mobile_enum() local
438 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_get_retune_mobile_enum()
577 static void wm8996_bg_enable(struct snd_soc_codec *codec) in wm8996_bg_enable() argument
579 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_bg_enable()
583 snd_soc_update_bits(codec, WM8996_POWER_MANAGEMENT_1, in wm8996_bg_enable()
589 static void wm8996_bg_disable(struct snd_soc_codec *codec) in wm8996_bg_disable() argument
591 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_bg_disable()
595 snd_soc_update_bits(codec, WM8996_POWER_MANAGEMENT_1, in wm8996_bg_disable()
602 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in bg_event() local
607 wm8996_bg_enable(codec); in bg_event()
610 wm8996_bg_disable(codec); in bg_event()
637 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in rmv_short_event() local
638 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in rmv_short_event()
656 static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask) in wait_for_dc_servo() argument
658 struct i2c_client *i2c = to_i2c_client(codec->dev); in wait_for_dc_servo()
659 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wait_for_dc_servo()
663 snd_soc_write(codec, WM8996_DC_SERVO_2, mask); in wait_for_dc_servo()
671 dev_err(codec->dev, "DC servo timed out\n"); in wait_for_dc_servo()
678 ret = snd_soc_read(codec, WM8996_DC_SERVO_2); in wait_for_dc_servo()
679 dev_dbg(codec->dev, "DC servo state: %x\n", ret); in wait_for_dc_servo()
683 dev_err(codec->dev, "DC servo timed out for %x\n", mask); in wait_for_dc_servo()
685 dev_dbg(codec->dev, "DC servo complete for %x\n", mask); in wait_for_dc_servo()
691 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); in wm8996_seq_notifier() local
692 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_seq_notifier()
697 dev_dbg(codec->dev, "Starting DC servo for %x\n", in wm8996_seq_notifier()
701 wait_for_dc_servo(codec, wm8996->dcs_pending in wm8996_seq_notifier()
708 dev_dbg(codec->dev, "Applying RMV_SHORTs %x->%x\n", in wm8996_seq_notifier()
731 snd_soc_update_bits(codec, WM8996_ANALOGUE_HP_1, mask, val); in wm8996_seq_notifier()
753 snd_soc_update_bits(codec, WM8996_ANALOGUE_HP_2, mask, val); in wm8996_seq_notifier()
762 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in dcs_start() local
763 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in dcs_start()
1535 static void wm8996_update_bclk(struct snd_soc_codec *codec) in wm8996_update_bclk() argument
1537 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_update_bclk()
1567 dev_dbg(codec->dev, "Using BCLK_DIV %d for actual BCLK %dHz\n", in wm8996_update_bclk()
1570 snd_soc_update_bits(codec, bclk_reg, in wm8996_update_bclk()
1575 static int wm8996_set_bias_level(struct snd_soc_codec *codec, in wm8996_set_bias_level() argument
1578 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_set_bias_level()
1586 snd_soc_update_bits(codec, WM8996_MICBIAS_1, in wm8996_set_bias_level()
1588 snd_soc_update_bits(codec, WM8996_MICBIAS_2, in wm8996_set_bias_level()
1593 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { in wm8996_set_bias_level()
1597 dev_err(codec->dev, in wm8996_set_bias_level()
1614 snd_soc_update_bits(codec, WM8996_MICBIAS_1, in wm8996_set_bias_level()
1616 snd_soc_update_bits(codec, WM8996_MICBIAS_2, in wm8996_set_bias_level()
1636 struct snd_soc_codec *codec = dai->codec; in wm8996_set_fmt() local
1713 snd_soc_update_bits(codec, aifctrl_reg, WM8996_AIF1_FMT_MASK, aifctrl); in wm8996_set_fmt()
1714 snd_soc_update_bits(codec, bclk_reg, in wm8996_set_fmt()
1717 snd_soc_update_bits(codec, lrclk_tx_reg, in wm8996_set_fmt()
1721 snd_soc_update_bits(codec, lrclk_rx_reg, in wm8996_set_fmt()
1737 struct snd_soc_codec *codec = dai->codec; in wm8996_hw_params() local
1738 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_hw_params()
1748 (snd_soc_read(codec, WM8996_GPIO_1)) & WM8996_GP1_FN_MASK) { in wm8996_hw_params()
1759 (snd_soc_read(codec, WM8996_GPIO_2)) & WM8996_GP2_FN_MASK) { in wm8996_hw_params()
1775 dev_err(codec->dev, "Unsupported BCLK rate: %d\n", bclk_rate); in wm8996_hw_params()
1796 wm8996_update_bclk(codec); in wm8996_hw_params()
1802 snd_soc_update_bits(codec, aifdata_reg, in wm8996_hw_params()
1806 snd_soc_update_bits(codec, lrclk_reg, WM8996_AIF1RX_RATE_MASK, in wm8996_hw_params()
1808 snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_2, in wm8996_hw_params()
1817 struct snd_soc_codec *codec = dai->codec; in wm8996_set_sysclk() local
1818 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_set_sysclk()
1829 old = snd_soc_read(codec, WM8996_AIF_CLOCKING_1) & WM8996_SYSCLK_ENA; in wm8996_set_sysclk()
1830 snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1, in wm8996_set_sysclk()
1847 dev_err(codec->dev, "Unsupported clock source %d\n", clk_id); in wm8996_set_sysclk()
1854 snd_soc_update_bits(codec, WM8996_AIF_RATE, in wm8996_set_sysclk()
1863 snd_soc_update_bits(codec, WM8996_AIF_RATE, in wm8996_set_sysclk()
1872 dev_warn(codec->dev, "Unsupported clock rate %dHz\n", in wm8996_set_sysclk()
1877 wm8996_update_bclk(codec); in wm8996_set_sysclk()
1879 snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1, in wm8996_set_sysclk()
1882 snd_soc_update_bits(codec, WM8996_CLOCKING_1, WM8996_LFCLK_ENA, lfclk); in wm8996_set_sysclk()
1883 snd_soc_update_bits(codec, WM8996_CONTROL_INTERFACE_1, in wm8996_set_sysclk()
1885 snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1, in wm8996_set_sysclk()
2004 static int wm8996_set_fll(struct snd_soc_codec *codec, int fll_id, int source, in wm8996_set_fll() argument
2007 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_set_fll()
2008 struct i2c_client *i2c = to_i2c_client(codec->dev); in wm8996_set_fll()
2019 dev_dbg(codec->dev, "FLL disabled\n"); in wm8996_set_fll()
2024 snd_soc_update_bits(codec, WM8996_FLL_CONTROL_1, in wm8996_set_fll()
2027 wm8996_bg_disable(codec); in wm8996_set_fll()
2050 dev_err(codec->dev, "Unknown FLL source %d\n", ret); in wm8996_set_fll()
2057 snd_soc_update_bits(codec, WM8996_FLL_CONTROL_5, in wm8996_set_fll()
2066 snd_soc_write(codec, WM8996_FLL_EFS_2, reg); in wm8996_set_fll()
2068 snd_soc_update_bits(codec, WM8996_FLL_CONTROL_2, in wm8996_set_fll()
2074 snd_soc_write(codec, WM8996_FLL_CONTROL_3, fll_div.theta); in wm8996_set_fll()
2076 snd_soc_update_bits(codec, WM8996_FLL_CONTROL_4, in wm8996_set_fll()
2081 snd_soc_write(codec, WM8996_FLL_EFS_1, fll_div.lambda); in wm8996_set_fll()
2084 ret = snd_soc_read(codec, WM8996_FLL_CONTROL_1); in wm8996_set_fll()
2086 wm8996_bg_enable(codec); in wm8996_set_fll()
2091 snd_soc_update_bits(codec, WM8996_FLL_CONTROL_1, in wm8996_set_fll()
2097 snd_soc_write(codec, WM8996_FLL_CONTROL_6, WM8996_FLL_SWITCH_CLK); in wm8996_set_fll()
2123 ret = snd_soc_read(codec, WM8996_INTERRUPT_RAW_STATUS_2); in wm8996_set_fll()
2128 dev_err(codec->dev, "Timed out waiting for FLL\n"); in wm8996_set_fll()
2132 dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); in wm8996_set_fll()
2244 int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, in wm8996_detect() argument
2247 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_detect()
2248 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8996_detect()
2256 wm8996->polarity_cb(codec, 0); in wm8996_detect()
2259 snd_soc_update_bits(codec, WM8996_MICBIAS_1, in wm8996_detect()
2261 snd_soc_update_bits(codec, WM8996_MICBIAS_2, in wm8996_detect()
2275 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, in wm8996_detect()
2279 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, in wm8996_detect()
2284 snd_soc_update_bits(codec, WM8996_INTERRUPT_STATUS_2_MASK, in wm8996_detect()
2291 static void wm8996_hpdet_irq(struct snd_soc_codec *codec) in wm8996_hpdet_irq() argument
2293 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8996_hpdet_irq()
2294 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_hpdet_irq()
2302 reg = snd_soc_read(codec, WM8996_HEADPHONE_DETECT_2); in wm8996_hpdet_irq()
2304 dev_err(codec->dev, "Failed to read HPDET status\n"); in wm8996_hpdet_irq()
2309 dev_err(codec->dev, "Got HPDET IRQ but HPDET is busy\n"); in wm8996_hpdet_irq()
2315 dev_dbg(codec->dev, "HPDET measured %d ohms\n", val); in wm8996_hpdet_irq()
2335 if (!(snd_soc_read(codec, WM8996_POWER_MANAGEMENT_1) & in wm8996_hpdet_irq()
2337 snd_soc_update_bits(codec, WM8996_ANALOGUE_HP_1, in wm8996_hpdet_irq()
2342 snd_soc_update_bits(codec, WM8996_ACCESSORY_DETECT_MODE_1, in wm8996_hpdet_irq()
2344 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, WM8996_MICD_ENA, in wm8996_hpdet_irq()
2351 static void wm8996_hpdet_start(struct snd_soc_codec *codec) in wm8996_hpdet_start() argument
2353 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8996_hpdet_start()
2356 snd_soc_update_bits(codec, WM8996_ANALOGUE_HP_1, in wm8996_hpdet_start()
2367 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, WM8996_MICD_ENA, 0); in wm8996_hpdet_start()
2368 snd_soc_update_bits(codec, WM8996_ACCESSORY_DETECT_MODE_1, in wm8996_hpdet_start()
2372 snd_soc_update_bits(codec, WM8996_HEADPHONE_DETECT_1, in wm8996_hpdet_start()
2376 static void wm8996_report_headphone(struct snd_soc_codec *codec) in wm8996_report_headphone() argument
2378 dev_dbg(codec->dev, "Headphone detected\n"); in wm8996_report_headphone()
2379 wm8996_hpdet_start(codec); in wm8996_report_headphone()
2382 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, in wm8996_report_headphone()
2389 static void wm8996_micd(struct snd_soc_codec *codec) in wm8996_micd() argument
2391 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_micd()
2394 val = snd_soc_read(codec, WM8996_MIC_DETECT_3); in wm8996_micd()
2396 dev_dbg(codec->dev, "Microphone event: %x\n", val); in wm8996_micd()
2399 dev_warn(codec->dev, "Microphone detection state invalid\n"); in wm8996_micd()
2405 dev_dbg(codec->dev, "Jack removal detected\n"); in wm8996_micd()
2413 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, in wm8996_micd()
2427 dev_dbg(codec->dev, "Microphone detected\n"); in wm8996_micd()
2429 wm8996_hpdet_start(codec); in wm8996_micd()
2433 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, in wm8996_micd()
2439 dev_dbg(codec->dev, "Mic button up\n"); in wm8996_micd()
2456 wm8996_report_headphone(codec); in wm8996_micd()
2460 reg = snd_soc_read(codec, WM8996_ACCESSORY_DETECT_MODE_2); in wm8996_micd()
2463 snd_soc_update_bits(codec, WM8996_ACCESSORY_DETECT_MODE_2, in wm8996_micd()
2468 wm8996->polarity_cb(codec, in wm8996_micd()
2471 dev_dbg(codec->dev, "Set microphone polarity to %d\n", in wm8996_micd()
2482 dev_dbg(codec->dev, "Mic button detected\n"); in wm8996_micd()
2486 wm8996_report_headphone(codec); in wm8996_micd()
2493 struct snd_soc_codec *codec = data; in wm8996_irq() local
2494 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_irq()
2497 irq_val = snd_soc_read(codec, WM8996_INTERRUPT_STATUS_2); in wm8996_irq()
2499 dev_err(codec->dev, "Failed to read IRQ status: %d\n", in wm8996_irq()
2503 irq_val &= ~snd_soc_read(codec, WM8996_INTERRUPT_STATUS_2_MASK); in wm8996_irq()
2508 snd_soc_write(codec, WM8996_INTERRUPT_STATUS_2, irq_val); in wm8996_irq()
2511 dev_dbg(codec->dev, "DC servo IRQ\n"); in wm8996_irq()
2516 dev_err(codec->dev, "Digital core FIFO error\n"); in wm8996_irq()
2519 dev_dbg(codec->dev, "FLL locked\n"); in wm8996_irq()
2524 wm8996_micd(codec); in wm8996_irq()
2527 wm8996_hpdet_irq(codec); in wm8996_irq()
2546 static void wm8996_retune_mobile_pdata(struct snd_soc_codec *codec) in wm8996_retune_mobile_pdata() argument
2548 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_retune_mobile_pdata()
2597 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", in wm8996_retune_mobile_pdata()
2603 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls)); in wm8996_retune_mobile_pdata()
2605 dev_err(codec->dev, in wm8996_retune_mobile_pdata()
2621 static int wm8996_probe(struct snd_soc_codec *codec) in wm8996_probe() argument
2624 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); in wm8996_probe()
2625 struct i2c_client *i2c = to_i2c_client(codec->dev); in wm8996_probe()
2628 wm8996->codec = codec; in wm8996_probe()
2634 wm8996_retune_mobile_pdata(codec); in wm8996_probe()
2636 snd_soc_add_codec_controls(codec, wm8996_eq_controls, in wm8996_probe()
2650 irq_flags, "wm8996", codec); in wm8996_probe()
2653 irq_flags, "wm8996", codec); in wm8996_probe()
2657 snd_soc_update_bits(codec, WM8996_INTERRUPT_CONTROL, in wm8996_probe()
2661 snd_soc_update_bits(codec, in wm8996_probe()
2669 dev_err(codec->dev, "Failed to request IRQ: %d\n", in wm8996_probe()
2678 static int wm8996_remove(struct snd_soc_codec *codec) in wm8996_remove() argument
2680 struct i2c_client *i2c = to_i2c_client(codec->dev); in wm8996_remove()
2682 snd_soc_update_bits(codec, WM8996_INTERRUPT_CONTROL, in wm8996_remove()
2686 free_irq(i2c->irq, codec); in wm8996_remove()