Commit Graph

118 Commits

Author SHA1 Message Date
Mark Brown ce8ee02d51
Merge remote-tracking branches 'asoc/fix/compress', 'asoc/fix/core', 'asoc/fix/dapm', 'asoc/fix/mtk' and 'asoc/fix/stm' into asoc-next 2018-02-07 11:21:02 +00:00
Johan Hovold 3a0a7b2610
ASoC: mt8173-rt5650: fix child-node lookup
This driver used the wrong OF-helper when looking up the optional
capture-codec child node during probe. Instead of searching just
children of the sound node, a tree-wide depth-first search starting at
the unrelated platform node was done. Not only could this end up
matching an unrelated node or no node at all; the platform node could
also be prematurely freed since of_find_node_by_name() drops a reference
to its first argument. This particular pattern has been observed leading
to crashes after probe deferrals in other drivers.

Fix this by dropping the broken call to of_find_node_by_name() and
keeping only the second, correct lookup using of_get_child_by_name()
while taking care not to bail out if the optional node is missing.

Note that this also addresses two capture-codec node-reference leaks
(one for each of the original helper calls).

Compile tested only.

Fixes: d349caeb05 ("ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-07 11:16:39 +00:00
Ryder Lee dc2a17f4f0
ASoC: mediatek: fix double free in mt2701_afe_pcm_dev_probe()
The commit dfa3cbb8(ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device)
leads to the following static checker warning:

	sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:1535 mt2701_afe_pcm_dev_probe()
	error: double free of 'component'

This patch fixes that and adds a helper mt2701_afe_add_component() to setup
component.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-22 12:18:36 +00:00
Mark Brown dc3f733a31
Merge remote-tracking branches 'asoc/topic/mtk', 'asoc/topic/nau8540', 'asoc/topic/nau8824', 'asoc/topic/nau8825' and 'asoc/topic/nuc900' into asoc-next 2018-01-12 12:29:18 +00:00
Mark Brown 4e1758b135
Merge remote-tracking branches 'asoc/topic/max98926', 'asoc/topic/max98927', 'asoc/topic/mc13783', 'asoc/topic/msm8916' and 'asoc/topic/mt8173' into asoc-next 2018-01-12 12:29:14 +00:00
Bard Liao 11aa2d9613
ASoC: mt8173: remove unnecessary micbias widget in route
The micbias1/2 are connected to route as SUPPLY usage. It was not
take effect since they were MICBIAS type. To keep the same register
settings, we have to remove it once the micbias1/2 widget is converted
to SUPPLY type.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-10 10:59:33 +00:00
Wei Yongjun 3e8052d90d
ASoC: mediatek: mt2701: fix return value check in mt2701_afe_pcm_dev_probe()
In case of error, the function syscon_node_to_regmap() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: dfa3cbb83e ("ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-08 11:27:45 +00:00
Ryder Lee dfa3cbb83e
ASoC: mediatek: modify MT2701 AFE driver to adapt mfd device
As the new MFD parent is in place, modify MT2701 AFE driver to adapt it.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 14:25:56 +00:00
Ryder Lee 96365d9fdb
ASoC: mediatek: add some core clocks for MT2701 AFE
Add three core clocks for MT2701 AFE.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-04 14:25:55 +00:00
Ryder Lee 600b2fd4f0
ASoC: mediatek: cleanup audio driver for MT2701
Cleanup unused code such as 'i2s_num' guard, headers, indentation
and some defines.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 15:15:25 +00:00
Ryder Lee d8d99d8ed6
ASoC: mediatek: rework clock functions for MT2701
Reworks clock part to make it more reasonable. The current changes are:

- Replace regmap operations by CCF APIs. Doing so, we just need to handle
  the element clocks and can also get accurate information via CCF.

- Rename clocks to make them more generic so that the future revisions
  of the IP can adapt gracefully.

- Regroup 'aud_clks[]' by usage - the basic needs and I2S parts:

  The new code just keep the common clocks in array and let SoC self decide
  I2S numbers - If future chips have different sets of channels we will
  add a little more abstract here.

  Moreover, this patch moves I2S clocks to the struct mt2701_i2s_data
  so that we can easily manage them when calls .prepare() and .shutdown().

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 15:15:24 +00:00
Ryder Lee dd6bb9b16f
ASoC: mediatek: fix error handling in mt2701_afe_pcm_dev_probe()
Fix unbalanced error handling path which will get incorrect counts
if probe failed. The .remove() should be adjusted accordingly.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-03 12:10:35 +00:00
Arvind Yadav d6e2c4ffdf
ASoC: mt8173: Fix platform_get_irq's error checking
The platform_get_irq() function returns negative if an error occurs.
zero or positive number on success. platform_get_irq() error checking
for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01 13:05:45 +00:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Mark Brown af4f47717f Merge remote-tracking branches 'asoc/topic/mtk', 'asoc/topic/mxs', 'asoc/topic/nau8825', 'asoc/topic/nuc900' and 'asoc/topic/of-graph' into asoc-next 2017-09-01 12:12:48 +01:00
Donglin Peng b286401752 ASoC: mediatek: Remove unnecessary function call
First of all,the address of pdev->dev is assigned to card->dev,then
the function platform_set_drvdata copies the value the variable card
to pdev->dev.driver_data, but when calling snd_soc_register_card,the
function dev_set_drvdata(card->dev, card) will also do the same copy
operation,so i think that the former copy operation can be removed.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21 18:14:58 +01:00
Ryder Lee f6c1626e28 ASoC: mediatek: switch to use platform_get_irq_byname()
Switch to use platform_get_irq_byname() so that binding can be agnostic
of the IRQ order.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
CC: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-18 12:35:42 +01:00
Christophe Jaillet 8d7313bfb1 ASoC: mediatek: Fix an error checking code
Check the value returned by 'devm_clk_get()' instead of the clock
identifier which can never be an ERR code.

Fixes: d6f3710a56 ("ASoC: mediatek: add structure define and clock control for 2701")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-07 12:31:57 +01:00
Gustavo A. R. Silva 549acff975 ASoC: mediatek: mt2701: constify snd_soc_dai_ops structure
This structure is only stored in the ops field of a snd_soc_dai_driver
structure. That field is declared const, so snd_soc_dai_ops structures
that have this property can be declared as const also.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-17 16:17:12 +01:00
Takashi Iwai b02ee56087 ASoC: mediatek: Constify hw_constraints
snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the
const pointers.  Constify the corresponding static objects for better
hardening.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-By: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-13 21:33:03 +01:00
Arnd Bergmann 362c59436c ASoC: mediatek: add I2C dependency for CS42XX8
We should not select drivers that depend on I2C when that is disabled,
as it results in a build error:

warning: (SND_SOC_MT2701_WM8960) selects SND_SOC_WM8960 which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && I2C)
sound/soc/codecs/wm8960.c:1469:1: error: data definition has no type or storage class [-Werror]
sound/soc/codecs/wm8960.c:1469:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]

