1
0
Fork 0
Commit Graph

2551 Commits (d082402e2174314e87131771d048925b2245b74c)

Author SHA1 Message Date
Takashi Iwai d02cac152c ASoC: Updates for v5.1
Lots and lots of new drivers so far, a highlight being the MediaTek
 BTCVSD which is a driver for a Bluetooth radio chip - the first such
 driver we've had upstream.  Hopefully we will soon also see a baseband
 with an upstream driver!
 
  - Support for only powering up channels that are actively being used.
  - Quite a few improvements to simplify the generic card drivers,
    especially the merge of the SCU cards into the main generic drivers.
  - Lots of fixes for probing on Intel systems, trying to rationalize
    things to look more standard from a framework point of view.
  - New drivers for Asahi Kasei Microdevices AK4497, Cirrus Logic CS4341,
    Google ChromeOS embedded controllers, Ingenic JZ4725B, MediaTek
    BTCVSD, MT8183 and MT6358, NXP MICFIL, Rockchip RK3328, Spreadtrum
    DMA controllers, Qualcomm WCD9335, Xilinx S/PDIF and PCM formatters.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxde0wTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0JWRB/9aQsLR22dNvKosiitTO/nnnPw/sUiG
 cFZsI4G1mFpjXyC2azaY1MQOIjRZY3WDsRjcHtAJUkdJnz8fdyj74mIRoHrQI/yv
 qdc7EtV5J0k0DemDQH2z5J7WjrkLg4aQCMT2XIvwrXL44jBv/iVKUE8l08D2AZ6t
 hQiVIF/9iBnaJwqfUSKzJaufdd88Onh1dBljLGwZnRDtG9mndpxoi+S9pR6gwSMG
 JzbgO4kUXdN95wKPxDsHFZimiSaX4bBo2cr79cisPrvcIKTyMAdtkAoNAcyuRezx
 qiN2l4zz6Wxi8TygkBZfmWGKz2/2fMDWLvYwfEnA9PhddlSUZt/P1IPl
 =tkEF
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v5.1

Lots and lots of new drivers so far, a highlight being the MediaTek
BTCVSD which is a driver for a Bluetooth radio chip - the first such
driver we've had upstream.  Hopefully we will soon also see a baseband
with an upstream driver!

 - Support for only powering up channels that are actively being used.
 - Quite a few improvements to simplify the generic card drivers,
   especially the merge of the SCU cards into the main generic drivers.
 - Lots of fixes for probing on Intel systems, trying to rationalize
   things to look more standard from a framework point of view.
 - New drivers for Asahi Kasei Microdevices AK4497, Cirrus Logic CS4341,
   Google ChromeOS embedded controllers, Ingenic JZ4725B, MediaTek
   BTCVSD, MT8183 and MT6358, NXP MICFIL, Rockchip RK3328, Spreadtrum
   DMA controllers, Qualcomm WCD9335, Xilinx S/PDIF and PCM formatters.
2019-02-08 14:20:32 +01:00
James Schulman 6ba9dd6c89
ASoC: cs35l36: Add support for Cirrus CS35L36 Amplifier
Add driver support for Cirrus Logic CS35L36 boosted
speaker amplifier

Signed-off-by: James Schulman <james.schulman@cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-08 13:00:28 +00:00
Pierre-Louis Bossart f13d4b5f85
ASoC: dapm: harden use of lookup tables
To detect potential errors, let's add:

a) build-time warnings when the table size isn't aligned with the enum
list
b) run-time warnings when the values are not initialized. This
requires an increase by one of all values to avoid the default 0.

Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-06 17:32:02 +00:00
Takashi Iwai 29b2625ff6 ALSA: info: Move card id proc creation into info.c
The creation of card's id proc file can be moved gracefully into
info.c.  Also, the assignment of card->proc_id is superfluous and can
be dropped.  So let's do it.

Basically this is no functional change but code refactoring, but one
potential behavior change is that now it returns properly the error
code from snd_info_card_register(), which is a good thing (tm).

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:58 +01:00
Takashi Iwai 9725752867 ALSA: info: Drop unused snd_info_entry.card field
It's referred only in snd_card_id_read() which can receive the card
object via private_data.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:58 +01:00
Takashi Iwai 7453e1dafd ALSA: info: Add standard helpers for card proc file entries
Two new helper functions are added here for cleaning up the existing
lengthy calls.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:55 +01:00
Charles Keepax 4f2ab5e1d1 ALSA: compress: Fix stop handling on compressed capture streams
It is normal user behaviour to start, stop, then start a stream
again without closing it. Currently this works for compressed
playback streams but not capture ones.

The states on a compressed capture stream go directly from OPEN to
PREPARED, unlike a playback stream which moves to SETUP and waits
for a write of data before moving to PREPARED. Currently however,
when a stop is sent the state is set to SETUP for both types of
streams. This leaves a capture stream in the situation where a new
start can't be sent as that requires the state to be PREPARED and
a new set_params can't be sent as that requires the state to be
OPEN. The only option being to close the stream, and then reopen.

Correct this issues by allowing snd_compr_drain_notify to set the
state depending on the stream direction, as we already do in
set_params.

Fixes: 49bb6402f1 ("ALSA: compress_core: Add support for capture streams")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-05 22:01:41 +01:00
Bard liao adfebb51e1
ASoC: topology: unload physical dai link in remove
soc_tplg_link_config() will find the physical dai link and call
soc_tplg_dai_link_load() to load the BE dai link. Currently remove_link()
is only used to remove the FE dai link which is created by the topology.
The BE dai link cannot however be unloaded in snd_soc_tplg_component
_remove(), which is problematic if anything needs to be released or
reinitialized.

This patch aligns the definitions of dynamic types with the existing
UAPI and adds a new remove_backend_link() routine to unload the the BE
dai link when snd_soc_tplg_component_remove() is invoked.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-04 11:59:30 +01:00
Charles Keepax 078a85f280
ASoC: dapm: Only power up active channels from a DAI
Currently all widgets attached to a DAI link will be powered
up when the DAI is active, however this may include routes
that are not actually in use if there are unused channels
available on the DAI.

The macros for creating AIF widgets already include an entry for
slot, it is proposed to change that to channel. The effective
difference here being respresenting the logical channel index
rather than the physical slot index. The CODECs currently
using the slot entry on the DAPM_AIF macros are using it in
a manner consistent with this, the CODECs not using it just
have the field set to zero.

A variable is added to snd_soc_dapm_widget to represent
this channel index and then for each AIF widget attached to
a DAI this is compared against the number of channels on
the stream. Enabling the links for those which will be in
use. This has the nice property that the CODECs which haven't
used the slot/channel entry in the macro will function exactly
as before due to all the AIF widgets having a channel of zero
and a stream by definition having at least one channel.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-02 17:15:17 +01:00
Takashi Iwai 0b6a2c9cf4 ALSA: isa: Avoid passing NULL to memory allocators
We used to pass NULL to memory allocators for ISA devices due to
historical reasons.  But we prefer rather a proper device object to be
assigned, so let's fix it by replacing snd_dma_isa_data() call with
card->dev reference, and kill snd_dma_isa_data() definition.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-01 17:16:40 +01:00
Takashi Iwai 305a0ade18 ALSA: hda - Serialize codec registrations
In the current code, the codec registration may happen both at the
codec bind time and the end of the controller probe time.  In a rare
occasion, they race with each other, leading to Oops due to the still
uninitialized card device.

This patch introduces a simple flag to prevent the codec registration
at the codec bind time as long as the controller probe is going on.
The controller probe invokes snd_card_register() that does the whole
registration task, and we don't need to register each piece
beforehand.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-01 11:30:09 +01:00
Ranjani Sridharan 5c30f43f06
ASoC: topology: add SND_SOC_DOBJ_GRAPH type for dapm routes
Add a new dobj type SND_SOC_DOBJ_GRAPH for dapm routes
and add snd_soc_dobj member to struct snd_soc_dapm_route.
This enables device drivers to save driver specific
data pertaining to dapm routes and also be able
to clean up the data when the driver module is unloaded.

Also, reorder the snd_soc_dobj_type types to align with
matching topology header types.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-29 18:03:44 +00:00
Takashi Iwai 286406c2e1 Merge branch 'for-linus' into for-next
Pull 5.0 branch for further development of USB-audio quirks

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 11:07:48 +01:00
Pierre-Louis Bossart cb50358b83
ASoC: add helper to change platform name for all dailinks
To reuse the same machine drivers with Atom/SST, Skylake and SOF, we
need to change the default platform_name (or platforms->name in the
"modern" representation).

So far, this override was done with an automatic override, which was
broken by a set of changes for DT platforms related to deferred probe
handling.

This automatic override is actually not really needed, the machine
driver can already receive the platform name as a platform_data
parameter. This is used e.g. for HDaudio support where we have
different PCI aliases used for different platforms. We can reuse the
same mechanism and modify the machine drivers to override the dailinks
prior to registrating the card.

This will require additional work for SOF, but with this helper it'll
be just two lines of additional code per machine driver which is
reused, not the end of the world.

This helper can be simplified when all drivers have transitioned to
the "modern" representation of dailinks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-28 18:05:38 +00:00
Pierre-Louis Bossart 5e484ec175
ASoC: soc-acpi: add static inline fallbacks when CONFIG_ACPI=n
Fix compilation issues reported by 0day-Kbuild with sparc64 w/ SOF.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-28 12:34:30 +00:00
Takashi Iwai 205d6bcf9b Merge branch 'topic/pcm-lock-refactor' into for-next
Pull PCM lock refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-24 14:46:21 +01:00
Takashi Iwai 480e32ebd5 ALSA: pcm: Simplify proc file destruction
The proc files are recursively freed by calling with the root
snd_info_entry object, so we don't have to keep each object for
releasing one by one.  Move the release of the PCM stream proc root at
the beginning, so that we can remove the redundant code and resource.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-24 14:40:25 +01:00
Takashi Iwai de89750c56 ALSA: pcm: Drop unused snd_pcm_substream.file field
It's assigned but nowhere used.  Let's remove it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-24 14:40:25 +01:00
Takashi Iwai f57f3df03a ALSA: pcm: More fine-grained PCM link locking
We have currently two global locks, a rwlock and a rwsem, that are
used for managing linking the PCM streams.  Due to these global locks,
once when a linked stream is used, the lock granularity suffers a
lot.

This patch attempts to eliminate the former global lock for atomic
ops.  The latter rwsem needs remaining because of the loosy way of the
loop calls in snd_pcm_action_nonatomic(), as well as for avoiding the
deadlock at linking.  However, these are used far rarely, actually
only by two actions (prepare and  reset), where both are no timing
critical ones.  So this can be still seen as a good improvement.

The basic strategy to eliminate the rwlock is to assure group->lock at
adding or removing a stream to / from the group.  Since we already
takes the group lock whenever taking the all substream locks under the
group, this shouldn't be a big problem.  The reference to group
pointer in snd_pcm_substream object is protected by the stream lock
itself.

However, there are still pitfalls: a race window at re-locking and the
lifecycle of group object.  The former is a small race window for
dereferencing the substream group object opened while snd_pcm_action()
performs re-locking to avoid ABBA deadlocks.  This includes the unlink
of group during that window, too.  And the latter is the kfree
performed after all streams are removed from the group while it's
still dereferenced.

