platform/kernel/linux-rpi.git
7 years agoASoC: rsnd: NULL check is not needed for clk_unprepare()
Kuninori Morimoto [Tue, 31 Oct 2017 00:39:17 +0000 (00:39 +0000)]
ASoC: rsnd: NULL check is not needed for clk_unprepare()

clk_unprepare() is checking parameter by IS_ERR_OR_NULL().
clk NULL check is not needed on rsnd_mod_quit()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: tidyup rsnd_mod_next() for loop method
Kuninori Morimoto [Tue, 31 Oct 2017 00:38:36 +0000 (00:38 +0000)]
ASoC: rsnd: tidyup rsnd_mod_next() for loop method

Let's remove point less "continue"

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: don't use io->mod[] directly
Kuninori Morimoto [Tue, 31 Oct 2017 00:38:09 +0000 (00:38 +0000)]
ASoC: rsnd: don't use io->mod[] directly

We have rsnd_io_to_mod() macro. Let's use it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: audio-graph-scu-card: remove unnecessary route patch from Example 1
Kuninori Morimoto [Tue, 17 Oct 2017 06:57:49 +0000 (06:57 +0000)]
ASoC: audio-graph-scu-card: remove unnecessary route patch from Example 1

Example 1 is for "Sampling Rate Conversion",
sample has only 1 CPU, 1 Codec.
Thus, "codec Playback", "DAI1 Playback" route is unnecessary.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: audio-graph-scu-card: add missing Capture routing on Example
Kuninori Morimoto [Tue, 17 Oct 2017 06:57:19 +0000 (06:57 +0000)]
ASoC: audio-graph-scu-card: add missing Capture routing on Example

Both cases have 1 Capture path.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: more clear ADG clock debug info
Kuninori Morimoto [Fri, 13 Oct 2017 06:03:06 +0000 (06:03 +0000)]
ASoC: rsnd: more clear ADG clock debug info

ADG inputs clock from CLK{A,B,C,I} and outputs clock from
CLKOUT{0,1,2,3} which is selected by BRG{A,B}.
Now, ADG is assuming BRGA is for 44100Hz related clocks,
BRGB is for 48000Hz related clocks.

Clock related debug is very difficult/confusable.
This patch cleanups clock related debug info.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: add rsnd_kctrl_xxx() macro
Kuninori Morimoto [Wed, 11 Oct 2017 04:42:34 +0000 (04:42 +0000)]
ASoC: rsnd: add rsnd_kctrl_xxx() macro

Current CTU/MIX/DVC are directly using rsnd_kctrl_cfg_m/s to control
val etc, but it is difficult to read/understand.
And there was no uniformity in access method.
This patch adds new rsnd_kctrl_xxx() and implements uniformed access
method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: add MIX Volume Ramp support
Kuninori Morimoto [Sun, 1 Oct 2017 23:49:18 +0000 (23:49 +0000)]
ASoC: rsnd: add MIX Volume Ramp support

Both DVC/MIX have Volume Ramp Control. This patch supprts MIX
Volume Ramp. One note is that main purpose of MIX Volume Ramp
is to reduce noise, thus, MIX Ramp range is very few if you
compare to DVC Volume Ramp (DVC = 5bit, MIX = 4bit).

You can use MIX Volume Ranp like below
amixer set "MIX Ramp Up Rate"   "0.125 dB/1 step"
amixer set "MIX Ramp Down Rate" "0.125 dB/1 step"
amixer set "MIX Ramp" on
aplay xxx.wav &
amixer set "MIX",0  80%  // DAI0 Volume Down
amixer set "MIX",1 100%  // DAI1 Volume Up

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: makes volume ramp rate list generic
Kuninori Morimoto [Sun, 1 Oct 2017 23:49:03 +0000 (23:49 +0000)]
ASoC: rsnd: makes volume ramp rate list generic

DVC is supporting Volume Ramp Rate, and MIX has Volume Ramp
but not yet supported. To support MIX Volume Ramp, we want to
share Rate List since DVC/MIX are using almost same list.
This patch move DVC specific Volume Ramp Rate List to core.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: CTU kctrl sets once
Kuninori Morimoto [Sun, 1 Oct 2017 23:48:46 +0000 (23:48 +0000)]
ASoC: rsnd: CTU kctrl sets once

Same CTU might be used few times if system/platform is using MIX.
For example below case.

DAI0 playback = <&src0 &ctu02 &mix0 &dvc0 &ssi0>;
DAI1 playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;

This case, ALSA will have CTU,0 and CTU,1 kcontrol interfaces,
but these are same CTU. This is confusing.
This patch adds new flags and avoid such case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: DVC kctrl sets once
Kuninori Morimoto [Sun, 1 Oct 2017 23:48:29 +0000 (23:48 +0000)]
ASoC: rsnd: DVC kctrl sets once

Same DVC might be used few times if system/platform is using MIX.
For example below case.

DAI0 playback = <&src0 &ctu02 &mix0 &dvc0 &ssi0>;
DAI1 playback = <&src2 &ctu03 &mix0 &dvc0 &ssi0>;

This case, ALSA will have DVC,0 and DVC,1 kcontrol interfaces,
but these are same DVC. This is confusing.
This patch adds new flags and avoid such case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: use generic rsnd_flags_xxx() macro on ADG
Kuninori Morimoto [Sun, 1 Oct 2017 23:48:12 +0000 (23:48 +0000)]
ASoC: rsnd: use generic rsnd_flags_xxx() macro on ADG

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: add generic rsnd_flags_xxx() macro
Kuninori Morimoto [Sun, 1 Oct 2017 23:47:50 +0000 (23:47 +0000)]
ASoC: rsnd: add generic rsnd_flags_xxx() macro

SSI is using rsnd_ssi_flags_xxx() macro to control flags.
But it is useful macro not only for SSI. This patch replace it
to more generic rsnd_flags_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: add rsnd_dma_alloc()
Kuninori Morimoto [Wed, 20 Sep 2017 06:28:44 +0000 (06:28 +0000)]
ASoC: rsnd: add rsnd_dma_alloc()

R-Car sound DMA will be used from SSI/SRC.
dma.c doesn't alloc DMA handler in .probe timing, because we don't
know what kind of DMA transfer will be used then.
Thus, SSI/SRC have *rsnd_mod for DMA. rsnd_dma_attach() will allocate
it and attach it to system.
It will be PIO mode if it can't alloc DMA handler.

In case of MIX is used, rsnd_dma_attach() will be called twice from SSI.
To avoid duplicate allocation, current rsnd_dma_attach() is checking
allocated DMA handler. This DMA related operation is a little bit
difficult to understand.
This patch adds new rsnd_dma_alloc() and separates allocation and attach
for readable code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
7 years agoASoC: rsnd: fix ADG flags
Kuninori Morimoto [Mon, 11 Sep 2017 04:17:26 +0000 (04:17 +0000)]
ASoC: rsnd: fix ADG flags

Current ADG driver is over-writing flags. This patch fixes it.

Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
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 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 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 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 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 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

7 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sat, 26 Aug 2017 00:46:23 +0000 (17:46 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull Paolo Bonzini:
 "Bugfixes for x86, PPC and s390"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: PPC: Book3S: Fix race and leak in kvm_vm_ioctl_create_spapr_tce()
  KVM, pkeys: do not use PKRU value in vcpu->arch.guest_fpu.state
  KVM: x86: simplify handling of PKRU
  KVM: x86: block guest protection keys unless the host has them enabled
  KVM: PPC: Book3S HV: Add missing barriers to XIVE code and document them
  KVM: PPC: Book3S HV: Workaround POWER9 DD1.0 bug causing IPB bit loss
  KVM: PPC: Book3S HV: Use msgsync with hypervisor doorbells on POWER9
  KVM: s390: sthyi: fix specification exception detection
  KVM: s390: sthyi: fix sthyi inline assembly

7 years agoMerge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Linus Torvalds [Sat, 26 Aug 2017 00:40:03 +0000 (17:40 -0700)]
Merge tag 'for_linus' of git://git./linux/kernel/git/mst/vhost

Pull virtio fixes from Michael Tsirkin:
 "Fixes two obvious bugs in virtio pci"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio_pci: fix cpu affinity support
  virtio_blk: fix incorrect message when disk is resized

7 years agoMerge tag 'powerpc-4.13-8' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sat, 26 Aug 2017 00:32:35 +0000 (17:32 -0700)]
Merge tag 'powerpc-4.13-8' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fix from Michael Ellerman:
 "Just one fix, to add a barrier in the switch_mm() code to make sure
  the mm cpumask update is ordered vs the MMU starting to load
  translations. As far as we know no one's actually hit the bug, but
  that's just luck.

  Thanks to Benjamin Herrenschmidt, Nicholas Piggin"

* tag 'powerpc-4.13-8' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/mm: Ensure cpumask update is ordered

7 years agoMerge tag 'nfsd-4.13-2' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Sat, 26 Aug 2017 00:27:26 +0000 (17:27 -0700)]
Merge tag 'nfsd-4.13-2' of git://linux-nfs.org/~bfields/linux

Pull nfsd fixes from Bruce Fields:
 "Two nfsd bugfixes, neither 4.13 regressions, but both potentially
  serious"

* tag 'nfsd-4.13-2' of git://linux-nfs.org/~bfields/linux:
  net: sunrpc: svcsock: fix NULL-pointer exception
  nfsd: Limit end of page list when decoding NFSv4 WRITE

7 years agoMerge tag 'cifs-fixes-for-4.13-rc6-and-stable' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sat, 26 Aug 2017 00:22:33 +0000 (17:22 -0700)]
Merge tag 'cifs-fixes-for-4.13-rc6-and-stable' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "Some bug fixes for stable for cifs"

* tag 'cifs-fixes-for-4.13-rc6-and-stable' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
  cifs: Fix df output for users with quota limits

7 years agoMerge tag 'for-linus-20170825' of git://git.infradead.org/linux-mtd
Linus Torvalds [Sat, 26 Aug 2017 00:09:19 +0000 (17:09 -0700)]
Merge tag 'for-linus-20170825' of git://git.infradead.org/linux-mtd

Pull MTD fixes from Brian Norris:
 "Two fixes - one for a 4.13 regression, and the other for an older one:

   - Atmel NAND: since we started utilizing ONFI timings, we found that
     we were being too restrict at rejecting them, partly due to
     discrepancies in ONFI 4.0 and earlier versions. Relax the
     restriction to keep these platforms booting. This is a 4.13-rc1
     regression.

   - nandsim: repeated probe/removal may not work after a failed init,
     because we didn't free up our debugfs files properly on the failure
     path. This has been around since 3.8, but it's nice to get this
     fixed now in a nice easy patch that can target -stable, since
     there's already refactoring work (that also fixes the issue)
     targeted for the next merge window"

* tag 'for-linus-20170825' of git://git.infradead.org/linux-mtd:
  mtd: nand: atmel: Relax tADL_min constraint
  mtd: nandsim: remove debugfs entries in error path