All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eldad Zack <eldad@fogrefinery.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	Clemens Ladisch <clemens@ladisch.de>,
	Daniel Mack <zonque@gmail.com>
Cc: alsa-devel@alsa-project.org, Eldad Zack <eldad@fogrefinery.com>
Subject: [PATCH 08/10] ALSA: usb-audio: UAC2: auto clock selection module param
Date: Sun, 31 Mar 2013 17:52:30 +0200	[thread overview]
Message-ID: <1364745152-1762-9-git-send-email-eldad@fogrefinery.com> (raw)
In-Reply-To: <1364745152-1762-1-git-send-email-eldad@fogrefinery.com>

Add a module param to disable auto clock selection.
This is provided for users that expect the audio stream to
fail when the clock source is invalid (e.g., the word clock
was unintentionally disconnected).

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
---
 sound/usb/card.c     | 4 ++++
 sound/usb/clock.c    | 2 +-
 sound/usb/usbaudio.h | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 314e8a2..dfbf317 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -82,6 +82,7 @@ static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
 static int nrpacks = 8;		/* max. number of packets per urb */
 static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
 static bool ignore_ctl_error;
+static bool noautoclk;
 
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
@@ -100,6 +101,8 @@ MODULE_PARM_DESC(device_setup, "Specific device setup (if needed).");
 module_param(ignore_ctl_error, bool, 0444);
 MODULE_PARM_DESC(ignore_ctl_error,
 		 "Ignore errors from USB controller for mixer interfaces.");
+module_param(noautoclk, bool, 0444);
+MODULE_PARM_DESC(noautoclk, "Disables auto-clock selection for UAC2 devices.");
 
 /*
  * we keep the snd_usb_audio_t instances by ourselves for merging
@@ -354,6 +357,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
 	chip->card = card;
 	chip->setup = device_setup[idx];
 	chip->nrpacks = nrpacks;
+	chip->noautoclk = noautoclk;
 	chip->probing = 1;
 
 	chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 6b79e25..e3075ca 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -216,7 +216,7 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
 		cur = ret;
 		ret = __uac_clock_find_source(chip, selector->baCSourceID[ret - 1],
 					       visited, validate);
-		if (!validate || ret > 0)
+		if (!validate || ret > 0 || chip->noautoclk)
 			return ret;
 
 		/* The current clock source is invalid, try others. */
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 1ac3fd9..4852eb0 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -56,6 +56,7 @@ struct snd_usb_audio {
 
 	int setup;			/* from the 'device_setup' module param */
 	int nrpacks;			/* from the 'nrpacks' module param */
+	bool noautoclk;			/* from the 'noautoclk' module param */
 
 	struct usb_host_interface *ctrl_intf;	/* the audio control interface */
 };
-- 
1.8.1.5

  parent reply	other threads:[~2013-03-31 15:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-31 15:52 [PATCH 00/10] UAC2: Automatic clock switching Eldad Zack
2013-03-31 15:52 ` [PATCH 01/10] ALSA: usb-audio: convert list_for_each to entry variant Eldad Zack
2013-03-31 15:52 ` [PATCH 02/10] ALSA: usb-audio: neaten MODULE_DEVICE_TABLE placement Eldad Zack
2013-03-31 15:52 ` [PATCH 03/10] ALSA: usb-audio: neaten EXPORT_SYMBOLS placement Eldad Zack
2013-03-31 15:52 ` [PATCH 04/10] ALSA: usb-audio: spelling correction Eldad Zack
2013-03-31 15:52 ` [PATCH 05/10] ALSA: usb-audio: use endianness macros Eldad Zack
2013-03-31 16:06   ` Clemens Ladisch
2013-03-31 17:15     ` Eldad Zack
2013-03-31 17:30       ` Clemens Ladisch
2013-04-05 18:36         ` Eldad Zack
2013-03-31 15:52 ` [PATCH 06/10] ALSA: usb-audio: UAC2: do clock validity check earlier Eldad Zack
2013-04-01  8:16   ` Torstein Hegge
2013-04-01 22:36     ` Eldad Zack
2013-04-02  8:38   ` Takashi Iwai
2013-03-31 15:52 ` [PATCH 07/10] ALSA: usb-audio: UAC2: try to find and switch to valid clock Eldad Zack
2013-04-02  8:46   ` Takashi Iwai
2013-04-02 20:20     ` Eldad Zack
2013-03-31 15:52 ` Eldad Zack [this message]
2013-04-02  8:51   ` [PATCH 08/10] ALSA: usb-audio: UAC2: auto clock selection module param Takashi Iwai
2013-04-02 20:27     ` Eldad Zack
2013-03-31 15:52 ` [PATCH 09/10] ALSA: usb-audio: show err in set_sample_rate_v2 debug Eldad Zack
2013-03-31 15:52 ` [PATCH 10/10] ALSA: usb-audio: UAC2: support read-only freq control Eldad Zack
2013-04-01  8:17   ` Torstein Hegge
2013-04-01 22:45     ` Eldad Zack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364745152-1762-9-git-send-email-eldad@fogrefinery.com \
    --to=eldad@fogrefinery.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.