For addressing these corner cases, two new tricks are introduced:
- After re-locking, the group assigned to the stream is checked again;
  if the group is changed, we retry the whole procedure.
- Introduce a refcount to snd_pcm_group object, so that it's freed
  only when it's empty and really no one refers to it.

(Some readers might wonder why not RCU for the latter.  RCU in this
case would cost more than refcounting, unfortunately.  We take the
group lock sooner or later, hence the performance improvement by RCU
would be negligible.  Meanwhile, because we need to deal with
schedulable context depending on the pcm->nonatomic flag, it'll become
dynamic RCU/SRCU switch, and the grace period may become too long.)

Along with these changes, there are a significant amount of code
refactoring.  The complex group re-lock & ref code is factored out to
snd_pcm_stream_group_ref() function, for example.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-23 07:25:08 +01:00
Kuninori Morimoto fe7ed4dec2
ASoC: simple-card: rename to asoc_simple_card_canonicalize_platform()
Current simple-card is using asoc_simple_card_canonicalize_dailink().
Its naming is "dailink", but is for "platform".
We already have asoc_simple_card_canonicalize_cpu() for "cpu",
let's follow same naming rule.
It never return error, so, void function is better idea.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-21 18:14:16 +00:00
Kuninori Morimoto 910fdcabed
ASoC: soc-core: add .num_platform for dai_link
Current snd_soc_dai_link is starting to use snd_soc_dai_link_component
(= modern) style for Platform, but it is still assuming single Platform
so far. We will need to have multi Platform support in the not far
future.

Currently only simple card is using it as sound card driver,
and other drivers are converted to it from legacy style by
snd_soc_init_platform().
To avoid future problem of multi Platform support, let's add
num_platforms before it is too late.

In the same time, to make it same naming mothed, "platform" should
be "platforms". This patch fixup it too.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-21 18:12:19 +00:00
Takashi Iwai a41c4cb913 ALSA: pcm: Make PCM linked list consistent while re-grouping
Make a common helper to re-assign the PCM link using list_move() instead
of open code with manual list_del() and list_add_tail().  This assures
the consistency and we can get rid of snd_pcm_group.count field -- its
purpose is only to check whether the list is singular, and we can know
it by list_is_singular() call now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-21 16:39:54 +01:00
Kuninori Morimoto 62bc79d35e
ASoC: soc.h: add explanation of legacy/modern style of dai_link
Current ALSA SoC is assuming 1 CPU 1 Platform (= DMA) style system.
Because of this background, it is directly using
xxx_name / xxx_of_node / xxx_dai_name on dai_link.
Let's call it as legacy style here.

More complex style system like multi CPU multi Platform (= DMA) will
coming. To supporting it, we can use snd_soc_dai_link_component on
dai_link. Let's call it as modern style here.
But current ALSA SoC can't support it so far. Thus, we need to have
multi CPU / multi Codec / multi Platform style in the future on ALSA SoC.

Currently we already have multi Codec support. Platform is starting to
use modern style on dai_link, but still style only. Multi Platform is
not yet implemented. And we still don't have multi CPU support on ALSA
SoC, and not have modern style either.

Currently, if driver is using legacy style Codec/Platform, it will be
converted to modern style on soc-core. This means, we are using glue code
for legacy vs modern style so far on ALSA SoC.
We can fully switch to modern style on all drivers if ALSA SoC supported
modern style for CPU, and then, legacy style code will be removed from
ALSA SoC.
Untile then, we need to keep both legacy/modern style and its glue code.
This patch adds such future plan and background on soc.h

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-18 19:14:43 +00:00
Mark Brown f557d39a3c ASoC: Fixes for v5.0
Quite a big batch of fixes here.  There's a couple of things going on,
 the main one is that we found some issues with not deferring probe when
 we should, causing us to skip some driver initialization.  The fixes for
 this then in turn exposed some issues with how we were searching for
 components which had previously gone unnoticed due to the original
 issue.
 
 There's also been the normal driver specific stuff and there's been what
 looks like several batches of automated scanning for issues which have
 generated quite a large set of smaller fixes for potential crashes and
 missed error handling.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxBy/wTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0HNQB/wI7qx/bNGOX1p2C0M5ENdgsMcYDpMh
 OHD073hL4wDkNJ/O2josnceCtrPUS5tuOxmx765IFXrAR4FWlNezQL4dHwTNGfG9
 Femd6iAxv47lC2fROpuHfB0j32LIjVrHLYDG0wAiDvteXK2VrGbj8vedfWqflOBj
 PX2kqkkgWfSCTrEYdrE09ExYoYKYdEqU/LEKFmIUnMuXc/HNHLo6e1sFNzTo8DIo
 g5P8nQ//Qgi1U9UWMabKjy4lYL2Tcid9jcNlz0QIffK2qwIEpVBeuhqJaT4sQrf5
 G51UrSk2y4lJ0t9WXv1SwQTDi2slCCGcOHA3fylGkJl1cxgOFMAR37Xs
 =ev1L
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxCJZ0THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0L+2B/0VnSutpVWaJnGyBuJ6zrydcSIW4183
 G51jmioR10cl5LDV0DiI9l7IoiOwUyODbrIl/swoQPs7FWUsFRGFYytdmAoqaKIC
 HK1j4D6Tlzac++e6bP6G6NzBMW6TGTu8c7hu3UtIGCz5uPRUKBthnndHmSbEB4h+
 10N7RMs9+/BvH1Zt+x9VqEIP5OHpwc7rP/8yANYbQCY7CPehqDiGpE7SvUgFFl5t
 IHx0nM1lJNeJyeu0Z/9BGAB5GWM/DzuMSrppNwl2k/QujSSyf1EPZvThpYNCBbnQ
 6cQ51+7SZi06ejzMBB5h5z/9yFZTSKmTwFwzJwg/fJ/QngZVkksRRNLV
 =9LPf
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.0-rc2' into asoc-5.1

ASoC: Fixes for v5.0

Quite a big batch of fixes here.  There's a couple of things going on,
the main one is that we found some issues with not deferring probe when
we should, causing us to skip some driver initialization.  The fixes for
this then in turn exposed some issues with how we were searching for
components which had previously gone unnoticed due to the original
issue.

There's also been the normal driver specific stuff and there's been what
looks like several batches of automated scanning for issues which have
generated quite a large set of smaller fixes for potential crashes and
missed error handling.
2019-01-18 19:14:36 +00:00
Takashi Iwai 436ec40e0c Merge branch 'topic/pcm-device-suspend' into for-next
Pull the PCM suspend improvement / cleanup.
This moves the most of snd_pcm_suspend*() calls into PCM's own device
PM ops.  There should be no change from the functionality POV.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-18 17:37:21 +01:00
Takashi Iwai b3c4014c2b ASoC: Fixes for v5.0
Quite a big batch of fixes here.  There's a couple of things going on,
 the main one is that we found some issues with not deferring probe when
 we should, causing us to skip some driver initialization.  The fixes for
 this then in turn exposed some issues with how we were searching for
 components which had previously gone unnoticed due to the original
 issue.
 
 There's also been the normal driver specific stuff and there's been what
 looks like several batches of automated scanning for issues which have
 generated quite a large set of smaller fixes for potential crashes and
 missed error handling.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxBy/wTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0HNQB/wI7qx/bNGOX1p2C0M5ENdgsMcYDpMh
 OHD073hL4wDkNJ/O2josnceCtrPUS5tuOxmx765IFXrAR4FWlNezQL4dHwTNGfG9
 Femd6iAxv47lC2fROpuHfB0j32LIjVrHLYDG0wAiDvteXK2VrGbj8vedfWqflOBj
 PX2kqkkgWfSCTrEYdrE09ExYoYKYdEqU/LEKFmIUnMuXc/HNHLo6e1sFNzTo8DIo
 g5P8nQ//Qgi1U9UWMabKjy4lYL2Tcid9jcNlz0QIffK2qwIEpVBeuhqJaT4sQrf5
 G51UrSk2y4lJ0t9WXv1SwQTDi2slCCGcOHA3fylGkJl1cxgOFMAR37Xs
 =ev1L
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.0-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.0

Quite a big batch of fixes here.  There's a couple of things going on,
the main one is that we found some issues with not deferring probe when
we should, causing us to skip some driver initialization.  The fixes for
this then in turn exposed some issues with how we were searching for
components which had previously gone unnoticed due to the original
issue.

There's also been the normal driver specific stuff and there's been what
looks like several batches of automated scanning for issues which have
generated quite a large set of smaller fixes for potential crashes and
missed error handling.
2019-01-18 15:17:17 +01:00
Takashi Iwai ce7f93e2bd ALSA: pcm: Make snd_pcm_suspend() local static
snd_pcm_suspend() is no longer called from outside, so let's make it
local static.  Also drop a superfluous NULL check there.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-15 17:48:23 +01:00
Takashi Iwai 3d21ef0b49 ALSA: pcm: Suspend streams globally via device type PM ops
Until now we rely on each driver calling snd_pcm_suspend*() explicitly
at its own PM handling.  However, this can be done far more easily by
setting the PM ops to each actual snd_pcm device object.

This patch adds the device_type object for PCM stream and assigns to
each PCM stream object.  The type contains only the PM ops for system
suspend; we don't need to deal with the resume in general.

The suspend hook simply calls snd_pcm_suspend_all() for the given PCM
streams.  This implies that the PM order is correctly put, i.e. PCM is
suspended before the main (or codec) driver, which should be true in
general.  If a special ordering is needed, you'd need to adjust the
device PM order manually later.

This patch introduces a new flag, snd_pcm.no_device_suspend, too.
With this flag set, the PCM device object won't invoke
snd_pcm_suspend_all() by itself.  This is needed for ASoC who wants to
manage the PM call orders in its serialized way, and the flag is set
in soc_new_pcm() as default.

For the non-ASoC world, we can get rid of the manual snd_pcm_suspend
calls.  This will be done in the later patches.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-15 17:46:36 +01:00
Curtis Malainey 09ac6a817b
ASoC: soc-core: fix init platform memory handling
snd_soc_init_platform initializes pointers to snd_soc_dai_link which is
statically allocated and it does this by devm_kzalloc. In the event of
an EPROBE_DEFER the memory will be freed and the pointers are left
dangling. snd_soc_init_platform sees the dangling pointers and assumes
they are pointing to initialized memory and does not reallocate them on
the second probe attempt which results in a use after free bug since
devm has freed the memory from the first probe attempt.

Since the intention for snd_soc_dai_link->platform is that it can be set
statically by the machine driver we need to respect the pointer in the
event we did not set it but still catch dangling pointers. The solution
is to add a flag to track whether the pointer was dynamically allocated
or not.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-01-14 22:48:16 +00:00
Sameer Pujar b59c8e7a73 ALSA: hda: add register offset for stripe control
bits 16:17 in SD_CTL register refer to stripe control. Added an
offset register(AZX_REG_SD_CTL_3B) to have exclusive read/write
of corresponding register byte. This helps to avoid unnecessary
32-bit read/write of SD_CTL whenever only stripe or other bits of
corresponding byte need to be updated. Also HD audio spec defines
SD_CTL as 3 byte register.

SD_CTL_STRIPE_MASK(0x3) can be used for stripe control programming
and when updating AZX_REG_SD_CTL_3B.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-14 19:52:27 +01:00
Sameer Pujar 5dd3d27132 ALSA: hda: Add api to program stripe control bits
Controllers and codecs can support striping of audio out across
multiple SDO lines. The number of supported SDO lines can be
specific to chip. GCAP register can be read to know the maximum
supported SDO lines.

