platform/kernel/linux-exynos.git
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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>
7 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

7 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

7 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

7 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

7 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>
7 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

7 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

7 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

7 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>
7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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

7 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

7 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

7 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

7 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>
7 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

7 years agoARM: 8415/1: early fixmap support for earlycon
Stefan Agner [Wed, 12 Aug 2015 23:01:52 +0000 (00:01 +0100)]
ARM: 8415/1: early fixmap support for earlycon

Add early fixmap support, initially to support permanent, fixed
mapping support for early console. A temporary, early pte is
created which is migrated to a permanent mapping in paging_init.
This is also needed since the attributes may change as the memory
types are initialized. The 3MiB range of fixmap spans two pte
tables, but currently only one pte is created for early fixmap
support.

Re-add FIX_KMAP_BEGIN to the index calculation in highmem.c since
the index for kmap does not start at zero anymore. This reverts
4221e2e6b316 ("ARM: 8031/1: fixmap: remove FIX_KMAP_BEGIN and
FIX_KMAP_END") to some extent.

Cc: Mark Salter <msalter@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Laura Abbott <lauraa@codeaurora.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[backport from mainline to support ioremap on earlycon for arm target]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ifeee5e94d70d87b74b8e0d2bb3b4d32f6d946a01

7 years agobitops.h: correctly handle rol32 with 0 byte shift
Sasha Levin [Fri, 4 Dec 2015 03:04:01 +0000 (22:04 -0500)]
bitops.h: correctly handle rol32 with 0 byte shift

ROL on a 32 bit integer with a shift of 32 or more is undefined and the
result is arch-dependent. Avoid this by handling the trivial case of
roling by 0 correctly.

The trivial solution of checking if shift is 0 breaks gcc's detection
of this code as a ROL instruction, which is unacceptable.

This bug was reported and fixed in GCC
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57157):

The standard rotate idiom,

  (x << n) | (x >> (32 - n))

is recognized by gcc (for concreteness, I discuss only the case that x
is an uint32_t here).

However, this is portable C only for n in the range 0 < n < 32. For n
== 0, we get x >> 32 which gives undefined behaviour according to the
C standard (6.5.7, Bitwise shift operators). To portably support n ==
0, one has to write the rotate as something like

  (x << n) | (x >> ((-n) & 31))

And this is apparently not recognized by gcc.

Note that this is broken on older GCCs and will result in slower ROL.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[Backport from mainline to fix ubsan report]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I47fcb9807778615fff4972fa92dc7b3143e0ef3d

7 years agoubsan: fix tree-wide -Wmaybe-uninitialized false positives
Andrey Ryabinin [Tue, 22 Mar 2016 21:27:45 +0000 (14:27 -0700)]
ubsan: fix tree-wide -Wmaybe-uninitialized false positives

-fsanitize=* options makes GCC less smart than usual and increase number
of 'maybe-uninitialized' false-positives. So this patch does two things:

 * Add -Wno-maybe-uninitialized to CFLAGS_UBSAN which will disable all
   such warnings for instrumented files.

 * Remove CONFIG_UBSAN_SANITIZE_ALL from all[yes|mod]config builds. So
   the all[yes|mod]config build goes without -fsanitize=* and still with
   -Wmaybe-uninitialized.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[backport from mainline for UBSAN]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ia32d029540fcb5ebd19a3ac447a3b6333a173f84

7 years agoarm64: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
Yang Shi [Fri, 5 Feb 2016 23:50:18 +0000 (15:50 -0800)]
arm64: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL

To enable UBSAN on arm64, ARCH_HAS_UBSAN_SANITIZE_ALL need to be selected.

Basic kernel bootup test is passed on arm64 with CONFIG_UBSAN_SANITIZE_ALL
enabled.

Signed-off-by: Yang Shi <yang.shi@linaro.org>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
[backport from mainline for UBSAN]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I1876783c89adf8c7f0328434ab41c556440b64ff

7 years agoubsan: cosmetic fix to Kconfig text
Yang Shi [Fri, 12 Feb 2016 00:12:55 +0000 (16:12 -0800)]
ubsan: cosmetic fix to Kconfig text

When enabling UBSAN_SANITIZE_ALL, the kernel image size gets increased
significantly (~3x).  So, it sounds better to have some note in Kconfig.

And, fixed a typo.

Signed-off-by: Yang Shi <yang.shi@linaro.org>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[backport from mainline for UBSAN]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Ibd4183436723b1cad45eab0ffa5b0a8910edc0e6

7 years agoUBSAN: run-time undefined behavior sanity checker
Andrey Ryabinin [Wed, 20 Jan 2016 23:00:55 +0000 (15:00 -0800)]
UBSAN: run-time undefined behavior sanity checker

UBSAN uses compile-time instrumentation to catch undefined behavior
(UB).  Compiler inserts code that perform certain kinds of checks before
operations that could cause UB.  If check fails (i.e.  UB detected)
__ubsan_handle_* function called to print error message.

