本文整理汇总了C++中snd_soc_update_bits函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_soc_update_bits函数的具体用法?C++ snd_soc_update_bits怎么用?C++ snd_soc_update_bits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_soc_update_bits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:3null,项目名称:linux,代码行数:24,代码来源:sta529.c
示例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;
}
开发者ID:MaxChina,项目名称:linux,代码行数:24,代码来源:mc13783.c
示例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__);
}
开发者ID:lyapota,项目名称:m8_gpe_lollipop,代码行数:24,代码来源:wcd9xxx-common.c
示例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;
}
开发者ID:lyapota,项目名称:m8_gpe_lollipop,代码行数:24,代码来源:wcd9xxx-common.c
示例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;
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:24,代码来源:tlv320aic31xx.c
示例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);
}
开发者ID:kamarush,项目名称:ZTE_GXIn_Kernel-3.0.8,代码行数:24,代码来源:cs42l73.c
示例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__);
}
开发者ID:upworkstar,项目名称:AndroidAmazon,代码行数:38,代码来源:wcd9xxx-common.c
示例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;
}
开发者ID:nickh186,项目名称:Samsung-GT-P3113-AOSP-CM-Kernel-and-Ramdisk,代码行数:43,代码来源:wm_hubs.c
示例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);
}
开发者ID:Astralix,项目名称:mainline-dss11,代码行数:36,代码来源:alc5632.c
示例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);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:36,代码来源:alc5632.c
示例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;
}
开发者ID:alex-tu-cc,项目名称:m75,代码行数:40,代码来源:es-a300.c
示例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;
}
开发者ID:MikeForeskin,项目名称:Vindicator-S6-MM,代码行数:38,代码来源:cod3022x.c
示例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;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:23,代码来源:da7210.c
示例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;
}
开发者ID:akuster,项目名称:linux-meson,代码行数:37,代码来源:aml_pmu3.c
示例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;
}
开发者ID:alex-tu-cc,项目名称:m75,代码行数:24,代码来源:es-a300.c
示例16: alc5632_set_bias_level
static int alc5632_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
switch (level) {
case SND_SOC_BIAS_ON:
enable_power_depop(codec);
break;
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
/* everything off except vref/vmid, */
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
ALC5632_PWR_MANAG_ADD1_MASK,
ALC5632_PWR_ADD1_MAIN_BIAS);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
ALC5632_PWR_MANAG_ADD2_MASK,
ALC5632_PWR_ADD2_VREF);
/* "normal" mode: 0 @ 26 */
snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
0xffff ^ (ALC5632_PWR_VREF_PR3
| ALC5632_PWR_VREF_PR2));
break;
case SND_SOC_BIAS_OFF:
/* everything off, dac mute, inactive */
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
ALC5632_PWR_MANAG_ADD2_MASK, 0);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
ALC5632_PWR_MANAG_ADD3_MASK, 0);
snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
ALC5632_PWR_MANAG_ADD1_MASK, 0);
break;
}
codec->dapm.bias_level = level;
return 0;
}
开发者ID:Astralix,项目名称:mainline-dss11,代码行数:36,代码来源:alc5632.c
示例17: cs4270_probe
/**
* cs4270_probe - ASoC probe function
* @pdev: platform device
*
* This function is called when ASoC has all the pieces it needs to
* instantiate a sound driver.
*/
static int cs4270_probe(struct snd_soc_codec *codec)
{
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
int i, ret;
/* Tell ASoC what kind of I/O to use to read the registers. ASoC will
* then do the I2C transactions itself.
*/
ret = snd_soc_codec_set_cache_io(codec, 8, 8, cs4270->control_type);
if (ret < 0) {
dev_err(codec->dev, "failed to set cache I/O (ret=%i)\n", ret);
return ret;
}
/* Disable auto-mute. This feature appears to be buggy. In some
* situations, auto-mute will not deactivate when it should, so we want
* this feature disabled by default. An application (e.g. alsactl) can
* re-enabled it by using the controls.
*/
ret = snd_soc_update_bits(codec, CS4270_MUTE, CS4270_MUTE_AUTO, 0);
if (ret < 0) {
dev_err(codec->dev, "i2c write failed\n");
return ret;
}
/* Disable automatic volume control. The hardware enables, and it
* causes volume change commands to be delayed, sometimes until after
* playback has started. An application (e.g. alsactl) can
* re-enabled it by using the controls.
*/
ret = snd_soc_update_bits(codec, CS4270_TRANS,
CS4270_TRANS_SOFT | CS4270_TRANS_ZERO, 0);
if (ret < 0) {
dev_err(codec->dev, "i2c write failed\n");
return ret;
}
/* Add the non-DAPM controls */
ret = snd_soc_add_codec_controls(codec, cs4270_snd_controls,
ARRAY_SIZE(cs4270_snd_controls));
if (ret < 0) {
dev_err(codec->dev, "failed to add controls\n");
return ret;
}
/* get the power supply regulators */
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
cs4270->supplies[i].supply = supply_names[i];
ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);
if (ret < 0)
return ret;
ret = regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);
if (ret < 0)
goto error_free_regulators;
return 0;
error_free_regulators:
regulator_bulk_free(ARRAY_SIZE(cs4270->supplies),
cs4270->supplies);
return ret;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:74,代码来源:cs4270.c
示例18: wm8523_probe
static int wm8523_probe(struct snd_soc_codec *codec)
{
struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
int ret, i;
wm8523->rate_constraint.list = &wm8523->rate_constraint_list[0];
wm8523->rate_constraint.count =
ARRAY_SIZE(wm8523->rate_constraint_list);
ret = snd_soc_codec_set_cache_io(codec, 8, 16, wm8523->control_type);
if (ret != 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}
for (i = 0; i < ARRAY_SIZE(wm8523->supplies); i++)
wm8523->supplies[i].supply = wm8523_supply_names[i];
ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8523->supplies),
wm8523->supplies);
if (ret != 0) {
dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
return ret;
}
ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies),
wm8523->supplies);
if (ret != 0) {
dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
goto err_get;
}
ret = snd_soc_read(codec, WM8523_DEVICE_ID);
if (ret < 0) {
dev_err(codec->dev, "Failed to read ID register\n");
goto err_enable;
}
if (ret != wm8523_reg[WM8523_DEVICE_ID]) {
dev_err(codec->dev, "Device is not a WM8523, ID is %x\n", ret);
ret = -EINVAL;
goto err_enable;
}
ret = snd_soc_read(codec, WM8523_REVISION);
if (ret < 0) {
dev_err(codec->dev, "Failed to read revision register\n");
goto err_enable;
}
dev_info(codec->dev, "revision %c\n",
(ret & WM8523_CHIP_REV_MASK) + 'A');
ret = wm8523_reset(codec);
if (ret < 0) {
dev_err(codec->dev, "Failed to issue reset\n");
goto err_enable;
}
/* Change some default settings - latch VU and enable ZC */
snd_soc_update_bits(codec, WM8523_DAC_GAINR,
WM8523_DACR_VU, WM8523_DACR_VU);
snd_soc_update_bits(codec, WM8523_DAC_CTRL3, WM8523_ZC, WM8523_ZC);
wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* Bias level configuration will have done an extra enable */
regulator_bulk_disable(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);
return 0;
err_enable:
regulator_bulk_disable(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);
err_get:
regulator_bulk_free(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);
return ret;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:76,代码来源:wm8523.c
示例19: ak4641_mute
static int ak4641_mute(struct snd_soc_dai *dai, int mute)
{
struct snd_soc_codec *codec = dai->codec;
return snd_soc_update_bits(codec, AK4641_DAC, 0x20, mute ? 0x20 : 0);
}
开发者ID:vishnupatekar,项目名称:linux,代码行数:6,代码来源:ak4641.c
示例20: adau1701_set_dai_fmt
static int adau1701_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{
struct snd_soc_codec *codec = codec_dai->codec;
struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
unsigned int serictl = 0x00, seroctl = 0x00;
bool invert_lrclk;
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM:
/* master, 64-bits per sample, 1 frame per sample */
seroctl |= ADAU1701_SEROCTL_MASTER | ADAU1701_SEROCTL_OBF16
| ADAU1701_SEROCTL_OLF1024;
break;
case SND_SOC_DAIFMT_CBS_CFS:
break;
default:
return -EINVAL;
}
/* clock inversion */
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
invert_lrclk = false;
break;
case SND_SOC_DAIFMT_NB_IF:
invert_lrclk = true;
break;
case SND_SOC_DAIFMT_IB_NF:
invert_lrclk = false;
serictl |= ADAU1701_SERICTL_INV_BCLK;
seroctl |= ADAU1701_SEROCTL_INV_BCLK;
break;
case SND_SOC_DAIFMT_IB_IF:
invert_lrclk = true;
serictl |= ADAU1701_SERICTL_INV_BCLK;
seroctl |= ADAU1701_SEROCTL_INV_BCLK;
break;
default:
return -EINVAL;
}
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
break;
case SND_SOC_DAIFMT_LEFT_J:
serictl |= ADAU1701_SERICTL_LEFTJ;
seroctl |= ADAU1701_SEROCTL_MSB_DEALY0;
invert_lrclk = !invert_lrclk;
break;
case SND_SOC_DAIFMT_RIGHT_J:
serictl |= ADAU1701_SERICTL_RIGHTJ_24;
seroctl |= ADAU1701_SEROCTL_MSB_DEALY8;
invert_lrclk = !invert_lrclk;
break;
default:
return -EINVAL;
}
if (invert_lrclk) {
seroctl |= ADAU1701_SEROCTL_INV_LRCLK;
serictl |= ADAU1701_SERICTL_INV_LRCLK;
}
adau1701->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
snd_soc_write(codec, ADAU1701_SERICTL, serictl);
snd_soc_update_bits(codec, ADAU1701_SEROCTL,
~ADAU1701_SEROCTL_WORD_LEN_MASK, seroctl);
return 0;
}
开发者ID:mb3dot,项目名称:community-b3-kernel,代码行数:72,代码来源:adau1701.c
注:本文中的snd_soc_update_bits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论