Commit 28aedaf7 authored by Norberto Lopes's avatar Norberto Lopes Committed by Takashi Iwai

ALSA: sound/pci/hda/hda_codec.c: various coding style fixes

Signed-off-by: default avatarNorberto Lopes <nlopes.ml@gmail.com>
Acked-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 20645d70
...@@ -978,8 +978,9 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, ...@@ -978,8 +978,9 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
* *
* Returns 0 if successful, or a negative error code. * Returns 0 if successful, or a negative error code.
*/ */
int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
struct hda_codec **codecp) unsigned int codec_addr,
struct hda_codec **codecp)
{ {
struct hda_codec *codec; struct hda_codec *codec;
char component[31]; char component[31];
...@@ -1186,7 +1187,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); ...@@ -1186,7 +1187,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);
*/ */
/* FIXME: more better hash key? */ /* FIXME: more better hash key? */
#define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) #define HDA_HASH_KEY(nid, dir, idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24))
#define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24))
#define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24)) #define HDA_HASH_PARPCM_KEY(nid) (u32)((nid) + (0x03 << 24))
#define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24)) #define HDA_HASH_PARSTR_KEY(nid) (u32)((nid) + (0x04 << 24))
...@@ -1356,7 +1357,8 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) ...@@ -1356,7 +1357,8 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
if (!codec->no_trigger_sense) { if (!codec->no_trigger_sense) {
pincap = snd_hda_query_pin_caps(codec, nid); pincap = snd_hda_query_pin_caps(codec, nid);
if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); snd_hda_codec_read(codec, nid, 0,
AC_VERB_SET_PIN_SENSE, 0);
} }
return snd_hda_codec_read(codec, nid, 0, return snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_SENSE, 0); AC_VERB_GET_PIN_SENSE, 0);
...@@ -1372,8 +1374,8 @@ EXPORT_SYMBOL_HDA(snd_hda_pin_sense); ...@@ -1372,8 +1374,8 @@ EXPORT_SYMBOL_HDA(snd_hda_pin_sense);
*/ */
int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
{ {
u32 sense = snd_hda_pin_sense(codec, nid); u32 sense = snd_hda_pin_sense(codec, nid);
return !!(sense & AC_PINSENSE_PRESENCE); return !!(sense & AC_PINSENSE_PRESENCE);
} }
EXPORT_SYMBOL_HDA(snd_hda_jack_detect); EXPORT_SYMBOL_HDA(snd_hda_jack_detect);
...@@ -1952,7 +1954,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, ...@@ -1952,7 +1954,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
err = snd_hda_ctl_add(codec, 0, kctl); err = snd_hda_ctl_add(codec, 0, kctl);
if (err < 0) if (err < 0)
return err; return err;
for (s = slaves; *s; s++) { for (s = slaves; *s; s++) {
struct snd_kcontrol *sctl; struct snd_kcontrol *sctl;
int i = 0; int i = 0;
...@@ -2439,27 +2441,27 @@ static struct snd_kcontrol_new dig_mixes[] = { ...@@ -2439,27 +2441,27 @@ static struct snd_kcontrol_new dig_mixes[] = {
{ {
.access = SNDRV_CTL_ELEM_ACCESS_READ, .access = SNDRV_CTL_ELEM_ACCESS_READ,
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
.info = snd_hda_spdif_mask_info, .info = snd_hda_spdif_mask_info,
.get = snd_hda_spdif_cmask_get, .get = snd_hda_spdif_cmask_get,
}, },
{ {
.access = SNDRV_CTL_ELEM_ACCESS_READ, .access = SNDRV_CTL_ELEM_ACCESS_READ,
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK),
.info = snd_hda_spdif_mask_info, .info = snd_hda_spdif_mask_info,
.get = snd_hda_spdif_pmask_get, .get = snd_hda_spdif_pmask_get,
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
.info = snd_hda_spdif_mask_info, .info = snd_hda_spdif_mask_info,
.get = snd_hda_spdif_default_get, .get = snd_hda_spdif_default_get,
.put = snd_hda_spdif_default_put, .put = snd_hda_spdif_default_put,
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH),
.info = snd_hda_spdif_out_switch_info, .info = snd_hda_spdif_out_switch_info,
.get = snd_hda_spdif_out_switch_get, .get = snd_hda_spdif_out_switch_get,
.put = snd_hda_spdif_out_switch_put, .put = snd_hda_spdif_out_switch_put,
...@@ -2610,7 +2612,7 @@ static int snd_hda_spdif_in_status_get(struct snd_kcontrol *kcontrol, ...@@ -2610,7 +2612,7 @@ static int snd_hda_spdif_in_status_get(struct snd_kcontrol *kcontrol,
static struct snd_kcontrol_new dig_in_ctls[] = { static struct snd_kcontrol_new dig_in_ctls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH),
.info = snd_hda_spdif_in_switch_info, .info = snd_hda_spdif_in_switch_info,
.get = snd_hda_spdif_in_switch_get, .get = snd_hda_spdif_in_switch_get,
.put = snd_hda_spdif_in_switch_put, .put = snd_hda_spdif_in_switch_put,
...@@ -2618,7 +2620,7 @@ static struct snd_kcontrol_new dig_in_ctls[] = { ...@@ -2618,7 +2620,7 @@ static struct snd_kcontrol_new dig_in_ctls[] = {
{ {
.access = SNDRV_CTL_ELEM_ACCESS_READ, .access = SNDRV_CTL_ELEM_ACCESS_READ,
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("",CAPTURE,DEFAULT), .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, DEFAULT),
.info = snd_hda_spdif_mask_info, .info = snd_hda_spdif_mask_info,
.get = snd_hda_spdif_in_status_get, .get = snd_hda_spdif_in_status_get,
}, },
...@@ -2883,7 +2885,7 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) ...@@ -2883,7 +2885,7 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus)
int err = snd_hda_codec_build_controls(codec); int err = snd_hda_codec_build_controls(codec);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "hda_codec: cannot build controls" printk(KERN_ERR "hda_codec: cannot build controls"
"for #%d (error %d)\n", codec->addr, err); "for #%d (error %d)\n", codec->addr, err);
err = snd_hda_codec_reset(codec); err = snd_hda_codec_reset(codec);
if (err < 0) { if (err < 0) {
printk(KERN_ERR printk(KERN_ERR
...@@ -2979,8 +2981,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, ...@@ -2979,8 +2981,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
val |= channels - 1; val |= channels - 1;
switch (snd_pcm_format_width(format)) { switch (snd_pcm_format_width(format)) {
case 8: val |= 0x00; break; case 8:
case 16: val |= 0x10; break; val |= 0x00;
break;
case 16:
val |= 0x10;
break;
case 20: case 20:
case 24: case 24:
case 32: case 32:
...@@ -3298,7 +3304,8 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) ...@@ -3298,7 +3304,8 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits))
return audio_idx[type][i]; return audio_idx[type][i];
snd_printk(KERN_WARNING "Too many %s devices\n", snd_hda_pcm_type_name[type]); snd_printk(KERN_WARNING "Too many %s devices\n",
snd_hda_pcm_type_name[type]);
return -EAGAIN; return -EAGAIN;
} }
...@@ -3336,7 +3343,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) ...@@ -3336,7 +3343,7 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec)
err = codec->patch_ops.build_pcms(codec); err = codec->patch_ops.build_pcms(codec);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "hda_codec: cannot build PCMs" printk(KERN_ERR "hda_codec: cannot build PCMs"
"for #%d (error %d)\n", codec->addr, err); "for #%d (error %d)\n", codec->addr, err);
err = snd_hda_codec_reset(codec); err = snd_hda_codec_reset(codec);
if (err < 0) { if (err < 0) {
printk(KERN_ERR printk(KERN_ERR
...@@ -3466,8 +3473,8 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config); ...@@ -3466,8 +3473,8 @@ EXPORT_SYMBOL_HDA(snd_hda_check_board_config);
/** /**
* snd_hda_check_board_codec_sid_config - compare the current codec * snd_hda_check_board_codec_sid_config - compare the current codec
subsystem ID with the subsystem ID with the
config table config table
This is important for Gateway notebooks with SB450 HDA Audio This is important for Gateway notebooks with SB450 HDA Audio
where the vendor ID of the PCI device is: where the vendor ID of the PCI device is:
...@@ -3607,7 +3614,7 @@ void snd_hda_update_power_acct(struct hda_codec *codec) ...@@ -3607,7 +3614,7 @@ void snd_hda_update_power_acct(struct hda_codec *codec)
* *
* Increment the power-up counter and power up the hardware really when * Increment the power-up counter and power up the hardware really when
* not turned on yet. * not turned on yet.
*/ */
void snd_hda_power_up(struct hda_codec *codec) void snd_hda_power_up(struct hda_codec *codec)
{ {
struct hda_bus *bus = codec->bus; struct hda_bus *bus = codec->bus;
...@@ -3636,7 +3643,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up); ...@@ -3636,7 +3643,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_up);
* *
* Decrement the power-up counter and schedules the power-off work if * Decrement the power-up counter and schedules the power-off work if
* the counter rearches to zero. * the counter rearches to zero.
*/ */
void snd_hda_power_down(struct hda_codec *codec) void snd_hda_power_down(struct hda_codec *codec)
{ {
--codec->power_count; --codec->power_count;
...@@ -3662,7 +3669,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_down); ...@@ -3662,7 +3669,7 @@ EXPORT_SYMBOL_HDA(snd_hda_power_down);
* *
* This function is supposed to be set or called from the check_power_status * This function is supposed to be set or called from the check_power_status
* patch ops. * patch ops.
*/ */
int snd_hda_check_amp_list_power(struct hda_codec *codec, int snd_hda_check_amp_list_power(struct hda_codec *codec,
struct hda_loopback_check *check, struct hda_loopback_check *check,
hda_nid_t nid) hda_nid_t nid)
...@@ -3830,7 +3837,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, ...@@ -3830,7 +3837,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
{ {
/* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE))
set_dig_out_convert(codec, nid, set_dig_out_convert(codec, nid,
codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff, codec->spdif_ctls & ~AC_DIG1_ENABLE & 0xff,
-1); -1);
snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
...@@ -4089,13 +4096,13 @@ static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list) ...@@ -4089,13 +4096,13 @@ static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list)
/* /*
* Sort an associated group of pins according to their sequence numbers. * Sort an associated group of pins according to their sequence numbers.
*/ */
static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, static void sort_pins_by_sequence(hda_nid_t *pins, short *sequences,
int num_pins) int num_pins)
{ {
int i, j; int i, j;
short seq; short seq;
hda_nid_t nid; hda_nid_t nid;
for (i = 0; i < num_pins; i++) { for (i = 0; i < num_pins; i++) {
for (j = i + 1; j < num_pins; j++) { for (j = i + 1; j < num_pins; j++) {
if (sequences[i] > sequences[j]) { if (sequences[i] > sequences[j]) {
...@@ -4123,7 +4130,7 @@ static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences, ...@@ -4123,7 +4130,7 @@ static void sort_pins_by_sequence(hda_nid_t * pins, short * sequences,
* is detected, one of speaker of HP pins is assigned as the primary * is detected, one of speaker of HP pins is assigned as the primary
* output, i.e. to line_out_pins[0]. So, line_outs is always positive * output, i.e. to line_out_pins[0]. So, line_outs is always positive
* if any analog output exists. * if any analog output exists.
* *
* The analog input pins are assigned to input_pins array. * The analog input pins are assigned to input_pins array.
* The digital input/output pins are assigned to dig_in_pin and dig_out_pin, * The digital input/output pins are assigned to dig_in_pin and dig_out_pin,
* respectively. * respectively.
...@@ -4186,9 +4193,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, ...@@ -4186,9 +4193,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
case AC_JACK_SPEAKER: case AC_JACK_SPEAKER:
seq = get_defcfg_sequence(def_conf); seq = get_defcfg_sequence(def_conf);
assoc = get_defcfg_association(def_conf); assoc = get_defcfg_association(def_conf);
if (! assoc) if (!assoc)
continue; continue;
if (! assoc_speaker) if (!assoc_speaker)
assoc_speaker = assoc; assoc_speaker = assoc;
else if (assoc_speaker != assoc) else if (assoc_speaker != assoc)
continue; continue;
...@@ -4286,7 +4293,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, ...@@ -4286,7 +4293,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
cfg->speaker_outs); cfg->speaker_outs);
sort_pins_by_sequence(cfg->hp_pins, sequences_hp, sort_pins_by_sequence(cfg->hp_pins, sequences_hp,
cfg->hp_outs); cfg->hp_outs);
/* if we have only one mic, make it AUTO_PIN_MIC */ /* if we have only one mic, make it AUTO_PIN_MIC */
if (!cfg->input_pins[AUTO_PIN_MIC] && if (!cfg->input_pins[AUTO_PIN_MIC] &&
cfg->input_pins[AUTO_PIN_FRONT_MIC]) { cfg->input_pins[AUTO_PIN_FRONT_MIC]) {
...@@ -4436,7 +4443,7 @@ EXPORT_SYMBOL_HDA(snd_hda_resume); ...@@ -4436,7 +4443,7 @@ EXPORT_SYMBOL_HDA(snd_hda_resume);
/** /**
* snd_array_new - get a new element from the given array * snd_array_new - get a new element from the given array
* @array: the array object * @array: the array object
* *
* Get a new element from the given array. If it exceeds the * Get a new element from the given array. If it exceeds the
* pre-allocated array size, re-allocate the array. * pre-allocated array size, re-allocate the array.
* *
......
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