So the most of the work is done by compiler.  This patch just implements
ubsan handlers printing errors.

GCC has this capability since 4.9.x [1] (see -fsanitize=undefined
option and its suboptions).
However GCC 5.x has more checkers implemented [2].
Article [3] has a bit more details about UBSAN in the GCC.

[1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html
[2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
[3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/

Issues which UBSAN has found thus far are:

Found bugs:

 * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix
   insufficient validation in nfnetlink_bind")

undefined shifts:

 * d48458d4a768 ("jbd2: use a better hash function for the revoke
   table")

 * 10632008b9e1 ("clockevents: Prevent shift out of bounds")

 * 'x << -1' shift in ext4 -
   http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com>

 * undefined rol32(0) -
   http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com>

 * undefined dirty_ratelimit calculation -
   http://lkml.kernel.org/r/<566594E2.3050306@odin.com>

 * undefined roundown_pow_of_two(0) -
   http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com>

 * [WONTFIX] undefined shift in __bpf_prog_run -
   http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com>

   WONTFIX here because it should be fixed in bpf program, not in kernel.

signed overflows:

 * 32a8df4e0b33f ("sched: Fix odd values in effective_load()
   calculations")

 * mul overflow in ntp -
   http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com>

 * incorrect conversion into rtc_time in rtc_time64_to_tm() -
   http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com>

 * unvalidated timespec in io_getevents() -
   http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com>

 * [NOTABUG] signed overflow in ktime_add_safe() -
   http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com>

[akpm@linux-foundation.org: fix unused local warning]
[akpm@linux-foundation.org: fix __int128 build woes]
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yury Gribov <y.gribov@samsung.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[backport from mainline for UBSAN]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I216cb2d9dbfd9fc9e70b8e4515a0e34fcb68822f

7 years agokernel: printk: specify alignment for struct printk_log
Andrey Ryabinin [Wed, 20 Jan 2016 23:00:48 +0000 (15:00 -0800)]
kernel: printk: specify alignment for struct printk_log

On architectures that have support for efficient unaligned access struct
printk_log has 4-byte alignment.  Specify alignment attribute in type
declaration.

The whole point of this patch is to fix deadlock which happening when
UBSAN detects unaligned access in printk() thus UBSAN recursively calls
printk() with logbuf_lock held by top printk() call.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Yury Gribov <y.gribov@samsung.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Kostya Serebryany <kcc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[Backport from mainline for UBSAN]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I93d23dec2c1539faf21eb7242ccc328999950c01

7 years agoinput: touchscreen: fts: fix to use touch_id with proper event_id only
Seung-Woo Kim [Tue, 31 May 2016 08:29:39 +0000 (17:29 +0900)]
input: touchscreen: fts: fix to use touch_id with proper event_id only

From event handler, touch_id is used as index of array, but in can
be larger than array size, and it causes out of range access for
array. From event data of the fts hw, finger touch_id is only valid
when event_id is enter/leave/motion pointer event. So this patch
fixes to use touch_id as a array index only when the proper event_id
is received.

This issue is found by ubsan checker like following:

   ================================================================================
   UBSAN: Undefined behaviour in drivers/input/touchscreen/fts_ts.c:342:15
   index 13 is out of range for type 'fts_finger [10]'
   CPU: 1 PID: 98 Comm: irq/150-fts_tou Not tainted 4.1.0-01159-gfb62846 #17
   Hardware name: Samsung TM2 board (DT)
   Call trace:
   [<ffffffc00008f440>] dump_backtrace+0x0/0x218
   [<ffffffc00008f668>] show_stack+0x10/0x20
   [<ffffffc00159f378>] dump_stack+0x80/0xfc
   [<ffffffc00159f518>] ubsan_epilogue+0x10/0x6c
   [<ffffffc00159fef4>] __ubsan_handle_out_of_bounds+0xc8/0xf4
   [<ffffffc000ceb980>] fts_interrupt_handler+0x570/0x678
   [<ffffffc000165a98>] irq_thread+0x218/0x378
   [<ffffffc0000ee30c>] kthread+0x194/0x240
   ================================================================================

Change-Id: I3b2195ee0eee39b16cd05552c19c26072706125d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agodrm/panel: s6e3ha2: add VR mode support
Inki Dae [Thu, 26 May 2016 07:34:30 +0000 (16:34 +0900)]
drm/panel: s6e3ha2: add VR mode support

This patch adds VR mode support.

For this, it creates a new sysfs file which is used by user-space
to enable or disable VR mode like below,

To enable,
echo 1 > /sys/devices/platform/soc/13900000.dsi/13900000.dsi.0/vr

To disable,
echo 0 > /sys/devices/platform/soc/13900000.dsi/13900000.dsi.0/vr

Actually, this patch enables mDNIe feature of Panel device and
updates its Display color temperature to 6500K for VR mode.

Change-Id: I4e9f15134f57fa200e63ac8fa9d94c5300d6a340
Signed-off-by: Inki Dae <inki.dae@samsung.com>
7 years agopackaging: add build spec for gbs/obs for tm2
Seung-Woo Kim [Mon, 16 May 2016 04:07:52 +0000 (13:07 +0900)]
packaging: add build spec for gbs/obs for tm2

This patch adds build script for gbs/obs for tm2/tm2e.

Change-Id: I4bcd1a9d2b6ae26fd65e54f56c84624335192b8c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agobuild: add fit image build and mkimage tools to create fit image
Seung-Woo Kim [Fri, 20 May 2016 01:28:23 +0000 (10:28 +0900)]
build: add fit image build and mkimage tools to create fit image

This patch fixes local build script to make fit image also and
x86_32 prebuilt mkimage tool to create fit image.
Also boot.img style image creation and tools for boot.img are
removed.

Change-Id: I7dedb2d40a8a5c672f01271951551b660c5f7013
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agodrm/exynos: fimc: fix wrong buf_id access for dma channel
Seung-Woo Kim [Mon, 31 Aug 2015 03:07:55 +0000 (12:07 +0900)]
drm/exynos: fimc: fix wrong buf_id access for dma channel

For destination buffers, buf_id is valid only less than maximum
dest buffer count. So this patch fixes wrong buf_id access to
dma_channel.

Change-Id: I4c73ab90a2fc8e57ecb82f277d3d53c2e91b910a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM64: configs: revert defconfig into default and add tizen_tm2_defconfig
Jaehoon Chung [Thu, 19 May 2016 04:03:45 +0000 (13:03 +0900)]
ARM64: configs: revert defconfig into default and add tizen_tm2_defconfig

This patch reverts arm64 defconfig into default defconfig in v4.1 and
adds tizen_tm2_defconfig. Also it fixes proper defconfig from local
build script.

Change-Id: Ic167bb2edc61f4fb25bade2e69e46f9549b7ae4e
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agodrm/exynos/mic: fix timing calculation
Andrzej Hajda [Tue, 10 May 2016 13:45:48 +0000 (15:45 +0200)]
drm/exynos/mic: fix timing calculation

MIC_BS_SIZE_2D depends only on hactive.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ie6120a2b6aef251f0bfb295b41666dac5f9c5e42

7 years agodrm/panel/s6e3ha2: fix initialization sequence
Andrzej Hajda [Tue, 10 May 2016 13:36:51 +0000 (15:36 +0200)]
drm/panel/s6e3ha2: fix initialization sequence

Panel datasheet is not clear about it but directly after dsi interface
setting and calibration of panel, DSIM/MIC should start transmission, panel
should then wait 120ms and finish its initialization.
The patch fixes frequent image loss on draco board.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I194d5bae87bac0e436469d6f5949ee756656b16b

7 years agodrm/panel/s6e3ha2: fix tear-on sequence
Andrzej Hajda [Mon, 9 May 2016 13:04:05 +0000 (15:04 +0200)]
drm/panel/s6e3ha2: fix tear-on sequence

Tear-On sequence should have one argument.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I37aa1c368ff691499e225fdd108e168fe0a449ac

7 years agodrm/panel/s6e3ha2: fix frequency calibration on 1440p displays
Andrzej Hajda [Thu, 28 Apr 2016 09:58:48 +0000 (11:58 +0200)]
drm/panel/s6e3ha2: fix frequency calibration on 1440p displays

The driver support 1440p and 1600p displays, to support both models correctly
it should send different frequency calibration sequence.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ic38d4eb357609be0d1a67c655c5c110559b08bd3

7 years agodrm/panel/s6e3ha2: fix calibration sequence
Andrzej Hajda [Wed, 27 Apr 2016 14:04:44 +0000 (16:04 +0200)]
drm/panel/s6e3ha2: fix calibration sequence

Panel TE interrupt was signaled with variable frequency 53-60 fps.
This patch fixes it to about 60 fps.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Icf88caae7eed9ea540158a17a6745a0265948265

7 years agosoc: exynos: pm_domains: restore old way of getting dt clocks
Marek Szyprowski [Thu, 19 May 2016 11:12:37 +0000 (13:12 +0200)]
soc: exynos: pm_domains: restore old way of getting dt clocks

This restores support for asb clocks, which got lost during core rewrite.

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

7 years agodrm/exynos: gsc: force to use zero buf_id for src and dst
Marek Szyprowski [Thu, 19 May 2016 10:15:23 +0000 (12:15 +0200)]
drm/exynos: gsc: force to use zero buf_id for src and dst

Exynos DRM GSC IPP subdriver supports only processing a single src/dst
buffer pair, so don't use any other buf_id to avoid accessing
uninitialized buffers (IOMMU page fault).

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

7 years agomedia: s5p-mfc: fix build warning
Marek Szyprowski [Thu, 19 May 2016 10:35:34 +0000 (12:35 +0200)]
media: s5p-mfc: fix build warning

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

7 years agomedia: s5p-mfc: exynos5422 doesn't provide sclk clock to MFC block
Marek Szyprowski [Thu, 19 May 2016 10:31:42 +0000 (12:31 +0200)]
media: s5p-mfc: exynos5422 doesn't provide sclk clock to MFC block

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

7 years agodrm/exynos: gsc: normalize invalid buf idx from userspace
Hyungwon Hwang [Mon, 24 Aug 2015 10:33:27 +0000 (19:33 +0900)]
drm/exynos: gsc: normalize invalid buf idx from userspace

At least in the one frame processing mode which is the only mode supported
by the current gsc driver, the buf idx is not meaningful for the driver.
Because only one address in the buffer is valid at a time, so it is OK to
convert the invalid buf idx from userspace to a valid idx, process the
frame, and return the result with original buf idx.

Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8257cd39e33382f214ce4573e4a79f15ea498aab

7 years agoRevert "drm/exynos: gsc: always use hw buffer 0 until queue management get fixed"
Marek Szyprowski [Thu, 19 May 2016 10:15:23 +0000 (12:15 +0200)]
Revert "drm/exynos: gsc: always use hw buffer 0 until queue management get fixed"

This reverts commit 937b633eebe825aad14181b168c5b79eccad833d.

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

7 years agodrm/exynos: mixer: enable video overlay plane only when VP is available
Marek Szyprowski [Mon, 30 Nov 2015 13:53:24 +0000 (14:53 +0100)]
drm/exynos: mixer: enable video overlay plane only when VP is available

Video overlay plane should be registered only when suitable hardware
sub-block (Video Processor) is available.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
[backport of mainline commit ab14420125c3cd1111f57731f0f9359c4e64d76a
 to let Enlightenment to use video/osd graphics plane]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Iea4dd02abb408aa188b46f6ed099b0231ef99b6d

7 years agonet: bcm4358: remove unused config for pci binding
Jaehoon Chung [Thu, 19 May 2016 03:56:34 +0000 (12:56 +0900)]
net: bcm4358: remove unused config for pci binding

This patch removes unused config for pci binding in bcm4358 driver.

Change-Id: Ib82010c667224a9ed323c52f604e3183f62f42a7
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoarm64: build: add tizen-tm2 its file to create kernel image for u-boot
Jaehoon Chung [Wed, 18 May 2016 04:28:41 +0000 (13:28 +0900)]
arm64: build: add tizen-tm2 its file to create kernel image for u-boot

This patch adds tizen-tm2 its file to create kernel image for u-boot.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable usb acm driver config
Seung-Woo Kim [Tue, 3 May 2016 06:07:50 +0000 (15:07 +0900)]
ARM: odroidxu3_defconfig: enable usb acm driver config

This patch enables usb cdc-acm driver config to support /dev/ttyACM#
nodes for ACM class devices.

Change-Id: I8531129aeabd504bb5f43a34379a1a2b6634a65c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable dm_crypt
Seung-Woo Kim [Wed, 20 Apr 2016 06:43:54 +0000 (15:43 +0900)]
ARM: odroidxu3_defconfig: enable dm_crypt

This patch enables dm_crypto config instead of building as a
module to manage encrypted disk.

Change-Id: Ic1639439a473cc2cd2e5206de282798d2e9f3973
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable cp210x usb serial driver
Seung-Woo Kim [Wed, 6 Apr 2016 08:43:23 +0000 (17:43 +0900)]
ARM: odroidxu3_defconfig: enable cp210x usb serial driver

This patch enables cp210x usb serial driver. It is required to use
specific usb serial dongle.

Change-Id: I1e0a991ec4e467fd236a1806d672a42faa996081
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoavoid not-allowable mutex lock condition
Kunhoon Baik [Wed, 30 Mar 2016 08:59:31 +0000 (17:59 +0900)]
avoid not-allowable mutex lock condition

Change-Id: Icd2c90535687558aa3f294471edb865ef178a5b4
Signed-off-by: Kazimierz Krosman <k.krosman@samsung.com>
7 years agopackaging: enable KDBUS for odroidxu3
Paul Osmialowski [Thu, 9 Jul 2015 16:27:32 +0000 (18:27 +0200)]
packaging: enable KDBUS for odroidxu3

CONFIG_KDBUS=y line added to odroidxu3_defconfig in the exact spot where it is
usually placed in .config file.

Change-Id: I019070af680aa8f1316cd2c2d069731d19f7c5b4
Signed-off-by: Paul Osmialowski <p.osmialowsk@samsung.com>
7 years agokdbus: disable internal kdbus policy
Lukasz Skalski [Mon, 24 Aug 2015 16:54:46 +0000 (18:54 +0200)]
kdbus: disable internal kdbus policy

Possibilities of connections to own, see and talk to well-known names
are already restricted by LSM hooks.

Change-Id: I62d86a506a85e6c48bdd3e0f8b11f1aa5a918c75
Signed-off-by: Lukasz Skalski <l.skalski@samsung.com>
7 years agoclk: samsung: exynos5420: Add pll_rate_table and clock id for EPLL
Chanwoo Choi [Tue, 29 Dec 2015 01:42:39 +0000 (10:42 +0900)]
clk: samsung: exynos5420: Add pll_rate_table and clock id for EPLL

This patch add the clock id of EPLL to handle it on devicetree file
and the rate tables. EPLL is used as root clock of ASS (Audio Subsystem).

Change-Id: Iefcbd5ea4cb911a3b5d75888286926773a98af54
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agodrm/exynos: mixer: add experimental support for 1024x600@43Hz mode
Marek Szyprowski [Tue, 26 Jan 2016 08:45:13 +0000 (09:45 +0100)]
drm/exynos: mixer: add experimental support for 1024x600@43Hz mode

This patch adds experimental configuration data for HDMI PHY for 32MHz
pixel clock modes. This enables support for WaveShare 7inch HDMI LCD (C)
HDMI panel.

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

7 years agodrm/exynos: rotator: remove unnecessary cur_buf_id
Seung-Woo Kim [Mon, 31 Aug 2015 03:59:17 +0000 (12:59 +0900)]
drm/exynos: rotator: remove unnecessary cur_buf_id

After commit 2af026584c81faa37f26b86713d6331ddf70e3f3,
'drm/exynos: ipp: introduce last_buf_id', each driver do not need
to handler buf_id for the event. So this patch removes unnecessary
cur_buf_id from rotator.

Change-Id: Idd80765c41260ae6ce4488e56b0d4beaea76229a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: DTS: exynos5420: add GSCL block parent clock management to pm domain
Marek Szyprowski [Tue, 1 Sep 2015 09:23:09 +0000 (11:23 +0200)]
ARM: DTS: exynos5420: add GSCL block parent clock management to pm domain

Add support for restoring GSCALLER parent clocks configuration when GSCL
power domain is turned on.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agoclk: samsung: exynos5422: add missing parent GSCL block clocks
Marek Szyprowski [Tue, 1 Sep 2015 09:22:18 +0000 (11:22 +0200)]
clk: samsung: exynos5422: add missing parent GSCL block clocks

This patch adds clocks, which are required for preserving parent clock
configuration on GSCALLER power domain on/off.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agoclk: samsung: exynos5422: fix MFC clock hierarchy parent
Marek Szyprowski [Mon, 31 Aug 2015 11:52:43 +0000 (13:52 +0200)]
clk: samsung: exynos5422: fix MFC clock hierarchy parent

Proper source for MFC block is mout_user_aclk333 (in datasheet named
USER_MUX_ACLK_333), not the output of CLKDIV_ACLK_333 MUX.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable UACCESS_WITH_MEMCPY
Junghak Sung [Wed, 16 Sep 2015 06:23:34 +0000 (15:23 +0900)]
ARM: odroidxu3_defconfig: enable UACCESS_WITH_MEMCPY

Enable CONFIG_UACCESS_WITH_MEMCPY for odroid-xu3.
Fix an issue that sometimes TS data is broken when DVB demux pass the data
to user-space by using copy_to_user.

Change-Id: I7994f193871e70afe31df9c7abdd75b8909b587d
Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable zram feature
Seung-Woo Kim [Mon, 7 Dec 2015 09:45:35 +0000 (18:45 +0900)]
ARM: odroidxu3_defconfig: enable zram feature

This patch enables zram feature which is used by Tizen resourced.

Change-Id: I3f35f1c53ce60d64263064ed9b5b8221e1b63bb4
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable CONFIG_USB_RTL8152
Joonyoung Shim [Tue, 25 Aug 2015 09:17:16 +0000 (18:17 +0900)]
ARM: odroidxu3_defconfig: enable CONFIG_USB_RTL8152

Enable CONFIG_USB_RTL8152 for Odroid-XU4.

Change-Id: Iab87b058f01c0b8cd376d1fa4d84099ab412ba9a
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoARM: odroidxu3_defconfig: enable rt2x00 wifi usb drivers
Seung-Woo Kim [Mon, 6 Jul 2015 07:39:25 +0000 (16:39 +0900)]
ARM: odroidxu3_defconfig: enable rt2x00 wifi usb drivers

This patch enables rt2x00 wifi usb drivers to support rt5572n.

Change-Id: I1d7f9c71e9cb60c83986f4e90cb1edd7557333df
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: dts: Add Odroid-XU4 support
Joonyoung Shim [Tue, 25 Aug 2015 09:08:29 +0000 (18:08 +0900)]
ARM: dts: Add Odroid-XU4 support

The Odroid-XU4 is almost the same as XU3, except usb otg, DP, audio
codec and power monitoring sensors. This patch makes common dtsi file
and dts file for XU4.

We will add more features on dts for XU4 later.

Change-Id: I6536b9cfa4a4441e392bfe17011968be64c97b3e
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agoARM: odroidxu3_defconfig: disable CONFIG_RTC_DRV_S3C
Joonyoung Shim [Mon, 24 Aug 2015 07:52:32 +0000 (16:52 +0900)]
ARM: odroidxu3_defconfig: disable CONFIG_RTC_DRV_S3C

Odroid-XU3 board has two rtc devices - SoC rtc(rtc-s3c) and pmic rtc
(rtc-s5m), so two device nodes for rtc like /dev/rtc0 and /dev/rtc1 will
be created.

The pmic rtc can keep time via rtc backup battery, so tizen platform
will want to use pmic rtc than SoC rtc but it can't know which device
node is for pmic rtc.

This patch disables CONFIG_RTC_DRV_S3C, then tizen platform can use only
pmic rtc.

Change-Id: Ie4256d547c9263c6bcb0302aacd7fbd3b47a4048
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agortc: s3c: remove unnecessary NULL assignment
Joonyoung Shim [Tue, 11 Aug 2015 10:29:11 +0000 (19:29 +0900)]
rtc: s3c: remove unnecessary NULL assignment

It's unnecessary the code that assigns info->rtc_clk to NULL in
s3c_rtc_remove.

Change-Id: I6a735e4fc010a208068305ee8ccd9c5f0cdaa6ad
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agortc: s3c: add missing clk control
Joonyoung Shim [Tue, 11 Aug 2015 07:15:53 +0000 (16:15 +0900)]
rtc: s3c: add missing clk control

It's missed to call clk_unprepare() about info->rtc_src_clk in
s3c_rtc_remove and to call clk_disable_unprepare about info->rtc_clk in
error routine of s3c_rtc_probe.

Change-Id: Ia338db2dd1be2d9fc21d3455f91fba1dbff01a89
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 years agoARM: dts: odroidxu3: Enable wake alarm of S2MPS11 RTC
Krzysztof Kozlowski [Sat, 30 May 2015 06:33:21 +0000 (15:33 +0900)]
ARM: dts: odroidxu3: Enable wake alarm of S2MPS11 RTC

The IRQB of S2MPS11 PMIC is wired to XEINT4 (GPX0-4) through pull-up
resistor.

Add interrupt properties and pinctrl configuration to enable RTC wake
alarm of rtc-s5m driver. This also removes a warning:
sec_pmic 4-0066: No interrupt specified, no interrupts

Change-Id: I3aa4d802ca9ff19f7b9cda2bbb178476aca19a9a
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
7 years agoARM: dts: add 'rtc_src' clock to rtc node for exynos5422-odroidxu3
Markus Reichl [Sun, 3 May 2015 16:34:29 +0000 (18:34 +0200)]
ARM: dts: add 'rtc_src' clock to rtc node for exynos5422-odroidxu3

The Exynos5422 SoC has a s3c6410 RTC where the source clock
is now a mandatory property.

This patch fixes probe failure of s3c-rtc on Odroid-XU3 boards.

Change-Id: Ie197965fb99f980deffddb96821f4c8a00bf69b8
Signed-off-by: Markus Reichl <m.reichl@fivetechno.de>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
7 years agoclk: samsung: Add bindings for 32kHz clocks from s2mps11
Markus Reichl [Tue, 31 Mar 2015 11:57:20 +0000 (13:57 +0200)]
clk: samsung: Add bindings for 32kHz clocks from s2mps11

This creates include/dt-bindings/clock/samsung,s2mps11.h with
the three 32kHz clock outputs from the s2mps11 mfd.

Change-Id: I2e6de74e55b980d56f192344d712f1caca1a7ed9
Signed-off-by: Markus Reichl <m.reichl@fivetechno.de>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
7 years agoARM: EXYNOS: use PS_HOLD based poweroff for all supported SoCs
Marek Szyprowski [Mon, 9 Feb 2015 07:25:41 +0000 (08:25 +0100)]
ARM: EXYNOS: use PS_HOLD based poweroff for all supported SoCs

PS_HOLD based power off procedure is common for all Exynos SoCs,
so use it for every Exynos SoCs.

Change-Id: I4c71a13430f088c9709fa6067b47a8da34f5da5e
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>
Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
7 years agoARM: dts: Add MSHC2 dt node for Exynos3250 SoC
Chanwoo Choi [Fri, 17 Jul 2015 11:22:27 +0000 (20:22 +0900)]
ARM: dts: Add MSHC2 dt node for Exynos3250 SoC

This patch add the MSHC2 (Mobile Storage Host Controller) devicetree node for
Exynos3250 SoC.

Change-Id: Ia8850063ad90b986b1371952c879676a608fe3f1
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoARM: dts: Add UART2 dt node for Exynos3250 SoC
Chanwoo Choi [Fri, 17 Jul 2015 05:49:08 +0000 (14:49 +0900)]
ARM: dts: Add UART2 dt node for Exynos3250 SoC

This patch add the uart2 devicetree node for Exynos3250 SoC.

Change-Id: I28dd84bc645e26f14b7d0c7d630870cc812dccd8
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoclk: samsung: exynos3250: Add MMC2 clock
Chanwoo Choi [Fri, 17 Jul 2015 11:48:38 +0000 (20:48 +0900)]
clk: samsung: exynos3250: Add MMC2 clock

This patch add the MMC2 clocks (mux, divider, gate) of Exynos3250 SoC.

Change-Id: Ib0c194e09f6ed171ba1a84a35a96f651b615666f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoclk: samsung: exynos3250: Add UART2 clock
Chanwoo Choi [Fri, 17 Jul 2015 05:51:01 +0000 (14:51 +0900)]
clk: samsung: exynos3250: Add UART2 clock

This patch add the UART2 clocks (mux, divider, gate) of Exynos3250 SoC.

Change-Id: I5b013ed835a3985659f956b2bd3e64dbeeca7369
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
7 years agoRevert "[media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init"
Marek Szyprowski [Thu, 2 Jul 2015 08:57:15 +0000 (10:57 +0200)]
Revert "[media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init"

This reverts commit e6c9dec3e7d68c477768e2955c7f8ed78a09bfd6.

7 years agodrm/exynos: fix vsync interrupt clear rountine of mixer
Joonyoung Shim [Wed, 1 Jul 2015 04:14:57 +0000 (13:14 +0900)]
drm/exynos: fix vsync interrupt clear rountine of mixer

INT_EN_VSYNC bit is not used when we clear vsync interrupt but
INT_STATUS_VSYNC bit should be related.

Also, if we want to enable vsync interrupt, we should write 1 in
INT_CLEAR_VSYNC bit before we set INT_EN_VSYNC bit. It will clear prior
vsync interrupt. You can check it from exynos mixer user manual.

Change-Id: Ide955d5cb966e49883c51d8fab0eba51897bac7a
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
7 years agodrm/exynos: mixer: set the framebuffer source size by 0 when a layer is disabled
Joonyoung Shim [Mon, 8 Jun 2015 06:10:31 +0000 (15:10 +0900)]
drm/exynos: mixer: set the framebuffer source size by 0 when a layer is disabled

Repeately turning on and off a layer, sometimes page fault occurs. This
problem seems to happen, because of H/W malfunction during turning on
the layer. But it can be solved by setting the framebuffer source size
by 0.

Kernel dump:
[   24.646472] PAGE FAULT occurred at 0x23000000 by 14650000.sysmmu(Page table base: 0x6d924000)
[   24.653515]  Lv1 entry: 0x6e3b1001
[   24.656945] ------------[ cut here ]------------
[   24.661485] kernel BUG at drivers/iommu/exynos-iommu.c:358!
[   24.667030] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[   24.672836] Modules linked in:
[   24.675872] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.0.0-00007-g838e0df #136
[   24.683145] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   24.689214] task: c0e1aff0 ti: c0e0c000 task.ti: c0e0c000
[   24.694597] PC is at exynos_sysmmu_irq+0x1b8/0x2c4
[   24.699358] LR is at vprintk_emit+0x2a0/0x550
[   24.703684] pc : [<c036e530>]    lr : [<c00705d0>]    psr: 60070193
[   24.703684] sp : c0e0dd90  ip : 00000000  fp : c0e0ddcc
[   24.715121] r10: ee22e610  r9 : 00000000  r8 : ee22e628
[   24.720321] r7 : ed875810  r6 : 23000000  r5 : ed924000  r4 : 00000000
[   24.726820] r3 : c0e98098  r2 : 00000000  r1 : 00000000  r0 : ed6819c0
[   24.733321] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[   24.740685] Control: 10c5387d  Table: 6cb8c06a  DAC: 00000015
[   24.746403] Process swapper/0 (pid: 0, stack limit = 0xc0e0c210)
[   24.752383] Stack: (0xc0e0dd90 to 0xc0e0e000)
[   24.756718] dd80:                                     c0e0dd9c c0932868 ffff28da 6d924000
[   24.764864] dda0: ffff2990 ee22d8c0 ee22f060 00000049 c0e34e34 c0e0c000 00000000 00000000
[   24.773009] ddc0: c0e0de14 c0e0ddd0 c0071fd8 c036e384 ffffffff 7fffffff c0e0ddf4 ee22f000
[   24.781155] dde0: c0e95dfc c0e95de8 c0e0de14 ee22f000 ee22f060 ee22d8c0 c0e34e34 ee004670
[   24.789300] de00: ee010800 c0e0df00 c0e0de34 c0e0de18 c007221c c0071f80 ee22f000 ee22f060
[   24.797446] de20: 00000017 c0e34e34 c0e0de4c c0e0de38 c007520c c00721dc 00000049 ee0283c0
[   24.805591] de40: c0e0de64 c0e0de50 c0071540 c0075144 0000001c ee0283c0 c0e0de8c c0e0de68
[   24.813737] de60: c02fe7e8 c0071510 00000017 00000000 00000017 00000000 00000001 ee010800
[   24.821882] de80: c0e0dea4 c0e0de90 c0071540 c02fe750 c0e08a1c 00000000 c0e0ded4 c0e0dea8
[   24.830028] dea0: c0071880 c0071510 c0e0df00 f000200c 00000017 c0e140a8 c0e0df00 f0002000
[   24.838173] dec0: c0e96374 c0936d0c c0e0defc c0e0ded8 c0008734 c0071800 c0010d88 60070013
[   24.846319] dee0: ffffffff c0e0df34 00000001 c0e96374 c0e0df54 c0e0df00 c0014780 c0008700
[   24.854464] df00: 00000001 00000000 00000000 c0020720 c0e0c000 c0e13530 00000000 00000000
[   24.862610] df20: 00000001 c0e96374 c0936d0c c0e0df54 c0e0df58 c0e0df48 c0010d84 c0010d88
[   24.870755] df40: 60070013 ffffffff c0e0df94 c0e0df58 c00626d8 c0010d4c 00000001 c0eb1f00
[   24.878901] df60: c0e95ab0 c0e0df70 c0e1353c c0e0a580 00000002 c0e13e84 c0e09b88 c0e0df58
[   24.887046] df80: c092e1b8 ffffffff c0e0dfac c0e0df98 c0928880 c00622fc c0e13e10 c0eb1f00
[   24.895192] dfa0: c0e0dff4 c0e0dfb0 c0d57d2c c09287f8 ffffffff ffffffff c0d576ec 00000000
[   24.903337] dfc0: 00000000 c0dc1420 00000000 c0eb22d4 c0e134c0 c0dc141c c0e1c20c 4000406a
[   24.911483] dfe0: 410fc073 00000000 00000000 c0e0dff8 40008074 c0d57968 00000000 00000000
[   24.919641] [<c036e530>] (exynos_sysmmu_irq) from [<c0071fd8>] (handle_irq_event_percpu+0x64/0x25c)
[   24.928644] [<c0071fd8>] (handle_irq_event_percpu) from [<c007221c>] (handle_irq_event+0x4c/0x6c)
[   24.937483] [<c007221c>] (handle_irq_event) from [<c007520c>] (handle_level_irq+0xd4/0x14c)
[   24.945802] [<c007520c>] (handle_level_irq) from [<c0071540>] (generic_handle_irq+0x3c/0x4c)
[   24.954209] [<c0071540>] (generic_handle_irq) from [<c02fe7e8>] (combiner_handle_cascade_irq+0xa4/0x110)
[   24.963653] [<c02fe7e8>] (combiner_handle_cascade_irq) from [<c0071540>] (generic_handle_irq+0x3c/0x4c)
[   24.973009] [<c0071540>] (generic_handle_irq) from [<c0071880>] (__handle_domain_irq+0x8c/0xfc)
[   24.981676] [<c0071880>] (__handle_domain_irq) from [<c0008734>] (gic_handle_irq+0x40/0x78)
[   24.989994] [<c0008734>] (gic_handle_irq) from [<c0014780>] (__irq_svc+0x40/0x74)
[   24.997440] Exception stack(0xc0e0df00 to 0xc0e0df48)
[   25.002469] df00: 00000001 00000000 00000000 c0020720 c0e0c000 c0e13530 00000000 00000000
[   25.010616] df20: 00000001 c0e96374 c0936d0c c0e0df54 c0e0df58 c0e0df48 c0010d84 c0010d88
[   25.018757] df40: 60070013 ffffffff
[   25.022234] [<c0014780>] (__irq_svc) from [<c0010d88>] (arch_cpu_idle+0x48/0x4c)
[   25.029595] [<c0010d88>] (arch_cpu_idle) from [<c00626d8>] (cpu_startup_entry+0x3e8/0x4bc)
[   25.037837] [<c00626d8>] (cpu_startup_entry) from [<c0928880>] (rest_init+0x94/0x98)
[   25.045544] [<c0928880>] (rest_init) from [<c0d57d2c>] (start_kernel+0x3d0/0x3dc)
[   25.052992] Code: e34c30e9 e5932004 e3520000 ca000018 (e7f001f2)
[   25.059058] ---[ end trace 91806a51727d6586 ]---

Change-Id: Ic134f206721e33335962d7e941741331ec72672b
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>