platform/kernel/linux-exynos.git
5 years agoarm64: dts: exynos: Add CPU performance counters to Exynos5433 boards
Marek Szyprowski [Thu, 23 Nov 2017 14:34:31 +0000 (15:34 +0100)]
arm64: dts: exynos: Add CPU performance counters to Exynos5433 boards

Enable support for ARM Performance Monitoring Units available in
Cortex-A53 and Cortex-A57 CPU cores for Exynos5433 SoCs.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Use lower case hex addresses in node unit addresses
Krzysztof Kozlowski [Thu, 14 Dec 2017 20:54:30 +0000 (21:54 +0100)]
ARM: dts: exynos: Use lower case hex addresses in node unit addresses

Convert all hex addresses in node unit addresses to lower case to fix warnings
like:
    arch/arm/boot/dts/exynos5422-odroidhc1.dtb: Warning (simple_bus_reg):
      Node /soc/nocp@10CA1000 simple-bus unit address format error, expected "10ca1000"

Conversion was done using sed:

    $ sed -e 's/@\([a-zA-Z0-9_-]*\) {/@\L\1 {/' -i arch/arm/boot/dts/exynos*.dts*

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add nodes for True Random Number Generator
Łukasz Stelmach [Tue, 12 Dec 2017 12:09:02 +0000 (13:09 +0100)]
ARM: dts: exynos: Add nodes for True Random Number Generator

Add nodes for the True Random Number Generator found in Samsung Exynos
5250+ SoCs.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add DT nodes for PRNG in Exynos5 SoCs
Łukasz Stelmach [Mon, 11 Dec 2017 08:54:15 +0000 (09:54 +0100)]
ARM: dts: exynos: Add DT nodes for PRNG in Exynos5 SoCs

Add nodes for Pseudo Random Number Generator in dts files describing
Exynos5 chips.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add G3D power domain to Exynos5250
Marek Szyprowski [Fri, 8 Dec 2017 14:53:56 +0000 (15:53 +0100)]
ARM: dts: exynos: Add G3D power domain to Exynos5250

Add support for G3D power domain, which contains ARM Mali-600MP
graphics accelerator device (not yet instantiated).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add audio power domain to Exynos5250
Marek Szyprowski [Fri, 8 Dec 2017 14:53:55 +0000 (15:53 +0100)]
ARM: dts: exynos: Add audio power domain to Exynos5250

Audio power domain includes following hardware modules: Pin controller
for GPZ bank, AudioSS clock controller and three Exynos I2S controller.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Fix power domain node names for Exynos5250
Marek Szyprowski [Fri, 8 Dec 2017 14:53:54 +0000 (15:53 +0100)]
ARM: dts: exynos: Fix power domain node names for Exynos5250

Device nodes in device tree should use generic names, so rename
all existing domains to "power-domain".

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add audio power domain support to Exynos542x SoCs
Marek Szyprowski [Wed, 29 Nov 2017 11:35:14 +0000 (12:35 +0100)]
ARM: dts: exynos: Add audio power domain support to Exynos542x SoCs

Audio power domain includes following hardware modules: Pin controller
for GPZ bank, AudioSS clock controller, PL330 ADMA device and Exynos I2S
controller.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Fix property values of LDO15/17 for Odroid XU3/XU4
Dongjin Kim [Tue, 28 Nov 2017 00:15:01 +0000 (19:15 -0500)]
ARM: dts: exynos: Fix property values of LDO15/17 for Odroid XU3/XU4

Looking at the schematic, LDO15 and LDO17 are tied as a power source of a
builtin network chipset. Correct voltage on LDO15 to 3.3V and the name
of LDO17 to "vdd_ldo17".

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add Exynos4412 ISP clock controller
Marek Szyprowski [Wed, 11 Oct 2017 09:25:14 +0000 (11:25 +0200)]
ARM: dts: exynos: Add Exynos4412 ISP clock controller

Exynos4412 ISP clock controller is located in the SOC area, which belongs
to ISP power domain. This patch instantiates a separate clock driver
for those clocks, updates all clients of ISP clocks and ensures that the
driver is properly integrated in ISP power domin.

This finally solves all the mysterious freezes in accessing ISP clocks
when ISP power domain is disabled.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Move G2D node to exynos5.dtsi
Tobias Jakobi [Wed, 29 Nov 2017 11:42:34 +0000 (12:42 +0100)]
ARM: dts: exynos: Move G2D node to exynos5.dtsi

Current the node is only defined in the exynos5250 DT, while
the corresponding SYSMMUs are also to be found in the exynos5420
DT. Move the node to exynos5 and only setup the SYSMMUs in the
corresponding DT.

Disable the node by default, since exynos5410 also includes
the dtsi, but currently does not define the G2D clock.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
[mszyprow: rephrased commit message]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add CPU perf counters to Exynos54xx boards
Marian Mihailescu [Thu, 23 Nov 2017 14:34:30 +0000 (15:34 +0100)]
ARM: dts: exynos: Add CPU perf counters to Exynos54xx boards

Enable support for ARM Performance Monitoring Units available in Cortex-A7
and Cortex-A15 CPU cores for Exynos54xx SoCs (5410, 5420 and 5422/5800).

The PMUs interrupts are defined in the common exynos54xx.dtsi device tree,
but the PMUs are enabled and have their interrupt CPU affinity defined
next to each SoC's cpus node.

Tested with perf on Odroid XU4 (Exynos5422):
armv7_cortex_a7 PMU driver: 5 counters available
armv7_cortex_a15 PMU driver: 7 counters available

Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Marian Mihailescu <mihailescu2m@gmail.com>
Signed-off-by: Willy Wolff <willy.mh.wolff@gmail.com>
[mszyprow: reordered nodes according to krzk request, fixed typos]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Remove duplicate definitions of SSS nodes for Exynos5
Łukasz Stelmach [Mon, 27 Nov 2017 12:37:11 +0000 (13:37 +0100)]
ARM: dts: exynos: Remove duplicate definitions of SSS nodes for Exynos5

Move Security Subsystem nodes common for Exynos5250 and Exynos54xx
to exynos5.dtsi to avoid duplication.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add bcm4334 device node to Trats2
Simon Shields [Mon, 13 Nov 2017 00:52:03 +0000 (11:52 +1100)]
ARM: dts: exynos: Add bcm4334 device node to Trats2

This patch allows the bcm4334 to power on and enables WiFi functionality
on Trats2.

Signed-off-by: Simon Shields <simon@lineageos.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add sound support for Odroid XU4
Sylwester Nawrocki [Fri, 3 Nov 2017 16:54:46 +0000 (17:54 +0100)]
ARM: dts: exynos: Add sound support for Odroid XU4

This patch adds support for Odroid XU4 audio. The main difference
comparing to Odroid XU3 is a missing on-board audio CODEC, only
HDMI output is supported on Odroid XU4. External CODEC could be
optionally connected to the I2S port connector.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Switch to dedicated Odroid XU3 sound card binding
Sylwester Nawrocki [Fri, 3 Nov 2017 16:54:45 +0000 (17:54 +0100)]
ARM: dts: exynos: Switch to dedicated Odroid XU3 sound card binding

The new sound card DT binding is used for Odroid XU3 in order
to properly support the HDMI audio path.  Clocks configuration is
changed so the I2S controller is now the bit clock and the frame clock
master.  The EPLL output clock is now the audio root clock adjusted to
each audio sample rate.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Enable Mixer node for Exynos5800 Peach Pi machine
Javier Martinez Canillas [Tue, 12 Dec 2017 07:42:08 +0000 (08:42 +0100)]
ARM: dts: exynos: Enable Mixer node for Exynos5800 Peach Pi machine