snd_hdac_get_stream_stripe_ctl() is exposed to program stripe bits
on controller and codec side.
stripe value: 0 for 1SDO, 1 for 2SDO, 2 for 4SDO lines, etc.,

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-14 19:52:25 +01:00
Sameer Pujar e6ce794323 ALSA: hda: add verbs for stripe control
Controllers can support multiple Serial Data Out(SDO) lines, for
extended outbound bandwidth, to pump data to all codecs on the link.
Codecs can sample data present on SDO.

Add verbs AC_VERB_GET_STRIPE_CONTROL and AC_VERB_SET_STRIPE_CONTROL
These can be used to program usage of SDO lines for codec.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-14 19:52:23 +01:00
Pierre-Louis Bossart d82b51c855 ALSA: HD-Audio: SKL+: force HDaudio legacy or SKL+ driver selection
For HDaudio and Skylake drivers, add module parameter "pci_binding"

When pci_binding == 0 (AUTO), the PCI class/subclass info is used to
select drivers based on the presence of the DSP.

pci_binding == 1 (LEGACY) forces the use of the HDAudio legacy driver,
even if the DSP is present.

pci_binding == 2 (ASOC) forces the use of the ASOC driver. The
information on the DSP presence is bypassed.

The value for the module parameter needs to be identical for both
drivers. This parameter is intended as a back-up solution if the
automatic detection fails or when the DSP usage fails. Such cases
should be reported on the alsa-devel mailing list for analysis.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-19 18:07:23 +01:00
Keyon Jie 18d43c9b88 ALSA: HDA: export process_unsol_events()
The SOF implementation does not rely on the hdac_bus library, however
for HDMI and HDaudio codec support it does need to deal with
unsolicited events. Instead of re-inventing the wheel, export this
symbol to reuse this part of the library directly.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-19 18:07:18 +01:00
Takashi Iwai ed49e83919 ASoC: Updates for v4.21
Not much work on the core this time around but we've seen quite a bit of
 driver work, including on the generic DT drivers.  There's also a large
 part of the diff from a merge of the DaVinci and OMAP directories, along
 with some active development there:
 
  - Preparatory work from Morimoto-san for merging the audio-graph and
    audio-graph-scu cards.
  - A merge of the TI OMAP and DaVinci directories, the OMAP product line
    has been merged into the DaVinci product line so there is now a lot
    of IP sharing which meant that the split directories just got in the
    way.  This has pulled in a few architecture changes as well.
  - A big cleanup of the Maxim MAX9867 driver from Ladislav Michl.
  - Support for Asahi Kaesi AKM4118, AMD ACP3x, Intel platforms with
    RT5660, Meson AXG S/PDIF inputs, several Qualcomm IPs and Xilinx I2S
    controllers.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlwY7KsTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0MFqB/4m9nlfUeXTpiSD1FgVIlMmdPNUg4V2
 6Ybztaw4kRc5LuQN8PXQmaFLx020yAnLvI7Zzj7l3K8r6a9lfyFs+pKL0wtBnNK2
 9QEFmOVQ3QFpt31Yb2IQeO4dfNbiyKeczjLau4mXWTl0j5dc/UH+HasE1dRZOxsC
 rqJ8IsdibIVxVtQ7ZmcnU+y6XK0inBHAAh6ksMehsufShGrfrLs/nRBaXRZcRqJg
 ciSFY5uYRYkDxTgogTpNRfVy4nr17N10+0sgrQ3RtaaqgG3gBXsHca1meyxKYW3Q
 TssOJGIl3+uGiAMNyZqzxe5pAwwuGhZ3hAAAODtfYJQtAuAOW3/45Wqh
 =phWF
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v4.21

Not much work on the core this time around but we've seen quite a bit of
driver work, including on the generic DT drivers.  There's also a large
part of the diff from a merge of the DaVinci and OMAP directories, along
with some active development there:

 - Preparatory work from Morimoto-san for merging the audio-graph and
   audio-graph-scu cards.
 - A merge of the TI OMAP and DaVinci directories, the OMAP product line
   has been merged into the DaVinci product line so there is now a lot
   of IP sharing which meant that the split directories just got in the
   way.  This has pulled in a few architecture changes as well.
 - A big cleanup of the Maxim MAX9867 driver from Ladislav Michl.
 - Support for Asahi Kaesi AKM4118, AMD ACP3x, Intel platforms with
   RT5660, Meson AXG S/PDIF inputs, several Qualcomm IPs and Xilinx I2S
   controllers.
2018-12-18 14:59:56 +01:00
Mark Brown a7a850dba8
Merge branch 'asoc-4.21' into asoc-next 2018-12-18 12:23:59 +00:00
Srinivas Kandagatla ba02eed9f3
ALSA: soc-compress: add support to snd_compr_set_runtime_buffer()
Existing compress offload code allocates data buffers using simple kmalloc,
however there are situations where these buffers have to be mapped
in smmu. So provide a way to set the runtime buffer by the driver itself,
simillar to what we do with pcm.

This patch adds support to set runtime dma buffer on compressed stream.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-14 12:43:41 +00:00
Mark Brown 8fe8915b6c
Merge branch 'for-4.20' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-4.21 intel dep 2018-12-13 14:36:46 +00:00
Takashi Iwai 4f799e7340 ALSA: hda: Make snd_hdac_display_power() void function
After the recent refactoring, snd_hdac_display_power() doesn't return
any error, hence it can be defined to return void.
This makes many error checks redundant and allows us to reduce them
gracefully.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-11 08:18:25 +01:00
Takashi Iwai 029d92c289 ALSA: hda: Refactor display power management
The current HD-audio code manages the DRM audio power via too complex
redirections, and this seems even still unbalanced in a corner case as
Intel DRM CI has been intermittently reporting.  This patch is a big
surgery for addressing the complexity and the possible unbalance.

Basically the patch changes the display PM in the following ways:

- Both HD-audio controller and codec drivers call a single helper,
  snd_hdac_display_power().  (Formerly, the display power control from
  a codec was done indirectly via link_power bus ops.)

- snd_hdac_display_power() receives the codec address index.  For
  turning on/off from the controller, pass HDA_CODEC_IDX_CONTROLLER.

- snd_hdac_display_power() doesn't manage refcounts any longer, but
  keeps the power status in bitmap.  If any of controller or codecs is
  turned on, the function updates the DRM power state via get_power()
  or put_power().

Also this refactor allows us more cleanup:

- The link_power bus ops is dropped, so there is no longer indirect
  management, as mentioned in the above.

- hdac_device link_power_control flag is moved to hda_codec
  display_power_control flag, as it's only for HDA legacy.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106525
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-11 08:06:55 +01:00
Pierre-Louis Bossart 9923e9072d
ASoC: Intel: common: add ACPI matching tables for ICL
Entry needed for ICL RVP w/ RT274

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-03 12:02:13 +00:00
Takashi Iwai 5363857b91 ALSA: pcm: Fix interval evaluation with openmin/max
As addressed in alsa-lib (commit b420056604f0), we need to fix the
case where the evaluation of PCM interval "(x x+1]" leading to
-EINVAL.  After applying rules, such an interval may be translated as
"(x x+1)".

Fixes: ff2d6acdf6 ("ALSA: pcm: Fix snd_interval_refine first/last with open min/max")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-29 12:05:19 +01:00
Takashi Iwai b8e0be79d0 ASoC: Fixes for v4.20
Lots of fixes here, the majority of which are driver specific but
 there's a couple of core things and one notable driver specific one:
 
  - A core fix for a DAPM regression introduced during the component
    refactoring, we'd lost the code that forced a reevaluation of the
    DAPM graph after probe (which we suppress during init to save lots
    of recalcuation) and have now restored it.
  - A core fix for error handling using the newly added
    for_each_rtd_codec_dai_rollback() macro.
  - A fix for the names of widgets in the newly introduced pcm3060
    driver, merged as a fix so we don't have a release with legacy names.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlv9WBQTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0KeSB/9mrVVRe8hVg2ErfCEY8BaPGIdtNoBT
 IIRh/woXwbZEsY3owRuF5FeQxUbsRWLQL8fnzLFE7b6ltlRiPKahIGG0rIE0Xqcz
 jkvqR0Kvck1MLNjj8qyd72Eqv0uQmW5qoezY9eFJiWms5uIlbh+WR3KPFu4WkcnD
 9DHoYYq4ZU3EIqgt92QJ2uOWPwrSfueBcz6+bdYy11mSMuUtHz4HaAV8/XGFEjFy
 9uPeNmS4nTFxGXR5PzpxTP1mG7nYixq3J07iwXGTH/X3LDANmJCPgMgQQRnY6h1k
 KrtnZfcNljJxyYuNPV/A3ShG98Snbym17cq2zN1o9ZBUlPyxfGdRwrTd
 =NoTQ
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v4.20

Lots of fixes here, the majority of which are driver specific but
there's a couple of core things and one notable driver specific one:

 - A core fix for a DAPM regression introduced during the component
   refactoring, we'd lost the code that forced a reevaluation of the
   DAPM graph after probe (which we suppress during init to save lots
   of recalcuation) and have now restored it.
 - A core fix for error handling using the newly added
   for_each_rtd_codec_dai_rollback() macro.
 - A fix for the names of widgets in the newly introduced pcm3060
   driver, merged as a fix so we don't have a release with legacy names.