Fixes: 8625c1dbd8 ("ASoC: mediatek: Add mt2701-wm8960 machine driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-21 17:58:34 +01:00
Ryder Lee 8625c1dbd8 ASoC: mediatek: Add mt2701-wm8960 machine driver
Add wm8960 machine driver and config option for MT2701.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-29 11:37:53 +01:00
Bhumika Goyal 424dfbf2c0 ASoC: mediatek: constify snd_soc_ops structures
Declare snd_soc_ops structures as const as they are only stored
in the ops field of a snd_soc_dai_link structure. This field is
of type const, so snd_soc_ops structures having this property
can be made const too.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-03-20 11:25:47 +00:00
Arnd Bergmann 72cedf599f ASoC: mediatek: add I2C dependency for CS42XX8
We should not select drivers that depend on I2C when that is disabled,
as it results in a build error:

warning: (SND_SOC_MT2701_CS42448) selects SND_SOC_CS42XX8_I2C which has unmet direct dependencies (SOUND && !M68K && !UML && SND && SND_SOC && I2C)
sound/soc/codecs/cs42xx8-i2c.c:60:1: warning: data definition has no type or storage class
 module_i2c_driver(cs42xx8_i2c_driver);
sound/soc/codecs/cs42xx8-i2c.c:60:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]

Fixes: 1f458d53f7 ("ASoC: mediatek: Add mt2701-cs42448 driver and config option.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-02-21 15:02:34 -08:00
Garlic Tseng cc3e1ce2c7 ASoC: mediatek: add power-domain get/put ctrl for mt2701
add power-domain ctrl for audio driver

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-02-16 18:27:17 +00:00
Enric Balletbo i Serra b1b9e0d3d9 ASoC: mt8173-max98090: remove the call to snd_soc_jack_add_pins.
The snd_soc_card_jack_new function can call snd_soc_jack_add_pins for
you, so pass directly the pins struct when you create the new jack.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-31 20:19:05 +00:00
Baoyou Xie 22e766146a ASoC: mediatek: mark symbols static where possible
We get 2 warnings about global functions without a declaration
in the ASoC mediatek module when building with W=1:

sound/soc/mediatek/common/mtk-afe-fe-dai.c:26:5: warning: no previous prototype for 'mtk_regmap_update_bits' [-Wmissing-prototypes]
 int mtk_regmap_update_bits(struct regmap *map, int reg, unsigned int mask,
         ^
sound/soc/mediatek/common/mtk-afe-fe-dai.c:34:5: warning: no previous prototype for 'mtk_regmap_write' [-Wmissing-prototypes]
 int mtk_regmap_write(struct regmap *map, int reg, unsigned int val)

In fact, all of those functions are only used in the file in which
they are declared and don't need a declaration, but can be made static.

so this patch marks it 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-11 15:02:28 +01:00
PC Liao 97e1145a41 ASoC: mediatek: Add HDMI dai-links to the mt8173-rt5650 machine driver
This patch adds HDMI audio output support to the MT8173 RT5650 machine
driver.

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-14 17:31:18 +01:00
Wei Yongjun 25d01dc678 ASoC: mediatek: mt2701: fix non static symbol warning
Fixes the following sparse warning:

sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:72:5: warning:
 symbol 'mt2701_dai_num_to_i2s' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-14 17:30:46 +01:00
Dan Carpenter b02c5cc723 ASoC: mediatek: mt2701: fix some error handling in probe
The check for if the "afe" allocation failed was too late and there
wasn't a check for "afe->platform_priv".

Fixes: 43a6a7e710 ('ASoC: mediatek: add mt2701 platform driver implementation.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-07 11:40:58 +02:00
Garlic Tseng 4bdc8d452c ASoC: mediatek: add BT implementation
Add BT implementation for mt2701 platform driver.

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-05 11:28:20 +02:00
Garlic Tseng 1f458d53f7 ASoC: mediatek: Add mt2701-cs42448 driver and config option.
Add machine driver and config option for MT2701.

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-04 16:49:03 +02:00
Garlic Tseng 43a6a7e710 ASoC: mediatek: add mt2701 platform driver implementation.
Add mt2701 platform driver implementation for playback and capture.
The implement follow DAPM structure (memory interface as FE and I2S
as BE).
Because of the hardware design, i2s out required to be enabled when
we need to enable i2s in. This patch includes the implementation.

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-07-04 16:30:35 +02:00
Garlic Tseng d6f3710a56 ASoC: mediatek: add structure define and clock control for 2701
add structure define and clock control function for 2701.

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29 20:11:09 +01:00
Garlic Tseng 6b1e19d91d ASoC: mediatek: let mt8173 use mediatek common structure
Modify mt8173 driver implementation to use common structure.

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29 20:11:09 +01:00
Garlic Tseng 283b612429 ASoC: mediatek: implement mediatek common structure
implement mediatek basic structure, include common private data,
afe fe dai operator and afe platform driver.

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29 20:11:09 +01:00
Garlic Tseng 0d1d7a6642 ASoC: mediatek: Refine mt8173 driver and change config option
move mt8173 driver to another folder and add prefix.
add config option SND_SOC_MT8173

Signed-off-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-29 20:11:09 +01:00
PC Liao 0c198ed2ba ASoC: mediatek: add MCLK source selection
The new machine's MCLK source is from mt8173 which is dynamic from
sampling rate*256. This patch provides the selection for device tree.

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-06-02 18:18:25 +01:00
PC Liao 33d919bd51 ASoC: mediatek: Change the order of MCLK clock configuration
Because MCLK opens later and closes earlier than codec, this patch
changes the order of MCLK clock configuration.

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30 16:16:12 +01:00
PC Liao 27becea06e ASoC: mediatek: HDMI audio LR channel swapped
Because LRCK of TDM use High to Low as default setting, this patch
changes the TDM setting to inverse LRCK.

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-26 11:25:51 +01:00
Koro Chen c0133e3b02 ASoC: mediatek: Add HDMI dai-links in the mt8173-rt5650-rt5676 machine driver
This creates pcmC0D2p for the HDMI playback in the same card.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-21 17:15:14 +01:00
PC Liao d349caeb05 ASoC: mediatek: Add second I2S on mt8173-rt5650 machine driver
This patch adds second I2S connection to rt5650 codec for capture path on
mt8173-rt5650 machine driver.

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-21 17:08:25 +01:00
Philipp Zabel 05f5afd3f0 ASoC: mediatek: address dai link array entries by enum
This should be more robust to future changes than adressing
array entries by index number.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-05 13:46:06 +09:00
Koro Chen 0c71367d35 ASoC: mediatek: Add machine driver for rt5650 rt5514 codec
This is the DPCM based machine driver with rt5650 and rt5514.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-02 13:32:00 +09:00
Koro Chen 84f3a52421 ASoC: mediatek: Add I03/I04 widgets and corresponding routes
Add these widgets to allow another path from I2S input.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-26 11:31:21 +09:00
PC Liao 4d7cb66c8f ASoC: mediatek: remove soft reset and add second I2S clock
To improve I2S flow, this patch removes soft reset and adds second
I2S clock to use.

Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-26 11:11:22 +09:00
Koro Chen 0f83f9296d ASoC: mediatek: Add machine driver for ALC5650 codec
This is the DPCM based machine driver with rt5650

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-22 20:12:23 +09:00
Mark Brown 8174b35f1d Linux 4.5-rc5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWyN0eAAoJEHm+PkMAQRiGqIAIAKKodaqX5ACJhTRozj3GN5iV
 dDHU/SJQj4nIyJecaCVAJIBa3gvAX6GyY+Jg4JKJ4TKAdR0Hd/3EwOWIR+0+BQIM
 0MqmB0CRLzq42AOQtpDUdwB+OTE8jFQFQd2gFKuQYJJ61ppykCC36OWV0bTfQLSV
 b2esO4Ry6eoQnDMw8oT52ncUIZEvQ2DZE3L6tNDEPD/0je14GWkV1Fx1+X2jb9cB
 diFA2TmaEEXMHNT1NCLSQ+D7QefXV3mFl85leNlFi5QQNy7ZdSh7kvvOodMQ2uAS
 qa9V8Uk6LZYv5O71+Jr5Rmlqh3GxNRCMXu2tlMd2gtw8ApEvBw6XoL5YZYE13Lk=
 =3HMg
 -----END PGP SIGNATURE-----

Merge tag 'v4.5-rc5' into asoc-mtk

Linux 4.5-rc5
2016-02-22 20:12:13 +09:00
Mark Brown 733f4c79de Merge remote-tracking branches 'asoc/fix/imx-spdif', 'asoc/fix/mtk', 'asoc/fix/mxs-saif', 'asoc/fix/qcom' and 'asoc/fix/rt286' into asoc-linus 2016-02-10 19:23:07 +00:00
Arnd Bergmann ec3995da27 ASoC: mediatek: add i2c dependency
The newly added mediatek drivers for mt8173 select codes that depend
on I2C, which cuases a build failure if I2C is disabled:

warning: (SND_SOC_ADAU1761_I2C && SND_SOC_ADAU1781_I2C && SND_SOC_ADAU1977_I2C && SND_SOC_RT5677 && EXTCON_MAX14577 && EXTCON_MAX77693 && EXTCON_MAX77843 && BMC150_ACCEL_I2C && BMG160_I2C) selects REGMAP_I2C which has unmet direct dependencies (I2C)
codecs/rt5645.c:3854:1: warning: data definition has no type or storage class
codecs/rt5645.c:3854:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
codecs/rt5677.c:5270:1: warning: data definition has no type or storage class
77_i2c_driver);

codecs/rt5677.c:5270:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]

This adds an explicit dependency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-15 18:14:32 +00:00
PC Liao fcde5a7eca ASoC: mediatek: Enable 33bit memory address to support 4GB DRAM
If platform is embedded with memory more than 3GB, the address will
go out of the scope that 32-bit can handle with. This patch sets the
dma_mask and MSB properly to describe its address to 33-bit.

Signed-off-by: Hidalgo Huang <hidalgo.huang@mediatek.com>
Signed-off-by: PC Liao <pc.liao@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-15 18:07:54 +00:00
Koro Chen c1f2a34284 ASoC: mediatek: Turn AFE on/off in runtime resume/suspend
AFE is actually allowed to be turn on before configuration of DAIs
since each DAI has its own enabling control. Turn on/off AFE in
runtime resume/suspend to avoid AFE being shut down when closing a DAI
while other DAIs are still active.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-22 23:52:20 +00:00
Koro Chen 8d6f88ce96 ASoC: mediatek: Use current HW pointer for pointer callback
Previously we recorded "last interrupt position" and used it in
pointer callback. This is not correct implementation, and it causes
underruns when user space monitors buffer level to decide when to
send next data chunk in low latency application.

Remove position recording in IRQ handler and also hw_ptr in
struct mtk_afe_memif used to record that, and let pointer callback
reports current HW pointer instead.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-08 17:06:45 +00:00
Koro Chen b45e68df06 ASoC: mediatek: Move 22M/24M clock control into I2S ops
22M/24M clocks are only required for I2S, so move the control to
I2S DAI ops.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-17 18:54:29 +00:00
Mark Brown 9abbe73e7d Merge remote-tracking branches 'asoc/topic/jz4740', 'asoc/topic/kirkwood', 'asoc/topic/mtk', 'asoc/topic/multi' and 'asoc/topic/mxs' into asoc-next 2015-09-23 11:01:22 -07:00
Koro Chen e4fba9b5be ASoC: mediatek: Increase periods_min in capture
In capture, there is chance that hw_ptr reported at IRQ is
a little smaller than period_size due to internal AFE buffer.
In the case of ping-pong buffer:

|xxxxxxxxxxxxxxxxxxxxxxxxxxxx--|-----------------------------|
                            hw_ptr < period_size

This available buffer will not be read since its size is smaller than
avail_min (which is period_size by default), and read thread continues
to sleep. If the next hw_ptr is just a little larger than buffer_size,
overrun occurs. One more period can hold the possible unread buffer.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-14 18:13:54 +01:00
Axel Lin 887e83e32d ASoC: mediatek: Convert to devm_snd_soc_register_card
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-31 16:11:32 +01:00
Mark Brown acb47ad502 Merge remote-tracking branches 'asoc/topic/mediatek', 'asoc/topic/mtk', 'asoc/topic/nuc900', 'asoc/topic/of-name' and 'asoc/topic/omap' into asoc-next 2015-08-30 15:55:21 +01:00
Mark Brown 48997b9c03 Merge remote-tracking branches 'asoc/topic/au1x', 'asoc/topic/bcm2835', 'asoc/topic/blackfin' and 'asoc/topic/card' into asoc-next 2015-08-30 15:52:41 +01:00
Axel Lin 54d8697fa5 ASoC: Set missing card owner field
Set the card owner field to prevent the module from being removed from
underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-21 09:07:19 -07:00
Koro Chen 0643558f85 ASoC: mediatek: Remove AIF widgets for backend DAIs
DAPM core already creates widgets for DAIs. It is not necessary
to declare them by SND_SOC_DAPM_AIF_IN/SND_SOC_DAPM_AIF_OUT.
Furthermore, original codes use backend DAI's stream name to be the AIF
widget name. It causes the same widget to be created twice, and after
commit 92fa124267 ("ASoC: dapm: Add new widgets to the end of the
widget list") the first created widget (by snd_soc_dapm_new_controls)
is used, not the 2nd created one (by snd_soc_dapm_new_dai_widgets),
so audio path is broken.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-17 10:52:08 -07:00
Koro Chen 775b07de4f ASoC: mediatek: Add suspend/resume callbacks
This adds suspend/resume callbacks, which are common for each DAI.
To be able to continue the last playback/capture after resume
when suspend was done during a playback/capture, in the callbacks
we do backup/restore of registers which were set before prepare stage.
Registers to be backup/restore are defined in a backup list array.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-22 11:11:18 +01:00
Krzysztof Kozlowski 27bc1dd244 ASoC: mediatek: Drop owner assignment from platform_driver
platform_driver does not need to set an owner because
platform_driver_register() will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-14 18:10:16 +01:00
Koro Chen 94319ba10e ASoC: mediatek: Use platform_of_node for machine drivers
This replaces the platform_name in snd_soc_dai_link by device tree node.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-09 09:30:12 +01:00
Koro Chen 4623a614e8 ASoC: mediatek: Fix unbalanced calls to runtime suspend/resume
This adds call to runtime suspend in dev remove. It fixs the problem that
suspend is not called in the case of CONFIG_PM=n. It also fixs build
warning when CONFIG_PM=n.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-23 12:10:01 +01:00
Koro Chen 662e8d917f ASoC: mediatek: Add machine driver for rt5650 rt5676 codec
This is the DPCM based machine driver with rt5650 and rt5676

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-16 12:52:36 +01:00
Koro Chen a54f6f0c5b ASoC: mediatek: Add machine driver for MAX98090 codec
This is the DPCM based machine driver with MAX98090

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-16 12:52:36 +01:00
Koro Chen ee0bcaff10 ASoC: mediatek: Add AFE platform driver
This is the DPCM based platform driver of AFE (Audio Front End) unit.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-16 12:51:21 +01:00