return 0;
}
-int resample_set(enum resample_idx id, enum samplerate_index index)
+/* force set to new rate index whatever the resampler holds */
+int resample_set(enum resample_idx id, enum samplerate_index index, bool force)
{
int resample_rate = 0;
struct audioresample *p_resample = get_audioresample(id);
return 0;
}
+ if (index == p_resample->asrc_rate_idx && !force)
+ return 0;
+
pr_info("%s resample_%c to %s, last %s\n",
__func__,
(id == RESAMPLE_A) ? 'a' : 'b',
auge_resample_texts[index],
auge_resample_texts[p_resample->asrc_rate_idx]);
-#if 0
- if (index == p_resample->asrc_rate_idx)
- return 0;
-#endif
set_resample_rate_index(id, index);
resample_rate = resample_idx2rate(index);
pr_debug("%s() index %d\n", __func__, id);
- return resample_set(id, index);
+ return resample_set(id, index, true);
}
static int resample_set_enum(
if (val & 0x2)
/* nonpcm, resample disable */
- resample_set(p_spdif->asrc_id, RATE_OFF);
+ resample_set(p_spdif->asrc_id, RATE_OFF, false);
else
/* pcm, resample which rate ? */
- resample_set(p_spdif->asrc_id, p_spdif->auto_asrc);
+ resample_set(p_spdif->asrc_id, p_spdif->auto_asrc, false);
}
static void spdifin_audio_type_detect_init(struct aml_spdif *p_spdif)
/* resample enable, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
resample_set(p_spdif->asrc_id,
- p_spdif->auto_asrc);
+ p_spdif->auto_asrc, false);
#endif
extcon_set_state(p_spdif->edev,
EXTCON_SPDIFIN_SAMPLERATE, 1);
#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample disable, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
- resample_set(p_spdif->asrc_id, RATE_OFF);
+ resample_set(p_spdif->asrc_id, RATE_OFF, false);
#endif
#endif
}
#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample to 48k, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
- resample_set(p_spdif->asrc_id, p_spdif->auto_asrc);
+ resample_set(p_spdif->asrc_id,
+ p_spdif->auto_asrc, false);
#endif
}
if (intrpt_status & 0x40)
#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample to 48k in default, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
- resample_set(p_spdif->asrc_id, p_spdif->auto_asrc);
+ resample_set(p_spdif->asrc_id,
+ p_spdif->auto_asrc, false);
#endif
}
#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample disabled, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
- resample_set(p_spdif->asrc_id, RATE_OFF);
+ resample_set(p_spdif->asrc_id, RATE_OFF, false);
#endif
clk_disable_unprepare(p_spdif->clk_spdifin);
clk_disable_unprepare(p_spdif->fixed_clk);