2018-11-27 16:06:42 +01:00
Kuninori Morimoto 2708bccf9c
ASoC: soc.h: makes snd_soc_of_parse_audio_prefix() inline
commit 3b7103562c ("ASoC: soc-core: add
snd_soc_of_parse_node_prefix()") maked snd_soc_of_parse_audio_prefix()
as #define. But it'd be better to make this a static inline rather than
a #define. It helps with error messages and type safety.
This patch makes it inline.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-26 12:23:22 +00:00
Kuninori Morimoto 3b7103562c
ASoC: soc-core: add snd_soc_of_parse_node_prefix()
Current ASoC has snd_soc_of_parse_audio_prefix() to get codec_conf
settings from DT which is used to avoid DAI naming conflict when
CPU/Codec matching.

Currently, it is parsing from "top node",
but, we want to parse from "each sub node" if sound card had multi
cpus/codecs.

This patch adds new snd_soc_of_parse_node_prefix() to allow parsing
settings from selected node.
It is keeping existing snd_soc_of_parse_audio_prefix() by using macro.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-23 14:01:47 +00:00
Kuninori Morimoto 33404f3f10
ASoC: simple_card_utils: remove "option" from asoc_simple_card_of_parse_routing()
asoc_simple_card_of_parse_routing() had "option" parameter
to consider error handling, but it is very pointless parameter.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-21 13:28:49 +00:00
Kuninori Morimoto a48bf02b35
ASoC: simple-card-utils: tidyup asoc_simple_card_parse_convert()
Current simple-card-utils has asoc_simple_card_parse_convert() to parse
convert channel/rate for be_hw_params_fixup.
But, it is parsing from top of node.

If sound card had multi subnode, we need to parse it from each sub node.
This patch tidyup asoc_simple_card_parse_convert() to allow parsing
settings from each node.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-21 13:28:34 +00:00
Pierre-Louis Bossart b92826fa8c
ASoC: Intel: fix interface for Chromebook machine drivers
The changes for HDaudio overlooked the fact that the machine drivers
used for Chromebooks rely on the dmic number information passed as
pdata.

Add dmic_num field to standard interface and use standard interface
instead of SKL-specific one.

Also clean-up pdata definition to remove fields that are no longer
used.

Fixes: 842bb5135f ('ASoC: Intel: use standard interface for Hdaudio machine driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-20 16:56:25 +00:00
Pierre-Louis Bossart 8679284b37
ASoC: acpi: define common interface for machine driver configuration
The machine drivers may need information provided by the platform
driver.  Currently the information is passed using pdata specific to
each plaform driver. This prevents other drivers, such as SOF, from
reusing machine drivers directly.

Add a new structure which contains the required fields.

This proposal requires a bit more work on the platform side but this
generic interface helps reuse code directly.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-06 17:23:33 +00:00
Arnd Bergmann 576ce4075b
ASoC: wm97xx: fix uninitialized regmap pointer problem
gcc notices that without either the ac97 bus or the pdata, we never
initialize the regmap pointer, which leads to an uninitialized variable
access:

sound/soc/codecs/wm9712.c: In function 'wm9712_soc_probe':
sound/soc/codecs/wm9712.c:666:2: error: 'regmap' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since that configuration is invalid, it's better to return an error
here. I tried to avoid adding complexity to the conditions, and turned
the #ifdef into a regular if(IS_ENABLED()) check for readability.
This in turn requires moving some header file declarations out of
an #ifdef.

The same code is used in three drivers, all of which I'm changing
the same way.

Fixes: 2ed1a8e0ce ("ASoC: wm9712: add ac97 new bus support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-05 10:37:39 +00:00
Pierre-Louis Bossart 23cb2d04db
ASoC: fix oops w/ for_each_rtd_codec_dai_rollback() macro
A kernel oops happens on an error case (usual missing BE mixer
configuration required by Intel SST driver). Git bisect points to this
macro and an operator precedence issue.

	for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)

The initial code replaced by this macro was
	while (--i >= 0) {
		codec_dai = rtd->codec_dais[i];

Fix the C operator precedence difference by reverting to pre-decrement

Fixes: 0b7990e389 ('ASoC: add for_each_rtd_codec_dai() macro')
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-30 15:31:11 +00:00
Takashi Iwai 5e3cdecf78 ASoC: Updates for v5.0/v4.20
As ever there's a lot of small and driver specific changes going on
 here, but we do also have some relatively large changes in the core
 thanks to the hard work of Charles and Morimoto-san:
 
  - More component transitions from Morimoto-san, I think we're about
    finished with this.  Thanks for all the hard work!
  - Morimoto-san also added a bunch of for_each_foo macros
  - A bunch of cleanups and fixes for DAPM from Charles.
  - MCLK support for several different devices, including CS42L51, STM32
    SAI, and MAX98373.
  - Support for Allwinner A64 CODEC analog, Intel boards with DA7219 and
    MAX98927, Meson AXG PDM inputs, Nuvoton NAU8822, Renesas R8A7744 and
    TI PCM3060.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlvNuPoTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0CsxB/91P2RgcUhBSkPO3jsFSerc+RccqD8j
 XogqjC62V2T3xqVUYtqqLf0dZFKUPFNoFitN2XdNU36H55DVI+3wxxmwObc64RIc
 uB6ptQuwFz7vGeF6r6GWFUAZ7MB518dq/oZYRKrjAW49Lt2YiCD0HJ2gi+0Hm66A
 53I7SLH3Q386UHDd+dl7+9BN7gPt0OIKAdsc/Vq7BDYvP+cNEm+YYjXGwaHjLLEC
 o8vmj8Ny6x0dytdYuQ/XuekBhGopcfqTbWTpTu43/jCd5rumQXQY2g9CC1eRMlEJ
 cm1hOjAErmKkkg2S84B1cMAvK23Szu36sPyeCphSQWOhlL4CFPVyJqic
 =9A07
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v5.0' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v5.0/v4.20

As ever there's a lot of small and driver specific changes going on
here, but we do also have some relatively large changes in the core
thanks to the hard work of Charles and Morimoto-san:

 - More component transitions from Morimoto-san, I think we're about
   finished with this.  Thanks for all the hard work!
 - Morimoto-san also added a bunch of for_each_foo macros
 - A bunch of cleanups and fixes for DAPM from Charles.
 - MCLK support for several different devices, including CS42L51, STM32
   SAI, and MAX98373.
 - Support for Allwinner A64 CODEC analog, Intel boards with DA7219 and
   MAX98927, Meson AXG PDM inputs, Nuvoton NAU8822, Renesas R8A7744 and
   TI PCM3060.
2018-10-22 23:26:37 +02:00
Takashi Iwai 6aea5702e2 ALSA: rawmidi: A lightweight function to discard pending bytes
For discarding the pending bytes on rawmidi, we process with a loop of
snd_rawmidi_transmit() which is just a waste of CPU power.
Implement a lightweight API function to discard the pending bytes and
the proceed the ring buffer instantly, and use it instead of open
codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-04 20:13:17 +02:00
Takashi Iwai 4a9a72e0db Merge branch 'for-linus' into for-next
Back-merge 4.19-devel branch into 4.20 for applying FireWire patches
cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-04 07:53:06 +02:00
Kuninori Morimoto 15a0c64572
ASoC: add for_each_component_dais() macro
To be more readable code, this patch adds
new for_each_component_dais() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-21 10:12:44 -07:00
Kuninori Morimoto 8d6258a4dd
ASoC: add for_each_dpcm_be() macro
To be more readable code, this patch adds
new for_each_dpcm_be() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:31:20 -07:00
Kuninori Morimoto d2e24d6465
ASoC: add for_each_dpcm_fe() macro
To be more readable code, this patch adds
new for_each_dpcm_fe() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:31:19 -07:00
Kuninori Morimoto 1a1035a985
ASoC: add for_each_comp_order() macro
To be more readable code, this patch adds
new for_each_comp_order() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:31:18 -07:00
Kuninori Morimoto f70f18f7d4
ASoC: add for_each_card_components() macro
To be more readable code, this patch adds
new for_each_card_components() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:22:58 -07:00
Kuninori Morimoto bcb1fd1fcd
ASoC: add for_each_card_rtds() macro
To be more readable code, this patch adds
new for_each_card_rtds() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:21:28 -07:00
Kuninori Morimoto 98061fdbfc
ASoC: add for_each_card_links() macro
To be more readable code, this patch adds
new for_each_card_links() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:20:02 -07:00
Kuninori Morimoto 7fe072b4df
ASoC: add for_each_card_prelinks() macro
To be more readable code, this patch adds
new for_each_card_prelinks() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:18:34 -07:00
Kuninori Morimoto 6d11b12879
ASoC: rename for_each_rtd_codec_dai_reverse to rollback
commit 0b7990e389 ("ASoC: add for_each_rtd_codec_dai() macro")
added for_each_rtd_codec_dai_reverse(). but _rollback() is better
naming than _reverse(). This patch rename it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-20 10:17:05 -07:00
Mark Brown 90fbeb0cab
Merge branch 'asoc-4.19' into asoc-4.20 for rt5682 deps. 2018-09-18 10:30:14 -07:00
Takashi Iwai 196f4eeeb7 ASoC: Fixes for v4.19
This is the usual set of small fixes scatterd around various drivers,
 plus one fix for DAPM and a UAPI build fix.  There's not a huge amount
 that stands out here relative to anything else.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluf2AQTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0BojB/9ZpiRgSSjKTFSmGgu3OFI7Nvj63ruB
 hxOnwOc8Bea8tZtpzgEcx/aLZ1sbWVT4uRUYZv0Tf6UJtuOQagbJDEUkUdRitKtX
 1khSMyKFlAa7cIbv19ZOMCN0pjcs7hlHCPryT8AyCWCWN8yPdlUsDqWfyfUoq56r
 qpdu/OQ4E9VvS8OcX1gPjcop3gE/fYEoU+mbUpr0KYUXaroEzJm85tOqpGYk4+XW
 GCNUR19vNRJr5G6ANqIx96JOlgF5nRZu7aOfvLceiWH5BgPdW3iNRAJkPmKCIHwb
 a1+X21eCC7Ec2/7bQmR5Aoxz1yqzhngrevSFNLrqXFZmMmNrEfkfdCrJ
 =gVzO
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v4.19

This is the usual set of small fixes scatterd around various drivers,
plus one fix for DAPM and a UAPI build fix.  There's not a huge amount
that stands out here relative to anything else.
2018-09-17 18:59:21 +02:00
Yu Zhao 75383f8d39
sound: don't call skl_init_chip() to reset intel skl soc
Internally, skl_init_chip() calls snd_hdac_bus_init_chip() which
1) sets bus->chip_init to prevent multiple entrances before device
is stopped; 2) enables interrupt.

We shouldn't use it for the purpose of resetting device only because
1) when we really want to initialize device, we won't be able to do
so; 2) we are ready to handle interrupt yet, and kernel crashes when
interrupt comes in.

Rename azx_reset() to snd_hdac_bus_reset_link(), and use it to reset
device properly.

Fixes: 60767abcea ("ASoC: Intel: Skylake: Reset the controller in probe")
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-12 11:22:09 +01:00
Srinivas Kandagatla e894efef9a
ASoC: core: add support to card rebind
Current behaviour of ASoC core w.r.t to component removal is that it
unregisters dependent sound card totally. There is no support to
rebind the card if the component comes back.
Typical use case is DSP restart or kernel modules itself.

With this patch, core now maintains list of cards that are unbind due to
any of its depended components are removed and card not unregistered yet.
This list is cleared when the card is rebind successfully or when the
card is unregistered from machine driver.

This list of unbind cards are tried to bind once again after every new
component is successfully added, giving a fair chance for card bind
to be successful.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-12 11:09:04 +01:00
Kuninori Morimoto 4f1b327e65
ASoC: soc-core: remove unused num_dai_links
ALSA SoC is counting card->dai_link_list user,
but no-one is using it.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-11 17:18:39 +01:00
Charles Keepax 243bcfafcd
ASoC: dapm: Move CODEC to CODEC params from the widget to the runtime
Larger CODECs may contain many several hundred widgets and which set of
parameters is selected only needs to be recorded on a per DAI basis. As
such move the selected CODEC to CODEC link params to be stored in the
runtime rather than the DAPM widget, to save some memory.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-05 17:11:32 +01:00
Charles Keepax 778ff5bb86
ASoC: dapm: Move connection of CODEC to CODEC DAIs
Currently, snd_soc_dapm_connect_dai_link_widgets connects up the routes
representing normal DAIs, however CODEC to CODEC links are hooked up
through separate infrastructure in soc_link_dai_widgets. Improve the
consistency of the code by using snd_soc_dapm_connect_dai_link for both
types of DAIs.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-05 17:11:25 +01:00
Kuninori Morimoto 0b7990e389
ASoC: add for_each_rtd_codec_dai() macro
ALSA SoC snd_soc_pcm_runtime has snd_soc_dai array for codec_dai.
To be more readable code, this patch adds
new for_each_rtd_codec_dai() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-04 16:59:11 +01:00
Kuninori Morimoto 3db769f177
ASoC: add for_each_link_codecs() macro
ALSA SoC snd_soc_dai_link has snd_soc_dai_link_component array
for codecs.
To be more readable code, this patch adds
new for_each_link_codecs() macro, and replace existing code to it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-04 16:59:11 +01:00
Kuninori Morimoto 868cdb4690
ASoC: simple-card-util: support snd_soc_dai_link_component style for platform
Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple-card-util for platform.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-31 15:58:43 +01:00
Kuninori Morimoto daecf46ee0
ASoC: soc-core: use snd_soc_dai_link_component for platform
Current struct snd_soc_dai_link is supporting multicodec,
and it is supporting legacy style of
	codec_name
	codec_of_node
	code_dai_name
