GitHub/LineageOS/android_kernel_motorola_exynos9610.git
7 years agoALSA: hda/ca0132 - Fix memory leak at error path
Takashi Iwai [Mon, 4 Sep 2017 15:38:36 +0000 (17:38 +0200)]
ALSA: hda/ca0132 - Fix memory leak at error path

The CA0132 codec driver doesn't call the free function at its error
path of the probe, which leaves the allocated memory.  Call
ca0132_free() properly at the error handling.

Fixes: a73d511c4867 ("ALSA: hda/ca0132: Add unsol handler for DSP and jack detection")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: hda: Fix forget to free resource in error handling code path in hda_codec_drive...
Wang YanQing [Mon, 4 Sep 2017 15:17:09 +0000 (23:17 +0800)]
ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe

When hda_codec_driver_probe meet error and return failure, we need
to free resource with patch_ops.free, or we will get resource leak.

Signed-off-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge tag 'asoc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Mon, 4 Sep 2017 12:50:49 +0000 (14:50 +0200)]
Merge tag 'asoc-v4.14' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v4.14

This is quite a large release by volume of patches and diff, a lot of
that is mechanical cleanup patches but it's great to also see a range of
vendors actively working on adding new features and fixing issues in
their drivers.  Intel and Realtek have been especially active here.

 - Continued work towards moving everything to the component model from
   Morimoto-san.
 - Use of devres for jack detection GPIOs, eliminating some potential
   resource leaks.
 - Jack detection support for Qualcomm MSM8916.
 - Support for Allwinner H3, Cirrus Logic CS43130, Intel Kabylake
   systems with RT5663, Realtek RT274, TI TLV320AIC32x6 and Wolfson
   WM8523.

7 years agoALSA: atmel: Remove leftovers of AVR32 removal
Andy Shevchenko [Fri, 1 Sep 2017 16:15:07 +0000 (19:15 +0300)]
ALSA: atmel: Remove leftovers of AVR32 removal

The ALSA related include header files are left overs after the commit

020c5260c2b1 ("ALSA: atmel: Remove AVR32 bits from the driver")

Fixes: 020c5260c2b1 ("ALSA: atmel: Remove AVR32 bits from the driver")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: atmel: convert AC97c driver to GPIO descriptor API
Andy Shevchenko [Fri, 1 Sep 2017 16:15:06 +0000 (19:15 +0300)]
ALSA: atmel: convert AC97c driver to GPIO descriptor API

Convert the driver to use GPIO descriptor API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: hda/realtek - Enable jack detection function for Intel ALC700
PeiSen Hou [Fri, 1 Sep 2017 07:11:56 +0000 (15:11 +0800)]
ALSA: hda/realtek - Enable jack detection function for Intel ALC700

Intel ALC 700 needs this patch for jack detection function.
Because ALC700's jack detect function defaults is disable.
So alc700 needs pathc to enable jack detection function.

Signed-off-by: PeiSen Hou <pshou@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge branch 'for-next' into for-linus
Takashi Iwai [Mon, 4 Sep 2017 08:10:27 +0000 (10:10 +0200)]
Merge branch 'for-next' into for-linus

7 years agoALSA: hda: Fix regression of hdmi eld control created based on invalid pcm
Wang YanQing [Sun, 3 Sep 2017 13:18:49 +0000 (21:18 +0800)]
ALSA: hda: Fix regression of hdmi eld control created based on invalid pcm

Commit fb087eaaef72 ("ALSA: hda - hdmi eld control created based on pcm")
forget to filter out invalid pcm numbers, if there is only one invalid pcm
number, then this issue causes we create eld control for invalid pcm silently,
but when there are more than one invalid pcm numbers, then this issue bring
probe error looks like below dmesg:
"
kernel: [    1.647283] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops 0xc2967540)
kernel: [    1.651192] snd_hda_intel 0000:00:03.0: Too many HDMI devices
kernel: [    1.651195] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y
kernel: [    1.651197] snd_hda_intel 0000:00:03.0: Too many HDMI devices
kernel: [    1.651199] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y
kernel: [    1.651201] snd_hda_intel 0000:00:03.0: Too many HDMI devices
kernel: [    1.651203] snd_hda_intel 0000:00:03.0: Consider building the kernel with CONFIG_SND_DYNAMIC_MINORS=y
kernel: [    1.651676] snd_hda_intel 0000:00:03.0: control 3:0:0:ELD:0 is already present
kernel: [    1.651787] snd_hda_codec_hdmi: probe of hdaudioC0D0 failed with error -16
"

This patch add invalid pcm number filter before calling hdmi_create_eld_ctl.

