WARN_ON((hw->wr + int_block > hw->size) ||
(sw->rd + int_block > sw->size));
- WARN_ON((hw->wr < 0) || (sw->rd < 0));
if (external_mute_enable == 1 && external_mute_flag == 1) {
memset((hw->addr + hw->wr), 0, int_block);
* audio_out_mode = 2,
* TV in direct mix with android audio;
*/
- if (arg < 0 || arg > 2)
+ if (arg > 2)
return -EINVAL;
audio_out_mode = arg;
break;
case AMAUDIO_IOC_MIC_LEFT_GAIN:
/* in karaOK mode, mic volume can be set from 0-256 */
- if (arg < 0 || arg > 256)
+ if (arg > 256)
return -EINVAL;
direct_left_gain = arg;
break;
case AMAUDIO_IOC_MIC_RIGHT_GAIN:
- if (arg < 0 || arg > 256)
+ if (arg > 256)
return -EINVAL;
direct_right_gain = arg;
break;
case AMAUDIO_IOC_MUSIC_GAIN:
/* music volume can be set from 0-256 */
- if (arg < 0 || arg > 256)
+ if (arg > 256)
return -EINVAL;
music_gain = arg;
{
// TODO:
return;
+#if 0
audiobus_update_bits(
EE_AUDIO_LB_CTRL0,
0x1 << 30,
mode << 30
);
+#endif
}
static void tdmin_lb_clk_enalbe(int tdm_src, int is_enable)
{
int val = aml_pdm_read(PDM_CTRL);
- if (!((val & 20000) >> 17))
- pr_warn_once("pdm mute is not enable\n");
-
return (val & (0xff << 20));
}
ret = -EINVAL;
goto fail;
}
-
ret = of_property_read_u32(node, "pwrdet_src",
&p_pwrdet->det_src);
if (ret) {
struct device *dev;
unsigned int det_src;
- unsigned int irq;
+ int irq;
unsigned int hi_th;
unsigned int lo_th;
static int resample_clk_set(struct audioresample *p_resample)
{
- int ret;
+ int ret = 0;
/* enable clock */
if (p_resample->enable) {
/* match data */
p_chipinfo = (struct tdm_chipinfo *)
of_device_get_match_data(dev);
- if (!p_chipinfo)
+ if (!p_chipinfo) {
dev_warn_once(dev, "check whether to update tdm chipinfo\n");
-
+ return -ENOMEM;
+ }
p_tdm->chipinfo = p_chipinfo;
p_tdm->id = p_chipinfo->id;
pr_info("%s, tdm ID = %u\n", __func__, p_tdm->id);
return PTR_ERR(p_tdm->mclk);
}
- clk_set_parent(p_tdm->mclk, p_tdm->clk);
+ ret = clk_set_parent(p_tdm->mclk, p_tdm->clk);
+ if (ret) {
+ dev_err(dev, "can't set tdm parent clock\n");
+ return ret;
+ }
/* complete mclk for tdm */
if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MINOR) == 0xa)
aml_aiu_write(AIU_MEM_IEC958_START_PTR, addr & 0xffffffc0);
aml_aiu_write(AIU_MEM_IEC958_RD_PTR, addr & 0xffffffc0);
#endif
- if (flag == 0) {
- /* this is for 16bit 2 channel */
-#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
- aml_aiu_write(AIU_MEM_IEC958_END_PTR,
- (addr & 0xffffffff) +
- (size & 0xffffffff) - 1);
-#else
- aml_aiu_write(AIU_MEM_IEC958_END_PTR,
- (addr & 0xffffffc0) +
- (size & 0xffffffc0) - 64);
-#endif
- } else {
- /* this is for RAW mode */
+
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
- aml_aiu_write(AIU_MEM_IEC958_END_PTR,
+ aml_aiu_write(AIU_MEM_IEC958_END_PTR,
(addr & 0xffffffff) +
(size & 0xffffffff) - 1);
#else
- aml_aiu_write(AIU_MEM_IEC958_END_PTR,
- (addr & 0xffffffc0) +
- (size & 0xffffffc0) - 1);
-#endif
+ if (flag == 0) {
+ /* this is for 16bit 2 channel */
+ aml_aiu_write(AIU_MEM_IEC958_END_PTR,
+ (addr & 0xffffffc0) +
+ (size & 0xffffffc0) - 64);
+ } else {
+ /* this is for RAW mode */
+ aml_aiu_write(AIU_MEM_IEC958_END_PTR,
+ (addr & 0xffffffc0) +
+ (size & 0xffffffc0) - 1);
}
+ #endif
#ifdef CONFIG_AMLOGIC_SND_SPLIT_MODE
aml_aiu_update_bits(AIU_MEM_IEC958_MASKS, 0xffff, 0xffff);
#else
{
uint val = 0;
- if (div < 1 && div > 4)
+ if (div < 1 || div > 4)
return;
val = div - 1;
.use_iomap = false,
};
-static int aml_snd_read(u32 base_type, unsigned int reg, unsigned int *val)
+static int aml_snd_read(u32 base_type, unsigned int reg, int *val)
{
int ret;
if (v_aml_snd_iomap.use_iomap) {
- if ((base_type >= IO_AUDIN_BASE) && (base_type < IO_BASE_MAX)) {
+ if (base_type < IO_BASE_MAX) {
*val = readl(
(v_aml_snd_iomap.reg_map[base_type]
+ (reg << 2)));
static void aml_snd_write(u32 base_type, unsigned int reg, unsigned int val)
{
if (v_aml_snd_iomap.use_iomap) {
- if ((base_type >= IO_AUDIN_BASE) && (base_type < IO_BASE_MAX)) {
+ if (base_type < IO_BASE_MAX) {
writel(val,
(v_aml_snd_iomap.reg_map[base_type]
+ (reg << 2)));
unsigned int val)
{
if (v_aml_snd_iomap.use_iomap) {
- if ((base_type >= IO_AUDIN_BASE) && (base_type < IO_BASE_MAX)) {
+ if (base_type < IO_BASE_MAX) {
unsigned int tmp, orig;
- aml_snd_read(base_type, reg, &orig);
+ if (aml_snd_read(base_type, reg, &orig) == 0) {
tmp = orig & ~mask;
tmp |= val & mask;
aml_snd_write(base_type, reg, tmp);
return;
+ }
}
pr_err("write snd reg %x error\n", reg);
} else
buf->area = NULL;
tmp_buf = buf->private_data;
- if (tmp_buf->buffer_start != NULL && tmp_buf != NULL)
+ if (tmp_buf != NULL && tmp_buf->buffer_start != NULL)
kfree(tmp_buf->buffer_start);
if (tmp_buf != NULL)
kfree(tmp_buf);
static int hp_det_adc_value(struct aml_audio_private_data *p_aml_audio)
{
- int ret, hp_value;
+ int ret, hp_value = 0;
int hp_val_sum = 0;
int loop_num = 0;
unsigned int mic_ret = 0;
static int aml_pcm_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{
pr_debug("***Entered %s\n", __func__);
- if (fmt & SND_SOC_DAIFMT_CBS_CFS)
- snd_soc_dai_get_drvdata(dai);
aml_set_pcm_format(fmt & SND_SOC_DAIFMT_FORMAT_MASK);
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
struct aml_audio_private_data *p_aml_audio =
snd_soc_card_get_drvdata(card);
- struct aml_card_info *p_cardinfo = p_aml_audio->cardinfo;
+ struct aml_card_info *p_cardinfo = NULL;
- if (p_aml_audio && p_cardinfo)
+ if (!p_aml_audio)
+ return -EINVAL;
+ p_cardinfo = p_aml_audio->cardinfo;
+
+ if (p_cardinfo)
p_cardinfo->set_audin_source(
ucontrol->value.enumerated.item[0]);
else
init = NULL;
/* CPU sub-node */
cpu_node = of_parse_phandle(np, "cpu_list", i);
- if (cpu_node < 0) {
+ if (cpu_node == NULL) {
dev_err(dev, "parse aml sound card cpu list error\n");
return -EINVAL;
}
/* CODEC sub-node */
codec_node = of_parse_phandle(np, "codec_list", i);
- if (codec_node < 0) {
+ if (codec_node == NULL) {
dev_err(dev, "parse aml sound card codec list error\n");
return ret;
}
/* Platform sub-node */
plat_node = of_parse_phandle(np, "plat_list", i);
- if (plat_node < 0) {
+ if (plat_node == NULL) {
dev_err(dev,
"parse aml sound card platform list error\n");
return ret;
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
+#if 0
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
u32 add, val, val1, val2;
-
+#endif
/*TODO: return 0 for tmp, this wolud modified later */
return 0;
-
+#if 0
if (codec == NULL)
return -1;
val = val1 | val2;
ucontrol->value.enumerated.item[0] = val;
return 0;
+ #endif
}
static int aml_DAC_Gain_set_enum(
{
struct aml_T9015_audio_priv *T9015_audio =
snd_soc_codec_get_drvdata(codec);
-
+ if (!T9015_audio) {
+ pr_info("T9015_audio is null!\n");
+ return -ENODEV;
+ }
/*reset audio codec register*/
aml_T9015_audio_reset(codec);
aml_T9015_audio_start_up(codec);
struct txlx_acodec_priv *aml_acodec =
snd_soc_codec_get_drvdata(dai->codec);
u32 reg;
+ int ret = 0;
pr_debug("%s, mute:%d\n", __func__, mute);
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* DAC 1 */
- regmap_read(aml_acodec->regmap,
+ ret = regmap_read(aml_acodec->regmap,
DAC_VOL_CTR_DAC_SOFT_MUTE,
®);
+ if (ret < 0)
+ pr_err("Failed to read dac1\n");
if (mute)
reg |= DAC_SOFT_MUTE;
else
reg &= ~DAC_SOFT_MUTE;
- regmap_write(aml_acodec->regmap,
+ ret = regmap_write(aml_acodec->regmap,
DAC_VOL_CTR_DAC_SOFT_MUTE,
reg);
-
+ if (ret < 0)
+ pr_err("Failed to write dac1\n");
/* DAC 2 */
- regmap_read(aml_acodec->regmap,
+ ret = regmap_read(aml_acodec->regmap,
ACODEC_DAC2_CONFIG2,
®);
+ if (ret < 0)
+ pr_err("Failed to read dac2\n");
+
if (mute)
reg |= DAC2_SOFT_MUTE;
else
reg &= ~DAC2_SOFT_MUTE;
- regmap_write(aml_acodec->regmap,
+ ret = regmap_write(aml_acodec->regmap,
ACODEC_DAC2_CONFIG2,
reg);
- }
+ if (ret < 0)
+ pr_err("Failed to write dac2\n");
+ }
return 0;
}
int ret;
int i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "WL2")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no wl2 error");
+ return ret;
+ }
ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value);
if (ret)
return ret;
{
int value, ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "WL2")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no wl2 error");
+ return ret;
+ }
value = ucontrol->value.integer.value[0];
ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value);
if (ret)
int value = 0;
int ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "WR2")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no wr2 error");
+ return ret;
+ }
ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value);
if (ret)
return ret;
{
int value, ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "WR2")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no wr2 error");
+ return ret;
+ }
value = ucontrol->value.integer.value[0];
ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value);
if (ret)
int value = 0;
int ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "TL1")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no tl1 error");
+ return ret;
+ }
ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value);
if (ret)
return ret;
{
int value, ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "TL1")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no tl1 error");
+ return ret;
+ }
value = ucontrol->value.integer.value[0];
ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value);
if (ret)
int value = 0;
int ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "TR1")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no tr1 error");
+ return ret;
+ }
ret = regmap_read(ssm3515->regmap, SSM3515_REG_POWER_CTRL, &value);
if (ret)
return ret;
{
int value, ret, i;
struct ssm3515 *ssm3515 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3515[i].amp_cfg, "TR1")) {
ssm3515 = g_ssm3515+i;
break;
}
}
+ if (!ssm3515) {
+ pr_info("no tl1 error");
+ return ret;
+ }
value = ucontrol->value.integer.value[0];
ret = regmap_write(ssm3515->regmap, SSM3515_REG_POWER_CTRL, value);
if (ret)
static struct snd_kcontrol_new ssm3515_snd_controls[] = {
SOC_SINGLE_EXT("WR2 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0,
- WR2_amplifier_power_get, WR2_amplifier_power_put),
+ WR2_amplifier_power_get, WR2_amplifier_power_put),
SOC_SINGLE_EXT("WL2 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0,
- WL2_amplifier_power_get, WL2_amplifier_power_put),
+ WL2_amplifier_power_get, WL2_amplifier_power_put),
SOC_SINGLE_EXT("TL1 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0,
- TL1_amplifier_power_get, TL1_amplifier_power_put),
+ TL1_amplifier_power_get, TL1_amplifier_power_put),
SOC_SINGLE_EXT("TR1 Amp Power Control", SND_SOC_NOPM, 0, 0xff, 0,
- TR1_amplifier_power_get, TR1_amplifier_power_put),
+ TR1_amplifier_power_get, TR1_amplifier_power_put),
};
static int ssm3515_hw_params(struct snd_pcm_substream *substream,
int ret;
int i;
struct ssm3525 *ssm3525 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3525[i].amp_cfg, "WL1")) {
ssm3525 = g_ssm3525+i;
break;
}
}
+ if (!ssm3525) {
+ pr_info("no wl1 error");
+ return ret;
+ }
ret = regmap_read(ssm3525->regmap, SSM3525_REG_POWER_CTRL, &value);
if (ret)
return ret;
{
int value, ret, i;
struct ssm3525 *ssm3525 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3525[i].amp_cfg, "WL1")) {
ssm3525 = g_ssm3525+i;
break;
}
}
+ if (!ssm3525) {
+ pr_info("no wl1 error");
+ return ret;
+ }
value = ucontrol->value.integer.value[0];
ret = regmap_write(ssm3525->regmap, SSM3525_REG_POWER_CTRL, value);
if (ret)
int value = 0;
int ret, i;
struct ssm3525 *ssm3525 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3525[i].amp_cfg, "WR1")) {
ssm3525 = g_ssm3525+i;
break;
}
}
+ if (!ssm3525) {
+ pr_info("no wr1 error");
+ return ret;
+ }
ret = regmap_read(ssm3525->regmap, SSM3525_REG_POWER_CTRL, &value);
if (ret)
return ret;
{
int value, ret, i;
struct ssm3525 *ssm3525 = NULL;
-
+ ret = -1;
for (i = 0; i < device_num; i++) {
if (!strcmp(g_ssm3525[i].amp_cfg, "WR1")) {
ssm3525 = g_ssm3525+i;
break;
}
}
+ if (!ssm3525) {
+ pr_info("no wr1 error");
+ return ret;
+ }
value = ucontrol->value.integer.value[0];
ret = regmap_write(ssm3525->regmap, SSM3525_REG_POWER_CTRL, value);
if (ret)
reset_pin = of_get_named_gpio(np, "reset_pin", 0);
if (reset_pin < 0) {
pr_err("%s fail to get reset pin from dts!\n", __func__);
- ret = -1;
+ //ret = -1;
} else {
pr_info("%s pdata->reset_pin = %d!\n", __func__,
tas5707->pdata->reset_pin);
"codec_name",
&codec_name)) {
pr_info("no codec name\n");
- ret = -1;
+ //ret = -1;
}
pr_info("aux name = %s\n", codec_name);
if (codec_name)