This is handled as single entry of multicodec.

We don't have multicpu support yet, but in the future we will.
In such case, we can use snd_soc_dai_link_component for both
cpu/codec. Then the code will be more simple and readble.

As next step, we want to use it for platform, too.
This patch adds snd_soc_dai_link_component style for platform.
We might have multiplatform support in the future, but we
don't know yet. To avoid un-known issue / complex code,
this patch supports just single-platform as 1st step.

If we could use snd_soc_dai_link_component for all CPU/Codec/Platform,
we will switch to new style, and remove legacy code.
This is prepare for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-31 15:58:39 +01:00
Kuninori Morimoto e664de680b
ASoC: simple_card_utils: support snd_soc_dai_link_component style for codec
Current ASoC is supporting snd_soc_dai_link_component for binding,
it is more useful than current legacy style.
Currently only codec is supporting it as multicodec (= codecs).
CPU will support multi style in the future.
We want to have it on Platform too in the future.

If all Codec/CPU/Platform are replaced into snd_soc_dai_link_component
style, we can remove legacy complex style.
This patch supports snd_soc_dai_link_component style
for simple_card_utils for codec.

[current]
struct snd_soc_dai_link {
	...
	*cpu_name;
	*cpu_of_node;
	*cpu_dai_name;

	*codec_name;
	*codec_of_node;
	*codec_dai_name;
	*codecs;
	num_codecs;

	*platform_name;
	*platform_of_node;
	...
}

[in the future]
struct snd_soc_dai_link {
	...
	*cpus
	num_cpus;

	*codecs;
	num_codecs;

