platform/kernel/linux-exynos.git
8 years agodrm/exynos: Properly report supported formats for each device
Marek Szyprowski [Sun, 30 Aug 2015 15:53:57 +0000 (00:53 +0900)]
drm/exynos: Properly report supported formats for each device

Exynos DRM reported that all planes for all supported sub-devices supports
only three pixel formats: XRGB24, ARGB24 and NV12. This patch lets each
Exynos DRM sub-drivers to provide the list of supported pixel formats
and registers this list to DRM core.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[jy0922.shim: backported from original mainline commit]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Change-Id: I7f486b9f2d776a8fdd8cb0c758100eba8de31ef6

8 years agodrm/exynos/hdmi: apply configuration in case of power cycling
Andrzej Hajda [Tue, 26 Jul 2016 09:03:26 +0000 (11:03 +0200)]
drm/exynos/hdmi: apply configuration in case of power cycling

When power is turned off and on, modesetting is not performed,
but HDMI registers should be set.
The patch fixes issues with black screen on Odroid (X)U3 during
console blank/unblank.

Change-Id: I95d9098969793d38986237234b95e11a7027052f
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/mixer: enable HDMI-PHY before configuring MIXER
Andrzej Hajda [Tue, 26 Jul 2016 08:45:55 +0000 (10:45 +0200)]
drm/exynos/mixer: enable HDMI-PHY before configuring MIXER

Mixer similarly to DECON-TV requires enabled clock generated
by HDMI-PHY to proper work.
The patch fixes hang on Odroid (X)U3 during console blank/unblank.

Change-Id: I9fa14fe02e54d2981fa06b43654f9616cd7074a8
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agopackaging: add baselibs.conf
Chan Lee [Thu, 9 Jun 2016 08:05:07 +0000 (17:05 +0900)]
packaging: add baselibs.conf

this config file is for creating bi-arch rpms of armv7l

Change-Id: Ifc9d1e31fbfa8376b0d6bffd8d1700e06d0a1c17
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
8 years agoARM64: tizen_tm2_defconfig: disable rtc-s3c config
Joonyoung Shim [Fri, 22 Jul 2016 06:57:55 +0000 (15:57 +0900)]
ARM64: tizen_tm2_defconfig: disable rtc-s3c config

Currently there is booting issue of tizen 3.0 mobile 32bit platform with
PID1 getting stuck printing "systemd[1]: Time has been changed"
continuously. [1][2]

This problem is related with rtc-s3c and now rtc-s3c is reporting time
values over 2038 years like below:

[    5.124065] s3c-rtc 10590000.rtc: setting system clock to 2140-10-02 10:52:03 UTC (5388461523)

Android MM N910S kernel uses only pmic rtc, not rtc-s3c so i think it's
better to disable rtc-s3c.

[1] https://github.com/systemd/systemd/issues/1143
[2] https://patchwork.ozlabs.org/patch/585661

Change-Id: Idc580c2494aa309607dd835ca39411236f3366e6
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoclk: exynos542x: add IGNORE_UNUSED flag to aclk432_scaler clock
Marek Szyprowski [Mon, 18 Jul 2016 11:53:52 +0000 (13:53 +0200)]
clk: exynos542x: add IGNORE_UNUSED flag to aclk432_scaler clock

This keeping this clock enabled is needed for proper GSCL power domain
on/off sequence, so add this flag to avoid core disabling it on boot.

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

8 years agodts: tm2/tm2e: remove te-gpios property from panel node
Andrzej Hajda [Mon, 4 Jul 2016 06:13:49 +0000 (08:13 +0200)]
dts: tm2/tm2e: remove te-gpios property from panel node

Since DECON uses HW-TRIGGER it does not need TE interrupt. Exynos-DSI driver
will not register this interrupt if the property is not present.

Change-Id: I15097fed7cdcdabf8f825c3b170eb625966fcacc
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/dsi: make te-gpios optional
Andrzej Hajda [Fri, 1 Jul 2016 13:57:41 +0000 (15:57 +0200)]
drm/exynos/dsi: make te-gpios optional

In case of HW-TRIGGER te-gpios interrupt is not necessary. With this
patch we can get rid of 60 interrupt callbacks per second.

Change-Id: Ifbe6b55eefe41e5de63e0be58c7c34054d8e73be
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/decon5433: merge interrupt handlers
Andrzej Hajda [Wed, 6 Jul 2016 06:13:12 +0000 (08:13 +0200)]
drm/exynos/decon5433: merge interrupt handlers

Both interrupt handlers do almost the same things, merging will simplify
the code.

Change-Id: I53fc1fbc0fa4ca00fdb5aa266b959427bd7f1f2a
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/decon5433: handle vblank in vblank interrupt
Andrzej Hajda [Wed, 29 Jun 2016 08:00:02 +0000 (10:00 +0200)]
drm/exynos/decon5433: handle vblank in vblank interrupt

vblank should be signaled to userspace as soon as possible after sending
frame. INTFRMDONEPEND irq looks to be the best moment.
Handling it in TE interrupt looks wrong - TE triggers reading framebuffers
so it is the worst moment, it could result in delayed frame update.
Other benefit of moving vblank handiling to vblank interrupt is possibility
to eliminate TE irq handler in case of HWTRIGGER.

Change-Id: I1f9b1830c3328a935d05fc9d859c9baf4df33533
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agobuild: remove dtb files for ARM64 exynos
Joonyoung Shim [Thu, 7 Jul 2016 01:07:52 +0000 (10:07 +0900)]
build: remove dtb files for ARM64 exynos

Remove existing dtb files before building because old dtb files can be
included in kernel image.

Change-Id: I28847ad01cbf38e458e093c1c912eecc1f066560
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: tizen_odroid_defconfig: enable sync config
Joonyoung Shim [Thu, 7 Jul 2016 05:20:18 +0000 (14:20 +0900)]
ARM: tizen_odroid_defconfig: enable sync config

The android sync config is enabled by request of window part because of
vulkan support.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM64: tizen_tm2_defconfig: enable sync config
Joonyoung Shim [Wed, 29 Jun 2016 02:38:33 +0000 (11:38 +0900)]
ARM64: tizen_tm2_defconfig: enable sync config

The android sync config is enabled by request of window part because of
vulkan support.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: tizen_odroid_defconfig: enable mali400 r5p2_rel0
Joonyoung Shim [Tue, 24 May 2016 02:03:21 +0000 (11:03 +0900)]
ARM: tizen_odroid_defconfig: enable mali400 r5p2_rel0

Enable mali400 r5p2_rel0 instead of r4p0_rel0.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: tizen_odroid_defconfig: enable mali midgard r12p0_04rel0
Joonyoung Shim [Mon, 23 May 2016 08:38:54 +0000 (17:38 +0900)]
ARM: tizen_odroid_defconfig: enable mali midgard r12p0_04rel0

We will use mali midgard r12p0_04rel0 instead of r5p0_06rel0.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM64: tizen_tm2_defconfig: enable mali midgard r12p0_04rel0
Joonyoung Shim [Mon, 23 May 2016 09:02:15 +0000 (18:02 +0900)]
ARM64: tizen_tm2_defconfig: enable mali midgard r12p0_04rel0

We will use mali midgard r12p0_04rel0 instead of r5p0_06rel0.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()
Joonyoung Shim [Thu, 7 Jul 2016 05:02:21 +0000 (14:02 +0900)]
ARM: mali400: r5p2_rel0: use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()

get_unused_fd() was changed to get_unused_fd_flags() by the commit
1a7bd2265fc5 ("make get_unused_fd_flags() a function"), so it causes
build error,

drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_sync.c: In function 'mali_sync_fence_fd_alloc':
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_sync.c:235:2: error: implicit declaration of function 'get_unused_fd' [-Werror=implicit-function-declaration]
  fd = get_unused_fd();
  ^