Fixes: fb087eaaef72 ("ALSA: hda - hdmi eld control created based on pcm")
Signed-off-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge remote-tracking branches 'asoc/topic/wm8524', 'asoc/topic/wm8804' and 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:13:19 +0000 (12:13 +0100)]
Merge remote-tracking branches 'asoc/topic/wm8524', 'asoc/topic/wm8804' and 'asoc/topic/zte' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/twl6040', 'asoc/topic/txx9', 'asoc/topic...
Mark Brown [Fri, 1 Sep 2017 11:13:15 +0000 (12:13 +0100)]
Merge remote-tracking branches 'asoc/topic/twl6040', 'asoc/topic/txx9', 'asoc/topic/utils', 'asoc/topic/ux500' and 'asoc/topic/wm8523' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5720', 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:13:10 +0000 (12:13 +0100)]
Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5720', 'asoc/topic/tegra', 'asoc/topic/tlv320aic32x4' and 'asoc/topic/tlv320aic3x' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic...
Mark Brown [Fri, 1 Sep 2017 11:13:06 +0000 (12:13 +0100)]
Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic/sta32x', 'asoc/topic/stm32' and 'asoc/topic/sunxi' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/rt5665', 'asoc/topic/rt5670', 'asoc/topic...
Mark Brown [Fri, 1 Sep 2017 11:13:03 +0000 (12:13 +0100)]
Merge remote-tracking branches 'asoc/topic/rt5665', 'asoc/topic/rt5670', 'asoc/topic/rt5677' and 'asoc/topic/samsung' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/rt5563', 'asoc/topic/rt5616', 'asoc/topic...
Mark Brown [Fri, 1 Sep 2017 11:12:58 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/rt5563', 'asoc/topic/rt5616', 'asoc/topic/rt5645', 'asoc/topic/rt5659' and 'asoc/topic/rt5663' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/rk3036', 'asoc/topic/rockchip', 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:12:55 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/rk3036', 'asoc/topic/rockchip', 'asoc/topic/rt274' and 'asoc/topic/rt5514' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/omap', 'asoc/topic/psc-ac97' and 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:12:52 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/omap', 'asoc/topic/psc-ac97' and 'asoc/topic/pxa' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/mtk', 'asoc/topic/mxs', 'asoc/topic/nau882...
Mark Brown [Fri, 1 Sep 2017 11:12:48 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/mtk', 'asoc/topic/mxs', 'asoc/topic/nau8825', 'asoc/topic/nuc900' and 'asoc/topic/of-graph' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/kirkwood', 'asoc/topic/max9867', 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:12:44 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/kirkwood', 'asoc/topic/max9867', 'asoc/topic/max98926' and 'asoc/topic/max98927' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/hisi', 'asoc/topic/img', 'asoc/topic/jack...
Mark Brown [Fri, 1 Sep 2017 11:12:41 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/hisi', 'asoc/topic/img', 'asoc/topic/jack' and 'asoc/topic/jz4740' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8316', 'asoc/topic...
Mark Brown [Fri, 1 Sep 2017 11:12:36 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8316', 'asoc/topic/fsi', 'asoc/topic/fsl' and 'asoc/topic/hdmi' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/cs43130', 'asoc/topic/cs53l30', 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:12:32 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/cs43130', 'asoc/topic/cs53l30', 'asoc/topic/cygnus' and 'asoc/topic/davinci' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/cs35l33', 'asoc/topic/cs35l34' and 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:12:29 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/cs35l33', 'asoc/topic/cs35l34' and 'asoc/topic/cs42l42' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/blackfin', 'asoc/topic/build', 'asoc/topic...
Mark Brown [Fri, 1 Sep 2017 11:12:26 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/blackfin', 'asoc/topic/build', 'asoc/topic/cirrus' and 'asoc/topic/compress' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/topic/adau1977', 'asoc/topic/arizona', 'asoc...
Mark Brown [Fri, 1 Sep 2017 11:12:21 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/topic/adau1977', 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/au1x' and 'asoc/topic/bcm' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/rcar' into asoc-next
Mark Brown [Fri, 1 Sep 2017 11:12:20 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/topic/rcar' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/intel' into asoc-next
Mark Brown [Fri, 1 Sep 2017 11:12:19 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/topic/intel' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/core' into asoc-next
Mark Brown [Fri, 1 Sep 2017 11:12:18 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/topic/core' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/const' into asoc-next
Mark Brown [Fri, 1 Sep 2017 11:12:17 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/topic/const' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/component' into asoc-next
Mark Brown [Fri, 1 Sep 2017 11:12:17 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/topic/component' into asoc-next

7 years agoMerge remote-tracking branch 'asoc/topic/msm8916' into asoc-next
Mark Brown [Fri, 1 Sep 2017 11:12:16 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/topic/msm8916' into asoc-next

7 years agoMerge remote-tracking branches 'asoc/fix/arizona' and 'asoc/fix/mtk' into asoc-linus
Mark Brown [Fri, 1 Sep 2017 11:12:13 +0000 (12:12 +0100)]
Merge remote-tracking branches 'asoc/fix/arizona' and 'asoc/fix/mtk' into asoc-linus

7 years agoMerge remote-tracking branch 'asoc/fix/rcar' into asoc-linus
Mark Brown [Fri, 1 Sep 2017 11:12:12 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/fix/rcar' into asoc-linus

7 years agoMerge remote-tracking branch 'asoc/fix/intel' into asoc-linus
Mark Brown [Fri, 1 Sep 2017 11:12:11 +0000 (12:12 +0100)]
Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus

7 years agoMerge tag 'asoc-fix-v4.13-rc7' into asoc-linus
Mark Brown [Fri, 1 Sep 2017 11:12:09 +0000 (12:12 +0100)]
Merge tag 'asoc-fix-v4.13-rc7' into asoc-linus

ASoC: Fixes for v4.13

A couple of fixes, one for a regression in simple-card introduced during
the merge window that was only reported this week and another for a
regression in registration of ACPI GPIOs.

# gpg: Signature made Thu 31 Aug 2017 12:50:29 BST
# gpg:                using RSA key ADE668AA675718B59FE29FEA24D68B725D5487D0
# gpg:                issuer "broonie@kernel.org"
# gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" [unknown]
# gpg:                 aka "Mark Brown <broonie@debian.org>" [unknown]
# gpg:                 aka "Mark Brown <broonie@kernel.org>" [unknown]
# gpg:                 aka "Mark Brown <broonie@tardis.ed.ac.uk>" [unknown]
# gpg:                 aka "Mark Brown <broonie@linaro.org>" [unknown]
# gpg:                 aka "Mark Brown <Mark.Brown@linaro.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 3F25 68AA C269 98F9 E813  A1C5 C3F4 36CA 30F5 D8EB
#      Subkey fingerprint: ADE6 68AA 6757 18B5 9FE2  9FEA 24D6 8B72 5D54 87D0

7 years agoASoC: Intel: Skylake: Add IPC to configure the copier secondary pins
Pradeep Tewani [Fri, 1 Sep 2017 08:06:13 +0000 (13:36 +0530)]
ASoC: Intel: Skylake: Add IPC to configure the copier secondary pins

Copier can support upto 4 output pins. However, only pin 0 is configured
as a part of copier initialization. Configuring rest of pins require the
separate IPC to be sent to fw.

Signed-off-by: Pradeep Tewani <pradeep.d.tewani@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: add missing compile rule for max98371
Kuninori Morimoto [Fri, 1 Sep 2017 04:33:01 +0000 (04:33 +0000)]
ASoC: add missing compile rule for max98371

It is still using old driver style, this patch also
fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: add missing compile rule for sirf-audio-codec
Kuninori Morimoto [Fri, 1 Sep 2017 04:33:27 +0000 (04:33 +0000)]
ASoC: add missing compile rule for sirf-audio-codec

It is still using old driver style, this patch also
fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: add missing compile rule for max98371
Kuninori Morimoto [Fri, 1 Sep 2017 04:33:01 +0000 (04:33 +0000)]
ASoC: add missing compile rule for max98371

It is still using old driver style, this patch also
fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: cs43130: Add devicetree bindings for CS43130
Li Xu [Fri, 18 Aug 2017 16:00:20 +0000 (11:00 -0500)]
ASoC: cs43130: Add devicetree bindings for CS43130

Add devicetree bindings documentation file for Cirrus
Logic CS43130 codec.

Signed-off-by: Li Xu <li.xu@cirrus.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: cs43130: Add support for CS43130 codec
Li Xu [Fri, 18 Aug 2017 16:00:19 +0000 (11:00 -0500)]
ASoC: cs43130: Add support for CS43130 codec

Add support for Cirrus Logic CS43130 codec.

Support:
I2S/DSP PCM playback.
DoP/DSD playback.
HP detection and DC/AC impedance measurement.

Signed-off-by: Li Xu <li.xu@cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: make clock direction configurable in asoc-simple
Vitaly Wool [Thu, 17 Aug 2017 11:42:36 +0000 (13:42 +0200)]
ASoC: make clock direction configurable in asoc-simple

Some CPU drivers (e. g. davinci-mcasp) may require the system clock to
be configured as OUT, while there's no good way currently to set
SND_SOC_CLK_OUT in simple-soc driver if the clock is fixed-rate.

This patch makes asoc_simple_card_init_dai() initialize clock to
SND_SOCK_CLK_OUT if explicitly stated in the relevant dts file. This
change is transparent and doesn't change the default behavior.

Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: ctxfi: Remove null check before kfree
Himanshu Jha [Thu, 31 Aug 2017 15:06:42 +0000 (20:36 +0530)]
ALSA: ctxfi: Remove null check before kfree

kfree on NULL pointer is a no-op and therefore checking is redundant.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoMerge tag 'asoc-fix-v4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broon...
Takashi Iwai [Thu, 31 Aug 2017 12:08:26 +0000 (14:08 +0200)]
Merge tag 'asoc-fix-v4.13-rc7' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v4.13

A couple of fixes, one for a regression in simple-card introduced during
the merge window that was only reported this week and another for a
regression in registration of ACPI GPIOs.

7 years agoMerge remote-tracking branch 'asoc/fix/rt5670' into asoc-fixes
Mark Brown [Thu, 31 Aug 2017 11:47:58 +0000 (12:47 +0100)]
Merge remote-tracking branch 'asoc/fix/rt5670' into asoc-fixes

7 years agoASoC: max98927: Changed device property read function
Ryan Lee [Mon, 28 Aug 2017 23:31:01 +0000 (16:31 -0700)]
ASoC: max98927: Changed device property read function

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: max98927: Modified DAPM widget and map to enable/disable VI sense path
Ryan Lee [Mon, 28 Aug 2017 23:31:00 +0000 (16:31 -0700)]
ASoC: max98927: Modified DAPM widget and map to enable/disable VI sense path

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: max98927: Added PM suspend and resume function
Ryan Lee [Mon, 28 Aug 2017 23:30:59 +0000 (16:30 -0700)]
ASoC: max98927: Added PM suspend and resume function

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: max98927: Modified chip default register values
Ryan Lee [Mon, 28 Aug 2017 23:30:58 +0000 (16:30 -0700)]
ASoC: max98927: Modified chip default register values

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: max98927: Added missing \n to end of dev_err messages
Ryan Lee [Mon, 28 Aug 2017 23:30:56 +0000 (16:30 -0700)]
ASoC: max98927: Added missing \n to end of dev_err messages

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: max98927: Updated volatile register list
Ryan Lee [Mon, 28 Aug 2017 23:30:55 +0000 (16:30 -0700)]
ASoC: max98927: Updated volatile register list

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: ac97c: Fix an error handling path in 'atmel_ac97c_probe()'
Christophe Jaillet [Thu, 31 Aug 2017 04:40:42 +0000 (06:40 +0200)]
ALSA: ac97c: Fix an error handling path in 'atmel_ac97c_probe()'

If 'clk_prepare_enable()' fails, we must release some resources before
returning. Add a new label in the existing error handling path and 'goto'
there.

Fixes: 260ea95cc027 ("ASoC: atmel: ac97c: Handle return value of clk_prepare_enable.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rt5645: Add jack detection workaround for MINIX Z83-4 based devices
Ian W MORRISON [Wed, 30 Aug 2017 22:35:47 +0000 (08:35 +1000)]
ASoC: rt5645: Add jack detection workaround for MINIX Z83-4 based devices

The MINIX NEO Z83-4 and MINIX NEO Z83-4 Pro devices requires jd_mode=3
to make the jack detection work. Using a BIOS DMI product of "Z83-4"
will match both devices of 'NEO Z83-4' and 'Z83-4 Pro'.

Signed-off-by: Ian W Morrison <ianwmorrison@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: tlv320aic3x: Support for OCMV configuration
Peter Ujfalusi [Thu, 31 Aug 2017 08:49:47 +0000 (11:49 +0300)]
ASoC: tlv320aic3x: Support for OCMV configuration

In aic3x class of devices Output Common-Mode Voltage can be configured for
better analog performance.
The OCMV value depends on the Analog and digital domain power supply
voltage configuration.

The default OCMV of 1.35V gives best performance when AVDD is around 2.7V
and DVDD is 1.525V, but for higher AVDD/DVDD higher OCMV setting is
recommended.

The patch gives an automatic way of guessing the best OCMV which can be
overwritten by a DT parameter if needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: sh: Put missing KERN_* prefix
Takashi Iwai [Thu, 31 Aug 2017 08:57:36 +0000 (10:57 +0200)]
ALSA: sh: Put missing KERN_* prefix

sh audio driver prints its presence at probe function but a proper
KERN_ prefix is missing.  Put KERN_INFO there as it's merely an
advertisement.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: usx2y: Put missing KERN_CONT prefix
Takashi Iwai [Thu, 31 Aug 2017 09:00:20 +0000 (11:00 +0200)]
ALSA: usx2y: Put missing KERN_CONT prefix

The usx2y driver has a debug printk code without proper KERN_ prefix.
On recent kernels, KERN_CONT prefix is mandatory for continued output
lines.  Put it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: usb-audio: Put missing KERN_CONT prefix
Takashi Iwai [Thu, 31 Aug 2017 08:59:12 +0000 (10:59 +0200)]
ALSA: usb-audio: Put missing KERN_CONT prefix

The usb-audio driver has a debug printk code without proper KERN_
prefix.  On recent kernels, KERN_CONT prefix is mandatory for
continued output lines.  Put it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: asihpi: Put missing KERN_CONT prefix
Takashi Iwai [Thu, 31 Aug 2017 08:56:50 +0000 (10:56 +0200)]
ALSA: asihpi: Put missing KERN_CONT prefix

The asihpi driver has a debug printk code without proper KERN_
prefix.  On recent kernels, KERN_CONT prefix is mandatory for
continued output lines.  Put it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: vx: Put missing KERN_CONT prefix
Takashi Iwai [Thu, 31 Aug 2017 08:56:12 +0000 (10:56 +0200)]
ALSA: vx: Put missing KERN_CONT prefix

The vx driver has a debug printk code without proper KERN_ prefix.
On recent kernels, KERN_CONT prefix is mandatory for continued output
lines.  Put it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: opl3: Put missing KERN_CONT prefix
Takashi Iwai [Thu, 31 Aug 2017 08:53:35 +0000 (10:53 +0200)]
ALSA: opl3: Put missing KERN_CONT prefix

The opl3 driver has a debug printk code without proper KERN_ prefix.
On recent kernels, KERN_CONT prefix is mandatory for continued output
lines.  Put it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: add Component level set_jack
Kuninori Morimoto [Thu, 24 Aug 2017 00:58:07 +0000 (00:58 +0000)]
ASoC: add Component level set_jack

In current ALSA SoC, Codec only has set_jack feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: add Component level set_pll
Kuninori Morimoto [Thu, 24 Aug 2017 00:57:51 +0000 (00:57 +0000)]
ASoC: add Component level set_pll

In current ALSA SoC, Codec only has set_pll feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: add Component level set_sysclk
Kuninori Morimoto [Thu, 24 Aug 2017 00:57:35 +0000 (00:57 +0000)]
ASoC: add Component level set_sysclk

In current ALSA SoC, Codec only has set_sysclk feature.
Codec will be merged into Component in next generation ALSA SoC,
thus current Codec specific feature need to be merged into it.
This is glue patch for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoMerge tag 'v4.13-rc7' into asoc-component
Mark Brown [Wed, 30 Aug 2017 21:15:31 +0000 (22:15 +0100)]
Merge tag 'v4.13-rc7' into asoc-component

Linux 4.13-rc7

7 years agoALSA: pcm: Unify ioctl functions for playback and capture streams
Takashi Iwai [Wed, 30 Aug 2017 13:39:32 +0000 (15:39 +0200)]
ALSA: pcm: Unify ioctl functions for playback and capture streams

Some ioctl functions are implemented individually for both playback
and capture streams although most of the codes are identical with just
a few different stream-specific function calls.  This patch unifies
these places, removes the superfluous trivial check and flattens the
call paths as a cleanup.  Meanwhile, for better readability, some
codes (e.g. xfer ioctls or forward/rewind ioctls) are factored out as
functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoALSA: Get rid of card power_lock
Takashi Iwai [Wed, 30 Aug 2017 14:13:25 +0000 (16:13 +0200)]
ALSA: Get rid of card power_lock

Currently we're taking power_lock at each card component for assuring
the power-up sequence, but it doesn't help anything in the
implementation at the moment: it just serializes unnecessarily the
callers, but it doesn't protect about the power state change itself.
It used to have some usefulness in the early days where we managed the
PM manually.  But now the suspend/resume core procedure is beyond our
hands, and power_lock lost its meaning.

This patch drops the power_lock from allover the places.
There shouldn't be any issues by this change, as it's no helper
regarding the power state change.  Rather we'll get better performance
by removing the serialization; which is the only slight concern of any
behavior change, but it can't be a showstopper, after all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: hdmi-codec: Use different name for playback streams
Jeffy Chen [Sat, 12 Aug 2017 00:40:38 +0000 (08:40 +0800)]
ASoC: hdmi-codec: Use different name for playback streams

Currently the hdmi i2s playback stream and hdmi spdif playback stream
are using the same name. So when they are enabled at the same time,
kernel will print this warning:

[    2.201835] hdmi-audio-codec hdmi-audio-codec.1.auto: ASoC: Failed to
create Playback debugfs file

Assign different names to them to avoid that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: simple_card_utils: fix fallback when "label" property isn't present
Lucas Stach [Tue, 29 Aug 2017 15:51:22 +0000 (17:51 +0200)]
ASoC: simple_card_utils: fix fallback when "label" property isn't present

snd_soc_of_parse_card_name() doesn't return an error if the requested
property isn't present, but silently fails to fill the card name. This can
not be changed, as it is a backwards compatibility measure itself.

We can not rely on the return value of this function alone, but must check
if the card name has been filled sucessfully when deciding to skip the
fallback path, which is in place for existing users.

Fixes: dedfaa1eedc7 (ASoC: simple-card-utils: enable "label" on
                     asoc_simple_card_parse_card_name)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: Drop unit-addresses without reg properties
Geert Uytterhoeven [Wed, 30 Aug 2017 10:01:06 +0000 (12:01 +0200)]
ASoC: rsnd: Drop unit-addresses without reg properties

Nodes without reg properties must not have unit addresses:

    Warning (unit_address_vs_reg): Node .../rcar_sound,dvc/dvc@0 has a unit name, but no reg property

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rockchip: constify snd_soc_ops structures
Jeffy Chen [Wed, 30 Aug 2017 09:58:14 +0000 (17:58 +0800)]
ASoC: rockchip: constify snd_soc_ops structures

Add const to dp/dmic snd_soc_ops.

Fixes: 626d84db64d7 (ASoC: rockchip: Add support for DMIC codec)
Fixes: 3313faf1053e (ASoC: rockchip: Add support for DP codec)
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rt5663: Add delay for jack plug in
oder_chiou@realtek.com [Wed, 30 Aug 2017 05:08:31 +0000 (13:08 +0800)]
ASoC: rt5663: Add delay for jack plug in

Codec initialize takes some time when 3.5mm jack plugged in. Add a
delay to report jack plugged event to user space to avoid pop noise.

Signed-off-by: Hsinyu Chao <hychao@chromium.org>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rt274: add acpi id
Bard Liao [Wed, 30 Aug 2017 04:28:31 +0000 (12:28 +0800)]
ASoC: rt274: add acpi id

Add ACPI id for Intel platform.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Wed, 30 Aug 2017 13:17:10 +0000 (15:17 +0200)]
Merge branch 'for-linus' into for-next

7 years agoALSA: pcm: Fix power lock unbalance via OSS emulation
Takashi Iwai [Wed, 30 Aug 2017 12:50:07 +0000 (14:50 +0200)]
ALSA: pcm: Fix power lock unbalance via OSS emulation

PCM OSS emulation issues the drain ioctl without power lock.  It used
to work in the earlier kernels as the power lock was taken inside
snd_pcm_drain() itself.  But since 68b4acd32249 ("ALSA: pcm: Apply
power lock globally to common ioctls"), the power lock is taken
outside the function.  Due to that change, the call via OSS emulation
leads to the unbalanced power lock, thus it deadlocks.

As a quick fix, just take the power lock before snd_pcm_drain() call
for OSS emulation path.  A better cleanup will follow later.

Fixes: 68b4acd32249 ("ALSA: pcm: Apply power lock globally to common ioctls")
Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoASoC: tas2552: Fix fraction overflow in PLL calculation
Oskar Schirmer [Fri, 25 Aug 2017 21:36:56 +0000 (21:36 +0000)]
ASoC: tas2552: Fix fraction overflow in PLL calculation

Setting the PLL involves the calculation of a fixed point ratio
with 4 decimal digits fraction, referred to as "J.D". The
fraction "D" is stored separately from the integer part "J"
and is limited to 0..9999.

The current algorithm uses integer registers to calculate the
fraction part, but failed to compensate for rounding errors,
resulting in values larger than 9999 for the fraction part
occasionally, e.g. for 44.1kHz audio rate and pll_clkin =
3763400 it would set J to 11 and D to 10002, which will at
best result in wrong pitch.

The critical part is the "pll_clkin / 10000", which would be
ok with real numbers, but using integer arithmetic the rounding
decreases the divisor, thus increasing the final quotient.

The issue is solved by linear interpolation over the reciprocal
function between the two adjacent points with integer divisor,
i.e. pll_clkin / 10000 and pll_clkin / 10000 + 1, and doing
all rounding to the lower result.

As a side effect to the bug fix, the approximation to the
desired frequency is much better, for the above mentioned
example we get 11.9993, while the true ratio is 11.9993623.

Signed-off-by: Oskar Schirmer <oskar@scara.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rockchip: Update description of rockchip, codec
Jeffy Chen [Thu, 24 Aug 2017 04:52:27 +0000 (12:52 +0800)]
ASoC: rockchip: Update description of rockchip, codec

Update description for newly added optional audio codecs.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rockchip: Add support for DMIC codec
Jeffy Chen [Thu, 24 Aug 2017 04:52:26 +0000 (12:52 +0800)]
ASoC: rockchip: Add support for DMIC codec

Add support for optional dmic codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rockchip: Add support for DP codec
Jeffy Chen [Thu, 24 Aug 2017 04:52:25 +0000 (12:52 +0800)]
ASoC: rockchip: Add support for DP codec

Add support for optional cdn dp codec.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rockchip: Parse dai links from dts
Jeffy Chen [Thu, 24 Aug 2017 04:52:24 +0000 (12:52 +0800)]
ASoC: rockchip: Parse dai links from dts

Refactor rockchip_sound_probe, parse dai links from dts instead of
hard coding them.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rockchip: Use codec of_node and dai_name for rt5514 dsp
Jeffy Chen [Thu, 24 Aug 2017 04:52:21 +0000 (12:52 +0800)]
ASoC: rockchip: Use codec of_node and dai_name for rt5514 dsp

Currently we are using codec name for rt5514 dsp dai link, use codec
of_node instead.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: kbl: Add map for Maxim IV Feedback
Naveen Manohar [Fri, 25 Aug 2017 21:51:39 +0000 (03:21 +0530)]
ASoC: Intel: kbl: Add map for Maxim IV Feedback

MAX98927 provides IV feedback on the capture widget.
Here we are connecting the capture widget to SSP0_RX and
SSP0_RX to the algorithm running on host.

Signed-off-by: Naveen M <naveen.m@intel.com>
Signed-off-by: Sathya Prakash M R <sathya.prakash.m.r@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rt5514: Guard Hotword Model bytes loading
Hsin-Yu Chao [Mon, 28 Aug 2017 07:13:50 +0000 (15:13 +0800)]
ASoC: rt5514: Guard Hotword Model bytes loading

If the rt5514-spi driver is not enabled in kernel, hotword model will
not be loaded when "DSP Voice Wake Up" is set to turn on DSP mode, and
an error is logged instead.

Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: fsl_dma: remove dma_object path member
Rob Herring [Tue, 29 Aug 2017 12:37:55 +0000 (07:37 -0500)]
ASoC: fsl_dma: remove dma_object path member

dma_object.path is unused, so rather than fix it to work with DT
full_name changes, just remove it.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Timur Tabi <timur@tabi.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: kbl: Add jack port initialize in kbl machine drivers
Naveen M [Fri, 25 Aug 2017 22:34:10 +0000 (04:04 +0530)]
ASoC: Intel: kbl: Add jack port initialize in kbl machine drivers

After the pcm jack is created, create and initialize the pin switch
widget for each port. For hdmi audio, invoke hdac_hdmi_jack_port_init
func() in rt5663_max98927 & rt5663_rt5514_max98927 to enable the pin,
when monitor is connected.

Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: Intel: kbl: Add MST route change to kbl machine drivers
Naveen M [Fri, 25 Aug 2017 22:34:09 +0000 (04:04 +0530)]
ASoC: Intel: kbl: Add MST route change to kbl machine drivers

To support MST hdmi audio, modify the current routes to be based
on port in rt5663_max98927 & rt5663_rt5514_max98927 machine.

Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoALSA: aoa: Convert to using %pOF instead of full_name
Rob Herring [Mon, 7 Aug 2017 23:29:19 +0000 (18:29 -0500)]
ALSA: aoa: Convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoLinux 4.13-rc7
Linus Torvalds [Mon, 28 Aug 2017 00:20:40 +0000 (17:20 -0700)]
Linux 4.13-rc7

7 years agoMerge tag 'iommu-fixes-v4.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 28 Aug 2017 00:10:34 +0000 (17:10 -0700)]
Merge tag 'iommu-fixes-v4.13-rc6' of git://git./linux/kernel/git/joro/iommu

Pull IOMMU fix from Joerg Roedel:
 "Another fix, this time in common IOMMU sysfs code.

  In the conversion from the old iommu sysfs-code to the
  iommu_device_register interface, I missed to update the release path
  for the struct device associated with an IOMMU. It freed the 'struct
  device', which was a pointer before, but is now embedded in another
  struct.

  Freeing from the middle of allocated memory had all kinds of nasty
  side effects when an IOMMU was unplugged. Unfortunatly nobody
  unplugged and IOMMU until now, so this was not discovered earlier. The
  fix is to make the 'struct device' a pointer again"

* tag 'iommu-fixes-v4.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu: Fix wrong freeing of iommu_device->dev

7 years agoMerge tag 'char-misc-4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
Linus Torvalds [Mon, 28 Aug 2017 00:08:37 +0000 (17:08 -0700)]
Merge tag 'char-misc-4.13-rc7' of git://git./linux/kernel/git/gregkh/char-misc

Pull char/misc fix from Greg KH:
 "Here is a single misc driver fix for 4.13-rc7. It resolves a reported
  problem in the Android binder driver due to previous patches in
  4.13-rc.

  It's been in linux-next with no reported issues"

* tag 'char-misc-4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  ANDROID: binder: fix proc->tsk check.

7 years agoMerge tag 'staging-4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Mon, 28 Aug 2017 00:03:33 +0000 (17:03 -0700)]
Merge tag 'staging-4.13-rc7' of git://git./linux/kernel/git/gregkh/staging

Pull staging/iio fixes from Greg KH:
 "Here are few small staging driver fixes, and some more IIO driver
  fixes for 4.13-rc7. Nothing major, just resolutions for some reported
  problems.

  All of these have been in linux-next with no reported problems"

* tag 'staging-4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  iio: magnetometer: st_magn: remove ihl property for LSM303AGR
  iio: magnetometer: st_magn: fix status register address for LSM303AGR
  iio: hid-sensor-trigger: Fix the race with user space powering up sensors
  iio: trigger: stm32-timer: fix get trigger mode
  iio: imu: adis16480: Fix acceleration scale factor for adis16480
  PATCH] iio: Fix some documentation warnings
  staging: rtl8188eu: add RNX-N150NUB support
  Revert "staging: fsl-mc: be consistent when checking strcmp() return"
  iio: adc: stm32: fix common clock rate
  iio: adc: ina219: Avoid underflow for sleeping time
  iio: trigger: stm32-timer: add enable attribute
  iio: trigger: stm32-timer: fix get/set down count direction
  iio: trigger: stm32-timer: fix write_raw return value
  iio: trigger: stm32-timer: fix quadrature mode get routine
  iio: bmp280: properly initialize device for humidity reading

7 years agoMerge tag 'ntb-4.13-bugfixes' of git://github.com/jonmason/ntb
Linus Torvalds [Mon, 28 Aug 2017 00:01:54 +0000 (17:01 -0700)]
Merge tag 'ntb-4.13-bugfixes' of git://github.com/jonmason/ntb

Pull NTB fixes from Jon Mason:
 "NTB bug fixes to address an incorrect ntb_mw_count reference in the
  NTB transport, improperly bringing down the link if SPADs are
  corrupted, and an out-of-order issue regarding link negotiation and
  data passing"

* tag 'ntb-4.13-bugfixes' of git://github.com/jonmason/ntb:
  ntb: ntb_test: ensure the link is up before trying to configure the mws
  ntb: transport shouldn't disable link due to bogus values in SPADs
  ntb: use correct mw_count function in ntb_tool and ntb_transport

7 years agoAvoid page waitqueue race leaving possible page locker waiting
Linus Torvalds [Sun, 27 Aug 2017 23:25:09 +0000 (16:25 -0700)]
Avoid page waitqueue race leaving possible page locker waiting

The "lock_page_killable()" function waits for exclusive access to the
page lock bit using the WQ_FLAG_EXCLUSIVE bit in the waitqueue entry
set.

That means that if it gets woken up, other waiters may have been
skipped.

That, in turn, means that if it sees the page being unlocked, it *must*
take that lock and return success, even if a lethal signal is also
pending.

So instead of checking for lethal signals first, we need to check for
them after we've checked the actual bit that we were waiting for.  Even
if that might then delay the killing of the process.

This matches the order of the old "wait_on_bit_lock()" infrastructure
that the page locking used to use (and is still used in a few other
areas).

Note that if we still return an error after having unsuccessfully tried
to acquire the page lock, that is ok: that means that some other thread
was able to get ahead of us and lock the page, and when that other
thread then unlocks the page, the wakeup event will be repeated.  So any
other pending waiters will now get properly woken up.

Fixes: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit")
Cc: Nick Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Jan Kara <jack@suse.cz>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoMinor page waitqueue cleanups
Linus Torvalds [Sun, 27 Aug 2017 20:55:12 +0000 (13:55 -0700)]
Minor page waitqueue cleanups

Tim Chen and Kan Liang have been battling a customer load that shows
extremely long page wakeup lists.  The cause seems to be constant NUMA
migration of a hot page that is shared across a lot of threads, but the
actual root cause for the exact behavior has not been found.

Tim has a patch that batches the wait list traversal at wakeup time, so
that we at least don't get long uninterruptible cases where we traverse
and wake up thousands of processes and get nasty latency spikes.  That
is likely 4.14 material, but we're still discussing the page waitqueue
specific parts of it.

In the meantime, I've tried to look at making the page wait queues less
expensive, and failing miserably.  If you have thousands of threads
waiting for the same page, it will be painful.  We'll need to try to
figure out the NUMA balancing issue some day, in addition to avoiding
the excessive spinlock hold times.

That said, having tried to rewrite the page wait queues, I can at least
fix up some of the braindamage in the current situation. In particular:

 (a) we don't want to continue walking the page wait list if the bit
     we're waiting for already got set again (which seems to be one of
     the patterns of the bad load).  That makes no progress and just
     causes pointless cache pollution chasing the pointers.

 (b) we don't want to put the non-locking waiters always on the front of
     the queue, and the locking waiters always on the back.  Not only is
     that unfair, it means that we wake up thousands of reading threads
     that will just end up being blocked by the writer later anyway.

Also add a comment about the layout of 'struct wait_page_key' - there is
an external user of it in the cachefiles code that means that it has to
match the layout of 'struct wait_bit_key' in the two first members.  It
so happens to match, because 'struct page *' and 'unsigned long *' end
up having the same values simply because the page flags are the first
member in struct page.

Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Christopher Lameter <cl@linux.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoClarify (and fix) MAX_LFS_FILESIZE macros
Linus Torvalds [Sun, 27 Aug 2017 19:12:25 +0000 (12:12 -0700)]
Clarify (and fix) MAX_LFS_FILESIZE macros

We have a MAX_LFS_FILESIZE macro that is meant to be filled in by
filesystems (and other IO targets) that know they are 64-bit clean and
don't have any 32-bit limits in their IO path.

It turns out that our 32-bit value for that limit was bogus.  On 32-bit,
the VM layer is limited by the page cache to only 32-bit index values,
but our logic for that was confusing and actually wrong.  We used to
define that value to

(((loff_t)PAGE_SIZE << (BITS_PER_LONG-1))-1)

which is actually odd in several ways: it limits the index to 31 bits,
and then it limits files so that they can't have data in that last byte
of a page that has the highest 31-bit index (ie page index 0x7fffffff).

Neither of those limitations make sense.  The index is actually the full
32 bit unsigned value, and we can use that whole full page.  So the
maximum size of the file would logically be "PAGE_SIZE << BITS_PER_LONG".

However, we do wan tto avoid the maximum index, because we have code
that iterates over the page indexes, and we don't want that code to
overflow.  So the maximum size of a file on a 32-bit host should
actually be one page less than the full 32-bit index.

So the actual limit is ULONG_MAX << PAGE_SHIFT.  That means that we will
not actually be using the page of that last index (ULONG_MAX), but we
can grow a file up to that limit.

The wrong value of MAX_LFS_FILESIZE actually caused problems for Doug
Nazar, who was still using a 32-bit host, but with a 9.7TB 2 x RAID5
volume.  It turns out that our old MAX_LFS_FILESIZE was 8TiB (well, one
byte less), but the actual true VM limit is one page less than 16TiB.

This was invisible until commit c2a9737f45e2 ("vfs,mm: fix a dead loop
in truncate_inode_pages_range()"), which started applying that
MAX_LFS_FILESIZE limit to block devices too.

NOTE! On 64-bit, the page index isn't a limiter at all, and the limit is
actually just the offset type itself (loff_t), which is signed.  But for
clarity, on 64-bit, just use the maximum signed value, and don't make
people have to count the number of 'f' characters in the hex constant.

So just use LLONG_MAX for the 64-bit case.  That was what the value had
been before too, just written out as a hex constant.

Fixes: c2a9737f45e2 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()")
Reported-and-tested-by: Doug Nazar <nazard@nazar.ca>
Cc: Andreas Dilger <adilger@dilger.ca>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agoASoC: davinci-mcasp: check memory allocation failure
Christophe Jaillet [Sun, 27 Aug 2017 06:46:50 +0000 (08:46 +0200)]
ASoC: davinci-mcasp: check memory allocation failure

Check memory allocation failures and return -ENOMEM in such cases, as
already done above for another memory allocation.

This avoids NULL pointers dereference.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Sat, 26 Aug 2017 19:48:29 +0000 (12:48 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:

 - a tweak to the IBM Trackpoint driver that helps recognizing
   trackpoints on never Lenovo Carbons

 - a fix to the ALPS driver solving scroll issues on some Dells

 - yet another ACPI ID has been added to Elan I2C toucpad driver

 - quieted diagnostic message in soc_button_array driver

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: ALPS - fix two-finger scroll breakage in right side on ALPS touchpad
  Input: soc_button_array - silence -ENOENT error on Dell XPS13 9365
  Input: trackpoint - add new trackpoint firmware ID
  Input: elan_i2c - add ELAN0602 ACPI ID to support Lenovo Yoga310

7 years agoMerge tag 'pci-v4.13-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaa...
Linus Torvalds [Sat, 26 Aug 2017 19:46:14 +0000 (12:46 -0700)]
Merge tag 'pci-v4.13-fixes-3' of git://git./linux/kernel/git/helgaas/pci

Pull PCI fix from Bjorn Helgaas:
 "Remove needlessly alarming MSI affinity warning (this is not actually
  a bug fix, but the warning prompts unnecessary bug reports)"

* tag 'pci-v4.13-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI/MSI: Don't warn when irq_create_affinity_masks() returns NULL

7 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 26 Aug 2017 16:06:28 +0000 (09:06 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Two fixes: one for an ldt_struct handling bug and a cherry-picked
  objtool fix"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mm: Fix use-after-free of ldt_struct
  objtool: Fix '-mtune=atom' decoding support in objtool 2.0

7 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 26 Aug 2017 16:02:18 +0000 (09:02 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
 "Fix a timer granularity handling race+bug, which would manifest itself
  by spuriously increasing timeouts of some timers (from 1 jiffy to ~500
  jiffies in the worst case measured) in certain nohz states"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  timers: Fix excessive granularity of new timers after a nohz idle

7 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 26 Aug 2017 15:59:50 +0000 (08:59 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fix from Ingo Molnar:
 "A single fix to not allow nonsensical event groups that result in
  kernel warnings"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix group {cpu,task} validation

7 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Sat, 26 Aug 2017 01:02:27 +0000 (18:02 -0700)]
Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "6 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  mm/memblock.c: reversed logic in memblock_discard()
  fork: fix incorrect fput of ->exe_file causing use-after-free
  mm/madvise.c: fix freeing of locked page with MADV_FREE
  dax: fix deadlock due to misaligned PMD faults
  mm, shmem: fix handling /sys/kernel/mm/transparent_hugepage/shmem_enabled
  PM/hibernate: touch NMI watchdog when creating snapshot