platform/kernel/linux-exynos.git
4 years agotizen_odroid_kvm_defconfig: enable SCSI TARGET related options sandbox/mszyprowski/v4.14-odroid-kvm
Marek Szyprowski [Thu, 3 Oct 2019 15:04:48 +0000 (17:04 +0200)]
tizen_odroid_kvm_defconfig: enable SCSI TARGET related options

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
4 years agoARM: config: add tizen_odroid_kvm_defconfig
Marek Szyprowski [Tue, 17 Sep 2019 08:08:21 +0000 (10:08 +0200)]
ARM: config: add tizen_odroid_kvm_defconfig

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
4 years agoARM: dts: vexpress: add arch timer clock frequency needed for OdroidXU3/4
Marek Szyprowski [Wed, 24 Jul 2019 06:58:06 +0000 (08:58 +0200)]
ARM: dts: vexpress: add arch timer clock frequency needed for OdroidXU3/4

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
4 years agoARM: exynos: Enable support for ARM architected timers
Marek Szyprowski [Fri, 15 Feb 2019 10:02:26 +0000 (11:02 +0100)]
ARM: exynos: Enable support for ARM architected timers

ARM architected timer can be used together with Exynos MultiCore Timer
driver, so enable support for it. Support for ARM architected timers is
essential for enabling proper KVM support.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
4 years agoARM: dts: exynos: Add support ARM architected timers on Exynos5
Marek Szyprowski [Fri, 14 Sep 2018 09:19:07 +0000 (11:19 +0200)]
ARM: dts: exynos: Add support ARM architected timers on Exynos5

All CortexA7/A15 based Exynos5 SoCs have ARM architected timers, so enable
support for them directly in the base dtsi. None of the known firmware
properly configures CNTFRQ arch timer register, so force clock frequency
to 24MHz, which is the only configuration supported by the remaining
clock drivers so far.

Stock firmware for Peach Pit and Pi Chromebooks also doesn't reset
properly other arch timer registers, so add respective properties
indicating that. Other Exynos5-based boards behaves correctly in this area,
what finally allows to enable support for KVM-based virtualization.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
4 years agoclocksource: exynos_mct: Increase priority over ARM arch timer
Marek Szyprowski [Mon, 14 May 2018 07:06:03 +0000 (09:06 +0200)]
clocksource: exynos_mct: Increase priority over ARM arch timer

Exynos SoCs based on CA7/CA15 have 2 timer interfaces: custom Exynos MCT
(Multi Core Timer) and standard ARM Architected Timers.

There are use cases, where both timer interfaces are used simultanously.
One of such examples is using Exynos MCT for the main system timer and
ARM Architected Timers for the KVM and virtualized guests (KVM requires
arch timers).

Exynos Multi-Core Timer driver (exynos_mct) must be however started
before ARM Architected Timers (arch_timer), because they both share some
common hardware blocks (global system counter) and turning on MCT is
needed to get ARM Architected Timer working properly.

To ensure selecting Exynos MCT as the main system timer, increase MCT
timer rating. To ensure proper starting order of both timers during
suspend/resume cycle, increase MCT hotplug priority over ARM Archictected
Timers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agoclocksource: exynos_mct: Fix error path in timer resources initialization
Marek Szyprowski [Mon, 15 Oct 2018 09:43:00 +0000 (11:43 +0200)]
clocksource: exynos_mct: Fix error path in timer resources initialization

While freeing interrupt handlers in error path, don't assume that all
requested interrupts are per-processor interrupts and properly release
standard interrupts too.

Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Fixes: 56a94f13919c ("clocksource: exynos_mct: Avoid blocking calls in the cpu hotplug notifier")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agoclocksource: exynos_mct: Remove dead code
Marek Szyprowski [Tue, 2 Oct 2018 14:39:37 +0000 (16:39 +0200)]
clocksource: exynos_mct: Remove dead code

Exynos Multi-Core Timer driver is used only on device-tree based
systems, so remove non-dt related code. In case of !CONFIG_OF
the code is anyway equal because of_irq_count() has a stub
returning 0. Device node pointer is always provided when driver
has been probed from device tree.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
4 years agoARM: exynos: Fix boot with CONFIG_SUSPEND disabled 47/213547/1
Marek Szyprowski [Fri, 6 Sep 2019 11:43:57 +0000 (13:43 +0200)]
ARM: exynos: Fix boot with CONFIG_SUSPEND disabled

Exynos SMP code relies on PMU registers to be mapped via pmu_base_addr.
Those mapping is done in suspend.c:exynos_pmu_irq_init(), which is not
called if CONFIG_SUSPEND is disabled. Fix this by moving PMU mapping
creation to exynos.c:exynos_map_pmu(), which is called in all cases.

Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ic9dc37b18b63827b612fbc91e0f84509d4e8723b

4 years agodrm/exynos: fix to build suspend/resume callback functions always 27/213527/1
Seung-Woo Kim [Fri, 6 Sep 2019 08:04:23 +0000 (17:04 +0900)]
drm/exynos: fix to build suspend/resume callback functions always

When CONFIG_SUSPEND is disabled, conditional build for suspend and
resume callbcak functions causes build error after the commit
ae1c75eeaa19 ("drm/exynos: Suspend/resume display pipeline as
early/late as possible"). So fix to build the callbacks always
like mainline applied version, the commit dc684af6fc8d.

Change-Id: I226ef3279df0b3ed646f5c532a0093b34e877723
CC: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoARM: configs: tizen_odroid_defconfig: Enable NETFILTER_XT_MATCH_OWNER config 34/211234/1 accepted/tizen/unified/20190801.113438 submit/tizen/20190801.010047
Seung-Woo Kim [Wed, 31 Jul 2019 07:56:06 +0000 (16:56 +0900)]
ARM: configs: tizen_odroid_defconfig: Enable NETFILTER_XT_MATCH_OWNER config

Enable the NETFILTER_XT_MATCH_OWNER config option to use xt_owner
supplementary groups.

Change-Id: I715a8e360152f4f46d3ea7daeef5c6bcbc895e2f
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoARM: configs: tizen_odroid: sync with savedefconfig 33/211233/1
Seung-Woo Kim [Wed, 31 Jul 2019 07:53:58 +0000 (16:53 +0900)]
ARM: configs: tizen_odroid: sync with savedefconfig

After few changes, it is different from savedefconfig, so sync.

Change-Id: I50759332ef3660cf57090d65e78e7fc95d945342
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agoarm64: configs: tizen_tm2_defconfig: Enable NETFILTER_XT_MATCH_OWNER config 32/211232/1
Seung-Woo Kim [Wed, 31 Jul 2019 07:54:52 +0000 (16:54 +0900)]
arm64: configs: tizen_tm2_defconfig: Enable NETFILTER_XT_MATCH_OWNER config

Enable the NETFILTER_XT_MATCH_OWNER config option to use xt_owner
supplementary groups.

Change-Id: I3719c6fb2d2f12014889e88002fd7ac9f67f4d94
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
4 years agonetfilter: xt_owner: bail out with EINVAL in case of unsupported flags 09/209209/1 accepted/tizen/unified/20190705.110609 submit/tizen/20190705.061120
Pablo Neira Ayuso [Fri, 7 Jun 2019 14:37:30 +0000 (16:37 +0200)]
netfilter: xt_owner: bail out with EINVAL in case of unsupported flags

Reject flags that are not supported with EINVAL.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to apply supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I92f1bd37788cc71088112770bb1b4071dfe8f3fd

4 years agonetfilter: xt_owner: Add supplementary groups option 08/209208/1
Lukasz Pawelczyk [Fri, 10 May 2019 11:46:22 +0000 (13:46 +0200)]
netfilter: xt_owner: Add supplementary groups option

The XT_OWNER_SUPPL_GROUPS flag causes GIDs specified with XT_OWNER_GID
to be also checked in the supplementary groups of a process.

f_cred->group_info cannot be modified during its lifetime and f_cred
holds a reference to it so it's safe to use.

Signed-off-by: Lukasz Pawelczyk <l.pawelczyk@samsung.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[sw0312.kim: backport from mainline to apply supplementary groups on netfilter]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ie2e4c64388b4c64794ebc73de9bacf206eb46173

4 years agoARM: defconfig: enable I-Cache line size workaround on Exynos systems 53/206253/1 accepted/tizen/unified/20190611.110428 submit/tizen/20190611.014400
Marek Szyprowski [Wed, 15 May 2019 10:58:27 +0000 (12:58 +0200)]
ARM: defconfig: enable I-Cache line size workaround on Exynos systems

All Exynos big.LITTLE system suffer from I-Cache line size mismatch between
CPU cores, so enable workaround for it in exynos_defconfig and
tizen_odroid_defconfig.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I0f324a5832e1ef47999f7b8d4ddd4a29db0ee176

4 years agoARM: Add workaround for I-Cache line size mismatch between CPU cores 52/206252/1
Marek Szyprowski [Wed, 15 May 2019 07:53:55 +0000 (09:53 +0200)]
ARM: Add workaround for I-Cache line size mismatch between CPU cores

Some big.LITTLE systems have mismatch of I-Cache line size between
LITTLE and big cores. This patch adds workaround for proper I-Cache
support on such systems. Without it, some code (typically self-modifying)
might suffer from random SIGILL failures.

Similar workaround exists for ARM64 architecture, added by commit
116c81f427ff ("arm64: Work around systems with mismatched cache line
sizes").

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I76e1cb24cde91dbfd5a16bd8d5dc97c7953767ff

5 years agogpu: drm: exynos: Add extcon notification for hdmi connection 46/205546/1 accepted/tizen/unified/20190508.111058 submit/tizen/20190507.092632
Dongwoo Lee [Tue, 17 Oct 2017 23:21:05 +0000 (08:21 +0900)]
gpu: drm: exynos: Add extcon notification for hdmi connection

Currently, hdmi connection generates only uevent by drm core. In
addition, it has no information about connection state. But, Tizen
starts TV-out behavior along with extcon uevent. To this end, this
patch will add extcon notification for hdmi connection.

Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
[sw0312.kim: port to v4.14]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I20a2d13deff07e566ce4f50c7fc64600ce10ca9f

5 years agoARM: configs: tizen_odroid: enable squashfs 43/204743/1 accepted/tizen/unified/20190426.110522 submit/tizen/20190426.054810
Seung-Woo Kim [Fri, 26 Apr 2019 05:05:27 +0000 (14:05 +0900)]
ARM: configs: tizen_odroid: enable squashfs

Tizen web engine uses squashfs for its libraray update. Enable
squashfs and related options.

Change-Id: Id9a25c46642598d0927a4304f6813dbbd64f68b1
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agoarm64: configs: tizen_tm2_defconfig: enable squashfs 42/204742/1
Seung-Woo Kim [Fri, 26 Apr 2019 05:03:43 +0000 (14:03 +0900)]
arm64: configs: tizen_tm2_defconfig: enable squashfs

Tizen web engine uses squashfs for its libraray update. Enable
squashfs and related options.

Change-Id: Id2f7640cf6007b280bb6daef3c42484e8b4a04ef
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agoclocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansion 29/203229/1
Mark Rutland [Mon, 16 Oct 2017 15:28:39 +0000 (16:28 +0100)]
clocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansion

Our ctags mangling script can't handle newlines inside of a
DEFINE_PER_CPU(), leading to an annoying message whenever tags are
built:

  ctags: Warning: drivers/clocksource/arm_arch_timer.c:302: null expansion of name pattern "\1"

This was dealt with elsewhere in commit:

  25528213fe9f75f4 ("tags: Fix DEFINE_PER_CPU expansions")

... by ensuring each DEFINE_PER_CPU() was contained on a single line,
even where this would violate the usual code style (checkpatch warnings
and all).

Let's do the same for the arch timer driver, and get rid of the
distraction.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[sw0312.kim: cherry-pick mainline commit a7fb4577bbe3 to resolve warning on ctags build]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id79bac4d2450f30c21b50cdf0de1be7fb3b1bbec

5 years agosoc: samsung: Split ASV drivers into ARM and ARM64 parts 44/202444/1 accepted/tizen/unified/20190330.030053 submit/tizen/20190329.020226
Sylwester Nawrocki [Thu, 28 Mar 2019 11:07:49 +0000 (12:07 +0100)]
soc: samsung: Split ASV drivers into ARM and ARM64 parts

This fixes build error with tizen_odroid_defconfig related to missing
MTD symbols required by exynos5433-asv.c driver.

The Exynos5433 ASV driver has dependency on MTD, to avoid inheriting this
dependency by the Exynos5422 ASV driver split Exynos ASV drivers into ARM
and ARM64 parts, similarly as it is done for the PMU.
This also has an advantage that we don't need to include ARM ASV drivers on
ARM64 SoCs and we can build only ARM ASV drivers for ARM SoCs.

Change-Id: I3d647b784f936dcb535632e4ee15a7d571d7a131
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: configs: tizen_tm2_defconfig: Enable MTD_EXYNOS_OTP 54/202354/1
Sylwester Nawrocki [Wed, 27 Mar 2019 11:39:55 +0000 (12:39 +0100)]
arm64: configs: tizen_tm2_defconfig: Enable MTD_EXYNOS_OTP

Enable MTD_EXYNOS_OTP which is required for the ASV driver on Exynos5433.

Change-Id: I6b176856405ea38c51436e73d5aa4df80c79f6b1
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: exynos: Enable ASV driver for ARCH_EXYNOS 51/200151/4
Sylwester Nawrocki [Wed, 30 Jan 2019 15:55:01 +0000 (16:55 +0100)]
arm64: exynos: Enable ASV driver for ARCH_EXYNOS

Enable ASV driver for Exynos5433 SoC.

Change-Id: I2870b83f909425356be2391ac5e534a773cd8db8
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agosoc: samsung: Add ASV support for Exynos5433 SoC 50/200150/4
Sylwester Nawrocki [Wed, 30 Jan 2019 17:16:08 +0000 (18:16 +0100)]
soc: samsung: Add ASV support for Exynos5433 SoC

This patch adds Adaptive Supply Voltage support or the Cortex A53
and the Cortex A57 clusters. There is no Adaptive Body Bias handling
added yet.

Change-Id: I07190bf3614428292594b42bb8a1fb60a7b3ae63
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: dts: Add Exynos5433 SoC OTP device node 54/200754/3
Sylwester Nawrocki [Fri, 1 Mar 2019 14:19:43 +0000 (15:19 +0100)]
arm64: dts: Add Exynos5433 SoC OTP device node

Change-Id: I8bcd9955c3cff940150bff10da564c3b9f477952
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: dts: exynos: Update Exynos5433 CHIPID node 46/200146/4
Sylwester Nawrocki [Wed, 30 Jan 2019 15:53:06 +0000 (16:53 +0100)]
arm64: dts: exynos: Update Exynos5433 CHIPID node

Extend the register region to also cover the ASV table region
and add reg entries for the ABB registers region.

Change-Id: I64704397a0cd12cb9a019b83f45fd23890da458b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agomtd: Add exynos OTP memory driver 48/200148/4
Sylwester Nawrocki [Fri, 1 Mar 2019 14:18:15 +0000 (15:18 +0100)]
mtd: Add exynos OTP memory driver

This patch adds driver for Exynos5433 OTP memory.  Access to the OTP
memory is required, among others, to support the Adaptive Supply Voltage
feature.

Partially based on code from Android SM-N910C_LL_Opensource kernel.

Change-Id: If85363f1626d622f1559757eb06fd950e214e5ab
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agosoc: samsung: chipid: Add ABB register region read helper 45/200145/4
Sylwester Nawrocki [Wed, 30 Jan 2019 15:24:13 +0000 (16:24 +0100)]
soc: samsung: chipid: Add ABB register region read helper

This patch adds helper functions for accessing the ABB block
registers needed by the ASV driver.

Change-Id: Ida2ea622136c1abea2caffaee00b5400a8efba7d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agosoc: samsung: chipid: Update DT bindings documentation 44/200144/4
Sylwester Nawrocki [Mon, 18 Feb 2019 16:37:38 +0000 (17:37 +0100)]
soc: samsung: chipid: Update DT bindings documentation

Document "samsung,exynos5433-chipid" compatible and add description
of 'reg' property for Exynos5433.

Change-Id: I9f22c76aabd46ea7aa31cfbecbb64131914e9938
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agosoc: samsung: chipid: Add exynos_chipid_read_bits() function 42/200142/4
Sylwester Nawrocki [Wed, 30 Jan 2019 14:57:56 +0000 (15:57 +0100)]
soc: samsung: chipid: Add exynos_chipid_read_bits() function

Add register read helper function needed by the ASV driver.

Change-Id: I90ec78cff58ac7ff424a50309e83d37605e7cbc7
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Add CLK_IGNORE_UNUSED for Exynos5433 ABB, ASV_TB clocks 53/200753/3
Sylwester Nawrocki [Fri, 1 Mar 2019 15:44:21 +0000 (16:44 +0100)]
clk: samsung: Add CLK_IGNORE_UNUSED for Exynos5433 ABB, ASV_TB clocks

Prevent disabling these clocks by the kernel until proper support
is added to the ASV driver.

With current code this patch is not necessarily required, because
exynos_asv_init() is being called before unused clocks get disabled
by clk core. However, things may break when the timings change
for any reason.

This patch has been tested after changing initcall type in exynos-asv.c:

-late_initcall(exynos_asv_init)
+late_initcall_sync(exynos_asv_init)

Change-Id: I513ff391bece219318020c0bcca07e2a7938a175
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agosoc: samsung: asv: Print error code when adding an OPP fails 49/200149/3
Sylwester Nawrocki [Wed, 30 Jan 2019 17:17:23 +0000 (18:17 +0100)]
soc: samsung: asv: Print error code when adding an OPP fails

Log error code from devm_pm_opp_add() to make any errors easier
to debug.

Change-Id: If418320565f1efc14d16242d8b166bea07353c54
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agosoc: samsung: asv: Wait until OPP gets released before adding new one 52/200752/2
Sylwester Nawrocki [Fri, 1 Mar 2019 15:30:16 +0000 (16:30 +0100)]
soc: samsung: asv: Wait until OPP gets released before adding new one

There is currently no check whether an OPP is actually removed before
attempting to add an replacement OPP. In situations when and OPP is
referenced when we try to remove it and it is not already removed at
the time of return from the dev_pm_opp_remove() call subsequent
dev_pm_opp_add() invocation will fail. To avoid that add a polling loop
with timeout as a barrier before adding new OPP.

This patch should also prevent related cpufreq core issues as indicated
by logs as follows.

exynos_asv_update_cpu_opp cpu4 opp5, freq: 2000 missing
exynos5433_asv_opp_get_voltage: arm,cortex-a57: [6] freq: 1900, voltage: 1262500 -> 1187500
cpu cpu4: _opp_add: duplicate OPPs detected. Existing: freq: 1900000000, volt: 1262500,
enabled: 1. New: freq: 1900000000, volt: 1187500, enabled: 1
exynos_asv_update_cpu_opp: Failed to add OPP 1900000000 Hz/1187500 uV for cpu4 (-17)

cpu cpu4: dev_pm_opp_set_rate: failed to find OPP for freq 1900000000 (-34)
exynos5433_asv_opp_get_voltage: arm,cortex-a57: [9] freq: 1600, voltage: 1137500 -> 1062500
cpufreq: __target_index: Failed to change cpu frequency: -34

Change-Id: Ibf6a568cabbd5380952d97f93d27ac59f1db125b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agodrm/exynos/mixer: fix MIXER shadow registry synchronisation code 04/201804/1
Andrzej Hajda [Tue, 19 Mar 2019 13:05:11 +0000 (14:05 +0100)]
drm/exynos/mixer: fix MIXER shadow registry synchronisation code

MIXER on Exynos5 SoCs uses different synchronisation method than Exynos4
to update internal state (shadow registers).
Apparently the driver implements it incorrectly. The rule should be
as follows:
- do not request updating registers until previous request was finished,
  ie. MXR_CFG_LAYER_UPDATE_COUNT must be 0.
- before setting registers synchronisation on VSYNC should be turned off,
  ie. MXR_STATUS_SYNC_ENABLE should be reset,
- after finishing MXR_STATUS_SYNC_ENABLE should be set again.
The patch hopefully implements it correctly.
Below sample kernel log from page fault caused by the bug:

[   25.670038] exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0x2247b800
[   25.677888] ------------[ cut here ]------------
[   25.682164] kernel BUG at ../drivers/iommu/exynos-iommu.c:450!
[   25.687971] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   25.693778] Modules linked in:
[   25.696816] CPU: 5 PID: 1553 Comm: fb-release_test Not tainted 5.0.0-rc7-01157-g5f86b1566bdd #136
[   25.705646] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   25.711710] PC is at exynos_sysmmu_irq+0x1c0/0x264
[   25.716470] LR is at lock_is_held_type+0x44/0x64

