1
0
Fork 0
Commit Graph

680 Commits (4fd69c9099a7a6284a1f001c78b8ed3c8cec6fbf)

Author SHA1 Message Date
Kuninori Morimoto fcff45f8e0 ASoC: remove .delay from snd_soc_platform_driver
No existing platform is using .delay.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-09 19:31:21 +00:00
Sylwester Nawrocki d2e3a1358c ASoC: Fix binding and probing of auxiliary components
Currently binding of auxiliary devices doesn't work as in
soc_bind_aux_dev() function a bound component is not being added
to any list and in soc_probe_aux_devices() we are trying to walk
the component_dev_list list to probe auxiliary components but
at that time this list doesn't contain any auxiliary components
since they are being added to the card only in soc_probe_component().

This patch adds a list to the card where are stored bound but not
probed auxiliary devices, so that all aux devices can be probed.

Fixes: 1a653aa447 "ASoC: core: replace aux_comp_list to component_dev_list"
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-31 18:28:36 +00:00
Kuninori Morimoto 99b04f4c40 ASoC: add Component level pcm_new/pcm_free
In current ALSA SoC, Platform only has pcm_new/pcm_free feature,
but it should be supported on Component level. This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-15 16:54:23 +00:00
Mark Brown dc42c6cb30 Merge remote-tracking branches 'asoc/topic/tlv320aic31xx', 'asoc/topic/topology', 'asoc/topic/uda1380', 'asoc/topic/wm2200' and 'asoc/topic/wm8523' into asoc-next 2016-12-12 15:53:25 +00:00
Mark Brown 2f028b15a2 Merge remote-tracking branches 'asoc/topic/of-graph', 'asoc/topic/pxa', 'asoc/topic/qcom' and 'asoc/topic/rk808' into asoc-next 2016-12-12 15:53:07 +00:00
Mark Brown ffe9c4f330 Merge remote-tracking branches 'asoc/topic/ab8500', 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/bcm' and 'asoc/topic/bitfield' into asoc-next 2016-12-12 15:52:48 +00:00
Mark Brown e6c6fd896b Merge remote-tracking branch 'asoc/topic/dapm-pin' into asoc-next 2016-12-12 15:52:45 +00:00
Kuninori Morimoto 9178feb453 ASoC: add Component level suspend/resume
In current ALSA SoC, Codec only has suspend/resume feature,
but it should be supported on Component level. This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:58 +00:00
Kuninori Morimoto 1a653aa447 ASoC: core: replace aux_comp_list to component_dev_list
Now, Card has component_dev_list, we can replace aux_comp_list
to component_dev_list with new auxiliary flags

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:50 +00:00
Kuninori Morimoto d9fc40639d ASoC: core: replace codec_dev_list to component_dev_list on Card
Current Card has Codec list (= codec_dev_list), but Codec will be
removed in the future. Because of this reason, this patch adds
new Component list in Card, and replace Codec list.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-12-01 20:09:34 +00:00
Richard Fitzgerald 1b4d9c2219 ASoC: core: Add component pin control functions
It's often the case that a codec driver will need to control its
own pins. However, if a name_prefix has been applied to this codec it
must be included in the name passed to any of the snd_soc_dapm_x_pin()
functions.

The behaviour of the existing pin control functions is reasonable, since
you may want to search for a fully-specified name within the scope of an
entire card. This means that we can't apply the prefix in these functions
because it will break card-scope searches.

Constructing a prefixed string "manually" in codec drivers leads to a lot
of repetition of the same code.

To make this tidier in codec drivers this patch adds a new set of
equivalent functions that take a struct snd_soc_component instead of a
dapm context and automatically add the component's name_prefix to the
given name. This makes it a simple change in codec drivers to be
prefix-safe.

The new functions are not quite trivial enough to be inlines and the
compiler won't be able to compile-away any part of them.

Although it looks somewhat inefficient to have to allocate a temporary
buffer and combine strings, the current design of the widget list
doesn't lend itself to a more optimized implementation - it's a single
list of all widgets on a card and is searched linearly for a matching
string. As pin state changes are generally low-frequency events it's
unlikely to be a significant issue - at least not enough to rewrite the
widget list handling just for this.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-30 17:16:09 +00:00
Kuninori Morimoto 1ef5bcd57b ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_simple_widgets
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:22:02 +00:00
Kuninori Morimoto 8f5ebb1bee ASoC: soc-core: adjust for graph on snd_soc_of_parse_card_name
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:22:01 +00:00
Kuninori Morimoto b6defcca0a ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:19:35 +00:00
Kuninori Morimoto 1ad8ec535b ASoC: soc-core: snd_soc_get_dai_name() become non static
snd_soc_get_dai_name() is used from snd_soc_of_get_dai_name(),
and it is assuming that DT is using "sound-dai" / "#sound-dai-cells".
But graph base DT is using "remote-endpoint". This patch makes
snd_soc_get_dai_name() non static for graph support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:19:34 +00:00
Kuninori Morimoto 7364c8dc25 ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-11 15:19:34 +00:00
Mengdong Lin 17fb175520 ASoC: Define API to find a dai link
Define the API to find an existing DAI link of the soc card by matching
the ID, name and stream name.

Some cards may use unique ID for each DAI link, so matching ID is enough,
and name or stream name are not necessary. But user need to specify name
or stream name as well if not sure whether link ID is unique since most
cards use 0 as the default link ID.

Topology can use this API to find an existing BE link and configure it.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-04 11:16:51 -06:00
Kuninori Morimoto 57619b4c93 ASoC: remove component from snd_soc_pcm_runtime
commit f2ed6b0764 ("ASoC: Make aux_dev more like a generic component")
removed its usecase. No one is using it now.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24 16:11:57 +01:00
Kuninori Morimoto a7df0d3b45 ASoC: bunch up bit field for snd_soc_pcm_runtime
We can reduce struct size in certain environment.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24 16:11:42 +01:00
Kuninori Morimoto 1236fa1e3c ASoC: soc.h: use bit field for playback/capture_only
Current snd_soc_dai_link is already using many bit fields.
Let's use it for playback_only/capture_only too.
We can reduce struct size in certain environment.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24 16:11:42 +01:00
Mark Brown 971dec826c Merge remote-tracking branches 'asoc/topic/nau8810', 'asoc/topic/of-bool', 'asoc/topic/omap' and 'asoc/topic/platform-drvdata' into asoc-next 2016-09-29 12:44:31 -07:00
Kuninori Morimoto 1e81403095 ASoC: remove snd_soc_pcm_set/get_drvdata()
snd_soc_pcm_set_drvdata() will set driver data to rtd->dev,
but driver data of rtd->dev is already used as "rtd" on
soc_post_component_init().

	static int soc_post_component_init(xxx)
	{
		...
		dev_set_drvdata(rtd->dev, rtd);
		...
	}

To remove confusion, this patch removes snd_soc_pcm_set/get_drvdata().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-09 10:38:21 +01:00
Kuninori Morimoto 8073aefa60 ASoC: remove codec duplicated callback function
codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch removes codec side duplicated callback function.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:57:57 +01:00
Srinivas Kandagatla dcc0799bf7 ASoC: Introduce SOC_SINGLE_S8_TLV() macro
This patch introduces SOC_SINGLE_S8_TLV() macro for volume control
on chips which supports both negative and positive gains with sign
bit on a 8 bit register, Gain ranges from -128 to +127 with a
predefined step size.
Currently we only have support to DOUBLE_S8_TLV() which does not fit
for cases where we just have separate gain control register for each
channel.

One of the Qualcomm SOC msm8916 has such gain control register whose gain
range is from -38.4dB to +38.4dB with step size of 0.3dB.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30 16:19:46 +01:00
Mark Brown 180bc41ad1 Merge remote-tracking branches 'asoc/topic/es8328', 'asoc/topic/find-dai', 'asoc/topic/fsl', 'asoc/topic/fsl-sai' and 'asoc/topic/fsl-ssi' into asoc-next 2016-05-13 14:27:01 +01:00
Mengdong Lin 305e9020f0 ASoC: Export snd_soc_find_dai()
This API can be used by topology to find an existing BE dai by name
and further configure it.

Topology will also check DAI ID to avoid wrong match.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-20 17:19:24 +01:00
Mengdong Lin 2f0ad49104 ASoC: Change DAI link's be_id to a generic id
The generic ID can be used by topology:
- Toplogy can create FE links and set their ID, machine drivers will
  be notified and check this ID for machine-specific init.
- Toplogy can use the ID to find existing BE & CC links and further
  configure them.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-20 17:14:43 +01:00
Mengdong Lin 64527e8a35 ASoC: topology: Add FE DAIs dynamically
Topology will create FE DAIs dynamically from the PCM objects,
and register them to the component.

A PCM topoplogy object describes a FE DAI and DAI link. Later
patch will add FE DAI links as well.

Change tplg load ops for DAI:
- Only process a DAI.
- Pass the DAI driver pointer to the component driver for
  extra initialization.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-15 19:35:59 +00:00
Mark Brown a1916ff350 Merge remote-tracking branch 'asoc/topic/pcm-list' into asoc-next 2016-01-11 13:54:31 +00:00
Mark Brown fffe9b89d8 ASoC: Updates for v4.5
This is quite a busy release on the driver front with a lot of new
 drivers being added but comparatively quiet on the core side with only
 one big change going in and that a fairly straightforward refactoring.
 
  - Conversion of the array of DAI links to a list by Mengdong Lin,
    supporting dynamically adding and removing DAI links.
  - Some more fixes for the topology code, though it is still not final
    and ready for enabling in production.  We really need to get to the
    point where that can be done.
  - A pile of changes for Intel SkyLake drivers which hopefully deliver
    some useful initial functionality for systems with this chipset,
    though there is more work still to come.
  - New drivers for a number of Imagination Technologies IPs.
  - Lots of new features and cleanups for the Renesas drivers.
  - ANC support for WM5110.
  - New driver for Atmel class D speaker drivers.
  - New drivers for Cirrus CS47L24 and WM1831.
  - New driver for Dialog DA7128.
  - New drivers for Realtek RT5659 and RT56156.
  - New driver for Rockchip RK3036.
  - New driver for TI PC3168A
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWee4AAAoJECTWi3JdVIfQwPkH/jMpijne8cfnOm0jQ0WyvXPd
 HSig93ZAJ2x/+uR7yrmF2BsxhnT6G1lmDb2zxYhHGEAMyBtdA/xtOjO1wTRjXgIo
 9p7ui66uP/sAW+NfHsvXVyf/8vV9nw8t0CsyBf+ijynz6MiDigQR7e8RA7xZR7oQ
 oBabHPZb85OJjxmn2XlqaxUoxNhBdAS3gNoctMy9VZDwSLiunOvYTGBoBA43LQk6
 6DN5VRu7wg05ruN6t5xZ5bd5WAtvgN+tSsRAabmunWDnILCa8OaOmzWPv3QITIva
 PQLauiya4N0/YgyNGYaBY/6pc5u9SHzq0caYUq0I6WY6Phjo7wfU8/+y4NqUPn4=
 =d18k
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.5' into asoc-next

ASoC: Updates for v4.5

This is quite a busy release on the driver front with a lot of new
drivers being added but comparatively quiet on the core side with only
one big change going in and that a fairly straightforward refactoring.

 - Conversion of the array of DAI links to a list by Mengdong Lin,
   supporting dynamically adding and removing DAI links.
 - Some more fixes for the topology code, though it is still not final
   and ready for enabling in production.  We really need to get to the
   point where that can be done.
 - A pile of changes for Intel SkyLake drivers which hopefully deliver
   some useful initial functionality for systems with this chipset,
   though there is more work still to come.
 - New drivers for a number of Imagination Technologies IPs.
 - Lots of new features and cleanups for the Renesas drivers.
 - ANC support for WM5110.
 - New driver for Atmel class D speaker drivers.
 - New drivers for Cirrus CS47L24 and WM1831.
 - New driver for Dialog DA7128.
 - New drivers for Realtek RT5659 and RT56156.
 - New driver for Rockchip RK3036.
 - New driver for TI PC3168A

# gpg: Signature made Wed 23 Dec 2015 00:42:40 GMT using RSA key ID 5D5487D0
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>"
# gpg:                 aka "Mark Brown <broonie@debian.org>"
# gpg:                 aka "Mark Brown <broonie@kernel.org>"
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>"
# gpg:                 aka "Mark Brown <broonie@linaro.org>"
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 3F25 68AA C269 98F9 E813  A1C5 C3F4 36CA 30F5 D8EB
#      Subkey fingerprint: ADE6 68AA 6757 18B5 9FE2  9FEA 24D6 8B72 5D54 87D0
2016-01-11 13:54:29 +00:00
Mark Brown 7b2f32cc81 Merge remote-tracking branch 'asoc/topic/intel' into asoc-next 2016-01-11 13:54:28 +00:00
Mengdong Lin f2ed6b0764 ASoC: Make aux_dev more like a generic component
aux_dev is mainly used by the machine driver to specify analog devices,
which are registered as codecs. Making it more like a generic component
can help the machine driver to use it to specify any component with
topology info by name.

