本文整理汇总了C++中snd_soc_update_bits函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_soc_update_bits函数的具体用法?C++ snd_soc_update_bits怎么用?C++ snd_soc_update_bits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_soc_update_bits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sta529_set_dai_fmt
static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
{
struct snd_soc_codec *codec = codec_dai->codec;
u8 mode = 0;
/* interface format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_LEFT_J:
mode = LEFT_J_DATA_FORMAT;
break;
case SND_SOC_DAIFMT_I2S:
mode = I2S_DATA_FORMAT;
break;
case SND_SOC_DAIFMT_RIGHT_J:
mode = RIGHT_J_DATA_FORMAT;
break;
default:
return -EINVAL;
}
snd_soc_update_bits(codec, STA529_S2PCFG0, DATA_FORMAT_MSK, mode);
return 0;
}
示例2: mc13783_pcm_hw_params_codec
static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
unsigned int rate = params_rate(params);
unsigned int val;
switch (rate) {
case 8000:
val = 0;
break;
case 16000:
val = AUDIO_CODEC_CDCFS8K16K;
break;
default:
return -EINVAL;
}
snd_soc_update_bits(codec, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K,
val);
return 0;
}
示例3: wcd9xxx_cfg_clsh_param_common
static void wcd9xxx_cfg_clsh_param_common(
struct snd_soc_codec *codec)
{
int i;
const struct wcd9xxx_reg_mask_val reg_set[] = {
{WCD9XXX_A_CDC_CLSH_BUCK_NCP_VARS, 0x3 << 0, 0},
{WCD9XXX_A_CDC_CLSH_BUCK_NCP_VARS, 0x3 << 2, 1 << 2},
{WCD9XXX_A_CDC_CLSH_BUCK_NCP_VARS, (0x1 << 4), 0},
{WCD9XXX_A_CDC_CLSH_B2_CTL, (0x3 << 0), 0x01},
{WCD9XXX_A_CDC_CLSH_B2_CTL, (0x3 << 2), (0x01 << 2)},
{WCD9XXX_A_CDC_CLSH_B2_CTL, (0xf << 4), (0x03 << 4)},
{WCD9XXX_A_CDC_CLSH_B3_CTL, (0xf << 4), (0x03 << 4)},
{WCD9XXX_A_CDC_CLSH_B3_CTL, (0xf << 0), (0x0B)},
{WCD9XXX_A_CDC_CLSH_B1_CTL, (0x1 << 5), (0x01 << 5)},
{WCD9XXX_A_CDC_CLSH_B1_CTL, (0x1 << 1), (0x01 << 1)},
};
for (i = 0; i < ARRAY_SIZE(reg_set); i++)
snd_soc_update_bits(codec, reg_set[i].reg, reg_set[i].mask,
reg_set[i].val);
dev_dbg(codec->dev, "%s: Programmed class H controller common parameters",
__func__);
}
示例4: wcd9xxx_soc_update_bits_push
int wcd9xxx_soc_update_bits_push(struct snd_soc_codec *codec,
struct list_head *list,
uint16_t reg, uint8_t mask,
uint8_t value, int delay)
{
int rc;
struct wcd9xxx_register_save_node *node;
node = kmalloc(sizeof(*node), GFP_KERNEL);
if (unlikely(!node)) {
pr_err("%s: Not enough memory\n", __func__);
return -ENOMEM;
}
node->reg = reg;
node->value = snd_soc_read(codec, reg);
list_add(&node->lh, list);
if (mask == 0xFF)
rc = snd_soc_write(codec, reg, value);
else
rc = snd_soc_update_bits(codec, reg, mask, value);
if (delay)
usleep_range(delay, delay + USLEEP_RANGE_MARGIN_US);
return rc;
}
示例5: aic31xx_set_dai_sysclk
static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_codec *codec = codec_dai->codec;
struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
int i;
dev_dbg(codec->dev, "## %s: clk_id = %d, freq = %d, dir = %d\n",
__func__, clk_id, freq, dir);
for (i = 0; aic31xx_divs[i].mclk != freq; i++)
if (i == ARRAY_SIZE(aic31xx_divs)) {
dev_err(aic31xx->dev, "%s: Unsupported frequency %d\n",
__func__, freq);
return -EINVAL;
}
/* set clock on MCLK, BCLK, or GPIO1 as PLL input */
snd_soc_update_bits(codec, AIC31XX_CLKMUX, AIC31XX_PLL_CLKIN_MASK,
clk_id << AIC31XX_PLL_CLKIN_SHIFT);
aic31xx->sysclk = freq;
return 0;
}
示例6: cs42l73_bp_detection
void cs42l73_bp_detection(struct snd_soc_codec *codec,
struct snd_soc_jack *jack,
int plug_status)
{
unsigned int status;
unsigned int reg;
unsigned int mask = SND_JACK_BTN_0 | SND_JACK_HEADSET;
if (plug_status) {
pr_err("%s: Invalid interrupt\n", __func__);
return;
} else {
snd_soc_update_bits(codec, CS42L73_IM1, MIC2_SDET, MIC2_SDET);
reg = snd_soc_read(codec, CS42L73_IS1);
if (reg & MIC2_SDET) { /*button pressed */
pr_debug("%s:Button Pressed\n", __func__);
status = SND_JACK_HEADSET | SND_JACK_BTN_0;
} else {
pr_debug("%s:Button Released\n", __func__);
status = SND_JACK_HEADSET;
}
}
snd_soc_jack_report(jack, status, mask);
}
示例7: wcd9xxx_enable_high_perf_mode
void wcd9xxx_enable_high_perf_mode(struct snd_soc_codec *codec,
struct wcd9xxx_clsh_cdc_data *clsh_d,
u8 req_state, bool req_type)
{
dev_dbg(codec->dev, "%s: users fclk8 %d, fclk5 %d", __func__,
clsh_d->ncp_users[NCP_FCLK_LEVEL_8],
clsh_d->ncp_users[NCP_FCLK_LEVEL_5]);
if (req_type == WCD9XXX_CLSAB_REQ_ENABLE) {
clsh_d->ncp_users[NCP_FCLK_LEVEL_8]++;
snd_soc_update_bits(codec, WCD9XXX_A_RX_HPH_CHOP_CTL,
0x20, 0x00);
wcd9xxx_chargepump_request(codec, true);
wcd9xxx_enable_anc_delay(codec, true);
if (clsh_d->ncp_users[NCP_FCLK_LEVEL_8] > 0)
snd_soc_update_bits(codec, WCD9XXX_A_NCP_STATIC,
0x0F, 0x08);
snd_soc_update_bits(codec, WCD9XXX_A_NCP_STATIC, 0x30, 0x30);
/* Enable NCP and wait until settles down */
if (snd_soc_update_bits(codec, WCD9XXX_A_NCP_EN, 0x01, 0x01))
usleep_range(NCP_SETTLE_TIME_US, NCP_SETTLE_TIME_US+10);
} else {
snd_soc_update_bits(codec, WCD9XXX_A_RX_HPH_CHOP_CTL,
0x20, 0x20);
wcd9xxx_chargepump_request(codec, false);
wcd9xxx_enable_anc_delay(codec, false);
clsh_d->ncp_users[NCP_FCLK_LEVEL_8]--;
if (clsh_d->ncp_users[NCP_FCLK_LEVEL_8] == 0 &&
clsh_d->ncp_users[NCP_FCLK_LEVEL_5] == 0)
snd_soc_update_bits(codec, WCD9XXX_A_NCP_EN,
0x01, 0x00);
else if (clsh_d->ncp_users[NCP_FCLK_LEVEL_8] == 0)
snd_soc_update_bits(codec, WCD9XXX_A_NCP_STATIC,
0x0F, 0x05);
}
dev_dbg(codec->dev, "%s: leave\n", __func__);
}
示例8: wm_hubs_handle_analogue_pdata
int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec,
int lineout1_diff, int lineout2_diff,
int lineout1fb, int lineout2fb,
int jd_scthr, int jd_thr, int micbias1_lvl,
int micbias2_lvl)
{
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
hubs->lineout1_se = !lineout1_diff;
hubs->lineout2_se = !lineout2_diff;
if (!lineout1_diff)
snd_soc_update_bits(codec, WM8993_LINE_MIXER1,
WM8993_LINEOUT1_MODE,
WM8993_LINEOUT1_MODE);
if (!lineout2_diff)
snd_soc_update_bits(codec, WM8993_LINE_MIXER2,
WM8993_LINEOUT2_MODE,
WM8993_LINEOUT2_MODE);
if (!lineout1_diff && !lineout2_diff)
snd_soc_update_bits(codec, WM8993_ANTIPOP1,
WM8993_LINEOUT_VMID_BUF_ENA,
WM8993_LINEOUT_VMID_BUF_ENA);
if (lineout1fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
WM8993_LINEOUT1_FB, WM8993_LINEOUT1_FB);
if (lineout2fb)
snd_soc_update_bits(codec, WM8993_ADDITIONAL_CONTROL,
WM8993_LINEOUT2_FB, WM8993_LINEOUT2_FB);
snd_soc_update_bits(codec, WM8993_MICBIAS,
WM8993_JD_SCTHR_MASK | WM8993_JD_THR_MASK |
WM8993_MICB1_LVL | WM8993_MICB2_LVL,
jd_scthr << WM8993_JD_SCTHR_SHIFT |
jd_thr << WM8993_JD_THR_SHIFT |
micbias1_lvl |
micbias2_lvl << WM8993_MICB2_LVL_SHIFT);
return 0;
}
示例9: enable_power_depop
static void enable_power_depop(struct snd_soc_codec *codec)
{
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
ALC5632_PWR_ADD1_SOFTGEN_EN,
ALC5632_PWR_ADD1_SOFTGEN_EN);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
ALC5632_ADD3_POWER_EN,
ALC5632_ADD3_POWER_EN);
snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
ALC5632_MISC_HP_DEPOP_MODE2_EN,
ALC5632_MISC_HP_DEPOP_MODE2_EN);
/* "normal" mode: 0 @ 26 */
/* set all PR0-7 mixers to 0 */
snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
0);
msleep(500);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
ALC5632_ADD2_POWER_EN,
ALC5632_ADD2_POWER_EN);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
ALC5632_ADD1_POWER_EN,
ALC5632_ADD1_POWER_EN);
/* disable HP Depop2 */
snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
ALC5632_MISC_HP_DEPOP_MODE2_EN,
0);
}
示例10: enable_power_depop
static void enable_power_depop(struct snd_soc_codec *codec)
{
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
ALC5632_PWR_ADD1_SOFTGEN_EN,
ALC5632_PWR_ADD1_SOFTGEN_EN);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
ALC5632_ADD3_POWER_EN,
ALC5632_ADD3_POWER_EN);
snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
ALC5632_MISC_HP_DEPOP_MODE2_EN,
ALC5632_MISC_HP_DEPOP_MODE2_EN);
/* */
/* */
snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
0);
msleep(500);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
ALC5632_ADD2_POWER_EN,
ALC5632_ADD2_POWER_EN);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
ALC5632_ADD1_POWER_EN,
ALC5632_ADD1_POWER_EN);
/* */
snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
ALC5632_MISC_HP_DEPOP_MODE2_EN,
0);
}
示例11: mic_event
static int mic_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
struct snd_soc_codec *codec = w->codec;
pr_debug("%s() %x\n", __func__, SND_SOC_DAPM_EVENT_ON(event));
if (SND_SOC_DAPM_EVENT_ON(event)) {
if (!strncmp(w->name, "MIC0", 4))
snd_soc_update_bits(codec, ES_MIC0_CTRL,
ES_MIC0_ON_MASK, 1);
else if (!strncmp(w->name, "MIC1", 4))
snd_soc_update_bits(codec, ES_MIC1_CTRL,
ES_MIC1_ON_MASK, 1);
else if (!strncmp(w->name, "MIC2", 4))
snd_soc_update_bits(codec, ES_MIC2_CTRL,
ES_MIC2_ON_MASK, 1);
else {
pr_err("%s() Invalid Mic Widget ON = %s\n",
__func__, w->name);
return -EINVAL;
}
} else {
if (!strncmp(w->name, "MIC0", 4))
snd_soc_update_bits(codec, ES_MIC0_CTRL,
ES_MIC0_ON_MASK, 0);
else if (!strncmp(w->name, "MIC1", 4))
snd_soc_update_bits(codec, ES_MIC1_CTRL,
ES_MIC1_ON_MASK, 0);
else if (!strncmp(w->name, "MIC2", 4))
snd_soc_update_bits(codec, ES_MIC2_CTRL,
ES_MIC2_ON_MASK, 0);
else {
pr_err("%s() Invalid Mic Widget OFF = %s\n",
__func__, w->name);
return -EINVAL;
}
}
return 0;
}
示例12: spkdrv_ev
static int spkdrv_ev(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
dev_dbg(w->codec->dev, "%s called\n", __func__);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_update_bits(w->codec, COD3022X_32_VOL_EP_SPK,
CTVOL_SPK_PGA_MASK, 0x3);
snd_soc_update_bits(w->codec, COD3022X_17_PWAUTO_DA,
PW_AUTO_DA_MASK | APW_SPK_MASK,
(0x1 << PW_AUTO_DA_SHIFT) |
(0x1 << APW_SPK_SHIFT));
snd_soc_update_bits(w->codec, COD3022X_37_MIX_DA2,
EN_SPK_MIX_DCTL_MASK | EN_SPK_MIX_DCTR_MASK,
(0x1 << EN_SPK_MIX_DCTL_SHIFT) |
(0x1 << EN_SPK_MIX_DCTR_SHIFT));
break;
case SND_SOC_DAPM_PRE_PMD:
snd_soc_update_bits(w->codec, COD3022X_32_VOL_EP_SPK,
CTVOL_SPK_PGA_MASK, 0x3);
snd_soc_update_bits(w->codec, COD3022X_37_MIX_DA2,
EN_SPK_MIX_DCTL_MASK | EN_SPK_MIX_DCTR_MASK, 0);
snd_soc_update_bits(w->codec, COD3022X_17_PWAUTO_DA,
APW_SPK_MASK, 0);
break;
default:
break;
}
return 0;
}
示例13: da7210_startup
static int da7210_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
int is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
struct snd_soc_codec *codec = dai->codec;
if (is_play) {
/* Enable Out */
snd_soc_update_bits(codec, DA7210_OUTMIX_L, 0x1F, 0x10);
snd_soc_update_bits(codec, DA7210_OUTMIX_R, 0x1F, 0x10);
} else {
/* Volume 7 */
snd_soc_update_bits(codec, DA7210_MIC_L, 0x7, 0x7);
snd_soc_update_bits(codec, DA7210_MIC_R, 0x7, 0x7);
/* Enable Mic */
snd_soc_update_bits(codec, DA7210_INMIX_L, 0x1F, 0x1);
snd_soc_update_bits(codec, DA7210_INMIX_R, 0x1F, 0x1);
}
return 0;
}
示例14: pmu3_probe
static int pmu3_probe(struct snd_soc_codec *codec)
{
int ret = 0;
printk("aml pmu3 codec probe\n");
pmu3_audio_power_init(codec);
pmu3_reset(codec);
/* power on device */
pmu3_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* Enable DAC soft mute by default */
snd_soc_update_bits(codec, PMU3_SOFT_MUTE, 0x7800, 0x7800);
/* Enable ZC */
snd_soc_update_bits(codec, PMU3_BLOCK_ENABLE_2, 0x3c0, 0x0);
snd_soc_add_codec_controls(codec, pmu3_snd_controls,
ARRAY_SIZE(pmu3_snd_controls));
/* ADC high pass filter Hi-fi mode */
snd_soc_update_bits(codec, PMU3_ADC_DAC, 0xc00, 0xc00);
snd_soc_write(codec, PMU3_MIXOUT_L, 0xe000);
snd_soc_write(codec, PMU3_MIXOUT_R, 0xe000);
snd_soc_write(codec, PMU3_MIXIN_L, 0xf000);
snd_soc_write(codec, PMU3_MIXIN_R, 0xf000);
snd_soc_write(codec, PMU3_PGA_IN, 0x1616);
snd_soc_update_bits(codec, PMU3_BLOCK_ENABLE_1, 0xf0c, 0xf0c);
snd_soc_update_bits(codec, PMU3_BLOCK_ENABLE_2, 0xf, 0xf);
snd_soc_update_bits(codec, PMU3_LINEOUT_HP_DRV, 0x90, 0x90);
snd_soc_write(codec, PMU3_DAC_VOLUME_CTL, 0xb9b9);
snd_soc_write(codec, PMU3_ADC_VOLUME_CTL, 0x6a6a);
return ret;
}
示例15: es_dac_enable
static int es_dac_enable(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = w->codec;
pr_debug("%s DAC%d event %d\n", __func__, w->shift, event);
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
snd_soc_update_bits(codec, w->reg, 1<<w->shift, 1<<w->shift);
snd_soc_update_bits(codec, ES_DAC_DIG_EN, ES_DIG_CLK_EN_MASK,
ES_DIG_CLK_EN);
snd_soc_update_bits(codec, ES_DAC_DIG_EN, ES_DAC_CLK_EN_MASK,
ES_DAC_CLK_EN);
break;
case SND_SOC_DAPM_POST_PMD:
snd_soc_update_bits(codec, w->reg, 1<<w->shift , 0);
snd_soc_update_bits(codec, ES_DAC_DIG_EN, ES_DIG_CLK_EN_MASK,
0);
snd_soc_update_bits(codec, ES_DAC_DIG_EN, ES_DAC_CLK_EN_MASK,
0);
break;
}
return 0;
}