Skip to content

Commit e97249d

Browse files
ikminetttiwai
authored andcommitted
ALSA: hda - Remove unnecessary struct hda_stream_format from CA0132
Signed-off-by: Ian Minett <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 4861af8 commit e97249d

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

sound/pci/hda/patch_ca0132.c

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,6 @@ enum dsp_download_state {
356356
DSP_DOWNLOADED = 2
357357
};
358358

359-
struct 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-
366359
/* retrieve parameters from hda format */
367360
#define get_hdafmt_chs(fmt) (fmt & 0xf)
368361
#define get_hdafmt_bits(fmt) ((fmt >> 4) & 0x7)
@@ -1585,16 +1578,17 @@ enum dma_state {
15851578
};
15861579

15871580
static int dma_convert_to_hda_format(
1588-
struct hda_stream_format *stream_format,
1581+
unsigned int sample_rate,
1582+
unsigned short channels,
15891583
unsigned short *hda_format)
15901584
{
15911585
unsigned int format_val;
15921586

15931587
format_val = snd_hda_calc_stream_format(
1594-
stream_format->sample_rate,
1595-
stream_format->number_channels,
1588+
sample_rate,
1589+
channels,
15961590
SNDRV_PCM_FORMAT_S32_LE,
1597-
stream_format->container_size, 0);
1591+
32, 0);
15981592

15991593
if (hda_format)
16001594
*hda_format = (unsigned short)format_val;
@@ -1940,14 +1934,17 @@ static int dspxfr_one_seg(struct hda_codec *codec,
19401934
* @fls_data: pointer to a fast load image
19411935
* @reloc: Relocation address for loading single-segment overlays, or 0 for
19421936
* 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
19441939
* @ovly: TRUE if overlay format is required
19451940
*
19461941
* Returns zero or a negative error code.
19471942
*/
19481943
static int dspxfr_image(struct hda_codec *codec,
19491944
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,
19511948
bool ovly)
19521949
{
19531950
struct ca0132_spec *spec = codec->spec;
@@ -1976,7 +1973,7 @@ static int dspxfr_image(struct hda_codec *codec,
19761973
}
19771974

19781975
dma_engine->codec = codec;
1979-
dma_convert_to_hda_format(format, &hda_format);
1976+
dma_convert_to_hda_format(sample_rate, channels, &hda_format);
19801977
dma_engine->m_converter_format = hda_format;
19811978
dma_engine->buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY :
19821979
DSP_DMA_WRITE_BUFLEN_INIT) * 2;
@@ -2104,7 +2101,8 @@ static int dspload_image(struct hda_codec *codec,
21042101
int router_chans)
21052102
{
21062103
int status = 0;
2107-
struct hda_stream_format stream_format;
2104+
unsigned int sample_rate;
2105+
unsigned short channels;
21082106

21092107
snd_printdd(KERN_INFO "---- dspload_image begin ------");
21102108
if (router_chans == 0) {
@@ -2114,17 +2112,14 @@ static int dspload_image(struct hda_codec *codec,
21142112
router_chans = DMA_OVERLAY_FRAME_SIZE_NWORDS;
21152113
}
21162114

2117-
stream_format.sample_rate = 48000;
2118-
stream_format.number_channels = (unsigned short)router_chans;
2115+
sample_rate = 48000;
2116+
channels = (unsigned short)router_chans;
21192117

2120-
while (stream_format.number_channels > 16) {
2121-
stream_format.sample_rate *= 2;
2122-
stream_format.number_channels /= 2;
2118+
while (channels > 16) {
2119+
sample_rate *= 2;
2120+
channels /= 2;
21232121
}
21242122

2125-
stream_format.container_size = 32;
2126-
stream_format.valid_bits_per_sample = 32;
2127-
21282123
do {
21292124
snd_printdd(KERN_INFO "Ready to program DMA");
21302125
if (!ovly)
@@ -2134,7 +2129,8 @@ static int dspload_image(struct hda_codec *codec,
21342129
break;
21352130

21362131
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);
21382134

21392135
if (status < 0)
21402136
break;

0 commit comments

Comments
 (0)