mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
ASoC: rsnd: ssi: remove unnesessary period_pos
period_pos can always be calculated by byte_pos and byte_per_period, there is no reason to maintain this variable in rsnd_dai_stream. This patch removes period_pos from rsnd_ssi and calculates next_period_byte with consideration of actual byte_pos value. Signed-off-by: Jiada Wang <jiada_wang@mentor.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c046010a83
commit
2e2d53da81
@ -80,7 +80,6 @@ struct rsnd_ssi {
|
||||
unsigned int usrcnt;
|
||||
|
||||
int byte_pos;
|
||||
int period_pos;
|
||||
int byte_per_period;
|
||||
int next_period_byte;
|
||||
};
|
||||
@ -421,7 +420,6 @@ static void rsnd_ssi_pointer_init(struct rsnd_mod *mod,
|
||||
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
|
||||
|
||||
ssi->byte_pos = 0;
|
||||
ssi->period_pos = 0;
|
||||
ssi->byte_per_period = runtime->period_size *
|
||||
runtime->channels *
|
||||
samples_to_bytes(runtime, 1);
|
||||
@ -453,13 +451,12 @@ static bool rsnd_ssi_pointer_update(struct rsnd_mod *mod,
|
||||
|
||||
if (byte_pos >= ssi->next_period_byte) {
|
||||
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
|
||||
int period_pos = byte_pos / ssi->byte_per_period;
|
||||
|
||||
ssi->period_pos++;
|
||||
ssi->next_period_byte += ssi->byte_per_period;
|
||||
ssi->next_period_byte = (period_pos + 1) * ssi->byte_per_period;
|
||||
|
||||
if (ssi->period_pos >= runtime->periods) {
|
||||
if (period_pos >= runtime->periods) {
|
||||
byte_pos = 0;
|
||||
ssi->period_pos = 0;
|
||||
ssi->next_period_byte = ssi->byte_per_period;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user