v2: added missing MXR_CFG_LAYER_UPDATE bit setting in mixer_enable_sync

Reported-by: Marian Mihailescu <mihailescu2m@gmail.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Change-Id: Idd49412e699350a7ea3a98ef7f925924e0ddf1ff

5 years agodrm/exynos/mixer: fix synchronization check in interlaced mode 03/201803/1
Andrzej Hajda [Fri, 2 Feb 2018 15:11:22 +0000 (16:11 +0100)]
drm/exynos/mixer: fix synchronization check in interlaced mode

In case of interlace mode video processor registers and mixer config
register must be check to ensure internal state is in sync with shadow
registers.
This patch fixes page-faults in interlaced mode.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[backport of mainline commit 2eced8e917b060587fc8ed46df41c364957a5050]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8b09ed165101a7dcccd1d6e7338e0216a27f4481

5 years agoARM: dts: exynos: Increase minimal ACLK400_DISP1 frequency on Exynos542x 02/201802/1
Marek Szyprowski [Tue, 19 Mar 2019 12:58:06 +0000 (13:58 +0100)]
ARM: dts: exynos: Increase minimal ACLK400_DISP1 frequency on Exynos542x

ACLK400_DISP1 bus feeds some internal buses of the display subsystem, some
of which are also related to TV/Mixer hardware modules. When that bus
is set to 120MHz, Exynos Mixer is not able to properly handle two XRGB
display planes at FullHD-60MHz. DMA underrun happens, which in turn might
result in reading data out of the configured buffer, what causes IOMMU
page fault and kernel panic.

This change fixes the following IOMMU fault, observed, when 2 Mixer planes
were enabled:

exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0x20fe9000
------------[ cut here ]------------
kernel BUG at ../drivers/iommu/exynos-iommu.c:450!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.0.0-00003-g1b03088168ea #149
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
PC is at exynos_sysmmu_irq+0x1c0/0x264
LR is at lock_is_held_type+0x44/0x64
...

Reported-by: Marian Mihailescu <mihailescu2m@gmail.com>
Fixes: 5d99cc59a3c6 ("ARM: dts: exynos: Move Exynos5250 and Exynos5420 nodes under soc")
Fixes: b04a62d3ade3 ("ARM: dts: exynos: Add bus nodes using VDD_INT for Exynos542x SoC")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3d2f341f5e89d4631401f653d0ad9e36f26f45ad

5 years agoASoC: samsung: odroid: Change rfs value to 256 59/201059/4
Jaechul Lee [Thu, 7 Mar 2019 23:42:55 +0000 (08:42 +0900)]
ASoC: samsung: odroid: Change rfs value to 256

rfs is set 256 as a default value in I2S module. Due to clock rate
setting rounding errors with rfs=512 playback is almost twice faster
than original speed when the device is opened with 44.1k samplerate.
pulseaudio that uses 44.1k sinks can't play the sound properly.

Change-Id: I21d5553e36dcbf00802230cf1c60f5fb7df1056d
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
5 years agoASoS: samsung: odroid: Fix clock configuration for 44100 sample rate 25/201125/1
Sylwester Nawrocki [Fri, 8 Mar 2019 15:36:38 +0000 (16:36 +0100)]
ASoS: samsung: odroid: Fix clock configuration for 44100 sample rate

After commit fbeec965b8d1c ("ASoC: samsung: odroid: Fix 32000 sample
rate handling") due to clock rounding error CODEC master clock frequency
is being set to 20070401 Hz instead of 22579000 Hz.
This results in too fast actual sample rate for fs=44100, e.g. 2 kHz tone
has really 3555 Hz frequency (2000 Hz * 20070401/22579000 * 2).

Fix this by increasing correction passed to clk_set_rate() to take into
account inaccuracy of EPLL frequency properly.

Change-Id: I8d08bec8e70394421c115bde1d511b730885bbe2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoARM: dts: exynos: Fix audio routing on exynos5422-odroidxu3 30/200830/1
Sylwester Nawrocki [Mon, 4 Mar 2019 16:18:32 +0000 (17:18 +0100)]
ARM: dts: exynos: Fix audio routing on exynos5422-odroidxu3

Add missing audio routing entry for the capture stream, this change
is required to fix audio recording on Odroid XU3.

Change-Id: I8db68ab3e097a0f3cfd07224016e4704e57c6635
Fixes: 885b005d232c ("ARM: dts: exynos: Add support for secondary DAI to Odroid XU3")
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoASoC: samsung: i2s: Fix DAPM routes for capture stream 29/200829/1
Sylwester Nawrocki [Mon, 4 Mar 2019 16:17:14 +0000 (17:17 +0100)]
ASoC: samsung: i2s: Fix DAPM routes for capture stream

This patch sets missing stream_name of capture part of the DAI driver
so we can define DAPM routing properly also for the capture stream.

Fixes: 64aba9bca5bd ("ASoC: samsung: i2s: Add widgets and routes for DPCM support")
Change-Id: I7ac244afcd74d92cf92da1d9d7d9606285ea0360
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoARM: dts: exynos: Add support for secondary DAI to Odroid XU4 55/197855/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:42 +0000 (19:03 +0100)]
ARM: dts: exynos: Add support for secondary DAI to Odroid XU4

