alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Piotr G." <pejotr@wp.pl>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/1] sound/usb: Add Asus Xonar U7 Mixer - input	support
Date: Mon, 27 Jul 2015 14:10:40 +0200	[thread overview]
Message-ID: <s5hpp3dx0lb.wl-tiwai@suse.de> (raw)
In-Reply-To: <55B4938C.6080808@wp.pl>

On Sun, 26 Jul 2015 10:00:12 +0200,
Piotr G. wrote:
> 
> Hello,
> This is my first patch to alsa-devel, and I'm not very skilled
> programmer. From lsusb -vvv, I've draw Xonar U7 map with all IT OT FU CS
> in mixer_map.c I don't know why the driver by default doesn't parse all
> info correctly. With this patch you can see Line Switch and Mic Switch
> in alsamixer. I can record my voice in Audacity with all supported bit
> and sampling rates in Mono or Stereo
> This is temporary solution. Please correct me if the patch is not
> properly made.
> 
>    What doesn't work:
>    - Cannot change Capture Volume for Line/Mic. No mixer control in
> alsamixer
>    - Switching between Line/Mic doesn't work (Mute doesn't work)
>    - SPDIF not tested
>    As what I wrote at beginning I'm not skilled programmer so any help is
>    aprreciated
> 
> 
> proc-usbmixer -> cat /proc/asound/*/usbmix
> usb.debug -> lsusb -vv (only Asus Xonar U7)

The changes in mixer_maps.c look good, but what's the reason for
uac2_audio_feature_info[]?  It seems adding "Control" suffix to each
entry, which doesn't look correct.


thanks,

Takashi


> 
> ---
>    sound/usb/mixer.c      | 23 +++++++++++++++++++++--
>    sound/usb/mixer_maps.c | 48
> ++++++++++++++++++++++++++++++++++++++++++++++++
>    2 files changed, 69 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index 6b3acba..027d160 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -818,6 +818,25 @@ static struct usb_feature_control_info
> audio_feature_info[] = {
>    	{ "Phase Inverter Control",	USB_MIXER_BOOLEAN },
>    };
> 
> +static struct usb_feature_control_info uac2_audio_feature_info[] = {
> +	/* UAC2 specific */
> +	{ "Mute Control",		USB_MIXER_INV_BOOLEAN },
> +	{ "Volume Control",		USB_MIXER_S16 },
> +	{ "Bass Control",		USB_MIXER_S8 },
> +	{ "Mid Control",		USB_MIXER_S8 },
> +	{ "Treble Control",		USB_MIXER_S8 },
> +	{ "Graphic Equalizer Control",	USB_MIXER_S8 },
> +	{ "Automatic Gain Control",	USB_MIXER_BOOLEAN },
> +	{ "Delay Control",		USB_MIXER_S16 }, /* FIXME: U32 in UAC2 */
> +	{ "Bass Boost Control",		USB_MIXER_BOOLEAN },
> +	{ "Loudness Control",		USB_MIXER_BOOLEAN },
> +	{ "Input Gain Control",		USB_MIXER_S16 },
> +	{ "Input Gain Pad Control",	USB_MIXER_S16 },
> +	{ "Phase Inverter Control",	USB_MIXER_BOOLEAN },
> +	{ "Underflow Control",		USB_MIXER_BOOLEAN },
> +	{ "Overflow Control",		USB_MIXER_BOOLEAN },
> +};
> +
>    /* private_free callback */
>    void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl)
>    {
> @@ -1240,7 +1259,7 @@ static void build_feature_ctl(struct mixer_build
> *state, void *raw_desc,
>    	snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid);
>    	cval->control = control;
>    	cval->cmask = ctl_mask;
> -	cval->val_type = audio_feature_info[control-1].type;
> +	cval->val_type = uac2_audio_feature_info[control-1].type;
>    	if (ctl_mask == 0) {
>    		cval->channels = 1;	/* master channel */
>    		cval->master_readonly = readonly_mask;
> @@ -1318,7 +1337,7 @@ static void build_feature_ctl(struct mixer_build
> *state, void *raw_desc,
>    		break;
>    	default:
>    		if (!len)
> -			strlcpy(kctl->id.name, audio_feature_info[control-1].name,
> +			strlcpy(kctl->id.name, uac2_audio_feature_info[control-1].name,
>    				sizeof(kctl->id.name));
>    		break;
>    	}
> diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
> index e5000da..07f510e 100644
> --- a/sound/usb/mixer_maps.c
> +++ b/sound/usb/mixer_maps.c
> @@ -341,6 +341,48 @@ static const struct usbmix_name_map
> scms_usb3318_map[] = {
>    	{ 0 }
>    };
> 
> +/* ASUS Xonar U7 - USB CM6632A (ADC CS5361 // DAC Dolby CS4362A // DAC
> Stereo CS4398 */
> +/* Topology:
> +
> +USB_IN[1]------->FU[13]-----------CS[18]--->Spk_OUT[7]
> +
> +Dig_IN[2]------->FU[14]-----------CS[19]--->Dig_OUT[8]
> +
> +Mic_IN[4]------->FU[16]---+
> +                          SU[20]--CS[22]--->USB_OUT[11]
> +Line_IN[5]------>FU[17]---+
> +
> +*/
> +
> +static const struct usbmix_name_map xonar_u7_map[] = {
> +	/* 1: IT PCM  Analog (USB Streaming) */
> +	/* 2: IT PCM2 Digital (USB Streaming) */
> +	/* 4: IT Microphone */
> +	/* 5: IT Line IN */
> +	/* 7: OT Speaker */
> +	/* 8: OT SPDIF */
> +	/* 11 OT Capture Playback (USB Streaming) */
> +	{ 13, "Speaker Playback" },	/* 13 FU Speaker Out Mute/Volume */
> +	{ 14, "IEC958 Playback" },	/* 14 FU SPDIF Out Mute/Volume */
> +	{ 16, "Mic Capture" }, 		/* 16 FU Capture Mic-in Mute/Volume */
> +	{ 17, "Line Capture" }, 	/* 17 FU Capture Line-in Mute/Volume */
> +	/* 18 CS for 1 PCM (USB Streaming) Clock Source */
> +	/* 19 CS for 2 SPDIF (USB Streaming) Clock Source */
> +	{ 20, "Capture Source" }, 	/* 20 SU Capture Source Selector */
> +	/* 22 CS Line-in and Mic-in Clock Source */
> +	{ 0 }
> +};
> +
> +static struct usbmix_selector_map xonar_u7_selectors[] = {
> +{
> +                .id = 20,
> +                .count = 2,
> +                .names = (const char*[]) {"Mic", "Line"}
> +        },
> +        { 0 } /* terminator */
> +
> +};
> +
>    /*
>     * Control map entries
>     */
> @@ -451,6 +493,12 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
>    		.id = USB_ID(0x25c4, 0x0003),
>    		.map = scms_usb3318_map,
>    	},
> +	{
> +		/* Asus Xonar U7 */
> +		.id = USB_ID(0x1043, 0x857c),
> +		.map = xonar_u7_map,
> +		.selector_map = xonar_u7_selectors,
> +	},
>    	{ 0 } /* terminator */
>    };
> 
> -- 
> 2.3.6
> 

  reply	other threads:[~2015-07-27 12:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <55B4929D.5030401@wp.pl>
2015-07-26  8:00 ` [PATCH 1/1] sound/usb: Add Asus Xonar U7 Mixer - input support Piotr G.
2015-07-27 12:10   ` Takashi Iwai [this message]
2015-09-10 14:49     ` Piotr G.
     [not found]     ` <55F197E8.2020301@wp.pl>
2015-09-11 10:43       ` Johan Aires Rastén
2016-07-01  7:30       ` Piotr G.

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=s5hpp3dx0lb.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=pejotr@wp.pl \
    /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;
as well as URLs for NNTP newsgroup(s).