Commit 2bf2778e authored by Takashi Iwai's avatar Takashi Iwai

ASoC: Optimize switch/case in magician.c

Use default to optimize the switch/case in magicial_playback_hw_params(),
which also fixes the compile warnings below:
  sound/soc/pxa/magician.c:89: warning: 'acds' may be used uninitialized in this function
  sound/soc/pxa/magician.c:89: warning: 'acps' may be used uninitialized in this function
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2baaec28
...@@ -106,7 +106,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -106,7 +106,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
/* 513156 Hz ~= _2_ * 8000 Hz * 32 (+0.23%) */ /* 513156 Hz ~= _2_ * 8000 Hz * 32 (+0.23%) */
acds = PXA_SSP_CLK_AUDIO_DIV_16; acds = PXA_SSP_CLK_AUDIO_DIV_16;
break; break;
case 32: default: /* 32 */
/* 1026312 Hz ~= _2_ * 8000 Hz * 64 (+0.23%) */ /* 1026312 Hz ~= _2_ * 8000 Hz * 64 (+0.23%) */
acds = PXA_SSP_CLK_AUDIO_DIV_8; acds = PXA_SSP_CLK_AUDIO_DIV_8;
} }
...@@ -118,7 +118,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -118,7 +118,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
/* 351375 Hz ~= 11025 Hz * 32 (-0.41%) */ /* 351375 Hz ~= 11025 Hz * 32 (-0.41%) */
acds = PXA_SSP_CLK_AUDIO_DIV_4; acds = PXA_SSP_CLK_AUDIO_DIV_4;
break; break;
case 32: default: /* 32 */
/* 702750 Hz ~= 11025 Hz * 64 (-0.41%) */ /* 702750 Hz ~= 11025 Hz * 64 (-0.41%) */
acds = PXA_SSP_CLK_AUDIO_DIV_2; acds = PXA_SSP_CLK_AUDIO_DIV_2;
} }
...@@ -130,7 +130,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -130,7 +130,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
/* 702750 Hz ~= 22050 Hz * 32 (-0.41%) */ /* 702750 Hz ~= 22050 Hz * 32 (-0.41%) */
acds = PXA_SSP_CLK_AUDIO_DIV_2; acds = PXA_SSP_CLK_AUDIO_DIV_2;
break; break;
case 32: default: /* 32 */
/* 1405500 Hz ~= 22050 Hz * 64 (-0.41%) */ /* 1405500 Hz ~= 22050 Hz * 64 (-0.41%) */
acds = PXA_SSP_CLK_AUDIO_DIV_1; acds = PXA_SSP_CLK_AUDIO_DIV_1;
} }
...@@ -142,7 +142,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -142,7 +142,7 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
/* 1405500 Hz ~= 44100 Hz * 32 (-0.41%) */ /* 1405500 Hz ~= 44100 Hz * 32 (-0.41%) */
acds = PXA_SSP_CLK_AUDIO_DIV_2; acds = PXA_SSP_CLK_AUDIO_DIV_2;
break; break;
case 32: default: /* 32 */
/* 2811000 Hz ~= 44100 Hz * 64 (-0.41%) */ /* 2811000 Hz ~= 44100 Hz * 64 (-0.41%) */
acds = PXA_SSP_CLK_AUDIO_DIV_1; acds = PXA_SSP_CLK_AUDIO_DIV_1;
} }
...@@ -154,19 +154,20 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream, ...@@ -154,19 +154,20 @@ static int magician_playback_hw_params(struct snd_pcm_substream *substream,
/* 1529375 Hz ~= 48000 Hz * 32 (-0.44%) */ /* 1529375 Hz ~= 48000 Hz * 32 (-0.44%) */
acds = PXA_SSP_CLK_AUDIO_DIV_2; acds = PXA_SSP_CLK_AUDIO_DIV_2;
break; break;
case 32: default: /* 32 */
/* 3058750 Hz ~= 48000 Hz * 64 (-0.44%) */ /* 3058750 Hz ~= 48000 Hz * 64 (-0.44%) */
acds = PXA_SSP_CLK_AUDIO_DIV_1; acds = PXA_SSP_CLK_AUDIO_DIV_1;
} }
break; break;
case 96000: case 96000:
default:
acps = 12235000; acps = 12235000;
switch (width) { switch (width) {
case 16: case 16:
/* 3058750 Hz ~= 96000 Hz * 32 (-0.44%) */ /* 3058750 Hz ~= 96000 Hz * 32 (-0.44%) */
acds = PXA_SSP_CLK_AUDIO_DIV_1; acds = PXA_SSP_CLK_AUDIO_DIV_1;
break; break;
case 32: default: /* 32 */
/* 6117500 Hz ~= 96000 Hz * 64 (-0.44%) */ /* 6117500 Hz ~= 96000 Hz * 64 (-0.44%) */
acds = PXA_SSP_CLK_AUDIO_DIV_2; acds = PXA_SSP_CLK_AUDIO_DIV_2;
div4 = PXA_SSP_CLK_SCDB_1; div4 = PXA_SSP_CLK_SCDB_1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment