@@ -658,9 +658,9 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,
* interface is active. */
if (rate != prev_rate) {
usb_set_interface(dev, iface, 0);
- snd_usb_set_interface_quirk(dev);
+ snd_usb_set_interface_quirk(chip);
usb_set_interface(dev, iface, fmt->altsetting);
- snd_usb_set_interface_quirk(dev);
+ snd_usb_set_interface_quirk(chip);
}
validation:
@@ -553,6 +553,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
{
struct usb_device *dev = subs->dev;
struct usb_host_interface *alts;
+ struct snd_usb_audio *chip = subs->stream->chip;
int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK;
unsigned int ep;
int err;
@@ -569,7 +570,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
if (!alts)
return 0;
- subs->sync_endpoint = snd_usb_get_endpoint(subs->stream->chip, ep);
+ subs->sync_endpoint = snd_usb_get_endpoint(chip, ep);
if (!subs->sync_endpoint) {
if (is_playback &&
(fmt->ep_attr & USB_ENDPOINT_SYNCTYPE) == USB_ENDPOINT_SYNC_NONE)
@@ -596,7 +597,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
dev_dbg(&dev->dev, "setting usb interface %d:%d\n",
subs->sync_endpoint->iface,
subs->sync_endpoint->altsetting);
- snd_usb_set_interface_quirk(dev);
+ snd_usb_set_interface_quirk(chip);
}
return 0;
@@ -608,6 +609,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
{
struct usb_device *dev = subs->dev;
+ struct snd_usb_audio *chip = subs->stream->chip;
struct usb_host_interface *alts;
struct usb_interface *iface;
struct snd_usb_endpoint *ep;
@@ -625,7 +627,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
/* shared EP with implicit fb */
if (fmt->implicit_fb && !subs->need_setup_fmt) {
- ep = snd_usb_get_endpoint(subs->stream->chip, fmt->endpoint);
+ ep = snd_usb_get_endpoint(chip, fmt->endpoint);
if (ep && ep->use_count > 0)
goto add_data_ep;
}
@@ -648,7 +650,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
/* set interface */
if (iface->cur_altsetting != alts) {
- err = snd_usb_select_mode_quirk(subs, fmt);
+ err = snd_usb_select_mode_quirk(chip, fmt);
if (err < 0)
return -EIO;
@@ -661,7 +663,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
}
dev_dbg(&dev->dev, "setting usb interface %d:%d\n",
fmt->iface, fmt->altsetting);
- snd_usb_set_interface_quirk(dev);
+ snd_usb_set_interface_quirk(chip);
}
subs->need_setup_ep = true;
@@ -669,8 +671,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
add_data_ep:
subs->interface = fmt->iface;
subs->altset_idx = fmt->altset_idx;
- subs->data_endpoint = snd_usb_get_endpoint(subs->stream->chip,
- fmt->endpoint);
+ subs->data_endpoint = snd_usb_get_endpoint(chip, fmt->endpoint);
if (!subs->data_endpoint)
return -EINVAL;
subs->data_endpoint->iface = fmt->iface;
@@ -681,7 +682,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
return err;
if (subs->need_setup_ep) {
- err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt);
+ err = snd_usb_init_pitch(chip, fmt->iface, alts, fmt);
if (err < 0)
return err;
}
@@ -1553,13 +1553,13 @@ static bool is_itf_usb_dsd_dac(unsigned int id)
return false;
}
-int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
+int snd_usb_select_mode_quirk(struct snd_usb_audio *chip,
struct audioformat *fmt)
{
- struct usb_device *dev = subs->dev;
+ struct usb_device *dev = chip->dev;
int err;
- if (is_itf_usb_dsd_dac(subs->stream->chip->usb_id)) {
+ if (is_itf_usb_dsd_dac(chip->usb_id)) {
/* First switch to alt set 0, otherwise the mode switch cmd
* will not be accepted by the DAC
*/
@@ -1622,10 +1622,8 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
ep->tenor_fb_quirk = 1;
}
-void snd_usb_set_interface_quirk(struct usb_device *dev)
+void snd_usb_set_interface_quirk(struct snd_usb_audio *chip)
{
- struct snd_usb_audio *chip = dev_get_drvdata(&dev->dev);
-
if (!chip)
return;
/*
@@ -35,12 +35,12 @@ int snd_usb_is_big_endian_format(struct snd_usb_audio *chip,
void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep);
-void snd_usb_set_interface_quirk(struct usb_device *dev);
+void snd_usb_set_interface_quirk(struct snd_usb_audio *chip);
void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
__u8 request, __u8 requesttype, __u16 value,
__u16 index, void *data, __u16 size);
-int snd_usb_select_mode_quirk(struct snd_usb_substream *subs,
+int snd_usb_select_mode_quirk(struct snd_usb_audio *chip,
struct audioformat *fmt);
u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,