Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e76a883 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Replace with standard printk



Use dev_err() and co for messages from HD-audio controller and codec
drivers.  The codec drivers are mostly bound with codec objects, so
some helper macros, codec_err(), codec_info(), etc, are provided.
They merely wrap the corresponding dev_xxx().

There are a few places still calling snd_printk() and its variants
as they are called without the codec or device context.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b989d044
Loading
Loading
Loading
Loading
+15 −20
Original line number Original line Diff line number Diff line
@@ -313,9 +313,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
		}
		}


		if (hsmic)
		if (hsmic)
			snd_printdd("Told to look for a headset mic, but didn't find any.\n");
			codec_dbg(codec, "Told to look for a headset mic, but didn't find any.\n");
		if (hpmic)
		if (hpmic)
			snd_printdd("Told to look for a headphone mic, but didn't find any.\n");
			codec_dbg(codec, "Told to look for a headphone mic, but didn't find any.\n");
	}
	}


	/* FIX-UP:
	/* FIX-UP:
@@ -384,33 +384,33 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
	/*
	/*
	 * debug prints of the parsed results
	 * debug prints of the parsed results
	 */
	 */
	snd_printd("autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n",
	codec_info(codec, "autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n",
		   cfg->line_outs, cfg->line_out_pins[0], cfg->line_out_pins[1],
		   cfg->line_outs, cfg->line_out_pins[0], cfg->line_out_pins[1],
		   cfg->line_out_pins[2], cfg->line_out_pins[3],
		   cfg->line_out_pins[2], cfg->line_out_pins[3],
		   cfg->line_out_pins[4],
		   cfg->line_out_pins[4],
		   cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" :
		   cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" :
		   (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ?
		   (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ?
		    "speaker" : "line"));
		    "speaker" : "line"));
	snd_printd("   speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
	codec_info(codec, "   speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
		   cfg->speaker_outs, cfg->speaker_pins[0],
		   cfg->speaker_outs, cfg->speaker_pins[0],
		   cfg->speaker_pins[1], cfg->speaker_pins[2],
		   cfg->speaker_pins[1], cfg->speaker_pins[2],
		   cfg->speaker_pins[3], cfg->speaker_pins[4]);
		   cfg->speaker_pins[3], cfg->speaker_pins[4]);
	snd_printd("   hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
	codec_info(codec, "   hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
		   cfg->hp_outs, cfg->hp_pins[0],
		   cfg->hp_outs, cfg->hp_pins[0],
		   cfg->hp_pins[1], cfg->hp_pins[2],
		   cfg->hp_pins[1], cfg->hp_pins[2],
		   cfg->hp_pins[3], cfg->hp_pins[4]);
		   cfg->hp_pins[3], cfg->hp_pins[4]);
	snd_printd("   mono: mono_out=0x%x\n", cfg->mono_out_pin);
	codec_info(codec, "   mono: mono_out=0x%x\n", cfg->mono_out_pin);
	if (cfg->dig_outs)
	if (cfg->dig_outs)
		snd_printd("   dig-out=0x%x/0x%x\n",
		codec_info(codec, "   dig-out=0x%x/0x%x\n",
			   cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
			   cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
	snd_printd("   inputs:\n");
	codec_info(codec, "   inputs:\n");
	for (i = 0; i < cfg->num_inputs; i++) {
	for (i = 0; i < cfg->num_inputs; i++) {
		snd_printd("     %s=0x%x\n",
		codec_info(codec, "     %s=0x%x\n",
			    hda_get_autocfg_input_label(codec, cfg, i),
			    hda_get_autocfg_input_label(codec, cfg, i),
			    cfg->inputs[i].pin);
			    cfg->inputs[i].pin);
	}
	}
	if (cfg->dig_in_pin)
	if (cfg->dig_in_pin)
		snd_printd("   dig-in=0x%x\n", cfg->dig_in_pin);
		codec_info(codec, "   dig-in=0x%x\n", cfg->dig_in_pin);


	return 0;
	return 0;
}
}
@@ -774,38 +774,33 @@ static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
		case HDA_FIXUP_PINS:
		case HDA_FIXUP_PINS:
			if (action != HDA_FIXUP_ACT_PRE_PROBE || !fix->v.pins)
			if (action != HDA_FIXUP_ACT_PRE_PROBE || !fix->v.pins)
				break;
				break;
			snd_printdd(KERN_INFO SFX
			codec_dbg(codec, "%s: Apply pincfg for %s\n",
				    "%s: Apply pincfg for %s\n",
				    codec->chip_name, modelname);
				    codec->chip_name, modelname);
			snd_hda_apply_pincfgs(codec, fix->v.pins);
			snd_hda_apply_pincfgs(codec, fix->v.pins);
			break;
			break;
		case HDA_FIXUP_VERBS:
		case HDA_FIXUP_VERBS:
			if (action != HDA_FIXUP_ACT_PROBE || !fix->v.verbs)
			if (action != HDA_FIXUP_ACT_PROBE || !fix->v.verbs)
				break;
				break;
			snd_printdd(KERN_INFO SFX
			codec_dbg(codec, "%s: Apply fix-verbs for %s\n",
				    "%s: Apply fix-verbs for %s\n",
				    codec->chip_name, modelname);
				    codec->chip_name, modelname);
			snd_hda_add_verbs(codec, fix->v.verbs);
			snd_hda_add_verbs(codec, fix->v.verbs);
			break;
			break;
		case HDA_FIXUP_FUNC:
		case HDA_FIXUP_FUNC:
			if (!fix->v.func)
			if (!fix->v.func)
				break;
				break;
			snd_printdd(KERN_INFO SFX
			codec_dbg(codec, "%s: Apply fix-func for %s\n",
				    "%s: Apply fix-func for %s\n",
				    codec->chip_name, modelname);
				    codec->chip_name, modelname);
			fix->v.func(codec, fix, action);
			fix->v.func(codec, fix, action);
			break;
			break;
		case HDA_FIXUP_PINCTLS:
		case HDA_FIXUP_PINCTLS:
			if (action != HDA_FIXUP_ACT_PROBE || !fix->v.pins)
			if (action != HDA_FIXUP_ACT_PROBE || !fix->v.pins)
				break;
				break;
			snd_printdd(KERN_INFO SFX
			codec_dbg(codec, "%s: Apply pinctl for %s\n",
				    "%s: Apply pinctl for %s\n",
				    codec->chip_name, modelname);
				    codec->chip_name, modelname);
			set_pin_targets(codec, fix->v.pins);
			set_pin_targets(codec, fix->v.pins);
			break;
			break;
		default:
		default:
			snd_printk(KERN_ERR SFX
			codec_err(codec, "%s: Invalid fixup type %d\n",
				   "%s: Invalid fixup type %d\n",
				   codec->chip_name, fix->type);
				   codec->chip_name, fix->type);
			break;
			break;
		}
		}
+1 −1
Original line number Original line Diff line number Diff line
@@ -172,7 +172,7 @@ static int snd_hda_do_attach(struct hda_beep *beep)
	err = input_register_device(input_dev);
	err = input_register_device(input_dev);
	if (err < 0) {
	if (err < 0) {
		input_free_device(input_dev);
		input_free_device(input_dev);
		printk(KERN_INFO "hda_beep: unable to register input device\n");
		codec_err(codec, "hda_beep: unable to register input device\n");
		return err;
		return err;
	}
	}
	beep->dev = input_dev;
	beep->dev = input_dev;
+68 −69
Original line number Original line Diff line number Diff line
@@ -201,7 +201,7 @@ make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int flags,


	if ((codec->addr & ~0xf) || (nid & ~0x7f) ||
	if ((codec->addr & ~0xf) || (nid & ~0x7f) ||
	    (verb & ~0xfff) || (parm & ~0xffff)) {
	    (verb & ~0xfff) || (parm & ~0xffff)) {
		printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x\n",
		codec_err(codec, "hda-codec: out of range cmd %x:%x:%x:%x\n",
		       codec->addr, nid, verb, parm);
		       codec->addr, nid, verb, parm);
		return ~0;
		return ~0;
	}
	}
@@ -249,8 +249,8 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd,
	snd_hda_power_down(codec);
	snd_hda_power_down(codec);
	if (!codec_in_pm(codec) && res && *res == -1 && bus->rirb_error) {
	if (!codec_in_pm(codec) && res && *res == -1 && bus->rirb_error) {
		if (bus->response_reset) {
		if (bus->response_reset) {
			snd_printd("hda_codec: resetting BUS due to "
			codec_dbg(codec,
				   "fatal communication error\n");
				  "resetting BUS due to fatal communication error\n");
			trace_hda_bus_reset(bus);
			trace_hda_bus_reset(bus);
			bus->ops.bus_reset(bus);
			bus->ops.bus_reset(bus);
		}
		}
@@ -475,8 +475,7 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,


	if (len > 0 && conn_list) {
	if (len > 0 && conn_list) {
		if (len > max_conns) {
		if (len > max_conns) {
			snd_printk(KERN_ERR "hda_codec: "
			codec_err(codec, "Too many connections %d for NID 0x%x\n",
				   "Too many connections %d for NID 0x%x\n",
				   len, nid);
				   len, nid);
			return -EINVAL;
			return -EINVAL;
		}
		}
@@ -574,7 +573,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
		range_val = !!(parm & (1 << (shift-1))); /* ranges */
		range_val = !!(parm & (1 << (shift-1))); /* ranges */
		val = parm & mask;
		val = parm & mask;
		if (val == 0 && null_count++) {  /* no second chance */
		if (val == 0 && null_count++) {  /* no second chance */
			snd_printdd("hda_codec: "
			codec_dbg(codec,
				  "invalid CONNECT_LIST verb %x[%i]:%x\n",
				  "invalid CONNECT_LIST verb %x[%i]:%x\n",
				    nid, i, parm);
				    nid, i, parm);
			return 0;
			return 0;
@@ -583,7 +582,7 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
		if (range_val) {
		if (range_val) {
			/* ranges between the previous and this one */
			/* ranges between the previous and this one */
			if (!prev_nid || prev_nid >= val) {
			if (!prev_nid || prev_nid >= val) {
				snd_printk(KERN_WARNING "hda_codec: "
				codec_warn(codec,
					   "invalid dep_range_val %x:%x\n",
					   "invalid dep_range_val %x:%x\n",
					   prev_nid, val);
					   prev_nid, val);
				continue;
				continue;
@@ -660,7 +659,7 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux,
	if (!recursive)
	if (!recursive)
		return -1;
		return -1;
	if (recursive > 10) {
	if (recursive > 10) {
		snd_printd("hda_codec: too deep connection for 0x%x\n", nid);
		codec_dbg(codec, "too deep connection for 0x%x\n", nid);
		return -1;
		return -1;
	}
	}
	recursive++;
	recursive++;
@@ -808,8 +807,7 @@ static int init_unsol_queue(struct hda_bus *bus)


	unsol = kzalloc(sizeof(*unsol), GFP_KERNEL);
	unsol = kzalloc(sizeof(*unsol), GFP_KERNEL);
	if (!unsol) {
	if (!unsol) {
		snd_printk(KERN_ERR "hda_codec: "
		dev_err(bus->card->dev, "can't allocate unsolicited queue\n");
			   "can't allocate unsolicited queue\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	INIT_WORK(&unsol->work, process_unsol_events);
	INIT_WORK(&unsol->work, process_unsol_events);
@@ -881,7 +879,7 @@ int snd_hda_bus_new(struct snd_card *card,


	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
	bus = kzalloc(sizeof(*bus), GFP_KERNEL);
	if (bus == NULL) {
	if (bus == NULL) {
		snd_printk(KERN_ERR "can't allocate struct hda_bus\n");
		dev_err(card->dev, "can't allocate struct hda_bus\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -900,7 +898,7 @@ int snd_hda_bus_new(struct snd_card *card,
		 "hd-audio%d", card->number);
		 "hd-audio%d", card->number);
	bus->workq = create_singlethread_workqueue(bus->workq_name);
	bus->workq = create_singlethread_workqueue(bus->workq_name);
	if (!bus->workq) {
	if (!bus->workq) {
		snd_printk(KERN_ERR "cannot create workqueue %s\n",
		dev_err(card->dev, "cannot create workqueue %s\n",
			   bus->workq_name);
			   bus->workq_name);
		kfree(bus);
		kfree(bus);
		return -ENOMEM;
		return -ENOMEM;
@@ -944,7 +942,7 @@ find_codec_preset(struct hda_codec *codec)
	mutex_lock(&preset_mutex);
	mutex_lock(&preset_mutex);
	list_for_each_entry(tbl, &hda_preset_tables, list) {
	list_for_each_entry(tbl, &hda_preset_tables, list) {
		if (!try_module_get(tbl->owner)) {
		if (!try_module_get(tbl->owner)) {
			snd_printk(KERN_ERR "hda_codec: cannot module_get\n");
			codec_err(codec, "cannot module_get\n");
			continue;
			continue;
		}
		}
		for (preset = tbl->preset; preset->id; preset++) {
		for (preset = tbl->preset; preset->id; preset++) {
@@ -1433,14 +1431,15 @@ int snd_hda_codec_new(struct hda_bus *bus,
		return -EINVAL;
		return -EINVAL;


	if (bus->caddr_tbl[codec_addr]) {
	if (bus->caddr_tbl[codec_addr]) {
		snd_printk(KERN_ERR "hda_codec: "
		dev_err(bus->card->dev,
			   "address 0x%x is already occupied\n", codec_addr);
			"address 0x%x is already occupied\n",
			codec_addr);
		return -EBUSY;
		return -EBUSY;
	}
	}


	codec = kzalloc(sizeof(*codec), GFP_KERNEL);
	codec = kzalloc(sizeof(*codec), GFP_KERNEL);
	if (codec == NULL) {
	if (codec == NULL) {
		snd_printk(KERN_ERR "can't allocate struct hda_codec\n");
		dev_err(bus->card->dev, "can't allocate struct hda_codec\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -1513,7 +1512,7 @@ int snd_hda_codec_new(struct hda_bus *bus,


	setup_fg_nodes(codec);
	setup_fg_nodes(codec);
	if (!codec->afg && !codec->mfg) {
	if (!codec->afg && !codec->mfg) {
		snd_printdd("hda_codec: no AFG or MFG node found\n");
		dev_err(bus->card->dev, "no AFG or MFG node found\n");
		err = -ENODEV;
		err = -ENODEV;
		goto error;
		goto error;
	}
	}
@@ -1521,7 +1520,7 @@ int snd_hda_codec_new(struct hda_bus *bus,
	fg = codec->afg ? codec->afg : codec->mfg;
	fg = codec->afg ? codec->afg : codec->mfg;
	err = read_widget_caps(codec, fg);
	err = read_widget_caps(codec, fg);
	if (err < 0) {
	if (err < 0) {
		snd_printk(KERN_ERR "hda_codec: cannot malloc\n");
		dev_err(bus->card->dev, "cannot malloc\n");
		goto error;
		goto error;
	}
	}
	err = read_pin_defaults(codec);
	err = read_pin_defaults(codec);
@@ -1583,7 +1582,7 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec)
	fg = codec->afg ? codec->afg : codec->mfg;
	fg = codec->afg ? codec->afg : codec->mfg;
	err = read_widget_caps(codec, fg);
	err = read_widget_caps(codec, fg);
	if (err < 0) {
	if (err < 0) {
		snd_printk(KERN_ERR "hda_codec: cannot malloc\n");
		codec_err(codec, "cannot malloc\n");
		return err;
		return err;
	}
	}


@@ -1660,7 +1659,7 @@ int snd_hda_codec_configure(struct hda_codec *codec)
#endif
#endif
		}
		}
		if (!patch) {
		if (!patch) {
			printk(KERN_ERR "hda-codec: No codec parser is available\n");
			codec_err(codec, "No codec parser is available\n");
			return -ENODEV;
			return -ENODEV;
		}
		}
	}
	}
@@ -1744,8 +1743,8 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
	if (!nid)
	if (!nid)
		return;
		return;


	snd_printdd("hda_codec_setup_stream: "
	codec_dbg(codec,
		    "NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n",
		  "hda_codec_setup_stream: NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n",
		  nid, stream_tag, channel_id, format);
		  nid, stream_tag, channel_id, format);
	p = get_hda_cvt_setup(codec, nid);
	p = get_hda_cvt_setup(codec, nid);
	if (!p)
	if (!p)
@@ -1793,7 +1792,7 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid,
	if (codec->no_sticky_stream)
	if (codec->no_sticky_stream)
		do_now = 1;
		do_now = 1;


	snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid);
	codec_dbg(codec, "hda_codec_cleanup_stream: NID=0x%x\n", nid);
	p = get_hda_cvt_setup(codec, nid);
	p = get_hda_cvt_setup(codec, nid);
	if (p) {
	if (p) {
		/* here we just clear the active flag when do_now isn't set;
		/* here we just clear the active flag when do_now isn't set;
@@ -2315,9 +2314,9 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol,
	uinfo->value.integer.min = 0;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = get_amp_max_value(codec, nid, dir, ofs);
	uinfo->value.integer.max = get_amp_max_value(codec, nid, dir, ofs);
	if (!uinfo->value.integer.max) {
	if (!uinfo->value.integer.max) {
		printk(KERN_WARNING "hda_codec: "
		codec_warn(codec,
		       "num_steps = 0 for NID=0x%x (ctl = %s)\n", nid,
			   "num_steps = 0 for NID=0x%x (ctl = %s)\n",
		       kcontrol->id.name);
			   nid, kcontrol->id.name);
		return -EINVAL;
		return -EINVAL;
	}
	}
	return 0;
	return 0;
@@ -2591,7 +2590,7 @@ int snd_hda_add_nid(struct hda_codec *codec, struct snd_kcontrol *kctl,
		item->nid = nid;
		item->nid = nid;
		return 0;
		return 0;
	}
	}
	printk(KERN_ERR "hda-codec: no NID for mapping control %s:%d:%d\n",
	codec_err(codec, "no NID for mapping control %s:%d:%d\n",
		  kctl->id.name, kctl->id.index, index);
		  kctl->id.name, kctl->id.index, index);
	return -EINVAL;
	return -EINVAL;
}
}
@@ -2784,7 +2783,7 @@ static int get_kctl_0dB_offset(struct snd_kcontrol *kctl, int *step_to_check)
			return -1;
			return -1;
		if (*step_to_check && *step_to_check != step) {
		if (*step_to_check && *step_to_check != step) {
			snd_printk(KERN_ERR "hda_codec: Mismatching dB step for vmaster slave (%d!=%d)\n",
			snd_printk(KERN_ERR "hda_codec: Mismatching dB step for vmaster slave (%d!=%d)\n",
				   *step_to_check, step);
-				   *step_to_check, step);
			return -1;
			return -1;
		}
		}
		*step_to_check = step;
		*step_to_check = step;
@@ -2854,7 +2853,7 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,


	err = map_slaves(codec, slaves, suffix, check_slave_present, NULL);
	err = map_slaves(codec, slaves, suffix, check_slave_present, NULL);
	if (err != 1) {
	if (err != 1) {
		snd_printdd("No slave found for %s\n", name);
		codec_dbg(codec, "No slave found for %s\n", name);
		return 0;
		return 0;
	}
	}
	kctl = snd_ctl_make_virtual_master(name, tlv);
	kctl = snd_ctl_make_virtual_master(name, tlv);
@@ -3520,7 +3519,7 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,


	idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", idx);
	idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", idx);
	if (idx < 0) {
	if (idx < 0) {
		printk(KERN_ERR "hda_codec: too many IEC958 outputs\n");
		codec_err(codec, "too many IEC958 outputs\n");
		return -EBUSY;
		return -EBUSY;
	}
	}
	spdif = snd_array_new(&codec->spdif_out);
	spdif = snd_array_new(&codec->spdif_out);
@@ -3724,7 +3723,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)


	idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch", 0);
	idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch", 0);
	if (idx < 0) {
	if (idx < 0) {
		printk(KERN_ERR "hda_codec: too many IEC958 inputs\n");
		codec_err(codec, "too many IEC958 inputs\n");
		return -EBUSY;
		return -EBUSY;
	}
	}
	for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) {
	for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) {
@@ -4151,12 +4150,13 @@ int snd_hda_build_controls(struct hda_bus *bus)
	list_for_each_entry(codec, &bus->codec_list, list) {
	list_for_each_entry(codec, &bus->codec_list, list) {
		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 "
			codec_err(codec,
			       "for #%d (error %d)\n", codec->addr, err);
				  "cannot build controls 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
				codec_err(codec,
				       "hda_codec: cannot revert codec\n");
					  "cannot revert codec\n");
				return err;
				return err;
			}
			}
		}
		}
@@ -4403,8 +4403,8 @@ int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,
				rates |= rate_bits[i].alsa_bits;
				rates |= rate_bits[i].alsa_bits;
		}
		}
		if (rates == 0) {
		if (rates == 0) {
			snd_printk(KERN_ERR "hda_codec: rates == 0 "
			codec_err(codec,
				   "(nid=0x%x, val=0x%x, ovrd=%i)\n",
				  "rates == 0 (nid=0x%x, val=0x%x, ovrd=%i)\n",
				  nid, val,
				  nid, val,
				  (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0);
				  (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0);
			return -EIO;
			return -EIO;
@@ -4466,9 +4466,8 @@ int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,
			bps = 8;
			bps = 8;
		}
		}
		if (formats == 0) {
		if (formats == 0) {
			snd_printk(KERN_ERR "hda_codec: formats == 0 "
			codec_err(codec,
				   "(nid=0x%x, val=0x%x, ovrd=%i, "
				  "formats == 0 (nid=0x%x, val=0x%x, ovrd=%i, streams=0x%x)\n",
				   "streams=0x%x)\n",
				  nid, val,
				  nid, val,
				  (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0,
				  (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0,
				  streams);
				  streams);
@@ -4662,7 +4661,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type)
	int i;
	int i;


	if (type >= HDA_PCM_NTYPES) {
	if (type >= HDA_PCM_NTYPES) {
		snd_printk(KERN_WARNING "Invalid PCM type %d\n", type);
		dev_err(bus->card->dev, "Invalid PCM type %d\n", type);
		return -EINVAL;
		return -EINVAL;
	}
	}


@@ -4683,10 +4682,11 @@ static int get_empty_pcm_device(struct hda_bus *bus, unsigned int type)
	}
	}
#endif
#endif


	snd_printk(KERN_WARNING "Too many %s devices\n",
	dev_warn(bus->card->dev, "Too many %s devices\n",
		snd_hda_pcm_type_name[type]);
		snd_hda_pcm_type_name[type]);
#ifndef CONFIG_SND_DYNAMIC_MINORS
#ifndef CONFIG_SND_DYNAMIC_MINORS
	snd_printk(KERN_WARNING "Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y\n");
	dev_warn(bus->card->dev,
		 "Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y\n");
#endif
#endif
	return -EAGAIN;
	return -EAGAIN;
}
}
@@ -4724,12 +4724,13 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec)
			return 0;
			return 0;
		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"
			codec_err(codec,
			       "for #%d (error %d)\n", codec->addr, err);
				  "cannot build PCMs 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
				codec_err(codec,
				       "hda_codec: cannot revert codec\n");
					  "cannot revert codec\n");
				return err;
				return err;
			}
			}
		}
		}
@@ -4748,8 +4749,8 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec)
			cpcm->device = dev;
			cpcm->device = dev;
			err = snd_hda_attach_pcm(codec, cpcm);
			err = snd_hda_attach_pcm(codec, cpcm);
			if (err < 0) {
			if (err < 0) {
				printk(KERN_ERR "hda_codec: cannot attach "
				codec_err(codec,
				       "PCM stream %d for codec #%d\n",
					  "cannot attach PCM stream %d for codec #%d\n",
					  dev, codec->addr);
					  dev, codec->addr);
				continue; /* no fatal error */
				continue; /* no fatal error */
			}
			}
@@ -4819,8 +4820,8 @@ int snd_hda_check_board_config(struct hda_codec *codec,
		for (i = 0; i < num_configs; i++) {
		for (i = 0; i < num_configs; i++) {
			if (models[i] &&
			if (models[i] &&
			    !strcmp(codec->modelname, models[i])) {
			    !strcmp(codec->modelname, models[i])) {
				snd_printd(KERN_INFO "hda_codec: model '%s' is "
				codec_info(codec, "model '%s' is selected\n",
					   "selected\n", models[i]);
					   models[i]);
				return i;
				return i;
			}
			}
		}
		}
@@ -4842,8 +4843,7 @@ int snd_hda_check_board_config(struct hda_codec *codec,
			sprintf(tmp, "#%d", tbl->value);
			sprintf(tmp, "#%d", tbl->value);
			model = tmp;
			model = tmp;
		}
		}
		snd_printdd(KERN_INFO "hda_codec: model '%s' is selected "
		codec_info(codec, "model '%s' is selected for config %x:%x (%s)\n",
			    "for config %x:%x (%s)\n",
			   model, tbl->subvendor, tbl->subdevice,
			   model, tbl->subvendor, tbl->subdevice,
			   (tbl->name ? tbl->name : "Unknown device"));
			   (tbl->name ? tbl->name : "Unknown device"));
#endif
#endif
@@ -4903,8 +4903,7 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,
			sprintf(tmp, "#%d", tbl->value);
			sprintf(tmp, "#%d", tbl->value);
			model = tmp;
			model = tmp;
		}
		}
		snd_printdd(KERN_INFO "hda_codec: model '%s' is selected "
		codec_info(codec, "model '%s' is selected for config %x:%x (%s)\n",
			    "for config %x:%x (%s)\n",
			   model, tbl->subvendor, tbl->subdevice,
			   model, tbl->subvendor, tbl->subdevice,
			   (tbl->name ? tbl->name : "Unknown device"));
			   (tbl->name ? tbl->name : "Unknown device"));
#endif
#endif
+8 −9
Original line number Original line Diff line number Diff line
@@ -153,7 +153,7 @@ static unsigned int hdmi_get_eld_data(struct hda_codec *codec, hda_nid_t nid,
	val = snd_hda_codec_read(codec, nid, 0,
	val = snd_hda_codec_read(codec, nid, 0,
					AC_VERB_GET_HDMI_ELDD, byte_index);
					AC_VERB_GET_HDMI_ELDD, byte_index);
#ifdef BE_PARANOID
#ifdef BE_PARANOID
	printk(KERN_INFO "HDMI: ELD data byte %d: 0x%x\n", byte_index, val);
	codec_info(codec, "HDMI: ELD data byte %d: 0x%x\n", byte_index, val);
#endif
#endif
	return val;
	return val;
}
}
@@ -332,11 +332,11 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
	size = snd_hdmi_get_eld_size(codec, nid);
	size = snd_hdmi_get_eld_size(codec, nid);
	if (size == 0) {
	if (size == 0) {
		/* wfg: workaround for ASUS P5E-VM HDMI board */
		/* wfg: workaround for ASUS P5E-VM HDMI board */
		snd_printd(KERN_INFO "HDMI: ELD buf size is 0, force 128\n");
		codec_info(codec, "HDMI: ELD buf size is 0, force 128\n");
		size = 128;
		size = 128;
	}
	}
	if (size < ELD_FIXED_BYTES || size > ELD_MAX_SIZE) {
	if (size < ELD_FIXED_BYTES || size > ELD_MAX_SIZE) {
		snd_printd(KERN_INFO "HDMI: invalid ELD buf size %d\n", size);
		codec_info(codec, "HDMI: invalid ELD buf size %d\n", size);
		return -ERANGE;
		return -ERANGE;
	}
	}


@@ -348,8 +348,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
		 * Just abort. The caller will repoll after a while.
		 * Just abort. The caller will repoll after a while.
		 */
		 */
		if (!(val & AC_ELDD_ELD_VALID)) {
		if (!(val & AC_ELDD_ELD_VALID)) {
			snd_printd(KERN_INFO
			codec_info(codec, "HDMI: invalid ELD data byte %d\n", i);
				  "HDMI: invalid ELD data byte %d\n", i);
			ret = -EINVAL;
			ret = -EINVAL;
			goto error;
			goto error;
		}
		}
@@ -361,7 +360,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
		 * correctly writes ELD content before setting ELD_valid bit.
		 * correctly writes ELD content before setting ELD_valid bit.
		 */
		 */
		if (!val && !i) {
		if (!val && !i) {
			snd_printdd(KERN_INFO "HDMI: 0 ELD data\n");
			codec_dbg(codec, "HDMI: 0 ELD data\n");
			ret = -EINVAL;
			ret = -EINVAL;
			goto error;
			goto error;
		}
		}
@@ -681,7 +680,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
	spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);
	spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);


	if (spkalloc <= 0) {
	if (spkalloc <= 0) {
		snd_printd(KERN_INFO "HDMI ATI/AMD: no speaker allocation for ELD\n");
		codec_info(codec, "HDMI ATI/AMD: no speaker allocation for ELD\n");
		return -EINVAL;
		return -EINVAL;
	}
	}


@@ -722,7 +721,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
		sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
		sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);


		if (sink_desc_len > ELD_MAX_MNL) {
		if (sink_desc_len > ELD_MAX_MNL) {
			snd_printd(KERN_INFO "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n",
			codec_info(codec, "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n",
				   sink_desc_len);
				   sink_desc_len);
			sink_desc_len = ELD_MAX_MNL;
			sink_desc_len = ELD_MAX_MNL;
		}
		}
@@ -764,7 +763,7 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
	}
	}


	if (pos == ELD_FIXED_BYTES + sink_desc_len) {
	if (pos == ELD_FIXED_BYTES + sink_desc_len) {
		snd_printd(KERN_INFO "HDMI ATI/AMD: no audio descriptors for ELD\n");
		codec_info(codec, "HDMI ATI/AMD: no audio descriptors for ELD\n");
		return -EINVAL;
		return -EINVAL;
	}
	}


+21 −21
Original line number Original line Diff line number Diff line
@@ -346,7 +346,8 @@ static bool is_ctl_associated(struct hda_codec *codec, hda_nid_t nid,
	return is_ctl_used(codec, val, type);
	return is_ctl_used(codec, val, type);
}
}


static void print_nid_path(const char *pfx, struct nid_path *path)
static void print_nid_path(struct hda_codec *codec,
			   const char *pfx, struct nid_path *path)
{
{
	char buf[40];
	char buf[40];
	int i;
	int i;
@@ -358,7 +359,7 @@ static void print_nid_path(const char *pfx, struct nid_path *path)
		sprintf(tmp, ":%02x", path->path[i]);
		sprintf(tmp, ":%02x", path->path[i]);
		strlcat(buf, tmp, sizeof(buf));
		strlcat(buf, tmp, sizeof(buf));
	}
	}
	snd_printdd("%s path: depth=%d %s\n", pfx, path->depth, buf);
	codec_dbg(codec, "%s path: depth=%d %s\n", pfx, path->depth, buf);
}
}


/* called recursively */
/* called recursively */
@@ -1260,7 +1261,7 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
			dac = dacs[i] = 0;
			dac = dacs[i] = 0;
			badness += bad->no_dac;
			badness += bad->no_dac;
		} else {
		} else {
			/* print_nid_path("output", path); */
			/* print_nid_path(codec, "output", path); */
			path->active = true;
			path->active = true;
			path_idx[i] = snd_hda_get_path_idx(codec, path);
			path_idx[i] = snd_hda_get_path_idx(codec, path);
			badness += assign_out_path_ctls(codec, path);
			badness += assign_out_path_ctls(codec, path);
@@ -1387,7 +1388,7 @@ static int fill_multi_ios(struct hda_codec *codec,
				badness++;
				badness++;
				continue;
				continue;
			}
			}
			/* print_nid_path("multiio", path); */
			/* print_nid_path(codec, "multiio", path); */
			spec->multi_io[spec->multi_ios].pin = nid;
			spec->multi_io[spec->multi_ios].pin = nid;
			spec->multi_io[spec->multi_ios].dac = dac;
			spec->multi_io[spec->multi_ios].dac = dac;
			spec->out_paths[cfg->line_outs + spec->multi_ios] =
			spec->out_paths[cfg->line_outs + spec->multi_ios] =
@@ -1444,7 +1445,7 @@ static bool map_singles(struct hda_codec *codec, int outs,
		if (path) {
		if (path) {
			dacs[i] = dac;
			dacs[i] = dac;
			found = true;
			found = true;
			/* print_nid_path("output", path); */
			/* print_nid_path(codec, "output", path); */
			path->active = true;
			path->active = true;
			path_idx[i] = snd_hda_get_path_idx(codec, path);
			path_idx[i] = snd_hda_get_path_idx(codec, path);
		}
		}
@@ -1482,7 +1483,7 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx)
	}
	}
	if (!path)
	if (!path)
		return 0;
		return 0;
	/* print_nid_path("output-aamix", path); */
	/* print_nid_path(codec, "output-aamix", path); */
	path->active = false; /* unused as default */
	path->active = false; /* unused as default */
	return snd_hda_get_path_idx(codec, path);
	return snd_hda_get_path_idx(codec, path);
}
}
@@ -1699,7 +1700,7 @@ static int fill_and_eval_dacs(struct hda_codec *codec,
#define DEBUG_BADNESS
#define DEBUG_BADNESS


#ifdef DEBUG_BADNESS
#ifdef DEBUG_BADNESS
#define debug_badness	snd_printdd
#define debug_badness(fmt, args...)	codec_dbg(codec, fmt, ##args)
#else
#else
#define debug_badness(...)
#define debug_badness(...)
#endif
#endif
@@ -1712,7 +1713,7 @@ static inline void print_nid_path_idx(struct hda_codec *codec,


	path = snd_hda_get_path_from_idx(codec, idx);
	path = snd_hda_get_path_from_idx(codec, idx);
	if (path)
	if (path)
		print_nid_path(pfx, path);
		print_nid_path(codec, pfx, path);
}
}


static void debug_show_configs(struct hda_codec *codec,
static void debug_show_configs(struct hda_codec *codec,
@@ -1780,7 +1781,7 @@ static void fill_all_dac_nids(struct hda_codec *codec)
		if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_AUD_OUT)
		if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_AUD_OUT)
			continue;
			continue;
		if (spec->num_all_dacs >= ARRAY_SIZE(spec->all_dacs)) {
		if (spec->num_all_dacs >= ARRAY_SIZE(spec->all_dacs)) {
			snd_printk(KERN_ERR "hda: Too many DACs!\n");
			codec_err(codec, "Too many DACs!\n");
			break;
			break;
		}
		}
		spec->all_dacs[spec->num_all_dacs++] = nid;
		spec->all_dacs[spec->num_all_dacs++] = nid;
@@ -2429,7 +2430,7 @@ static int create_hp_mic(struct hda_codec *codec)
	spec->hp_mic_pin = nid;
	spec->hp_mic_pin = nid;
	/* we can't handle auto-mic together with HP-mic */
	/* we can't handle auto-mic together with HP-mic */
	spec->suppress_auto_mic = 1;
	spec->suppress_auto_mic = 1;
	snd_printdd("hda-codec: Enable shared I/O jack on NID 0x%x\n", nid);
	codec_dbg(codec, "Enable shared I/O jack on NID 0x%x\n", nid);
	return 0;
	return 0;
}
}


@@ -2883,7 +2884,7 @@ static int new_analog_input(struct hda_codec *codec, int input_idx,
	path = snd_hda_add_new_path(codec, pin, mix_nid, 0);
	path = snd_hda_add_new_path(codec, pin, mix_nid, 0);
	if (!path)
	if (!path)
		return -EINVAL;
		return -EINVAL;
	print_nid_path("loopback", path);
	print_nid_path(codec, "loopback", path);
	spec->loopback_paths[input_idx] = snd_hda_get_path_idx(codec, path);
	spec->loopback_paths[input_idx] = snd_hda_get_path_idx(codec, path);


	idx = path->idx[path->depth - 1];
	idx = path->idx[path->depth - 1];
@@ -2911,7 +2912,7 @@ static int new_analog_input(struct hda_codec *codec, int input_idx,
		path = snd_hda_add_new_path(codec, spec->mixer_nid,
		path = snd_hda_add_new_path(codec, spec->mixer_nid,
					    spec->mixer_merge_nid, 0);
					    spec->mixer_merge_nid, 0);
		if (path) {
		if (path) {
			print_nid_path("loopback-merge", path);
			print_nid_path(codec, "loopback-merge", path);
			path->active = true;
			path->active = true;
			spec->loopback_merge_path =
			spec->loopback_merge_path =
				snd_hda_get_path_idx(codec, path);
				snd_hda_get_path_idx(codec, path);
@@ -2990,7 +2991,7 @@ static int check_dyn_adc_switch(struct hda_codec *codec)
			}
			}
		}
		}


		snd_printdd("hda-codec: enabling ADC switching\n");
		codec_dbg(codec, "enabling ADC switching\n");
		spec->dyn_adc_switch = 1;
		spec->dyn_adc_switch = 1;
	} else if (nums != spec->num_adc_nids) {
	} else if (nums != spec->num_adc_nids) {
		/* shrink the invalid adcs and input paths */
		/* shrink the invalid adcs and input paths */
@@ -3014,7 +3015,7 @@ static int check_dyn_adc_switch(struct hda_codec *codec)


	if (imux->num_items == 1 ||
	if (imux->num_items == 1 ||
	    (imux->num_items == 2 && spec->hp_mic)) {
	    (imux->num_items == 2 && spec->hp_mic)) {
		snd_printdd("hda-codec: reducing to a single ADC\n");
		codec_dbg(codec, "reducing to a single ADC\n");
		spec->num_adc_nids = 1; /* reduce to a single ADC */
		spec->num_adc_nids = 1; /* reduce to a single ADC */
	}
	}


@@ -3045,7 +3046,7 @@ static int parse_capture_source(struct hda_codec *codec, hda_nid_t pin,
		path = snd_hda_add_new_path(codec, pin, adc, anchor);
		path = snd_hda_add_new_path(codec, pin, adc, anchor);
		if (!path)
		if (!path)
			continue;
			continue;
		print_nid_path("input", path);
		print_nid_path(codec, "input", path);
		spec->input_paths[imux_idx][c] =
		spec->input_paths[imux_idx][c] =
			snd_hda_get_path_idx(codec, path);
			snd_hda_get_path_idx(codec, path);


@@ -3711,7 +3712,7 @@ static void parse_digital(struct hda_codec *codec)
		path = snd_hda_add_new_path(codec, dig_nid, pin, 0);
		path = snd_hda_add_new_path(codec, dig_nid, pin, 0);
		if (!path)
		if (!path)
			continue;
			continue;
		print_nid_path("digout", path);
		print_nid_path(codec, "digout", path);
		path->active = true;
		path->active = true;
		spec->digout_paths[i] = snd_hda_get_path_idx(codec, path);
		spec->digout_paths[i] = snd_hda_get_path_idx(codec, path);
		set_pin_target(codec, pin, PIN_OUT, false);
		set_pin_target(codec, pin, PIN_OUT, false);
@@ -3738,7 +3739,7 @@ static void parse_digital(struct hda_codec *codec)
				continue;
				continue;
			path = snd_hda_add_new_path(codec, pin, dig_nid, 0);
			path = snd_hda_add_new_path(codec, pin, dig_nid, 0);
			if (path) {
			if (path) {
				print_nid_path("digin", path);
				print_nid_path(codec, "digin", path);
				path->active = true;
				path->active = true;
				spec->dig_in_nid = dig_nid;
				spec->dig_in_nid = dig_nid;
				spec->digin_path = snd_hda_get_path_idx(codec, path);
				spec->digin_path = snd_hda_get_path_idx(codec, path);
@@ -4169,8 +4170,7 @@ static int check_auto_mute_availability(struct hda_codec *codec)
		hda_nid_t nid = cfg->hp_pins[i];
		hda_nid_t nid = cfg->hp_pins[i];
		if (!is_jack_detectable(codec, nid))
		if (!is_jack_detectable(codec, nid))
			continue;
			continue;
		snd_printdd("hda-codec: Enable HP auto-muting on NID 0x%x\n",
		codec_dbg(codec, "Enable HP auto-muting on NID 0x%x\n", nid);
			    nid);
		snd_hda_jack_detect_enable_callback(codec, nid, HDA_GEN_HP_EVENT,
		snd_hda_jack_detect_enable_callback(codec, nid, HDA_GEN_HP_EVENT,
						    call_hp_automute);
						    call_hp_automute);
		spec->detect_hp = 1;
		spec->detect_hp = 1;
@@ -4182,7 +4182,7 @@ static int check_auto_mute_availability(struct hda_codec *codec)
				hda_nid_t nid = cfg->line_out_pins[i];
				hda_nid_t nid = cfg->line_out_pins[i];
				if (!is_jack_detectable(codec, nid))
				if (!is_jack_detectable(codec, nid))
					continue;
					continue;
				snd_printdd("hda-codec: Enable Line-Out auto-muting on NID 0x%x\n", nid);
				codec_dbg(codec, "Enable Line-Out auto-muting on NID 0x%x\n", nid);
				snd_hda_jack_detect_enable_callback(codec, nid,
				snd_hda_jack_detect_enable_callback(codec, nid,
								    HDA_GEN_FRONT_EVENT,
								    HDA_GEN_FRONT_EVENT,
								    call_line_automute);
								    call_line_automute);
@@ -4302,7 +4302,7 @@ static int check_auto_mic_availability(struct hda_codec *codec)
	spec->auto_mic = 1;
	spec->auto_mic = 1;
	spec->num_adc_nids = 1;
	spec->num_adc_nids = 1;
	spec->cur_mux[0] = spec->am_entry[0].idx;
	spec->cur_mux[0] = spec->am_entry[0].idx;
	snd_printdd("hda-codec: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
	codec_dbg(codec, "Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
		    spec->am_entry[0].pin,
		    spec->am_entry[0].pin,
		    spec->am_entry[1].pin,
		    spec->am_entry[1].pin,
		    spec->am_entry[2].pin);
		    spec->am_entry[2].pin);
Loading