	*platform;
	...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-31 15:58:07 +01:00
Takashi Iwai 56e91b1268 ALSA: Move hda_codec.h to include/sound
For easier sharing with ASoC.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluIAxkTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0NVNB/0cE/j09cyBR80x5gvnFE3Z5NEPNPLP
 yl7sD93xFP6iww3CGJjXgxxDTh2sf7Sro4hcR9ZdD9zSSQ1qMVVY28MJ1YUsbFPu
 TeUkqRFNPjgOpSmwK7T5QpVbIvdTZmmht8umgQ2+Y4vsGu1aKZf80ZT2n/2mjTOe
 bEYfpyjP5V1aVL8JcX4TN3hbGZ2Pth5m404Qe0pkIdv4qqLx2edphJQ7ecU8w3kK
 vTg1gfo7j9CKx7rzHZei/cvA3qXl/g9oufHAfpJDrlYFz6N35qwpA5UCyXqcFVo2
 kZtyFbaBAvBjnhVyMNkdG7PvBMlL6HMLxN3fJbMLPPS30/+IuAsHXkZY
 =wtBB
 -----END PGP SIGNATURE-----

Merge tag 'hda-codec-h-move' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ALSA: Move hda_codec.h to include/sound

For easier sharing with ASoC.
2018-08-30 16:55:38 +02:00
Pierre-Louis Bossart be57bfffb7
ALSA: hda: move hda_codec.h to include/sound
As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-30 15:45:10 +01:00
Pierre-Louis Bossart 8dce1d026d
ASoC: Intel: common: add table for HDA-based platforms
Expose a table containing machine driver information for HDAudio-based
platforms handled by ASoC on Intel hardware.

We only set constant values that are valid across multiple
platforms. The firmware name used by the DSP will be set dynamically
for each platform.

The table is made of a single entry for now, if we need more
complicated set-up where HDAudio is mixed with ACPI-enumerated devices
(I2C, SoundWire) then we'd expect the differentiation to be handled
through information provided by the BIOS (as done for KBL
Chromebooks).

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-28 20:18:07 +01:00
Pierre-Louis Bossart b4af16d617
ALSA: hda: move hda_codec.h to include/sound
As suggested by Takashi, move this header file to make it easier
to include from e.g. the Intel Skylake driver in follow-up patches

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-28 20:18:06 +01:00
Mark Brown 6e2d6b2728 Linux 4.19-rc1
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAluDF64eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGoX0H/3Vc+MxU4CdAr8s6
 HhAHALmNwgvmYraEzsjGCSqtMXX0H7ni3XonWjm66WMigQi9ypESJgTFGryLECO3
 csLk+BSVWF/L0zliA+orsywMkTRiwwbLsU0gC1Af/pIs3HwuydPAUVuk2cU4eaoh
 sVXpiKopA4FifUuar8mMNhvMbggOYMZ3fdMqhGXTQBcsCPgX6DRB8I9wAN1ONfLU
 bx5ZPrcn4NqQrqHjnG1YVBg5ZRBnTG7UxmBBWRwwSJnqsHs9bmCAq1dTpdxS4HYF
 yw1XelQ9K/u2+JyYoch1fxE8hk8Kj7xB+2BcJImoV0Fms5llDZssBlLgeusQWSU0
 MJQivyk=
 =XPLb
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAluFjq4THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0F+uB/9dBMK45nI1jEMamtVsEfTFv+3TKH7/
 GBxmFMxDs2wo0njQeetYxUtGqHBOIf30pYgrLOiKvvtFufZlhok3iVduDgYTr+aY
 X1QxTvVH3piQpvp1j/5TmFSfUKaxRIw+1ghsdSCaBB4BlhSyQz46NuzwaOp6gaZ3
 rjVfigycorGwCEM9/QiiynTJm09jmC+mrQ5i6QpqFgaYJtNXamXK6d+NbsHk2pxt
 jfas4P58M9Us8sUBRDWiq17jFFd9z+qvj8BsDgwEB5R4EAzNvQOavzIZUQhpOb2r
 uYQdgeVsqXI51ON+BhbPfsFHPfoe0TSiwBxz/mgM7rpaMh8l3XbiX6f0
 =dl9F
 -----END PGP SIGNATURE-----

Merge tag 'v4.19-rc1' into asoc-4.19

Linux 4.19-rc1
2018-08-28 19:03:57 +01:00
Takashi Iwai 42e748a0b3 ALSA: memalloc: Add non-cached buffer type
In some cases (mainly for x86), we need the DMA coherent buffer with
non-cached pages.  Although this has been done in each driver side
like HD-audio and intel8x0, it can be done cleaner in the core memory
allocator.

This patch adds the new types, SNDRV_DMA_TYPE_DEV_UC and
SNDRV_DMA_TYPE_DEV_UC_SG, for allocating such non-cached buffer
pages.  On non-x86 architectures, they work as same as the standard
SNDRV_DMA_TYPE_DEV and *_SG.

One additional change by this move is that we can assure to pass the
non-cached pgprot to the vmapped buffer, too.  It eventually fixes the
case like non-snoop mode without mmap access on HD-audio.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-28 13:56:47 +02:00
Charles Keepax 249dc49576
ASoC: dapm: Fix NULL pointer deference on CODEC to CODEC DAIs
Commit a655de808c ("ASoC: core: Allow topology to override
machine driver FE DAI link config.") caused soc_dai_hw_params to
be come dependent on the substream private_data being set with
a pointer to the snd_soc_pcm_runtime. Currently, CODEC to CODEC
links don't set this, which causes a NULL pointer dereference:

[<4069de54>] (soc_dai_hw_params) from
[<40694b68>] (snd_soc_dai_link_event+0x1a0/0x380)

Since the ASoC core in general assumes that the substream
private_data will be set to a pointer to the snd_soc_pcm_runtime,
update the CODEC to CODEC links to respect this.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-15 15:52:20 +01:00
Takashi Iwai f5b6c1fcb4 ASoC: Updates for v4.19
A fairly big update, including quite a bit of core activity this time
 around (which is good to see) along with a fairly large set of new
 drivers.
 
  - A new snd_pcm_stop_xrun() helper which is now used in several
    drivers.
  - Support for providing name prefixes to generic component nodes.
  - Quite a few fixes for DPCM as it gains a bit wider use and more
    robust testing.
  - Generalization of the DIO2125 support to a simple amplifier driver.
  - Accessory detection support for the audio graph card.
  - DT support for PXA AC'97 devices.
  - Quirks for a number of new x86 systems.
  - Support for AM Logic Meson, Everest ES7154, Intel systems with
    RT5682, Qualcomm QDSP6 and WCD9335, Realtek RT5682 and TI TAS5707.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAltxVZsTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0CtwB/0U+IUWLlojWD6RDfueycvc9TiZW0t4
 gBT3OD8f4oif0MuMy6oE2ag8JPNU8n5MnO14U366GDaEyZPj79W7f50Q8Nnyht/n
 py6fQfyo7Ec2hFJstDI42KvDymTbAer6hnAUJarr/FdZHdGeOfYV+s7aHp5aEQAS
 KACnX8qWo87VePouNBorqWXWueAJTb6zpWy7YQ1KGb/pJIAeue2Y9pLRGXQos1BS
 E1AP+ge2BMnz7BeiCgw/39hN6X545nJ1fcZKuIu8Gqy9ahqEDHgmBWPAehtGnfVj
 D8JPplTaBFtAsJwi18b7ApWtcytpizPPN/l3NTA4fTRJQe9kxfDmnE7b
 =fvKX
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v4.19

A fairly big update, including quite a bit of core activity this time
around (which is good to see) along with a fairly large set of new
drivers.

 - A new snd_pcm_stop_xrun() helper which is now used in several
   drivers.
 - Support for providing name prefixes to generic component nodes.
 - Quite a few fixes for DPCM as it gains a bit wider use and more
   robust testing.
 - Generalization of the DIO2125 support to a simple amplifier driver.
 - Accessory detection support for the audio graph card.
 - DT support for PXA AC'97 devices.
 - Quirks for a number of new x86 systems.
 - Support for AM Logic Meson, Everest ES7154, Intel systems with
   RT5682, Qualcomm QDSP6 and WCD9335, Realtek RT5682 and TI TAS5707.
2018-08-13 12:12:31 +02:00
Srinivas Kandagatla 611cbc8799
ASoC: core: remove support for card rebind using component framework
DRM based audio components get registered inside the component framework
bind callback. However component framework has a big mutex lock taken for
every call to component_add, component_del and bind, unbind callbacks.

This can lead to deadlock situation if we are trying to add new/remove
component within a bind/unbind callbacks. Which is what was happening
with bcm2837 rpi 3.

Revert this change till we sort out the mutex issue.

Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-02 17:19:46 +01:00
Kuninori Morimoto fdec79c18b
ASoC: fsi: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-02 10:56:59 +01:00
Takashi Iwai ef965ad5a7 ALSA: seq: Minor cleanup of MIDI event parser helpers
snd_midi_event_encode_byte() can never fail, and it can return rather
true/false.  Change the return type to bool, adjust the argument to
receive a MIDI byte as unsigned char, and adjust the comment
accordingly.  This allows callers to drop error checks, which
simplifies the code.

Meanwhile, snd_midi_event_encode() helper is used only in seq_midi.c,
and it can be better folded into it.  This will reduce the total
amount of lines in the end.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-01 22:54:35 +02:00
Mark Brown a0b5031582
Merge branch 'topic/drm_audio_component' of https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into asoc-4.19 2018-08-01 10:32:05 +01:00
Takashi Iwai 89b4ab213f ALSA: seq: virmidi: Use READ_ONCE/WRITE_ONCE() macros
The trigger flag in vmidi object can be referred in different contexts
concurrently, hence it's better to be put with READ_ONCE() and
WRITE_ONCE() macros to assure the accesses.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-30 14:52:30 +02:00
Takashi Iwai f7debfe540 ALSA: seq: virmidi: Offload the output event processing
The virmidi sequencer stuff tries to translate the rawmidi bytes to
sequencer events and deliver the packets at trigger callback.  The
amount of the whole process of these translations and deliveries
depends on the incoming rawmidi bytes, and we have no limit for that;
this was the cause of a CPU soft lockup that had been reported and
fixed recently.

Although we've fixed the soft lockup by putting the temporary unlock
and cond_resched(), it's rather a quick band aid.  In this patch,
meanwhile, the event parsing and delivery process is offloaded to a
dedicated work, and the trigger callback just kicks it off.  It has
three merits, at least:

- The processing is always done in a sleepable context, which can
  assure the event delivery with non-atomic flag without hackish
  is_atomic() usage.

- Other relevant codes can be simplified, reducing the lines

- It makes me happier

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-30 14:51:51 +02:00
Takashi Iwai 345a9ca37a
ALSA: memalloc: Fix missing PAGE_SIZE definition
The recent fix moved the inline snd_sgbuf_aligned_pages() outside the
ifdef, and this triggered a build error on some architectures due to
the undefined PAGE_SIZE, as spotted by 0day bot.
Fix it by adding the missing header inclusion.

Fixes: 4cae99d9b5 ("ALSA: memalloc: declare snd_sgbuf_aligned_pages() unconditionally")
Reported-by: kbuild test robot <lkp@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-30 12:02:24 +01:00
Takashi Iwai e5d3765b6c ALSA: sb: Fix sparse warning wrt PCM format type
The PCM format type is with __bitwise, and it can't be converted from
integer implicitly.  Instead of an ugly cast, declare the function
argument of snd_sb_csp_autoload() with the proper snd_pcm_format_t
type.

This fixes the sparse warnings like:
  sound/isa/sb/sb16_csp.c:743:22: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-27 09:05:33 +02:00
Takashi Iwai a6ea5fe95a ALSA: hda: Fix implicit PCM format type conversion
The PCM format type is defined with __bitwise, hence it can't be
passed as integer but needs an explicit cast.  In this patch, instead
of the messy cast flood, define the format argument of
snd_hdac_calc_stream_format() to be the proper snd_pcm_format_t type.

This fixes sparse warnings like:
  sound/hda/hdac_device.c:760:38: warning: incorrect type in argument 1 (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-27 09:05:24 +02:00
Takashi Iwai 0b62834e73
ALSA: pcm: Add snd_mask_set_format() helper for standard usages
Many drivers calling snd_mask_set() need to do ugly cast with __force
for shutting up the sparse warnings.  Actually almost all of them are
about setting the format, so it's far better to provide a common
helper snd_mask_set_format() to pass SNDRV_PCM_FORMAT_* directly
without the cast.

There are a few other calls of snd_mask_set(), but they are in the PCM
core code, so we leave them for now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26 17:09:04 +01:00
Mark Brown fd56361177 ALSA: memalloc: declare snd_sgbuf_aligned_pages() unconditionally
Make this helper inline function available for all platforms. This
 helps solve 0-day compilation issues when CONFIG_SND_DMA_SGBUF is not
 defined.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAltZ8WYTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0CFPB/9dor5jPnP7uCj0ukCGHvWoVy4t4HBF
 gfHE8ida6iG8Wbxiu9IlP5UfjqnAhOzirwhVQwLTSSykg9pvqx9mqe84Hi0BU2V/
 g/ojqw3uY902BNpGn4DaMgaHyf9RwG0ZUdm//7XNqjKwMySPrJK+CrDqFXSJLkvZ
 xjALUiU2LW5POAeZEuP3N4zz5a18aNaaMVrBCVtV39WWKxRdUm96SGVw7V9DLipB
 qq7GR9wRcazUEn1MhorU9WXsfQYSxpCWH2MqLttMwk574CWo/gMHZyTrJtf+lFxX
 OOCH2wN6qWE2gXEFG/aCnfKS1TzWlkIlvx035QGBUAmvGXoVNvSqHhzS
 =FsV/
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAltZ8g0THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0MydB/98q4L86WvguNo0OsJ1NuUbyqUBaT4p
 +niwGJbcoYuKT1wx8D4jaGUo+UdNHsuRHSDWUbqdMhfkc+UBK+QrdF8MHVSW2Bie
 w/5OYkKiVPXHYM3ISdcpNqDPe9Of1IRJwHQ6WANOQ5dk3WLgvD/dNiN6tvjrJkhg
 /bcrKkCCbWaK+69rlNwMaOu43LDED102aQbbyeT5Rdhm/xXCRQgohGQwYV32wJAv
 sT4ZVzRkFEemc+cecD7fvCx8phSYRWA0qkso/mTog1Cx7u/Y06oVFnIHllq/68VR
 McGran3+XYee1Fdkj2aTCEQ8Ra214fAcdJ2t2UkgrSAX4jJZ4ry0tKfh
 =QfMT
 -----END PGP SIGNATURE-----

Merge tag 'alsa-add-snd-sgbuf-aligned-pages' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-4.19

ALSA: memalloc: declare snd_sgbuf_aligned_pages() unconditionally

Make this helper inline function available for all platforms. This
helps solve 0-day compilation issues when CONFIG_SND_DMA_SGBUF is not
defined.
2018-07-26 17:08:39 +01:00
Pierre-Louis Bossart 4cae99d9b5
ALSA: memalloc: declare snd_sgbuf_aligned_pages() unconditionally
Make this helper inline function available for all platforms. This
helps solve 0-day compilation issues when CONFIG_SND_DMA_SGBUF is not
defined.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26 17:05:29 +01:00
Takashi Iwai 95a48b7d44 ALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()
The snd_pcm_lib_read() and snd_pcm_lib_write() inline functions have
the explicit cast from a user pointer to a kernel pointer, but they
lacks of __force prefix.

This fixes sparse warnings like:
  ./include/sound/pcm.h:1093:47: warning: cast removes address space of expression

Fixes: 6854121372 ("ALSA: pcm: Direct in-kernel read/write support")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-26 08:32:13 +02:00
Srinivas Kandagatla 467b061f1a
ASoC: core: add support to snd_soc_dai_get_channel_map()
On Qualcomm platforms, specifically with SLIMbus interfaced codecs,
the codec slim channel numbers are passed to DSP while configuring
the slim audio path. Having get_channel_map() would allow dais to
share such information across multiple dais.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-24 12:06:43 +01:00
Jerome Brunet cbdfab3b67
ASoC: export snd_soc_of_get_slot_mask
Amlogic's axg card driver can't use snd_soc_of_parse_tdm_slot()
directly because it needs to handle 4 mask for each direction.
Yet the parsing of each mask is the same, so export
snd_soc_of_get_slot_mask() to reuse the the existing code.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-20 17:39:26 +01:00
Takashi Iwai 7abeb64da6 Merge branch 'topic/drm_audio_component' into for-next
Pull the generic drm_audio_component support, which will be used later
for AMD/ATI and other HD-audio HDMI codec drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-19 20:48:14 +02:00
Srinivas Kandagatla bb4b894add
ASoC: core: add support to card re-bind using component framework
This patch aims at achieving dynamic behaviour of audio card when
the dependent components disappear and reappear.

With this patch the card is removed if any of the dependent component
is removed and card is added back if the dependent component comes back.
All this is done using component framework and matching based on
component name.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-18 13:08:15 +01:00
Takashi Iwai fa84cf094e ALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc()
snd_pcm_lib_mmap_vmalloc() was supposed to be implemented with
somewhat special for vmalloc handling, but in the end, this turned to
just the default handler, i.e. NULL.  As the situation has never
changed over decades, let's rip it off.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-18 08:24:29 +02:00
Takashi Iwai a57942bfdd ALSA: hda: Make audio component support more generic
This is the final step for more generic support of DRM audio
component.  The generic audio component code is now moved to its own
file, and the symbols are renamed from snd_hac_i915_* to
snd_hdac_acomp_*, respectively.  The generic code is enabled via the
new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
kept as the super-class.

Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and
the widget id, and master_bind/master_unbin are called at binding /
unbinding the master component, respectively.  All these are optional,
but used in i915 implementation and also other later implementations.

A note about the new snd_hdac_acomp_init() function: there is a slight
difference between this and the old snd_hdac_i915_init().  The latter
(still) synchronizes with the master component binding, i.e. it
assures that the relevant DRM component gets bound when it returns, or
gives a negative error.  Meanwhile the new function doesn't
synchronize but just leaves as is.  It's the responsibility by the
caller's side to synchronize, or the caller may accept the
asynchronous binding on the fly.

v1->v2: Fix missing NULL check in master_bind/unbind

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-17 22:25:48 +02:00
Takashi Iwai 82887c0beb ALSA: hda/i915: Associate audio component with devres
The HD-audio i915 binding code contains a single pointer, hdac_acomp,
for allowing the access to audio component from the master bind/unbind
callbacks.  This was needed because the callbacks pass only the device
pointer and we can't guarantee the object type assigned to the drvdata
(which is free for each controller driver implementation).
And this implementation will be a problem if we support multiple
components for different DRM drivers, not only i915.

As a solution, allocate the audio component object via devres and
associate it with the given device, so that the component callbacks
can refer to it via devres_find().

The removal of the object is still done half-manually via
devres_destroy() to make the code consistent (although it may work
without the explicit call).

Also, the snd_hda_i915_register_notifier() had the reference to
hdac_acomp as well.  In this patch, the corresponding code is removed
by passing hdac_bus object to the function, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-17 22:25:47 +02:00
Takashi Iwai ae891abe7c drm/i915: Split audio component to a generic type
For allowing other drivers to use the DRM audio component, rename the
i915_audio_component_* with drm_audio_component_*, and split the
generic part into drm_audio_component.h.  The i915 specific stuff
remains in struct i915_audio_component, which contains
drm_audio_component as the base.

The license of drm_audio_component.h is kept to MIT as same as the the
original i915_component.h.

This is a preliminary change for further development, and no
functional changes by this patch itself, merely code-split and
renames.

v1->v2: Use SPDX for drm_audio_component.h, fix remaining i915
        argument in drm_audio_component.h

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-17 22:25:19 +02:00
Jerome Brunet baacd8d100
ASoC: dpcm: add rate merge to the BE stream merge
As done for format and channels, add the possibility to merge
the backend rates on the frontend rates.

This useful if the backend does not support all rates supported by the
frontend, or if several backends (cpu and codecs) with different
capabilities are connected to the same frontend.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-11 11:58:41 +01:00
Liam Girdwood d64c5cf8e8 ALSA: pcm: Allow drivers to set R/W wait time.
Currently ALSA core blocks userspace for about 10 seconds for PCM R/W IO.
This needs to be configurable for modern hardware like DSPs where no
pointer update in milliseconds can indicate terminal DSP errors.

Add a substream variable to set the wait time in ms. This allows userspace
and drivers to recover more quickly from terminal DSP errors.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-06 15:00:25 +02:00
Liam Girdwood a655de808c
ASoC: core: Allow topology to override machine driver FE DAI link config.
Machine drivers statically define a number of DAI links that currently
cannot be changed or removed by topology. This means PCMs and platform
components cannot be changed by topology at runtime AND machine drivers
are tightly coupled to topology.

This patch allows topology to override the machine driver DAI link config
in order to reuse machine drivers with different topologies and platform
components. The patch supports :-

1) create new FE PCMs with a topology defined PCM ID.
2) destroy existing static FE PCMs
3) change the platform component driver.
4) assign any new HW params fixups.
5) assign a new card name prefix to differentiate this topology to userspace.

