LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate
@ 2015-03-31  7:34 Eric Wong
  2015-03-31  7:36 ` [RFC] ALSA: usb-audio: reduce "cannot get freq at ep" spew Eric Wong
  2015-04-04 12:08 ` [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Wong @ 2015-03-31  7:34 UTC (permalink / raw)
  To: Takashi Iwai, Joe Turner; +Cc: alsa-devel, linux-kernel, Eric Wong

Adding this quirk allows us to avoid the noisy
"cannot get freq at ep 0x1" message in dmesg output every time
playback starts.

This ought to affect other Benchmark DAC1 variations using the same
"Microchip Technology, Inc." chip as well, but I have only tested
with the "Pre" variant.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Cc: Joe Turner <joe@oampo.co.uk>
Cc: Takashi Iwai <tiwai@suse.de>
---
  I also had another generic patch prepared before I noticed Joe's
  quirk addition for the MS Lifecam HD-5000.

 sound/usb/quirks.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 753a47d..9a28365 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1113,8 +1113,13 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
 
 bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
 {
-	/* MS Lifecam HD-5000 doesn't support reading the sample rate. */
-	return chip->usb_id == USB_ID(0x045E, 0x076D);
+	/* devices which do not support reading the sample rate. */
+	switch (chip->usb_id) {
+	case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */
+	case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
+		return true;
+	}
+	return false;
 }
 
 /* Marantz/Denon USB DACs need a vendor cmd to switch
-- 
EW


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] ALSA: usb-audio: reduce "cannot get freq at ep" spew
  2015-03-31  7:34 [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate Eric Wong
@ 2015-03-31  7:36 ` Eric Wong
  2015-04-04 12:13   ` Takashi Iwai
  2015-04-04 12:08 ` [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Wong @ 2015-03-31  7:36 UTC (permalink / raw)
  To: Takashi Iwai, Joe Turner; +Cc: alsa-devel, linux-kernel

Eric Wong <normalperson@yhbt.net> wrote:
>   I also had another generic patch prepared before I noticed Joe's
>   quirk addition for the MS Lifecam HD-5000.

This is the generic patch I prepared before I noticed Joe's quirk
addition (applies cleanly to 3.19 and 4.0-rc6):

------------------------------8<---------------------------
Subject: [PATCH] ALSA: usb-audio: reduce "cannot get freq at ep" spew

If a device fails to support reading the sample rate, it will likely
fail again and there is no point in logging the message every time the
sample rate is set.

This reduces dmesg noise when using the Benchmark DAC1 PRE as a USB
sound card.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 sound/usb/clock.c    | 7 +++++--
 sound/usb/usbaudio.h | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 03fed66..512fe12 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -307,8 +307,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
 				   USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN,
 				   UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
 				   data, sizeof(data))) < 0) {
-		dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
-			iface, fmt->altsetting, ep);
+		if (!chip->no_get_freq) {
+			dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
+				iface, fmt->altsetting, ep);
+			chip->no_get_freq = 1;
+		}
 		return 0; /* some devices don't support reading */
 	}
 
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 91d0380..be65671 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -43,7 +43,8 @@ struct snd_usb_audio {
 	unsigned int in_pm:1;
 	unsigned int autosuspended:1;	
 	unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
-	
+	unsigned int no_get_freq:1;
+
 	int num_interfaces;
 	int num_suspended_intf;
 
-- 
EW


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate
  2015-03-31  7:34 [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate Eric Wong
  2015-03-31  7:36 ` [RFC] ALSA: usb-audio: reduce "cannot get freq at ep" spew Eric Wong
@ 2015-04-04 12:08 ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-04-04 12:08 UTC (permalink / raw)
  To: Eric Wong; +Cc: Joe Turner, alsa-devel, linux-kernel

At Tue, 31 Mar 2015 07:34:05 +0000,
Eric Wong wrote:
> 
> Adding this quirk allows us to avoid the noisy
> "cannot get freq at ep 0x1" message in dmesg output every time
> playback starts.
> 
> This ought to affect other Benchmark DAC1 variations using the same
> "Microchip Technology, Inc." chip as well, but I have only tested
> with the "Pre" variant.
> 
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
> Cc: Joe Turner <joe@oampo.co.uk>
> Cc: Takashi Iwai <tiwai@suse.de>

Applied, thanks.


Takashi

> ---
>   I also had another generic patch prepared before I noticed Joe's
>   quirk addition for the MS Lifecam HD-5000.
> 
>  sound/usb/quirks.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> index 753a47d..9a28365 100644
> --- a/sound/usb/quirks.c
> +++ b/sound/usb/quirks.c
> @@ -1113,8 +1113,13 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
>  
>  bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
>  {
> -	/* MS Lifecam HD-5000 doesn't support reading the sample rate. */
> -	return chip->usb_id == USB_ID(0x045E, 0x076D);
> +	/* devices which do not support reading the sample rate. */
> +	switch (chip->usb_id) {
> +	case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */
> +	case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
> +		return true;
> +	}
> +	return false;
>  }
>  
>  /* Marantz/Denon USB DACs need a vendor cmd to switch
> -- 
> EW
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] ALSA: usb-audio: reduce "cannot get freq at ep" spew
  2015-03-31  7:36 ` [RFC] ALSA: usb-audio: reduce "cannot get freq at ep" spew Eric Wong
@ 2015-04-04 12:13   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2015-04-04 12:13 UTC (permalink / raw)
  To: Eric Wong; +Cc: Joe Turner, alsa-devel, linux-kernel

At Tue, 31 Mar 2015 07:36:28 +0000,
Eric Wong wrote:
> 
> Eric Wong <normalperson@yhbt.net> wrote:
> >   I also had another generic patch prepared before I noticed Joe's
> >   quirk addition for the MS Lifecam HD-5000.
> 
> This is the generic patch I prepared before I noticed Joe's quirk
> addition (applies cleanly to 3.19 and 4.0-rc6):
> 
> ------------------------------8<---------------------------
> Subject: [PATCH] ALSA: usb-audio: reduce "cannot get freq at ep" spew
> 
> If a device fails to support reading the sample rate, it will likely
> fail again and there is no point in logging the message every time the
> sample rate is set.
> 
> This reduces dmesg noise when using the Benchmark DAC1 PRE as a USB
> sound card.

Hm, this shuts up all the rest for the device, so it also hides if the
message comes from multiple EPs.


Takashi

> 
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
> ---
>  sound/usb/clock.c    | 7 +++++--
>  sound/usb/usbaudio.h | 3 ++-
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/usb/clock.c b/sound/usb/clock.c
> index 03fed66..512fe12 100644
> --- a/sound/usb/clock.c
> +++ b/sound/usb/clock.c
> @@ -307,8 +307,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
>  				   USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN,
>  				   UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
>  				   data, sizeof(data))) < 0) {
> -		dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
> -			iface, fmt->altsetting, ep);
> +		if (!chip->no_get_freq) {
> +			dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
> +				iface, fmt->altsetting, ep);
> +			chip->no_get_freq = 1;
> +		}
>  		return 0; /* some devices don't support reading */
>  	}
>  
> diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
> index 91d0380..be65671 100644
> --- a/sound/usb/usbaudio.h
> +++ b/sound/usb/usbaudio.h
> @@ -43,7 +43,8 @@ struct snd_usb_audio {
>  	unsigned int in_pm:1;
>  	unsigned int autosuspended:1;	
>  	unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
> -	
> +	unsigned int no_get_freq:1;
> +
>  	int num_interfaces;
>  	int num_suspended_intf;
>  
> -- 
> EW
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-04 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31  7:34 [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate Eric Wong
2015-03-31  7:36 ` [RFC] ALSA: usb-audio: reduce "cannot get freq at ep" spew Eric Wong
2015-04-04 12:13   ` Takashi Iwai
2015-04-04 12:08 ` [PATCH] ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).