This patch extends DAPM routing and adds secondary CPU DAI entry
to support the secondary audio PCM interface on Odroid XU4.

Change-Id: Id20d2a064f5d29c4edf349e9a968864a48a11b46
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add support for secondary DAI to Odroid XU3 54/197854/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:41 +0000 (19:03 +0100)]
ARM: dts: exynos: Add support for secondary DAI to Odroid XU3

This patch extends DAPM routing and adds secondary CPU DAI entry
to support the secondary audio PCM interface on Odroid XU3.

Change-Id: I2efb8eca9418554482194a2c54aa6b6ca674d5c2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoLOCAL: ASoC: temporary workaround for i2s/prepare_lock deadlock 46/200646/2
Marek Szyprowski [Wed, 27 Feb 2019 10:47:39 +0000 (11:47 +0100)]
LOCAL: ASoC: temporary workaround for i2s/prepare_lock deadlock

This reverts commit 00ffa8a3b1a60a89ab0ef5ae1d8e41269c30a3bd.

Change-Id: I396b1250a748fdb8219abf6d0bf71c5fab119658
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agoASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag 59/197859/6
Sylwester Nawrocki [Thu, 14 Feb 2019 15:45:55 +0000 (16:45 +0100)]
ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag

There is now no users of this flag so remove it together with
related code.  The chan_name field of snd_dmaengine_dai_dma_data
data structure is not removed as it is still in use by the PXA
platform.

Change-Id: Ia8bb6022ce7c5e85abb7c5410459130666785f45
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Prevent uninitialized variable use 45/200645/2
Sylwester Nawrocki [Thu, 21 Feb 2019 09:42:28 +0000 (10:42 +0100)]
ASoC: samsung: odroid: Prevent uninitialized variable use

This addresses an issue pointed out by compiler warning:

sound/soc/samsung/odroid.c: In function ‘odroid_audio_probe’:
sound/soc/samsung/odroid.c:298:22: warning: ‘cpu_dai’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis");
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I39c6dd0a1aa5ec68bfc17c895988c21a1a34733e
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Fix of_node refcount unbalance 44/200644/2
Sylwester Nawrocki [Wed, 20 Feb 2019 11:06:07 +0000 (12:06 +0100)]
ASoC: samsung: odroid: Fix of_node refcount unbalance

In odroid_audio_probe() some OF nodes are left without reference count
decrease after use. Fix it by ensuring required of_node_calls() are done
before exiting probe.

Change-Id: Ifbcb6294331acc59028e675d8ab1143394508d66
Reported-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization 43/200643/2
Sylwester Nawrocki [Tue, 19 Feb 2019 15:19:41 +0000 (16:19 +0100)]
ASoC: samsung: i2s: Fix multiple "IIS multi" devices initialization

On some SoCs (e.g. Exynos5433) there are multiple "IIS multi audio
interfaces" and the driver will try to register there multiple times
same platform device for the secondary FIFO, which of course fails
miserably.  To fix this we derive the secondary platform device name
from the primary device name. The secondary device name will now
be <primary_dev_name>-sec instead of fixed "samsung-i2s-sec".

The fixed platform_device_id table entry is removed as the secondary
device name is now dynamic and device/driver matching is done through
driver_override.

Change-Id: I49ed3e20279af198cdce11c08cc11bd6536dddad
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Fix secondary platform device unregistration 42/200642/2
Sylwester Nawrocki [Tue, 19 Feb 2019 15:19:40 +0000 (16:19 +0100)]
ASoC: samsung: i2s: Fix secondary platform device unregistration

This fixes unregistration of the secondary platform device so all
resources are properly released.  Additionally the removal sequence
is corrected so it is in reverse order comparing to probe sequence.
The test against NULL priv->pdev_sec is removed as it is not necessary.

Change-Id: If325e11b4109fbc61fbb2df3ac012f2c1e9f0cb5
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Add missing DAPM routes 41/200641/2
Sylwester Nawrocki [Fri, 15 Feb 2019 12:04:22 +0000 (13:04 +0100)]
ASoC: samsung: odroid: Add missing DAPM routes

With old DTS there will be missing DAPM routes linking BE with CODECs.
Add those routes in the card driver so sound works properly on Odroid
XU3/4 also without DTS updates enabling the secondary PCM.

Change-Id: I0a2a8e59859cdaf46da0563e30278dc9a8fe2376
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Ensure proper sample rate on pri/sec PCM 40/200640/2
Sylwester Nawrocki [Thu, 14 Feb 2019 16:00:11 +0000 (17:00 +0100)]
ASoC: samsung: odroid: Ensure proper sample rate on pri/sec PCM

Currently when playing sound with different sample rates actual
sample rate will be determined by audio stream which starts first
on either primary or secondary PCM. The audio root clock will be
configured appropriately only for the first stream. As the hardware
is limited to same sample rate on both interfaces we need to disallow
streams with different sample rates. It is done by this patch by
returning error in FE hw_params if there is already active stream
running with different sample rate.

Change-Id: I643d02d38acf20a7711ba5930e6bceceeaafc087
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Prevent potential NULL platform data dereference 39/200639/2
Sylwester Nawrocki [Thu, 14 Feb 2019 15:58:40 +0000 (16:58 +0100)]
ASoC: samsung: i2s: Prevent potential NULL platform data dereference

When np is NULL i2s_pdata could also be NULL but i2s_pdata is now being
dereferenced without proper check. Fix this and shorten the error message
so we don't exceed 80 characters limit.

Change-Id: I5d5b14ff953d4a2617500f50e81eb459d56a6e4f
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Convert to SPDX License Indentifier 38/200638/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:47 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Convert to SPDX License Indentifier

Replace GPL v2.0 license statements with SPDX license identifier.

Change-Id: Iaf0ae489d7d55dc949ba70e956afe3642cdfaeb4
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Comments clean up 37/200637/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:46 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Comments clean up

Spelling error fixes, upper/lower case letter changes.

Change-Id: Id1060cbb859c6da4480a0dd6f676a6614b64da8c
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Mark expected switch fall-through 36/200636/2
Gustavo A. R. Silva [Fri, 3 Aug 2018 16:33:57 +0000 (11:33 -0500)]
ASoC: samsung: i2s: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Change-Id: I030b163708ab40f17cf500cff7a8f326b890b7f5
Addresses-Coverity-ID: 1381093 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition 35/200635/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:45 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition

Change indentation so this macro definition spans 2 rows and looks
more consistent with surrounding code.

Change-Id: I747acdce454a660c637d29ab34450081e02084d2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage 34/200634/2
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:44 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage

If the probe call is on the primary DAI we can use 'other' in place of
i2s->sec_dai, if the probe call is on the secondary DAI we can use 'i2s'
in place of other->sec_dai.

While at it fix one whitespace issue.

Change-Id: Idbe9190d87f628f4d8fab77dbdbe433c8cd7825d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: Specify DMA channel names through custom DMA config 47/199147/3
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:41 +0000 (10:37 +0100)]
ASoC: samsung: Specify DMA channel names through custom DMA config

This is a part of conversion of Samsung platforms to use the custom DMA
config for specifying DMA channel names, in addition to passing custom
DMA device for the secondary CPU DAI's "PCM" component for some variants
of the I2S controller.

We also don't set the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME any more
as setting it wouldn't allow to specify DMA channels through the custom
DMA config.

Change-Id: Ia7e4da88746788c6fd56e1781160328bdaa224b8
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Get rid of a static spinlock 52/197852/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:39 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Get rid of a static spinlock

This patch makes the spinlock serializing access to the primary/secondary
PCM a per I2S controller lock, rather than a global one. There is no need
to have a global lock across multiple I2S controllers in the SoC.

