aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorIan Minett <ian_minett@creativelabs.com>2012-09-20 23:29:21 -0400
committerTakashi Iwai <tiwai@suse.de>2012-11-28 02:47:26 -0500
commite97249dd6d70b657a4c6bc47e436b2b981031144 (patch)
tree2ca7dccc81862afbc596e376dee6522c0e13d005 /sound/pci/hda
parent4861af8075d91feb9df0e2f6539dad20debbeb67 (diff)
ALSA: hda - Remove unnecessary struct hda_stream_format from CA0132
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_ca0132.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 7a0425ff8b7b..5c6a0569c611 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -356,13 +356,6 @@ enum dsp_download_state {
356 DSP_DOWNLOADED = 2 356 DSP_DOWNLOADED = 2
357}; 357};
358 358
359struct hda_stream_format {
360 unsigned int sample_rate;
361 unsigned short valid_bits_per_sample;
362 unsigned short container_size;
363 unsigned short number_channels;
364};
365
366/* retrieve parameters from hda format */ 359/* retrieve parameters from hda format */
367#define get_hdafmt_chs(fmt) (fmt & 0xf) 360#define get_hdafmt_chs(fmt) (fmt & 0xf)
368#define get_hdafmt_bits(fmt) ((fmt >> 4) & 0x7) 361#define get_hdafmt_bits(fmt) ((fmt >> 4) & 0x7)
@@ -1585,16 +1578,17 @@ enum dma_state {
1585}; 1578};
1586 1579
1587static int dma_convert_to_hda_format( 1580static int dma_convert_to_hda_format(
1588 struct hda_stream_format *stream_format, 1581 unsigned int sample_rate,
1582 unsigned short channels,
1589 unsigned short *hda_format) 1583 unsigned short *hda_format)
1590{ 1584{
1591 unsigned int format_val; 1585 unsigned int format_val;
1592 1586
1593 format_val = snd_hda_calc_stream_format( 1587 format_val = snd_hda_calc_stream_format(
1594 stream_format->sample_rate, 1588 sample_rate,
1595 stream_format->number_channels, 1589 channels,
1596 SNDRV_PCM_FORMAT_S32_LE, 1590 SNDRV_PCM_FORMAT_S32_LE,
1597 stream_format->container_size, 0); 1591 32, 0);
1598 1592
1599 if (hda_format) 1593 if (hda_format)
1600 *hda_format = (unsigned short)format_val; 1594 *hda_format = (unsigned short)format_val;
@@ -1940,14 +1934,17 @@ static int dspxfr_one_seg(struct hda_codec *codec,
1940 * @fls_data: pointer to a fast load image 1934 * @fls_data: pointer to a fast load image
1941 * @reloc: Relocation address for loading single-segment overlays, or 0 for 1935 * @reloc: Relocation address for loading single-segment overlays, or 0 for
1942 * no relocation 1936 * no relocation
1943 * @format: format of the stream used for DSP download 1937 * @sample_rate: sampling rate of the stream used for DSP download
1938 * @number_channels: channels of the stream used for DSP download
1944 * @ovly: TRUE if overlay format is required 1939 * @ovly: TRUE if overlay format is required
1945 * 1940 *
1946 * Returns zero or a negative error code. 1941 * Returns zero or a negative error code.
1947 */ 1942 */
1948static int dspxfr_image(struct hda_codec *codec, 1943static int dspxfr_image(struct hda_codec *codec,
1949 const struct dsp_image_seg *fls_data, 1944 const struct dsp_image_seg *fls_data,
1950 unsigned int reloc, struct hda_stream_format *format, 1945 unsigned int reloc,
1946 unsigned int sample_rate,
1947 unsigned short channels,
1951 bool ovly) 1948 bool ovly)
1952{ 1949{
1953 struct ca0132_spec *spec = codec->spec; 1950 struct ca0132_spec *spec = codec->spec;
@@ -1976,7 +1973,7 @@ static int dspxfr_image(struct hda_codec *codec,
1976 } 1973 }
1977 1974
1978 dma_engine->codec = codec; 1975 dma_engine->codec = codec;
1979 dma_convert_to_hda_format(format, &hda_format); 1976 dma_convert_to_hda_format(sample_rate, channels, &hda_format);
1980 dma_engine->m_converter_format = hda_format; 1977 dma_engine->m_converter_format = hda_format;
1981 dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY : 1978 dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY :
1982 DSP_DMA_WRITE_BUFLEN_INIT) * 2; 1979 DSP_DMA_WRITE_BUFLEN_INIT) * 2;
@@ -2104,7 +2101,8 @@ static int dspload_image(struct hda_codec *codec,
2104 int router_chans) 2101 int router_chans)
2105{ 2102{
2106 int status = 0; 2103 int status = 0;
2107 struct hda_stream_format stream_format; 2104 unsigned int sample_rate;
2105 unsigned short channels;
2108 2106
2109 snd_printdd(KERN_INFO "---- dspload_image begin ------"); 2107 snd_printdd(KERN_INFO "---- dspload_image begin ------");
2110 if (router_chans == 0) { 2108 if (router_chans == 0) {
@@ -2114,17 +2112,14 @@ static int dspload_image(struct hda_codec *codec,
2114 router_chans = DMA_OVERLAY_FRAME_SIZE_NWORDS; 2112 router_chans = DMA_OVERLAY_FRAME_SIZE_NWORDS;
2115 } 2113 }
2116 2114
2117 stream_format.sample_rate = 48000; 2115 sample_rate = 48000;
2118 stream_format.number_channels = (unsigned short)router_chans; 2116 channels = (unsigned short)router_chans;
2119 2117
2120 while (stream_format.number_channels > 16) { 2118 while (channels > 16) {
2121 stream_format.sample_rate *= 2; 2119 sample_rate *= 2;
2122 stream_format.number_channels /= 2; 2120 channels /= 2;
2123 } 2121 }
2124 2122
2125 stream_format.container_size = 32;
2126 stream_format.valid_bits_per_sample = 32;
2127
2128 do { 2123 do {
2129 snd_printdd(KERN_INFO "Ready to program DMA"); 2124 snd_printdd(KERN_INFO "Ready to program DMA");
2130 if (!ovly) 2125 if (!ovly)
@@ -2134,7 +2129,8 @@ static int dspload_image(struct hda_codec *codec,
2134 break; 2129 break;
2135 2130
2136 snd_printdd(KERN_INFO "dsp_reset() complete"); 2131 snd_printdd(KERN_INFO "dsp_reset() complete");
2137 status = dspxfr_image(codec, fls, reloc, &stream_format, ovly); 2132 status = dspxfr_image(codec, fls, reloc, sample_rate, channels,
2133 ovly);
2138 2134
2139 if (status < 0) 2135 if (status < 0)
2140 break; 2136 break;