@@ -356,13 +356,6 @@ enum dsp_download_state {
356
356
DSP_DOWNLOADED = 2
357
357
};
358
358
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
-
366
359
/* retrieve parameters from hda format */
367
360
#define get_hdafmt_chs (fmt ) (fmt & 0xf)
368
361
#define get_hdafmt_bits (fmt ) ((fmt >> 4) & 0x7)
@@ -1585,16 +1578,17 @@ enum dma_state {
1585
1578
};
1586
1579
1587
1580
static int dma_convert_to_hda_format (
1588
- struct hda_stream_format * stream_format ,
1581
+ unsigned int sample_rate ,
1582
+ unsigned short channels ,
1589
1583
unsigned short * hda_format )
1590
1584
{
1591
1585
unsigned int format_val ;
1592
1586
1593
1587
format_val = snd_hda_calc_stream_format (
1594
- stream_format -> sample_rate ,
1595
- stream_format -> number_channels ,
1588
+ sample_rate ,
1589
+ channels ,
1596
1590
SNDRV_PCM_FORMAT_S32_LE ,
1597
- stream_format -> container_size , 0 );
1591
+ 32 , 0 );
1598
1592
1599
1593
if (hda_format )
1600
1594
* hda_format = (unsigned short )format_val ;
@@ -1940,14 +1934,17 @@ static int dspxfr_one_seg(struct hda_codec *codec,
1940
1934
* @fls_data: pointer to a fast load image
1941
1935
* @reloc: Relocation address for loading single-segment overlays, or 0 for
1942
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
1939
* @ovly: TRUE if overlay format is required
1945
1940
*
1946
1941
* Returns zero or a negative error code.
1947
1942
*/
1948
1943
static int dspxfr_image (struct hda_codec * codec ,
1949
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
1948
bool ovly )
1952
1949
{
1953
1950
struct ca0132_spec * spec = codec -> spec ;
@@ -1976,7 +1973,7 @@ static int dspxfr_image(struct hda_codec *codec,
1976
1973
}
1977
1974
1978
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
1977
dma_engine -> m_converter_format = hda_format ;
1981
1978
dma_engine -> buf_size = (ovly ? DSP_DMA_WRITE_BUFLEN_OVLY :
1982
1979
DSP_DMA_WRITE_BUFLEN_INIT ) * 2 ;
@@ -2104,7 +2101,8 @@ static int dspload_image(struct hda_codec *codec,
2104
2101
int router_chans )
2105
2102
{
2106
2103
int status = 0 ;
2107
- struct hda_stream_format stream_format ;
2104
+ unsigned int sample_rate ;
2105
+ unsigned short channels ;
2108
2106
2109
2107
snd_printdd (KERN_INFO "---- dspload_image begin ------" );
2110
2108
if (router_chans == 0 ) {
@@ -2114,17 +2112,14 @@ static int dspload_image(struct hda_codec *codec,
2114
2112
router_chans = DMA_OVERLAY_FRAME_SIZE_NWORDS ;
2115
2113
}
2116
2114
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 ;
2119
2117
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 ;
2123
2121
}
2124
2122
2125
- stream_format .container_size = 32 ;
2126
- stream_format .valid_bits_per_sample = 32 ;
2127
-
2128
2123
do {
2129
2124
snd_printdd (KERN_INFO "Ready to program DMA" );
2130
2125
if (!ovly )
@@ -2134,7 +2129,8 @@ static int dspload_image(struct hda_codec *codec,
2134
2129
break ;
2135
2130
2136
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
2135
if (status < 0 )
2140
2136
break ;
0 commit comments