Commit 1cb686c08d12 ("ARM: dts: exynos: Add status property to Exynos 542x
Mixer nodes") disabled the Mixer node by default in the DTSI and enabled
for each Exynos 542x DTS. But unfortunately it missed to enable it for the
Exynos5800 Peach Pi machine, since the 5800 is also an 542x SoC variant.

Fixes: 1cb686c08d12 ("ARM: dts: exynos: Add status property to Exynos 542x Mixer nodes")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoarm: dts: fix unit-address leading 0s
Rob Herring [Fri, 13 Oct 2017 17:54:51 +0000 (12:54 -0500)]
arm: dts: fix unit-address leading 0s

Fix dtc warnings for 'simple_bus_reg' due to leading 0s. Converted using
the following command:

perl -p -i -e 's/\@0+([0-9a-f])/\@$1/g' `find arch/arm/boot/dts -type -f -name '*.dts*'

Dropped changes to ARM, Ltd. boards LED nodes and manually fixed up some
occurrences of uppercase hex.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agodrm/exynos: ipp: Remove Exynos DRM IPP subsystem
Marek Szyprowski [Thu, 14 Dec 2017 15:10:15 +0000 (16:10 +0100)]
drm/exynos: ipp: Remove Exynos DRM IPP subsystem

Exynos DRM IPP subsystem is in fact non-functional and frankly speaking
dead-code. This patch clearly marks that Exynos DRM IPP subsystem is
broken and never really functional. It will be replaced by a completely
rewritten API.

Exynos DRM IPP user-space API can be obsoleted for the following
reasons:

1. Exynos DRM IPP user-space API can be optional in Exynos DRM, so
userspace should not rely that it is always available and should have
a software fallback in case it is not there.

2. The only mode which was initially semi-working was memory-to-memory
image processing. The remaining modes (LCD-"writeback" and "output")
were never operational due to missing code (both in mainline and even
vendor kernels).

3. Exynos DRM IPP mainline user-space API compatibility for
memory-to-memory got broken very early by commit 083500baefd5 ("drm:
remove DRM_FORMAT_NV12MT", which removed the support for tiled formats,
the main feature which made this API somehow useful on Exynos platforms
(video codec that time produced only tiled frames, to implement xvideo
or any other video overlay, one has to de-tile them for proper
display).

4. Broken drivers. Especially once support for IOMMU has been added,
it revealed that drivers don't configure DMA operations properly and in
many cases operate outside the provided buffers trashing memory around.

5. Need for external patches. Although IPP user-space API has been used
in some vendor kernels, but in such cases there were additional patches
applied (like reverting mentioned 083500baefd5 patch) what means that
those userspace apps which might use it, still won't work with the
mainline kernel version.

We don't have time machines, so we cannot change it, but Exynos DRM IPP
extension should never have been merged to mainline in that form.

Exynos IPP subsystem and user-space API will be rewritten, so remove
current IPP core code and mark existing drivers as BROKEN.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/decon: Add include guard to the Exynos7 header
Krzysztof Kozlowski [Tue, 26 Dec 2017 13:07:19 +0000 (14:07 +0100)]
drm/exynos/decon: Add include guard to the Exynos7 header

Although header is included only once but still having an include guard
is a good practice.  To avoid confusion, add SoC prefix to existing
Exynos5433 header include guard.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/decon: Move headers from global to local place
Krzysztof Kozlowski [Tue, 26 Dec 2017 13:07:18 +0000 (14:07 +0100)]
drm/exynos/decon: Move headers from global to local place

The DECON headers contain only defines for registers.  There are no
other drivers using them so this should be put locally to the Exynos DRM
driver.  Keeping headers local helps managing the code.

Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: decon5433: Remove unnecessary platform_get_resource() error check
Fabio Estevam [Mon, 18 Dec 2017 13:02:25 +0000 (11:02 -0200)]
drm/exynos: decon5433: Remove unnecessary platform_get_resource() error check

devm_ioremap_resource() already checks if the resource is NULL, so
remove the unnecessary platform_get_resource() error check.

Cc: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: remove unnecessary function declaration
Inki Dae [Thu, 23 Nov 2017 09:27:57 +0000 (18:27 +0900)]
drm/exynos: remove unnecessary function declaration

Removed exynos_drm_get_dma_device funtion declaration on top
of exynos_drm_drv.c file.

We can remove this declaration by moving the implementation
of this function upwards.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: remove unnecessary descrptions
Inki Dae [Thu, 23 Nov 2017 09:32:06 +0000 (18:32 +0900)]
drm/exynos: remove unnecessary descrptions

Removed two descriptions to 'da_start' and 'da_space_size'
from exynos_drm_private structure.

These members don't exist anymore.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: Fix dma-buf import
Marek Szyprowski [Mon, 30 Oct 2017 07:28:09 +0000 (08:28 +0100)]
drm/exynos: Fix dma-buf import

When IOMMU support was enabled, dma-buf import in Exynos DRM was broken
since commit f43c35966a5a ("drm/exynos: use real device for DMA-mapping
operations") due to using wrong struct device in drm_gem_prime_import()
function. This patch fixes following kernel BUG caused by incorrect buffer
mapping to DMA address space:

exynos-sysmmu 14650000.sysmmu: 14450000.mixer: PAGE FAULT occurred at 0xb2e00000
------------[ cut here ]------------
kernel BUG at drivers/iommu/exynos-iommu.c:449!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc4-next-20171016-00033-g990d723669fd #3165
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
task: c0e0b7c0 task.stack: c0e00000
PC is at exynos_sysmmu_irq+0x1d0/0x24c
LR is at exynos_sysmmu_irq+0x154/0x24c
------------[ cut here ]------------

Reported-by: Marian Mihailescu <mihailescu2m@gmail.com>
Fixes: f43c35966a5a ("drm/exynos: use real device for DMA-mapping operations")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm: exynos: Use proper macro definition for HDMI_I2S_PIN_SEL_1
Sylwester Nawrocki [Wed, 14 Feb 2018 17:23:56 +0000 (18:23 +0100)]
drm: exynos: Use proper macro definition for HDMI_I2S_PIN_SEL_1

Bit field [2:0] of HDMI_I2S_PIN_SEL_1 corresponds to SDATA_0,
not SDATA_2. This patch removes redefinition of HDMI_I2S_SEL_DATA2
constant and adds missing HDMI_I2S_SEL_DATA0.
The value of bit field selecting SDATA_1 (pin_sel_3) is also changed,
so it is 3 as suggested in the Exynos TRMs.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm: exynos: Add driver for HDMI audio interface
Sylwester Nawrocki [Mon, 23 Oct 2017 12:49:34 +0000 (14:49 +0200)]
drm: exynos: Add driver for HDMI audio interface

The hdmi-codec interface added in this patch is required to properly
support HDMI audio. Currently the audio part of the SoC internal
HDMI transmitter is configured with fixed values, which makes HDMI
audio working by chance, only on boards having an external audio
codec connected in parallel with the HDMI audio transmitter's input
I2S interface.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/hdmi: add 85.5MHz pixel clock for v14 HDMI PHY
Daniel Drake [Fri, 29 Sep 2017 10:05:42 +0000 (12:05 +0200)]
drm/exynos/hdmi: add 85.5MHz pixel clock for v14 HDMI PHY

Configuration details from Samsung. This enables 1366x768@60Hz,
which also needs the 256px timing hack to work around a mixer
limitation.

Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
[a.hajda@samsung.com: rebased onto proposed patchset]
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: enable support for 1024x768 and 1280x1024 modes
Andrzej Hajda [Fri, 29 Sep 2017 10:05:41 +0000 (12:05 +0200)]
drm/exynos/mixer: enable support for 1024x768 and 1280x1024 modes

Since HDMI can handle these modes despite of MIXER limitations let's
enable them.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/hdmi: quirk for support mode timings conversion
Andrzej Hajda [Fri, 29 Sep 2017 10:05:40 +0000 (12:05 +0200)]
drm/exynos/hdmi: quirk for support mode timings conversion

MIXER in SoCs prior to Exynos5420 supports only 4 video modes:
720x480, 720x576, 1280x720, 1920x1080. Support for other modes
can be enabled by manipulating timings of HDMI. To do it
adjusted_mode should contain actual mode set on crtc.
With this patch it is possible to enable 1024x768 and 1280x1024
modes in MIXER.

Suggested-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: pass actual mode on MIXER to encoder
Andrzej Hajda [Fri, 29 Sep 2017 10:05:39 +0000 (12:05 +0200)]
drm/exynos/mixer: pass actual mode on MIXER to encoder

MIXER in SoCs prior to Exynos5420 supports only 4 video modes:
720x480, 720x576, 1280x720, 1920x1080. Support for other modes can be
enabled by manipulating timings of HDMI. To allow it MIXER must pass
actual video mode to HDMI, the proper way to do it is to modify
adjusted_mode property in crtc::mode_fixup callback. Adding such callback
allows also to simplify mixer_cfg_scan code - choosing mode is performed
already in crtc::mode_fixup. mode_fixup is also better place to check
interlace flag.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos: add mode_fixup callback to exynos_drm_crtc_ops
Andrzej Hajda [Fri, 29 Sep 2017 10:05:38 +0000 (12:05 +0200)]
drm/exynos: add mode_fixup callback to exynos_drm_crtc_ops

crtc::mode_fixup callback is required by crtcs which internally use
a different mode than requested by user - case of Exynos Mixer.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/hdmi: remove redundant mode field
Andrzej Hajda [Fri, 29 Sep 2017 10:05:37 +0000 (12:05 +0200)]
drm/exynos/hdmi: remove redundant mode field

Display mode is preserved in CRTC state, there is no need to keep local
copy of it. Moreover since HDMI should configure registers according to
requested mode, use it instead of adjusted_mode, which should contain
mode produced by CRTC - functionally it does not change anything, but
subsequent patches will make the difference.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: remove mixer_resources sub-structure
Andrzej Hajda [Fri, 29 Sep 2017 10:05:36 +0000 (12:05 +0200)]
drm/exynos/mixer: remove mixer_resources sub-structure

mixer_resources adds only unnecessary redirection, removing it makes the
code shorter and cleaner.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: fix mode validation code
Andrzej Hajda [Fri, 29 Sep 2017 10:05:35 +0000 (12:05 +0200)]
drm/exynos/mixer: fix mode validation code

Mode limitation checked in mixer driver affects only older HW.
Mixer in Exynos542x has no such limitations. While at it patch changes
validation callback to recently introduced mode_valid which is more
suitable for the check. Additionally little cleanup is performed.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: move resolution configuration to single function
Andrzej Hajda [Fri, 29 Sep 2017 10:05:34 +0000 (12:05 +0200)]
drm/exynos/mixer: move resolution configuration to single function

Screen resolution configuration depends on HW version, let's put it into
single function to make it consistent and simplify the code.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: move mode commit to enable callback
Andrzej Hajda [Fri, 29 Sep 2017 10:05:33 +0000 (12:05 +0200)]
drm/exynos/mixer: move mode commit to enable callback

Mode commit should not be called for every plane separately. It is enough
to call it once in enable callback. The change also requires that
the interlace check is moved to mixer_commit. It should be done in
the same patch to avoid regression.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/exynos/mixer: abstract out output mode setup code
Andrzej Hajda [Fri, 29 Sep 2017 10:05:32 +0000 (12:05 +0200)]
drm/exynos/mixer: abstract out output mode setup code

Mode setup code is called from video plane update and mixer plane update.
Let's group it together in mixer_commit function like in case of other
Exynos CRTCs.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/bridge/sii8620: add DVI mode support
Maciej Purski [Thu, 9 Nov 2017 10:53:42 +0000 (11:53 +0100)]
drm/bridge/sii8620: add DVI mode support

If the sink device is in HDMI mode, enable infoframe interrupt in scdt
irq handle function else call start_video function immediately, because
in DVI mode, there is no infoframe interrupt provided.

Rename start_hdmi function to start_video and get rid of the old
start_video function. In start_video, if the sink is DVI and mode is
MHL1 or MHl2, write appropriate values to registers else the path
should remain the same as in HDMI mode.

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1510224822-7732-1-git-send-email-m.purski@samsung.com
5 years agodrm/bridge/sii8620: filter unsupported modes
Marek Szyprowski [Thu, 9 Nov 2017 10:28:31 +0000 (11:28 +0100)]
drm/bridge/sii8620: filter unsupported modes

The maximum pixel clock depends on the version of the connected MHL
adapter. Add mode_valid callback to filter out modes with too high pixel
clock to avoid failure in mode_fixup later.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171109102831.19844-1-m.szyprowski@samsung.com
5 years agodrm/bridge/sii8620: add remote control support
Maciej Purski [Thu, 24 Aug 2017 08:58:07 +0000 (10:58 +0200)]
drm/bridge/sii8620: add remote control support

MHL specification defines Remote Control Protocol(RCP) to
send input events between MHL devices.
The driver now recognizes RCP messages and reacts to them
by reporting key events to input subsystem, allowing
a user to control a device using TV remote control.

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Acked-by: Sean Young <sean@mess.org>
Acked-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1503565087-19730-1-git-send-email-m.purski@samsung.com
5 years agophy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800
Vivek Gautam [Mon, 9 Oct 2017 12:00:51 +0000 (14:00 +0200)]
phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800

Adding phy calibration sequence for USB 3.0 DRD PHY present on
Exynos5420/5800 systems.
This calibration facilitates setting certain PHY parameters viz.
the Loss-of-Signal (LOS) Detector Threshold Level, as well as
Tx-Vboost-Level for Super-Speed operations.
Additionally we also set proper time to wait for RxDetect measurement,
for desired PHY reference clock, so as to solve issue with enumeration
of few USB 3.0 devices, like Samsung SUM-TSB16S 3.0 USB drive
on the controller.

We are using CR_port for this purpose to send required data
to override the LOS values.

On testing with USB 3.0 devices on USB 3.0 port present on
SMDK5420, and peach-pit boards should see following message:
usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd

and without this patch, should see below shown message:
usb 1-1: new high-speed USB device number 2 using xhci-hcd

[Also removed unnecessary extra lines in the register macro definitions]

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
[adapted to use phy_calibrate as entry point]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
5 years agodrivers: phy: add calibrate method
Andrzej Pietrasiewicz [Mon, 9 Oct 2017 12:00:50 +0000 (14:00 +0200)]
drivers: phy: add calibrate method

Some quirky UDCs (like dwc3 on Exynos) need to have their phys calibrated e.g.
for using super speed. This patch adds a new phy_calibrate() method.
When the calibration should be used is dependent on actual chip.

In case of dwc3 on Exynos the calibration must happen after usb_add_hcd()
(while in host mode), because certain phy parameters like Tx LOS levels
and boost levels need to be calibrated further post initialization of xHCI
controller, to get SuperSpeed operations working. But an hcd must be
prepared first in order to pass it to usb_add_hcd(), so, in particular, dwc3
registers must be available first, and in order for the latter to happen
the phys must be initialized. This poses a chicken and egg problem if
the calibration were to be performed in phy_init(). To break the circular
dependency a separate method is added which can be called at a desired
moment after phy intialization.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
5 years agoextcon: max77843: Add support for SmartDock accessory
Marek Szyprowski [Wed, 18 Oct 2017 09:56:22 +0000 (11:56 +0200)]
extcon: max77843: Add support for SmartDock accessory

SmartDock uses ADC_RESERVED_ACC_3 (0x10) ADC ID type and provides following
features:
1. USB host with embedded USB hub (2-4 ports) for mice, keyboard, etc,
2. MHL for video output,
3. charging.

Tested with Unitek Y-2165 MHL+OTG Hub Smart Phone Dock.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agoextcon: max77843: Add OTG power control to the MUIC driver
Marek Szyprowski [Wed, 18 Oct 2017 09:56:21 +0000 (11:56 +0200)]
extcon: max77843: Add OTG power control to the MUIC driver

Enabling power on VBUS micro-usb pin is required only when passive OTG
cable is connected. Initially OTG VBUS power control was planned to be
done in charger driver. However such information is not really available
from the extcon notifications, so VBUS power control has to be done
directly in MUIC driver, which has all information about the attached
accessory.

For example SmartDock is externally powered accessory, provides OTG
(USB HOST) functionality and use VBUS pin for charging a device battery,
so the VBUS charging pump should be disabled in such case.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agoextcon: max14577: Delete an unnecessary variable initialisation in max14577_muic_set_...
Markus Elfring [Sun, 22 Oct 2017 17:39:12 +0000 (19:39 +0200)]
extcon: max14577: Delete an unnecessary variable initialisation in max14577_muic_set_path()

The variable "ret" is immediately reassigned by a following statement.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agoextcon: make extcon_info static const, fixes warning
Colin Ian King [Sat, 9 Sep 2017 16:51:00 +0000 (17:51 +0100)]
extcon: make extcon_info static const, fixes warning

The array extcon_info is read only, local to the source and does not
need to be in global scope, so make it static const.

Cleans up sparse warning:
symbol 'extcon_info' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agoextcon: Split out extcon header file for consumer and provider device
Chanwoo Choi [Thu, 21 Sep 2017 03:11:24 +0000 (12:11 +0900)]
extcon: Split out extcon header file for consumer and provider device

The extcon has two type of extcon devices as following.
- 'extcon provider deivce' adds new extcon device and detect the
   state/properties of external connector. Also, it notifies the
   state/properties to the extcon consumer device.
- 'extcon consumer device' gets the change state/properties
   from extcon provider device.
Prior to that, include/linux/extcon.h contains all exported API for
both provider and consumer device driver. To clarify the meaning of
header file and to remove the wrong use-case on consumer device,
this patch separates into extcon.h and extcon-provider.h.

[Description for include/linux/{extcon.h|extcon-provider.h}]
- extcon.h includes the extcon API and data structure for extcon consumer
  device driver. This header file contains the following APIs:
  : Register/unregister the notifier to catch the change of extcon device
  : Get the extcon device instance
  : Get the extcon device name
  : Get the state of each external connector
  : Get the property value of each external connector
  : Get the property capability of each external connector

- extcon-provider.h includes the extcon API and data structure for extcon
  provider device driver. This header file contains the following APIs:
  : Include 'include/linux/extcon.h'
  : Allocate the memory for extcon device instance
  : Register/unregister extcon device
  : Set the state of each external connector
  : Set the property value of each external connector
  : Set the property capability of each external connector

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
5 years agoiommu/exynos: Rework runtime PM links management
Marek Szyprowski [Fri, 15 Sep 2017 11:05:08 +0000 (13:05 +0200)]
iommu/exynos: Rework runtime PM links management

add_device is a bit more suitable for establishing runtime PM links than
the xlate callback. This change also makes it possible to implement proper
cleanup - in remove_device callback.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
5 years agoASoC: samsung: i2s: disable secondary DAI until it gets fixed
Marek Szyprowski [Wed, 18 Oct 2017 07:25:34 +0000 (09:25 +0200)]
ASoC: samsung: i2s: disable secondary DAI until it gets fixed

Secondary DAI in Exynos I2S driver is not used by any of the currently
supported boards and it causes problems due to some limitations in the
ASoC code. Disable it until it gets proper support both by board-specific
and ASoC core code. Also disable IDMA support, which relies on secondary
DAI presence.

This patch fixes following kernel warning:
samsung-i2s 3830000.i2s: ASoC: Failed to create component debugfs directory
samsung-i2s 3830000.i2s: ASoC: Failed to create component debugfs directory
------------[ cut here ]------------
WARNING: CPU: 3 PID: 82 at fs/proc/generic.c:330 proc_register+0xec/0x10c
proc_dir_entry 'sub0/prealloc' already registered
Modules linked in:
CPU: 3 PID: 82 Comm: kworker/3:1 Not tainted 4.14.0-rc5-next-20171017 #3089
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
Workqueue: events deferred_probe_work_func
[<c0110114>] (unwind_backtrace) from [<c010c900>] (show_stack+0x10/0x14)
[<c010c900>] (show_stack) from [<c083e664>] (dump_stack+0x90/0xc8)
[<c083e664>] (dump_stack) from [<c011d2b8>] (__warn+0xd4/0x100)
[<c011d2b8>] (__warn) from [<c011d384>] (warn_slowpath_fmt+0x38/0x48)
[<c011d384>] (warn_slowpath_fmt) from [<c0271268>] (proc_register+0xec/0x10c)
[<c0271268>] (proc_register) from [<c027130c>] (proc_create_data+0x84/0xc8)
[<c027130c>] (proc_create_data) from [<c061afbc>] (snd_info_register+0x64/0xcc)
[<c061afbc>] (snd_info_register) from [<c062a6e0>] (snd_pcm_lib_preallocate_pages1+0x78/0x1a0)
[<c062a6e0>] (snd_pcm_lib_preallocate_pages1) from [<c063eef4>] (dmaengine_pcm_new+0xa0/0x1ec)
[<c063eef4>] (dmaengine_pcm_new) from [<c062b9f8>] (snd_soc_platform_drv_pcm_new+0x1c/0x28)
[<c062b9f8>] (snd_soc_platform_drv_pcm_new) from [<c063d54c>] (soc_new_pcm+0x2f4/0x4f4)
[<c063d54c>] (soc_new_pcm) from [<c063107c>] (snd_soc_register_card+0xc4c/0xdc4)
[<c063107c>] (snd_soc_register_card) from [<c063db30>] (devm_snd_soc_register_card+0x34/0x70)
[<c063db30>] (devm_snd_soc_register_card) from [<c064af60>] (asoc_simple_card_probe+0x230/0x47c)
[<c064af60>] (asoc_simple_card_probe) from [<c047f8fc>] (platform_drv_probe+0x50/0xb0)
[<c047f8fc>] (platform_drv_probe) from [<c047dee0>] (driver_probe_device+0x2a0/0x46c)
[<c047dee0>] (driver_probe_device) from [<c047c0bc>] (bus_for_each_drv+0x44/0x8c)
[<c047c0bc>] (bus_for_each_drv) from [<c047db50>] (__device_attach+0xa0/0x134)
[<c047db50>] (__device_attach) from [<c047cf7c>] (bus_probe_device+0x88/0x90)
[<c047cf7c>] (bus_probe_device) from [<c047d484>] (deferred_probe_work_func+0x3c/0x168)
[<c047d484>] (deferred_probe_work_func) from [<c01371f8>] (process_one_work+0x188/0x41c)
[<c01371f8>] (process_one_work) from [<c01374b4>] (process_scheduled_works+0x28/0x38)
[<c01374b4>] (process_scheduled_works) from [<c01376d4>] (worker_thread+0x210/0x4dc)
[<c01376d4>] (worker_thread) from [<c013d9cc>] (kthread+0x128/0x164)
[<c013d9cc>] (kthread) from [<c0108848>] (ret_from_fork+0x14/0x2c)
---[ end trace bad8db6ee771d094 ]--

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agommc: sdhci-s3c: Fix driver data for Exynos4 SoCs
Marek Szyprowski [Wed, 4 Oct 2017 06:38:24 +0000 (08:38 +0200)]
mmc: sdhci-s3c: Fix driver data for Exynos4 SoCs

Support for non-dt based initialization for Exynos SoCs has been removed,
so there is no need to keep driver IDs for this case. While touching this,
replace odd conditional code for instantiating driver data for Exynos4
SoCs with a simple reference and move that driver data under CONFIG_OF.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
5 years agomedia: s5p-mfc: fix lockdep warning
Shuah Khan [Mon, 30 Oct 2017 21:04:57 +0000 (17:04 -0400)]
media: s5p-mfc: fix lockdep warning

The driver mmap functions shouldn't take lock when calling vb2_mmap().
Fix it to not take the lock. The following lockdep warning is fixed
with this change.

[ 2106.181412] ======================================================
[ 2106.187563] WARNING: possible circular locking dependency detected
[ 2106.193718] 4.14.0-rc2-00002-gfab205f-dirty #4 Not tainted
[ 2106.199175] ------------------------------------------------------
[ 2106.205328] qtdemux0:sink/2614 is trying to acquire lock:
[ 2106.210701]  (&dev->mfc_mutex){+.+.}, at: [<bf175544>] s5p_mfc_mmap+0x28/0xd4 [s5p_mfc]
[ 2106.218672]
[ 2106.218672] but task is already holding lock:
[ 2106.224477]  (&mm->mmap_sem){++++}, at: [<c01df2e4>] vm_mmap_pgoff+0x44/0xb8
[ 2106.231497]
[ 2106.231497] which lock already depends on the new lock.
[ 2106.231497]
[ 2106.239642]
[ 2106.239642] the existing dependency chain (in reverse order) is:
[ 2106.247095]
[ 2106.247095] -> #1 (&mm->mmap_sem){++++}:
[ 2106.252473]        __might_fault+0x80/0xb0
[ 2106.256567]        video_usercopy+0x1cc/0x510 [videodev]
[ 2106.261845]        v4l2_ioctl+0xa4/0xdc [videodev]
[ 2106.266596]        do_vfs_ioctl+0xa0/0xa18
[ 2106.270667]        SyS_ioctl+0x34/0x5c
[ 2106.274395]        ret_fast_syscall+0x0/0x28
[ 2106.278637]
[ 2106.278637] -> #0 (&dev->mfc_mutex){+.+.}:
[ 2106.284186]        lock_acquire+0x6c/0x88
[ 2106.288173]        __mutex_lock+0x68/0xa34
[ 2106.292244]        mutex_lock_interruptible_nested+0x1c/0x24
[ 2106.297893]        s5p_mfc_mmap+0x28/0xd4 [s5p_mfc]
[ 2106.302747]        v4l2_mmap+0x54/0x88 [videodev]
[ 2106.307409]        mmap_region+0x3a8/0x638
[ 2106.311480]        do_mmap+0x330/0x3a4
[ 2106.315207]        vm_mmap_pgoff+0x90/0xb8
[ 2106.319279]        SyS_mmap_pgoff+0x90/0xc0
[ 2106.323439]        ret_fast_syscall+0x0/0x28
[ 2106.327683]
[ 2106.327683] other info that might help us debug this:
[ 2106.327683]
[ 2106.335656]  Possible unsafe locking scenario:
[ 2106.335656]
[ 2106.341548]        CPU0                    CPU1
[ 2106.346053]        ----                    ----
[ 2106.350559]   lock(&mm->mmap_sem);
[ 2106.353939]                                lock(&dev->mfc_mutex);
[ 2106.353939]                                lock(&dev->mfc_mutex);
[ 2106.365897]   lock(&dev->mfc_mutex);
[ 2106.369450]
[ 2106.369450]  *** DEADLOCK ***
[ 2106.369450]
[ 2106.375344] 1 lock held by qtdemux0:sink/2614:
[ 2106.379762]  #0:  (&mm->mmap_sem){++++}, at: [<c01df2e4>] vm_mmap_pgoff+0x44/0xb8
[ 2106.387214]
[ 2106.387214] stack backtrace:
[ 2106.391550] CPU: 7 PID: 2614 Comm: qtdemux0:sink Not tainted 4.14.0-rc2-00002-gfab205f-dirty #4
[ 2106.400213] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 2106.406285] [<c01102c8>] (unwind_backtrace) from [<c010cabc>] (show_stack+0x10/0x14)
[ 2106.413995] [<c010cabc>] (show_stack) from [<c08543a4>] (dump_stack+0x98/0xc4)
[ 2106.421187] [<c08543a4>] (dump_stack) from [<c016b2fc>] (print_circular_bug+0x254/0x410)
[ 2106.429245] [<c016b2fc>] (print_circular_bug) from [<c016c580>] (check_prev_add+0x468/0x938)
[ 2106.437651] [<c016c580>] (check_prev_add) from [<c016f4dc>] (__lock_acquire+0x1314/0x14fc)
[ 2106.445883] [<c016f4dc>] (__lock_acquire) from [<c016fefc>] (lock_acquire+0x6c/0x88)
[ 2106.453596] [<c016fefc>] (lock_acquire) from [<c0869fb4>] (__mutex_lock+0x68/0xa34)
[ 2106.461221] [<c0869fb4>] (__mutex_lock) from [<c086aa08>] (mutex_lock_interruptible_nested+0x1c/0x24)
[ 2106.470425] [<c086aa08>] (mutex_lock_interruptible_nested) from [<bf175544>] (s5p_mfc_mmap+0x28/0xd4 [s5p_mfc])
[ 2106.480494] [<bf175544>] (s5p_mfc_mmap [s5p_mfc]) from [<bf037120>] (v4l2_mmap+0x54/0x88 [videodev])
[ 2106.489575] [<bf037120>] (v4l2_mmap [videodev]) from [<c01f4798>] (mmap_region+0x3a8/0x638)
[ 2106.497875] [<c01f4798>] (mmap_region) from [<c01f4d58>] (do_mmap+0x330/0x3a4)
[ 2106.505068] [<c01f4d58>] (do_mmap) from [<c01df330>] (vm_mmap_pgoff+0x90/0xb8)
[ 2106.512260] [<c01df330>] (vm_mmap_pgoff) from [<c01f28cc>] (SyS_mmap_pgoff+0x90/0xc0)
[ 2106.520059] [<c01f28cc>] (SyS_mmap_pgoff) from [<c0108820>] (ret_fast_syscall+0x0/0x28)

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Suggested-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5 years agos5p-mfc: Adjust a null pointer check in four functions
Markus Elfring [Fri, 8 Sep 2017 20:37:00 +0000 (22:37 +0200)]
s5p-mfc: Adjust a null pointer check in four functions

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written...

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agos5p-mfc: Improve a size determination in s5p_mfc_alloc_memdev()
Markus Elfring [Fri, 8 Sep 2017 20:30:09 +0000 (22:30 +0200)]
s5p-mfc: Improve a size determination in s5p_mfc_alloc_memdev()

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agos5p-mfc: Delete an error message for a failed memory allocation
Markus Elfring [Fri, 8 Sep 2017 20:25:17 +0000 (22:25 +0200)]
s5p-mfc: Delete an error message for a failed memory allocation

Omit an extra message for a memory allocation failure in s5p_mfc_probe()
function.  This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoexynos-gsc: Add hardware rotation limits
Hoegeun Kwon [Wed, 13 Sep 2017 11:41:55 +0000 (20:41 +0900)]
exynos-gsc: Add hardware rotation limits

The hardware rotation limits of gsc depends on SOC (Exynos
5250/5420/5433). Distinguish them and add them to the driver data.

[s.nawrocki@samsung.com: corrected num_entities in 5420 variant data]
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoexynos-gsc: Add compatible for Exynos 5250 and 5420 SoC version
Hoegeun Kwon [Wed, 13 Sep 2017 11:41:52 +0000 (20:41 +0900)]
exynos-gsc: Add compatible for Exynos 5250 and 5420 SoC version

Exynos 5250 and 5420 have different hardware rotation limits.
Since we have to distinguish between these two, we add different
compatible: samsung,exynos5250-gsc and samsung,exynos5420-gsc.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: exynos5433: Extend list of available AUD_PLL output frequencies
Sylwester Nawrocki [Mon, 12 Feb 2018 15:52:27 +0000 (16:52 +0100)]
clk: exynos5433: Extend list of available AUD_PLL output frequencies

Add one more entry to the exynos5433_aud_pll_rates table, this allows
to support audio sample rates: 48000, 96000, 192000 Hz with minimum
error. The M, P, S, K values re confirmed by the HW team.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agoclk: exynos5433: Add CLK_IGNORE_UNUSED flag to sclk_ioclk_i2s1_bclk
Sylwester Nawrocki [Mon, 5 Feb 2018 14:22:30 +0000 (15:22 +0100)]
clk: exynos5433: Add CLK_IGNORE_UNUSED flag to sclk_ioclk_i2s1_bclk

The sclk_ioclk_i2s1_bclk clock is not currently handled by any driver
and disabling this clock by the clk core prevents proper operation
of the I2S1 block. CLK_IGNORE_UNUSED flag is added as a temporary fix.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
5 years agoclk: samsung: Remove redundant dev_err call in exynos5433_cmu_probe()
Wei Yongjun [Wed, 17 Jan 2018 11:26:27 +0000 (11:26 +0000)]
clk: samsung: Remove redundant dev_err call in exynos5433_cmu_probe()

There is a error message within devm_ioremap_resource already,
so remove the dev_err call to avoid redundant error message.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Remove obsolete clkdev alias support
Marek Szyprowski [Tue, 3 Oct 2017 10:00:16 +0000 (12:00 +0200)]
clk: samsung: Remove obsolete clkdev alias support

Remove support for obsolete clkdev alias definition in generic helper
macros for MUX, DIV, GATE and PLL clocks. clkdev aliases can be still
created using samsung_clk_register_alias() function if given platform
still needs them. All current drivers have been converted not to use
*_A-style macros and checked if there are any clients for the PLL
clocks, which had aliases created unconditionally.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Add explicit MPLL, EPLL clkdev aliases in S3C2443 driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:15 +0000 (12:00 +0200)]
clk: samsung: Add explicit MPLL, EPLL clkdev aliases in S3C2443 driver

S3C2443 platform still use non-dt based lookup in some of its drivers
to get MPLL and EPLL clocks. Till now it worked only because PLL()
macro implicitly created aliases for all instantiated clocks. This
feature will be removed, so explicitly create aliases for MPLL and
EPLL clocks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Rework clkdev alias handling in S3C2443 driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:14 +0000 (12:00 +0200)]
clk: samsung: Rework clkdev alias handling in S3C2443 driver

S3C2443 SoC still uses old, non-dt CPUfreq driver, which requires clkdev
aliases to get access to proper clocks. Create those aliases using
samsung_clk_register_alias() function instead of using *_A clock macros,
which will be removed soon.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Rework clkdev alias handling in Exynos5440 driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:13 +0000 (12:00 +0200)]
clk: samsung: Rework clkdev alias handling in Exynos5440 driver

Exynos5440 still uses old, non-dt CPUfreq driver, which requires clkdev
aliases to get access to proper clocks. Create those aliases using
samsung_clk_register_alias() function instead of using *_A clock macros,
which will be removed soon.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Drop useless alias in Exynos5420 clk driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:12 +0000 (12:00 +0200)]
clk: samsung: Drop useless alias in Exynos5420 clk driver

Drop clkdev alias for "mout_aclk400_mscl" clock. It was not used at all
and it was probably committed by accident.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Remove clkdev alias support in Exynos5250 clk driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:11 +0000 (12:00 +0200)]
clk: samsung: Remove clkdev alias support in Exynos5250 clk driver

All Exynos5250 boards have been fully converted to device-tree and use
generic dt-based CPUfreq driver, so there is no need to create any clkdev
aliases for the clocks. Drop all the code related to aliases handling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Remove double assignment of CLK_ARM_CLK in Exynos4 driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:10 +0000 (12:00 +0200)]
clk: samsung: Remove double assignment of CLK_ARM_CLK in Exynos4 driver

CLK_ARM_CLK ("armclk") clock is provided by cpu-clk subdriver, which is
instantiated after creating all divider clocks from exynos4_div_clks
array. There is no point assigning this id to "div_core2" clock and later
overwrite with proper "armcpu" clock by cpu-clk subdriver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Remove clkdev alias support in Exynos4 clk driver
Marek Szyprowski [Tue, 3 Oct 2017 10:00:09 +0000 (12:00 +0200)]
clk: samsung: Remove clkdev alias support in Exynos4 clk driver

All Exynos4 boards have been fully converted to device-tree and use generic
dt-based CPUfreq driver, so there is no need to create any clkdev aliases
for the clocks. Drop all the code related to aliases handling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Remove support for obsolete Exynos4212 CPU clock
Marek Szyprowski [Tue, 3 Oct 2017 10:00:08 +0000 (12:00 +0200)]
clk: samsung: Remove support for obsolete Exynos4212 CPU clock

Support for Exynos 4212 SoC has been removed by commit bca9085e0ae9 ("ARM:
dts: exynos: remove Exynos4212 support (dead code)"), so there is no need
to keep dead code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Remove support for Exynos4212 SoCs in Exynos CLKOUT driver
Marek Szyprowski [Wed, 4 Oct 2017 06:38:26 +0000 (08:38 +0200)]
clk: samsung: Remove support for Exynos4212 SoCs in Exynos CLKOUT driver

Support for Exynos4212 SoCs has been removed by commit bca9085e0ae9 ("ARM:
dts: exynos: remove Exynos4212 support (dead code)"), so there is no need
to keep remaining dead code related to this SoC version.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Properly propagate flags in __PLL macro
Marek Szyprowski [Thu, 14 Sep 2017 14:38:17 +0000 (16:38 +0200)]
clk: samsung: Properly propagate flags in __PLL macro

All users of __PLL macro already provide flags parameter, so don't
overwrite it unconditionally with CLK_GET_RATE_NOCACHE.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Fix m2m scaler clock on Exynos542x
Andrzej Pietrasiewicz [Fri, 29 Sep 2017 07:32:53 +0000 (09:32 +0200)]
clk: samsung: Fix m2m scaler clock on Exynos542x

The TOP "aclk400_mscl" clock should be kept enabled all the time
to allow proper access to power management control for MSC power
domain and devices that are a part of it. This change is required
for the scaler to work properly after domain power on/off sequence.

Fixes: 318fa46cc60d ("clk/samsung: exynos542x: mark some clocks as critical")
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Delete a memory allocation error message in clk-cpu.c
Markus Elfring [Wed, 27 Sep 2017 13:46:53 +0000 (15:46 +0200)]
clk: samsung: Delete a memory allocation error message in clk-cpu.c

Omit an extra message for a memory allocation failure
in exynos_register_cpu_clock() function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: use atomic runtime pm api in clk_core_is_enabled
Dong Aisheng [Fri, 22 Dec 2017 09:46:04 +0000 (17:46 +0800)]
clk: use atomic runtime pm api in clk_core_is_enabled

Current clk_pm_runtime_put is using pm_runtime_put_sync which
is not safe to be called in clk_core_is_enabled as it should
be able to run in atomic context.

Thus use pm_runtime_put instead which is atomic safe.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
5 years agoclk: Manage proper runtime PM state in clk_change_rate()
Marek Szyprowski [Thu, 30 Nov 2017 12:14:51 +0000 (13:14 +0100)]
clk: Manage proper runtime PM state in clk_change_rate()

clk_change_rate() propagates rate change down to all its children. Such
operation requires managing proper runtime PM state of each child, what
was missing. Add needed calls to clk_pm_runtime*() to ensure that
set_rate() clock callback is called on runtime active clock.

This fixes following issue found on Exynos5433 TM2 board with devfreq
enabled:

Synchronous External Abort: synchronous external abort (0x96000210) at 0xffffff80093f5600
Internal error: : 96000210 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 5 Comm: kworker/u16:0 Not tainted 4.15.0-rc1-next-20171129+ #4
Hardware name: Samsung TM2 board (DT)
Workqueue: devfreq_wq devfreq_monitor
task: ffffffc0ca96b600 task.stack: ffffff80093a8000
pstate: a0000085 (NzCv daIf -PAN -UAO)
pc : clk_divider_set_rate+0x54/0x118
lr : clk_divider_set_rate+0x44/0x118
...
Process kworker/u16:0 (pid: 5, stack limit = 0xffffff80093a8000)
Call trace:
 clk_divider_set_rate+0x54/0x118
 clk_change_rate+0xfc/0x4e0
 clk_change_rate+0x1f0/0x4e0
 clk_change_rate+0x1f0/0x4e0
 clk_change_rate+0x1f0/0x4e0
 clk_core_set_rate_nolock+0x138/0x148
 clk_set_rate+0x28/0x50
 exynos_bus_passive_target+0x6c/0x11c
 update_devfreq_passive+0x58/0xb4
 devfreq_passive_notifier_call+0x50/0x5c
 notifier_call_chain+0x4c/0x88
 __srcu_notifier_call_chain+0x54/0x80
 srcu_notifier_call_chain+0x14/0x1c
 update_devfreq+0x100/0x1b4
 devfreq_monitor+0x2c/0x88
 process_one_work+0x148/0x3d8
 worker_thread+0x13c/0x3f8
 kthread+0x100/0x12c
 ret_from_fork+0x10/0x18

Reported-by: Chanwoo Choi <cw00.choi@samsung.com>
Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
5 years agoclk: samsung: Add a separate driver for Exynos4412 ISP clocks
Marek Szyprowski [Wed, 11 Oct 2017 09:25:13 +0000 (11:25 +0200)]
clk: samsung: Add a separate driver for Exynos4412 ISP clocks

Some registers for the Exynos 4412 ISP (Camera subsystem) clocks are
located in the ISP power domain. Because those registers are also
located in a different memory region than the main clock controller,
support for them can be provided by a separate clock controller.
This in turn allows to almost seamlessly make it aware of the power
domain using recently introduced runtime PM support for clocks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Add dt bindings for Exynos4412 ISP clock controller
Marek Szyprowski [Wed, 11 Oct 2017 09:25:12 +0000 (11:25 +0200)]
clk: samsung: Add dt bindings for Exynos4412 ISP clock controller

Some registers for the Exynos 4412 ISP (Camera subsystem) clocks are
located in the ISP power domain. Because those registers are also
located in a different memory region than the main clock controller,
support for them can be provided by a separate clock controller.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: Instantiate Exynos4412 ISP clocks only when available
Marek Szyprowski [Wed, 11 Oct 2017 09:25:11 +0000 (11:25 +0200)]
clk: samsung: Instantiate Exynos4412 ISP clocks only when available

Some registers for the Exynos 4412 ISP (Camera subsystem) clocks are
located in the ISP power domain. Instantiate those clocks only when
provided clock registers resource covers those registers. This is
a preparation for adding a separate clock driver for ISP clocks,
which will be integrated with power domain using runtime PM feature.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: exynos5433: mark PM functions as __maybe_unused
Arnd Bergmann [Tue, 10 Oct 2017 09:15:12 +0000 (11:15 +0200)]
clk: samsung: exynos5433: mark PM functions as __maybe_unused

The suspend/resume functions are referenced conditionally, causing
a harmless warning when CONFIG_PM is disabled:

drivers/clk/samsung/clk-exynos5433.c:5476:12: error: 'exynos5433_cmu_resume' defined but not used [-Werror=unused-function]
drivers/clk/samsung/clk-exynos5433.c:5453:12: error: 'exynos5433_cmu_suspend' defined but not used [-Werror=unused-function]

This marks both as __maybe_unused to shut up the warning.

Fixes: 523d3de41f02 ("clk: samsung: exynos5433: Add support for runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoclk: samsung: exynos-audss: Add support for runtime PM
Marek Szyprowski [Mon, 21 Aug 2017 08:05:03 +0000 (10:05 +0200)]
clk: samsung: exynos-audss: Add support for runtime PM

This patch adds support for runtime PM to Exynos Audio SubSystem driver to
enable full support for audio power domain on Exynos5 SoCs. The main change
is moving register saving and restoring code from system sleep PM ops to
runtime PM ops and implementing system sleep PM ops with generic
pm_runtime_force_suspend/resume helpers. Runtime PM of the Exynos AudSS
device is managed from clock core depending on the preparation status
of the provided clocks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1503302703-13801-6-git-send-email-m.szyprowski@samsung.com

5 years agoclk: samsung: exynos-audss: Use local variable for controller's device
Marek Szyprowski [Mon, 21 Aug 2017 08:05:02 +0000 (10:05 +0200)]
clk: samsung: exynos-audss: Use local variable for controller's device

Store pointer to the controller's device in local variable to avoid
extracting it from platform device in each call. This will also simplify
code in the future, when runtime PM support is added.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1503302703-13801-5-git-send-email-m.szyprowski@samsung.com

5 years agoclk: samsung: exynos5433: Add support for runtime PM
Marek Szyprowski [Mon, 21 Aug 2017 08:05:01 +0000 (10:05 +0200)]
clk: samsung: exynos5433: Add support for runtime PM

Add runtime pm support for all clock controller units (CMU), which belong
to power domains and require special handling during on/off operations.
Typically special values has to be written to MUX registers to change
internal clocks parents to OSC clock before turning power off. During such
operation all clocks, which enter CMU has to be enabled to let MUX to
stabilize. Also for each CMU there is one special parent clock, which has
to be enabled all the time when any access to CMU registers is being done.

This patch solves most of the mysterious external abort and freeze issues
caused by a lack of proper parent CMU clock enabled or incorrect turn off
procedure.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1503302703-13801-4-git-send-email-m.szyprowski@samsung.com

5 years agoclk: samsung: Add support for runtime PM
Marek Szyprowski [Mon, 21 Aug 2017 08:05:00 +0000 (10:05 +0200)]
clk: samsung: Add support for runtime PM

This patch adds struct device pointer to samsung_clk_provider and forwarding it
to clk_register_* functions, so drivers can register clocks, which use runtime
pm feature.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1503302703-13801-3-git-send-email-m.szyprowski@samsung.com

5 years agoclk: Add support for runtime PM
Marek Szyprowski [Mon, 21 Aug 2017 08:04:59 +0000 (10:04 +0200)]
clk: Add support for runtime PM

Registers for some clocks might be located in the SOC area, which are under the
power domain. To enable access to those registers respective domain has to be
turned on. Additionally, registers for such clocks will usually loose its
contents when power domain is turned off, so additional saving and restoring of
them might be needed in the clock controller driver.

This patch adds basic infrastructure in the clocks core to allow implementing
driver for such clocks under power domains. Clock provider can supply a
struct device pointer, which is the used by clock core for tracking and managing
clock's controller runtime pm state. Each clk_prepare() operation
will first call pm_runtime_get_sync() on the supplied device, while
clk_unprepare() will do pm_runtime_put_sync() at the end.

Additional calls to pm_runtime_get/put functions are required to ensure that any
register access (like calculating/changing clock rates and unpreparing/disabling
unused clocks on boot) will be done with clock controller in runtime resumend
state.

When one wants to register clock controller, which make use of this feature, he
has to:
1. Provide a struct device to the core when registering the provider.
2. Ensure to enable runtime PM for that device before registering clocks.
3. Make sure that the runtime PM status of the controller device reflects
   the HW state.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/1503302703-13801-2-git-send-email-m.szyprowski@samsung.com

5 years agodt-bindings: samsung: Document binding for new Odroid HC1 board
Krzysztof Kozlowski [Sun, 8 Oct 2017 12:26:28 +0000 (14:26 +0200)]
dt-bindings: samsung: Document binding for new Odroid HC1 board

Document the binding for new Hardkernel Odroid HC1 board.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add HDMI and Sil9234 to Trats2 board
Maciej Purski [Mon, 9 Oct 2017 07:39:38 +0000 (09:39 +0200)]
ARM: dts: exynos: Add HDMI and Sil9234 to Trats2 board

Add HDMI and Sil9234 MHL converter to Trats2 board.
Following in SoC devices have been enabled:
- HDMI (HDMI signal encoder),
- Mixer (video buffer scanout device),
- I2C_5 bus (used for HDMI DDC)
- I2C_8 bus (used for HDMI_PHY control).

Based on previous work by:
Tomasz Stanislawski <t.stanislaws@samsung.com>

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agosoc: samsung: Remove Exynos4212 related dead code
Marek Szyprowski [Wed, 4 Oct 2017 06:38:23 +0000 (08:38 +0200)]
soc: samsung: Remove Exynos4212 related dead code

Support for Exynos4212 SoCs has been removed by commit bca9085e0ae9 ("ARM:
dts: exynos: remove Exynos4212 support (dead code)"), so there is no need
to keep remaining dead code related to this SoC version.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: EXYNOS: Remove Exynos4212 related dead code
Marek Szyprowski [Wed, 4 Oct 2017 06:38:22 +0000 (08:38 +0200)]
ARM: EXYNOS: Remove Exynos4212 related dead code

Support for Exynos4212 SoCs has been removed by commit bca9085e0ae9 ("ARM:
dts: exynos: remove Exynos4212 support (dead code)"), so there is no need
to keep remaining dead code related to this SoC version.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: SAMSUNG: Simplify size used for kzalloc
Markus Elfring [Wed, 4 Oct 2017 07:52:33 +0000 (09:52 +0200)]
ARM: SAMSUNG: Simplify size used for kzalloc

Simplify the size argument of kzalloc() memory allocation by using
sizeof(*ptr) syntax in adc.c and devs.c.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
[krzk: Rewrite commit message]
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: SAMSUNG: Remove printk for failed memory allocation
Markus Elfring [Wed, 4 Oct 2017 07:33:52 +0000 (09:33 +0200)]
ARM: SAMSUNG: Remove printk for failed memory allocation

Omit an extra message for a memory allocation failure in adc.c and
platformdata.c.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: multi_v7_defconfig: Enable UAS support for Odroid HC1 board
Marek Szyprowski [Tue, 3 Oct 2017 10:13:32 +0000 (12:13 +0200)]
ARM: multi_v7_defconfig: Enable UAS support for Odroid HC1 board

Odroid HC1 board has built-in JMicron USB to SATA bridge, which supports
UAS protocol. Enable support for it to make sure that all built-in storage
devices are available. Enable it as module to keep in line with multi_v7
policy to enable drivers as build-in only if they are critical for boot
process. On Odroid HC1 the kernel itself has to be still read from the
SD-card, so assume that modules/initrd is also accessible there.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add support for Hardkernel's Odroid HC1 board
Marek Szyprowski [Mon, 2 Oct 2017 06:39:34 +0000 (08:39 +0200)]
ARM: dts: exynos: Add support for Hardkernel's Odroid HC1 board

Odroid HC1 board is based on Odroid XU4 board, but it has no HDMI,
no eMMC, no built-in USB3.0 hub, no extension port pins, and no GPIO
button. USB3.0 ports are used for built-in JMicron USB to SATA bridge
and Gigabit R8152 ethernet chips. HC1 uses only passive cooling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: multi_v7_defconfig: Enable USB3503 driver
Linus Lüssing [Thu, 28 Sep 2017 20:27:03 +0000 (22:27 +0200)]
ARM: multi_v7_defconfig: Enable USB3503 driver

The Odroid U3 (Exynos 4412 based) for instance needs this driver,
otherwise its USB hub will not come up.

Also selecting it as built-in to allow booting from USB without
an initrd/initramfs.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Move audio clocks configuration to odroidxu3-audio.dtsi
Marek Szyprowski [Fri, 29 Sep 2017 12:33:25 +0000 (14:33 +0200)]
ARM: dts: exynos: Move audio clocks configuration to odroidxu3-audio.dtsi

Audio subsystem clocks configuration is a part of audio block,
so there it should be moved to exynos5422-odroidxu3-audio.dtsi
to avoid it on Odroid XU4, which has no audio codec.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add dwc3 SUSPHY quirk
Andrzej Pietrasiewicz [Mon, 18 Sep 2017 10:02:13 +0000 (12:02 +0200)]
ARM: dts: exynos: Add dwc3 SUSPHY quirk

Odroid XU4 board does not enumerate SuperSpeed devices.
This patch makes exynos5 series chips use USB SUSPHY quirk,
which solves the problem.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add status property to Exynos 542x Mixer nodes
Marek Szyprowski [Fri, 15 Sep 2017 09:11:23 +0000 (11:11 +0200)]
ARM: dts: exynos: Add status property to Exynos 542x Mixer nodes

HDMI support requires some additional off-SoC logic, so Mixer device (part
of HDMI display path) should be disabled by default in SoC dtsi and enabled
then in each board dts. This patch unifies Mixer handling with other
Exynos SoCs.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Add status property to Exynos 5250 HDMI and Mixer nodes
Marek Szyprowski [Fri, 15 Sep 2017 09:11:22 +0000 (11:11 +0200)]
ARM: dts: exynos: Add status property to Exynos 5250 HDMI and Mixer nodes

HDMI support requires some additional off-SoC logic, so HDMI and Mixer
devices should be disabled by default in SoC dtsi and enabled then
in each board dts. This patch unifies HDMI and Mixer handling with other
Exynos SoCs.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Cleanup HDMI DCC definitions on Exynos5250 and Exynos542x boards
Marek Szyprowski [Fri, 15 Sep 2017 09:11:21 +0000 (11:11 +0200)]
ARM: dts: exynos: Cleanup HDMI DCC definitions on Exynos5250 and Exynos542x boards

Commit 2b7681326dc2 ("drm/exynos: hdmi: remove the i2c drivers and use")
merged to v3.15 kernel added a required 'ddc' property to Exynos HDMI
device tree bindings, which should point to i2c bus used for handling DDC
(mainly reading display's EDID information). It has been enough time to
convert all boards to use new bindings, but sadly due to copy/paste design
the old approach using separate node with 'samsung,exynos4210-hdmiddc'
compatible was used also for many new boards. This patch finally converts
all boards to the new approach and unifies HDMI DDC definition across all
Exynos boards.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Move HDMI PHY node from boards to exynos5250.dtsi
Marek Szyprowski [Fri, 15 Sep 2017 09:11:20 +0000 (11:11 +0200)]
ARM: dts: exynos: Move HDMI PHY node from boards to exynos5250.dtsi

All Exynos 5250 SoCs have HDMI PHY connected via dedicated I2C bus (bus
number 8), so HDMI PHY should be defined in exynos5250.dtsi instead of
duplicating it in every board, which enables HDMI support.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
5 years agoARM: dts: exynos: Use specific compatibles for proper Gscaler limits on Exynos5250...
Hoegeun Kwon [Wed, 13 Sep 2017 11:41:53 +0000 (20:41 +0900)]
ARM: dts: exynos: Use specific compatibles for proper Gscaler limits on Exynos5250 and Exynos5420

Exynos 5250 and 5420 have different hardware rotation limits. However,
currently it uses only one compatible - "exynos5-gsc". Since we have
to distinguish between these two, we add different compatible.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>