The patch requires no changes to the machine drivers, but does add some
platform component flags that the platform component driver can assign
before loading topologies.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-03 16:38:29 +01:00
Takashi Iwai 51d7d35817 Merge branch 'topic/hda-core-intel' into for-next
Merge the development branch for HD-audio ext bus refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-03 12:51:31 +02:00
Kuninori Morimoto 1a8f0a3c13
ASoC: ac97: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:56:09 +01:00
Kuninori Morimoto 1356a6071c
ASoC: soc-generic-dmaengine-pcm: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:52 +01:00
Kuninori Morimoto b3ed4c86a7
ASoC: soc-compress: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:47 +01:00
Kuninori Morimoto f2b6a1b25f
ASoC: soc-topology: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:42 +01:00
Kuninori Morimoto c01f3af4d3
ASoC: soc-dapm: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:38 +01:00
Kuninori Morimoto 873486ed4a
ASoC: soc-core: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:32 +01:00
Kuninori Morimoto 7730bb13c7
ASoC: soc-acpi: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:27 +01:00
Kuninori Morimoto b53c34b4b7
ASoC: soc-dpcm.h: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:55:05 +01:00
Kuninori Morimoto e2cfd2c967
ASoC: soc-dai.h: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:54:26 +01:00
Kuninori Morimoto d613a7f45e
ASoC: simple-card-utils: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:52:52 +01:00
Kuninori Morimoto d573454d9b
ASoC: simple-card: convert to SPDX identifiers
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-02 10:52:47 +01:00
Daniel Mack 7afd1b0b2e
ASoC: pxa: move some functions to pxa2xx-lib
To get rid of some intermediate platform layers, move pxa2xx_soc_pcm_new()
and pxa2xx_pcm_ops in pxa2xx-lib.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-29 12:05:04 +01:00
Daniel Mack a7160670b5
ASoC: pxa: clean up function names in pxa2xx-lib
Clean up the namespace a bit and drop the __ prefix of all functions
exported by pxa2xx-lib. This improves the readability of the code.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-29 12:05:03 +01:00
Rakesh Ughreja cb04ba3318 ALSA: hdac: add extended ops in the hdac_bus
Add extended ops in the hdac_bus to allow calling the ASoC HDAC library
ops to reuse the legacy HDA codec drivers with ASoC framework.
Extended ops are used by the legacy codec drivers to call into
hdac_hda library, in the subsequent patches..

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-28 07:33:29 +02:00
Rakesh Ughreja 6298542fa3 ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
Remove memory allocation within snd_hdac_ext_bus_device_init, to make
its behaviour identical to snd_hdac_bus_device_init. So that caller
can allocate the parent data structure containing hdac_device.
This API change helps in reusing the legacy HDA codec drivers with
ASoC platform drivers.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-28 07:33:29 +02:00
Rakesh Ughreja e1df9317cb ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
This patch removes the hdac_ext_driver structure. The legacy and
enhanced HDaudio capabilities can be handled in a backward-compatible
way without separate definitions.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-28 07:33:29 +02:00
Rakesh Ughreja 76f56fae1c ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
This patch removes the hdac_ext_bus structure. The legacy and
enhanced HDaudio capabilities can be handled in a backward-compatible
way without separate definitions.

Follow-up patches in this series handle the driver definition.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-28 07:33:29 +02:00
Rakesh Ughreja 3787a39852 ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
This patch removes the hdac_ext_device structure. The legacy and
enhanced HDaudio capabilities can be handled in a backward-compatible
way without separate definitions.

Follow-up patches in this series handle the bus and driver definitions.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-28 07:33:29 +02:00
Takashi Iwai feb20faec7 ALSA: hda - Move in_pm accessors to HDA core
The in_pm atomic in hdac_device is an important field used as a flag
as well as a refcount for PM.  The existing snd_hdac_power_up/down
helpers already refer to it in the HD-audio core code, while the code
to actually setting the value (atomic_inc() / _dec()) is open-coded in
HDA legacy side, which is hard to find.

This patch adds the helper functions to set/reset the in_pm counter to
HDA core and use them in HDA legacy side, for making it clearer who /
where the PM is managed.

There is no functional changes, just code refactoring.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-28 00:02:59 +02:00
Jiada Wang f4c277b817
ASoC: soc-pcm: DPCM cares BE channel constraint
Current DPCM is caring only FE channel configuration. Sometimes
it will be trouble if user selects channel which isn't supported
by BE.

This patch adds new .dpcm_merged_chan on struct snd_soc_dai_link.
DPCM will use FE / BE merged channel if struct snd_soc_dai_link
has it.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-22 15:57:03 +01:00
Pierre-Louis Bossart cbaa7f0bdb
ASoC: Intel: move SKL+ codec ACPI tables to common directory
No functionality change, just move to common tables to make it easier
to deal with SOF and share the same machine drivers - as done
previously for BYT/CHT/HSW/BDW.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-19 15:47:02 +01:00
Bard Liao 0ddce71c21
ASoC: rt5682: add rt5682 codec driver
This is the initial codec driver for rt5682.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-18 12:54:38 +01:00
Katsuhiro Suzuki 62c2c9fcac
ASoC: simple-card-utils: move hp and mic detect gpios from simple-card
This patch moves headphone and microphone jack detection gpios from
simple-card driver. It is preparing for using this feature from other
drivers.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-18 12:54:38 +01:00
Liam Girdwood 503e79b793
ASoC: topology: Add callback for DAPM route load/unload
Add a callback fro clients for notification about DAPM route loading and
unloading.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-18 12:16:21 +01:00
Liam Girdwood c60b613a70
ASoC: topology: Give more data to clients via callbacks
Give topology clients more access to the topology data by passing index,
pcm, link_config and dai_driver to clients. This allows clients to fully
instantiate and track topology objects.

The SOF driver is the first user of these new APIs and needs them to build
component topology driver and FW objects.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-18 12:16:16 +01:00
Linus Torvalds 126f7051b4 sound updates for 4.18
We've got many code additions at this cycle as a result of quite a few
 new drivers.  Below are highlights:
 
 Core stuff:
 - Fix the long-standing issue with the device registration order;
   the control device is now registered at last
 - PCM locking code cleanups for RT kernels
 - Fixes for possible races in ALSA timer resolution accesses
 - TLV offset definitions in uapi
 
 ASoC:
 - Many fixes for the topology stuff, including fixes for v4 ABI
   compatibility
 - Lots of cleanups / quirks for Intel platforms based on Realtek
   CODECs
 - Continued componentization works, removing legacy CODEC stuff
 - Conversion of OMAP DMA to the new, more standard SDMA-PCM driver
 - Fixes and updates to Cirrus Logic SoC drivers
 - New Qualcomm DSP support
 - New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
   MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306 and
   RT5668 and TI TSCS454
 
 HD-audio:
 - Finally better support for some CA0132 boards, allowing Windows
   firmware
 - HP Spectre x360 support along with a bulk of COEF stuff
 - Blacklisting power save default some known boards reported on Fedora
 
 USB-audio:
 - Continued improvements on UAC3 support; now BADD is supported
 - Fixes / improvements for Dell WD15 dock
 - Allow DMA coherent pages for PCM buffers for ARCH, MIPS & co
 
 Others:
 - New Xen sound frontend driver support
 - Cache implementation and other improvements for FireWire DICE
 - Conversions to octal permissions in allover places
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAlsXjEAOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE/szw/9FdtjD7LOBMNgbVbeU+SDTEUGh1OdIElSE+bL
 vU1USUNud9TgYb4SFM4grjsB9v6vM+bZ8mquzLpSzGj2J/Yl3dT7reyr6TYfoGfE
 oCETfYLk0gbhQrrqWoVwRHsPAJYyj6dGXZ/Kiy9MuD9bfWUGAehuqKl1inySxcGb
 VTrhlegHApRJ7z+Yzn6K3Git+aCYhpgxO5NK1DkoagHAsAhJhdavYWhm8lcQ4pnO
 UlahRms0cTpDFrIkHHKH+c1ihyxn3RVpueQIIpx5xRpIHXezMnUk8mpRduqcYGk2
 9cxVlC4KMucsAud39joGN6BWlkmfpmlMfGkdVlAnlBpdTyYC1pJRCKPXX3P+d9Tk
 NvH3jKx/izNYFPLOysoV4vc5puDqSEfAC3geD+ugJFhhJuH9sAMyGOx9MRhC6ebf
 qGI2IEhyn9tVc8/f3glEqS79WDHas+dUCkXxhbAQtj4NcjqgXkM26h5MnrzIYV23
 m5iAzXIDuT44Qw1BxHQb40DzgHZMU3p/c/PAqU/Ex9+Oi1mq6E8V7MH+n9Ylo2vN
 Mw3atYiLqv9xv+7/MmvGUQuTyMR3HB0KyNUCcSyuWPnuqZ/Gi+wIg9cuYXYfrn57
 NtCoW4gzaex909z+QoZa5YxYRfZBJuRjYU0ugOBdK6R3+l/6IsGTasdR6LqngYY6
 RIgK2S8=
 =37hC
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "We've got many code additions at this cycle as a result of quite a few
  new drivers. Below are highlights:

  Core stuff:
   - Fix the long-standing issue with the device registration order; the
     control device is now registered at last
   - PCM locking code cleanups for RT kernels
   - Fixes for possible races in ALSA timer resolution accesses
   - TLV offset definitions in uapi

  ASoC:
   - Many fixes for the topology stuff, including fixes for v4 ABI
     compatibility
   - Lots of cleanups / quirks for Intel platforms based on Realtek
     CODECs
   - Continued componentization works, removing legacy CODEC stuff
   - Conversion of OMAP DMA to the new, more standard SDMA-PCM driver
   - Fixes and updates to Cirrus Logic SoC drivers
   - New Qualcomm DSP support
   - New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
     MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306
     and RT5668 and TI TSCS454

  HD-audio:
   - Finally better support for some CA0132 boards, allowing Windows
     firmware
   - HP Spectre x360 support along with a bulk of COEF stuff
   - Blacklisting power save default some known boards reported on
     Fedora

  USB-audio:
   - Continued improvements on UAC3 support; now BADD is supported
   - Fixes / improvements for Dell WD15 dock
   - Allow DMA coherent pages for PCM buffers for ARCH, MIPS & co

  Others:
   - New Xen sound frontend driver support
   - Cache implementation and other improvements for FireWire DICE
   - Conversions to octal permissions in allover places"