Change-Id: I6b56296ce45e219ed5f37af85fd352ff51af617a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: odroid: Add support for secondary CPU DAI 53/197853/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:40 +0000 (10:37 +0100)]
ASoC: samsung: odroid: Add support for secondary CPU DAI

This patch adds DPCM links in order to support the secondary I2S interface.
For the secondary PCM interface to be actually available one more entry
should be added to the sound-dai property in sound/cpu node in DT.
The changes in driver are done in a way so we are backwards compatible
with existing DTS/DTB, i.e. if the cpu sound-dai property contains only
one entry only one PCM will be registered.

Change-Id: I7bc789cf1d025b168fd3411f24f4015016025bb2
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move quirks data to common driver data structure 51/197851/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:38 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move quirks data to common driver data structure

The quirk flags are common for the primary and the secondary DAI
so move respective field from struct i2s_dai to common driver data
structure.

Change-Id: I27506c48b3faa8c344535c6749b534c6c11901e7
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move IP variant data to common driver data structure 50/197850/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:37 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move IP variant data to common driver data structure

The IP variant data is another thing common for both DAIs, move it
to the driver's common data structure.

Change-Id: Id83d14a38d6c5d0d4d25dfd0ca8332e88315d271
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure 49/197849/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:36 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure

As we now have the 'priv' pointer in most of the places we can use
priv->lock directly, dropping extra indirection in the SFR region
spinlock access.

Change-Id: Ic137ee120aa1871a9d2142eaee9f9292e2c0f25f
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move SFR pointer to common driver data structure 48/197848/5
Sylwester Nawrocki [Thu, 14 Feb 2019 09:37:35 +0000 (10:37 +0100)]
ASoC: samsung: i2s: Move SFR pointer to common driver data structure

The SFR region is common for both DAIs so move related data structure
field from struct i2s_dai to the common driver data structure.

Change-Id: I2080a75f0a49f431ee37fa4488ed13ae8fd26b12
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move registers cache to common driver data structure 47/197847/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:27 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move registers cache to common driver data structure

There is no need to keep the PM suspend/resume register cache separate
for each DAI as those registers are common, move related i2s_dai data
structure to the driver's common data structure.  This will allow us
to simplify the code a little eventually and to make it easier to follow.

Change-Id: I91919c337611dc69983d2ee346e988f2e93d0695
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move opclk data to common driver data structure 46/197846/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:26 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move opclk data to common driver data structure

The clock for generating I2S signals is also common for both CPU DAIs
so move it to the driver's common data structure.

Change-Id: Ia8320f1e9ab0c02d113bb73002cd4ae98caec7e8
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move core clk to the driver common data structure 45/197845/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:25 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move core clk to the driver common data structure

The core clock is also common for both CPU DAIs so move it to
the driver's private data structure.

Change-Id: Ib6f2975bd34a8cfba20faaa9e51be88b6a41bc30
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Add widgets and routes for DPCM support 44/197844/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:24 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Add widgets and routes for DPCM support

This patch adds DAPM widgets required to model the internal mixer
of the I2S controller merging audio streams from the primary and
from the secondary PCM interface.

Change-Id: I3cb7b1b17f0c6891f6edb638db97ca6a482cec4b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Move clk supplier data to common driver data structure 43/197843/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:23 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Move clk supplier data to common driver data structure

Having the clocks provider data in struct samsung_i2s_priv, i.e. per the I2S
controller instance, rather than per CPU DAI better models the hardware and
simplifies the code a little. The clock provider is common for both DAIs.

Change-Id: I76db45001d8303263405b2cc40526e4101f35d16
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Restore support for the secondary PCM 42/197842/5
Sylwester Nawrocki [Tue, 12 Feb 2019 18:03:22 +0000 (19:03 +0100)]
ASoC: samsung: i2s: Restore support for the secondary PCM

This patch introduces again registration of additional platform device as
we still need it for registering the secondary dmaengine PCM component.

This patch in most part is a revert of changes done in commit
be2c92eb64023e ("ASoC: samsung: i2s: Remove virtual device for secondary DAI")

Change-Id: Ib7a47c83511403b32e04c41edf8148d77481abb3
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Convert to single component with multiple DAIs 41/197841/5
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:13 +0000 (18:00 +0100)]
ASoC: samsung: i2s: Convert to single component with multiple DAIs

This patch includes minimal changes as a prerequisite for adding support
for the Exynos secondary I2S interface as second DAI of the I2S component.
Doing it that way allows to avoid problems as indicated in commmit
6b01e0365b1689 ("ASoC: samsung: i2s: disable secondary DAI until it gets fixed")

The samsung_i2s_get_pri_dai() helper added in this patch is temporary and
will be removed in one of subsequent patches.

Change-Id: I5cb8ff7cb13a144bc6944752081b93a847080f94
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: dmaengine: Allow to specify custom DMA device 39/197839/5
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:11 +0000 (18:00 +0100)]
ASoC: samsung: dmaengine: Allow to specify custom DMA device

The additional function argument will allow to select proper DMA device
for requesting DMA channel for the secondary CPU DAI.

Change-Id: I3848594e393bcf55770020857ee5f2d0271b779b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dmaengine: Extend use of chan_names provided in custom DMA config 38/197838/5
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:10 +0000 (18:00 +0100)]
ASoC: dmaengine: Extend use of chan_names provided in custom DMA config

There are currently two ways to specify custom DMA channel names:
 - through the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag and
   snd_dmaengine_dai_dma_data data structure,
 - through chan_names field of struct snd_dmaengine_pcm_config.

In order to replace the DAI DMA data method with the custom DMA config
one on non-DT platforms the dmaengine_pcm_new() function is extended
to also consider channel names specified in the custom DMA config.
If both config->chan_names and dma_data->chan_name are provided
the former will be used.

Change-Id: I6a325754971c7d4daf3141f3cfeede9280d9941c
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of() 37/197837/5
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:09 +0000 (18:00 +0100)]
ASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of()

Currently when of_node of the "PCM" device is null
dmaengine_pcm_request_chan_of() function will bail out, including cases
when custom DMA device is intended to be used.  To have the channels
properly requested when custom DMA device is provided extend the of_node
test to also consider dma_dev->of_node.

Change-Id: Icac9da759fdefa367492f5d0ad0ff031a7b0bb62
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: i2s: Fix prescaler setting for the secondary DAI 40/197840/5
Sylwester Nawrocki [Thu, 7 Feb 2019 17:00:12 +0000 (18:00 +0100)]
ASoC: samsung: i2s: Fix prescaler setting for the secondary DAI

Make sure i2s->rclk_srcrate is properly initialized also during
playback through the secondary DAI.

Change-Id: Ic27fe0b834379a95485668137eee1e7d22d93952
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: samsung: Prevent clk_get_rate() calls in atomic context 33/200633/2
Sylwester Nawrocki [Thu, 7 Feb 2019 14:20:41 +0000 (15:20 +0100)]
ASoC: samsung: Prevent clk_get_rate() calls in atomic context

This patch moves clk_get_rate() call from trigger() to hw_params()
callback to avoid calling sleeping clk API from atomic context
and prevent deadlock as indicated below.

Before this change clk_get_rate() was being called with same
spinlock held as the one passed to the clk API when registering
clocks exposed by the I2S driver.

