Re: [PATCH v1 1/3] sound: usb: Add vendor's hooking interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 24, 2022 at 09:33:40AM +0100, Greg Kroah-Hartman wrote:
> On Thu, Mar 24, 2022 at 05:10:42PM +0900, Oh Eomji wrote:
> > In mobile, a co-processor can be used with USB audio to improve power
> > consumption.  To support this type of hardware, hooks need to be added
> > to the USB audio subsystem to be able to call into the hardware when
> > needed.
> > 
> > The main operation of the call-backs are:
> >   - Initialize the co-processor by transmitting data when initializing.
> >   - Change the co-processor setting value through the interface
> >     function.
> >   - Configure sampling rate
> >   - pcm open/close
> >   - other housekeeping
> > 
> > Known issues:
> >   - This only supports one set of callback hooks, meaning that this only
> >     works if there is one type of USB controller in the system.  This
> >     should be changed to be a per-host-controller interface instead of
> >     one global set of callbacks.
> > 
> > Signed-off-by: JaeHun Jung <jh0801.jung@xxxxxxxxxxx>
> > Signed-off-by: Oh Eomji <eomji.oh@xxxxxxxxxxx>
> > ---
> >  sound/usb/card.c     | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  sound/usb/card.h     |  20 +++++++++
> >  sound/usb/usbaudio.h |  45 +++++++++++++++++++
> >  3 files changed, 184 insertions(+)
> > 
> > diff --git a/sound/usb/card.c b/sound/usb/card.c
> > index 3769622..bd59311 100644
> > --- a/sound/usb/card.c
> > +++ b/sound/usb/card.c
> > @@ -117,6 +117,117 @@ MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no)
> >  static DEFINE_MUTEX(register_mutex);
> >  static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
> >  static struct usb_driver usb_audio_driver;
> > +static struct snd_usb_audio_vendor_ops *usb_vendor_ops;
> > +
> > +int snd_vendor_set_ops(struct snd_usb_audio_vendor_ops *ops)
> > +{
> > +	if ((!ops->connect) ||
> > +	    (!ops->disconnect) ||
> > +	    (!ops->set_interface) ||
> > +	    (!ops->set_rate) ||
> > +	    (!ops->set_pcm_buf) ||
> > +	    (!ops->set_pcm_intf) ||
> > +	    (!ops->set_pcm_connection) ||
> > +	    (!ops->set_pcm_binterval) ||
> > +	    (!ops->usb_add_ctls))
> > +		return -EINVAL;
> > +
> > +	usb_vendor_ops = ops;
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(snd_vendor_set_ops);
> > +
> > +struct snd_usb_audio_vendor_ops *snd_vendor_get_ops(void)
> > +{
> > +	return usb_vendor_ops;
> > +}
> 
> This is the function you need to fix up, and add proper reference
> counting to, in order to solve your "this breaks with multiple USB
> controllers" problem.  So this really should not be all that difficult
> of a task.  Why has it taken years to do so?
> 
> thanks,
> 
> greg k-h
>
Hi,

Is that mean the scenario when two or more usb audio devices are
connected through the hub?

Thanks,
Eomji Oh





[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux