platform/kernel/linux-exynos.git
5 years agoclk: samsung: add 933MHz clock to bpll
Inki Dae [Fri, 23 Nov 2018 08:29:31 +0000 (17:29 +0900)]
clk: samsung: add 933MHz clock to bpll

Change-Id: I9951d067e530e6bd9393cfe1fc7789be7ed06488
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoARM: configs: tizen_odroid_defconfig: disable rotator IPP device
Marek Szyprowski [Mon, 26 Nov 2018 15:09:11 +0000 (16:09 +0100)]
ARM: configs: tizen_odroid_defconfig: disable rotator IPP device

Disable rotator IPP device, because it confuses ipptest tool.

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

5 years agoARM: dts: exynos: Move some assigned-clock* properties to i2s0 node
Sylwester Nawrocki [Tue, 27 Nov 2018 16:44:24 +0000 (17:44 +0100)]
ARM: dts: exynos: Move some assigned-clock* properties to i2s0 node

Setting of an IP block clock parent clock should be in the IP's DT node,
this ensures respective driver sees correct parent clock right from the
beginning, i.e. right after registering clock provider in probe() callback.

Without this change wrong I2S function clock (op_clk) is being used by
the driver in runtime suspend/resume ops, i.e. i2s_bus is enabled/disabled
twice instead of having activated both i2s_bus and sclk_i2s when required.

Change-Id: I1b52e20ff3596dae7b09d6a65d8ac6da7b76fe7d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoASoC: samsung: i2s: Fix rclk_srcrate handling
Sylwester Nawrocki [Fri, 9 Mar 2018 17:48:55 +0000 (18:48 +0100)]
ASoC: samsung: i2s: Fix rclk_srcrate handling

As the RCLK clock may be updated through the common clk API before each
snd_soc_dai_ops::trigger call, it is not enough to update i2s->rclk_srcrate
only once after it has been initially set to 0. To avoid wrong PSR values
we always get RCLK frequency from the CLK_I2S_RCLK_SRC clock, when that
clock is available.

Fixes: e1417fdf3011 "ASoC: samsung: i2s: Ensure the RCLK rate is properly determined"
Change-Id: I81065cf4e7da3c159a1f91bb0df626cdc0356c23
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoarm: dts: exynos4: opp-suspend in DMC and leftbus
Lukasz Luba [Mon, 19 Nov 2018 13:46:07 +0000 (14:46 +0100)]
arm: dts: exynos4: opp-suspend in DMC and leftbus

Mark the state for devfreq device while entring suspend/resume process.

The patch is based on earlier work by Tobias Jakobi.

Change-Id: I2b82fcb2a405abd15bea1e480bca1a1328bd6ff9
Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
5 years agodrivers: power: suspend: call devfreq suspend/resume
Lukasz Luba [Fri, 16 Nov 2018 12:36:53 +0000 (13:36 +0100)]
drivers: power: suspend: call devfreq suspend/resume

Devfreq framework supports suspend of its devices.
Call the the devfreq interface and allow devfreq devices preserve/restore
their states during suspend/resume.

The patch is based on earlier work by Tobias Jakobi.

Change-Id: I1aa62a13466120ef6f88edec2637888d77edc981
Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
5 years agodevfreq: add devfreq_suspend/resume() functions
Lukasz Luba [Fri, 16 Nov 2018 12:33:53 +0000 (13:33 +0100)]
devfreq: add devfreq_suspend/resume() functions

This patch adds implementation for global suspend/resume for
devfreq framework. System suspend will next use these functions.

The patch is based on earlier work by Tobias Jakobi.

Change-Id: Id48187e492eb11f532512ecdda736309bc094af4
Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
5 years agodevfreq: add support for suspend/resume of a devfreq device
Lukasz Luba [Thu, 15 Nov 2018 14:26:10 +0000 (15:26 +0100)]
devfreq: add support for suspend/resume of a devfreq device

The patch prepares devfreq device for handling suspend/resume
functionality.  The new fields will store needed information during this
process.  Devfreq framework handles opp-suspend DT entry and there is no
need of modyfications in the drivers code.  It uses atomic variables to
make sure no race condition affects the process.

The patch is based on earlier work by Tobias Jakobi.

Change-Id: I55187da468966b11b27f7d90e1e59471fb602422
Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
5 years agodevfreq: refactor set_target frequency function
Lukasz Luba [Thu, 15 Nov 2018 15:12:43 +0000 (16:12 +0100)]
devfreq: refactor set_target frequency function

The refactoring is needed for the new client in devfreq: suspend.
To avoid code duplication, move it to the new local function
devfreq_set_target.

The patch is based on earlier work by Tobias Jakobi.

Change-Id: I8515ba9cde9b957b47684ff36296bfeab54f76f6
Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
5 years agoARM64: dts: exynos: Add clocks and pins needed for bluetooth chip
Marek Szyprowski [Mon, 26 Nov 2018 14:24:52 +0000 (15:24 +0100)]
ARM64: dts: exynos: Add clocks and pins needed for bluetooth chip

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

5 years agomfd: exynos-lpass: Enable UART module support
Beomho Seo [Thu, 26 Feb 2015 08:54:50 +0000 (17:54 +0900)]
mfd: exynos-lpass: Enable UART module support

This patch enables support for UART module in AUD subsystem. There are
boards (for example TM2), which use it for communication with bluetooth
chip.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
[mszyprow: rephrased commit message, added UART reset]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I4f189b64baca4865d119d7e931c1ce608a5908bd

5 years agotty: serial: samsung: Increase maximum baudrate
Seung-Woo Kim [Thu, 15 May 2014 03:35:50 +0000 (12:35 +0900)]
tty: serial: samsung: Increase maximum baudrate

This driver can be used to communicate with bluetooth chip in high-speed
UART mode, so increase maximum baudrate to 3Mbps.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[mszyprow: rephrased commit message]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ifd046553dfd9f4f469f58ded785844631c1ef08e

5 years agoARM: dts: exynos: change vpll clock to 600MHz
Inki Dae [Fri, 23 Nov 2018 07:18:36 +0000 (16:18 +0900)]
ARM: dts: exynos: change vpll clock to 600MHz

This change enhances MALI inference(on-device deep leanring) performance.

Change-Id: I2a9341589873a049bd91ee6771c96d831768df3c
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoclk: samsung: add vpll pms tables
Inki Dae [Fri, 23 Nov 2018 07:06:33 +0000 (16:06 +0900)]
clk: samsung: add vpll pms tables

This patch adds pms tables to generate various clock frequencies.
In default, VPLL generates 400MHz but it's not enough for MALI GPU
device so it allows to change vpll clock frequency through device tree.