Details:
- Remove the stub 'rtd_aux' array from the soc card.
- Add a list 'aux_comp_list' to store the components of aux_devs.
  And add a list head 'list_aux' to struct snd_soc_component, for adding
  such components to the above list.
- Add a 'init' ops to a component for machine specific init.
  soc_bind_aux_dev() will set it to be aux_dev's init. And it will be
  called when probing the component.
- soc_bind_aux_dev() will also search components by name of an aux_dev,
  since it may not be a codec.
- Move probing of aux_devs before checking new DAI links brought by
  topology.
- Move removal of aux_devs later than removal of links. Because topology
  of aux components may register DAIs and the DAI drivers will go with
  removal of the aux components, we want soc_remove_link_dais() to remove
  the DAIs at first.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10 12:46:55 +00:00
Mengdong Lin 68003e6cf2 ASoC: Support registering a DAI dynamically
Define API snd_soc_register_dai() to add a DAI dynamically and
create the DAI widgets. Topology can use this API to register DAIs
when probing a component with topology info. These DAIs's playback
& capture widgets will be freed when the sound card is unregistered
and the DAIs will be freed when cleaning up the component.

And a dobj is embedded into the struct snd_soc_dai_driver. Topology
can use the dobj to find the DAI drivers created by it and free them
when the topology component is removed.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10 12:06:19 +00:00
Charles Keepax 783513eec3 ASoC: Use nested lock for snd_soc_dapm_mutex_lock
snd_soc_dapm_mutex_lock currently uses the un-nested call which can
cause lockdep warnings when called from control handlers (a relatively
common usage) and using modules. As creating the control causes a
potential mutex inversion with the handler, creating the control will
take the controls_rwsem under the dapm_mutex and accessing the control
will take the dapm_mutex under controls_rwsem.

All the users look like they want to be using the runtime class of the
lock anyway, so this patch just changes snd_soc_dapm_mutex_lock to use
the nested call, with the SND_SOC_DAPM_CLASS_RUNTIME class.

Fixes: f6d5e586b4 ("ASoC: dapm: Add helpers to lock/unlock DAPM mutex")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-30 16:48:13 +00:00
Mark Brown 9451a46928 Merge remote-tracking branches 'asoc/topic/kcontrol', 'asoc/topic/max98357a' and 'asoc/topic/mtk' into asoc-next 2015-12-23 00:23:44 +00:00
Mark Brown 89c172e2aa Merge remote-tracking branch 'asoc/topic/pcm3168a' into asoc-next 2015-12-23 00:23:33 +00:00
Mark Brown a93202fa7b Merge remote-tracking branch 'asoc/topic/pcm-list' into asoc-next 2015-12-23 00:23:32 +00:00
Damien.Horsley d13871b353 ASoC: Add SOC_DOUBLE_STS macro
Add SOC_DOUBLE_STS macro for read-only volatile status controls

Signed-off-by: Damien.Horsley <Damien.Horsley@imgtec.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 22:38:20 +00:00
Mengdong Lin d6f220ea13 ASoC: Define add/remove_dai_link ops for a soc card
A machine driver can register the two ops.

When a DAI link is added or removed by a component's topology, the
ASoC core can call the ops to notify the machine driver for extra
intialization or destruction.

E.g. topology can create FE DAI links from a cpu DAI component, and
the machine driver may define an add_dai_link ops to set machine-specific
.init ops for the DAI link.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 18:05:09 +00:00
Mengdong Lin f8f80361d0 ASoC: Implement DAI links in a list & define API to add/remove a link
Implement a dai link list for the soc card.

Add APIs to add/remove a DAI links dynamically, e.g. by topology.

And a dobj is embedded into the struct snd_soc_dai_link. Topology can
use the dobj to find the links created by it and remove them when the
topology component is unloaded.

The predefined DAI links are reserved to keep backward compatibility.
And they will also be added to the list.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 18:05:09 +00:00
Vinod Koul 50a4f98d34 ASoC: core: mark SND_SOC_BYTES_EXT as deprecated
Since we have SND_SOC_BYTES_TLV control to lets devices have
larger size data sent, we do not need SND_SOC_BYTES_EXT with 512
byte limitation so mark it deprecated

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-25 12:56:19 +00:00
Mengdong Lin 1a497983a5 ASoC: Change the PCM runtime array to a list
Currently the number of DAI links is statically defined by the machine
driver at build time using an array. This makes it difficult to shrink/
grow the number of DAI links at runtime in order to reflect any changes
in topology.

We can change the DAI link array in the core to a list so that PCMs and
FE DAI links can be added and deleted at runtime to reflect changes in
use case and DSP topology. The machine driver can still register DAI links
as an array.

As the 1st step, this patch change the PCM runtime array to a list. A new
PCM runtime is added to the list when a DAI link is bound successfully.

Later patches will further implement the DAI link list.

More:
- define snd_soc_new/free_pcm_runtime() to create/free a runtime.
- define soc_add_pcm_runtime() to add a runtime to the rtd list.
- define soc_remove_pcm_runtimes() to clean up the runtime list.

- traverse the rtd list to probe the link components and dais.

- Add a field "num" to PCM runtime struct, used to specify the device
  number when creating the pcm device, and for a soc card to access
  its dai_props array.

- The following 3rd party machine/platform drivers iterate the rtd list
  to check the runtimes:
  sound/soc/intel/atom/sst-mfld-platform-pcm.c
  sound/soc/intel/boards/cht_bsw_rt5645.c
  sound/soc/intel/boards/cht_bsw_rt5672.c
  sound/soc/intel/boards/cht_bsw_max98090_ti.c

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18 18:32:24 +00:00
Mythri P K a1e5e7e9b3 ASoC: core: Pass kcontrol to bytes tlv callbacks
Add kcontrol to the tlv callbacks in soc_bytes_ext, as it is
needed for referencing the corresponding control in the driver
code

Also fix the only upstream user in topology core

Signed-off-by: Mythri P K <mythri.p.k@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18 12:57:50 +00:00
Mark Brown 1c9d000c5b Merge remote-tracking branch 'asoc/topic/da7219' into asoc-next 2015-10-26 11:16:02 +09:00
Mark Brown 6439e5c2a7 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2015-10-26 11:15:55 +09:00
Mark Brown 7c9c29eefa ASoC: Updates for v4.4
A first batch of updates targetted at v4.4.  There are no substantial
 core fixes here, the biggest block of changes is updates to the rcar
 drivers and the addition of a CODEC driver for the AK4613.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWBF7yAAoJECTWi3JdVIfQ1MEH/jnzSyEVIuG+l8UkMaz6gf4w
 zGsM1KCn//mfPl7yAoOdsnElOLR+Fmf+0jx4pCPQKrjvBGwjwH/IwBR1rwuEeUPY
 7d66efpWOKlTf3qpsF1S7ZIlAZOs0NFvo0jwA1ZY/pc3YEBekyWxbABk/uWAVrM5
 HJJKafI7WeiYrF0l0z2sG7BpsFtr8JKqrOVM+SGaPTNn2k+/lQ1bwTk1liOEUbsv
 oq8NFNrUWPBCwbUNJQxBOvmoXC6Oa6+JBVO3+SsoS0q2FweNpqtZopjmoqHM8CiN
 SkBeFT+wYlSGSnnFgAXXA2+kq74TeP2CvToo6tw+gf4LZXydKIaAdeuT6M9weZA=
 =8h3u
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.3-rc2' into asoc-next

ASoC: Updates for v4.4

A first batch of updates targetted at v4.4.  There are no substantial
core fixes here, the biggest block of changes is updates to the rcar
drivers and the addition of a CODEC driver for the AK4613.

# gpg: Signature made Fri 25 Sep 2015 05:37:06 KST using RSA key ID 5D5487D0
# gpg: key CD7BEEBC: no public key for trusted key - skipped
# gpg: key CD7BEEBC marked as ultimately trusted
# gpg: key AF88CD16: no public key for trusted key - skipped
# gpg: key AF88CD16 marked as ultimately trusted
# gpg: key 16005C11: no public key for trusted key - skipped
# gpg: key 16005C11 marked as ultimately trusted
# gpg: key 5621E907: no public key for trusted key - skipped
# gpg: key 5621E907 marked as ultimately trusted
# gpg: key 5C6153AD: no public key for trusted key - skipped
# gpg: key 5C6153AD marked as ultimately trusted
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>"
# gpg:                 aka "Mark Brown <broonie@debian.org>"
# gpg:                 aka "Mark Brown <broonie@kernel.org>"
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>"
# gpg:                 aka "Mark Brown <broonie@linaro.org>"
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>"
2015-10-26 11:15:54 +09:00
Jie Yang 6f0c42269f ASoC: compress: add config item for soc-compress to make it compiled only when needed
We don't always need soc-compress in soc, here add a config item
SND_SOC_COMPRESS, when nobody select it, the soc-compress will
not be compiled.

Here also change Kconfig to 'select SND_SOC_COMPRESS' for drivers
that needed soc-compress.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-22 13:52:16 +01:00
Lars-Peter Clausen 26d9ca3462 ASoC: Let snd_soc_limit_volume() take a snd_soc_card
snd_soc_limit_volume() operates on a card and the CODEC that is passed in
is only used to look up the card. Let it directly take the card instead.
This makes it possible to use it when no snd_soc_codec is available.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Tested-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-22 13:49:20 +01:00
Charles Keepax 34198710f5 ASoC: Add info callback for SX_TLV controls
SX_TLV controls are intended for situations where the register behind
the control has some non-zero value indicating the minimum gain
and then gains increasing from there and eventually overflowing through
zero.

Currently every CODEC implementing these controls specifies the minimum
as the non-zero value for the minimum and the maximum as the number of
gain settings available.

This means when the info callback subtracts the minimum value from the
maximum value to calculate the number of gain levels available it is
actually under reporting the available levels. This patch fixes this
issue by adding a new snd_soc_info_volsw_sx callback that does not
subtract the minimum value.