This patch was refered from the commit 45acea57335e ("android/sw_sync:
use get_unused_fd_flags(O_CLOEXEC) instead of get_unused_fd()")

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: replace CONFIG_PM_RUNTIME to CONFIG_PM
Seung-Woo Kim [Mon, 23 May 2016 08:23:22 +0000 (17:23 +0900)]
ARM: mali400: r5p2_rel0: replace CONFIG_PM_RUNTIME to CONFIG_PM

After commit 464ed18ebdb6 ("PM: Eliminate CONFIG_PM_RUNTIME") which
is applied kernel version 3.19, PM_RUNTIME is eliminated. So this
patch replaces CONFIG_PM_RUNTIME to CONFIG_PM for kernel version
larger than 3.19.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[jy0922.shim: apply to mali400 r5p2_rel0 with some modification]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: fix build error
Joonyoung Shim [Mon, 23 May 2016 06:35:41 +0000 (15:35 +0900)]
ARM: mali400: r5p2_rel0: fix build error

Include pm_runtime.h to fix below build error when CONFIG_PM_RUNTIME is
disabled.

drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.c: In function ‘mali_driver_suspend_scheduler’:
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.c:595:2: error: implicit declaration of function ‘pm_runtime_active’ [-Werror=implicit-function-declaration]
  if (pm_runtime_active(dev))
  ^

Change-Id: Ic613dd9785a9d563e50361328944bd23d33fd70c
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: fix building out of tree
Joonyoung Shim [Tue, 24 May 2016 09:21:06 +0000 (18:21 +0900)]
ARM: mali400: fix building out of tree

s/$(src)/$(srctree)\/$(src)/

$(srctree) has absolute path of kernel root directory, so with this
commit, building problem by relative path will be gone from outside of
kernel tree.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: add GLES mem profiler feature
YoungJun Cho [Tue, 21 Jul 2015 04:19:27 +0000 (13:19 +0900)]
ARM: mali400: r5p2_rel0: add GLES mem profiler feature

This patch adds GLES mem profiler feature.

You could use it by "cat /sys/kernel/debug/mali/gles_mem/<PID>".
Without user-DDK's MALI_IOC_MEM_PROFILE_GLES_MEM, it only show layout.

With this ioctl, you could check current GLES relevant memory status
in opened session and also check memory leakage in trash subdirectory.

The mechanism of detecting memory leakage is checking information when
the session is closed. So the user misses to free (GLES)memory during
session, it(the PID) could be found in trash.

Caution! When app is killed and the session is forcely shut down, then
it(the PID) could be found in trash but we can not guarantee there is a
real memory leakage. That is because like this case, it is impossible
to call MALI_IOC_MEM_PROFILE_GLES_MEM to remove allocated memory.

Change-Id: I78a08f7b53594dc20f8cc6f4c892250fdc9e8208
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
[jy0922.shim: applied to r5p2_rel0 from r5p0_rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: delete proprietary word in Kbuild
YoungJun Cho [Thu, 2 Jul 2015 10:44:49 +0000 (19:44 +0900)]
ARM: mali400: r5p2_rel0: delete proprietary word in Kbuild

This is to guid for non-gpl case, not related with license,
but Tango detects it because it simply compares string.

Change-Id: Iad42e139fd5d040b3242f1e7358720ef24343570
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
[jy0922.shim: applied to r5p2_rel0 from r5p0_rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: fix of_match_table
Joonyoung Shim [Mon, 23 May 2016 10:20:09 +0000 (19:20 +0900)]
ARM: mali400: r5p2_rel0: fix of_match_table

The exynos platform of this kernel has exynos specific of_match_table,
so use mali_of_matches of exynos instead of base_dt_ids of mali.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: fix for exynos
Joonyoung Shim [Mon, 23 May 2016 07:51:52 +0000 (16:51 +0900)]
ARM: mali400: r5p2_rel0: fix for exynos

The exynos platform codes have to be modified a bit to apply
r5p2_rel0. If not, will occurs build errors.

  CC      drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.o
drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.c:190:13: error: conflicting types for ‘mali_platform_power_mode_change’
 extern void mali_platform_power_mode_change(int power_mode);
...
drivers/gpu/arm/mali400/r5p2_rel0/platform/exynos/exynos.c:246:2: error: unknown field ‘utilization_interval’ specified in initializer
  .utilization_interval = 100, /* 100ms in Tizen */
  ^
...
drivers/built-in.o: In function `mali_remove':
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.c:561: undefined reference to `mali_platform_device_deinit'
drivers/built-in.o: In function `mali_probe':
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/linux/mali_kernel_linux.c:515: undefined reference to `mali_platform_device_init'
drivers/built-in.o: In function `mali_hw_core_register_read':
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h:52: undefined reference to `mali_is_on'
drivers/built-in.o: In function `mali_hw_core_register_write':
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h:98: undefined reference to `mali_is_on'
drivers/built-in.o: In function `mali_hw_core_register_read':
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h:52: undefined reference to `mali_is_on'
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h:52: undefined reference to `mali_is_on'
drivers/built-in.o: In function `mali_hw_core_register_write':
/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h:98: undefined reference to `mali_is_on'
drivers/built-in.o:/home/pub/git/spin/linux-exynos/drivers/gpu/arm/mali400/r5p2_rel0/common/mali_hw_core.h:52: more undefined references to `mali_is_on' follow

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: add exynos platform codes
Joonyoung Shim [Mon, 23 May 2016 06:09:33 +0000 (15:09 +0900)]
ARM: mali400: r5p2_rel0: add exynos platform codes

This comes from r4p0_rel0.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: sync codes for TM1 from r5p0_rel0
Joonyoung Shim [Tue, 10 May 2016 07:18:10 +0000 (16:18 +0900)]
ARM: mali400: r5p2_rel0: sync codes for TM1 from r5p0_rel0

Spectrum added some codes on r5p0_rel0 public, so do it on r5p2_rel0.
But except some codes related with below defines

SPRD_MEM_OPT_PAGE_TABLE_SHRINK
MALI_IOC_MEM_INIT
MALI_IOC_MEM_TERM

because we cannot add them by changed codes from r5p2_rel0.

Change-Id: I1423e7ce5181d4f1a08f3fbd01f9d426290eff29
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: fix Makefile & Kconfig
Joonyoung Shim [Tue, 10 May 2016 05:59:10 +0000 (14:59 +0900)]
ARM: mali400: r5p2_rel0: fix Makefile & Kconfig

For building of r5p2_rel0.

Change-Id: I23c3144d886b9cbfe6061650ab16d180eb74e94c
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r5p2_rel0: add public codes from ARM
Joonyoung Shim [Tue, 10 May 2016 05:57:26 +0000 (14:57 +0900)]
ARM: mali400: r5p2_rel0: add public codes from ARM

This comes from DX910-SW-99002-r5p2-00rel0.tgz of ARM web site.

Change-Id: I8d556f4abba5497679068eec6540a1d7716f6ebb
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: mali400: r4p0_rel0: fix to rearrange resources
Joonyoung Shim [Tue, 24 May 2016 04:44:09 +0000 (13:44 +0900)]
ARM: mali400: r4p0_rel0: fix to rearrange resources

Above commit ("ARM: dts: exynos4x12: fix g3d nodes") changes order of
reg resources, so need to fix codes to rearrange resources.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: dts: exynos4x12: fix g3d nodes
Joonyoung Shim [Tue, 24 May 2016 02:57:22 +0000 (11:57 +0900)]
ARM: dts: exynos4x12: fix g3d nodes

This fixes order of reg resources. First has to be resource that has
lowest address because mali400 r5p2 version requires it.

This also adds interrupt-names for g3d nodes. The interrupt-names needs
at mali400 r5p2 version.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM: dts: exynos5422-odroidxu3-common: Add mali regulator supply
Joonyoung Shim [Mon, 23 May 2016 05:39:48 +0000 (14:39 +0900)]
ARM: dts: exynos5422-odroidxu3-common: Add mali regulator supply

mali-supply is used for devfreq voltage supply control.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM64: dts: exynos5433: Add power_nodel node for mali midgard
Sylwester Nawrocki [Fri, 18 Mar 2016 15:21:29 +0000 (16:21 +0100)]
ARM64: dts: exynos5433: Add power_nodel node for mali midgard

Property values taken from example for Mali-T602 from
Documentation/devicetree/bindings/arm/mali-midgard.txt.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
8 years agoARM64: dts: exynos5433-tm2e: Add mali regulator supply
Joonyoung Shim [Fri, 20 May 2016 06:04:40 +0000 (15:04 +0900)]
ARM64: dts: exynos5433-tm2e: Add mali regulator supply

mali-supply is used for devfreq voltage supply control.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoARM64: dts: exynos5433-tm2: Add mali regulator supply
Sylwester Nawrocki [Wed, 16 Mar 2016 18:16:43 +0000 (19:16 +0100)]
ARM64: dts: exynos5433-tm2: Add mali regulator supply

mali-supply is used for devfreq voltage supply control.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to dts of tm2]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoDocumentation: Add devicetree bindings documentation for Mali Midgard
Sylwester Nawrocki [Fri, 18 Mar 2016 15:23:45 +0000 (16:23 +0100)]
Documentation: Add devicetree bindings documentation for Mali Midgard

Extracted from TX011-BU-00001-r10p0-00rel0.tgz downloaded from
malideveloper.arm.com.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: add exynos5422 platform files
Joonyoung Shim [Mon, 23 May 2016 05:37:02 +0000 (14:37 +0900)]
gpu: arm: midgard: r12p0_04rel0: add exynos5422 platform files

This is based on exynos5433 platform files.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: Fix incorrect IS_ERR_OR_NULL() usage
Sylwester Nawrocki [Thu, 17 Mar 2016 16:00:41 +0000 (17:00 +0100)]
gpu: arm: midgard: r12p0_04rel0: Fix incorrect IS_ERR_OR_NULL() usage

The corresponding function return ERR_PTR() values which
should be tested with IS_ERR(), not IS_ERR_OR_NULL() macro.
Especially it is not correct to do:

 if(IS_ERR_OR_NULL(value))
error = PTR_ERR(value);

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0 except r5p0_06rel0 part]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: Add custom simple_ondemand devfreq governor data
Sylwester Nawrocki [Wed, 16 Mar 2016 18:20:58 +0000 (19:20 +0100)]
gpu: arm: midgard: r12p0_04rel0: Add custom simple_ondemand devfreq governor data

Need custom upthreshold and downdifferential for mali devfreq.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0]

8 years agogpu: arm: midgard: r12p0_04rel0: Restore frequency/voltage values on error paths...
Sylwester Nawrocki [Wed, 16 Mar 2016 18:20:16 +0000 (19:20 +0100)]
gpu: arm: midgard: r12p0_04rel0: Restore frequency/voltage values on error paths in kbase_devfreq_target()

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: add regulator enable/disable calls
Sylwester Nawrocki [Thu, 17 Mar 2016 11:02:01 +0000 (12:02 +0100)]
gpu: arm: midgard: r12p0_04rel0: add regulator enable/disable calls

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0 with some modification]

8 years agogpu: arm: midgard: r12p0_04rel0: Workaround for missing last_status field
Sylwester Nawrocki [Wed, 16 Mar 2016 16:58:55 +0000 (17:58 +0100)]
gpu: arm: midgard: r12p0_04rel0: Workaround for missing last_status field

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: Fix 'struct devfreq_cooling_ops' related compilation...
Sylwester Nawrocki [Tue, 15 Mar 2016 15:18:56 +0000 (16:18 +0100)]
gpu: arm: midgard: r12p0_04rel0: Fix 'struct devfreq_cooling_ops' related compilation break

There is no 'struct devfreq_cooling_ops' in current kernel tree
and 'struct devfreq_cooling_power' seems to be an equivalent of it.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: Fix build warning about devfreq cooling device
Chanwoo Choi [Tue, 14 Jul 2015 09:53:42 +0000 (18:53 +0900)]
gpu: arm: midgard: r12p0_04rel0: Fix build warning about devfreq cooling device

This patch fixes the build warning according to new devfreq_cooling device
driver and make the frequency table as descending order.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: change temperature var type to int in model_static_p...
Sylwester Nawrocki [Wed, 16 Mar 2016 16:36:13 +0000 (17:36 +0100)]
gpu: arm: midgard: r12p0_04rel0: change temperature var type to int in model_static_power()

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: r12p0_04rel0: add exynos5433 platform files
Joonyoung Shim [Thu, 19 May 2016 09:44:30 +0000 (18:44 +0900)]
gpu: arm: midgard: r12p0_04rel0: add exynos5433 platform files

We should check more clock and regulator for DVFS.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[jy0922.shim: apply to midgard r12p0_04rel0 with removing some codes]

8 years agogpu: arm: midgard: remove choice in Kconfig of r12p0_04rel0
Joonyoung Shim [Thu, 19 May 2016 08:16:03 +0000 (17:16 +0900)]
gpu: arm: midgard: remove choice in Kconfig of r12p0_04rel0

The choice of each mali version causes Kconfig errors like below,

$ make ARCH=arm64 menuconfig
scripts/kconfig/mconf  Kconfig
drivers/gpu/arm/midgard/r12p0_04rel0/Kconfig:126:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_04rel0/Kconfig:129:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_04rel0/Kconfig:132:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_04rel0/Kconfig:135:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_04rel0/Kconfig:137:warning: choice value used outside its choice group

Also remove configs for unused platform.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: support Kconfig for r12p0_04rel0
Joonyoung Shim [Thu, 7 Jul 2016 00:19:58 +0000 (09:19 +0900)]
gpu: arm: midgard: support Kconfig for r12p0_04rel0

So, we can select mali midgard r12p0_04rel0 from Kconfig of midgard.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: add r12p0_04rel0 sources
Joonyoung Shim [Wed, 6 Jul 2016 08:33:48 +0000 (17:33 +0900)]
gpu: arm: midgard: add r12p0_04rel0 sources

This is mali midgard r12p0_04rel0 version from ARM.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: remove choice in Kconfig of r5p0_06rel0
Joonyoung Shim [Thu, 19 May 2016 08:16:21 +0000 (17:16 +0900)]
gpu: arm: midgard: remove choice in Kconfig of r5p0_06rel0

The choice of each mali version causes Kconfig errors like below,

$ make ARCH=arm64 menuconfig
scripts/kconfig/mconf  Kconfig
drivers/gpu/arm/midgard/r12p0_02dev0/Kconfig:126:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_02dev0/Kconfig:129:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_02dev0/Kconfig:132:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_02dev0/Kconfig:135:warning: choice value used outside its choice group
drivers/gpu/arm/midgard/r12p0_02dev0/Kconfig:137:warning: choice value used outside its choice group

Also remove configs for unused platform.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: fix Kconfig for multiple driver
Joonyoung Shim [Thu, 19 May 2016 02:32:40 +0000 (11:32 +0900)]
gpu: arm: midgard: fix Kconfig for multiple driver

This will make Kconfig of midgard can select mali midgard version to
use.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoarm64: tizen_tm2_defconfig: fix mali directory path for gator
Joonyoung Shim [Thu, 7 Jul 2016 06:30:33 +0000 (15:30 +0900)]
arm64: tizen_tm2_defconfig: fix mali directory path for gator

The mali midgard path was changed to drivers/gpu/arm/midgard/r5p0_06rel0
from drivers/gpu/arm/midgard, so should fix mali path for gator in
defconfig.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agogpu: arm: midgard: move to r5p0_06rel0
Joonyoung Shim [Thu, 19 May 2016 02:16:21 +0000 (11:16 +0900)]
gpu: arm: midgard: move to r5p0_06rel0

This is initial work to support multiple midgard driver in midgard
directory.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agodevfreq_cooling: return on allocation failure
Dan Carpenter [Wed, 4 Nov 2015 13:36:20 +0000 (16:36 +0300)]
devfreq_cooling: return on allocation failure

If the allocation fails then we can't continue.

Fixes: a76caf55e5b3 ('thermal: Add devfreq cooling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agothermal: devfreq_cooling: Make power a u64
Javi Merino [Mon, 2 Nov 2015 19:03:04 +0000 (19:03 +0000)]
thermal: devfreq_cooling: Make power a u64

The prototype of do_div() is:

uint32_t do_div(uint64_t *n, uint32_t base);

Make power u64 to avoid the following warning:

   drivers/thermal/devfreq_cooling.c: In function 'get_dynamic_power':
   drivers/thermal/devfreq_cooling.c:267:2: warning: comparison of distinct pointer types lacks a cast [enabled by default]
   drivers/thermal/devfreq_cooling.c:267:2: warning: right shift count >= width of type [enabled by default]
   drivers/thermal/devfreq_cooling.c:267:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default]
   include/asm-generic/div64.h:35:17: note: expected 'uint64_t *' but argument is of type 'long unsigned int *'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agothermal: devfreq_cooling: use a thermal_cooling_device for register and unregister
Javi Merino [Mon, 2 Nov 2015 19:03:03 +0000 (19:03 +0000)]
thermal: devfreq_cooling: use a thermal_cooling_device for register and unregister

Be consistent with what other cooling devices do and return a struct
thermal_cooling_device * on register.  Also, for the unregister, accept
a struct thermal_cooling_device * as parameter.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agodevfreq_cooling: add trace information
Javi Merino [Thu, 10 Sep 2015 17:09:31 +0000 (18:09 +0100)]
devfreq_cooling: add trace information

Tracing is useful for debugging and performance tuning.  Add similar
traces to what's present in the cpu cooling device.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply from mainline with fixup of fuzz]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agothermal: Add devfreq cooling
Ørjan Eide [Thu, 10 Sep 2015 17:09:30 +0000 (18:09 +0100)]
thermal: Add devfreq cooling

Add a generic thermal cooling device for devfreq, that is similar to
cpu_cooling.

The device must use devfreq.  In order to use the power extension of the
cooling device, it must have registered its OPPs using the OPP library.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Ørjan Eide <orjan.eide@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply from mainline with fixup of fuzz]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agothermal: remove devfreq cooling
Joonyoung Shim [Thu, 19 May 2016 10:04:11 +0000 (19:04 +0900)]
thermal: remove devfreq cooling

Remove local old driver to apply original mainline driver for devfreq
cooling.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoPM / devfreq: comments for get_dev_status usage updated
MyungJoo Ham [Tue, 18 Aug 2015 04:45:49 +0000 (13:45 +0900)]
PM / devfreq: comments for get_dev_status usage updated

With the introduction of devfreq_update_stats(), governors
are not recommended to use get_dev_status() directly.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoPM / devfreq: cache the last call to get_dev_status()
Javi Merino [Fri, 14 Aug 2015 17:56:56 +0000 (18:56 +0100)]
PM / devfreq: cache the last call to get_dev_status()

The return value of get_dev_status() can be reused.  Cache it so that
other parts of the kernel can reuse it instead of having to call the
same function again.

Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agothermal: extend the cooling device API to include power information
Javi Merino [Thu, 26 Feb 2015 19:00:28 +0000 (19:00 +0000)]
thermal: extend the cooling device API to include power information

Add three optional callbacks to the cooling device interface to allow
them to express power.  In addition to the callbacks, add helpers to
identify cooling devices that implement the power cooling device API.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
[jy0922.shim: apply mainline patch]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
8 years agoRevert "PM: devfreq: Add the prototype of update_devfreq() to export"
Sylwester Nawrocki [Tue, 15 Mar 2016 11:56:37 +0000 (12:56 +0100)]
Revert "PM: devfreq: Add the prototype of update_devfreq() to export"

This temporarily reverts commit d70aa318b6a80780e3134d8a07303fa72b95576b,
which will be re-applied after applying soem mainline commits.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
8 years agogpu: mali: Drop TRACE_SYSTEM_STRING macro definition from mali_linux_trace.h
Sylwester Nawrocki [Mon, 14 Mar 2016 17:16:19 +0000 (18:16 +0100)]
gpu: mali: Drop TRACE_SYSTEM_STRING macro definition from mali_linux_trace.h

This fixes compilation warning:

In file included from include/trace/define_trace.h:90:0,
                 from drivers/gpu/arm/midgard/mali_linux_trace.h:211,
                 from drivers/gpu/arm/midgard/mali_kbase_core_linux.c:4199:
include/trace/ftrace.h:28:0: warning: "TRACE_SYSTEM_STRING" redefined
 #define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
 ^
In file included from include/trace/define_trace.h:83:0,
                 from drivers/gpu/arm/midgard/mali_linux_trace.h:211,
                 from drivers/gpu/arm/midgard/mali_kbase_core_linux.c:4199:
drivers/gpu/arm/midgard/./mali_linux_trace.h:28:0: note: this is the location of the previous definition
 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
 ^
In file included from include/trace/ftrace.h:134:0,
                 from include/trace/define_trace.h:90,
                 from drivers/gpu/arm/midgard/mali_linux_trace.h:211,
                 from drivers/gpu/arm/midgard/mali_kbase_core_linux.c:4199:
drivers/gpu/arm/midgard/./mali_linux_trace.h:28:0: warning: "TRACE_SYSTEM_STRING" redefined
 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
 ^
In file included from include/trace/define_trace.h:90:0,
                 from drivers/gpu/arm/midgard/mali_linux_trace.h:211,
                 from drivers/gpu/arm/midgard/mali_kbase_core_linux.c:4199:
include/trace/ftrace.h:28:0: note: this is the location of the previous definition
 #define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
8 years agoarm64: tizen_tm2_defconfig: enable the sec-nfc legacy driver
Jihoon Jung [Fri, 29 Apr 2016 06:06:10 +0000 (15:06 +0900)]
arm64: tizen_tm2_defconfig: enable the sec-nfc legacy driver

This patch enables the sec-nfc legacy driver instead of s3fwrn5 for
neard interface. The legacy driver is used from nfc-manager which is
used as replacement of neard from Tizen.

Change-Id: I7a688738b69ca14723c8333cfca28c30ba2b9c84
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agonfc: change driver from neard interface to legacy sec-nfc
Jihoon Jung [Fri, 29 Apr 2016 01:56:28 +0000 (10:56 +0900)]
nfc: change driver from neard interface to legacy sec-nfc

This enable the legacy nfc driver instead of neard interface.
It is required for nfc-manager and lsi nfc plugin implementation.

Change-Id: Ia77f105262e5c4899806e6310be6ae9cbc013ec9
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoarm: configs: merge odroid related defconfigs
Seung-Woo Kim [Tue, 5 Jul 2016 05:07:08 +0000 (14:07 +0900)]
arm: configs: merge odroid related defconfigs

There are two separated defconfig files for odroid including
tizen_odroidu3_defconfig and odroidxu3_defconfig. With just one
defconfig, it is possible to support both boards. So this patch
merges both odroid defconfigs into one tizen_odroid_defconfig
and also replaces defconfig from packaging spec file.

Change-Id: I5232ab6e5adfb98ea312e2fcfb9d149860c8764d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agodrm/exynos/dsi: mask frame-done interrupt
Andrzej Hajda [Fri, 1 Jul 2016 13:48:04 +0000 (15:48 +0200)]
drm/exynos/dsi: mask frame-done interrupt