Change-Id: Iae8c55d03a4efc40ecc7966c4591572f27e4a81a
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoRevert "ARM: dts: exynos: set g3d parent clock to dpll"
Inki Dae [Fri, 23 Nov 2018 07:15:39 +0000 (16:15 +0900)]
Revert "ARM: dts: exynos: set g3d parent clock to dpll"

We don't need to change parent clock of mali gpu device.
Instead, we can change vpll clock frequency through device tree,
and it's a better way because vpll is dedicated to gpu device
in default.

This reverts commit d78913aca3abe06124e71b63f7171f83c666d85a.

Change-Id: Ib4770fba8df4a55d04ca8587af0458c9d3f8882c
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoARM: dts: exynos: set g3d parent clock to dpll
Inki Dae [Fri, 23 Nov 2018 01:37:11 +0000 (10:37 +0900)]
ARM: dts: exynos: set g3d parent clock to dpll

 MALI GPU device uses VPLL as its parent clock which generates
 400MHz clock so it's not enough for MALI GPU device.
 This patch changes g3d parent clock to dpll which generates
 600MHz.

Change-Id: I42f0a8c13ec8eec8e91f73ba210e3c0cbcb596d0
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoclk: samsung: exynos542x: add clock ID for G3D performance enhancement
Inki Dae [Fri, 23 Nov 2018 01:29:01 +0000 (10:29 +0900)]
clk: samsung: exynos542x: add clock ID for G3D performance enhancement

This patch adds clock IDs for CLKMUX_ACLK_G3D and DPLL_CTRL,
and these IDs will be used by device tree to change G3D's parent
clock to DPLL(600MHz) instead of VPLL(400MHz).

Change-Id: Ia2c11331d42a73e095fd4c9deb64e9fb162c511d
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agoARM: dts: exynos5420: add mali dt bindings
Inki Dae [Mon, 19 Nov 2018 01:52:54 +0000 (10:52 +0900)]
ARM: dts: exynos5420: add mali dt bindings

Change-Id: I850b32a6be2be6ada5344e26e4af636360e9cfbc
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agopackaging: packaging: Add spec file for TM2 and Odroid-XU3/4
Inki Dae [Mon, 19 Nov 2018 08:12:47 +0000 (17:12 +0900)]
packaging: packaging: Add spec file for TM2 and Odroid-XU3/4

Change-Id: Iefcde80b71ac44f5c3aff8206a61175e524b4e12
Signed-off-by: Inki Dae <inki.dae@samsung.com>
5 years agodrm/bridge/sii8620: fix HDMI cable connection to dongle
Maciej Purski [Tue, 23 Jan 2018 11:13:16 +0000 (12:13 +0100)]
drm/bridge/sii8620: fix HDMI cable connection to dongle

MHL bridge is usually connected to TV via MHL dongle. Currently plugging
HDMI cable to dongle is handled improperly.

Fix it by splitting connecting of a dongle and a HDMI cable. The driver
should now handle unplugging a sink from a dongle and plugging a
different sink with new edid.

Tested on MHL1, MHL2 and MHL3 using various vendors' dongles both in
DVI and 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/1516705996-8928-1-git-send-email-m.purski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I74dcc6ff2cec4c926ad3107a99d6987aabeebf09

5 years agodrm/bridge/sii8620: remove HSIC initialization
Maciej Purski [Wed, 29 Nov 2017 15:12:47 +0000 (16:12 +0100)]
drm/bridge/sii8620: remove HSIC initialization

HSIC initialization was taken from the vendor code. HSIC in MHL circuit
is not connected, so it is not possible to test it. Tests prove that
without HSIC the device works well. Therefore it can be removed.

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/1511968368-30884-1-git-send-email-m.purski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I619d5eabbc04fa4d9134378cabd529682c9d114a

5 years agodrm/bridge/sii8620: start MHL transmission after HDMI signal detection
Maciej Purski [Wed, 29 Nov 2017 11:48:50 +0000 (12:48 +0100)]
drm/bridge/sii8620: start MHL transmission after HDMI signal detection

The vendor code waits for infoframe to detect video mode set by source.
We do not need to follow this pattern, because video mode information is
provided by drm core. As a result most of the infoframe handling
code can be removed.

Start transmission immediately after detecting stream on HDMI lines
in irq_scdt() function without waiting for infoframe interrupt.

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/1511956130-24482-1-git-send-email-m.purski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I4c437ae8340f0a896429c752a2e9c5a210a6f6f8

5 years agodrm/bridge/sii8620: fix display modes validation
Maciej Purski [Fri, 2 Feb 2018 10:54:25 +0000 (11:54 +0100)]
drm/bridge/sii8620: fix display modes validation

Current implementation of mode_valid() and mode_fixup() callbacks
handle packed pixel modes improperly.

Fix it by using proper maximum clock values from the documentation.

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/1517568865-25219-1-git-send-email-m.purski@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ia6782c6302a1d75e3970fba420a0fed2a13a6530

5 years agodrm/bridge/sii8620: simplify hardware reset procedure
Andrzej Hajda [Fri, 8 Jun 2018 06:04:57 +0000 (08:04 +0200)]
drm/bridge/sii8620: simplify hardware reset procedure

There is no need to flip reset pin twice. Also delays can be changed to
values present in vendor's code.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Maciej Purski <m.purski@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180608060457.18357-1-a.hajda@samsung.com
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib7710bedc9f5dbdd448262d44f83c2c80c208ac5

5 years agodrm/exynos: scaler: Fix support for YUV420, YUV422 and YUV444 modes
Marek Szyprowski [Tue, 29 May 2018 08:18:47 +0000 (10:18 +0200)]
drm/exynos: scaler: Fix support for YUV420, YUV422 and YUV444 modes

Fix Cb/CR components order in two-planar YUV420, YUV422 and YUV444 modes.

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

5 years agodrm/exynos: gsc: Increase Exynos5433 buffer width alignment to 16 pixels
Marek Szyprowski [Mon, 28 May 2018 12:34:39 +0000 (14:34 +0200)]
drm/exynos: gsc: Increase Exynos5433 buffer width alignment to 16 pixels

Investigation revealed that GScaler hardware requires the real buffer width
(pitch) to be aligned to 16 pixels.

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

5 years agodrm/exynos: gsc: Use real buffer width for configuring the hardware
Marek Szyprowski [Mon, 28 May 2018 12:10:14 +0000 (14:10 +0200)]
drm/exynos: gsc: Use real buffer width for configuring the hardware

DMA hardware should respect buffer pitch, so use the width calculated from
the buffer pitch instead of the virtual one.

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

5 years agodrm/exynos: ipp: Rework checking for the correct buffer formats
Marek Szyprowski [Mon, 28 May 2018 12:03:20 +0000 (14:03 +0200)]
drm/exynos: ipp: Rework checking for the correct buffer formats

Prepare a common function for size and scale checks and call it for
source and destination buffers. Then also move there the state-less checks
from exynos_drm_ipp_task_setup_buffer, so the format information is already
available in limits processing. Finally perform the IPP_LIMIT_BUFFER check
on the real width of the buffer (the width calculated from the provided
buffer pitch).

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

5 years agodrm/exynos: rotator: Fix DRM_MODE_REFLECT_{X,Y} interpretation
Marek Szyprowski [Fri, 25 May 2018 11:02:55 +0000 (13:02 +0200)]
drm/exynos: rotator: Fix DRM_MODE_REFLECT_{X,Y} interpretation

Horizontal (DRM_MODE_REFLECT_Y) and vertical (DMR_MODE_REFLECT_Y) flip
were swapped in Rotator driver. Fix this by swapping code for interpreting
them.

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

5 years agodrm/exynos: gsc: Fix DRM_MODE_REFLECT_{X,Y} interpretation
Marek Szyprowski [Fri, 25 May 2018 11:02:26 +0000 (13:02 +0200)]
drm/exynos: gsc: Fix DRM_MODE_REFLECT_{X,Y} interpretation

Horizontal (DRM_MODE_REFLECT_Y) and vertical (DMR_MODE_REFLECT_Y) flip
were swapped in GScaler driver. Fix this by swapping code for interpreting
them.

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

5 years agodrm/exynos: scaler: Reset hardware before starting the operation
Andrzej Pietrasiewicz [Mon, 5 Feb 2018 15:41:54 +0000 (16:41 +0100)]
drm/exynos: scaler: Reset hardware before starting the operation

Ensure that Scaler hardware is properly reset and interrupts are cleared
before processing next image.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I036118b95bdf37e1c6dd133606746f2d6fce4758

5 years agodrm/exynos: decon: Add support for hardware windows no 4 and 5
Marek Szyprowski [Wed, 23 May 2018 09:21:19 +0000 (11:21 +0200)]
drm/exynos: decon: Add support for hardware windows no 4 and 5

Enable support for 2 more hardware windows. This require enabling a few
more clocks and set proper plane type for all windows. In the new
configuration primary plane uses hardware window no 3 and cursor uses
window no 5. The remaining hardware windows are used for overlays. This
gives us an overlay plane both below and above primary plane for both
Decon and DeconTV (which uses hardware window nr 0 for background).

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

5 years agodrm/exynos: Fix default value for zpos plane property
Marek Szyprowski [Wed, 23 May 2018 09:14:53 +0000 (11:14 +0200)]
drm/exynos: Fix default value for zpos plane property

The default zpos property for all planes in Exynos DRM was fixed as zero.
Fix this by providing proper value provided by hardware drivers, which
typically matches hardware window number.

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

5 years agoarm64: dts: exynos: Add more clocks to Exynos5433 Decon and DeconTV
Marek Szyprowski [Wed, 23 May 2018 09:12:27 +0000 (11:12 +0200)]
arm64: dts: exynos: Add more clocks to Exynos5433 Decon and DeconTV

Add all '1x' clocks to decon and decontv devices. Enabling those clocks
is needed to get proper display on hardware windows no 4 and 5.

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

5 years agoarm64: dts: exynos: Remove duplicated entries from exynos5433-tm2e.dts
Sylwester Nawrocki [Thu, 26 Apr 2018 12:03:25 +0000 (14:03 +0200)]
arm64: dts: exynos: Remove duplicated entries from exynos5433-tm2e.dts

There are already proper dts entries in exynos5433-tm2-common.dtsi
which can be reused also for TM2e.

Change-Id: I269bef96efa8dc68f9ca9d59e07a9bd862a9d46a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: dts: exynos: Fix ldo25_reg regulator name for tm2e
Sylwester Nawrocki [Thu, 26 Apr 2018 12:00:30 +0000 (14:00 +0200)]
arm64: dts: exynos: Fix ldo25_reg regulator name for tm2e

The S2MPS13 LDO25 regulator is needed for camera sensor on TM2e
boards, without this change both cameras fail on TM2e.
The fimc-is driver handles regulators in a non-standard way and
it expects specific regulator device name.

Change-Id: Ie8b0200fac333fa1c1851549de834051144b926a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agospi: spi-s3c64xx: Decrease autosuspend timeout for FIMC-IS
Sylwester Nawrocki [Thu, 19 Apr 2018 13:37:52 +0000 (15:37 +0200)]
spi: spi-s3c64xx: Decrease autosuspend timeout for FIMC-IS

This a workaround to avoid errors in SPI transfer when camera devices
are closed and shortly after re-opened.

Change-Id: I239463f6eefe56a644ec63c42daedb455cf91202
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove dubious spin_(un)lock_irq() use
Sylwester Nawrocki [Thu, 19 Apr 2018 12:09:33 +0000 (14:09 +0200)]
fimc-is: Remove dubious spin_(un)lock_irq() use

There should not be a need to use spin_lock_irq/spin_unlock_irq
in those critical sections. spin_unlock_irq() enables interrupts
unconditionally which can be harmful.

Change-Id: I29df4e56475a56a94762bb1585a6ba3d55c45259
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Suppress warning generated in fimc_is_group_buffer_finish()
Sylwester Nawrocki [Thu, 19 Apr 2018 12:04:41 +0000 (14:04 +0200)]
fimc-is: Suppress warning generated in fimc_is_group_buffer_finish()

Due to videobuf2 queue cancel call fimc_is_group_buffer_finish() function
may be called with invalid group->id. Just return EINVAL instead of WARN_ON()
when group->id has GROUP_ID_INVALID value so as to avoid unneeded stack dumps
in kernel log while closing video device nodes.

Change-Id: I3c5d6fec997ceaf5ae28e2537cfbca9405040bb0
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Release all buffers in sensor video node stop_streaming() callback
Sylwester Nawrocki [Fri, 20 Apr 2018 10:32:08 +0000 (12:32 +0200)]
fimc-is: Release all buffers in sensor video node stop_streaming() callback

Any buffer owned by a driver should be released in videobuf2 stop_streaming()
callback. This change allows to avoid warnings from videobuf2 when closing
video device nodes.

Change-Id: Ib7f8b0b8fffe50f387827929829e3e87c0f1bf38
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Release all buffers in fimc_is_queue_stop_streaming()
Sylwester Nawrocki [Thu, 19 Apr 2018 11:58:43 +0000 (13:58 +0200)]
fimc-is: Release all buffers in fimc_is_queue_stop_streaming()