[   82.109780] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:908
[   82.117009] in_atomic(): 1, irqs_disabled(): 128, pid: 1554, name: speaker-test
[   82.124235] 3 locks held by speaker-test/1554:
[   82.128653]  #0: cc8c5328 (snd_pcm_link_rwlock){...-}, at: snd_pcm_stream_lock_irq+0x20/0x38
[   82.137058]  #1: ec9eda17 (&(&substream->self_group.lock)->rlock){..-.}, at: snd_pcm_ioctl+0x900/0x1268
[   82.146417]  #2: 6ac279bf (&(&pri_dai->spinlock)->rlock){..-.}, at: i2s_trigger+0x64/0x6d4
[   82.154650] irq event stamp: 8144
[   82.157949] hardirqs last  enabled at (8143): [<c0a0f574>] _raw_read_unlock_irq+0x24/0x5c
[   82.166089] hardirqs last disabled at (8144): [<c0a0f6a8>] _raw_read_lock_irq+0x18/0x58
[   82.174063] softirqs last  enabled at (8004): [<c01024e4>] __do_softirq+0x3a4/0x66c
[   82.181688] softirqs last disabled at (7997): [<c012d730>] irq_exit+0x140/0x168
[   82.188964] Preemption disabled at:
[   82.188967] [<00000000>]   (null)
[   82.195728] CPU: 6 PID: 1554 Comm: speaker-test Not tainted 5.0.0-rc5-00192-ga6e6caca8f03 #191
[   82.204302] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   82.210376] [<c0111a54>] (unwind_backtrace) from [<c010d8f4>] (show_stack+0x10/0x14)
[   82.218084] [<c010d8f4>] (show_stack) from [<c09ef004>] (dump_stack+0x90/0xc8)
[   82.225278] [<c09ef004>] (dump_stack) from [<c0152980>] (___might_sleep+0x22c/0x2c8)
[   82.232990] [<c0152980>] (___might_sleep) from [<c0a0a2e4>] (__mutex_lock+0x28/0xa3c)
[   82.240788] [<c0a0a2e4>] (__mutex_lock) from [<c0a0ad80>] (mutex_lock_nested+0x1c/0x24)
[   82.248763] [<c0a0ad80>] (mutex_lock_nested) from [<c04923dc>] (clk_prepare_lock+0x78/0xec)
[   82.257079] [<c04923dc>] (clk_prepare_lock) from [<c049538c>] (clk_core_get_rate+0xc/0x5c)
[   82.265309] [<c049538c>] (clk_core_get_rate) from [<c0766b18>] (i2s_trigger+0x490/0x6d4)
[   82.273369] [<c0766b18>] (i2s_trigger) from [<c074fec4>] (soc_pcm_trigger+0x100/0x140)
[   82.281254] [<c074fec4>] (soc_pcm_trigger) from [<c07378a0>] (snd_pcm_do_start+0x2c/0x30)
[   82.289400] [<c07378a0>] (snd_pcm_do_start) from [<c07376cc>] (snd_pcm_action_single+0x38/0x78)
[   82.298065] [<c07376cc>] (snd_pcm_action_single) from [<c073a450>] (snd_pcm_ioctl+0x910/0x1268)
[   82.306734] [<c073a450>] (snd_pcm_ioctl) from [<c0292344>] (do_vfs_ioctl+0x90/0x9ec)
[   82.314443] [<c0292344>] (do_vfs_ioctl) from [<c0292cd4>] (ksys_ioctl+0x34/0x60)
[   82.321808] [<c0292cd4>] (ksys_ioctl) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
[   82.329431] Exception stack(0xeb875fa8 to 0xeb875ff0)
[   82.334459] 5fa0:                   00033c18 b6e31000 00000004 00004142 00033d80 00033d80
[   82.342605] 5fc0: 00033c18 b6e31000 00008000 00000036 00008000 00000000 beea38a8 00008000
[   82.350748] 5fe0: b6e3142c beea384c b6da9a30 b6c9212c
[   82.355789]
[   82.357245] ======================================================
[   82.363397] WARNING: possible circular locking dependency detected
[   82.369551] 5.0.0-rc5-00192-ga6e6caca8f03 #191 Tainted: G        W
[   82.376395] ------------------------------------------------------
[   82.382548] speaker-test/1554 is trying to acquire lock:
[   82.387834] 6d2007f4 (prepare_lock){+.+.}, at: clk_prepare_lock+0x78/0xec
[   82.394593]
[   82.394593] but task is already holding lock:
[   82.400398] 6ac279bf (&(&pri_dai->spinlock)->rlock){..-.}, at: i2s_trigger+0x64/0x6d4
[   82.408197]
[   82.408197] which lock already depends on the new lock.
[   82.416343]
[   82.416343] the existing dependency chain (in reverse order) is:
[   82.423795]
[   82.423795] -> #1 (&(&pri_dai->spinlock)->rlock){..-.}:
[   82.430472]        clk_mux_set_parent+0x34/0xb8
[   82.434975]        clk_core_set_parent_nolock+0x1c4/0x52c
[   82.440347]        clk_set_parent+0x38/0x6c
[   82.444509]        of_clk_set_defaults+0xc8/0x308
[   82.449186]        of_clk_add_provider+0x84/0xd0
[   82.453779]        samsung_i2s_probe+0x408/0x5f8
[   82.458376]        platform_drv_probe+0x48/0x98
[   82.462879]        really_probe+0x224/0x3f4
[   82.467037]        driver_probe_device+0x70/0x1c4
[   82.471716]        bus_for_each_drv+0x44/0x8c
[   82.476049]        __device_attach+0xa0/0x138
[   82.480382]        bus_probe_device+0x88/0x90
[   82.484715]        deferred_probe_work_func+0x6c/0xbc
[   82.489741]        process_one_work+0x200/0x740
[   82.494246]        worker_thread+0x2c/0x4c8
[   82.498408]        kthread+0x128/0x164
[   82.502131]        ret_from_fork+0x14/0x20
[   82.506204]          (null)
[   82.508976]
[   82.508976] -> #0 (prepare_lock){+.+.}:
[   82.514264]        __mutex_lock+0x60/0xa3c
[   82.518336]        mutex_lock_nested+0x1c/0x24
[   82.522756]        clk_prepare_lock+0x78/0xec
[   82.527088]        clk_core_get_rate+0xc/0x5c
[   82.531421]        i2s_trigger+0x490/0x6d4
[   82.535494]        soc_pcm_trigger+0x100/0x140
[   82.539913]        snd_pcm_do_start+0x2c/0x30
[   82.544246]        snd_pcm_action_single+0x38/0x78
[   82.549012]        snd_pcm_ioctl+0x910/0x1268
[   82.553345]        do_vfs_ioctl+0x90/0x9ec
[   82.557417]        ksys_ioctl+0x34/0x60
[   82.561229]        ret_fast_syscall+0x0/0x28
[   82.565477]        0xbeea384c
[   82.568421]
[   82.568421] other info that might help us debug this:
[   82.568421]
[   82.576394]  Possible unsafe locking scenario:
[   82.576394]
[   82.582285]        CPU0                    CPU1
[   82.586792]        ----                    ----
[   82.591297]   lock(&(&pri_dai->spinlock)->rlock);
[   82.595977]                                lock(prepare_lock);
[   82.601782]                                lock(&(&pri_dai->spinlock)->rlock);
[   82.608975]   lock(prepare_lock);
[   82.612268]
[   82.612268]  *** DEADLOCK ***

Fixes: 647d04f8e07a ("ASoC: samsung: i2s: Ensure the RCLK rate is properly determined")
Change-Id: I1b8100d4e65a1d9964aa92d2ac56965a01359791
Reported-by: Krzysztof Kozłowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: Revert "LOCAL / temporary workaround for i2s/prepare_lock deadlock" 32/200632/2
Sylwester Nawrocki [Wed, 27 Feb 2019 09:54:37 +0000 (10:54 +0100)]
ASoC: Revert "LOCAL / temporary workaround for i2s/prepare_lock deadlock"

This reverts commit a146d53312cc7151d7aa5d517b808d2d1fdfd6c1.

Revert temporarily in order to apply patches from the mainline
cleanly.

Change-Id: I2cce77968974c36d8ccbe4b2df75b77113e6d5bf
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agogpu/drm: Fix lock held when returning to user space. 82/200682/1
Tetsuo Handa [Thu, 10 Jan 2019 10:19:31 +0000 (19:19 +0900)]
gpu/drm: Fix lock held when returning to user space.

We need to call drm_modeset_acquire_fini() when drm_atomic_state_alloc()
failed or call drm_modeset_acquire_init() after drm_atomic_state_alloc()
succeeded.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reported-by: syzbot <syzbot+6ea337c427f5083ebdf2@syzkaller.appspotmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/1547115571-21219-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
[hoegeun.kwon: this patch from the mainline 4089e272ac61 and it has been
 modified to be able to backport linux-v4.14.]
Change-Id: Iaa0d6e104054abc11181c43bdb6283a8bd30eb19
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
5 years agoARM: configs: tizen_odroid: Increase CMA size to 256 MB 55/200655/1
Sylwester Nawrocki [Wed, 27 Feb 2019 13:50:08 +0000 (14:50 +0100)]
ARM: configs: tizen_odroid: Increase CMA size to 256 MB

This change is required for video decoding through gst-omx plugin.

Change-Id: I1b13280bb94bb0314c7f5c7bd1d8a4f77d829a36
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agobase/firmware retry firmware load after rootfs mount 63/200163/2
Christoph Manszewski [Fri, 15 Feb 2019 14:50:00 +0000 (15:50 +0100)]
base/firmware retry firmware load after rootfs mount

Return -EPROBE_DEFER for request_firmware() until root filesystem is
mounted. In case of request_firmware_nowait() create a list of deferred
firmware load requests, and retry firmware load after root filesytem is
mounted.