DSI driver is not really interested in this interrupt. It causes only
unnecessary code execution of interrupt handler and could possibly
cause FIFO overflow - as it triggers DSI interrupt handler to process
next DSI transfer. With this patch we will get rid of about 30 IRQ
handler calls per second.

Change-Id: I51b6a205cf235fab824888364980d358950b8c85
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/decon5433: mask HW trigger during frame send
Andrzej Hajda [Wed, 22 Jun 2016 12:12:29 +0000 (14:12 +0200)]
drm/exynos/decon5433: mask HW trigger during frame send

Not masked TE during frame transmission results in shifted image in case of TV.
The patch fixes it.

Change-Id: I2d31a90371807b1f0ff2937f44ee0c51dbdf3638
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/decon5433: enable trigger for decon-tv
Andrzej Hajda [Thu, 12 May 2016 13:04:01 +0000 (15:04 +0200)]
drm/exynos/decon5433: enable trigger for decon-tv

Decon-tv requires working trigger. Additionally whole trigger logic
was moved to one function.

Change-Id: I0d2aabc3ec3212024499868805ecfe15bdfa7023
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agoRevert "drm/exynos: decon: use deferred Trigger mode change"
Andrzej Hajda [Mon, 27 Jun 2016 09:18:26 +0000 (11:18 +0200)]
Revert "drm/exynos: decon: use deferred Trigger mode change"

Since HWTRIGGER can be enabled early this patch is not needed anymore.
Reverted patch complicates code and makes debugging more difficult -
DECON works in two different modes before and after suspend.
Since we have full control over all pipe components and we do full
configuration we can switch between HW/SW trigger without waiting
for platform suspend/resume.

This reverts commit 7a0e6fa3d120793a16b6bb16951ef2c436505080.

Change-Id: Ibe401305b9e80b70d9fcc8339cf2a9c40167879d
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agodrm/exynos/mic: workaround for disabling mic during modesetting
Andrzej Hajda [Tue, 21 Jun 2016 10:13:00 +0000 (12:13 +0200)]
drm/exynos/mic: workaround for disabling mic during modesetting

Exynos-DRM framework does not power cycle encoder during modesetting, but
DRM core does it for bridges, as a result MIC device is the only
power-cycled device in the chain DECON->MIC->DSI, it causes black screen.
It is a limitation/feature of DRM core.
The patch adds ugly workaround to skip power-cycling MIC during modesetting.
Alternative is to power-cycle all components during modesetting, it would
require adjustements in ExynosDRM framework and rework of some callbacks
in DSI driver.

Change-Id: I94fdb002f119a298b35f01a4abd41d65f7d7478b
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agosoc: exynos: fix support for domains without clocks defined
Marek Szyprowski [Wed, 29 Jun 2016 08:00:41 +0000 (10:00 +0200)]
soc: exynos: fix support for domains without clocks defined

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

8 years agodrm/exynos/decon5433: do not disable video on commit
Andrzej Hajda [Wed, 22 Jun 2016 12:34:24 +0000 (14:34 +0200)]
drm/exynos/decon5433: do not disable video on commit

There is no point in disabling video. In some cases it
results in blank screen.

Change-Id: Ifd242ea0ffbe0f30dbec8bb515bbc97dbfd332f6
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agoARM64: dts: exynos5433: add MIC to power domain
Marek Szyprowski [Tue, 28 Jun 2016 09:20:11 +0000 (11:20 +0200)]
ARM64: dts: exynos5433: add MIC to power domain

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

8 years agodrm/exynos: mic: add simple runtime pm support
Marek Szyprowski [Tue, 28 Jun 2016 09:21:20 +0000 (11:21 +0200)]
drm/exynos: mic: add simple runtime pm support

Add simple runtime pm to let driver to control power domain. No runtime pm
callbacks are defined, because state of the driver is already handled by
the DRM core.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[Add error routine for component_add like decon driver from probe]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I339fb38f1f5f44e8a58f0ac745e355d2a89aa037

8 years agodrm/exynos: dsi: add simple runtime pm support
Marek Szyprowski [Thu, 23 Jun 2016 12:23:40 +0000 (14:23 +0200)]
drm/exynos: dsi: add simple runtime pm support

Add simple runtime pm to let driver to control power domain. No runtime pm
callbacks are defined, because state of the driver is already handled by
the DRM core.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[Add error routine for component_add like decon driver from probe]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I77cdcf9b669c2bee45c14ba8d86f7fd1bbf8ba9c

8 years agodrm/exynos: decon: add simple runtime pm support
Marek Szyprowski [Thu, 30 Jun 2016 13:58:55 +0000 (15:58 +0200)]
drm/exynos: decon: add simple runtime pm support

Add simple runtime pm to let driver to control power domain. No runtime pm
callbacks are defined, because state of the driver is already handled by
the DRM core.

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

8 years agostaging: logger: fix build error due to removed ki_nbytes
Inki Dae [Mon, 4 Jul 2016 08:28:46 +0000 (17:28 +0900)]
staging: logger: fix build error due to removed ki_nbytes

This patch fixes build error. Logger driver was removed
from mainline kernel and after that there was some changes and
one of them is that ki_nbytes member was removed from kiocb structure.
66ee59a fs: remove ki_nbytes

This patch makes count member of iov_iter structure to be used instead.

Change-Id: I070587d650596eb7ed93df7d99398f9e401a6579
Signed-off-by: Inki Dae <inki.dae@samsung.com>
8 years agodrm/exynos/decon5433: Fix standalone update code
Andrzej Hajda [Mon, 27 Jun 2016 08:52:16 +0000 (10:52 +0200)]
drm/exynos/decon5433: Fix standalone update code

Documentation is not clear about the subject, but it seems that shadowed
registers should be updated only if STANDALONE_UPDATE_F bit is clear.
After completing update of shadowed registers driver should enable this bit.
Without this logic one can observe flickering, black screens or white noise.

Change-Id: Ia1e54423cd321bf7c8ac9e8cf90d1dc8c8d64daf
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
8 years agomm/filemap: generic_file_read_iter(): check for zero reads unconditionally
Nicolai Stange [Fri, 25 Mar 2016 21:22:14 +0000 (14:22 -0700)]
mm/filemap: generic_file_read_iter(): check for zero reads unconditionally

If
 - generic_file_read_iter() gets called with a zero read length,
 - the read offset is at a page boundary,
 - IOCB_DIRECT is not set
-  and the page in question hasn't made it into the page cache yet,
then do_generic_file_read() will trigger a readahead with a req_size hint
of zero.

Since roundup_pow_of_two(0) is undefined, UBSAN reports

  UBSAN: Undefined behaviour in include/linux/log2.h:63:13
  shift exponent 64 is too large for 64-bit type 'long unsigned int'
  CPU: 3 PID: 1017 Comm: sa1 Tainted: G L 4.5.0-next-20160318+ #14
  [...]
  Call Trace:
   [...]
   [<ffffffff813ef61a>] ondemand_readahead+0x3aa/0x3d0
   [<ffffffff813ef61a>] ? ondemand_readahead+0x3aa/0x3d0
   [<ffffffff813c73bd>] ? find_get_entry+0x2d/0x210
   [<ffffffff813ef9c3>] page_cache_sync_readahead+0x63/0xa0
   [<ffffffff813cc04d>] do_generic_file_read+0x80d/0xf90
   [<ffffffff813cc955>] generic_file_read_iter+0x185/0x420
   [...]
   [<ffffffff81510b06>] __vfs_read+0x256/0x3d0
   [...]

when get_init_ra_size() gets called from ondemand_readahead().

The net effect is that the initial readahead size is arch dependent for
requested read lengths of zero: for example, since

  1UL << (sizeof(unsigned long) * 8)

evaluates to 1 on x86 while its result is 0 on ARMv7, the initial readahead
size becomes 4 on the former and 0 on the latter.

