Lines Matching full:cpcap

3  * ALSA SoC CPCAP codec driver
14 #include <linux/mfd/motorola-cpcap.h>
269 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_st_workaround() local
272 /* Only CPCAP from ST requires workaround */ in cpcap_st_workaround()
273 if (cpcap->vendor != CPCAP_VENDOR_ST) in cpcap_st_workaround()
278 err = regmap_write(cpcap->regmap, CPCAP_REG_TEST, in cpcap_st_workaround()
282 err = regmap_write(cpcap->regmap, CPCAP_REG_ST_TEST1, in cpcap_st_workaround()
288 err = regmap_write(cpcap->regmap, CPCAP_REG_ST_TEST1, in cpcap_st_workaround()
292 err = regmap_write(cpcap->regmap, CPCAP_REG_TEST, in cpcap_st_workaround()
370 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_output_mux_get_enum() local
376 err = regmap_read(cpcap->regmap, CPCAP_REG_RXCOA, &reg_voice); in cpcap_output_mux_get_enum()
379 err = regmap_read(cpcap->regmap, CPCAP_REG_RXSDOA, &reg_hifi); in cpcap_output_mux_get_enum()
382 err = regmap_read(cpcap->regmap, CPCAP_REG_RXEPOA, &reg_ext); in cpcap_output_mux_get_enum()
413 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_output_mux_put_enum() local
436 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXCOA, in cpcap_output_mux_put_enum()
440 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXSDOA, in cpcap_output_mux_put_enum()
444 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXEPOA, in cpcap_output_mux_put_enum()
458 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_input_right_mux_get_enum() local
462 err = regmap_read(cpcap->regmap, CPCAP_REG_TXI, &regval); in cpcap_input_right_mux_get_enum()
497 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_input_right_mux_put_enum() local
528 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, in cpcap_input_right_mux_put_enum()
542 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_input_left_mux_get_enum() local
546 err = regmap_read(cpcap->regmap, CPCAP_REG_TXI, &regval); in cpcap_input_left_mux_get_enum()
573 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_input_left_mux_put_enum() local
596 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, in cpcap_input_left_mux_put_enum()
958 static int cpcap_set_sysclk(struct cpcap_audio *cpcap, enum cpcap_dai dai, in cpcap_set_sysclk() argument
981 dev_err(cpcap->component->dev, "invalid DAI: %d", dai); in cpcap_set_sysclk()
987 dev_err(cpcap->component->dev, "invalid clk id %d", clk_id); in cpcap_set_sysclk()
990 err = regmap_update_bits(cpcap->regmap, clkidreg, BIT(clkidshift), in cpcap_set_sysclk()
999 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI, in cpcap_set_sysclk()
1027 dev_err(cpcap->component->dev, "unsupported freq %u", freq); in cpcap_set_sysclk()
1031 err = regmap_update_bits(cpcap->regmap, clkfreqreg, in cpcap_set_sysclk()
1037 cpcap->codec_clk_id = clk_id; in cpcap_set_sysclk()
1038 cpcap->codec_freq = freq; in cpcap_set_sysclk()
1044 static int cpcap_set_samprate(struct cpcap_audio *cpcap, enum cpcap_dai dai, in cpcap_set_samprate() argument
1047 struct snd_soc_component *component = cpcap->component; in cpcap_set_samprate()
1102 err = regmap_update_bits(cpcap->regmap, sampreg, in cpcap_set_samprate()
1110 err = regmap_read(cpcap->regmap, sampreg, &sampreadval); in cpcap_set_samprate()
1128 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_hifi_hw_params() local
1132 return cpcap_set_samprate(cpcap, CPCAP_DAI_HIFI, rate); in cpcap_hifi_hw_params()
1139 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_hifi_set_dai_sysclk() local
1143 return cpcap_set_sysclk(cpcap, CPCAP_DAI_HIFI, clk_id, freq); in cpcap_hifi_set_dai_sysclk()
1150 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_hifi_set_dai_fmt() local
1179 dev_err(dev, "HiFi dai fmt failed: CPCAP should be provider"); in cpcap_hifi_set_dai_fmt()
1225 return regmap_update_bits(cpcap->regmap, reg, mask, val); in cpcap_hifi_set_dai_fmt()
1231 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_hifi_set_mute() local
1242 return regmap_update_bits(cpcap->regmap, reg, mask, val); in cpcap_hifi_set_mute()
1259 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_voice_hw_params() local
1270 err = cpcap_set_samprate(cpcap, CPCAP_DAI_VOICE, rate); in cpcap_voice_hw_params()
1285 err = regmap_update_bits(cpcap->regmap, reg_cdi, mask, val); in cpcap_voice_hw_params()
1297 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_voice_set_dai_sysclk() local
1301 return cpcap_set_sysclk(cpcap, CPCAP_DAI_VOICE, clk_id, freq); in cpcap_voice_set_dai_sysclk()
1308 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_voice_set_dai_fmt() local
1329 dev_err(component->dev, "Voice dai fmt failed: CPCAP should be the provider"); in cpcap_voice_set_dai_fmt()
1375 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI, mask, val); in cpcap_voice_set_dai_fmt()
1379 cpcap->codec_format = val; in cpcap_voice_set_dai_fmt()
1389 * cpcap related hardware as CPU is not involved in the voice call.
1391 static int cpcap_voice_call(struct cpcap_audio *cpcap, struct snd_soc_dai *dai, in cpcap_voice_call() argument
1398 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_VAUDIOC, in cpcap_voice_call()
1405 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, in cpcap_voice_call()
1413 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_TXI, in cpcap_voice_call()
1420 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXOA, in cpcap_voice_call()
1427 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_RXCOA, in cpcap_voice_call()
1444 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CC, in cpcap_voice_call()
1451 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI, in cpcap_voice_call()
1462 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_voice_set_tdm_slot() local
1481 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI, in cpcap_voice_set_tdm_slot()
1486 err = cpcap_set_samprate(cpcap, CPCAP_DAI_VOICE, slot_width * 1000); in cpcap_voice_set_tdm_slot()
1490 err = cpcap_voice_call(cpcap, dai, voice_call); in cpcap_voice_set_tdm_slot()
1500 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_voice_set_mute() local
1511 return regmap_update_bits(cpcap->regmap, reg, mask, val); in cpcap_voice_set_mute()
1526 .name = "cpcap-hifi",
1538 .name = "cpcap-voice",
1557 static int cpcap_dai_mux(struct cpcap_audio *cpcap, bool swap_dai_configuration) in cpcap_dai_mux() argument
1576 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_CDI, in cpcap_dai_mux()
1581 err = regmap_update_bits(cpcap->regmap, CPCAP_REG_SDACDI, in cpcap_dai_mux()
1592 struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); in cpcap_audio_reset() local
1598 err = regmap_update_bits(cpcap->regmap, in cpcap_audio_reset()
1607 err = cpcap_dai_mux(cpcap, swap_dai_configuration); in cpcap_audio_reset()
1611 err = cpcap_set_sysclk(cpcap, CPCAP_DAI_HIFI, 0, 26000000); in cpcap_audio_reset()
1614 err = cpcap_set_sysclk(cpcap, CPCAP_DAI_VOICE, 0, 26000000); in cpcap_audio_reset()
1618 err = cpcap_set_samprate(cpcap, CPCAP_DAI_HIFI, 48000); in cpcap_audio_reset()
1622 err = cpcap_set_samprate(cpcap, CPCAP_DAI_VOICE, 48000); in cpcap_audio_reset()
1631 struct cpcap_audio *cpcap; in cpcap_soc_probe() local
1634 cpcap = devm_kzalloc(component->dev, sizeof(*cpcap), GFP_KERNEL); in cpcap_soc_probe()
1635 if (!cpcap) in cpcap_soc_probe()
1637 snd_soc_component_set_drvdata(component, cpcap); in cpcap_soc_probe()
1638 cpcap->component = component; in cpcap_soc_probe()
1640 cpcap->regmap = dev_get_regmap(component->dev->parent, NULL); in cpcap_soc_probe()
1641 if (!cpcap->regmap) in cpcap_soc_probe()
1643 snd_soc_component_init_regmap(component, cpcap->regmap); in cpcap_soc_probe()
1645 err = cpcap_get_vendor(component->dev, cpcap->regmap, &cpcap->vendor); in cpcap_soc_probe()
1681 .name = "cpcap-codec",
1686 MODULE_ALIAS("platform:cpcap-codec");
1687 MODULE_DESCRIPTION("ASoC CPCAP codec driver");