This allows to have wifi drivers build into the kernel, but
the firmware files shipped on the root filesystem.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Change-Id: I40c0a2a98ca9b1a95fb743a848d2366250cae839

5 years agoRevert "[LOCAL] base/firmware: return -EPROBE_DEFER until rootfs is available" 62/200162/2
Christoph Manszewski [Fri, 15 Feb 2019 14:35:26 +0000 (15:35 +0100)]
Revert "[LOCAL] base/firmware: return -EPROBE_DEFER until rootfs is available"

This reverts commit 1733ede82e9e964a3d5234ef61979ca523e7ba5a.

Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com>
Change-Id: I30441cbd9b4933cab7e1cb6e80d767e4fca65f41

5 years agoARM: dts: Disable UHS-I modes for SD card on Odroid XU3/XU4/HC1 98/200398/3
Marek Szyprowski [Fri, 22 Feb 2019 15:16:31 +0000 (16:16 +0100)]
ARM: dts: Disable UHS-I modes for SD card on Odroid XU3/XU4/HC1

Ultra High Speed DDR50+ modes doesn't work stable on the tested Odroid XU3
and XU4 boards, so disable them until the proper solution is developed.

This is equal to the revert of the following commits:

"ARM: dts: exynos: Update maximum frequency for SD card to 200MHz on Odroid XU3/XU4/HC1"
"ARM: dts: exynos: Add UHS-I bus speed support to Odroid XU3/XU4/HC1"

This reverts commit 6d92b6cece561306a707e40a264b802b51d4264c.
This reverts commit f3e8e10898d0efee73ad0108dec9f3a0947da752.

Tested-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I210c64cb5d34597132341caa6b98a01fa6a8397c

5 years agoARM64: defconfig: tm2: Sync with savedefconfig 91/200091/1
Junghoon Kim [Tue, 19 Feb 2019 05:16:33 +0000 (14:16 +0900)]
ARM64: defconfig: tm2: Sync with savedefconfig

Sync the tizen_tm2_defconfig with savedefconfig. Currently, whenever
rebasing the kernel tree, it requires to update the kernel version in
the defconfig file. This patch helps to avoid the above step.

Change-Id: I3fa02794b552411aa15363bcbd27f4e370d668f6
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
5 years agoARM: defconfig: ordoid: Sync with savedefconfig 90/200090/1
Junghoon Kim [Tue, 19 Feb 2019 04:54:58 +0000 (13:54 +0900)]
ARM: defconfig: ordoid: Sync with savedefconfig

Sync the tizen_odroid_defconfig with savedefconfig. Whenever rebasing
the kernel tree, it requires to update the kernel version in the
defconfig file. This patch helps to avoid the above step.

Change-Id: I3bd1794ac58a4b0688134f416d33494a80764dcf
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
5 years agoARM: dts: exynos4412-odroid-common: add mmc aliases to set fixed mmc index 90/199890/2
Seung-Woo Kim [Fri, 15 Feb 2019 08:26:11 +0000 (17:26 +0900)]
ARM: dts: exynos4412-odroid-common: add mmc aliases to set fixed mmc index

Add mmc aliases to set fixed mmc index to emmc and sdcard.

Change-Id: I2a826442e86222cd0c6542c962e2c4187dad6c76
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agommc: block: Support the fixed index for mmcblk with aliases nodes 89/199889/2
Jaehoon Chung [Tue, 29 Mar 2016 10:43:34 +0000 (19:43 +0900)]
mmc: block: Support the fixed index for mmcblk with aliases nodes

Now, index of mmcblk is allocated in accordance with probing time.
If want to use the mmcblk1 for some device, it can use alias.

aliases {
mmc0 = &mmc0; /* mmcblk0 for eMMC */
mmc1 = &mmc2; /* mmcblk1 for SD */
mmc2 = &mmc1; /* mmcblk2 for SDIO*/
};

If there are no corresponding values, it might be allocated with
existing scheme.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
[sw0312.kim: port to v4.14
 - apply to host index instead of name_idx because host index is used in this version
]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I44673d62e546ea0aeedd9cac314dbfd31fdcce66

5 years agoARM: pm: fix HYP/SVC mode mismatch when MCPM is used 89/199789/3
Marek Szyprowski [Wed, 13 Feb 2019 12:02:25 +0000 (13:02 +0100)]
ARM: pm: fix HYP/SVC mode mismatch when MCPM is used

MCPM does a soft reset of the CPUs and uses common cpu_resume() routine to
perform low-level platform initialization. This results in a try to install
HYP stubs for the second time for each CPU and results in false HYP/SVC
mode mismatch detection. The HYP stubs are already installed at the
beginning of the kernel initialization on the boot CPU (head.S) or in the
secondary_startup() for other CPUs. To fix this issue MCPM code should use
a cpu_resume() routine without HYP stubs installation.

This change fixes HYP/SVC mode mismatch on Samsung Exynos5422-based Odroid
XU3/XU4/HC1 boards.

Fixes: 3721924c8154 ("ARM: 8081/1: MCPM: provide infrastructure to allow for MCPM loopback")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Change-Id: I6f6225fd2a7e57e323010af616a6fdd4774a7222

5 years agoARM: exynos: Fix undefined instruction during Exynos5422 resume 88/199788/2
Marek Szyprowski [Thu, 14 Feb 2019 10:12:46 +0000 (11:12 +0100)]
ARM: exynos: Fix undefined instruction during Exynos5422 resume

During early system resume on Exynos5422 with performance counters enabled
the following kernel oops happens:

Internal error: Oops - undefined instruction: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1433 Comm: bash Tainted: G        W         5.0.0-rc5-next-20190208-00023-gd5fb5a8a13e6-dirty #5480
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
PC is at reset_ctrl_regs+0x128/0x354
LR is at reset_ctrl_regs+0x124/0x354
pc : [<c0112814>]    lr : [<c0112810>]    psr: 600001d3
...
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 4451006a  DAC: 00000051
Process bash (pid: 1433, stack limit = 0xb7e0e22f)
...
[<c0112814>] (reset_ctrl_regs) from [<c0112ad0>] (dbg_cpu_pm_notify+0x1c/0x24)
[<c0112ad0>] (dbg_cpu_pm_notify) from [<c014c840>] (notifier_call_chain+0x44/0x84)
[<c014c840>] (notifier_call_chain) from [<c014cbc0>] (__atomic_notifier_call_chain+0x7c/0x128)
[<c014cbc0>] (__atomic_notifier_call_chain) from [<c01ffaac>] (cpu_pm_notify+0x30/0x54)
[<c01ffaac>] (cpu_pm_notify) from [<c055116c>] (syscore_resume+0x98/0x3f4)
[<c055116c>] (syscore_resume) from [<c0189350>] (suspend_devices_and_enter+0x97c/0xe74)
[<c0189350>] (suspend_devices_and_enter) from [<c0189fb8>] (pm_suspend+0x770/0xc04)
[<c0189fb8>] (pm_suspend) from [<c0187740>] (state_store+0x6c/0xcc)
[<c0187740>] (state_store) from [<c09fa698>] (kobj_attr_store+0x14/0x20)
[<c09fa698>] (kobj_attr_store) from [<c030159c>] (sysfs_kf_write+0x4c/0x50)
[<c030159c>] (sysfs_kf_write) from [<c0300620>] (kernfs_fop_write+0xfc/0x1e0)
[<c0300620>] (kernfs_fop_write) from [<c0282be8>] (__vfs_write+0x2c/0x160)
[<c0282be8>] (__vfs_write) from [<c0282ea4>] (vfs_write+0xa4/0x16c)
[<c0282ea4>] (vfs_write) from [<c0283080>] (ksys_write+0x40/0x8c)
[<c0283080>] (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
...
---[ end trace 03fc9866185939bf ]---

Undefined instruction is triggered during CP14 reset, because bits: #16
(Secure privileged invasive debug disabled) and #17 (Secure privileged
noninvasive debug disable) are set in DSCR. Those bits depend on SPNIDEN
and SPIDEN lines, which are provided by Secure JTAG hardware block. That
block in turn is powered from cluster 0 (big/Eagle), but the Exynos5422
boots on cluster 1 (LITTLE/KFC).

To fix this issue it is enough to turn on the power on the cluster 0 for
a while. This lets the Secure JTAG block to propagate the needed signals
to LITTLE/KFC cores and change their DSCR.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I0fa6618740853169bd96efeb33975f0289ac3706

5 years agoclocksource: exynos_mct: Clear timer interrupt when shutdown 87/199787/2
Stuart Menefy [Sun, 10 Feb 2019 22:51:14 +0000 (22:51 +0000)]
clocksource: exynos_mct: Clear timer interrupt when shutdown

When shutting down the timer, ensure that after we have stopped the
timer any pending interrupts are cleared. This fixes a problem when
suspending, as interrupts are disabled before the timer is stopped,
so the timer interrupt may still be asserted, preventing the system
entering a low power state when the wfi is executed.

Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
[pending patch for mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I2068bbadeb5e778bb81f772693e30a47e64dd77c

5 years agoclocksource: exynos_mct: Move one-shot check from tick clear to ISR 86/199786/2
Stuart Menefy [Sun, 10 Feb 2019 22:51:13 +0000 (22:51 +0000)]
clocksource: exynos_mct: Move one-shot check from tick clear to ISR

When a timer tick occurs and the clock is in one-shot mode, the timer
needs to be stopped to prevent it triggering subsequent interrupts.
Currently this code is in exynos4_mct_tick_clear(), but as it is
only needed when an ISR occurs move it into exynos4_mct_tick_isr(),
leaving exynos4_mct_tick_clear() just doing what its name suggests it
should.

Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
[pending patch for mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I1004b6947a338d27dc629f4174607663dedc1f33

5 years agoARM: exynos: Fix timeout when booting secondary CPUs 85/199785/2
Stuart Menefy [Mon, 28 Jan 2019 23:06:45 +0000 (23:06 +0000)]
ARM: exynos: Fix timeout when booting secondary CPUs

Without this fix the loop waiting for the timeout exits, but the
subsequent test to see if the timeout occurred fails.

Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
[backport of mainline commit 4bdf2f3f20a9de9b07f97907820c42f3a49ba63d]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If43a148b759fa015abd46fdfb60d64fdfe3baf5f

5 years agoarm: Use common outgoing-CPU-notification code 84/199784/2
Paul E. McKenney [Mon, 4 Feb 2019 15:01:55 +0000 (16:01 +0100)]
arm: Use common outgoing-CPU-notification code

This commit removes the open-coded CPU-offline notification with new
common code.  In particular, this change avoids calling scheduler code
using RCU from an offline CPU that RCU is ignoring.  This is a minimal
change.  A more intrusive change might invoke the cpu_check_up_prepare()
and cpu_set_state_online() functions at CPU-online time, which would
allow onlining throw an error if the CPU did not go offline properly.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Russell King <linux@arm.linux.org.uk>
[commit rejected in mainline, but needed on Exynos platform to fix
suspicious RCU usage during suspend/resume]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I26ba637d48fc3264e1b79507cfd0cb82bb5e6390

5 years agocpufreq: dt: Implement online/offline() callbacks 83/199783/2
Viresh Kumar [Tue, 12 Feb 2019 07:06:47 +0000 (12:36 +0530)]
cpufreq: dt: Implement online/offline() callbacks

Implement the light-weight tear down and bring up helpers to reduce the
amount of work to do on CPU offline/online operation.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[pending patch for mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I02a01f0f4d5c24102bcc58089937c371cc126b65

5 years agocpufreq: Allow light-weight tear down and bring up of CPUs 82/199782/2
Viresh Kumar [Tue, 12 Feb 2019 07:06:46 +0000 (12:36 +0530)]
cpufreq: Allow light-weight tear down and bring up of CPUs

The cpufreq core doesn't remove the cpufreq policy anymore on CPU
offline operation, rather that happens when the CPU device gets
unregistered from the kernel. This allows faster recovery when the CPU
comes back online. This is also very useful during system wide
suspend/resume where we offline all non-boot CPUs during suspend and
then bring them back on resume.

This commit takes the same idea a step ahead to allow drivers to do
light weight tear-down and bring-up during CPU offline and online
operations.

A new set of callbacks is introduced, online/offline(). online() gets
called when the first CPU of an inactive policy is brought up and
offline() gets called when all the CPUs of a policy are offlined.

The existing init/exit() callback get called on policy
creation/destruction. They also get called instead of online/offline()
callbacks if the online/offline() callbacks aren't provided.

This also moves around some code to get executed only for the new-policy
case going forward.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[pending patch for mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I27bd475cac802ffae345308fc145490966eda456

5 years agodevfreq: Suspend all devices on system shutdown 81/199781/2
Marek Szyprowski [Fri, 25 Jan 2019 13:49:53 +0000 (14:49 +0100)]
devfreq: Suspend all devices on system shutdown

This way devfreq core ensures that all its devices will be set to safe
operation points before reboot operation. There are board on which some
aggressive power saving operation points are behind the capabilities of
the bootloader to properly reset the hardware and boot the board. This
way one can avoid board crash early after reboot.

Similar pattern is used in CPUfreq subsystem.

Reported-by: Markus Reichl <m.reichl@fivetechno.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I45467c8e02f7fedf90d1dfd5080e6143a8cb69f7

5 years agortc: s3c: Use generic helper to get driver data 80/199780/2
Marek Szyprowski [Fri, 18 Jan 2019 13:28:37 +0000 (14:28 +0100)]
rtc: s3c: Use generic helper to get driver data

Replace of_match_node() with of_device_get_match_data(), which removes a
few lines of code from the driver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[backport of mainline commit 64704c92fd19c599f20433aae1372a7ccab79a57]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I9e3a1662233334925ca9ace34609468dc8bc0a14

5 years agortc: s3c: Rewrite clock handling 79/199779/2
Marek Szyprowski [Mon, 21 Jan 2019 11:09:30 +0000 (12:09 +0100)]
rtc: s3c: Rewrite clock handling

s3c_rtc_enable/disable_clk() functions were designed to be called multiple
times without reference counting, because they were initially only used in
alarm setting/clearing functions, which can be called both when alarm is
already set or not. Later however, calls to those functions have been added to
other places in the driver - like time and /proc reading callbacks, what
results in broken alarm if any of such events happens after the alarm has
been set. Fix this by simplifying s3c_rtc_enable/disable_clk() functions
to rely on proper reference counting in clock core and move alarm enable
counter to s3c_rtc_setaie() function.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[backport of mainline commit 5a5b614ba61cc2a89ad0dffc63d913a1a6ba1f9f]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib72a76ea0567ece0b7b5b706f2ee3b6cca850150

5 years agortc: s3c-rtc: Avoid using broken ALMYEAR register 78/199778/2
Marek Szyprowski [Tue, 13 Nov 2018 11:32:50 +0000 (12:32 +0100)]
rtc: s3c-rtc: Avoid using broken ALMYEAR register

(RTC,ALM)YEAR registers of Exynos built-in RTC device contains 3 BCD
characters. s3c-rtc driver uses only 2 lower of them and supports years
from 2000..2099 range. The third BCD value is typically set to 0, but it
looks that handling of it is broken in the hardware. It sometimes
defaults to a random (even non-BCD) value. This is not an issue
for handling RTCYEAR register, because bcd2bin() properly handles only
8bit values (2 BCD characters, the third one is skipped). The problem
is however with ALMYEAR register and proper RTC alarm operation. When
YEAREN bit is set for the configured alarm, RTC hardware triggers alarm
only when ALMYEAR and RTCYEAR matches. This usually doesn't happen
because of the random noise on the third BCD character.

Fix this by simply skipping setting ALMYEAR register in alarm
configuration. This workaround fixes broken alarm operation on Exynos
built-in rtc device. My tests revealed that the issue happens on the
following Exynos series: 3250, 4210, 4412, 5250 and 5410.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[backport of mainline commit 50c8aec4212a966817e868056efc9bfbb73337c0]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I057ae196eeaa9a2c0fee5fcf4c66625783cdfc21

5 years agoarm64: configs: tizen_tm2_defconfig: enable syscon-reboot-mode config 03/199703/4
Seung-Woo Kim [Thu, 14 Feb 2019 06:17:00 +0000 (15:17 +0900)]
arm64: configs: tizen_tm2_defconfig: enable syscon-reboot-mode config

To support reboot-mode, enable syscon-reboot-mode config option.

Change-Id: I27e2da1f29aa5fa271b0914fd62e38470f47b403
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agoarm64: dts: exynos5433-tm2: add syscon-reboot-mode 02/199702/4
Seung-Woo Kim [Thu, 14 Feb 2019 06:15:50 +0000 (15:15 +0900)]
arm64: dts: exynos5433-tm2: add syscon-reboot-mode

Add syscon-reboot-mode dt node to support reboot mode. TM2
bootloader uses INFORM3 register to check reboot mode of kernel.

Change-Id: I2d5ee09c005f14d4fa7c274fecade920385712e3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>