summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-03-04ASoC: samsung: i2s: Move SFR pointer to common driver data structureSylwester Nawrocki1-47/+59
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>
2019-03-04ASoC: samsung: i2s: Move registers cache to common driver data structureSylwester Nawrocki1-9/+11
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>
2019-03-04ASoC: samsung: i2s: Move opclk data to common driver data structureSylwester Nawrocki1-37/+33
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>
2019-03-04ASoC: samsung: i2s: Move core clk to the driver common data structureSylwester Nawrocki1-13/+14
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>
2019-03-04ASoC: samsung: i2s: Add widgets and routes for DPCM supportSylwester Nawrocki1-1/+26
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>
2019-03-04ASoC: samsung: i2s: Move clk supplier data to common driver data structureSylwester Nawrocki1-35/+33
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>
2019-03-04ASoC: samsung: i2s: Restore support for the secondary PCMSylwester Nawrocki1-4/+48
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>
2019-03-04ASoC: samsung: i2s: Convert to single component with multiple DAIsSylwester Nawrocki1-77/+115
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>
2019-03-04ASoC: samsung: dmaengine: Allow to specify custom DMA deviceSylwester Nawrocki7-8/+11
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>
2019-03-04ASoC: dmaengine: Extend use of chan_names provided in custom DMA configSylwester Nawrocki1-2/+9
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>
2019-03-04ASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of()Sylwester Nawrocki1-1/+2
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>
2019-03-04ASoC: samsung: i2s: Fix prescaler setting for the secondary DAISylwester Nawrocki1-1/+7
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>
2019-03-04ASoC: samsung: Prevent clk_get_rate() calls in atomic contextSylwester Nawrocki1-5/+5
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>
2019-03-04ASoC: Revert "LOCAL / temporary workaround for i2s/prepare_lock deadlock"Sylwester Nawrocki1-10/+10
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>
2019-02-28gpu/drm: Fix lock held when returning to user space.Tetsuo Handa2-4/+3
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>
2019-02-27ARM: configs: tizen_odroid: Increase CMA size to 256 MBSylwester Nawrocki1-1/+1
This change is required for video decoding through gst-omx plugin. Change-Id: I1b13280bb94bb0314c7f5c7bd1d8a4f77d829a36 Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2019-02-27base/firmware retry firmware load after rootfs mountChristoph Manszewski5-3/+47
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
2019-02-27Revert "[LOCAL] base/firmware: return -EPROBE_DEFER until rootfs is available"Christoph Manszewski4-11/+2
This reverts commit 1733ede82e9e964a3d5234ef61979ca523e7ba5a. Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com> Change-Id: I30441cbd9b4933cab7e1cb6e80d767e4fca65f41
2019-02-26ARM: dts: Disable UHS-I modes for SD card on Odroid XU3/XU4/HC1Marek Szyprowski1-4/+0
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
2019-02-19ARM64: defconfig: tm2: Sync with savedefconfigJunghoon Kim1-5603/+0
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>
2019-02-19ARM: defconfig: ordoid: Sync with savedefconfigJunghoon Kim1-4905/+0
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>
2019-02-19ARM: dts: exynos4412-odroid-common: add mmc aliases to set fixed mmc indexSeung-Woo Kim1-0/+5
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>
2019-02-19mmc: block: Support the fixed index for mmcblk with aliases nodesJaehoon Chung2-1/+17
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
2019-02-18ARM: pm: fix HYP/SVC mode mismatch when MCPM is usedMarek Szyprowski3-1/+14
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
2019-02-18ARM: exynos: Fix undefined instruction during Exynos5422 resumeMarek Szyprowski1-0/+19
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
2019-02-18clocksource: exynos_mct: Clear timer interrupt when shutdownStuart Menefy1-0/+1
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
2019-02-18clocksource: exynos_mct: Move one-shot check from tick clear to ISRStuart Menefy1-11/+11
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
2019-02-18ARM: exynos: Fix timeout when booting secondary CPUsStuart Menefy1-2/+2
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
2019-02-18arm: Use common outgoing-CPU-notification codePaul E. McKenney1-4/+2
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
2019-02-18cpufreq: dt: Implement online/offline() callbacksViresh Kumar1-0/+17
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
2019-02-18cpufreq: Allow light-weight tear down and bring up of CPUsViresh Kumar2-16/+35
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
2019-02-18devfreq: Suspend all devices on system shutdownMarek Szyprowski1-0/+7
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
2019-02-18rtc: s3c: Use generic helper to get driver dataMarek Szyprowski1-11/+2
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
2019-02-18rtc: s3c: Rewrite clock handlingMarek Szyprowski1-43/+31
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
2019-02-18rtc: s3c-rtc: Avoid using broken ALMYEAR registerMarek Szyprowski1-6/+0
(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
2019-02-15arm64: configs: tizen_tm2_defconfig: enable syscon-reboot-mode configSeung-Woo Kim1-1/+2
To support reboot-mode, enable syscon-reboot-mode config option. Change-Id: I27e2da1f29aa5fa271b0914fd62e38470f47b403 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-15arm64: dts: exynos5433-tm2: add syscon-reboot-modeSeung-Woo Kim1-0/+8
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>
2019-02-15ARM: configs: tizen_odroid: enable syscon-reboot-mode configSeung-Woo Kim1-1/+2
To support reboot-mode, enable syscon-reboot-mode config option. Change-Id: I4fe5074f4eeaec4d27d686e5bea4eaf5820fd640 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-15ARM: dts: trats2: add syscon-reboot-modeSeung-Woo Kim1-0/+8
Add syscon-reboot-mode dt node to support reboot mode. Trats2 uses INFORM3 register with offset 0x80c not like odroid families. In trats2's case, when we released the tizen-2.X with linux-3.10 kernel, it had used the INFORM3 register. That's why trats2 uses the INFORM3 register for reboot-mode. Change-Id: Ib7134020b493a83cc7661fe966ea40128f4f8dcc Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-15ARM: dts: odroid: add syscon-reboot-modeSeung-Woo Kim2-0/+20
Add the syscon-reboot-mode dt node to support reboot mode. Odroid families use INFORM2 register with offset 0x808 to let bootloader recognize reboot mode. Change-Id: I9876bfce4fc519026c62c53f10e1ef2107cfc256 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-15ARM/ARM64: dts: exynos: add simple-mfd compatible to pmu dt-nodeSeung-Woo Kim3-3/+3
To support syscon-reboot-mode with exynos-pmu, simple-mfd compatible is required. Reference: Documentation/devicetree/bindings/power/reset/syscon-reboot-mode.txt Reference: Documentation/devicetree/bindings/mfd/mfd.txt Change-Id: I81e78cf5c7f4b3373c181886820b323dadab3d0f Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-15soc: exynos: add reboot-mode headerSeung-Woo Kim1-0/+12
Exynos platform uses a SYSCON mapped pmu register store the reboot mode magic value for bootloader to use when system reboot. Add the shared header describing the values firmware expects for different boot modes. Change-Id: I83bfd3df79652ba55e158fc9e0a56724597ef67d Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-14LOCAL / ARM: SAMSUNG: set chip product id as system_serialSeung-Woo Kim1-0/+5
The Exynos SoC has 64bit chip product id and it is unique for each chip. So it can be used as system_serial. Change-Id: Id739b865a1e355a0209841ff2ca1802b5daeabb2 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-02-14soc: exynos: asv: Switch to MHz unit for frequency in ASV tablesSylwester Nawrocki2-133/+136
There is no need to store the frequencies in kHz units, MHz granularity is enough and is also used for other SoCs. Remove leading zeros in the first column of each table and update users accordingly. Change-Id: I07b0e0395dc6f60d16a008daa27a0ca7a3dcab78 Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2019-02-14soc: samsung: asv: Drop unnecessary cpuid local variableSylwester Nawrocki1-3/+2
Make the code more explicit by dropping the local variable and using cpu->id directly. Change-Id: Id97f57e15083e6928852988007d048e28b754285 Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2019-02-14soc: samsung: Split the ASV driver into common and SoC-specific partSylwester Nawrocki5-406/+473
The exynos-asv driver is re-factored as a prerequisite for adding support for other SoCs. Change-Id: I252a2f51d101ad39b0469ee7f31f69cd9f0120b5 Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2019-02-14packaging: Change the kernel version of the spec filesJunghoon Kim2-2/+2
This patch changes the kernel version of the spec files to 4.14.99. Change-Id: Ibb04f798717f8ff1e9f5e1c6691d6ec3e9dc56ff Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
2019-02-14drivers: power: opp: remove all OPPs registered from DTLukasz Luba1-1/+1
Patch solves issue with OPPs registered from DT and not removed during suspend. In suspend there was a warning: [ 18.152874] ------------[ cut here ]------------ [ 18.152885] WARNING: CPU: 7 PID: 43 at drivers/base/power/opp/core.c:1367 dev_pm_opp_put_regulators+0xa8/0xb8 [ 18.152889] Modules linked in: [ 18.152898] CPU: 7 PID: 43 Comm: cpuhp/7 Not tainted 4.14.85-00448-g64a9f12-dirty #6 [ 18.152902] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 18.152917] [<c01117b0>] (unwind_backtrace) from [<c010cf10>] (show_stack+0x20/0x24) [ 18.152927] [<c010cf10>] (show_stack) from [<c0c37310>] (dump_stack+0x7c/0x9c) [ 18.152938] [<c0c37310>] (dump_stack) from [<c012256c>] (__warn+0xe4/0x110) [ 18.152946] [<c012256c>] (__warn) from [<c01225c8>] (warn_slowpath_null+0x30/0x38) [ 18.152953] [<c01225c8>] (warn_slowpath_null) from [<c05755c4>] (dev_pm_opp_put_regulators+0xa8/0xb8) [ 18.152963] [<c05755c4>] (dev_pm_opp_put_regulators) from [<c0893e44>] (cpufreq_exit+0xa4/0xb0) [ 18.152971] [<c0893e44>] (cpufreq_exit) from [<c088f754>] (cpufreq_offline+0x118/0x238) [ 18.152977] [<c088f754>] (cpufreq_offline) from [<c088f930>] (cpuhp_cpufreq_offline+0x18/0x20) [ 18.152984] [<c088f930>] (cpuhp_cpufreq_offline) from [<c0122d18>] (cpuhp_invoke_callback+0xdc/0x964) [ 18.152992] [<c0122d18>] (cpuhp_invoke_callback) from [<c01245b8>] (cpuhp_thread_fun+0x114/0x2a4) [ 18.153002] [<c01245b8>] (cpuhp_thread_fun) from [<c0147298>] (smpboot_thread_fn+0x1cc/0x2f0) [ 18.153010] [<c0147298>] (smpboot_thread_fn) from [<c0142bb8>] (kthread+0x130/0x168) [ 18.153018] [<c0142bb8>] (kthread) from [<c0108e08>] (ret_from_fork+0x14/0x2c) [ 18.153023] ---[ end trace a7d94f69fabccd7c ]--- This fix introduces removing all OPPs and is similar to what is present in current mainline. Change-Id: I1abb9c5c887721163c24221ddcac90c35bdf8d67 Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
2019-02-14PM / devfreq: Fix handling of min/max_freq == 0Matthias Kaehlcke1-12/+30
Commit ab8f58ad72c4 ("PM / devfreq: Set min/max_freq when adding the devfreq device") initializes df->min/max_freq with the min/max OPP when the device is added. Later commit f1d981eaecf8 ("PM / devfreq: Use the available min/max frequency") adds df->scaling_min/max_freq and the following to the frequency adjustment code: max_freq = MIN(devfreq->scaling_max_freq, devfreq->max_freq); With the current handling of min/max_freq this is incorrect: Even though df->max_freq is now initialized to a value != 0 user space can still set it to 0, in this case max_freq would be 0 instead of df->scaling_max_freq as intended. In consequence the frequency adjustment is not performed: if (max_freq && freq > max_freq) { freq = max_freq; To fix this set df->min/max freq to the min/max OPP in max/max_freq_store, when the user passes a value of 0. This also prevents df->max_freq from being set below the min OPP when df->min_freq is 0, and similar for min_freq. Since it is now guaranteed that df->min/max_freq can't be 0 the checks for this case can be removed. Change-Id: I4092597dd0d81fd3937bf3a97a9e2639d542d030 Fixes: f1d981eaecf8 ("PM / devfreq: Use the available min/max frequency") Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> [cw00.choi: Backported from mainline kernel] Signed-off--by: Chanwoo Choi <cw00.choi@samsung.com>
2019-02-14PM / devfreq: Drop custom MIN/MAX macrosBjorn Andersson1-7/+4
Drop the custom MIN/MAX macros in favour of the standard min/max from kernel.h Change-Id: Ic519d8d2be7ec63e412221cdb55d85bad43f1be1 Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> [cw00.choi: Backported from mainline kernel] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>