What's more, whether or not the file access timestamp is updated for zero
length reads is decided differently for the two cases of IOCB_DIRECT
being set or cleared: in the first case, generic_file_read_iter()
explicitly skips updating that timestamp while in the latter case, it is
always updated through the call to do_generic_file_read().

According to POSIX, zero length reads "do not modify the last data access
timestamp" and thus, the IOCB_DIRECT behaviour is POSIXly correct.

Let generic_file_read_iter() unconditionally check the requested read
length at its entry and return immediately with success if it is zero.

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[Backport from mainline to remove UBSAN warning during login]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4f23b085363201c79d63601a69f287f26e55fafb

8 years agosignal: move the "sig < SIGRTMIN" check into siginmask(sig)
Oleg Nesterov [Mon, 23 May 2016 23:24:02 +0000 (16:24 -0700)]
signal: move the "sig < SIGRTMIN" check into siginmask(sig)

All the users of siginmask() must ensure that sig < SIGRTMIN.  sig_fatal()
doesn't and this is wrong:

UBSAN: Undefined behaviour in kernel/signal.c:911:6
shift exponent 32 is too large for 32-bit type 'long unsigned int'

the patch doesn't add the neccesary check to sig_fatal(), it moves the
check into siginmask() and updates other callers.

Link: http://lkml.kernel.org/r/20160517195052.GA15187@redhat.com
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[Backport from mainline to remove UBSAN warning in sending signal]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Icb12de70772b563ba112f5f6e490731e4db119d1

8 years agoUSB: EHCI: avoid undefined pointer arithmetic and placate UBSAN
Alan Stern [Thu, 19 May 2016 20:29:50 +0000 (16:29 -0400)]
USB: EHCI: avoid undefined pointer arithmetic and placate UBSAN

Several people have reported that UBSAN doesn't like the pointer
arithmetic in ehci_hub_control():

u32 __iomem *status_reg = &ehci->regs->port_status[
(wIndex & 0xff) - 1];
u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];

If wIndex is 0 (and it often is), these calculations underflow and
UBSAN complains.

According to the C standard, pointer computations leading to locations
outside the bounds of an array object (other than 1 position past the
end) are undefined.  In this case, the compiler would be justified in
concluding the wIndex can never be 0 and then optimizing away the
tests for !wIndex that occur later in the subroutine.  (Although,
since ehci->regs->port_status and ehci->regs->hostpc are both 0-length
arrays and are thus GCC extensions to the C standard, it's not clear
what the compiler is really allowed to do.)

At any rate, we can avoid all these difficulties, at the cost of
making the code slightly longer, by not decrementing the index when it
is equal to 0.  The runtime effect is minimal, and anyway
ehci_hub_control() is not on a hot path.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Reported-by: Meelis Roos <mroos@linux.ee>
Reported-by: Martin_MOKREJÅ <mmokrejs@gmail.com>
Reported-by: "Navin P.S" <navinp1912@gmail.com>
CC: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[Backport from mainline to remove UBSAN warning on usb-ehci]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Iead9feb0ae5b53d48baa7603f1808fc898b31127

8 years agoarm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
Seung-Woo Kim [Tue, 21 Jun 2016 05:26:00 +0000 (14:26 +0900)]
arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL

To enable UBSAN on arm, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
from arm confiuration. Basic kernel booting is tested on arm kernel
enabled CONFIG_UBSAN_SANITIZE_ALL from Exynos5422 based Odroid-XU3
board.

Change-Id: I9480a9af713b88eff2a90df11f78e1feb97eac30
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoARM: 8471/1: need to save/restore arm register(r11) when it is corrupted
Anson Huang [Mon, 7 Dec 2015 09:09:19 +0000 (10:09 +0100)]
ARM: 8471/1: need to save/restore arm register(r11) when it is corrupted

In cpu_v7_do_suspend routine, r11 is used while it is NOT
saved/restored, different compiler may have different usage
of ARM general registers, so it may cause issues during
calling cpu_v7_do_suspend.

We meet kernel fault occurs when using GCC 4.8.3, r11 contains
valid value before calling into cpu_v7_do_suspend, but when returned
from this routine, r11 is corrupted and lead to kernel fault.
Doing save/restore for those corrupted registers is a must in
assemble code.

Signed-off-by: Anson Huang <Anson.Huang@freescale.com>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
Cc: <stable@vger.kernel.org> # v3.3+
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[Backport from mainline to fix boot hangup on arm with UBSAN]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I2c0bb7b8e9d4a0489a4e9e08c65ed7b39fea9ee8

8 years agopinctrl: samsung: fix wakeup irq for extended eint
Seung-Woo Kim [Thu, 9 Jun 2016 07:57:15 +0000 (16:57 +0900)]
pinctrl: samsung: fix wakeup irq for extended eint

For extended eint bank, it should use maks1 for bit from 32 to 63
as its ext offset. So this patch fixes wakeup irq setting for
extended eit of exynos5433 with adding eint mask1 setting.

Without considering extended eint, setting wakeup on ext eint pin
causes wrong offset for eint mask, so UBSAN warning is repored
like following:

   UBSAN: Undefined behaviour in drivers/pinctrl/samsung/pinctrl-exynos.c:376:26
   shift exponent 8217 is too large for 64-bit type 'long unsigned int'
   Call trace:
   [<ffffffc00008f440>] dump_backtrace+0x0/0x218
   [<ffffffc00008f668>] show_stack+0x10/0x20
   [<ffffffc00159f3b8>] dump_stack+0x80/0xfc
   [<ffffffc00159f558>] ubsan_epilogue+0x10/0x6c
   [<ffffffc00159fe38>] __ubsan_handle_shift_out_of_bounds+0x188/0x1bc
   [<ffffffc000785514>] exynos_wkup_irq_set_wake+0x104/0x138
   [<ffffffc0001647b0>] set_irq_wake_real+0x70/0xc0
   [<ffffffc000164a70>] irq_set_irq_wake+0x158/0x1b0
   [...]

Change-Id: I6d55182609c982de702936ddb0045639df0e5ef0
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoarm64: tm2_defconfig: do not compile unnecessary drivers
Andi Shyti [Fri, 24 Jun 2016 06:51:21 +0000 (15:51 +0900)]
arm64: tm2_defconfig: do not compile unnecessary drivers

Patch c89511d3180fe37cdee67f9bcd2876fefa26a057 was including in
not specifying the compilation status of some drivers in the RC
system.

In order to not compile them specify their entries with the "is
not set" flag in the config file.

Change-Id: I09ff34c020bc7fd039bfaf7d5ba177205f7256fa
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Suggested-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoarm64: dts: exynos5433: tm2/tm2e: add ir-spi device node
Andi Shyti [Tue, 14 Jun 2016 01:20:58 +0000 (10:20 +0900)]
arm64: dts: exynos5433: tm2/tm2e: add ir-spi device node

The tm2 and tm2e boards both have an irled connected to the
SPI MOSI line for remote controlling. Therefore, enable it in
their related device tree node.

Add the fixed regulator which powers the LED, as well.

Change-Id: Ie47bebae3efaebbd2d18b3e5f5d6fbec68486b1d
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
8 years agoarm64: tm2_defconfig: add support for the ir-spi driver
Andi Shyti [Tue, 14 Jun 2016 05:57:01 +0000 (14:57 +0900)]
arm64: tm2_defconfig: add support for the ir-spi driver

Enable the CONFIG_IR_SPI flag for the TM2 default
configuration.

Change-Id: Ic2f08b7b5480d7de4bb8442323e100742642405a
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
8 years ago[media] rc: ir-spi: add support for IR LEDs connected with SPI
Andi Shyti [Tue, 14 Jun 2016 01:16:43 +0000 (10:16 +0900)]
[media] rc: ir-spi: add support for IR LEDs connected with SPI

The ir-spi is a simple device driver which supports the
connection between an IR LED and the MOSI line of an SPI device.

