All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Zammit <damien.zammit@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/2] snd-usb-audio: Add mixer control for Digidesign Mbox 1 clock source
Date: Sun, 09 Nov 2014 00:30:48 +1100	[thread overview]
Message-ID: <545E1B08.2020102@gmail.com> (raw)
In-Reply-To: <s5hbnok2zbf.wl-tiwai@suse.de>

Hi Takashi,

On 07/11/14 01:12, Takashi Iwai wrote:
> At Tue,  4 Nov 2014 11:06:36 +1100,
> Damien Zammit wrote:
>> +		down_read(&mixer->chip->shutdown_rwsem);
I dont know what down_read and up_read does.

>> +		if (mixer->chip->shutdown) {
>> +			err = -ENODEV;
>> +		} else {
>> +			err = snd_usb_ctl_msg(mixer->chip->dev,
>> +				usb_rcvctrlpipe(mixer->chip->dev, 0), 0x81,
>> +				USB_DIR_IN |
>> +				USB_TYPE_CLASS |
>> +				USB_RECIP_INTERFACE, 0x00, 0x500, buff, 1);
>> +			if (err < 0)
>> +				return err;
>> +			err = snd_usb_ctl_msg(mixer->chip->dev,
>> +				usb_rcvctrlpipe(mixer->chip->dev, 0), 0x81,
>> +				USB_DIR_IN |
>> +				USB_TYPE_CLASS |
>> +				USB_RECIP_ENDPOINT, 0x100, 0x81, buff, 3);
>> +			if (err < 0)
>> +				return err;
> 
> What do these two messages and why needed?

These two messages are the first half of the SPDIF mode selection.
The device does not respond to standard mixer commands.
I snooped the bus in Windows and replayed the packets when selecting
SPDIF mode.  Basically it appears that this command sets the mode of the
device to receive the SPDIF clock source setting.

>> +			if (new_val == 0) {
>> +				buff[0] = 0x80;
>> +				buff[1] = 0xbb;
>> +				buff[2] = 0x00;
>> +			} else {
>> +				buff[0] = buff[1] = buff[2] = 0;
>> +			}
If the mixer control is cleared to internal clock mode, the device
expects the next command to have the sample rate fed in.  Otherwise if
the mixer control is set to spdif mode, the buffer is fed 3 zero bytes
instead.  It does not work as expected if the sample rate is allowed to
be changed by the user, therefore I locked the sample rate to 48kHz.

>> +			err = snd_usb_ctl_msg(mixer->chip->dev,
>> +				usb_sndctrlpipe(mixer->chip->dev, 0), 0x1,
>> +				USB_TYPE_CLASS |
>> +				USB_RECIP_ENDPOINT, 0x100, 0x81, buff, 3);
>> +			if (err < 0)
>> +				return err;
>> +			err = snd_usb_ctl_msg(mixer->chip->dev,
>> +				usb_rcvctrlpipe(mixer->chip->dev, 0), 0x81,
>> +				USB_DIR_IN |
>> +				USB_TYPE_CLASS |
>> +				USB_RECIP_ENDPOINT, 0x100, 0x81, buff, 3);
>> +			if (err < 0)
>> +				return err;
>> +			err = snd_usb_ctl_msg(mixer->chip->dev,
>> +				usb_rcvctrlpipe(mixer->chip->dev, 0), 0x81,
>> +				USB_DIR_IN |
>> +				USB_TYPE_CLASS |
>> +				USB_RECIP_ENDPOINT, 0x100, 0x2, buff, 3);
>> +			if (err < 0)
>> +				return err;
This is where the magic happens...

>> +		}
>> +		up_read(&mixer->chip->shutdown_rwsem);
No idea what up_read is for.

Thanks for the review, and I will post a new patch soon.
How do I tell git send-email to reply to this thread?

Thanks,

Damien

  reply	other threads:[~2014-11-08 13:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04  0:06 [PATCH 0/2] Digidesign Mbox 1 duplex mode and mixer Damien Zammit
2014-11-04  0:06 ` [PATCH 1/2] snd-usb-audio: Add mixer control for Digidesign Mbox 1 clock source Damien Zammit
2014-11-06 14:12   ` Takashi Iwai
2014-11-08 13:30     ` Damien Zammit [this message]
2014-11-09  9:02       ` Takashi Iwai
2014-11-04  0:06 ` [PATCH 2/2] snd-usb-audio: Add duplex mode for Digidesign Mbox 1 and enable mixer Damien Zammit
2014-11-06 14:15   ` Takashi Iwai
2014-11-08 13:35     ` Damien Zammit
2014-11-09  9:18       ` Takashi Iwai
2014-11-09 14:04         ` Clemens Ladisch
2014-11-09 17:27           ` Takashi Iwai
2014-11-09 23:45             ` Damien Zammit
2014-11-10  1:33               ` Damien Zammit
2014-11-10  6:47               ` Takashi Iwai
2014-11-10  7:34                 ` Damien Zammit

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=545E1B08.2020102@gmail.com \
    --to=damien.zammit@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.