All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: About amp driver
@ 2009-06-15  7:54 Joonyoung Shim
  2009-06-15  9:07 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Joonyoung Shim @ 2009-06-15  7:54 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

Hi.

I have one question. Currently, the amp driver of ASoC is included in machine
driver. (ex. neo1973_wm8753 machine driver)
I want to use the same amp driver in more than one machine driver, but then the
same amp driver code exists double in each machine driver.

So, how about spliting between the amp driver and the machine driver? and Is it
possible?

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

* Re: ASoC: About amp driver
  2009-06-15  7:54 ASoC: About amp driver Joonyoung Shim
@ 2009-06-15  9:07 ` Mark Brown
  2009-06-15 11:15   ` Joonyoung Shim
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-06-15  9:07 UTC (permalink / raw)
  To: Joonyoung Shim; +Cc: alsa-devel

On Mon, Jun 15, 2009 at 04:54:49PM +0900, Joonyoung Shim wrote:

> I have one question. Currently, the amp driver of ASoC is included in machine
> driver. (ex. neo1973_wm8753 machine driver)
> I want to use the same amp driver in more than one machine driver, but then the
> same amp driver code exists double in each machine driver.

> So, how about spliting between the amp driver and the machine driver? and Is it
> possible?

Put the generic bits of the amp driver in sound/soc/codecs (there won't
be much).  At the minute you'll need to glue it in in via the machine
driver in the same way that OpenMoko does, there's not really any
support for multiple devices in the analouge part of the audio
subsystem.  This is on my radar to deal with, I have some systems where
it is relevant, but it's not there yet.

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

* Re: ASoC: About amp driver
  2009-06-15  9:07 ` Mark Brown
@ 2009-06-15 11:15   ` Joonyoung Shim
  2009-06-15 11:39     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Joonyoung Shim @ 2009-06-15 11:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

On 6/15/2009 6:07 PM, Mark Brown wrote:
> On Mon, Jun 15, 2009 at 04:54:49PM +0900, Joonyoung Shim wrote:
> 
>> I have one question. Currently, the amp driver of ASoC is included in machine
>> driver. (ex. neo1973_wm8753 machine driver)
>> I want to use the same amp driver in more than one machine driver, but then the
>> same amp driver code exists double in each machine driver.
> 
>> So, how about spliting between the amp driver and the machine driver? and Is it
>> possible?
> 
> Put the generic bits of the amp driver in sound/soc/codecs (there won't
> be much).  At the minute you'll need to glue it in in via the machine
> driver in the same way that OpenMoko does, there's not really any
> support for multiple devices in the analouge part of the audio
> subsystem.  This is on my radar to deal with, I have some systems where
> it is relevant, but it's not there yet.

This is heard me there is no way to split the amp driver from machine driver
at the minute.

The lm4857 amp driver is a complete i2c driver seperated in neo1973_wm8753.c.
It makes me confused that two complete drivers exist in a same file.
The controls of the lm4857 amp driver is depended only by neo1973 machine
driver because of registration through init() of snd_soc_dai_link.
I considered following some modification to solve this dependency.
For example, the amp_init field is added in snd_soc_dai_link struct and the
machine driver assigns the init function of amp driver in amp_init field of
dai_link, and snd_soc_init_card() calls amp_init() of dai_link as init() call
in soc-core.

Is this wrong solution?

Thank you for your reply.

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

* Re: ASoC: About amp driver
  2009-06-15 11:15   ` Joonyoung Shim
@ 2009-06-15 11:39     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-06-15 11:39 UTC (permalink / raw)
  To: Joonyoung Shim; +Cc: alsa-devel

On Mon, Jun 15, 2009 at 08:15:53PM +0900, Joonyoung Shim wrote:

> The lm4857 amp driver is a complete i2c driver seperated in neo1973_wm8753.c.
> It makes me confused that two complete drivers exist in a same file.
> The controls of the lm4857 amp driver is depended only by neo1973 machine
> driver because of registration through init() of snd_soc_dai_link.

Yes, there's no need for the lm4857 code to be in the machine driver and
it could be split out as I'm suggesting that you do for your system,
putting it in sound/soc/codecs.  This will help you share code and will
mean that once the core is enhanced to support this it's more
straightforward to convert the driver to use the standard stuff.

We could create a separate directory for amplifiers but I'm not sure
it's worth it since it'd just be a little more effort to classify
everything.

> I considered following some modification to solve this dependency.
> For example, the amp_init field is added in snd_soc_dai_link struct and the
> machine driver assigns the init function of amp driver in amp_init field of
> dai_link, and snd_soc_init_card() calls amp_init() of dai_link as init() call
> in soc-core.

> Is this wrong solution?

This isn't sufficiently abstracted to cover the general case.  We really
need to be able to cope with having multiple chips that handle analogue
as CODECs do, and to be able to cope with multiple chips of the same
model (which we can't do at the minute).  For the simple amplifier case
I'm not sure there's enough win putting something in the core that'll
need backing out later compared to just having direct calls from the
machine drivers.  It's not much more code for the machine drivers (a
couple of lines more for an error check as opposed to a line for the
assignment) but perhaps there's some extra hassle I'm missing.

For an example of the general case if you look at the wm9081 driver
you'll see that it's a mono DAC with integrated speaker amplifier.
Since it supports reading the input data from either the left or right
channel of stereo input data it is possible to make a stereo speaker
driver by using two of them.  Even with a fairly simple analogue
amplifier with just a volume register you could see a system having two
of them to provide stereo.

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

end of thread, other threads:[~2009-06-15 11:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15  7:54 ASoC: About amp driver Joonyoung Shim
2009-06-15  9:07 ` Mark Brown
2009-06-15 11:15   ` Joonyoung Shim
2009-06-15 11:39     ` Mark Brown

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.