The driver, indeed, uses the SPI framework to stream the raw data
provided by userspace through a character device. The chardev is
handled by the LIRC framework and its functionality basically
provides:

 - raw write: data to be sent to the SPI and then streamed to the
   MOSI line;
 - set frequency: sets the frequency whith which the data should
   be sent;
 - set length: sets the data length. This information is
   optional, if the length is set, then userspace should send raw
   data only with that length; while if the length is set to '0',
   then the driver will figure out himself the length of the data
   based on the length of the data written on the character
   device.
   The latter is not recommended, though, as the driver, at
   any write, allocates and deallocates a buffer where the data
   from userspace are stored.

The driver provides three feedback commands:

 - get length: reads the length set and (as mentioned), if the
   length is '0' it will be calculated at any write
 - get frequency: the driver reports the frequency. If userpace
   doesn't set the frequency, the driver will use a default value
   of 38000Hz.

The character device is created under /dev/lircX name, where X is
and ID assigned by the LIRC framework.

Example of usage:

        int fd, ret;
        ssize_t n;
        uint32_t val = 0;

        fd = open("/dev/lirc0", O_RDWR);
        if (fd < 0) {
                fprintf(stderr, "unable to open the device\n");
                return -1;
        }

        /* ioctl set frequency and length parameters */
        val = 6430;
        ret = ioctl(fd, LIRC_SET_LENGTH, &val);
        if (ret < 0)
                fprintf(stderr, "LIRC_SET_LENGTH failed\n");
        val = 608000;
        ret = ioctl(fd, LIRC_SET_FREQUENCY, &val);
        if (ret < 0)
                fprintf(stderr, "LIRC_SET_FREQUENCY failed\n");

        /* read back length and frequency parameters */
        ret = ioctl(fd, LIRC_GET_LENGTH, &val);
        if (ret < 0)
                fprintf(stderr, "LIRC_GET_LENGTH failed\n");
        else
                fprintf(stdout, "legnth = %u\n", val);

        ret = ioctl(fd, LIRC_GET_FREQUENCY, &val);
        if (ret < 0)
                fprintf(stderr, "LIRC_GET_FREQUENCY failed\n");
        else
                fprintf(stdout, "frequency = %u\n", val);

        /* write data to device */
        n = write(fd, b, 6430);
        if (n < 0) {
                fprintf(stderr, "unable to write to the device\n");
                ret = -1;
        } else if (n != 6430) {
                fprintf(stderr, "failed to write everything, wrote %ld instead\n", n);
                ret = -1;
        } else {
                fprintf(stdout, "written all the %ld data\n", n);
        }

        close(fd);

The driver supports multi task access, but all the processes
which hold the driver should use the same length and frequency
parameters.

Change-Id: I323d7dd4a56d6dcf48f2c695293822eb04bdb85f
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
8 years ago[media] include: lirc: add set length and frequency ioctl options
Andi Shyti [Mon, 13 Jun 2016 03:53:38 +0000 (12:53 +0900)]
[media] include: lirc: add set length and frequency ioctl options

The Lirc framework works mainly with receivers, but there is
nothing that prevents us from using it for transmitters as well.

For that we need to have more control on the device frequency to
set (which is a new concept fro LIRC) and we also need to provide
to userspace, as feedback, the values of the used frequency and
length.

Add the LIRC_SET_LENGTH, LIRC_GET_FREQUENCY and
LIRC_SET_FREQUENCY ioctl commands in order to allow the above
mentioned operations.

Change-Id: I50b08e4da89a61f4b14f8a2752b905bc9e4a1d34
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
8 years agospi: s3c64xx: use unsigned type for fifo handling variables
Jaehoon Chung [Mon, 13 Jun 2016 02:55:58 +0000 (11:55 +0900)]
spi: s3c64xx: use unsigned type for fifo handling variables

The 'quirks' variable cannot ever be negative, therefore use u8
instead of int. The 8 bit size is given from the fact that
currently the quirks variable has very few statuses.

The rx_lvl_offset and tx_st_done store shift values, so that u8
is a proper size.

fifo_lvl_mask stores a series of masks, to be in we will keep the
32 bit size.

Change-Id: I949160c9dfd68d6dce5c2385c911269f5b6d1505
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
8 years agospi: s3c64xx: add the BROKEN_CS case when setting up the transfer
Andi Shyti [Mon, 13 Jun 2016 02:44:09 +0000 (11:44 +0900)]
spi: s3c64xx: add the BROKEN_CS case when setting up the transfer

The CS line might be disconneced ("broken"), therefore unused.
In this case, the device doesn't need to wait for the user to
handle the CS line for selecting the slave. The data will then be
automatically transferred without taking the CS line status into
account.

Change-Id: Ibddf87721b7d882efbdad9c978b79a3e19189b3e
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
8 years agoclk: exynos5433: use CLK_IGNORE_UNUSED for the SPI3 related clock
Jaehoon Chung [Mon, 13 Jun 2016 02:34:01 +0000 (11:34 +0900)]
clk: exynos5433: use CLK_IGNORE_UNUSED for the SPI3 related clock

The SPI 3 bus uses two clocks, a bus clock and an input clock.
Do not disable the clocks when unused in order to allow access to
the SPI 3 device.

Change-Id: I5fbc360e4b0ed2043b0bf1f2dd251f3e913082f3
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
8 years agoARM: dts: Remove fimd node from exynos5422-odroidxu3-common
Marek Szyprowski [Tue, 10 Nov 2015 10:24:09 +0000 (11:24 +0100)]
ARM: dts: Remove fimd node from exynos5422-odroidxu3-common

FIMD device is not used at all on Exynos5422-based Odroid XU3-lite and
XU4. XU3 board theorethically can support FIMD with DisplayPort
connector, but due to hw limitation/design it doesn't work in most
cases. It is also not even enabled in XU3 dts file.

FIMD node was enabled mainly due to limitation of early Exynos DRM
driver, which didn't initialize properly when no FIMD device was
available. This node can be now safely removed from XU3-common dtsi and
added layer to Odroid XU3 dts, when Display Port driver gets enabled.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[mainline backport of commit 616d289abac9c63f5a5a56c0deb088360f4aed06]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I616d289abac9c63f5a5a56c0deb088360f4aed06

8 years agoARM: dts: Add async-bridge clock to MFC power domain for Exynos5420
Javier Martinez Canillas [Tue, 24 May 2016 17:41:02 +0000 (13:41 -0400)]
ARM: dts: Add async-bridge clock to MFC power domain for Exynos5420

The MFC IP is also inter-connected by an Async-Bridge so the CLK_ACLK333
has to be ungated during a power domain switch. Trying to do it when the
clock is gated will fail and lead to an imprecise external abort error
when the driver tries to access the MFC registers with the PD disabled.

For example, if the s5p-mfc module is removed and the MFC PD turned off:

[  186.835606] Power domain power-domain@10044060 disable failed
[  186.835671] s5p-mfc 11000000.codec: Removing 11000000.codec
[  186.837670] Power domain power-domain@10044060 disable failed

And when the module is inserted again:

