summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2020-06-11leds: add support for MAX77843 led control driverSeung-Woo Kim4-0/+265
Maxim max77843 has 4-channel led controller on max77843 multi function device. Add max77843 led driver for the device. Note: this ports below commits in 4.1 kernel in tizen_5.0 branch: commit dd11bc28be60 ("mfd: max77843: Add led of_compatible in mfd_cell") commit ab013630b285 ("leds: add support for MAX77843 led control driver") Change-Id: I48c778addba06d1070284e4fc6b8e3ca500c089a Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-12-30ath10k: avoid possible string overflowArnd Bergmann1-1/+1
commit 6707ba0105a2d350710bc0a537a98f49eb4b895d upstream. The way that 'strncat' is used here raised a warning in gcc-8: drivers/net/wireless/ath/ath10k/wmi.c: In function 'ath10k_wmi_tpc_stats_final_disp_tables': drivers/net/wireless/ath/ath10k/wmi.c:4649:4: error: 'strncat' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] Effectively, this is simply a strcat() but the use of strncat() suggests some form of overflow check. Regardless of whether this might actually overflow, using strlcat() instead of strncat() avoids the warning and makes the code more robust. Fixes: bc64d05220f3 ("ath10k: debugfs support to get final TPC stats for 10.4 variants") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [sw0312.kim: cherry-pick from stable linux-4.14.y commit 0cc17a7a3203 for gcc 9 build] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: I9e104bff8046c7ffa7f50b047dc4cd2e9fdb83e6
2019-12-05drm/exynos: add debugfs interface and gem_info nodesubmit/tizen/20191206.054449accepted/tizen/unified/20191206.121231Seung-Woo Kim5-0/+120
The memps requires gem_info with gem_names to analyze graphics shared memory, so this patch adds gem_info node with debugfs interface. Change-Id: I467527da85978b7a07ec638139cec02ea29b6297 Signed-off-by: YoungJun Cho <yj44.cho@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-11-12media: exynos4-is: fix wrong mdev and v4l2 dev order in error pathSeung-Woo Kim1-3/+4
When driver is built as module and probe during insmod is deferred because of sensor subdevs, there is NULL pointer deference because mdev is cleaned up and then access it from v4l2_device_unregister(). Fix the wrong mdev and v4l2 dev order in error path of probe. This fixes below null pointer deference: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = ca026f68 [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM [...] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) PC is at ida_free+0x7c/0x160 LR is at xas_start+0x44/0x204 [...] [<c0dafd60>] (ida_free) from [<c083c20c>] (__media_device_unregister_entity+0x18/0xc0) [<c083c20c>] (__media_device_unregister_entity) from [<c083c2e0>] (media_device_unregister_entity+0x2c/0x38) [<c083c2e0>] (media_device_unregister_entity) from [<c0843404>] (v4l2_device_release+0xd0/0x104) [<c0843404>] (v4l2_device_release) from [<c0632558>] (device_release+0x28/0x98) [<c0632558>] (device_release) from [<c0db1204>] (kobject_put+0xa4/0x208) [<c0db1204>] (kct_put) from [<bf00bac4>] (fimc_capture_subdev_unregistered+0x58/0x6c [s5p_fimc]) [<bf00bac4>] (fimc_capture_subdev_unregistered [s5p_fimc]) from [<c084a1cc>] (v4l2_device_unregister_subdev+0x6c/0xa8) [<c084a1cc>] (v4l2_device_unregister_subdev) from [<c084a350>] (v4l2_device_unregister+0x64/0x94) [<c084a350>] (v4l2_device_unregister) from [<bf0101ac>] (fimc_md_probe+0x4ec/0xaf8 [s5p_fimc]) [...] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Fixes: 9832e155f1ed ("[media] media-device: split media initialization and registration") Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> [sw0312.kim: cherry-pick mainline commit 4d741cbd58bf to handle exynos4-is issue] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: Ib2f757574a180145d4972b861057f090a19d5f8f
2019-11-12media: exynos4-is: Fix recursive locking in isp_video_release()Seung-Woo Kim1-1/+1
>From isp_video_release(), &isp->video_lock is held and subsequent vb2_fop_release() tries to lock vdev->lock which is same with the previous one. Replace vb2_fop_release() with _vb2_fop_release() to fix the recursive locking. Fixes: 1380f5754cb0 ("[media] videobuf2: Add missing lock held on vb2_fop_release") Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> [sw0312.kim: cherry-pick mainline commit 704c6c80fb47 to handle exynos4-is issue] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: Ibbfbc33b83dc17e86d8b030c0f7f7e101d6293c7
2019-10-31clk: samsung: exynos5433: add missing slab.h headersubmit/tizen/20191031.111959submit/tizen/20191031.023155accepted/tizen/unified/20191101.042035tizen_5.5Seung-Woo Kim1-0/+1
After the commit ee9bfe5eb9de9a ("clk: samsung: exynos5433: Fix error paths"), missing slab.h header causes build issue for using kfree(). Add missing header as like mainline commit faac3604d05e which is upstream version of ee9bfe5eb9de9a. Change-Id: Ib47a3fe79a049fca11d6ac3f2a626156dd5696a7 Fixes: ee9bfe5eb9de9a ("clk: samsung: exynos5433: Fix error paths") Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
2019-10-25thermal: exynos: remove trip reporting to user-spacesubmit/tizen/20191031.012258Bartlomiej Zolnierkiewicz1-28/+2
Remove trip reporting to user-space - I'm not aware of any user-space program which relies on it and there is a thermal user-space governor which does it in proper way nowadays. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com> [sw0312.kim: apply mainline commit b43e3cfe232a to remove unnecessary overhead uevent] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: I618b1c0c2285f823ecad527b76d38153068a6d32
2019-10-08clk: samsung: exynos5433: Fix error pathsMarek Szyprowski1-2/+11
Add checking the value returned by samsung_clk_alloc_reg_dump() and devm_kcalloc(). While fixing this, also release all gathered clocks. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Change-Id: I08e35e458e51f07e4c05c4101ffb4b86d187aded
2019-09-06drm/exynos: fix to build suspend/resume callback functions alwaysSeung-Woo Kim1-2/+0
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>
2019-05-07gpu: drm: exynos: Add extcon notification for hdmi connectionsubmit/tizen/20190507.092632accepted/tizen/unified/20190508.111058Dongwoo Lee2-0/+48
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
2019-04-11clocksource/drivers/arm_arch_timer: Fix DEFINE_PER_CPU expansionMark Rutland1-2/+1
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
2019-03-28soc: samsung: Split ASV drivers into ARM and ARM64 partssubmit/tizen/20190329.020226accepted/tizen/unified/20190330.030053Sylwester Nawrocki4-5/+37
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>
2019-03-27soc: samsung: Add ASV support for Exynos5433 SoCSylwester Nawrocki4-1/+529
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>
2019-03-27mtd: Add exynos OTP memory driverSylwester Nawrocki3-0/+277
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>
2019-03-27soc: samsung: chipid: Add ABB register region read helperSylwester Nawrocki2-3/+22
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>
2019-03-27soc: samsung: chipid: Add exynos_chipid_read_bits() functionSylwester Nawrocki2-0/+8
Add register read helper function needed by the ASV driver. Change-Id: I90ec78cff58ac7ff424a50309e83d37605e7cbc7 Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
2019-03-27clk: samsung: Add CLK_IGNORE_UNUSED for Exynos5433 ABB, ASV_TB clocksSylwester Nawrocki1-2/+2
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>
2019-03-27soc: samsung: asv: Print error code when adding an OPP failsSylwester Nawrocki1-2/+2
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>
2019-03-27soc: samsung: asv: Wait until OPP gets released before adding new oneSylwester Nawrocki1-0/+10
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>
2019-03-19drm/exynos/mixer: fix MIXER shadow registry synchronisation codeAndrzej Hajda1-44/+66
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
2019-03-19drm/exynos/mixer: fix synchronization check in interlaced modeAndrzej Hajda2-0/+11
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
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-27base/firmware retry firmware load after rootfs mountChristoph Manszewski2-3/+37
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 Manszewski2-7/+2
This reverts commit 1733ede82e9e964a3d5234ef61979ca523e7ba5a. Signed-off-by: Christoph Manszewski <c.manszewski@samsung.com> Change-Id: I30441cbd9b4933cab7e1cb6e80d767e4fca65f41
2019-02-19mmc: block: Support the fixed index for mmcblk with aliases nodesJaehoon Chung1-1/+5
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-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-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 Kumar1-16/+33
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-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-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>
2019-02-14PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.Enric Balletbo i Serra1-4/+49
When the devfreq driver and the governor driver are built as modules, the call to devfreq_add_device() or governor_store() fails because the governor driver is not loaded at the time the devfreq driver loads. The devfreq driver has a build dependency on the governor but also should have a runtime dependency. We need to make sure that the governor driver is loaded before the devfreq driver. This patch fixes this bug by adding a try_then_request_governor() function. First tries to find the governor, and then, if it is not found, it requests the module and tries again. Change-Id: I71cdbcc2867980714de984d0c0c2641f7eda8b46 Fixes: 1b5c1be2c88e (PM / devfreq: map devfreq drivers to governor using name) Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> 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: use put_device() instead of kfree()Arvind Yadav1-1/+3
Never directly free @dev after calling device_register() or device_unregister(), even if device_register() returned an error. Always use put_device() to give up the reference initialized. Change-Id: I65b83e63daf44ff784753b2372890f07c6515a46 Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> 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: exynos-ppmu: Delete an error message for a failed memory ↵Markus Elfring1-4/+2
allocation in exynos_ppmu_probe() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Change-Id: I25ee724ab3da80f54f339c4ed54bb7bf3c30dbc8 Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-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-14drivers: devfreq: exynos: use devm_pm_opp_add() in DMCLukasz Luba1-10/+6
It change the exynos5-dmc dirver to use safe devm_pm_opp_add() function for registering new OPPs. Thus, there device resource subsystem takes care for removing OPPs and/or OPP table in case of deffer probe. Change-Id: I6d5793e990ac585dca60b4b93018fec0d5e018b0 Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
2019-02-14drivers: base: opp: add devm_* for registration of notification chainLukasz Luba1-0/+63
Add safe function devm_pm_opp_register_notifier() for registering notification chain for OPP changes. The function is used in case of deffer probe, when the device is cleaned and probe function is called agian. Change-Id: I188bbfaddc821489c26cb908abb05ccece831dc3 Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
2019-02-14drivers: base: opp: add devres support and devm_* functionsLukasz Luba2-1/+90
The patch adds basic support for resource tracking in OPP subsystem. From now, adding a new OPP might be done using devm_pm_opp_add() which is safe in case of deffer probe. When the deffer probe is used and the driver does not remove explicitly the OPP table, it causes warnings for the next try. With devm_pm_opp_add() the resources are freed and the next deffer probe is safe. There is also simple wrapper for dev_pm_opp_remove(). Change-Id: I0b8282e9faf59b34e958853a451f2e7c9a13c18b Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
2019-02-14drivers: base: opp: add allocate_opp_table() used by devres.cLukasz Luba1-0/+11
The patch adds needed function for devres.c which implements family of devm_* safe function. It is used for resource tracking in case of deffer probe, when the driver probe function is called a few times. The allocated OPP table must be freed and OPPs removed. Change-Id: I9f098ea8a00bbef03ba680c4efe3b2fdf2e076d2 Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
2019-02-14mfd: sec-core: read irq registersJoonyoung Shim1-0/+5
On Odroid-XU3 case, this needs to succeed suspend/resume from second time. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Change-Id: I6ae92bb1116bb3ccfdbae4769258001cedd43d44
2019-02-14clk: samsung: exynos5420: Define CLK_SECKEY gate clock only or Exynos5420Joonyoung Shim1-2/+1
The bit of GATE_BUS_PERIS1 for CLK_SECKEY is just reserved on exynos5422/5800, not exynos5420. Define gate clk for exynos5420 to handle the bit only on exynos5420. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> [m.szyprow: rewrote commit subject] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <snawrocki@kernel.org> [backport of mainline commit d32dd2a1a0f80edad158c9a1ba5f47650d9504a0] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: Ibe07b14ac8bc88d18e76c9e2968ff7c08b5c3b67
2019-02-14clk: samsung: Export Exynos5420 CLK_MOUT_WCORE NoC clockLukasz Luba1-1/+2
Patch adds ID for clock needed for changing parent of the main NoC clock. Change-Id: I7ecc64ce7b09d0e7654bf9830e73a8328e269164 Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
2019-02-14drivers: devfreq: events: add Exynos PPMU new eventsLukasz Luba1-0/+6
Define new performance events supported by Exynos5422 SoC counters. The counters are built-in in Dynamic Memory Controller and provide information regarding memory utilization. Change-Id: Ia5feaed119cdbbdf570f8a5b3efcf231c500a2c8 Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>