Any buffer owned by the driver should be released in videobuf2 stop_streaming()
callback. This change allows to avoid warnings from videobuf2 when closing
video device nodes.

Change-Id: Idd2f3157ab5c0326c39e8d9160514ad6102301b6
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: configs: tizen_tm2_defconfig update camera driver
Sylwester Nawrocki [Thu, 29 Mar 2018 09:16:59 +0000 (11:16 +0200)]
arm64: configs: tizen_tm2_defconfig update camera driver

Enable camera driver.

Change-Id: I17644b593b9bd59b1055309633900240c2a30e50
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Convert bool to unsigned int to fix bool-operation
Seung-Woo Kim [Thu, 22 Mar 2018 06:36:31 +0000 (15:36 +0900)]
fimc-is: Convert bool to unsigned int to fix bool-operation

Convert bool to unsigned in to fix bool-operation warnings with gcc7.

Change-Id: I04147f628198204e2b1ecc3b3f04a63a61f62c7b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: SPI related functions clean up
Sylwester Nawrocki [Thu, 12 Apr 2018 15:17:25 +0000 (17:17 +0200)]
fimc-is: SPI related functions clean up

Replace explicit memset() calls with initialization to 0 at declaration time.

Change-Id: I56068b22577494c59d85e94af439234f56ed1fdd
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix cs_change flags in SPI transfers
Sylwester Nawrocki [Thu, 12 Apr 2018 15:10:10 +0000 (17:10 +0200)]
fimc-is: Fix cs_change flags in SPI transfers

The cs_change flags need to be adjusted so SPI communications works
properly with the spi-s3c64xx driver.

Change-Id: I73ae345670e9ac79d8b8b576dc25078ece6167e7
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove redundant "fimc_is_spi1" driver
Sylwester Nawrocki [Mon, 9 Apr 2018 16:35:51 +0000 (18:35 +0200)]
fimc-is: Remove redundant "fimc_is_spi1" driver

Change-Id: I0e372c47298d4869e0d5041a968e8ef84429d1da
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove unused SPI driver code
Sylwester Nawrocki [Fri, 6 Apr 2018 10:02:31 +0000 (12:02 +0200)]
fimc-is: Remove unused SPI driver code

This patch removes empty/unused SPI related functions and unneeded
devinit/devexit attribute definitions.

Change-Id: I98055d7947c15d0c6692d8714469f48ed9aeffb0
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agophy: exynos-mipi-video: Simplify code by using regmap_update_bits()
Sylwester Nawrocki [Fri, 6 Apr 2018 14:27:05 +0000 (16:27 +0200)]
phy: exynos-mipi-video: Simplify code by using regmap_update_bits()

Change-Id: I89144594f128b73a3c0c38ab7fd2536b34ef9768
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix memory leak in clock operations
Sylwester Nawrocki [Thu, 5 Apr 2018 15:04:55 +0000 (17:04 +0200)]
fimc-is: Fix memory leak in clock operations

devm_clk_get() allocates new struct clk which will be freed only during
the driver's deinitialization which actually never happens.

Change-Id: I94c1d42f3c1b053406437b4baf6c81577b53416b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agodts: arm64: exynos5433-tm2: Use only I2C child node for companion device
Sylwester Nawrocki [Thu, 5 Apr 2018 16:08:42 +0000 (18:08 +0200)]
dts: arm64: exynos5433-tm2: Use only I2C child node for companion device

Change-Id: Id75be47aa2d4012e7acd263f9059dfce775ff8c5
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Get rid of companion platform driver
Sylwester Nawrocki [Thu, 5 Apr 2018 15:04:55 +0000 (17:04 +0200)]
fimc-is: Get rid of companion platform driver

Change-Id: I2d9d6c690b867234ec8918747eec88d8593e44f1
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Use struct device * for companion device
Sylwester Nawrocki [Thu, 5 Apr 2018 14:35:44 +0000 (16:35 +0200)]
fimc-is: Use struct device * for companion device

Change-Id: I365f652a10d62b4949561b673de93774fbae77a6
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Use common struct v4l2_device for the companion device
Sylwester Nawrocki [Thu, 5 Apr 2018 14:12:38 +0000 (16:12 +0200)]
fimc-is: Use common struct v4l2_device for the companion device

Change-Id: Ia72b932676281dd972312e89d663ab096b4dbf79
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Use struct device rather than struct platform_device
Sylwester Nawrocki [Thu, 5 Apr 2018 13:46:28 +0000 (15:46 +0200)]
fimc-is: Use struct device rather than struct platform_device

Change-Id: Ief3d4c4356b66e900bd76dc1bdecca02420916ae
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: dts: exynos5433-tm2: Add camera device nodes
Sylwester Nawrocki [Mon, 16 Apr 2018 13:24:55 +0000 (15:24 +0200)]
arm64: dts: exynos5433-tm2: Add camera device nodes

Change-Id: I003c2a2ddeeea63168a4ff382eea783edd808937
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: dts: exynos5433-tm2: Correct s2mps13 LDO23 regulator definition
Sylwester Nawrocki [Mon, 26 Mar 2018 15:58:02 +0000 (17:58 +0200)]
arm64: dts: exynos5433-tm2: Correct s2mps13 LDO23 regulator definition

Change-Id: I276496ef0223be2adc9aafefa86d790485042844
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agoarm64: dts: exynos5433: Add FIMC-IS subsystem nodes
Sylwester Nawrocki [Fri, 23 Mar 2018 16:53:48 +0000 (17:53 +0100)]
arm64: dts: exynos5433: Add FIMC-IS subsystem nodes

Change-Id: I489d4000217c1780cd7caac7469eb93345adb1fb
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Set all buffer queues as bidirectional
Sylwester Nawrocki [Tue, 3 Apr 2018 13:34:36 +0000 (15:34 +0200)]
fimc-is: Set all buffer queues as bidirectional

This prevent SYSMMU fault from FIMC-IS CPU access:

