Lines Matching refs:codec

609 static int max98088_volatile_register(struct snd_soc_codec *codec, unsigned int reg)  in max98088_volatile_register()  argument
618 static void m98088_eq_band(struct snd_soc_codec *codec, unsigned int dai, in m98088_eq_band() argument
635 snd_soc_write(codec, eq_reg++, M98088_BYTE1(coefs[i])); in m98088_eq_band()
636 snd_soc_write(codec, eq_reg++, M98088_BYTE0(coefs[i])); in m98088_eq_band()
691 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); in max98088_mic1pre_set() local
692 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_mic1pre_set()
696 snd_soc_update_bits(codec, M98088_REG_35_LVL_MIC1, M98088_MICPRE_MASK, in max98088_mic1pre_set()
705 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); in max98088_mic1pre_get() local
706 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_mic1pre_get()
715 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); in max98088_mic2pre_set() local
716 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_mic2pre_set()
720 snd_soc_update_bits(codec, M98088_REG_36_LVL_MIC2, M98088_MICPRE_MASK, in max98088_mic2pre_set()
729 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); in max98088_mic2pre_get() local
730 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_mic2pre_get()
913 struct snd_soc_codec *codec = w->codec; in max98088_mic_event() local
914 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_mic_event()
919 snd_soc_update_bits(codec, w->reg, M98088_MICPRE_MASK, in max98088_mic_event()
922 snd_soc_update_bits(codec, w->reg, M98088_MICPRE_MASK, in max98088_mic_event()
927 snd_soc_update_bits(codec, w->reg, M98088_MICPRE_MASK, 0); in max98088_mic_event()
943 struct snd_soc_codec *codec = w->codec; in max98088_line_pga() local
944 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_line_pga()
963 snd_soc_update_bits(codec, w->reg, in max98088_line_pga()
969 snd_soc_update_bits(codec, w->reg, in max98088_line_pga()
1258 struct snd_soc_codec *codec = dai->codec; in max98088_dai1_hw_params() local
1259 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_dai1_hw_params()
1271 snd_soc_update_bits(codec, M98088_REG_14_DAI1_FORMAT, in max98088_dai1_hw_params()
1275 snd_soc_update_bits(codec, M98088_REG_14_DAI1_FORMAT, in max98088_dai1_hw_params()
1282 snd_soc_update_bits(codec, M98088_REG_51_PWR_SYS, M98088_SHDNRUN, 0); in max98088_dai1_hw_params()
1287 snd_soc_update_bits(codec, M98088_REG_11_DAI1_CLKMODE, in max98088_dai1_hw_params()
1292 if (snd_soc_read(codec, M98088_REG_14_DAI1_FORMAT) in max98088_dai1_hw_params()
1295 dev_err(codec->dev, "Invalid system clock frequency\n"); in max98088_dai1_hw_params()
1301 snd_soc_write(codec, M98088_REG_12_DAI1_CLKCFG_HI, in max98088_dai1_hw_params()
1303 snd_soc_write(codec, M98088_REG_13_DAI1_CLKCFG_LO, in max98088_dai1_hw_params()
1309 snd_soc_update_bits(codec, M98088_REG_18_DAI1_FILTERS, in max98088_dai1_hw_params()
1312 snd_soc_update_bits(codec, M98088_REG_18_DAI1_FILTERS, in max98088_dai1_hw_params()
1315 snd_soc_update_bits(codec, M98088_REG_51_PWR_SYS, M98088_SHDNRUN, in max98088_dai1_hw_params()
1325 struct snd_soc_codec *codec = dai->codec; in max98088_dai2_hw_params() local
1326 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_dai2_hw_params()
1338 snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT, in max98088_dai2_hw_params()
1342 snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT, in max98088_dai2_hw_params()
1349 snd_soc_update_bits(codec, M98088_REG_51_PWR_SYS, M98088_SHDNRUN, 0); in max98088_dai2_hw_params()
1354 snd_soc_update_bits(codec, M98088_REG_19_DAI2_CLKMODE, in max98088_dai2_hw_params()
1359 if (snd_soc_read(codec, M98088_REG_1C_DAI2_FORMAT) in max98088_dai2_hw_params()
1362 dev_err(codec->dev, "Invalid system clock frequency\n"); in max98088_dai2_hw_params()
1368 snd_soc_write(codec, M98088_REG_1A_DAI2_CLKCFG_HI, in max98088_dai2_hw_params()
1370 snd_soc_write(codec, M98088_REG_1B_DAI2_CLKCFG_LO, in max98088_dai2_hw_params()
1376 snd_soc_update_bits(codec, M98088_REG_20_DAI2_FILTERS, in max98088_dai2_hw_params()
1379 snd_soc_update_bits(codec, M98088_REG_20_DAI2_FILTERS, in max98088_dai2_hw_params()
1382 snd_soc_update_bits(codec, M98088_REG_51_PWR_SYS, M98088_SHDNRUN, in max98088_dai2_hw_params()
1391 struct snd_soc_codec *codec = dai->codec; in max98088_dai_set_sysclk() local
1392 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_dai_set_sysclk()
1403 snd_soc_write(codec, M98088_REG_10_SYS_CLK, 0x10); in max98088_dai_set_sysclk()
1405 snd_soc_write(codec, M98088_REG_10_SYS_CLK, 0x20); in max98088_dai_set_sysclk()
1407 dev_err(codec->dev, "Invalid master clock frequency\n"); in max98088_dai_set_sysclk()
1411 if (snd_soc_read(codec, M98088_REG_51_PWR_SYS) & M98088_SHDNRUN) { in max98088_dai_set_sysclk()
1412 snd_soc_update_bits(codec, M98088_REG_51_PWR_SYS, in max98088_dai_set_sysclk()
1414 snd_soc_update_bits(codec, M98088_REG_51_PWR_SYS, in max98088_dai_set_sysclk()
1427 struct snd_soc_codec *codec = codec_dai->codec; in max98088_dai1_set_fmt() local
1428 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_dai1_set_fmt()
1441 snd_soc_write(codec, M98088_REG_12_DAI1_CLKCFG_HI, in max98088_dai1_set_fmt()
1443 snd_soc_write(codec, M98088_REG_13_DAI1_CLKCFG_LO, in max98088_dai1_set_fmt()
1453 dev_err(codec->dev, "Clock mode unsupported"); in max98088_dai1_set_fmt()
1483 snd_soc_update_bits(codec, M98088_REG_14_DAI1_FORMAT, in max98088_dai1_set_fmt()
1490 snd_soc_write(codec, M98088_REG_15_DAI1_CLOCK, reg15val); in max98088_dai1_set_fmt()
1499 struct snd_soc_codec *codec = codec_dai->codec; in max98088_dai2_set_fmt() local
1500 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_dai2_set_fmt()
1512 snd_soc_write(codec, M98088_REG_1A_DAI2_CLKCFG_HI, in max98088_dai2_set_fmt()
1514 snd_soc_write(codec, M98088_REG_1B_DAI2_CLKCFG_LO, in max98088_dai2_set_fmt()
1524 dev_err(codec->dev, "Clock mode unsupported"); in max98088_dai2_set_fmt()
1554 snd_soc_update_bits(codec, M98088_REG_1C_DAI2_FORMAT, in max98088_dai2_set_fmt()
1558 snd_soc_write(codec, M98088_REG_1D_DAI2_CLOCK, in max98088_dai2_set_fmt()
1567 struct snd_soc_codec *codec = codec_dai->codec; in max98088_dai1_digital_mute() local
1575 snd_soc_update_bits(codec, M98088_REG_2F_LVL_DAI1_PLAY, in max98088_dai1_digital_mute()
1582 struct snd_soc_codec *codec = codec_dai->codec; in max98088_dai2_digital_mute() local
1590 snd_soc_update_bits(codec, M98088_REG_31_LVL_DAI2_PLAY, in max98088_dai2_digital_mute()
1595 static void max98088_sync_cache(struct snd_soc_codec *codec) in max98088_sync_cache() argument
1597 u8 *reg_cache = codec->reg_cache; in max98088_sync_cache()
1600 if (!codec->cache_sync) in max98088_sync_cache()
1603 codec->cache_only = 0; in max98088_sync_cache()
1608 for (i = 1; i < codec->driver->reg_cache_size; i++) { in max98088_sync_cache()
1615 snd_soc_write(codec, i, reg_cache[i]); in max98088_sync_cache()
1618 codec->cache_sync = 0; in max98088_sync_cache()
1621 static int max98088_set_bias_level(struct snd_soc_codec *codec, in max98088_set_bias_level() argument
1632 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) in max98088_set_bias_level()
1633 max98088_sync_cache(codec); in max98088_set_bias_level()
1635 snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN, in max98088_set_bias_level()
1640 snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN, in max98088_set_bias_level()
1642 codec->cache_sync = 1; in max98088_set_bias_level()
1645 codec->dapm.bias_level = level; in max98088_set_bias_level()
1700 static int max98088_get_channel(struct snd_soc_codec *codec, const char *name) in max98088_get_channel() argument
1709 dev_err(codec->dev, "Bad EQ channel name '%s'\n", name); in max98088_get_channel()
1713 static void max98088_setup_eq1(struct snd_soc_codec *codec) in max98088_setup_eq1() argument
1715 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_setup_eq1()
1740 dev_dbg(codec->dev, "Selected %s/%dHz for %dHz sample rate\n", in max98088_setup_eq1()
1745 save = snd_soc_read(codec, M98088_REG_49_CFG_LEVEL); in max98088_setup_eq1()
1746 snd_soc_update_bits(codec, M98088_REG_49_CFG_LEVEL, M98088_EQ1EN, 0); in max98088_setup_eq1()
1750 m98088_eq_band(codec, 0, 0, coef_set->band1); in max98088_setup_eq1()
1751 m98088_eq_band(codec, 0, 1, coef_set->band2); in max98088_setup_eq1()
1752 m98088_eq_band(codec, 0, 2, coef_set->band3); in max98088_setup_eq1()
1753 m98088_eq_band(codec, 0, 3, coef_set->band4); in max98088_setup_eq1()
1754 m98088_eq_band(codec, 0, 4, coef_set->band5); in max98088_setup_eq1()
1757 snd_soc_update_bits(codec, M98088_REG_49_CFG_LEVEL, M98088_EQ1EN, save); in max98088_setup_eq1()
1760 static void max98088_setup_eq2(struct snd_soc_codec *codec) in max98088_setup_eq2() argument
1762 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_setup_eq2()
1787 dev_dbg(codec->dev, "Selected %s/%dHz for %dHz sample rate\n", in max98088_setup_eq2()
1792 save = snd_soc_read(codec, M98088_REG_49_CFG_LEVEL); in max98088_setup_eq2()
1793 snd_soc_update_bits(codec, M98088_REG_49_CFG_LEVEL, M98088_EQ2EN, 0); in max98088_setup_eq2()
1797 m98088_eq_band(codec, 1, 0, coef_set->band1); in max98088_setup_eq2()
1798 m98088_eq_band(codec, 1, 1, coef_set->band2); in max98088_setup_eq2()
1799 m98088_eq_band(codec, 1, 2, coef_set->band3); in max98088_setup_eq2()
1800 m98088_eq_band(codec, 1, 3, coef_set->band4); in max98088_setup_eq2()
1801 m98088_eq_band(codec, 1, 4, coef_set->band5); in max98088_setup_eq2()
1804 snd_soc_update_bits(codec, M98088_REG_49_CFG_LEVEL, M98088_EQ2EN, in max98088_setup_eq2()
1811 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); in max98088_put_eq_enum() local
1812 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_put_eq_enum()
1814 int channel = max98088_get_channel(codec, kcontrol->id.name); in max98088_put_eq_enum()
1830 max98088_setup_eq1(codec); in max98088_put_eq_enum()
1833 max98088_setup_eq2(codec); in max98088_put_eq_enum()
1843 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); in max98088_get_eq_enum() local
1844 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_get_eq_enum()
1845 int channel = max98088_get_channel(codec, kcontrol->id.name); in max98088_get_eq_enum()
1856 static void max98088_handle_eq_pdata(struct snd_soc_codec *codec) in max98088_handle_eq_pdata() argument
1858 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_handle_eq_pdata()
1911 ret = snd_soc_add_codec_controls(codec, controls, ARRAY_SIZE(controls)); in max98088_handle_eq_pdata()
1913 dev_err(codec->dev, "Failed to add EQ control: %d\n", ret); in max98088_handle_eq_pdata()
1916 static void max98088_handle_pdata(struct snd_soc_codec *codec) in max98088_handle_pdata() argument
1918 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_handle_pdata()
1923 dev_dbg(codec->dev, "No platform data\n"); in max98088_handle_pdata()
1936 snd_soc_write(codec, M98088_REG_48_CFG_MIC, regval); in max98088_handle_pdata()
1940 snd_soc_update_bits(codec, M98088_REG_2A_MIC_REC_CNTL, in max98088_handle_pdata()
1945 max98088_handle_eq_pdata(codec); in max98088_handle_pdata()
1949 static int max98088_suspend(struct snd_soc_codec *codec) in max98088_suspend() argument
1951 max98088_set_bias_level(codec, SND_SOC_BIAS_OFF); in max98088_suspend()
1956 static int max98088_resume(struct snd_soc_codec *codec) in max98088_resume() argument
1958 max98088_set_bias_level(codec, SND_SOC_BIAS_STANDBY); in max98088_resume()
1967 static int max98088_probe(struct snd_soc_codec *codec) in max98088_probe() argument
1969 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_probe()
1973 codec->cache_sync = 1; in max98088_probe()
1975 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); in max98088_probe()
1977 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); in max98088_probe()
2003 ret = snd_soc_read(codec, M98088_REG_FF_REV_ID); in max98088_probe()
2005 dev_err(codec->dev, "Failed to read device revision: %d\n", in max98088_probe()
2009 dev_info(codec->dev, "revision %c\n", ret - 0x40 + 'A'); in max98088_probe()
2011 snd_soc_write(codec, M98088_REG_51_PWR_SYS, M98088_PWRSV); in max98088_probe()
2014 max98088_set_bias_level(codec, SND_SOC_BIAS_STANDBY); in max98088_probe()
2016 snd_soc_write(codec, M98088_REG_0F_IRQ_ENABLE, 0x00); in max98088_probe()
2018 snd_soc_write(codec, M98088_REG_22_MIX_DAC, in max98088_probe()
2022 snd_soc_write(codec, M98088_REG_4E_BIAS_CNTL, 0xF0); in max98088_probe()
2023 snd_soc_write(codec, M98088_REG_50_DAC_BIAS2, 0x0F); in max98088_probe()
2025 snd_soc_write(codec, M98088_REG_16_DAI1_IOCFG, in max98088_probe()
2028 snd_soc_write(codec, M98088_REG_1E_DAI2_IOCFG, in max98088_probe()
2031 max98088_handle_pdata(codec); in max98088_probe()
2033 snd_soc_add_codec_controls(codec, max98088_snd_controls, in max98088_probe()
2040 static int max98088_remove(struct snd_soc_codec *codec) in max98088_remove() argument
2042 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); in max98088_remove()
2044 max98088_set_bias_level(codec, SND_SOC_BIAS_OFF); in max98088_remove()