Fixes: 1d99f2436d ("ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Tested-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-10-16 16:17:25 +01:00
Adam Thomson c25c79b468 ASoC: Add SOC_DOUBLE_R_EXT
_EXT version of SOC_DOUBLE_R required to allow for custom handlers.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-30 19:22:48 +01:00
Mark Brown 727e53a12f Merge remote-tracking branches 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic/sunxi' and 'asoc/topic/tlv320aic3x' into asoc-next 2015-09-23 11:01:27 -07:00
Charles Keepax a54e22f404 ASoC: Add SOC_SINGLE_RANGE_EXT_TLV macro
Add a version of the SOC_SINGLE_RANGE_TLV macro that allows a custom get
and put to be specified.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16 21:00:04 +01:00
Jyri Sarha 6131084a0b ASoC: simple-card: Add tdm slot mask support to simple-card
Adds DT binding for explicitly choosing a tdm mask for DAI and uses it
in simple-card. The API for snd_soc_of_parse_tdm_slot() has also been
changed.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16 18:00:30 +01:00
Mark Brown acb47ad502 Merge remote-tracking branches 'asoc/topic/mediatek', 'asoc/topic/mtk', 'asoc/topic/nuc900', 'asoc/topic/of-name' and 'asoc/topic/omap' into asoc-next 2015-08-30 15:55:21 +01:00
Mark Brown 7c0031360b Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/davinci-vcif', 'asoc/topic/doc' and 'asoc/topic/dpcm' into asoc-next 2015-08-30 15:53:39 +01:00
Mark Brown 21af109438 Merge remote-tracking branches 'asoc/topic/88pm860x', 'asoc/topic/ac97', 'asoc/topic/ak4542', 'asoc/topic/arizona' and 'asoc/topic/atmel' into asoc-next 2015-08-30 15:52:21 +01:00
Mark Brown cb42e0f709 Merge remote-tracking branch 'asoc/topic/rt5645' into asoc-next 2015-08-30 15:52:12 +01:00
Jonathan Corbet 628536ea06 ASoC: Clean up docbook warnings
A number of functions and structures in the sound subsystem had incomplete
and/or obsolete DocBook comments, leading to warnings when the docs were
built.  Correct those comments so that we can enjoy our audio in the
absence of warning noise.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-28 19:07:16 +01:00
Lars-Peter Clausen 7361fbeaea ASoC: ac97: Add support for resetting device before registration
AC97 devices need to be initially reset before they can be used. Currently
each driver does this on its own.

Add support for resetting the device to core in snd_soc_new_ac97_codec().
If the caller supplies a device ID and device ID mask the function will
reset the device and verify that it has the correct ID, if it does not a
error is returned.

This will allow to remove custom code with similar functionality from
individual drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-23 17:33:28 +01:00
Kuninori Morimoto 5e3cdaa208 ASoC: core: add snd_soc_of_parse_audio_prefix()
Current ASoC can add name_prefix for DAPM, and it is necessary for
route settings. This patch adds snd_soc_of_parse_audio_prefix() for
this purpose. It will be used with snd_soc_of_parse_audio_routing().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:59:41 +01:00
Lars-Peter Clausen abd31b32dd ASoC: Use card field to indicate whether a component is bound
Use the card field of a component to indicate whether it is bound or not.
This makes a certain sense given that the field contains the card the
component is bound to and a component can only be bound to one card at a
time. And it also requires to unset the card field when the component is
unbound from the card.

This makes the probded flag redundant and it can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-08 20:05:04 +01:00
Lars-Peter Clausen 4890140f38 ASoC: Remove snd_soc_codec dapm field
There are no more direct users of the snd_soc_codec DAPM field left. So we
can finally remove it and switch over to directly using the component DAPM
context and remove the dapm_ptr indirection.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 14:54:32 +01:00
Mark Brown 28bedc5946 Merge remote-tracking branches 'asoc/topic/topology', 'asoc/topic/twl6040', 'asoc/topic/wm5100', 'asoc/topic/wm8741' and 'asoc/topic/wm8960' into asoc-next 2015-06-05 18:55:05 +01:00
Mark Brown 698803f8b9 Merge remote-tracking branches 'asoc/topic/davinci' and 'asoc/topic/dpcm' into asoc-next 2015-06-05 18:54:52 +01:00
Mark Brown 4b57895522 Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2015-06-05 18:54:45 +01:00
Liam Girdwood 8a9782346d ASoC: topology: Add topology core
The topology core parses the FW topology file for known block types and
instanciates any common ALSA/ASoC objects that it discovers. The core
also passes any block that is does not understand to client component
drivers for enumeration.

The core exports some APIs to client drivers in order to load and unload
firmware topology data as use case require.

Currently the core deals with the following object types :-

 o kcontrols. This includes TLV, enumerated and bytes controls.
 o DAPM widgets. All types with any associated kcontrol.
 o DAPM graph.
 o FE PCM. FE PCM capabilities and configuration can be defined.
 o BE DAI Link. BE DAI link capabilities and configuration can be defined.
 o Codec <-> codec style links capabilities and configuration.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04 09:40:03 +01:00
Kuninori Morimoto b073ed4e21 ASoC: soc-pcm: DPCM cares BE format
Current DPCM is caring only FE format. but it will be no sound
if FE/BE was below style, and user selects S24_LE format.

        FE: S16_LE/S24_LE
        BE: S16_LE

DPCM can rewrite the format, so basically we don't want to
constrain with the BE constraints. But sometimes it will be trouble.
This patch adds new .dpcm_merged_format on struct snd_soc_dai_link.
DPCM will use FE / BE merged format if .struct snd_soc_dai_link
has it. We can have other .dpcm_merged_xxx in the future

    .dpcm_merged_foramt
    .dpcm_merged_rate
    .dpcm_merged_chan

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-22 13:38:40 +01:00
Charles Keepax 561ed680b7 ASoC: dapm: Add support for autodisable mux controls
Commit 57295073b6 ("ASoC: dapm: Implement mixer input auto-disable")
added support for autodisable controls, controls whose values are only
written to the hardware when their respective widgets are powered up.
But it only added support for controls based on the mixer abstraction.

This patch add support for mux controls (DAPM controls based on the
enum abstraction) to be auto-disabled as well. As each mux can only have
a single control, there is no need to tie the autodisable widget to the
inputs (as is done for the mixer controls) it can be tided directly to
the mux widget itself.

Note that it is assumed that the first entry in a autodisable mux
control will always represent the off state for the mux and is what the
mux will be set to whilst it is disabled.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-06 17:13:01 +01:00
Charles Keepax 5967cb3d87 ASoC: Correct typo in SOC_VALUE_ENUM_SINGLE macro
xnitmes is clearly intended to be xnitems, but all other macros just
refer to this as xitems, so change it to that.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-06 17:12:53 +01:00
Mark Brown a78001b013 Merge remote-tracking branches 'asoc/fix/email', 'asoc/fix/fsl-ssi', 'asoc/fix/pm', 'asoc/fix/qcom' and 'asoc/fix/rcar' into asoc-linus 2015-04-29 13:37:28 +01:00
Lars-Peter Clausen fa880775ab ASoC: Add helper functions bias level management
Currently drivers are responsible for managing the bias_level field of
their DAPM context. The DAPM state itself is managed by the DAPM core
though and the core has certain expectations on how and when the bias_level
field should be updated. If drivers don't adhere to these undefined
behavior can occur.

This patch adds a few helper functions for manipulating the DAPM context
state, each function with a description on when it should be used and what
its effects are. This will also help us to move more of the bias_level
management from drivers to the DAPM core.

For convenience also add snd_soc_codec_* wrappers around these helpers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27 21:34:45 +01:00
Lars-Peter Clausen 39ed68c8cd ASoC: Add helper function getting CODEC's DAPM context
The DAPM context in the snd_soc_codec struct is redundant and scheduled to
be replaced by the DAPM context in the snd_soc_component struct. This patch
introduces a new helper function snd_soc_codec_get_dapm() which should be
used for getting the DAPM context for a CODEC rather then directly
accessing the dapm field. Once there are no more direct users of the dapm
field left it is possible to transparently switch all drivers to the
component DAPM context by updating snd_soc_codec_get_dapm() function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27 21:34:45 +01:00
Kuninori Morimoto 2dc0f16b83 ASoC: soc.h: tidyup struct snd_soc_dai_link definition order
Current struct snd_soc_dai_link has many members, but definition order
was random. Especially, bool / bit field are defined randomly.
This patch tidyups these definition order to calculate data alignment
easy.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27 21:13:17 +01:00
Jie Yang aae013d646 ASoC: add static inline funcs to fix a compiling issue
When CONFIG_PM_SLEEP is not selected, calling funcs
snd_soc_suspend and _resume will generate a compiling
issue.

Here add static inline stub functions to fix it.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-19 13:21:55 +01:00
Takashi Iwai ce4524e5a7 ASoC: Updates for v4.1
More updates for v4.1, pretty much all drivers:
 
  - Lots of cleanups from Lars, mainly moving things from the CODEC level
    to the card level.
  - Continuing improvements to rcar from Morimoto-san, pcm512x from
    Howard and Peter, the Intel platforms from Vinod, Jie, Jin and Han,
    and to rt5670 from Bard.
  - Support for some non-DSP Qualcomm platforms, Google's Storm
    platform, Maxmim MAX98925 CODECs and the Ingenic JZ4780 SoC.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVK7E7AAoJECTWi3JdVIfQeRwH+wZHxh5yXBwSysga6ITc8GzZ
 Swy9LCdVr4uDXBrzn6qusfpgyiy6i09aB3tlr02j1gnhaA6tZ52Xi5S5RGds2nQL
 Qi+Nmt/7Expys09mJrE1Z8ZBRXnSbKw36odNxHiVVPVSfBGEXeQErDmLzsQ3ccqA
 8HDC2TGRjjal9ZVW9kNsi5EkR9z8dRlkymAvzlpozs4aLwaOsH/xiF+4xI3zh0xZ
 +rG8HH9w3/yePVKiKZGjToNgzZ2ATLB5s+JZyFiDn0uXMo3UZWnQItPv8KJE0/FR
 A7D7XyMN66WSTnWHMIPetrJbgyNP9cM/Wk+prn/PKvObsqYiP7lJikzEAlklfJE=
 =LjN/
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v4.1

More updates for v4.1, pretty much all drivers:

 - Lots of cleanups from Lars, mainly moving things from the CODEC level
   to the card level.
 - Continuing improvements to rcar from Morimoto-san, pcm512x from
   Howard and Peter, the Intel platforms from Vinod, Jie, Jin and Han,
   and to rt5670 from Bard.
 - Support for some non-DSP Qualcomm platforms, Google's Storm
   platform, Maxmim MAX98925 CODECs and the Ingenic JZ4780 SoC.
2015-04-13 14:14:29 +02:00
Mark Brown e1f059937a Merge remote-tracking branches 'asoc/topic/link-param', 'asoc/topic/max98090', 'asoc/topic/max98925' and 'asoc/topic/nuc900' into asoc-next 2015-04-12 19:49:06 +01:00
Mark Brown 77b62fa5d2 Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2015-04-12 19:48:31 +01:00
Nikesh Oswal c66150824b ASoC: dapm: add code to configure dai link parameters
dai-link params for codec-codec links were fixed. The fixed
link between codec and another chip which may be another codec,
baseband, bluetooth codec etc may require run time configuaration
changes. This change provides an optional alsa control to select
one of the params from a list of params.

Signed-off-by: Nikesh Oswal <nikesh@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-17 22:54:54 +00:00
Lars-Peter Clausen 6b5b042d4c ASoC: Make snd_soc_dapm_kcontrol_codec() inline
snd_soc_dapm_kcontrol_codec() is a extremely simple function and inlining it
typically results in less code than necessary for calling the non-inlined
version of the function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-16 11:40:24 +00:00
Takashi Iwai a52afea68f ASoC: Changes for v4.1
A selection of changes for v4.1 so far.  The main things are:
 
  - Move of jack registration to the card where it belongs.
  - Support for DAPM routes specified by both the machine driver and DT.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJU960DAAoJECTWi3JdVIfQkKIH/RDvxRn8dvKOPF5U9Uix3chH
 JWKkzqfsMP0EpmQTzCQPp0ShAyYcWSbYsopicynPxUem5vS4Z8+UmOgEEgkj59pK
 USbF6v1jCQXA6BcbKyUcRRBD9FtRkfVDc7mYbRs2CcwQz2CGCgee41cvPM+2BT+z
 QdNC9UJARSweGvE1IUJSfpfYOly+BJ2s0/28RaQ0PGt+I0auoYx7IMFgMSDjv2p6
 PY0kyQiwm3Kyj2uNXPZ5gEuPxlw/t8n4fbQNrBYAvxzN+EF5NrGdKE3N7MI1xRV/
 EkFhzy+uM3X9c37tb2lT2fgPFlBc9rgPuLPSyoQ6nxa5ghCqAlgRhzpxRem8hhU=
 =VlCw
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Changes for v4.1

A selection of changes for v4.1 so far.  The main things are:

 - Move of jack registration to the card where it belongs.
 - Support for DAPM routes specified by both the machine driver and DT.
2015-03-06 14:25:27 +01:00
Mark Brown 256fca9247 Merge remote-tracking branches 'asoc/topic/jack', 'asoc/topic/max98357a', 'asoc/topic/omap' and 'asoc/topic/rt286' into asoc-next 2015-03-05 01:07:23 +00:00
Mark Brown 4a7e041570 Merge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/davinci', 'asoc/topic/gpiod' and 'asoc/topic/intel' into asoc-next 2015-03-05 01:07:21 +00:00
Lars-Peter Clausen 77c71765ef ASoC: Remove snd_soc_jack_new()
There are no users of snd_soc_jack_new() left and new users should use
snd_soc_card_jack_new() instead. So remove the function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-04 17:10:48 +00:00
Lars-Peter Clausen 970939964c ASoC: Allow to register jacks at the card level
Jacks are typically card level elements, but are currently registered with a
CODEC. When it was originally introduced snd_soc_jack_new() took a
snd_soc_card as its parameter, but at that time DAPM was only implemented at
the CODEC level and there was only one CODEC per card. This made it clear
which CODEC to use for the jack DAPM operations. But the multi-component
patchset added support for having multiple CODECs per card and with it the
API was updated to register jacks with a specific CODEC instance instead.
Subsequently DAPM support at the card level has been introduced, but the
snd_soc_jack_new() API has so remained unchanged.

This leaves us with the issue that the DAPM pins that are managed by the
jack detection logic usually are part of the card DAPM context but are
accessed through a CODEC DAPM context. Currently this works fine, but might
break in the future if we take a more hierarchical approach to DAPM
contexts.

Furthermore with componentization progressing systems that do not register
a snd_soc_codec might appear, while these system may still want to able to
register a jack.

This patch addresses these issues by adding a new function called
snd_soc_card_jack_new() that can be used to register jacks with the card
rather than a CODEC.

This new function is mostly identical to snd_soc_jack_new() except that it
additionally allows to directly specify the DAPM pins associated with the
jack. This was done since most users of snd_soc_jack_new() typically call
snd_soc_jack_add_pins() right after it, which is not necessary with the new
API and allows to reduce the amount of boiler plate code.

The old snd_soc_jack_new() is re-implemented as a wrapper around
snd_soc_card_jack_new().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-04 17:09:51 +00:00
Masanari Iida 1a6ab46fa9 ALSA: Fix spelling typo in Documentation/DocBook/alsa-driver-api.xml
This patch fix spelling typo found in alsa-driver-api.xml.
It is because this file is generated from comments in source files,
I have to fix source files.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-04 12:12:59 +01:00
Nicolin Chen f23e860edb ASoC: core: Add extra dapm properties for Device Tree
The current helper functions, snd_soc_of_parse_audio_simple_widgets()
and snd_soc_of_parse_audio_routing(), set dapm_widgets and dapm_routes
without caring if they are already set by using build-in widgets and
routes in the card driver. So there could be one of them, build-in one
or Device Tree one, overrided by the other depending on which one was
assigned later.

This patch adds an extra pair of dapm_widgets and dapm_routes for DT
use only so as to prevent unexpected overriding.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24 23:46:13 +09:00
Vinod Koul 48c7699fb2 ASoC: core: allow pcms to be registered as nonatomic
ALSA core with commit 257f8cce5d - "ALSA: pcm: Allow nonatomic trigger
operations" allows trigger ops to implemented as nonatomic. For ASoC, we can
specify this in dailinks and is updated while snd_pcm is created

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24 00:43:59 +09:00
Mark Brown 3f1cf65757 Merge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/dai' and 'asoc/topic/davinci' into asoc-next 2015-02-09 15:10:14 +08:00
Mark Brown 6d5c729dab Merge remote-tracking branches 'asoc/topic/cs42l73', 'asoc/topic/dai' and 'asoc/topic/davinci' into asoc-next 2015-02-04 20:57:10 +00:00
Lars-Peter Clausen 47e039413c ASoC: Add support for allocating AC'97 device before registering it
In some cases it is necessary to before additional operations after the
device has been initialized and before the device is registered. This can
for example be resetting the device.

This patch introduces a new function snd_soc_alloc_ac97_codec() which is
similar to snd_soc_new_ac97_codec() except that it does not register the
device. Any users of snd_soc_alloc_ac97_codec() are responsible for calling
device_add() manually.

Fixes: 6794f709b7 ("ASoC: ac97: Drop delayed device registration")
Reported-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-01-26 19:14:20 +00:00
Lars-Peter Clausen ce64c8b9cf ASoC: Add helper function for changing the DAI link format
For some setups it is necessary to change the DAI link format at runtime.
This patch factors out the code that does the initial static DAI link format
configuration into a separate helper function which can be used board
drivers as well.

This allows board drivers that have to change the DAI link format at runtime
to reuse it instead of having to manually change the format on all DAIs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-07 18:01:57 +00:00
Mark Brown c9098c6120 Merge remote-tracking branches 'asoc/topic/multi-codec', 'asoc/topic/mxs-saif', 'asoc/topic/mxs-sgtl5000', 'asoc/topic/omap' and 'asoc/topic/pxa' into asoc-next 2014-12-08 13:12:05 +00:00
Mark Brown cfdf59b4a1 Merge remote-tracking branches 'asoc/topic/codec-mutex', 'asoc/topic/compress' and 'asoc/topic/cq93vc' into asoc-next 2014-12-08 13:11:52 +00:00
Mark Brown 0a7e4ca1aa Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ad193x', 'asoc/topic/adau1373' and 'asoc/topic/adau17x1' into asoc-next 2014-12-08 13:11:45 +00:00
Mark Brown 941725f5fa Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-12-08 13:11:44 +00:00
Jean-Francois Moine c362effe5c ASoC: Remove 'const' from the device_node pointers
As Russell King's explained it, there should not be pointers to
struct device_node:

"struct device_node is a ref-counted structure.  That means if you
 store a reference to it, you should "get" it, and you should "put"
 it once you've done.  The act of "put"ing the pointed-to structure
 involves writing to that structure, so it is totally unappropriate
 to store a device_node structure as a const pointer.  It forces you
 to have to cast it back to a non-const pointer at various points
 in time to use various OF function calls."

[This isn't quite the application here, we're not geting or putting the
pointer though we did add some other users who call non-const OF
functions -- broonie]

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 22:26:34 +00:00
Lars-Peter Clausen e874bf5f76 ASoC: Disable regmap helpers if regmap is disabled
If regmap is disabled there will be no users of the ASoC regmap helpers.
Furthermore regmap_exit() will no be defined causing the following compile
error:
	sound/soc/soc-core.c: In function 'snd_soc_component_exit_regmap':
	sound/soc/soc-core.c:2645:2: error: implicit declaration of function
		'regmap_exit' [-Werror=implicit-function-declaration]

So disable the helpers if regmap is disabled.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 20feb88198 ASoC: Add helper functions for deferred regmap setup")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 21:15:31 +00:00
Jean-Francois Moine 93b0f3eeeb ASoC: core: add multi-codec support in DT
This patch exports a core function which handles the DT description
of multi-codec links (as: "sound-dai = <&hdmi 0>, <&spdif_codec>;")
and creates a CODEC component array in the DAI link.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 13:21:14 +00:00
Mark Brown e975cec295 Merge branch 'topic/regmap' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-ac97 2014-11-19 10:48:20 +00:00
Lars-Peter Clausen 20feb88198 ASoC: Add helper functions for deferred regmap setup
Some drivers (most notably the AC'97 drivers) do not have access to their
regmap struct when the component/codec is registered. For those drivers the
automatic regmap setup will not work and needs to be done manually,
typically from the component/CODEC drivers probe callback.

This patch adds a set of helper function to handle deferred regmap
initialization as well as early regmap tear-down.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-19 10:46:03 +00:00
Lars-Peter Clausen 358a8bb562 ASoC: ac97: Push snd_ac97 pointer to the driver level
Now that the ASoC core no longer needs a handle to the AC'97 device that is
associated with a CODEC we can remove it from the snd_soc_codec struct and
push it into the individual driver state structs like we do for other
communication buses. Doing so creates a clean separation between the AC'97
bus support and the ASoC core.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:38:03 +00:00
Lars-Peter Clausen 6794f709b7 ASoC: ac97: Drop delayed device registration
We have all the information and dependencies we need to initialize and
register the device available in snd_soc_new_ac97_codec(). So there is no
need to delay the device registration until after the card itself as been
registered.

This makes the code significantly simpler and also makes it possible to use
the AC'97 device in the CODECs probe function. The later will be required to
be able to convert the AC'97 CODEC drivers to regmap.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:37:58 +00:00
Lars-Peter Clausen ca005f324e ASoC: ac97: Drop support for setting platform data via the CPU DAI
This has no users since commit f0fba2ad1b ("ASoC: multi-component - ASoC
Multi-Component Support") which was almost 5 years ago. Given that this runs
after CODEC probe functions have been run it also doesn't seem to be that
useful.

So drop it altogether to make the code simpler.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:37:58 +00:00
Lars-Peter Clausen eda1a701fd ASoC: ac97: Use static ac97_bus
We always pass soc_ac97_ops to snd_soc_new_ac97_codec(). So instead of
allocating a snd_ac97_bus in snd_soc_new_ac97_codec() just use a static one
that gets initialized when snd_soc_set_ac97_ops() is called.

Also drop the device number parameter from snd_soc_new_ac97_codec(). We
currently only support one device per bus and all drivers pass 0 for the
device number. And if we should ever support multiple devices per bus it
wouldn't be up to individual AC'97 device drivers to pick their number, but
rather either the AC'97 adapter driver or the core code will assign them.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:37:46 +00:00
Lars-Peter Clausen 336b8423e2 ASoC: Move AC'97 support to its own file
Currently the AC'97 support is splattered all throughout soc-core.c. Some
parts are #ifdef'd some parts are not. This patch moves the AC'97 support to
its own file, this should make the code a bit more clearer and also makes it
possible to easily not compile it into the kernel when not needed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-18 15:26:06 +00:00
Lars-Peter Clausen bd6b87c104 ASoC: Remove CODEC mutex
The CODEC mutex is now unused and can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-10 19:08:31 +00:00
Lars-Peter Clausen 427d204c86 ASoC: Remove snd_soc_cache_sync() implementation
This function has no more non regmap user, which means we can remove the
implementation of the function and associated functions and structure
fields.

For convenience we keep a static inline version of the function that
forwards calls to regcache_sync() unconditionally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-09 09:06:30 +00:00
Lars-Peter Clausen dd63a9c295 ASoC: Remove snd_soc_platform_driver suspend/resume callbacks
Those are unused and new drivers should use device driver suspend/resume.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03 12:17:07 +00:00
Lars-Peter Clausen c1b4d1c777 ASoC: Use generic control handlers for S8 control
Commit f227b88f0f ("ASoC: core: Add signed register volume control logic")
added support for signed control to the generic volsw control handler.
This makes it possible to use them for the S8 control as well, rather than
having to use a custom control handler implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28 00:20:51 +00:00
Mark Brown 565fefdf31 Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/dmic', 'asoc/topic/drivers', 'asoc/topic/es8328' and 'asoc/topic/fsl' into asoc-next 2014-10-06 12:48:57 +01:00
Mark Brown 97c53e26f0 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-10-06 12:48:52 +01:00
Mark Brown 5bcaca4b5b Merge remote-tracking branch 'asoc/topic/component' into asoc-next 2014-10-06 12:48:51 +01:00
Lars-Peter Clausen 0634814fe0 ASoC: Remove table based DAPM/control setup support from snd_soc_platform_driver
There are no users left and new users should rather use the component_driver
struct embedded in the snd_soc_platform_driver struct to do this. E.g.:

static const struct snd_soc_platform_driver foobar_driver = {
	.component_driver = {
		.dapm_widgets = ...,
		.num_dapm_widgets = ...,
		...,
	},
	...
};

instead of

static const struct snd_soc_platform_driver foobar_driver = {
	.dapm_widgets = ...,
	.num_dapm_widgets = ...,
	...
};

This also allows us to remove the steal_sibling_dai_widgets hack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-09-06 14:46:30 +01:00
Lars-Peter Clausen c815dbb477 ASoC: Add snd_soc_component_{get,set}_drvdata()
Add Add snd_soc_component_{get,set}_drvdata() similar to
snd_soc_codec_{get,set}_drvdata() and snd_soc_platform_{get,set}_drvdata().
Also update them to use the new functions internally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-09-06 14:42:47 +01:00
Lars-Peter Clausen 86dbf2ac6f ASoC: Add support for automatically going to BIAS_OFF on suspend
There is a substantial amount of drivers that in go to SND_SOC_BIAS_OFF on
suspend and go back to SND_SOC_BIAS_SUSPEND on resume (Often this is even
the only thing done in the suspend and resume handlers). This patch
introduces a new suspend_bias_off flag, which when set by a driver will let
the ASoC core automatically put the device's DAPM context at the
SND_SOC_BIAS_OFF level during suspend. Once the device is resumed the DAPM
context will go back to SND_SOC_BIAS_STANDBY (if the context is idle,
otherwise to SND_SOC_BIAS_ON).

This will allow us to remove a fair bit of duplicated code from the drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-04 20:10:25 +01:00
Jarkko Nikula b792346fa8 ASoC: Remove unused cache_only from struct snd_soc_codec
There are no real users for cache_only in "struct snd_soc_codec" so remove
it and needless debugfs node.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-28 19:05:57 +01:00
Lars-Peter Clausen 75af7c0819 ASoC: Remove support for legacy snd_soc_platform IO
There were never any actual users of this in upstream and by we have with
regmap a replacement in place, which should be used by new drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:47 -05:00
Lars-Peter Clausen 886f569225 ASoC: Automatically initialize regmap for all components
So far regmap is only automatically initialized for CODECs. Now that we have the
infrastructure in place to let components have DAPM widgets and controls that
want to use the generic regmap based IO also make sure to automatically
initialize regmap for all components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:47 -05:00
Lars-Peter Clausen 57bf772687 ASoC: Pass component instead of DAPM context to AUX dev init callback
Given that the component is the containing structure it makes more sense to pass
the component rather than the DAPM context to the AUX dev init callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:46 -05:00
Lars-Peter Clausen 65d9361f0c ASoC: Move AUX dev support to the component level
This patch makes it possible to register arbitrary components as a AUX dev
for a card. This was previously only possible for CODEC components. With
componentization having made it possible for components to have DAPM contexts
and controls there is no reason why AUX devs should be artificially limited to
snd_soc_codec devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen 61aca5646b ASoC: Add component level probe/remove support
Now that we have a unified probe and remove path make sure to call them for all
components. soc_{probe,remove}_component are responsible for setting up the DAPM
context for the component, initialize the component prefix, manage the debugfs
entries as well as do the registration of table based controls and DAPM
elements. They also call the component drivers probe and remove callbacks. This
patch makes these things available for generic snd_soc_component drivers rather
than only having them for snd_soc_codec and snd_soc_platform drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen f1d45cc3ae ASoC: Consolidate platform and CODEC probe/remove
The platform and CODEC probe and remove code is now largely identical. This
patch consolidates it at the component level.

The resulting code is slightly larger due to all the boiler plate code setting
up the indirection for the table based control and DAPM registration.  Once all
drivers have been update to no longer use the snd_soc_codec_driver and
snd_soc_platform_driver specific fields for this the indirection can be removed
again.

This patch contains two noteworthy hacks that are only meant to be temporary to
be able to update drivers and the core in separate incremental patches.

The first hack is related to that some DPCM platforms expect that the DAPM
widgets for the DAIs of a snd_soc_component are created in the DAPM context of
the snd_soc_platform that has the same parent device. For handling this the
steal_sibling_dai_widgets attribute is introduced. It gets set for
snd_soc_platforms that register DAPM elements. When creating the DAI widgets for
a component this flag is checked and if it is found on one of the siblings the
component will not create any DAI widgets in its own DAPM context. If the
attribute is set on a platform it will look for siblings components and create
DAI widgets for them in its own context. The fix for this will be to update
the offending drivers to only register a single component rather than two.

The second hack deals with the fact that the ASoC card suspend and resume code
still needs a list of CODECs that have been registered for the card. To handle
this the generic probe and remove path have a check to see if the component is
CODEC and if yes add/remove it to the card's CODEC list. While it is possible to
clean up the suspend/resume code to not need the CODEC list anymore this is a
bit of a chicken and egg problem since it will become easier to clean up the
suspend/resume code once there is a unified component layer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Lars-Peter Clausen 81c7cfd1b2 ASoC: Move debugfs registration to the component level
The debugfs registration is mostly identical between platforms and CODECs. This
patches consolidates the two implementations at the component level.

Unfortunately there are still a couple of CODEC specific debugfs files that are
related to legacy ASoC IO that need to be registered. For this a new callback is
added to the component struct that will be initialized when a CODEC is
registered and will be used to register the CODEC specific files. Once there are
no drivers left using legacy IO this can be removed again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-19 10:59:45 -05:00
Subhransu S. Prusty 4d61b39bc1 ASoC: core: fix .info for SND_SOC_BYTES_TLV
Commit 7523a271 - "ASoC: core: add a helper for extended byte controls using
TLV" introduced support for TLV byte controls but had a typo for the info
function, so fix the same

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-18 08:59:12 -05:00
Sylwester Nawrocki 8ad9f9efcc ASoC: Drop const from struct snd_soc_dai_link *of_node members
Dropping the const qualifiers prevents "passing argument 1 of ‘of_node_put’
discards ‘const’ qualifier from pointer target type" type warnings when
compiling the code dropping reference to cpu_of_node, codec_of_node or
platform_of_node with with an of_node_put() function call.

This lets us to avoid casting to struct device_node * or caching variables
internally in drivers just to be able to properly drop a reference to the
OF node on clean up paths.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16 17:02:54 -05:00
Mark Brown c5e64c7636 Merge remote-tracking branches 'asoc/topic/tlv', 'asoc/topic/tlv320aic23', 'asoc/topic/tlv320aic31xx' and 'asoc/topic/tlv320aic32x4' into asoc-next 2014-08-04 16:32:12 +01:00
Mark Brown 7196be58ca Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-08-04 16:31:17 +01:00
Lars-Peter Clausen 0f2780ad4c ASoC: Add function to register component controls
We have now everything in place to actual let a component register controls. Add
a function which allows to do so.

Also update snd_soc_add_codec_controls() and snd_soc_platform_controls() to use
this new function internally. And while we are at it also change the
num_controls parameter of those two functions from int to unsigned int.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-22 23:15:57 +01:00
Lars-Peter Clausen 00200107a2 ASoC: Move card field form platform/codec to component
Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the
parent card and both handle this pointer in mostly the same way. This patch
moves the card field to the component level which will allow further code
consolidation between platforms and CODECS.

Since there are only a handful of users of the snd_soc_codec struct's card field
(and none of the snd_soc_platform's) these are update in this patch as well,
which allows it to be removed from the snd_soc_codec struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-22 23:15:57 +01:00
Lars-Peter Clausen 9898e1ccf5 ASoC: Remove per card platform list
The platform_dev_list was added in commit f0fba2ad1b ("ASoC: multi-component -
ASoC Multi-Component Support") and while platforms are added and remove from
that list it is otherwise unused. This patch removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-22 23:15:57 +01:00
Benoit Cousson 93e6958a36 ASoC: pcm: Add soc_dai_hw_params helper
Add a function helper to factorize the hw_params code.

Suggested by Lars-Peter Clausen <lars@metafoo.de>

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16 23:06:27 +01:00
Benoit Cousson 88bd870f02 ASoC: core: Add initial support for DAI multicodec
DAI link assumes a one to one mapping between CPU DAI and CODEC. In
some cases, the same CPU DAI can be connected to several codecs.
This is the case for example, if you connect two mono codecs to the
same I2S link in order to have a stereo card.
The current ASoC implementation does not allow such setup.

Add support for DAI links composed of a single CPU DAI and multiple
CODECs. Sound cards have to pass the CODECs array in the corresponding
DAI link through a new 'snd_soc_dai_link_component' struct. Each CODEC in
this array is described in the same manner single CODEC DAIs are
(either DT/OF node or codec_name).

Multi-codec links are not supported in the case of CODEC to CODEC links.
Just print a warning if it happens.

Based on an original code done by Misael.

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Fabien Parent <fparent@baylibre.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16 22:58:49 +01:00
Omair Mohammed Abdullah 7523a27168 ASoC: core: add a helper for extended byte controls using TLV
ALSA supports arbitrary length TLVs for each kcontrol that can be used
to pass metadata about the control (e.g. volumes, enum information). The
same transport mechanism is now used for arbitrary length data by
defining a new helper.

Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-16 22:43:59 +01:00
Richard Fitzgerald 1e4c0d7c9a ASoC: add SOC_VALUE_ENUM_EXT
Adds an equivalent of SOC_ENUM_EXT for value enums

Strictly speaking SOC_ENUM_EXT can also be used to define
a value enum since the only difference is the get and set
functions. But this doesn't look good in code because it is
inconsistent with the normal control definitions. Adding a
specific SOC_VALUE_ENUM_EXT is better for code clarity.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-07 16:36:38 +02:00
Lars-Peter Clausen 14e8bdebfb ASoC: Add component level stream_event() and seq_notifier() support
This patch adds stream_event() and seq_notifier() callbacks similar to those
found in the snd_soc_codec_driver and snd_soc_platform driver struct to the
snd_soc_component_driver struct. This is meant to unify the handling of these
callbacks across different types of components and will eventually allow their
removal from the CODEC and platfrom driver structs.

The new callbacks are slightly different from the old ones in that they take a
snd_soc_component as a parameter rather than a snd_soc_dapm_context. This was
done since otherwise casting from the DAPM context to the component would
typically be the first thing to do in the callback. And the interface becomes
slightly cleaner by passing a snd_soc_component to all callbacks in the
snd_soc_component_driver struct.

The patch also already removes the stream_event() callback from the
snd_soc_codec_driver and snd_soc_platform_driver structs as it is currently
unused.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen bc9af9fa9b ASoC: Use component DAPM context for platforms
The snd_soc_platform dapm field is not accessed outside of the ASoC core. Switch
it over to using the snd_soc_component DAPM context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen ce0fc93ae5 ASoC: Add DAPM support at the component level
This patch adds full DAPM support at the component level. Previously there was
only full DAPM support for CODECs and partial DAPM support (e.g. no Mixers nor
MUXs) for platforms. Having DAPM support at the component level will allow all
types of components to use DAPM and also help in consolidating the DAPM support
between CODECs and platforms.

Since the DAPM context is directly embedded into the snd_soc_codec and
snd_soc_platform struct and the 'dapm' field is directly referenced in a lot of
drivers moving the field just right now is not possible without causing code
churn. The approach this patch takes is to add two new fields to the component
struct. One field which is the pointer to the actual DAPM context used by the
component and one DAPM context that will be used as the default if no other
context was specified. For CODECs and platforms the pointer is initialized to
point to the CODEC or platform DAPM context. All generic code when referencing
a component's DAPM struct will go via the pointer. This will make it possible to
eventually seamlessly move the DAPM context from snd_soc_codec and
snd_soc_platform struct over once all direct references have been eliminated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:34:15 +01:00
Lars-Peter Clausen f4333203ec ASoC: Move name and id from CODEC/platform to component
The component struct already has a name and id field which are initialized to
the same values as the same fields in the CODEC and platform structs. So remove
them from the CODEC and platform structs and used the ones from the component
struct instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:04:24 +01:00
Lars-Peter Clausen 94f99c875c ASoC: Move name_prefix from CODEC to component
Move the name_prefix from the CODEC struct to the component struct. This will
eventually allow to specify prefixes for all types of components. It is also
necessary to make the DAPM code component type independent (i.e. a DAPM context
does not need to know whether it belongs to a CODEC or a platform or something
else).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21 21:03:22 +01:00
Mark Brown 9713d5d0c4 Merge remote-tracking branches 'asoc/topic/gpio' and 'asoc/topic/intel' into asoc-next 2014-06-03 10:39:50 +01:00
Mark Brown b8139d0afd Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-06-03 10:39:43 +01:00
Lars-Peter Clausen 24089e04cb ASoC: Add helper functions to cast from DAPM context to CODEC/platform
This is useful if we have a pointer to a DAPM context and know that it is a
CODEC or platform DAPM context and want to get a pointer to the CODEC or
platform.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-01 19:16:47 +01:00
Jarkko Nikula e667487b67 ASoC: jack: Fix multiple definition of `snd_soc_jack_add_gpiods'
Commit f025d3b9c6 ("ASoC: jack: Add support for GPIO descriptor defined
jack pins") caused build error when CONFIG_GPIOLIB is not set:

sound/include/sound/soc.h:470: multiple definition of `snd_soc_jack_add_gpiods'
sound/soc/soc-core.o:sound/include/sound/soc.h:470: first defined here
make[2]: *** [sound/soc/snd-soc-core.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [sound/soc] Error 2
make: *** [sound] Error 2

Fix this by marking snd_soc_jack_add_gpiods() as static inline in soc.h.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 12:05:30 +01:00
Jarkko Nikula 83ad152d03 ASoC: jack: Clarify GPIO descriptor lookup in struct snd_soc_jack_gpio doc
Clarify struct snd_soc_jack_gpio documentation for the idx and name fields.
Because name is passed as connection ID to gpiod_get_index() when using GPIO
descriptor defined jack pins it is not only used as a label in debugfs but
also as function name lookup in systems that support functions names for
GPIOs.

Clarify also idx since the index is within the function of the GPIO consumer
device and not within the device itself only.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-27 12:03:44 +01:00
Jarkko Nikula f025d3b9c6 ASoC: jack: Add support for GPIO descriptor defined jack pins
Allow jack GPIO pins be defined also using GPIO descriptor-based interface
in addition to legacy GPIO numbers. This is done by adding two new fields to
struct snd_soc_jack_gpio: idx and gpiod_dev.

Legacy GPIO numbers are used only when GPIO consumer device gpiod_dev is
NULL and otherwise idx is the descriptor index within the GPIO consumer
device.

New function snd_soc_jack_add_gpiods() is added for typical cases where all
GPIO descriptor jack pins belong to same GPIO consumer device. For other
cases the caller must set the gpiod_dev in struct snd_soc_jack_gpio before
calling snd_soc_jack_add_gpios().

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 15:26:00 +01:00
Jarkko Nikula 50dfb69d1b ASoC: jack: Basic GPIO descriptor conversion
This patch does basic GPIO descriptor conversion to soc-jack. Even the GPIOs
are still passed and requested using legacy GPIO numbers the driver
internals are converted to use GPIO descriptor API.

Motivation for this is to prepare soc-jack so that it will allow registering
jack GPIO pins using both GPIO descriptors and legacy GPIO numbers.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 15:23:14 +01:00
Mark Brown 04f87446c2 Merge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf', 'asoc/topic/sta350' and 'asoc/topic/tlv320dac33' into asoc-next 2014-05-22 00:24:00 +01:00
Mark Brown 0c5dacf2ca Merge remote-tracking branches 'asoc/topic/cs42l56', 'asoc/topic/cs42xx8' and 'asoc/topic/davinci' into asoc-next 2014-05-22 00:23:49 +01:00
Mark Brown e3ac3f2510 Merge remote-tracking branch 'asoc/topic/enum' into asoc-next 2014-05-22 00:23:44 +01:00
Mark Brown 566d4eeff8 Merge remote-tracking branch 'asoc/topic/dt' into asoc-next 2014-05-22 00:23:43 +01:00
Lars-Peter Clausen db88a8e3ca ASoC: Remove unused num_dai field from CODEC
Commit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the
last user of the num_dai field. Also remove the field itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 10:21:26 +01:00
Lars-Peter Clausen af0881ffbd ASoC: Remove unused 'list' field form card
The global card list was removed in commit b19e6e7b7 ("ASoC: core: Use driver
core probe deferral"). The 'list' field of the snd_soc_card struct has been
unused since then. This patch removes the field.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 10:21:25 +01:00
Lars-Peter Clausen 24faf76568 ASoC: Remove card's DAI list
Commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support") added
a per card list that keeps track of all the DAIs that have been registered with
the card, but the list has never been used. This patch removes it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-07 10:21:25 +01:00
Mark Brown 387f837b3d Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core 2014-05-07 10:21:22 +01:00
Vinod Koul d98812082c ASoC: add SND_SOC_BYTES_EXT
we need _EXT version for SND_SOC_BYTES so that DSPs can use this to pass data
for DSP modules

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-02 13:44:24 -07:00
Sebastian Reichel 3ca041ed04 ASoC: dt: Allow Aux Codecs to be specified using DT
This patch adds support for specifying auxiliary codecs and
codec configuration via device tree phandles.

This change adds new fields to snd_soc_aux_dev and snd_soc_codec_conf
and adds support for the changes to SoC core methods.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-01 10:56:45 -07:00
Jyri Sarha 389cb8348c ASoC: core: Update snd_soc_of_parse_daifmt() interface
Adds struct device_node **bitclkmaster and struct device_node **framemaster
function parameters. With the new syntax bitclock-master and frame-master
properties can explicitly indicate the dai-link bit-clock and frame masters
with a phandle. This patch also makes the minimal changes to simple-card
for it to work with the updated snd_soc_of_parse_daifmt(). Simple-card appears
to be the only user of snd_soc_of_parse_daifmt() for now.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23 13:14:27 +01:00
Lars-Peter Clausen 907fe36a2c ASoC: Move standard kcontrol helpers to the component level
After moving the IO layer inside ASoC to the component level we can now easily
move the standard control helpers also to the component level. This allows to
reuse the same standard helper control implementations for other components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22 13:38:21 +01:00
Lars-Peter Clausen e2c330b9b5 ASoC: Move IO abstraction to the component level
We currently have two very similar IO abstractions in ASoC, one for CODECs, the
other for platforms. Moving this to the component level will allow us to unify
those two. It will also enable us to move the standard kcontrol helpers as well
as DAPM support to the component level.

The new component level abstraction layer is primarily build around regmap.
There is a per component pointer for the regmap instance for the underlying
device. There are four new function snd_soc_component_read(),
snd_soc_component_write(), snd_soc_component_update_bits() and
snd_soc_component_update_bits_async(). They have the same signature as their
regmap counter-part and will internally forward the call one-to-one to regmap.
If the component it not using regmap it will fallback to using the custom IO
callbacks. This is done to be able to support drivers that haven't been
converted to regmap yet, but it is expected that this will eventually be removed
in the future once all component drivers have been converted to regmap.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-22 13:23:35 +01:00
Mark Brown 2b17ef4071 Merge branches 'topic/sta350', 'topic/core', 'topic/dapm' and 'topic/cache' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-component 2014-04-22 13:22:52 +01:00
Lars-Peter Clausen ab2874a8fa ASoC: Change return type of snd_soc_write() to int
The CODEC's write callback can return a negative error code, make sure to pass
that on correctly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-21 11:21:25 +01:00
Peter Ujfalusi 8931bf6208 ASoC: Add resource managed snd_soc_register_platform()
Simplify error handling and remove repetitive (and rarely executed) code
for unregistration by providing a devm_snd_soc_register_platform()
platform.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-18 17:59:59 +01:00
Lars-Peter Clausen 66097ca788 ASoC: Fix snd_soc_kcontrol_platform() return type
This should obviously be snd_soc_platform * and not snd_soc_codec *

Fixes: f6272ff8a5 ("ASoC: Add snd_soc_kcontrol_platform() helper function")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-15 23:53:10 +01:00
Lars-Peter Clausen 785b3c4e09 ASoC: Remove deprecated ENUM/MUX macros
Since there are no users left, we can remove the deprecated ENUM and MUX macros
which are just alias for other macros.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 20:40:06 +01:00
Mark Brown aa0258adf6 Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core
Conflicts:
	sound/soc/soc-core.c
2014-04-14 17:42:28 +01:00
Bard Liao 1a39019e93 ASoC: core: Allow snd_soc_update_bits use 32 bits register
Change reg's type from unsigned short to unsigned int. So that we can use
32 bits reg value in snd_soc_update_bits.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:23:39 +01:00
Lars-Peter Clausen b37f1d123c ASoC: Let snd_soc_platform subclass snd_soc_component
There is an increasing amount of code that is very similar between platforms,
CODECS and other components. Making platforms a component will allow us to
share this code. For now the patch just adds component and component_driver
fields to the platform and platform_driver structs and registers the platform as
a component. Followup patches will be used to consolidate code between the
different types of components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:44 +01:00
Lars-Peter Clausen 98e639fb8a ASoC: Track which components have been registered with snd_soc_register_component()
snd_soc_unregister_component() takes the parent device of the component as a
parameter and then looks up the component based on this. This is a problem if
multiple components are registered for the same parent device. Currently drivers
do not do this, but some drivers register a CPU DAI component and a platform for
the same parent device. This will become a problem once platforms are also made
components. To make sure that snd_soc_unregister_component() will not
accidentally unregister the platform in such a case only consider components
that were registered with snd_soc_register_component(). This is only meant as
short term stopgap solution to be able to continue componentisation. Long term
we'll need something different.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Lars-Peter Clausen 20a0ec27ea ASoC: Remove IO register modifier callbacks
There are no ASoC drivers left that use them and new drivers are supposed to use
regmap for this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Lars-Peter Clausen f6272ff8a5 ASoC: Add snd_soc_kcontrol_platform() helper function
For platform controls snd_kcontrol_chip() currently returns a pointer to the
platform that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_platform() helper function that will hide the
implementation details of how the platform for a control can be obtained. This
will allow us to change this easily in the future.

The patch also updates all platforms to use this new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Lars-Peter Clausen ea53bf77d1 ASoC: Add snd_soc_kcontrol_codec() helper function
For CODEC controls snd_kcontrol_chip() currently returns a pointer to the
CODEC that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_codec() helper function that will hide the implementation
details of how the CODEC for a control can be obtained. This will allow us to
change this easily in the future.

The patch also updates all CODEC drivers to use the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Xiubo Li a39f75f790 ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec()
Add the default regmap I/O setting to snd_soc_register_codec() while
the CODEC is initialising, which will be called by CODEC driver device
probe(), and then we can make XXX_set_cache_io() go away entirely from each
CODEC ASoC probe.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:18 +01:00
Mark Brown 9780b68435 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2014-03-23 14:00:43 +00:00
Lars-Peter Clausen 28d6d175d8 ASoC: Add helper function to cast component back to CODEC
Add a helper function to cast back from a component struct to the CODEC struct
it is embedded in. This is useful in situations where we know that a certain
component is a CODEC and want to get access to some CODEC specific properties.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-19 13:07:30 +00:00
Mark Brown 4c11a761b8 Merge remote-tracking branch 'asoc/topic/jack' into asoc-next 2014-03-13 14:19:32 +00:00
Mark Brown 2620954d64 Merge remote-tracking branch 'asoc/topic/io' into asoc-next 2014-03-13 14:19:21 +00:00
Mark Brown a4b12990b6 Merge remote-tracking branches 'asoc/topic/ml26124', 'asoc/topic/of', 'asoc/topic/omap', 'asoc/topic/pxa' and 'asoc/topic/rcar' into asoc-next 2014-03-12 23:04:35 +00:00
Mark Brown b8f861586c Merge remote-tracking branch 'asoc/topic/enum' into asoc-next 2014-03-12 23:03:59 +00:00
Mark Brown 53a2c4db8c Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2014-03-12 23:03:58 +00:00
Xiubo Li 092eba937d ASoC: io: New signature for snd_soc_codec_set_cache_io()
Now that all users have been converted to regmap and the config.reg_bits
and config.val_bits can be setted by each user through regmap core API.
So these two params are redundant here.

Since the only control type that left is SND_SOC_REGMAP, so remove it. Drop
the control params and add struct regmap *regmap to simplify the code.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-11 09:59:06 +00:00
Mark Brown db5a5ee7c7 Merge branches 'topic/ad193x', 'topic/tlv320aic23', 'topic/tlv320aic32x4', 'topic/wm8991', 'fix/si476x' and 'fix/88pm860' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-io 2014-03-11 09:58:55 +00:00
Lars-Peter Clausen 1438c2f60b ASoC: Add a per component dai list
Now that every DAI has a component we can track the DAIs on a per component
basis. This simplifies the DAI lookup when we are only interested in DAIs of a
specific component and also makes it possible to have multiple components with
the same parent device and also register DAIs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-10 12:17:54 +00:00
Mark Brown 6af5263cea Merge branch 'topic/pcm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-enum
Conflicts:
	include/sound/soc.h
2014-03-06 17:07:39 +08:00
Lars-Peter Clausen 3d59400fe4 ASoC: Move ignore_pmdown_time from CODEC to component
In preparation for componentization move the ignore_pmdown_time field from the
snd_soc_codec struct to the snd_soc_component struct. Set it to true for non
CODEC components for now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:04:56 +08:00
Lars-Peter Clausen cdde4ccb14 ASoC: Move active count from CODEC to component
There is no reason why active count tracking should only be done for CODECs but
not for other components. Moving the active count from the snd_soc_codec struct
to the snd_soc_component struct reduces the differences between CODECs and other
components and will eventually allow component to component DAI links (Which is
a prerequisite for converting CODECs to components).

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:04:55 +08:00
Lars-Peter Clausen 5c898e74d1 ASoC: Add helper function to check whether a CODEC is active
Instead of directly checking the 'active' field of the CODEC struct add a new
helper function that will return either true or false depending on whether the
CODEC is active. This will make the migration to the component level easier.

The patch also updates all CODEC drivers that check the active attribute to use
the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:04:55 +08:00
Lars-Peter Clausen 24894b7646 ASoC: Add helper functions for PCM runtime 'active' management
We have the same code that increments and decrements the active field of the
various PCM runtime components (all with the same bugs). Factor this out into
common helper functions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:04:55 +08:00
Lars-Peter Clausen 208a1589db ASoC: Handle ignore_pmdown_time for CODEC to CODEC links
For CODEC to CODEC links we should only immediately power down if both CODECs
are configured to ignore the power down delay. Factor the logic for this
into a helper function that can be used for both compressed and normal PCMs.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06 17:04:55 +08:00
Mark Brown feff9f3c96 ASoC: io: Remove hw_read() operation
We now no longer have any users of hw_read() in the kernel so remove the
code in order to prevent any new users being added. Users should be using
regmap.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-04 18:11:58 +08:00
Lars-Peter Clausen b948837a32 ASoC: Add macros for defining virtual enums
With the upcoming consolidation of normal MUXs and virtual MUXs we need to be
able to distinguish between enums with and without a backing register at the
enum level. Use the same approach as used for virtual mixer controls by setting
the reg field of the enum to SND_SOC_NOPM for enums without a backing register.
This patch adds a set of helper macros that can be used to define such enums.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01 12:03:34 +09:00
Lars-Peter Clausen 29ae2fa553 ASoC: Consolidate enum and value enum controls
The implementations for enum and value enum controls are almost identical. The
only difference is that the value enum uses an additional look-up table to map
the control value to the register value, while the enum control uses a direct
mapping. Enums and value enums can easily be distinguished at runtime, for value
enums the values field of the snd_soc_enum struct contains the look-up table,
while for enums it is NULL. This patch adds two new small helper functions
called snd_soc_enum_item_to_val() and snd_soc_enum_val_to_item() which map
between register value and control item. If the items field of the snd_soc_enum
struct is NULL the function will do a direct mapping otherwise they'll use the
look-up table to do the mapping. Using these small helper functions it is
possible to use the same kcontrol handlers for both enums and value enums. The
functions are added a inline functions in soc.h so they can also be used by the
DAPM code to accomplish similar consolidation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01 12:03:33 +09:00
Lars-Peter Clausen 8303d769ea ASoC: Remove unused 'reg2' field from soc_enum struct
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-01 12:03:33 +09:00
Mark Brown a304681f36 Merge branches 'topic/dapm', 'topic/sign', 'topic/adau1373', 'topic/max98090', 'topic/mc13783', 'fix/wm8994' and 'topic/wm8995' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-enum 2014-03-01 12:03:16 +09:00
xiangxiao cb29d7b9ef ASoC: add data field into snd_soc_jack_gpio
so callback could get the context data as needed

Signed-off-by: xiangxiao <xiaoxiang@xiaomi.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-24 10:27:44 +09:00
Xiubo Li 89c6785715 ASoC: core: add TDM slot parsing from DT supports
For some CPU/CODEC DAI devices the TDM slot infomation maybe needed. This
patch adds the slot parsing from DT supports.

TDM slot properties:
    dai-tdm-slot-num : Number of slots in use.
    dai-tdm-slot-width :  Width in bits for each slot.

For instance:
    dai-tdm-slot-num = <2>;
    dai-tdm-slot-width = <8>;

And for each spcified driver, there could be one .of_xlate_tdm_slot_mask()
to specify a explicit mapping of the channels and the slots. If it's absent
the default snd_soc_of_xlate_tdm_slot_mask() will be used to generating the
tx and rx masks.

For snd_soc_of_xlate_tdm_slot_mask(), the tx and rx masks will use a 1 bit
for an active slot as default, and the default active bits are at the LSB of
the masks.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-23 14:15:30 +09:00
Mark Brown 56b2f34913 ASoC: io: Remove SND_SOC_I2C
Now that all users have been converted to regmap we can eliminate the ASoC
level wrapper for I2C I/O reducing the amount of duplicated functionality.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-23 13:20:42 +09:00
Charles Keepax f6d5e586b4 ASoC: dapm: Add helpers to lock/unlock DAPM mutex
Acquiring the DAPM mutex is necessary before using several DAPM
functions and dereference is quite ugly. This patch provides a helper
function to simplify this.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 19:22:23 +09:00
Takashi Iwai 2e7e1993f9 ASoC: Add const to SOC_ENUM_*_DECL() macros
Since these macros are supposed to be used for decalring const
objects, let's add the const modifier there.

The doubled const appearing in usages will be cleaned by later
patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 10:43:06 +09:00
Takashi Iwai 9a8d38db03 ASoC: Rename soc_enum.max field with items
The name "max" in struct soc_enum is rather confusing since it
actually takes the number of items.  With "max", one might try to
assign (nitems - 1) value.

Rename the field to a more appropriate one, "items", which is also
used in struct snd_ctl_elem_info, too.

This patch also rewrites some code like "if (x > e->nitems - 1)" with
"if (x >= e->nitems)".  Not only the latter improves the readability,
it also fixes a potential bug when e->items is zero.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 10:42:53 +09:00
Mark Brown 7b80300e74 ASoC: io: Remove SPI support
All ASoC CODEC drivers that use SPI have now been converted to use regmap
so we can delete SND_SOC_SPI, preventing any new users being added.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-16 10:05:33 +08:00
Xiubo Li 9a6d48605e ASoC: add snd_soc_of_parse_audio_simple_widgets for DT
This patch adds snd_soc_of_parse_audio_simple_widgets() and supports
below style of widgets name on DT:

	"template-wname", "user supplied wname"

For instance:
	simple-audio-widgets =
		"Microphone", "Microphone Jack",
		"Line", "Line In Jack",
		"Line", "Line Out Jack",
		"Headphone", "Headphone Jack",
		"Speaker", "Speaker External";

The "template-wname" currently includes: "Microphone", "Line", "Headphone"
and "Speaker".

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 13:29:55 +00:00
Markus Pargmann cd21b12334 ASoC: core: Add SOC_DOUBLE_R_S_TLV
Add a macro for signed mixer with two registers and tlv array.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:44:50 +00:00
Markus Pargmann f227b88f0f ASoC: core: Add signed register volume control logic
Some codecs use signed volume control representation with non standard
register sizes, e.g. 6 or 7 bit signed integers.

This patch adds generic signed register volume control logic to
soc-core. Instead of a fixed width signed register control, this
implementation uses a 'min' value and the signed bit location to translate
it to an absolute volume. Using the 'sign_bit' we can calculate a
correct mask for the register values and translate it back into signed
integers of standard size.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:44:50 +00:00
Mark Brown ac6d7c48e3 Merge remote-tracking branch 'asoc/topic/compress' into asoc-next 2014-01-20 11:50:41 +00:00
Liam Girdwood 2a99ef0fdb ASoC: compress: Add suport for DPCM into compressed audio
Currently compressed audio streams are statically routed from the /dev
to the DAI link. Some DSPs can route compressed data to multiple BE DAIs
like they do for PCM data.

Add support to allow dynamically routed compressed streams using the existing
DPCM infrastructure. This patch adds special FE versions of the compressed ops
that work out the runtime routing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-17 17:56:21 +00:00
Mark Brown 2f43a23ab9 Merge remote-tracking branch 'asoc/topic/pcm' into for-tiwai 2014-01-16 12:42:57 +00:00
Liam Girdwood 1e9de42f43 ASoC: dpcm: Explicitly set BE DAI link supported stream directions
Some BE DAIs can be "dummy" (when the DSP is controlling the DAI) and as such
wont have set a minimum number of playback or capture channels required for BE
DAI registration (to establish supported stream directions).

Force machine drivers to explicitly set whether they support playback and capture
stream directions for every BE DAIs.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 17:57:48 +00:00
Mark Brown 2cde51fbd0 Merge remote-tracking branches 'asoc/topic/ad1836', 'asoc/topic/ad193x', 'asoc/topic/adav80x', 'asoc/topic/adsp', 'asoc/topic/ak4641', 'asoc/topic/ak4642', 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/au1x', 'asoc/topic/axi', 'asoc/topic/bcm2835', 'asoc/topic/blackfin', 'asoc/topic/cs4271', 'asoc/topic/cs42l52', 'asoc/topic/da7210', 'asoc/topic/davinci', 'asoc/topic/ep93xx', 'asoc/topic/fsl', 'asoc/topic/fsl-mxs', 'asoc/topic/generic', 'asoc/topic/hdmi', 'asoc/topic/jack', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/mxs', 'asoc/topic/omap', 'asoc/topic/pxa', 'asoc/topic/rcar', 'asoc/topic/s6000', 'asoc/topic/sai', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/spear', 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/tegra', 'asoc/topic/tlv320aic3x', 'asoc/topic/twl6040', 'asoc/topic/txx9', 'asoc/topic/uda1380', 'asoc/topic/width', 'asoc/topic/wm8510', 'asoc/topic/wm8523', 'asoc/topic/wm8580', 'asoc/topic/wm8711', 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic/wm8741', 'asoc/topic/wm8750', 'asoc/topic/wm8753', 'asoc/topic/wm8776', 'asoc/topic/wm8804', 'asoc/topic/wm8900', 'asoc/topic/wm8901', 'asoc/topic/wm8940', 'asoc/topic/wm8962', 'asoc/topic/wm8974', 'asoc/topic/wm8985', 'asoc/topic/wm8988', 'asoc/topic/wm8990', 'asoc/topic/wm8991', 'asoc/topic/wm8994', 'asoc/topic/wm8995', 'asoc/topic/wm9081' and 'asoc/topic/x86' into asoc-next 2014-01-02 13:01:55 +00:00
Takashi Iwai 8778ac6be2 ASoC: Fix build without CONFIG_GPIOLIB
snd_soc_jack_gpio stuff is currently enabled for CONFIG_GPIOLIB
explicitly with ifdef, and this causes build errors on some drivers
such as:
  sound/soc/omap/rx51.c:220:33: error: array type has incomplete element type

Remove ifdef and provide dummy functions for CONFIG_GPIOLIB=n case
instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-25 17:12:15 +00:00
Nicolin Chen 3635bf09a8 ASoC: soc-pcm: add symmetry for channels and sample bits
Some SoCs can only work in mono or stereo mode at one time. So if
we let them capture a mono stream while playing a stereo stream,
there might be a problem occur to one of these two streams: double
paced or slowed down.

In soc-pcm.c, we have soc_pcm_apply_symmetry() to apply the rate
symmetry. But we don't have one for channels.

Likewise, we can treat symmetric_rate as a solution for those SoCs
or CODECs which can not handle asymmetrical LRCLK. But it's also
impossible for them to handle asymmetrical BCLK. And accodring to
BCLK = LRCLK * channel number * slot size(fixed or sample bits),
sample bits might also be a problem if they are not using a fixed
slot size.

Thus, this patch applys symmetry for channels and sample bits.

Meanwhile, there might be a race between two substreams if starting
simultaneously. Previously, we only added warning to compalin but
still using conservative way to let it carry on. However, this patch
rejects the second stream with any unmatched parameter to make sure
the first existing stream won't be broken.

Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 13:32:50 +00:00
Mark Brown 48ce3ec16a Merge remote-tracking branch 'asoc/topic/devm' into asoc-next 2013-10-24 11:24:04 +01:00
Mark Brown 0705690110 Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2013-10-24 11:24:03 +01:00
Kuninori Morimoto 6833c452c2 ASoC: add snd_soc_of_get_dai_name() default of_xlate
Current snd_soc_of_get_dai_name() needs .of_xlate_dai_name()
callback on each component drivers.
But required behavior on almost all these drivers is
just returns its indexed driver's name.

This patch adds this feature as default behavior.
.of_xlate_dai_name() can overwrite it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-18 00:43:32 +01:00
Lars-Peter Clausen 249ce1387b ASoC: dapm: Add support for virtual mixer controls
This patch adds support for virtual DAPM mixer controls. They are similar to
virtual DAPM enums. There is no hardware register backing the control, so
changing the control's value wont have any direct effect on the hardware. But it
still influences the DAPM graph by causing the path it sits on to be connected
or disconnected. This in turn can cause power changes for some of the widgets on
the DAPM graph, which will then modify the hardware state.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 11:46:20 +01:00
Mark Brown 7d930ce26e Merge remote-tracking branch 'asoc/topic/component' into asoc-core
Conflicts:
	include/sound/soc.h
2013-09-17 13:25:28 +01:00
Kuninori Morimoto cb47008766 ASoC: add .of_xlate_dai_name on snd_soc_component_driver
ASoC sound driver requires CPU/CODEC drivers for probing,
and each CPU/CODEC has some DAI on it.
Then, "dai name matching" have been used to identify
CPU-CODEC DAI pair on ASoC.

But, the "dai port number matching" is now required from DeviceTree.
The solution of this issue is to replace
the dai port number into dai name.
Now, CPU/CODEC are based on struct snd_soc_component,
and it can care above as common issue.

This patch adds .of_xlate_dai_name callback interface
on struct snd_soc_component_driver,
and snd_soc_of_get_dai_name() which is using .of_xlate_dai_name.

Then, #sound-dai-cells which enables DAI specifier is required
on CPU/CODEC device tree properties.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 13:07:13 +01:00
Kuninori Morimoto d191bd8de8 ASoC: snd_soc_codec includes snd_soc_component
Codec includes component by this patch,
and component moved to upside of codec
to avoid extra declaration.
Codec dai will be registered via component
by this patch.

Current component register function
is used for cpu, and it is using
dai/dais functions properly to keep
existing cpu dai name.

And now, it will be used from codec also.
But codec driver had been used dais function only
even though it was single dai.
This patch adds new flag which can selects
dai/dais function on component register
function to keep existing codec dai name.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 13:07:13 +01:00
Mark Brown 0e4ff5c806 ASoC: core: Add devm_snd_soc_register_card()
Simplify error handling and remove repetitive (and rarely executed) code
for unregistration by providing a devm_snd_soc_register() card.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2013-09-17 00:50:06 +01:00
Mark Brown a0b03a616b ASoC: core: Implement devm_snd_soc_register_component()
Since with the wider use of devres many drivers are now only calling
snd_soc_unregister_component() in their remove functions providing a
managed version will save a reasonable amount of code.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:49:57 +01:00
Lars-Peter Clausen f90fb3f778 ASoC: Remove infrastructure for supporting multiple cache types
The only cache type left is the flat cache and new other cache types won't be
added since new drivers are supposed to use regmap directly for IO and caching.
This patch removes the snd_soc_cache_ops indirection that was added to support
multiple cache types and modifies the code to always use the flat cache
directly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:37:03 +01:00
Lars-Peter Clausen a94ed23436 ASoC: Remove 'reg_size' field from snd_soc_codec struct
The reg_size field is calculated in snd_soc_register_codec() and then used
exactly once in snd_soc_flat_cache_init(). Since it is calculated based on other
fields from the codec struct just move the calculation to
snd_soc_flat_cache_init() and remove the 'reg_size' field from the codec struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:37:03 +01:00
Lars-Peter Clausen b012aa619e ASoC: Remove reg_def_copy
reg_def_copy was introduced in commit 3335ddca ("ASoC: soc-cache: Use
reg_def_copy instead of reg_cache_default") to keep a copy of the register
defaults around in case the register defaults where placed in the __devinitdata
section. With the __devinitdata section gone we effectivly keep the same data
around twice. This patch removes reg_def_copy and uses reg_cache_default
directly instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:37:03 +01:00
Lars-Peter Clausen 2a1212a834 ASoC: Remove snd_soc_bulk_write_raw()
No users of snd_soc_bulk_write_raw() are left and new drivers are going to use
regmap directly for this, so the function can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:37:03 +01:00
Lars-Peter Clausen 175ee39e8f ASoC: Remove support for reg_access_defaults
No users of reg_access_defaults are left and new drivers are going to use regmap
for this, so support for it can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:37:02 +01:00
Mark Brown 90d561bed9 Merge remote-tracking branch 'asoc/topic/fsl' into tmp 2013-09-01 21:15:52 +01:00
Mark Brown a3ef472de1 Merge remote-tracking branch 'asoc/topic/core' into tmp 2013-09-01 21:15:48 +01:00
Fabio Estevam d6bead020d ASoC: soc-pcm: Allow to specify unidirectional dai_link
Add 'playback_only' and 'capture_only' fields that can be used for specifying
that a dai_link has a unidirectional capability.

The motivation for this is for the cases of systems, such as Freescale MX28,
that has two unidirectional DAIs.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-01 16:29:27 +01:00
Lars-Peter Clausen d7b1538c7c ASoC: Remove unused sysfs_registered field from snd_soc_codec struct
The sysfs_registered field was added to the snd_soc_codec struct in commit
f0fba2ad ("ASoC: multi-component - ASoC Multi-Component Support"), but has never
been used.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 12:48:23 +01:00
Lars-Peter Clausen ad758a6704 ASoC: Remove unused debugfs_dapm field from snd_soc_{platform,codec} struct
The DAPM context struct has its own field where it stores the pointer to the
DAPM debugfs entry. The debugfs_dapm field in the snd_soc_platform and
snd_soc_codec structs are completely unused and can be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 12:48:23 +01:00
Lars-Peter Clausen 43d92e7d9a ASoC: Remove unused control_type field from snd_soc_codec struct
The control_type field was used by the core to track which raw IO methods to
use, but when switching to regmap this was no longer necessary and so the last
user of the field was removed in commit be3ea3b9 ("ASoC: Use new register map
API for ASoC generic physical I/O"). The field is now completely unused and can
be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 12:48:23 +01:00
Mark Brown 38f7d75edc Merge remote-tracking branch 'asoc/topic/dapm' into asoc-core 2013-08-27 15:40:47 +01:00
Mark Brown 436f3562bb Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2013-08-22 14:28:32 +01:00
Mark Brown 8157567013 Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2013-08-22 14:28:31 +01:00
Mark Brown 6234eabf84 Merge remote-tracking branch 'asoc/topic/adsp' into asoc-next 2013-08-22 14:28:25 +01:00
Markus Pargmann 741a509f34 ASoC: core: Generic ac97 link reset functions
This patch adds generic ac97 reset functions using pincontrol and gpio
parsed from devicetree.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-20 11:02:00 +01:00
Lars-Peter Clausen 9a953e6f27 ASoC: Use snd_soc_info_enum_double() for SOC_ENUM_EXT controls
snd_soc_info_enum_ext() and snd_soc_info_enum_double() are almost identical. The
only difference is that snd_soc_info_enum_double() is also able to handle stereo
controls. Using snd_soc_info_enum double() instead of snd_soc_info_enum_ext()
for the SOC_ENUM_EXT control's info callback allows us to remove
snd_soc_info_enum_ext().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-11 12:00:27 +01:00
Lars-Peter Clausen c77f872e66 ASoC: Remove unused snd_soc_info_volsw_ext()
The SOC_SINGLE_EXT control has been using snd_soc_info_volsw() for its info
callback since commit 1c433fb ("[ALSA] soc - 0.13 ASoC headers"). The
snd_soc_info_volsw_ext() function has been unused ever since then, so remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-11 12:00:26 +01:00
Lars-Peter Clausen 57295073b6 ASoC: dapm: Implement mixer input auto-disable
Some devices have the problem that if a internal audio signal source is disabled
the output of the source becomes undefined or goes to a undesired state (E.g.
DAC output goes to ground instead of VMID). In this case it is necessary, in
order to avoid unwanted clicks and pops, to disable any mixer input the signal
feeds into or to active a mute control along the path to the output. Often it is
still desirable to expose the same mixer input control to userspace, so cerain
paths can sill be disabled manually. This means we can not use conventional DAPM
to manage the mixer input control. This patch implements a method for letting
DAPM overwrite the state of a userspace visible control. I.e. DAPM will disable
the control if the path on which the control sits becomes inactive. Userspace
will then only see a cached copy of the controls state. Once DAPM powers the
path up again it will sync the userspace setting with the hardware and give
control back to userspace.

To implement this a new widget type is introduced. One widget of this type will
be created for each DAPM kcontrol which has the auto-disable feature enabled.
For each path that is controlled by the kcontrol the widget will be connected to
the source of that path. The new widget type behaves like a supply widget,
which means it will power up if one of its sinks are powered up and will only
power down if all of its sinks are powered down. In order to only have the mixer
input enabled when the source signal is valid the new widget type will be
disabled before all other widget types and only be enabled after all other
widget types.

E.g. consider the following simplified example. A DAC is connected to a mixer
and the mixer has a control to enable or disable the signal from the DAC.

                     +-------+
  +-----+            |       |
  | DAC |-----[Ctrl]-| Mixer |
  +-----+       :    |       |
     |          :    +-------+
     |          :
    +-------------+
    | Ctrl widget |
    +-------------+

If the control has the auto-disable feature enabled we'll create a widget for
the control. This widget is connected to the DAC as it is the source for the
mixer input. If the DAC powers up the control widget powers up and if the DAC
powers down the control widget is powered down. As long as the control widget
is powered down the hardware input control is kept disabled and if it is enabled
userspace can freely change the control's state.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-05 15:50:27 +01:00
Lars-Peter Clausen 564c65049e ASoC: dapm: Move snd_soc_dapm_update from dapm context to card
The update field of a DAPM context is only assigned while the card's dapm_mutex
is locked, the field is also cleared again while the mutex is stil locked. So
there will only ever be one DAPM context at a time with a non-NULL update field.
So it is safe to move the update field from the DAPM context struct to the card
struct. Doing so will allow further cleanups in this area.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 18:40:59 +01:00
Dimitris Papastamos 4fefd69853 ASoC: core: Add snd_soc_card_get_kcontrol()
This is useful for drivers who want to grab a pointer to
snd_kcontrol outside of the kcontrol callbacks.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 15:39:11 +01:00
Mark Brown b047e1cce8 ASoC: ac97: Support multi-platform AC'97
Currently we can only have a single platform built in with AC'97 support
due to the use of a global variable to provide the bus operations. Fix
this by making that variable a pointer and having the bus drivers set the
operations prior to registering.

This is not a particularly good or nice approach but it avoids blocking
multiplatform and a real fix involves fixing the fairly deep problems
with AC'97 support - we should be converting it to a real bus.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-27 09:48:42 +01:00
Takashi Iwai 8dd2b66d1a ASoC: More updates for v3.10
The main additional change here is Lars-Peter's DMA work plus the
 platform conversions which have been tested - getting this in mainline
 will make life easier for development after the merge window.  These
 factor a large chunk of code out of the drivers for the platforms using
 dmaengine, greatly simplifying development.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRb/60AAoJELSic+t+oim9vL8P+wfaXRBGDtxhzMnTCf/cR2sc
 vlRnmSjA4s14vCoPffQJI0zaGLwDT5FnQtg6DAkP/8vXRoUz4Hgb0UwwDPiQNGED
 6Wmqm7mU+XGWgo4bPBA1e3Bt/9phVVO62rNPMNEnNqcp/Fa3RrdFAfxy4EUz9sKa
 lX4KJETCbIvLpOJmgq3H/WGtgYEnULHSCCNUQQ+fEY/VRQLsMtY5+tnZIJilMez0
 Ff6B084kE5oQpMsxdf89q8O5Uqc8lB0Xleluh0yQ1YZK3lxELMgr1Z7BkitysaJh
 uid+Ze8Vj2n5duI87OZcHN1Z2SibgTzqUwsd6YGCUKK3D3KVcSYgaYNn3zY09KNG
 tYlckAOJgVXqe1jedsfyuKTraz2JBY+jWYcIf8cRbwxxZpItG4Oj3idIBAKw+FrE
 /0DGqW7U9wXKx8pg7BH3dE6J6WVZ5uryaQX9d+nC8CGGjpcCla5L5jl/8stgGniW
 StTk4ETB6PP6iApv11p/7CXaTqXi+9UHmlcHFo11oQKiJFx4kG21DKQCXS0ycocM
 j0/gRGesWrVawYwJ86dhciUJjWlTHwproE/75i1JsTd3eRX6ybjBeNTTAI2ll/BJ
 BFDTS7tbX7GVcNbwXCvxW6pKOPpqV9jh0yMgpaB4jtkXOTKV/Z73ThPEql5w27c5
 OTBtONmiYeBcZGvgKQ3r
 =MXrq
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v3.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: More updates for v3.10

The main additional change here is Lars-Peter's DMA work plus the
platform conversions which have been tested - getting this in mainline
will make life easier for development after the merge window.  These
factor a large chunk of code out of the drivers for the platforms using
dmaengine, greatly simplifying development.
2013-04-18 16:24:31 +02:00
Lars-Peter Clausen 71a45cda44 ASoC: Add snd_soc_{add, remove}_platform
snd_soc_{add,remove}_platform are similar to snd_soc_register_platform and
snd_soc_unregister_platform with the difference that they won't allocate and
free the snd_soc_platform structure.

Also add snd_soc_lookup_platform which looks up a platform by the device it has
been registered for.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17 14:18:26 +01:00
Mark Brown 56c32c751c Merge remote-tracking branch 'asoc/topic/core' into asoc-next 2013-04-12 13:56:58 +01:00
Lars-Peter Clausen ef03c9ae96 ASoC: Constify the 'compr_ops' field of snd_soc_platform_driver
The ASoC core does not modify a platform driver's compr_ops structure. Making it
const allows ASoC platform drivers to declare their snd_compr_ops struct as
const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-27 23:09:36 +00:00
Lars-Peter Clausen 1f03f55b0c ASoC: Constify the 'ops' field of snd_soc_platform_driver
The ASoC core does not modify a platform driver's ops structure. Making it const
allows ASoC platform drivers to declare their snd_pcm_ops struct as const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-27 23:08:35 +00:00
Lars-Peter Clausen d79e57db84 ASoC: Constify the 'driver' field of snd_soc_platform
The ASoC core does no not modify the driver of a platform. Making it const
allows ASoC platform drivers to declare the snd_soc_platform_driver struct as
const.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-27 23:08:35 +00:00
Kuninori Morimoto 61782e4f5e ASoC: add .name for snd_soc_component_driver
This patch adds .name member on snd_soc_component_driver.
But this patch doesn't care about whether cmpnt_drv was NULL,
and/or its name was NULL in snd_soc_register_component()
at this point.

Because, it is easy to switch over to
snd_soc_register_component() from snd_soc_register_dais()
if it doesn't care cmpnt_drv was NULL.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-15 01:24:57 +00:00
Kuninori Morimoto 030e79f658 ASoC: add snd_soc_register_component()
Current ASoC has register function for platform/codec/dai/card,
but doesn't have for cpu.
It often produces confusion and fault on ASoC.

As result of ASoC community discussion,
we consider new struct snd_soc_component for CPU/CODEC,
and will switch over to use it.

This patch adds very basic struct snd_soc_component,
and register function for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-13 11:07:58 +00:00
Lars-Peter Clausen e383c467ce ASoC: core: Drop unused "dapm" field form soc_enum struct
This field was added in commit 2e72f8e ("ASoC: New enum type: value_enum"), but
has never been used since. Considering that the soc_enum struct is usually
shared between all instances of a CODEC, it also doesn't make much sense to have
a pointer to DAPM specific data in it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-08 20:45:05 +08:00