[   42.220252] exynos-sysmmu 142d0000.sysmmu: 14180000.fimc_is: AW ACCESS PROTECTION FAULT occurred at 0x7ff98af0
[   42.220634] ------------[ cut here ]------------
[   42.222578] kernel BUG at drivers/iommu/exynos-iommu.c:449!
[   42.228136] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[   42.233602] Modules linked in:
[   42.236641] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W       4.14.24+ #154
[   42.244105] Hardware name: Samsung TM2 board (DT)
[   42.248790] task: ffffff800905eb80 task.stack: ffffff8009040000
[   42.254699] PC is at exynos_sysmmu_irq+0x17c/0x188
[   42.259468] LR is at exynos_sysmmu_irq+0x108/0x188
[   42.264241] pc : [<ffffff80084d68b4>] lr : [<ffffff80084d6840>] pstate: 600001c5
[   42.271620] sp : ffffff8008003e00
[   42.274915] x29: ffffff8008003e00 x28: ffffff8009031010
[   42.280211] x27: ffffff8009043db0 x26: ffffff8009031000
[   42.285506] x25: ffffff800913c000 x24: 000000007ff98af0
[   42.290800] x23: ffffffc0c9c4a918 x22: 0000000000000064
[   42.296095] x21: ffffffc0c9c4a958 x20: 0000000000000013
[   42.301390] x19: ffffff8008ad87c8 x18: 0000000000000010
[   42.306685] x17: 0000000000000000 x16: fffffffffffffffe
[   42.311980] x15: ffffff8089180f9f x14: 0720072007200720
[   42.317275] x13: 0720072007200720 x12: 0720072007200720
[   42.322569] x11: 0720072007200720 x10: 0720072007200720
[   42.327864] x9 : 0720072007200720 x8 : 0720072007200720
[   42.333159] x7 : 0720072007200720 x6 : 00000000000003cb
[   42.338454] x5 : 0000000000000000 x4 : 0000000000000000
[   42.343748] x3 : 0000000000000001 x2 : 000000007ff98af0
[   42.349044] x1 : ffffff8009140c80 x0 : 00000000ffffffda
[   42.354340] Process swapper/0 (pid: 0, stack limit = 0xffffff8009040000)
[   42.361024] Call trace:
[   42.363451] Exception stack(0xffffff8008003cc0 to 0xffffff8008003e00)
[   42.369879] 3cc0: 00000000ffffffda ffffff8009140c80 000000007ff98af0 0000000000000001
[   42.377692] 3ce0: 0000000000000000 0000000000000000 00000000000003cb 0720072007200720
[   42.385504] 3d00: 0720072007200720 0720072007200720 0720072007200720 0720072007200720
[   42.393317] 3d20: 0720072007200720 0720072007200720 0720072007200720 ffffff8089180f9f
[   42.401128] 3d40: fffffffffffffffe 0000000000000000 0000000000000010 ffffff8008ad87c8
[   42.408940] 3d60: 0000000000000013 ffffffc0c9c4a958 0000000000000064 ffffffc0c9c4a918
[   42.416753] 3d80: 000000007ff98af0 ffffff800913c000 ffffff8009031000 ffffff8009043db0
[   42.424564] 3da0: ffffff8009031010 ffffff8008003e00 ffffff80084d6840 ffffff8008003e00
[   42.432376] 3dc0: ffffff80084d68b4 00000000600001c5 ffffff8008ad87c8 0000000000000013
[   42.440189] 3de0: 0000007fffffffff 0000000000000064 ffffff8008003e00 ffffff80084d68b4
[   42.448001] [<ffffff80084d68b4>] exynos_sysmmu_irq+0x17c/0x188
[   42.453817] [<ffffff80080f4b14>] __handle_irq_event_percpu+0x64/0x280
[   42.460238] [<ffffff80080f4d4c>] handle_irq_event_percpu+0x1c/0x58
[   42.466400] [<ffffff80080f4dd0>] handle_irq_event+0x48/0x78
[   42.471956] [<ffffff80080f8a34>] handle_fasteoi_irq+0xbc/0x1b0
[   42.477772] [<ffffff80080f3bac>] generic_handle_irq+0x24/0x38
[   42.483499] [<ffffff80080f426c>] __handle_domain_irq+0x84/0xf8
[   42.489315] [<ffffff80080817c8>] gic_handle_irq+0x68/0xc8
[   42.494695] Exception stack(0xffffff8009043db0 to 0xffffff8009043ef0)
[   42.501119] 3da0:                                   0000000000000000 ffffff8008e3c628
[   42.508934] 3dc0: ffffff8009031010 0000000000000001 00000040d657b000 0000000000005dc0
[   42.516746] 3de0: 0000000000000008 0000000000000000 0000000000000002 ffffff8009043e70
[   42.524558] 3e00: 0000000000000980 000000000011fa88 0000000000000000 0000000000000001
[   42.532370] 3e20: 0000000000000000 ffffff8089180f9f fffffffffffffffe 0000000000000000
[   42.540183] 3e40: 0000000000000010 ffffff800913c000 ffffff800913ce78 0000000000000000
[   42.547993] 3e60: ffffff8008e1ee50 0000000000000000 0000000000000000 ffffff800905eb80
[   42.555806] 3e80: 00000000df6e4808 0000000000000000 0000000020f80018 ffffff8009043ef0
[   42.563618] 3ea0: ffffff8008085de0 ffffff8009043ef0 ffffff8008085de4 0000000060000145
[   42.571430] 3ec0: ffffff800903b048 ffffff8008e1ee50 ffffffffffffffff ffffff8009052000
[   42.579241] 3ee0: ffffff8009043ef0 ffffff8008085de4
[   42.584100] [<ffffff8008083130>] el1_irq+0xb0/0x124
[   42.588962] [<ffffff8008085de4>] arch_cpu_idle+0x34/0x1c8
[   42.594344] [<ffffff80080e2b1c>] do_idle+0x114/0x1e0
[   42.599289] [<ffffff80080e2d84>] cpu_startup_entry+0x24/0x28
[   42.604935] [<ffffff8008a390c8>] rest_init+0xc8/0xd8
[   42.609883] [<ffffff8008f80b94>] start_kernel+0x39c/0x3b0
[   42.615264] Code: 2a1803e4 9401e0bc f94032e0 b5fffbe0 (d4210000)
[   42.621339] ---[ end trace f42ebbac31eb0484 ]---

Change-Id: I2467a1646a6c6cdcb6898fd4911cb64f9f0d658e
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Drop code for old kernel versions
Sylwester Nawrocki [Thu, 29 Mar 2018 13:57:30 +0000 (15:57 +0200)]
fimc-is: Drop code for old kernel versions

Change-Id: If303fd1f7546df825b6c9399791d1044ec92630a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc: Add missing memory allocator initialization for companion video node
Sylwester Nawrocki [Thu, 29 Mar 2018 13:56:06 +0000 (15:56 +0200)]
fimc: Add missing memory allocator initialization for companion video node

Change-Id: Ib8b910a54d024609a1c8e4dc675b2d61976531c0
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Enable build
Marek Szyprowski [Thu, 6 Aug 2015 13:39:42 +0000 (15:39 +0200)]
fimc-is: Enable build

Change-Id: I58682e769f517bb32d9a1a65b024a548ce20884a
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Remove unused Kconfig entry
Sylwester Nawrocki [Thu, 29 Mar 2018 10:35:50 +0000 (12:35 +0200)]
fimc-is: Remove unused Kconfig entry

