public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: Chris J Arges <chris.j.arges@canonical.com>, alsa-devel@alsa-project.org
Cc: tiwai@suse.de, th55@gmx.de, robin@gareus.org, clemens@ladisch.de
Subject: Re: [PATCH 4/4 v4] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20
Date: Wed, 05 Nov 2014 10:55:38 +0100	[thread overview]
Message-ID: <5459F41A.5060207@canonical.com> (raw)
In-Reply-To: <545934A3.4010600@canonical.com>



On 2014-11-04 21:18, Chris J Arges wrote:
>
>
> On 11/04/2014 02:11 PM, David Henningsson wrote:
>>
>>
>> On 2014-11-03 23:58, Chris J Arges wrote:
>>> This code contains the Scarlett mixer interface code that was originally
>>> written by Tobias Hoffman and Robin Gareus. Because the device doesn't
>>> properly implement UAC2 this code adds a mixer quirk for the device.
>>
>> Thanks a lot for taking over - it surely has been done with better speed
>> than I would have.
>>
>>> + *   Code cleanup:
>>> + *   David Henningsson <david.henningsson at canonical.com>
>>
>> Thanks for the credit, not sure I deserve it though, all I did was to
>> squash the patches and fix the checkpatch errors :-)
>>
> : )
>
>>> +static int scarlett_ctl_save_put(struct snd_kcontrol *kctl,
>>> +                 struct snd_ctl_elem_value *ucontrol)
>>> +{
>>> +    struct usb_mixer_elem_info *elem = kctl->private_data;
>>> +    struct snd_usb_audio *chip = elem->mixer->chip;
>>> +    char buf[] = { 0x00, 0xa5 };
>>> +    int err;
>>> +
>>> +    if (ucontrol->value.enumerated.item[0] > 0) {
>>> +        err = snd_usb_ctl_msg(chip->dev,
>>> +            usb_sndctrlpipe(chip->dev, 0), UAC2_CS_MEM,
>>> +            USB_RECIP_INTERFACE | USB_TYPE_CLASS |
>>> +            USB_DIR_OUT, 0x005a, snd_usb_ctrl_intf(chip) |
>>> +            (0x3c << 8), buf, 2);
>>> +        if (err < 0)
>>> +            return err;
>>> +
>>> +        usb_audio_info(elem->mixer->chip,
>>> +             "scarlett: saved settings to hardware.\n");
>>> +    }
>>> +    return 0;
>>> +}
>>
>> To elaborate on Takashi's concern about this control, imagine e g what
>> alsactl restore/store being run on startup/shutdown. On shutdown,
>> alsactl store would read "0", and on startup, alsactl restore would
>> write "0", with the result that the hw would not store the values set.
>>
>> Would it be possible to have an autosave instead? E g, whenever a value
>> is changed, it saves that value to the hardware. That's how other
>> hardware works and what userspace expects.
>> If you want to avoid a lot of autosaves, e g if the autosave takes a lot
>> of time before the hw responds, maybe you could do the autosave in a 10
>> ms delayed_work, or similar.
>>
>
> David,
> Hey, as Tobias mentioned this is a HW saving (to the mixer's NVRAM)
> function used for using the mixer disconnected from a computer. We
> wouldn't want to continually write the NVRAM on every control update as
> I'm unsure of how many write-cycles the device is capable of.
>
> So without it you can still plug the mixer into the computer and alsa
> will restore any saved settings automatically. I'm planning on dropping
> the HW Save in v5 until we can figure out a proper control mechanism for
> this.

Aha, sorry for not grasping that. Maybe "save to HW" could be labelled 
"save for offline use" or so. (Cool feature, btw. I didn't know that was 
possible.)

I think a sysfs node would be simplest for this case. Just like we do 
"echo 1 > /sys/class/sound/hwC0D0/reconfig" to tell the HDA driver to 
reconfigure itself, there could be a "save_mixer_for_offline_use" node 
for this feature.


-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

  reply	other threads:[~2014-11-05  9:55 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21 19:46 [PATCH v2] Scarlett mixer interface inclusion Chris J Arges
2014-10-21 19:46 ` [PATCH v2] Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 Chris J Arges
2014-10-22  6:49   ` Takashi Iwai
2014-10-22 18:44     ` Chris J Arges
2014-10-29 20:55     ` [PATCH v3 0/4] Scarlett mixer interface inclusion Chris J Arges
2014-10-29 20:56       ` [PATCH v3 1/4] Revert "ALSA: usb-audio: Add quirk for Focusrite Scarlett Chris J Arges
2014-10-29 20:56       ` [PATCH v3 2/4] ALSA: usb-audio: Add usb_mixer_elem_enum_info Chris J Arges
2014-10-30  7:17         ` Takashi Iwai
2014-10-29 20:56       ` [PATCH v3 3/4] ALSA: usb-audio: make set_*_mix_values functions public Chris J Arges
2014-10-29 20:56       ` [PATCH v3 4/4] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 Chris J Arges
2014-10-30  7:43         ` Takashi Iwai
2014-11-03 17:11           ` Chris J Arges
2014-11-03 17:31             ` Clemens Ladisch
2014-10-30  7:11       ` [PATCH v3 0/4] Scarlett mixer interface inclusion Takashi Iwai
2014-11-03 22:58         ` [PATCH 0/4 v4] " Chris J Arges
2014-11-03 22:58           ` [PATCH 1/4 v4] Revert "ALSA: usb-audio: Add quirk for Focusrite Scarlett Chris J Arges
2014-11-03 22:58           ` [PATCH 2/4 v4] ALSA: usb-audio: Add private_data pointer to usb_mixer_elem_info Chris J Arges
2014-11-03 22:58           ` [PATCH 3/4 v4] ALSA: usb-audio: make set_*_mix_values functions public Chris J Arges
2014-11-03 22:58           ` [PATCH 4/4 v4] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 Chris J Arges
2014-11-04 10:18             ` Takashi Iwai
2014-11-04 13:16               ` Tobias Hoffmann
2014-11-04 13:29                 ` Tobias Hoffmann
2014-11-04 19:45                   ` Chris J Arges
2014-11-04 14:00                 ` Takashi Iwai
2014-11-04 19:56                   ` Chris J Arges
2014-11-04 19:51                 ` Chris J Arges
2014-11-05 16:32               ` [PATCH v5] " Chris J Arges
2014-11-06 14:33               ` [PATCH 0/4 v5] Scarlett mixer interface inclusion Chris J Arges
2014-11-06 14:33                 ` [PATCH 1/4 v5] Revert "ALSA: usb-audio: Add quirk for Focusrite Scarlett Chris J Arges
2014-11-06 14:33                 ` [PATCH 2/4 v5] ALSA: usb-audio: Add private_data pointer to usb_mixer_elem_info Chris J Arges
2014-11-06 14:33                 ` [PATCH 3/4 v5] ALSA: usb-audio: make set_*_mix_values functions public Chris J Arges
2014-11-06 14:33                 ` [PATCH 4/4 v5] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 Chris J Arges
2014-11-07 10:15                   ` Takashi Iwai
2014-11-10 18:59                     ` [PATCH 0/4 v6] Scarlett mixer interface inclusion Chris J Arges
2014-11-10 18:59                       ` [PATCH 1/4 v6] Revert "ALSA: usb-audio: Add quirk for Focusrite Scarlett Chris J Arges
2014-11-10 18:59                       ` [PATCH 2/4 v6] ALSA: usb-audio: Add private_data pointer to usb_mixer_elem_info Chris J Arges
2014-11-10 18:59                       ` [PATCH 3/4 v6] ALSA: usb-audio: make set_*_mix_values functions public Chris J Arges
2014-11-10 18:59                       ` [PATCH 4/4 v6] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 Chris J Arges
2014-11-10 19:24                         ` Takashi Iwai
2014-11-10 22:00                           ` Chris J Arges
2014-11-11  7:33                             ` Takashi Iwai
2014-11-12 18:06                           ` [PATCH 0/4 v7] Scarlett mixer interface inclusion Chris J Arges
2014-11-12 18:06                             ` [PATCH 1/4 v7] Revert "ALSA: usb-audio: Add quirk for Focusrite Scarlett Chris J Arges
2014-11-12 18:07                             ` [PATCH 2/4 v7] ALSA: usb-audio: Add private_data pointer to usb_mixer_elem_info Chris J Arges
2014-11-12 18:07                             ` [PATCH 3/4 v7] ALSA: usb-audio: make set_*_mix_values functions public Chris J Arges
2014-11-12 18:07                             ` [PATCH 4/4 v7] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 Chris J Arges
2014-11-13  6:36                             ` [PATCH 0/4 v7] Scarlett mixer interface inclusion Takashi Iwai
2014-11-13  6:38                               ` David Henningsson
2014-11-13 13:01                               ` Chris J Arges
2014-11-04 20:11             ` [PATCH 4/4 v4] ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20 David Henningsson
2014-11-04 20:18               ` Chris J Arges
2014-11-05  9:55                 ` David Henningsson [this message]
2014-11-02 19:00       ` [PATCH v3 0/4] Scarlett mixer interface inclusion Dominik Haumann
2014-11-03 15:49         ` Chris J Arges
2014-11-03 22:31           ` Chris J Arges
2014-10-22  6:36 ` [PATCH v2] " Takashi Iwai
2014-11-05 11:33   ` Takashi Iwai
2014-11-05 12:39     ` Takashi Iwai
2014-11-05 14:20       ` Takashi Iwai
2014-11-05 14:30       ` Chris J Arges

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=5459F41A.5060207@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=chris.j.arges@canonical.com \
    --cc=clemens@ladisch.de \
    --cc=robin@gareus.org \
    --cc=th55@gmx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox