All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: usb-audio: Add DJM450 to Pioneer format quirk
@ 2021-02-02  0:02 Olivia Mackintosh
  2021-02-02 11:41 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Olivia Mackintosh @ 2021-02-02  0:02 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai

Like the DJM-750, ensure that the format control message is passed to
the device when opening a stream. It seems as though fmt->sync_ep is not
always set when this function is called hence the passing of the value
at the call site. If this can be fixed, fmt->sync_up should be used as
the wvalue.
---
 sound/usb/quirks.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index e196e364cef1..08300954a50e 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1470,6 +1470,23 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs,
 	subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
 }
 
+static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs,
+					u16 windex)
+{
+	unsigned int cur_rate = subs->data_endpoint->cur_rate;
+	u8 sr[3];
+	// Convert to little endian
+	sr[0] = cur_rate&0xff;
+	sr[1] = (cur_rate>>8)&0xff;
+	sr[2] = (cur_rate>>16)&0xff;
+	usb_set_interface(subs->dev, 0, 1);
+	// we should derive windex from fmt-sync_ep but it's not set
+	snd_usb_ctl_msg(subs->stream->chip->dev,
+		usb_rcvctrlpipe(subs->stream->chip->dev, 0),
+		0x01, 0x22, 0x0100, windex, &sr, 0x0003);
+	return 0;
+}
+
 void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
 			      const struct audioformat *fmt)
 {
@@ -1483,6 +1500,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
 	case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */
 		subs->stream_offset_adj = 2;
 		break;
+	case USB_ID(0x2b73, 0x0013): /* Pioneer DJM-450 */
+		pioneer_djm_set_format_quirk(subs, 0x0082);
+		break;
 	}
 }
 
-- 
2.30.0


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

* Re: [PATCH 1/2] ALSA: usb-audio: Add DJM450 to Pioneer format quirk
  2021-02-02  0:02 [PATCH 1/2] ALSA: usb-audio: Add DJM450 to Pioneer format quirk Olivia Mackintosh
@ 2021-02-02 11:41 ` Takashi Iwai
  2021-02-02 12:54   ` Olivia Mackintosh
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2021-02-02 11:41 UTC (permalink / raw)
  To: Olivia Mackintosh; +Cc: alsa-devel

On Tue, 02 Feb 2021 01:02:37 +0100,
Olivia Mackintosh wrote:
> 
> Like the DJM-750, ensure that the format control message is passed to
> the device when opening a stream. It seems as though fmt->sync_ep is not
> always set when this function is called hence the passing of the value
> at the call site. If this can be fixed, fmt->sync_up should be used as
> the wvalue.

Could you give your Signed-off-by line?

> +static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs,
> +					u16 windex)
> +{
> +	unsigned int cur_rate = subs->data_endpoint->cur_rate;
> +	u8 sr[3];
> +	// Convert to little endian
> +	sr[0] = cur_rate&0xff;
> +	sr[1] = (cur_rate>>8)&0xff;
> +	sr[2] = (cur_rate>>16)&0xff;

Better to have some appropriate spaces around operators.

Also, instead of open-code, you can use cpu_to_le32() and pass its
pointer, too.


thanks,

Takashi

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

* Re: [PATCH 1/2] ALSA: usb-audio: Add DJM450 to Pioneer format quirk
  2021-02-02 11:41 ` Takashi Iwai
@ 2021-02-02 12:54   ` Olivia Mackintosh
  0 siblings, 0 replies; 3+ messages in thread
From: Olivia Mackintosh @ 2021-02-02 12:54 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Apologies. I am just getting used to the git-send-email mailer for
emailing threaded patch sets and made a few oversights. I will correct
these, add Signed-off-by line and resubmit as thread.

Olivia

On Tue, Feb 02, 2021 at 12:41:04PM +0100, Takashi Iwai wrote:
> On Tue, 02 Feb 2021 01:02:37 +0100,
> Olivia Mackintosh wrote:
> > 
> > Like the DJM-750, ensure that the format control message is passed to
> > the device when opening a stream. It seems as though fmt->sync_ep is not
> > always set when this function is called hence the passing of the value
> > at the call site. If this can be fixed, fmt->sync_up should be used as
> > the wvalue.
> 
> Could you give your Signed-off-by line?
> 
> > +static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs,
> > +					u16 windex)
> > +{
> > +	unsigned int cur_rate = subs->data_endpoint->cur_rate;
> > +	u8 sr[3];
> > +	// Convert to little endian
> > +	sr[0] = cur_rate&0xff;
> > +	sr[1] = (cur_rate>>8)&0xff;
> > +	sr[2] = (cur_rate>>16)&0xff;
> 
> Better to have some appropriate spaces around operators.
> 
> Also, instead of open-code, you can use cpu_to_le32() and pass its
> pointer, too.
> 
> 
> thanks,
> 
> Takashi

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

end of thread, other threads:[~2021-02-02 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  0:02 [PATCH 1/2] ALSA: usb-audio: Add DJM450 to Pioneer format quirk Olivia Mackintosh
2021-02-02 11:41 ` Takashi Iwai
2021-02-02 12:54   ` Olivia Mackintosh

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.