CONFIG_OIS_FW_UPDATE_THREAD_USE is not used anywhere in the driver code.

Change-Id: I548a1793ccd9605fec24556cfbd1be36d5856827
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Enable required components in Kconfig by default
Sylwester Nawrocki [Tue, 27 Mar 2018 12:43:34 +0000 (14:43 +0200)]
fimc-is: Enable required components in Kconfig by default

Change-Id: Ia2d71205a997e551724ada9009aaf88dd9500669
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Adapt to latest changes DMA-mapping/IOMMU frameworks
Marek Szyprowski [Thu, 6 Aug 2015 08:03:46 +0000 (10:03 +0200)]
fimc-is: Adapt to latest changes DMA-mapping/IOMMU frameworks

This patch is a temporary workaround.

31-bit DMA mask is used to prevent overlapping with the Cortex-A5
reserved range. FIMC-IS CPU uses 0xe0000000-0xffffffff address
range for mapping peripheral devices, so those addresses must not
be used for memory buffers.

Change-Id: I74599b8037644bf7582043ac17a098d49b11193c
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Remove redundant memory allocation error log
Sylwester Nawrocki [Fri, 23 Mar 2018 17:14:09 +0000 (18:14 +0100)]
fimc-is: Remove redundant memory allocation error log

kzalloc() generates stack trace on errors.

Change-Id: I73a530a18a20e7e6d9aa73daec3e89357b1c1570
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Adaptation to kthread API changes
Sylwester Nawrocki [Wed, 21 Mar 2018 16:53:04 +0000 (17:53 +0100)]
fimc-is: Adaptation to kthread API changes

Change-Id: I0ef434f7c5a9a18348feaa391bb6a601d107e028
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Use ktime_get_ts() instead of do_posix_clock_monotonic_gettime
Sylwester Nawrocki [Wed, 21 Mar 2018 16:25:43 +0000 (17:25 +0100)]
fimc-is: Use ktime_get_ts() instead of do_posix_clock_monotonic_gettime

do_posix_clock_monotonic_gettime() is not available any more in kernel v4.14.

Change-Id: Ib9a5a1d1069e6ad7d593f8eddc0801f418163a16
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Adaptation to V4L2 API changes
Sylwester Nawrocki [Wed, 21 Mar 2018 16:24:35 +0000 (17:24 +0100)]
fimc-is: Adaptation to V4L2 API changes

Change-Id: Ia944801f9bd161bb4381b679a0d0b6920bb3d35d
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove BUG() from fimc_is_itf_s_param()
Sylwester Nawrocki [Mon, 21 Aug 2017 16:19:50 +0000 (18:19 +0200)]
fimc-is: Remove BUG() from fimc_is_itf_s_param()

The condition being tested for that BUG() invocation is often
recoverable, so replace BUG() with a WARN_ON() and return EINVAL.
This prevents specific user space call sequences crashing the kernel,
which should never happen.
The callers of fimc_is_itf_s_param() function will be updated in
subsequent patches if necessary, to prevent any further possible
crashes.

Change-Id: I90a08278baa0cee85a4a69fa1b278e28e5c6764a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: change metadata header as uapi header
Seung-Woo Kim [Thu, 22 Jun 2017 09:41:20 +0000 (18:41 +0900)]
fimc-is: change metadata header as uapi header

The header fimc-is-metadata.h is required from user, so it should
be a uapi header. So this patch moves the header to uapi header.

Change-Id: I5618889c806d4463da0bf0ea947bf5d1b667d5e3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agofimc-is: Rename "is fail" to "failed"
Sylwester Nawrocki [Thu, 3 Mar 2016 15:27:59 +0000 (16:27 +0100)]
fimc-is: Rename "is fail" to "failed"

Change-Id: Ifd587dd48cf28d91250814499b881198cc039229
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Add proper implementation of fimc_is_ischain_forcedown()
Sylwester Nawrocki [Fri, 11 Mar 2016 15:08:37 +0000 (16:08 +0100)]
fimc-is: Add proper implementation of fimc_is_ischain_forcedown()

Change-Id: I1f9314050dd9ca52623dd1770ccef3fa8b3755d6
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: MCUCTL register definition cleanup
Sylwester Nawrocki [Thu, 10 Mar 2016 16:46:47 +0000 (17:46 +0100)]
fimc-is: MCUCTL register definition cleanup

Lots of (mostly unused) postfix-indexed macro definitions
are now replaced with parametric definitions.

Change-Id: I86280b01681dfd25915ba7001af2e69c84369032
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove unused data structure declaration
Sylwester Nawrocki [Thu, 10 Mar 2016 16:24:27 +0000 (17:24 +0100)]
fimc-is: Remove unused data structure declaration

Change-Id: I8ba9ae47aab00f4dfad1724a92e4659cca91588b
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Clear all MCUCTL register in the power up sequence
Sylwester Nawrocki [Thu, 10 Mar 2016 16:43:00 +0000 (17:43 +0100)]
fimc-is: Clear all MCUCTL register in the power up sequence

When the ISP, CAM{0,1} power domains are always on it is required
to clear MCUCTL registers in the ISP power up sequence, otherwise
the front camera is not working properly if previously the rear
camera pipeline was used. The original code relied on the MCUCTL
registers being reset to default values after the ISP power domain
switch off/on cycle.

Change-Id: I685603ab968e5eb3871dd0ed3a25a4eb694bdc75
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Reconfigure more muxes to oscclk in the power off sequence
Sylwester Nawrocki [Fri, 4 Mar 2016 16:56:32 +0000 (17:56 +0100)]
fimc-is: Reconfigure more muxes to oscclk in the power off sequence

We don't switch off CAM1, CAM0, ISP power domain so reconfigure
more muxes to their default after reset state duriong power off
sequence.

Change-Id: I85161973d654268acd741f36210f5d8aee8c1ec9
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Workaround for ACLK_CAM1_552_USER configuration issues
Sylwester Nawrocki [Mon, 29 Feb 2016 15:03:26 +0000 (16:03 +0100)]
fimc-is: Workaround for ACLK_CAM1_552_USER configuration issues

For some reason "mout_aclk_cam1_552_user" clock reconfiguration from
"oscclk" to "aclk_cam1_552" breaks the front camera operation (often
only empty buffer are dequeued). But it is required for the rear
camera. Until the root cause is found reconfigure the mux conditionally
only for the rear sensor operation.

Change-Id: If121971afa4007efc778bde452ff95e75f20dced
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix compiler warning
Sylwester Nawrocki [Thu, 3 Mar 2016 15:30:54 +0000 (16:30 +0100)]
fimc-is: Fix compiler warning

n file included from drivers/media/platform/exynos/fimc-is/fimc-is-companion-dt.c:23:0:
drivers/media/platform/exynos/fimc-is/fimc-is-dt.h:36:58: warning: 'struct fimc_is_core' declared inside parameter list
 int fimc_is_parse_children_dt(struct device *dev, struct fimc_is_core *core);
                                                          ^
drivers/media/platform/exynos/fimc-is/fimc-is-dt.h:36:58: warning: its scope is only this definition or declaration, which is probably not what you want

Change-Id: I8848007ce5de95574699a735c19bad195f0bd3cb
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Add setting of vendorSpecific2[0] metadata structure field
Sylwester Nawrocki [Fri, 26 Feb 2016 16:33:50 +0000 (17:33 +0100)]
fimc-is: Add setting of vendorSpecific2[0] metadata structure field

vendorSpecific2[0] value pattern depends on the fimc-is firmware
revision. Move setting up of this field to the kernel as there is
all information required for this.
The driver will update the field accordingly only if user space
leaves it cleared.

Change-Id: Ib77d7be7081a2239a19912757392522d044d58f9
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Workaround for CLK_MOUT_ACLK_CAM1_552_USER clock
Sylwester Nawrocki [Fri, 26 Feb 2016 16:02:46 +0000 (17:02 +0100)]
fimc-is: Workaround for CLK_MOUT_ACLK_CAM1_552_USER clock

When CLK_MOUT_ACLK_CAM1_552_USER clock is properly defined
in clk-exynos5433.c re-parenting commented out in this patch
causes that only empty buffers can be dequeued from the scaler
for front camera. So re-parenting is disabled for now until
we can address this issue in a better way.

Change-Id: I6198a5f8945638ec0002a071d8f4865920790d00
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Eliminate some BUG_ON() from fimc_is_group_buffer_finish()
Sylwester Nawrocki [Fri, 6 Nov 2015 13:33:22 +0000 (14:33 +0100)]
fimc-is: Eliminate some BUG_ON() from fimc_is_group_buffer_finish()

This prevents kernel panic caused by wrong sequences in user space.

Change-Id: I1470675c0a2a2bcecb526dbef0f93772c5da9cb4
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix code issues pointed by CPPTest tool
Marek Szyprowski [Tue, 24 Nov 2015 09:33:57 +0000 (10:33 +0100)]
fimc-is: Fix code issues pointed by CPPTest tool

Change-Id: I2d717c6eca79bc213e98448666cc0f88995bb00e
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Fix possible memory leak found by static analysis
Marek Szyprowski [Mon, 23 Nov 2015 12:55:49 +0000 (13:55 +0100)]
fimc-is: Fix possible memory leak found by static analysis

This patch fixes all issues pointed by Klocwork static analysis tool.

Change-Id: Ie0d80a2bbd514c6dac0959784623d380ea580b19
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: 6d1: add sentinel element to id table
Seung-Woo Kim [Tue, 1 Sep 2015 08:21:01 +0000 (17:21 +0900)]
fimc-is: 6d1: add sentinel element to id table

This patch adds sentinel element to id table to fix following out
of bounds access:
    ==================================================================
    BUG: KASan: out of bounds access in i2c_device_match+0xcc/0xf0 at addr ffffffc00120ee80
    Read of size 1 by task swapper/0/1
    page:ffffffbdc0848380 count:1 mapcount:0 mapping:          (null) index:0x0
    flags: 0x400(reserved)
    page dumped because: kasan: bad access detected
    Address belongs to variable sensor_6d1_idt+0x20/0x40
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3
    Hardware name: Samsung TM2 board (DT)
    Call trace:
    [<ffffffc00008bc58>] dump_backtrace+0x0/0x1d8
    [<ffffffc00008be40>] show_stack+0x10/0x20
    [<ffffffc000eee3a4>] dump_stack+0x80/0xd4
    [<ffffffc00021e4f0>] kasan_report_error+0x3e0/0x408
    [<ffffffc00021e9ec>] kasan_report+0x44/0x50
    [<ffffffc00021d8f0>] __asan_load1+0x78/0x80
    [<ffffffc000916b78>] i2c_device_match+0xc8/0xf0
    [<ffffffc0006d9d54>] __driver_attach+0x3c/0xd0
    [<ffffffc0006d6fac>] bus_for_each_dev+0xd4/0x138
    [<ffffffc0006d932c>] driver_attach+0x2c/0x40
    [<ffffffc0006d8dfc>] bus_add_driver+0x214/0x2e8
    [<ffffffc0006dab40>] driver_register+0xb0/0x1c0
    [<ffffffc000917fc0>] i2c_register_driver+0x48/0xc8
    [<ffffffc001795344>] sensor_6d1_load+0x18/0x24
    [<ffffffc000082ae4>] do_one_initcall+0xec/0x240
    [<ffffffc001755e50>] kernel_init_freeable+0x288/0x330
    [<ffffffc000eeab1c>] kernel_init+0xc/0xf0
    Memory state around the buggy address:
     ffffffc00120ed80: 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fa fa
     ffffffc00120ee00: fa fa fa fa 00 00 06 fa fa fa fa fa 00 00 00 00
    >ffffffc00120ee80: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
                       ^
     ffffffc00120ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc00120ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================

Change-Id: I9db130c66d2aa884b946e946581e5dc08f8a20ca
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agofimc-is: Fix wrong index access for dt child nodes
Seung-Woo Kim [Tue, 1 Sep 2015 07:59:03 +0000 (16:59 +0900)]
fimc-is: Fix wrong index access for dt child nodes

This patch fixes wrong index access for dt child nodes. This fixes
following use after free:
    ==================================================================
    BUG: KASan: use after free in fimc_is_parse_children_dt+0x6c/0xe8 at addr ffffffc08d27ffa8
    Write of size 8 by task swapper/0/1
    page:ffffffbdc2b49fc0 count:0 mapcount:0 mapping:          (null) index:0x0
    flags: 0x0()
    page dumped because: kasan: bad access detected
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.1.0-00839-gb91c2a6-dirty #3
    Hardware name: Samsung TM2 board (DT)
    Call trace:
    [<ffffffc00008bc58>] dump_backtrace+0x0/0x1d8
    [<ffffffc00008be40>] show_stack+0x10/0x20
    [<ffffffc000eee3a4>] dump_stack+0x80/0xd4
    [<ffffffc00021e510>] kasan_report_error+0x400/0x408
    [<ffffffc00021e9ec>] kasan_report+0x44/0x50
    [<ffffffc00021d38c>] __asan_store8+0x94/0xb0
    [<ffffffc000991900>] fimc_is_parse_children_dt+0x68/0xe8
    [<ffffffc000959368>] fimc_is_probe+0xc0/0xed8
    [<ffffffc0006dc724>] platform_drv_probe+0x64/0xf8
    [<ffffffc0006d9ae8>] driver_probe_device+0x1f0/0x3a8
    [<ffffffc0006d9de0>] __driver_attach+0xc8/0xd0
    [<ffffffc0006d6fac>] bus_for_each_dev+0xd4/0x138
    [<ffffffc0006d932c>] driver_attach+0x2c/0x40
    [<ffffffc0006d8dfc>] bus_add_driver+0x214/0x2e8
    [<ffffffc0006dab40>] driver_register+0xb0/0x1c0
    [<ffffffc0006dc618>] __platform_driver_register+0xa8/0xb8
    [<ffffffc0017952c0>] fimc_is_driver_init+0x18/0x24
    [<ffffffc000082ae4>] do_one_initcall+0xec/0x240
    [<ffffffc001755e50>] kernel_init_freeable+0x288/0x330
    [<ffffffc000eeab1c>] kernel_init+0xc/0xf0
    Memory state around the buggy address:
     ffffffc08d27fe80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
     ffffffc08d27ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    >ffffffc08d27ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                      ^
     ffffffc08d280000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
     ffffffc08d280080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    ==================================================================

Change-Id: Id2794dfbb02c5fac923f0df15618609fe5387503
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
5 years agofimc-is: Set allow_zero_bytesused flag on videbuf2 queues
Marek Szyprowski [Wed, 12 Aug 2015 08:29:23 +0000 (10:29 +0200)]
fimc-is: Set allow_zero_bytesused flag on videbuf2 queues

Change-Id: Ib477ca52c34de66b22e7583696ebd2a250917677
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Get rid of struct v4l2_subdev_core_ops::init use
Sylwester Nawrocki [Thu, 30 Jul 2015 04:21:48 +0000 (13:21 +0900)]
fimc-is: Get rid of struct v4l2_subdev_core_ops::init use

The init() is too limited to be used in this driver, it is deprecated
and usage of this callback should be removed anyway.
There is no device nodes for subdevs so ioctl is no exposed to user space.

Change-Id: I7ff42e1a7843826cba8cb9e652616b8c10a8c932
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix/add vidioc_querycap for several video nodes
Sylwester Nawrocki [Thu, 30 Jul 2015 01:55:38 +0000 (10:55 +0900)]
fimc-is: Fix/add vidioc_querycap for several video nodes

This allows us to get rid of a warning from v4l2-core.

Change-Id: I30fae593f0dcdd314d5c2cd18f02528b78e7807c
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fail device open when called from udev
Marek Szyprowski [Thu, 13 Aug 2015 12:52:20 +0000 (14:52 +0200)]
fimc-is: Fail device open when called from udev

This workaround avoids driver state change on system boot when udev checks
all video nodes.

Change-Id: I13f16b109251010f138f97943ab180c5003cf6b9
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Workaround to ensure proper video open sequence
Sylwester Nawrocki [Tue, 28 Jul 2015 05:06:58 +0000 (14:06 +0900)]
fimc-is: Workaround to ensure proper video open sequence

This a workaround to prevent system crash when video nodes are opened
in random sequence during system booting.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
fimc-is: hack video node open to require companion to be opened

Change-Id: I3b7f929c087acb32169fd6a26cee6eeb7e225497
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Add memory barriers in place of vb2_ion_sync_for_device() calls
Sylwester Nawrocki [Mon, 27 Jul 2015 01:17:35 +0000 (10:17 +0900)]
fimc-is: Add memory barriers in place of vb2_ion_sync_for_device() calls

Change-Id: If208bd4f9f7ef2b2c488b004d552891e57577e25
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Do not skip enabling enabled regulators
Marek Szyprowski [Thu, 6 Aug 2015 08:09:24 +0000 (10:09 +0200)]
fimc-is: Do not skip enabling enabled regulators

Regulators have proper on/off refcount, so use it instead of strange
is_enabled() based logic.

Change-Id: I6e23a5a6c3576d50581cb887f57a51897cdd86eb
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: temporary hack to ensure proper structure size
Marek Szyprowski [Thu, 23 Jul 2015 07:33:18 +0000 (09:33 +0200)]
fimc-is: temporary hack to ensure proper structure size

Change-Id: Ib87a85508a6be13ace45fcd800df867ad87115fc
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: temporary workaround for more strict vb2 buffer state tracking
Marek Szyprowski [Fri, 7 Aug 2015 08:42:08 +0000 (10:42 +0200)]
fimc-is: temporary workaround for more strict vb2 buffer state tracking

Change-Id: I72897d4cbf6cf0b6bd349fe5f99ebc45b8c461f9
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
5 years agofimc-is: Correct error logs in fimc-is-groupmgr.c
Sylwester Nawrocki [Mon, 20 Jul 2015 01:53:30 +0000 (10:53 +0900)]
fimc-is: Correct error logs in fimc-is-groupmgr.c

Change-Id: I386a2b86fb6637617e02b9467020e196aaf31a15
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix printk format in wq_func_general() function
Sylwester Nawrocki [Mon, 20 Jul 2015 01:48:56 +0000 (10:48 +0900)]
fimc-is: Fix printk format in wq_func_general() function

Change-Id: Ia3ce3de8328ec5ab57b71bb383d274217a2a800a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove unneeded variable declarations
Sylwester Nawrocki [Mon, 20 Jul 2015 01:46:25 +0000 (10:46 +0900)]
fimc-is: Remove unneeded variable declarations

Change-Id: Ia5392e11cade65529a91fb5d000b879c55e66738
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Use proper type for FIMC-LITE register region pointer
Sylwester Nawrocki [Fri, 17 Jul 2015 05:20:40 +0000 (14:20 +0900)]
fimc-is: Use proper type for FIMC-LITE register region pointer

Aside of dropping the pointless TO_WORD_OFFSET() macro this let's
us avoid errors on a 64-bit system where size of unsigned long is
8 bytes, as opposed to 4 bytes on 32-bit machines.

Change-Id: I572003d0f85a21724411030e322bf6da967a613a
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Fix data type errors in debug printks
Sylwester Nawrocki [Fri, 17 Jul 2015 05:17:48 +0000 (14:17 +0900)]
fimc-is: Fix data type errors in debug printks

Change-Id: I7585c99ab7e8e2582da97e49688bea56ff66593f
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
5 years agofimc-is: Remove unused function declarations from fimc-is-hw.h
Sylwester Nawrocki [Fri, 17 Jul 2015 05:15:33 +0000 (14:15 +0900)]
fimc-is: Remove unused function declarations from fimc-is-hw.h

Change-Id: If173cd69b6e4ac3431740fa1b787b8894a09e5d0
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>