Commit dda14410 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Constify some API function arguments

Also fixed the assignment of multiout.dac_nids to satisfy const.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a9111321
......@@ -2621,7 +2621,7 @@ static unsigned int convert_to_spdif_status(unsigned short val)
static void set_dig_out(struct hda_codec *codec, hda_nid_t nid,
int verb, int val)
{
hda_nid_t *d;
const hda_nid_t *d;
snd_hda_codec_write_cache(codec, nid, 0, verb, val);
d = codec->slave_dig_outs;
......@@ -4184,7 +4184,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
-1);
snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
if (codec->slave_dig_outs) {
hda_nid_t *d;
const hda_nid_t *d;
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_setup_stream(codec, *d, stream_tag, 0,
format);
......@@ -4199,7 +4199,7 @@ static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid)
{
snd_hda_codec_cleanup_stream(codec, nid);
if (codec->slave_dig_outs) {
hda_nid_t *d;
const hda_nid_t *d;
for (d = codec->slave_dig_outs; *d; d++)
snd_hda_codec_cleanup_stream(codec, *d);
}
......@@ -4346,7 +4346,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
unsigned int format,
struct snd_pcm_substream *substream)
{
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
int chs = substream->runtime->channels;
int i;
......@@ -4401,7 +4401,7 @@ EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare);
int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout)
{
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
int i;
for (i = 0; i < mout->num_dacs; i++)
......@@ -4426,7 +4426,7 @@ EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);
* Helper for automatic pin configuration
*/
static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list)
static int is_in_nid_list(hda_nid_t nid, const hda_nid_t *list)
{
for (; *list; list++)
if (*list == nid)
......@@ -4507,7 +4507,7 @@ static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)
*/
int snd_hda_parse_pin_def_config(struct hda_codec *codec,
struct auto_pin_cfg *cfg,
hda_nid_t *ignore_nids)
const hda_nid_t *ignore_nids)
{
hda_nid_t nid, end_nid;
short seq, assoc_line_out, assoc_speaker;
......
......@@ -832,7 +832,7 @@ struct hda_codec {
unsigned int spdif_status; /* IEC958 status bits */
unsigned short spdif_ctls; /* SPDIF control bits */
unsigned int spdif_in_enable; /* SPDIF input enable? */
hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
struct snd_array init_pins; /* initial (BIOS) pin configurations */
struct snd_array driver_pins; /* pin configs set by codec parser */
struct snd_array cvt_setups; /* audio convert setups */
......
......@@ -267,11 +267,11 @@ enum { HDA_DIG_NONE, HDA_DIG_EXCLUSIVE, HDA_DIG_ANALOG_DUP }; /* dig_out_used */
struct hda_multi_out {
int num_dacs; /* # of DACs, must be more than 1 */
hda_nid_t *dac_nids; /* DAC list */
const hda_nid_t *dac_nids; /* DAC list */
hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */
hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */
hda_nid_t dig_out_nid; /* digital out audio widget */
hda_nid_t *slave_dig_outs;
const hda_nid_t *slave_dig_outs;
int max_channels; /* currently supported analog channels */
int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
int no_share_stream; /* don't share a stream with multiple pins */
......@@ -443,7 +443,7 @@ struct auto_pin_cfg {
int snd_hda_parse_pin_def_config(struct hda_codec *codec,
struct auto_pin_cfg *cfg,
hda_nid_t *ignore_nids);
const hda_nid_t *ignore_nids);
/* amp values */
#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
......
......@@ -2845,7 +2845,7 @@ static int ad1988_auto_fill_dac_nids(struct hda_codec *codec,
/* check the pins hardwired to audio widget */
for (i = 0; i < cfg->line_outs; i++) {
idx = ad1988_pin_idx(cfg->line_out_pins[i]);
spec->multiout.dac_nids[i] = ad1988_idx_to_dac(codec, idx);
spec->private_dac_nids[i] = ad1988_idx_to_dac(codec, idx);
}
spec->multiout.num_dacs = cfg->line_outs;
return 0;
......
......@@ -5294,7 +5294,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
nid = cfg->line_out_pins[i];
if (alc880_is_fixed_pin(nid)) {
int idx = alc880_fixed_pin_idx(nid);
spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
assigned[idx] = 1;
}
}
......@@ -5306,7 +5306,7 @@ static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
/* search for an empty channel */
for (j = 0; j < cfg->line_outs; j++) {
if (!assigned[j]) {
spec->multiout.dac_nids[i] =
spec->private_dac_nids[i] =
alc880_idx_to_dac(j);
assigned[j] = 1;
break;
......@@ -7131,7 +7131,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
spec->multiout.num_dacs = 1;
spec->multiout.dac_nids = spec->private_dac_nids;
spec->multiout.dac_nids[0] = 0x02;
spec->private_dac_nids[0] = 0x02;
nid = cfg->line_out_pins[0];
if (nid) {
......@@ -12214,7 +12214,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
spec->multiout.num_dacs = 1; /* only use one dac */
spec->multiout.dac_nids = spec->private_dac_nids;
spec->multiout.dac_nids[0] = 2;
spec->private_dac_nids[0] = 2;
pfx = alc_get_line_out_pfx(spec, true);
if (!pfx)
......@@ -13553,7 +13553,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
HDA_OUTPUT));
if (err < 0)
return err;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
if (nid != 0x16)
......@@ -15951,7 +15951,7 @@ static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
dac = alc861_look_for_dac(codec, nid);
if (!dac)
continue;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
return 0;
}
......@@ -18932,7 +18932,7 @@ static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]);
if (!dac)
continue;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
return 0;
}
......@@ -19166,7 +19166,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
spec->multi_io[num_pins].pin = nid;
spec->multi_io[num_pins].dac = dac;
num_pins++;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
}
spec->multiout.num_dacs = 1;
......@@ -19786,7 +19786,7 @@ static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
if (err < 0)
return err;
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
}
return 0;
......
......@@ -3072,7 +3072,8 @@ static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid)
printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
return 1;
} else {
spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids);
spec->dac_nids[spec->multiout.num_dacs] = nid;
spec->multiout.num_dacs++;
}
return 0;
......
......@@ -1233,7 +1233,7 @@ static void playback_multi_pcm_prep_0(struct hda_codec *codec,
{
struct via_spec *spec = codec->spec;
struct hda_multi_out *mout = &spec->multiout;
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
int chs = substream->runtime->channels;
int i;
......@@ -1302,7 +1302,7 @@ static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo,
{
struct via_spec *spec = codec->spec;
struct hda_multi_out *mout = &spec->multiout;
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
if (substream->number == 0)
playback_multi_pcm_prep_0(codec, stream_tag, format,
......@@ -1323,7 +1323,7 @@ static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo,
{
struct via_spec *spec = codec->spec;
struct hda_multi_out *mout = &spec->multiout;
hda_nid_t *nids = mout->dac_nids;
const hda_nid_t *nids = mout->dac_nids;
int i;
if (substream->number == 0) {
......@@ -1849,16 +1849,16 @@ static int vt1708_auto_fill_dac_nids(struct via_spec *spec,
/* config dac list */
switch (i) {
case AUTO_SEQ_FRONT:
spec->multiout.dac_nids[i] = 0x10;
spec->private_dac_nids[i] = 0x10;
break;
case AUTO_SEQ_CENLFE:
spec->multiout.dac_nids[i] = 0x12;
spec->private_dac_nids[i] = 0x12;
break;
case AUTO_SEQ_SURROUND:
spec->multiout.dac_nids[i] = 0x11;
spec->private_dac_nids[i] = 0x11;
break;
case AUTO_SEQ_SIDE:
spec->multiout.dac_nids[i] = 0x13;
spec->private_dac_nids[i] = 0x13;
break;
}
}
......@@ -2437,26 +2437,26 @@ static int vt1709_auto_fill_dac_nids(struct via_spec *spec,
switch (i) {
case AUTO_SEQ_FRONT:
/* AOW0 */
spec->multiout.dac_nids[i] = 0x10;
spec->private_dac_nids[i] = 0x10;
break;
case AUTO_SEQ_CENLFE:
/* AOW2 */
spec->multiout.dac_nids[i] = 0x12;
spec->private_dac_nids[i] = 0x12;
break;
case AUTO_SEQ_SURROUND:
/* AOW3 */
spec->multiout.dac_nids[i] = 0x11;
spec->private_dac_nids[i] = 0x11;
break;
case AUTO_SEQ_SIDE:
/* AOW1 */
spec->multiout.dac_nids[i] = 0x27;
spec->private_dac_nids[i] = 0x27;
break;
default:
break;
}
}
}
spec->multiout.dac_nids[cfg->line_outs] = 0x28; /* AOW4 */
spec->private_dac_nids[cfg->line_outs] = 0x28; /* AOW4 */
} else if (cfg->line_outs == 3) { /* 6 channels */
for (i = 0; i < cfg->line_outs; i++) {
......@@ -2466,15 +2466,15 @@ static int vt1709_auto_fill_dac_nids(struct via_spec *spec,
switch (i) {
case AUTO_SEQ_FRONT:
/* AOW0 */
spec->multiout.dac_nids[i] = 0x10;
spec->private_dac_nids[i] = 0x10;
break;
case AUTO_SEQ_CENLFE:
/* AOW2 */
spec->multiout.dac_nids[i] = 0x12;
spec->private_dac_nids[i] = 0x12;
break;
case AUTO_SEQ_SURROUND:
/* AOW1 */
spec->multiout.dac_nids[i] = 0x11;
spec->private_dac_nids[i] = 0x11;
break;
default:
break;
......@@ -3013,16 +3013,16 @@ static int vt1708B_auto_fill_dac_nids(struct via_spec *spec,
/* config dac list */
switch (i) {
case AUTO_SEQ_FRONT:
spec->multiout.dac_nids[i] = 0x10;
spec->private_dac_nids[i] = 0x10;
break;
case AUTO_SEQ_CENLFE:
spec->multiout.dac_nids[i] = 0x24;
spec->private_dac_nids[i] = 0x24;
break;
case AUTO_SEQ_SURROUND:
spec->multiout.dac_nids[i] = 0x11;
spec->private_dac_nids[i] = 0x11;
break;
case AUTO_SEQ_SIDE:
spec->multiout.dac_nids[i] = 0x25;
spec->private_dac_nids[i] = 0x25;
break;
}
}
......@@ -3546,19 +3546,19 @@ static int vt1708S_auto_fill_dac_nids(struct via_spec *spec,
/* config dac list */
switch (i) {
case AUTO_SEQ_FRONT:
spec->multiout.dac_nids[i] = 0x10;
spec->private_dac_nids[i] = 0x10;
break;
case AUTO_SEQ_CENLFE:
if (spec->codec->vendor_id == 0x11064397)
spec->multiout.dac_nids[i] = 0x25;
spec->private_dac_nids[i] = 0x25;
else
spec->multiout.dac_nids[i] = 0x24;
spec->private_dac_nids[i] = 0x24;
break;
case AUTO_SEQ_SURROUND:
spec->multiout.dac_nids[i] = 0x11;
spec->private_dac_nids[i] = 0x11;
break;
case AUTO_SEQ_SIDE:
spec->multiout.dac_nids[i] = 0x25;
spec->private_dac_nids[i] = 0x25;
break;
}
}
......@@ -3567,11 +3567,11 @@ static int vt1708S_auto_fill_dac_nids(struct via_spec *spec,
/* for Smart 5.1, line/mic inputs double as output pins */
if (cfg->line_outs == 1) {
spec->multiout.num_dacs = 3;
spec->multiout.dac_nids[AUTO_SEQ_SURROUND] = 0x11;
spec->private_dac_nids[AUTO_SEQ_SURROUND] = 0x11;
if (spec->codec->vendor_id == 0x11064397)
spec->multiout.dac_nids[AUTO_SEQ_CENLFE] = 0x25;
spec->private_dac_nids[AUTO_SEQ_CENLFE] = 0x25;
else
spec->multiout.dac_nids[AUTO_SEQ_CENLFE] = 0x24;
spec->private_dac_nids[AUTO_SEQ_CENLFE] = 0x24;
}
return 0;
......@@ -4017,7 +4017,7 @@ static int vt1702_auto_fill_dac_nids(struct via_spec *spec,
if (cfg->line_out_pins[0]) {
/* config dac list */
spec->multiout.dac_nids[0] = 0x10;
spec->private_dac_nids[0] = 0x10;
}
return 0;
......@@ -4384,16 +4384,16 @@ static int vt1718S_auto_fill_dac_nids(struct via_spec *spec,
/* config dac list */
switch (i) {
case AUTO_SEQ_FRONT:
spec->multiout.dac_nids[i] = 0x8;
spec->private_dac_nids[i] = 0x8;
break;
case AUTO_SEQ_CENLFE:
spec->multiout.dac_nids[i] = 0xa;
spec->private_dac_nids[i] = 0xa;
break;
case AUTO_SEQ_SURROUND:
spec->multiout.dac_nids[i] = 0x9;
spec->private_dac_nids[i] = 0x9;
break;
case AUTO_SEQ_SIDE:
spec->multiout.dac_nids[i] = 0xb;
spec->private_dac_nids[i] = 0xb;
break;
}
}
......@@ -4905,13 +4905,13 @@ static int vt1716S_auto_fill_dac_nids(struct via_spec *spec,
/* config dac list */
switch (i) {
case AUTO_SEQ_FRONT:
spec->multiout.dac_nids[i] = 0x10;
spec->private_dac_nids[i] = 0x10;
break;
case AUTO_SEQ_CENLFE:
spec->multiout.dac_nids[i] = 0x25;
spec->private_dac_nids[i] = 0x25;
break;
case AUTO_SEQ_SURROUND:
spec->multiout.dac_nids[i] = 0x11;
spec->private_dac_nids[i] = 0x11;
break;
}
}
......@@ -5454,7 +5454,7 @@ static int vt2002P_auto_fill_dac_nids(struct via_spec *spec,
spec->multiout.num_dacs = 1;
spec->multiout.dac_nids = spec->private_dac_nids;
if (cfg->line_out_pins[0])
spec->multiout.dac_nids[0] = 0x8;
spec->private_dac_nids[0] = 0x8;
return 0;
}
......@@ -5907,7 +5907,7 @@ static int vt1812_auto_fill_dac_nids(struct via_spec *spec,
spec->multiout.num_dacs = 1;
spec->multiout.dac_nids = spec->private_dac_nids;
if (cfg->line_out_pins[0])
spec->multiout.dac_nids[0] = 0x8;
spec->private_dac_nids[0] = 0x8;
return 0;
}
......
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