[ 2395.176956] s5p_mfc_wait_for_done_dev:34: Interrupt (dev->int_type:0, command:12) timed out
[ 2395.177031] s5p_mfc_init_hw:272: Failed to load firmware
[ 2395.177384] Unhandled fault: imprecise external abort (0x1406) at 0x00000000
[ 2395.177441] pgd = ec3b4000
[ 2395.177467] [00000000] *pgd=00000000
[ 2395.177507] Internal error: : 1406 [#1] PREEMPT SMP ARM
[ 2395.177550] Modules linked in: s5p_mfc mwifiex_sdio mwifiex uvcvideo s5p_jpeg v4l2_mem2mem videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_core v4l2_common videodev media [last unloaded: s5p_mfc]
[ 2395.177774] CPU: 1 PID: 2382 Comm: v4l_id Tainted: G        W       4.6.0-rc6-next-20160502-00010-g7730dc64d2c1-dirty #179
[ 2395.177857] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[ 2395.177906] task: ed275500 ti: e6c8c000 task.ti: e6c8c000
[ 2395.177996] PC is at s5p_mfc_reset+0x1c4/0x284 [s5p_mfc]
[ 2395.178057] LR is at s5p_mfc_reset+0x1a4/0x284 [s5p_mfc]

This patch fixes this issue by adding the CLK_ACLK333 as an Async-Bridge
clock for the MFC power domain, so the PD configuration works properly.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[backport of mainline commit 94aed538e032d82287023beb9c59ee80f03a1493]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I94aed538e032d82287023beb9c59ee80f03a1493

8 years agoclk: exynos5420: Set ID for aclk333 gate clock
Javier Martinez Canillas [Tue, 24 May 2016 17:41:01 +0000 (13:41 -0400)]
clk: exynos5420: Set ID for aclk333 gate clock

The aclk333 clock needs to be ungated during the MFC power domain switch,
so set the clock ID to allow the Exynos power domain logic to lookup this
clock if is defined in the MFC PD device tree node.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[backport of mainline commit 34cba900375ec1751a87d3655ad03b9a5b022362]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I34cba900375ec1751a87d3655ad03b9a5b022362

8 years agos5p-mfc: don't close instance after free OUTPUT buffers
ayaka [Fri, 6 May 2016 22:11:22 +0000 (18:11 -0400)]
s5p-mfc: don't close instance after free OUTPUT buffers

User-space applications can use the VIDIOC_REQBUFS ioctl to determine if a
memory mapped, user pointer or DMABUF based I/O is supported by the driver.

So a set of VIDIOC_REQBUFS ioctl calls will be made with count 0 and then
the real VIDIOC_REQBUFS call with count == n. But for count 0, the driver
not only frees the buffer but also closes the MFC instance and s5p_mfc_ctx
state is set to MFCINST_FREE.

The VIDIOC_REQBUFS handler for the output device checks if the s5p_mfc_ctx
state is set to MFCINST_INIT (which happens on an VIDIOC_S_FMT) and fails
otherwise. So after a VIDIOC_REQBUFS(n), future VIDIOC_REQBUFS(n) calls
will fails unless a VIDIOC_S_FMT ioctl calls happens before the reqbufs.

But applications may first set the format and then attempt to determine
the I/O methods supported by the driver (for example Gstramer does it) so
the state won't be set to MFCINST_INIT again and VIDIOC_REQBUFS will fail.

To avoid this issue, only free the buffers on VIDIOC_REQBUFS(0) but don't
close the MFC instance to allow future VIDIOC_REQBUFS(n) calls to succeed.

[javier: Rewrote changelog to explain the problem more detailed]

Signed-off-by: ayaka <ayaka@soulik.info>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Nicolas Dufresne <nicolas@collabora.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[backport of mainline commit 9bd5d8696fd50a10d830e2ad7f9d4e67e0bbbae2]
Signed-of-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I9bd5d8696fd50a10d830e2ad7f9d4e67e0bbbae2

8 years agos5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()
Javier Martinez Canillas [Tue, 3 May 2016 20:27:18 +0000 (16:27 -0400)]
s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()

The s5p_mfc_probe() function registers the video devices before all the
resources needed by s5p_mfc_open() are correctly initalized.

So if s5p_mfc_open() function is called before s5p_mfc_probe() finishes
(since the video dev is already registered), a NULL pointer dereference
will happen due s5p_mfc_open() accessing uninitialized vars such as the
struct s5p_mfc_dev .watchdog_timer and .mfc_ops fields.

An example is following BUG caused by add_timer() getting a NULL pointer:

[   45.765374] kernel BUG at kernel/time/timer.c:790!
[   45.765381] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
...
[   45.766149] [<c016fdf4>] (mod_timer) from [<bf181d18>] (s5p_mfc_open+0x274/0x4d4 [s5p_mfc])
[   45.766416] [<bf181d18>] (s5p_mfc_open [s5p_mfc]) from [<bf0214a0>] (v4l2_open+0x9c/0x100 [videodev])
[   45.766547] [<bf0214a0>] (v4l2_open [videodev]) from [<c01e355c>] (chrdev_open+0x9c/0x178)
[   45.766575] [<c01e355c>] (chrdev_open) from [<c01dceb4>] (do_dentry_open+0x1e0/0x300)
[   45.766595] [<c01dceb4>] (do_dentry_open) from [<c01ec2f0>] (path_openat+0x800/0x10d4)
[   45.766610] [<c01ec2f0>] (path_openat) from [<c01ed8b8>] (do_filp_open+0x5c/0xc0)
[   45.766624] [<c01ed8b8>] (do_filp_open) from [<c01de218>] (do_sys_open+0x10c/0x1bc)
[   45.766642] [<c01de218>] (do_sys_open) from [<c01078c0>] (ret_fast_syscall+0x0/0x3c)
[   45.766655] Code: eaffffe3 e3a00001 e28dd008 e8bd81f0 (e7f001f2)

Fix it by registering the video devs as the last step in s5p_mfc_probe().

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
[backport of mainline commit 6311f1261f59ce5e51fbe5cc3b5e7737197316ac]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I43355e4eeaa913d3b63a41a5621a122f4771982f

8 years agommc: dw_mmc: remove UBSAN warning in dw_mci_setup_bus()
Seung-Woo Kim [Fri, 17 Jun 2016 04:19:09 +0000 (13:19 +0900)]
mmc: dw_mmc: remove UBSAN warning in dw_mci_setup_bus()

This patch removes following UBSAN warnings in dw_mci_setup_bus().

  UBSAN: Undefined behaviour in drivers/mmc/host/dw_mmc.c:1102:14
  shift exponent 250 is too large for 32-bit type 'unsigned int'
  Call trace:
  [<ffffff90080908a8>] dump_backtrace+0x0/0x380
  [<ffffff9008090c3c>] show_stack+0x14/0x20
  [<ffffff90087457b8>] dump_stack+0xe0/0x120
  [<ffffff90087b1360>] ubsan_epilogue+0x18/0x68
  [<ffffff90087b1a94>] __ubsan_handle_shift_out_of_bounds+0x18c/0x1bc
  [<ffffff9008d89cb8>] dw_mci_setup_bus+0x3a0/0x438
  [...]

  UBSAN: Undefined behaviour in drivers/mmc/host/dw_mmc.c:1132:27
  shift exponent 250 is too large for 32-bit type 'unsigned int'
  Call trace:
  [<ffffff90080908a8>] dump_backtrace+0x0/0x380
  [<ffffff9008090c3c>] show_stack+0x14/0x20
  [<ffffff90087457b8>] dump_stack+0xe0/0x120
  [<ffffff90087b1360>] ubsan_epilogue+0x18/0x68
  [<ffffff90087b1a94>] __ubsan_handle_shift_out_of_bounds+0x18c/0x1bc
  [<ffffff9008d89c9c>] dw_mci_setup_bus+0x384/0x438
  [...]

The warnings are caused because of bit shift which is used to
filter spamming message for CONFIG_MMC_CLKGATE, but the config is
already removed. So this patch just removes the shift.

[Backport for current version.]

Change-Id: I1760db1b0e42ddd490aa7539e6c1474a047387c4
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
8 years agoARM: add support for generic early_ioremap/early_memremap
Ard Biesheuvel [Tue, 1 Sep 2015 06:59:28 +0000 (08:59 +0200)]
ARM: add support for generic early_ioremap/early_memremap

This enables the generic early_ioremap implementation for ARM.

It uses the fixmap region reserved for kmap. Since early_ioremap
is only supported before paging_init(), and kmap is only supported
afterwards, this is guaranteed not to cause any clashes.

Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
[backport from mainline to support ioremap on earlycon for arm target]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4e2d88b47a4c1f31882632b702df6a627b109308