* tag 'sound-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (386 commits)
  ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it
  ALSA: usb-audio: remove redundant check on err
  ASoC: topology: Move skl-tplg-interface.h to uapi
  ASoC: topology: Move v4 manifest header data structures to uapi
  ASoC: topology: Improve backwards compatibility with v4 topology files
  ALSA: pci/hda: Remove unused, broken, header file
  ASoC: TSCS454: Add Support
  ASoC: Intel: kbl: Move codec sysclk config to codec_init function
  ASoC: simple-card: set cpu dai clk in hw_params
  ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()
  ALSA: oxygen: use match_string() helper
  ASoC: dapm: use match_string() helper
  ASoC: max98095: use match_string() helper
  ASoC: max98088: use match_string() helper
  ASoC: Intel: bytcr_rt5651: Set card long_name based on quirks
  ASoC: mt6797-mt6351: add hostless phone call path
  ASoC: mt6797: add Hostless DAI
  ASoC: mt6797: add PCM interface
  ASoC: mediatek: export mtk-afe symbols as needed
  ASoC: codecs: PCM1789: include gpio/consumer.h
  ...
2018-06-06 09:08:38 -07:00
Takashi Iwai d4d5a1cd29 ASoC: Updates for v4.18
This is a very big update, mainly due to a huge set of new drivers some
 of which are individually very large.  We also have a lot of fixes for
 the topology stuff, several of the users have stepped up and fixed some
 the serious issues there, and continued progress on the transition away
 from CODEC specific drivers to generic component drivers.
 
  - Many fixes for the topology code, including fixes for the half done
    v4 ABI compatibility from Guenter Roeck and other ABI fixes from
    Kirill Marinushkin.
  - Lots of cleanup for Intel platforms based on Realtek CODECs from Hans
    de Goode.
  - More followups on removing legacy CODEC things and transitioning to
    components from Morimoto-san.
  - Conversion of OMAP DMA to the new, more standard SDMA-PCM driver.
  - A series of fixes and updates to the rather elderly Cirrus Logic SoC
    drivers from Alexander Sverdlin.
  - Qualcomm DSP support from Srinivas Kandagatla.
  - New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
    MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306 and
    RT5668 and TI TSCS454
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlsWonITHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0KBaB/sHLhq0NwDC+9sHEtFJLB2BvinShIm4
 aPk54T930r/aHZ3aht+qWWU9DTBA5VcaLXVxGJ6J2KrZ8QGOiUAt9QG6kiOb/ltE
 8ORJfsYsRpFSBMPqae/92uxV4WDYLpC1G/ty+VLY8Balp24nDvbrV6oo+xhNTDWW
 wwWVPQkLSDF29EgZJc5zX/PxrjuPSkawRe28P0GI/exXkaP7i8HNmgEl1nlOEgzs
 PiZW7YzsA/6VjSUtYMKWDlXmhkDpb/A/7bGa7JzQZEtN5zM8512gyQ12Hhkrrqn4
 0MvcUUPCw+tBj0A/sdpsPSf476eQ0SUbU85JF2r8sVNpeChb6Su9Q7WI
 =OuIx
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v4.18

This is a very big update, mainly due to a huge set of new drivers some
of which are individually very large.  We also have a lot of fixes for
the topology stuff, several of the users have stepped up and fixed some
the serious issues there, and continued progress on the transition away
from CODEC specific drivers to generic component drivers.

 - Many fixes for the topology code, including fixes for the half done
   v4 ABI compatibility from Guenter Roeck and other ABI fixes from
   Kirill Marinushkin.
 - Lots of cleanup for Intel platforms based on Realtek CODECs from Hans
   de Goode.
 - More followups on removing legacy CODEC things and transitioning to
   components from Morimoto-san.
 - Conversion of OMAP DMA to the new, more standard SDMA-PCM driver.
 - A series of fixes and updates to the rather elderly Cirrus Logic SoC
   drivers from Alexander Sverdlin.
 - Qualcomm DSP support from Srinivas Kandagatla.
 - New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
   MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306 and
   RT5668 and TI TSCS454
2018-06-05 16:51:55 +02:00
Pierre-Louis Bossart 0b014d72eb
ASoC: fix 0-day warnings with snd_soc_new_compress()
All conditionally-defined routines in include/sound/soc.h expose a
static inline fallback to avoid 0-day warnings and compilation issues,
except snd_soc_new_compress().

Fixes: 5db6aab6f3 ('ASoC: topology: Add support for compressed PCMs')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-30 11:35:07 +01:00
Takashi Iwai 96961fa048 ALSA: memalloc: Drop superfluous ifndef
Drop the superfluous #ifndef check in memalloc.h that had been put
just for allowing building the alsa-driver kernel modules externally.
Since the external build was discontinued years ago, let's clean up
the old kludges.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-24 11:14:13 +02:00
Takashi Iwai dc82e52492 ALSA: core: Assure control device to be registered at last
The commit 289ca025ee ("ALSA: Use priority list for managing device
list") changed the way to register/disconnect/free devices via a
single priority list.  This helped to make behavior consistent, but it
also changed a slight behavior change: namely, the control device is
registered earlier than others, while it was supposed to be the very
last one.

I've put SNDRV_DEV_CONTROL in the current position as the release of
ctl elements often conflict with the private ctl elements some PCM or
other components may create, which often leads to a double-free.
But, the order of register and disconnect should be indeed fixed as
expected in the early days: the control device gets registered at
last, and disconnected at first.

This patch changes the priority list order to move SNDRV_DEV_CONTROL
as the last guy to assure the register / disconnect order.  Meanwhile,
for keeping the messy resource release order, manually treat the
control and lowlevel devices as last freed one.

Additional note:
The lowlevel device is the device where a card driver creates at
probe.  And, we still keep the release order control -> lowlevel, as
there might  be link from a control element back to a lowlevel object.

Fixes: 289ca025ee ("ALSA: Use priority list for managing device list")
Reported-by: Tzung-Bi Shih <tzungbi@google.com>
Tested-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-17 08:21:23 +02:00
Greg Kroah-Hartman 176c2572cd soundwire streaming
This contains:
  - Support for SoundWire Streaming
  - Documentation updates for streaming
  - Cadence and Intel driver updates for streaming
  - ASoC API for programming soundwire stream
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJa98rIAAoJEHwUBw8lI4NHrU4P/2h6FLtl1RETg28dcUiGUXj4
 ALgMej7IbkRXaqEClfA6sU9qe9NCi1UrWD4bEnwetjgMki8/WeJP1pSgoRwZT/YA
 38lle3KoGaptBRf2uZe9hfiKKyvp3oI9XPNHEsk6Qqw0qSSUr8t6k5FAWBiupkiV
 s8R/dYDW/qSEmoWODodFFuJFYr1Xok5L95vt4dyCg4FXglr8Sym8Sk6DmjzcqEy/
 w4YsWKvg62RbOZ4hbuZcwY3NunIvvMAx0+A3xweZaLobpCwJ0KB3ApYZeOybF5px
 ODDRNuh76scgz+UMBr796vfvzPAztbUUwcCmXVJrZkWC98OCSOUXfQSZOKnIRmFL
 AZICxsSPOmip++O3C221bKeI65ldXiPHBFzzmzAHOI5IyMfZREu3bbE69x+cwTUi
 1UKrQb0uQRPCQJtaR9hMc4CadRA/SwhOIk42G5aNJ0R4CRpVpVhixuXUHv9+Huaj
 AHSYr3BKCiAW5FshcDcfl9PUvmgULgO66Nk5YURSEdaY39E+1NElHSeKxbbSYRqc
 SNr+gAUKP9Pqfpa8ToOUvb7yg4X72Tw4U9tUbj0i18vb7robkJD4BwlIikUpyBK/
 w8Ew/6WqatmHvX8GpQPRIuE3IbbGKYJquQjTF9tRwzuJBzWFr3JYRU3dZ8g1q+I7
 o9amLP9RcMVwD+qYFKtA
 =KZwI
 -----END PGP SIGNATURE-----

Merge tag 'soundwire-streaming' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-next

Vinod writes:

soundwire streaming

This contains:
 - Support for SoundWire Streaming
 - Documentation updates for streaming
 - Cadence and Intel driver updates for streaming
 - ASoC API for programming soundwire stream
2018-05-13 11:53:18 +02:00
Shreyas NC 97349b6051 ASoC: Add SoundWire stream programming interface
SoundWire stream needs to be propagated to all the DAIs(cpu, codec).
So, add a snd_soc_dai_set_sdw_stream() API for the same.

Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-05-11 21:47:19 +05:30
Peter Ujfalusi cfb53a56d1
ASoC: omap: Delete the obsolete omap-pcm
All DAI drivers are now using the new sdma-pcm platform driver. The
omap-pcm can be removed from the tree, but we need to keep the SND_OMAP_SOC
Kconfig option until the relevant defconfigs are updated to avoid
regression due to missing audio.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11 11:26:25 +09:00
Hans de Goede 8e3ebf5e8f
ASoC: rt5640: Remove unused rt5640_platform_data
There are no in tree users of platform-data for the rt5640 codec driver,
so lets remove support for it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-11 11:22:34 +09:00
Kuninori Morimoto c8306238fa
ASoC: soc.h: merge CONFIG_DEBUG_FS
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-09 18:39:48 +09:00
Kuninori Morimoto 999f7f5af8
ASoC: remove Codec related code
Now no one is using Codec related code.
Let's remove all

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-09 18:39:07 +09:00
Kuninori Morimoto 11fb14f8c5
ASoC: remove unneeded .pcm_new/free
commit ef050bece1 ("ASoC: Remove platform code now everything is
componentised") removed platform code, but it didn't remove
.pcm_new/free which existed only for platform.
This patch remove these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-09 18:39:01 +09:00
Kuninori Morimoto 2250e76d78
ASoC: remove .get_regmap
To setup regmap, ALSA SoC has snd_soc_component_init_regmap() and
.get_regmap. But these are duplicated feature.
Now, no one is using .get_regmap, let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-09 18:38:52 +09:00
Kuninori Morimoto d1021c8852
ASoC: remove codec reg_cache
Codec reg_cache is legacy feature, almost all driver are now using
common regmap, and very few driver had been used this legacy feature.
Because of this background, it is now implemented on each
driver internally now.
So now, no one is using codec reg_cache. Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-09 18:38:23 +09:00
Kuninori Morimoto 81da8a0b79
ASoC: remove codec hw_write/control_data
No one is using codec hw_write/control_data any more.
Let's remove these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-09 18:38:06 +09:00
Mark Brown 783ec5e99a
Merge remote-tracking branch 'asoc/for-4.17' into asoc-4.18 to resolve a
conflict between a fix and new development in mtk
2018-05-02 06:12:18 +09:00
Jerome Brunet 40c5796378
ASoC: dai playback and capture active may be greater than 1
At the moment playback_active and capture_active are using only 1 bit so
the maximum active count is 1.

However, snd_soc_runtime_activate() may be called several time on the
same dai. This happens when a dai is part of several dai_links. It is
often the case for "snd-soc-dummy-dai".

This is a problem if snd_soc_runtime_activate() is called an even number
of times on a dai. In this case the active count overflow back to 0. As
consequence, ASoC functions, such as soc_dpcm_runtime_update(), won't run
correctly.

Storing these usage counts on plain 'unsigned int' solves the problem.

Fixes: f0fba2ad1b ("ASoC: multi-component - ASoC Multi-Component Support")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-02 05:56:36 +09:00