linux.git
6 years agoapalis-tk1: handle backlight in the device tree Apalis-TK1_LXDE-Image_2.8b2.97-20180331
Dominik Sliwa [Tue, 27 Mar 2018 14:36:23 +0000 (16:36 +0200)]
apalis-tk1: handle backlight in the device tree

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agopwm-backlight: Add optional enable GPIO
Thierry Reding [Fri, 30 Aug 2013 09:51:22 +0000 (11:51 +0200)]
pwm-backlight: Add optional enable GPIO

To support a wider variety of backlight setups, introduce an optional
enable GPIO. Legacy users of the platform data already have a means of
supporting GPIOs by using the .init(), .exit() and .notify() hooks. DT
users however cannot use those, so an alternative method is required.

In order to ease the introduction of the optional enable GPIO, make it
available in the platform data first, so that existing users can be
converted. Once that has happened a second patch will add code to make
use of it in the driver.

Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 2b9b1620349e325f184c68cddf3b484499c163c0)

6 years agopwm-backlight: Disable backlight on shutdown
Thierry Reding [Tue, 29 Apr 2014 15:28:59 +0000 (17:28 +0200)]
pwm-backlight: Disable backlight on shutdown

When a device is shut down, make sure to disable the backlight. If it
stays lit, it gives the impression that the device hasn't turned off.
Furthermore keeping the backlight on may consume power, which is not
what users expect when they shut down a device.

Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 5f33b896246a2d9bdf01352de11d4dab96ba2fc9)

6 years agobacklight: pwm_bl: Remove error message upon devm_kzalloc() failure
Fabio Estevam [Sun, 1 Dec 2013 15:04:03 +0000 (13:04 -0200)]
backlight: pwm_bl: Remove error message upon devm_kzalloc() failure

No need to have a specific OOM message, since there is generic MM out of memory
message in place.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit ca7a97add4d4a7b0602b3bd1eff5c89da8636713)

6 years agopwm-backlight: Remove unused variable
Thierry Reding [Tue, 22 Oct 2013 07:37:05 +0000 (09:37 +0200)]
pwm-backlight: Remove unused variable

I forgot to remove this during earlier cleanup patches and only checked
various builds for errors, not warnings.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 73d4e2b82b4bb1571b1a7f97012c0db8a0faef42)

6 years agopwm_backlight: avoid short blank screen while doing hibernation
Huayi Li [Wed, 9 Oct 2013 02:33:02 +0000 (10:33 +0800)]
pwm_backlight: avoid short blank screen while doing hibernation

Use SIMPLE_DEV_PM_OPS macro will initialize the member "freeze"
and "thaw" of pwm_backlight_pm_ops as below,
.freeze = suspend_fn,
.thaw = resume_fn,
then during the process of making hibernation snapshot, screen
will be blank at the moment of freezing, and then light at the
moment of thawing.
this is not the right user experience for suspending to disk.

so this patch drops freeze and thaw callback, make the LCD is
always lighting before the final shutdown.

Signed-off-by: Huayi Li <huayi.li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 1dea1fd09246ada581a99d0669108eea94b7bfee)

6 years agopwm-backlight: Fix brightness adjustment
Thierry Reding [Fri, 18 Oct 2013 08:46:24 +0000 (10:46 +0200)]
pwm-backlight: Fix brightness adjustment

Split adjustment of the brightness (by changing the PWM duty cycle) from
the power on sequence. This fixes an issue where the brightness can no
longer be updated once the backlight has been enabled.

Reported-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit e4bfeda96872bfe6015cd360008b77cd3b981b2b)

6 years agopwm-backlight: Allow for non-increasing brightness levels
Mike Dunn [Sun, 22 Sep 2013 16:59:56 +0000 (09:59 -0700)]
pwm-backlight: Allow for non-increasing brightness levels

Currently the driver assumes that the values specified in the
brightness-levels device tree property increase as they are parsed from
left to right.  But boards that invert the signal between the PWM output
and the backlight will need to specify decreasing brightness-levels.
This patch removes the assumption that the last element of the array is
the maximum value, and instead searches the array for the maximum value
and uses that in the duty cycle calculation.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 8f43e18e2769b3b28383903d501b4da29e388aad)

6 years agopwm-backlight: Add power supply support
Thierry Reding [Fri, 30 Aug 2013 10:38:34 +0000 (12:38 +0200)]
pwm-backlight: Add power supply support

Backlights require a power supply to work properly. This commit adds a
regulator to power up and power down the backlight.

Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 22ceeee16eb8f0d04de3ef43a5174fb30ec18af9)

6 years agopwm-backlight: Use new enable_gpio field
Thierry Reding [Fri, 30 Aug 2013 10:32:18 +0000 (12:32 +0200)]
pwm-backlight: Use new enable_gpio field

Make use of the new enable_gpio field and allow it to be set from DT as
well. Now that all legacy users of platform data have been converted to
initialize this field to an invalid value, it is safe to use the field
from the driver.

Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 8265b2e4e62632b01f998095d1bbda4d281629fe)

6 years agopwm-backlight: Track enable state
Thierry Reding [Wed, 2 Oct 2013 16:01:02 +0000 (18:01 +0200)]
pwm-backlight: Track enable state

Follow up patches will add support for more complex means of powering
the backlight on and off such as using a regulator. To prevent calls to
the regulator API from becoming unbalanced, keep track of the enabled
state internally.

Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 97c38437115aa0c3fb2d50c488814b503ba529e0)

6 years agopwm-backlight: Refactor backlight power on/off
Thierry Reding [Mon, 7 Oct 2013 09:32:02 +0000 (11:32 +0200)]
pwm-backlight: Refactor backlight power on/off

In preparation for adding an optional regulator and enable GPIO to the
driver, split the power on and power off sequences into separate
functions to reduce code duplication at the multiple call sites.

Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 62b744a87c1170b339f993aa3cfb22465974816a)

6 years agopwm-backlight: Improve readability
Thierry Reding [Mon, 7 Oct 2013 09:30:50 +0000 (11:30 +0200)]
pwm-backlight: Improve readability

Add more blank lines to increase readability. While at it, remove a
trailing blank line at the end of the file.

Signed-off-by: Thierry Reding <treding@nvidia.com>
(cherry picked from commit 668e63c6701d486c68b49ffffc0e5b7de1a2e95c)

6 years agobacklight: use dev_get_platdata()
Jingoo Han [Tue, 12 Nov 2013 23:09:04 +0000 (15:09 -0800)]
backlight: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.  This is a cosmetic change to
make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit c512794cada491e008eeca822af7e4ad5db72a56)

6 years agoRevert "video: backlight: pwm_bl: add pwm_gpio"
Dominik Sliwa [Tue, 27 Mar 2018 13:42:04 +0000 (15:42 +0200)]
Revert "video: backlight: pwm_bl: add pwm_gpio"

This reverts commit 95730406a0e3bbd7f862718782924a3c367845a1.

6 years agoRevert "video: backlight: EDP client for backlight"
Dominik Sliwa [Tue, 27 Mar 2018 13:41:54 +0000 (15:41 +0200)]
Revert "video: backlight: EDP client for backlight"

This reverts commit 74df06fb565b7250bc86d79727b66bb02259d54c.

6 years agoRevert "EDP: remove old system EDP framework (pwm backlight driver)"
Dominik Sliwa [Tue, 27 Mar 2018 13:36:25 +0000 (15:36 +0200)]
Revert "EDP: remove old system EDP framework (pwm backlight driver)"

This reverts commit 08a13bacb43f206239ae0f1ccbe37325993e2b1b.

6 years agoRevert "backlight: pwm: Converting benign message to info"
Dominik Sliwa [Tue, 27 Mar 2018 13:36:14 +0000 (15:36 +0200)]
Revert "backlight: pwm: Converting benign message to info"

This reverts commit 153a5d54d1a10c5a35f6923e0c6423430d2c7c89.

6 years agomfd: apalis-tk1-k20: separate common header file
Dominik Sliwa [Mon, 26 Mar 2018 15:12:22 +0000 (17:12 +0200)]
mfd: apalis-tk1-k20: separate common header file

Both firmware and kernel are using the same set of constants
in a header file, this patch separates them in to a single file.
That way it will be easier to track changes to FW or kernel.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: add atmel mxt-ts to device-trees
Dominik Sliwa [Thu, 22 Mar 2018 13:26:02 +0000 (14:26 +0100)]
apalis-tk1: add atmel mxt-ts to device-trees

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoinput: atmel_mxt_ts: support reset gpio line
Dominik Sliwa [Thu, 22 Mar 2018 12:08:22 +0000 (13:08 +0100)]
input: atmel_mxt_ts: support reset gpio line

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: add atmel mxt to defconfig
Dominik Sliwa [Thu, 22 Mar 2018 12:07:34 +0000 (13:07 +0100)]
apalis-tk1: add atmel mxt to defconfig

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoinput: touchscreen: atmel_mxt_ts: backport from kernel 4.9
Dominik Sliwa [Thu, 22 Mar 2018 10:47:34 +0000 (11:47 +0100)]
input: touchscreen: atmel_mxt_ts: backport from kernel 4.9

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: remove platform dc initialization
Dominik Sliwa [Wed, 21 Mar 2018 17:17:07 +0000 (18:17 +0100)]
apalis-tk1: remove platform dc initialization

DC initialization now relays only on device-tree entry.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1:lvds: add option to select 24-bit lvds mode
Dominik Sliwa [Wed, 21 Mar 2018 16:29:05 +0000 (17:29 +0100)]
apalis-tk1:lvds: add option to select 24-bit lvds mode

Add ability to switch between 24.1 and 24.0 lvds modes.
Mode description can be found in "Using 24-bpp LVDS Panels with
IntelĀ® Mobile Chipsets for Embedded Applications".

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: move display configuration to device-tree
Dominik Sliwa [Thu, 28 Sep 2017 11:19:32 +0000 (13:19 +0200)]
apalis-tk1: move display configuration to device-tree

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agocan: mfd: apalis-tk1: v1.1 frequency adjustments and various fixes
Dominik Sliwa [Mon, 12 Feb 2018 11:21:11 +0000 (12:21 +0100)]
can: mfd: apalis-tk1: v1.1 frequency adjustments and various fixes

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agomfd: apalis-tk1-k20: single transaction register read
Dominik Sliwa [Thu, 1 Feb 2018 11:52:56 +0000 (12:52 +0100)]
mfd: apalis-tk1-k20: single transaction register read

This change also modifies SPI clock for ezPort mode.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agocan: mfd: apalis-tk1-k20:increased clock speed, zero copy
Dominik Sliwa [Wed, 31 Jan 2018 16:43:22 +0000 (17:43 +0100)]
can: mfd: apalis-tk1-k20:increased clock speed, zero copy

Increased SPI speed for transfers and peripheral speed.
Switch to cleaning IRQ flags on read, instead of separate write.
Switched to zero-copy on SPI reads.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: fix wake on lan functionality Apalis-TK1_LXDE-Image_2.8b1.64-20171229
Dominik Sliwa [Mon, 11 Dec 2017 15:31:12 +0000 (16:31 +0100)]
apalis-tk1: fix wake on lan functionality

GPIO used for WOL is briefly used in i210 reset procedure.
This patch makes sure it's freed and can be used for a wakeup
source.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoperf tools: define _DEFAULT_SOURCE for glibc_2.20
Chanho Park [Fri, 12 Sep 2014 02:10:17 +0000 (11:10 +0900)]
perf tools: define _DEFAULT_SOURCE for glibc_2.20

_BSD_SOURCE was deprecated in favour of _DEFAULT_SOURCE since glibc
2.20[1]. To avoid build warning on glibc2.20, _DEFAULT_SOURCE should
also be defined.

[1]: https://sourceware.org/glibc/wiki/Release/2.20

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1410487817-13403-1-git-send-email-chanho61.park@samsung.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit 512fe365373b9c95a70b4b6357503ee74d27214f)

6 years agoapalis-tk1_defconfig: enable user debug
Stefan Agner [Thu, 30 Nov 2017 14:09:31 +0000 (15:09 +0100)]
apalis-tk1_defconfig: enable user debug

Let the kernel print some debug messages when a user program
crashes due to an exception.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agotegra: align graphics drivers with android binaries Apalis-TK1_LXDE-Image_2.7b5-20171201
Dominik Sliwa [Thu, 22 Jun 2017 10:41:18 +0000 (12:41 +0200)]
tegra: align graphics drivers with android binaries

Some functionality used by android binary drivers
were missing.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agomfd: apalis-tk1: 0.11 fw support
Dominik Sliwa [Fri, 24 Nov 2017 11:43:21 +0000 (12:43 +0100)]
mfd: apalis-tk1: 0.11 fw support

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agommc: Allow forward compatibility for eMMC
Romain Izard [Fri, 27 Jun 2014 08:51:07 +0000 (10:51 +0200)]
mmc: Allow forward compatibility for eMMC

As stated by the eMMC 5.0 specification, a chip should not be rejected
only because of the revision stated in the EXT_CSD_REV field of the
EXT_CSD register.

Remove the control on this value, the control of the CSD_STRUCTURE field
should be sufficient to reject future incompatible changes.

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit 03a59437ef6b6ad7fb0165cb9b96c08d6bf057fc)

6 years agoMerge tag 'tegra-l4t-r21.6' into toradex_tk1_l4t_r21.6
Marcel Ziswiler [Wed, 29 Nov 2017 13:56:42 +0000 (14:56 +0100)]
Merge tag 'tegra-l4t-r21.6' into toradex_tk1_l4t_r21.6

Merge NVIDIA's latest Linux for Tegra aka L4T R21.6 Linux kernel changes
from git://nv-tegra.nvidia.com/linux-3.10.git commit:

b271e8fa67a6d9c4600274a25636cfe00fdd1b68

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoRevert "spi-tegra114: Warning when clock rate switch fails"
Marcel Ziswiler [Wed, 29 Nov 2017 12:55:15 +0000 (13:55 +0100)]
Revert "spi-tegra114: Warning when clock rate switch fails"

This reverts commit 8fdf8dc5afdb02625084356ebd7c0d1c7494a00e.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoRevert "mmc: Allow forward compatibility for eMMC"
Marcel Ziswiler [Wed, 29 Nov 2017 12:54:42 +0000 (13:54 +0100)]
Revert "mmc: Allow forward compatibility for eMMC"

This reverts commit 0293e897d740cc7991c82567aab5dee0e66294fd.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agomedia: ov5640: major driver cleanup
Peter Gielda [Tue, 17 Oct 2017 06:14:45 +0000 (08:14 +0200)]
media: ov5640: major driver cleanup

Signed-off-by: Peter Gielda <pgielda@antmicro.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoARM: tegra: apalis-tk1: use high vil/vih receivers for ddc
Dominik Sliwa [Tue, 17 Oct 2017 11:39:23 +0000 (13:39 +0200)]
ARM: tegra: apalis-tk1: use high vil/vih receivers for ddc

DDC/EDID detection was failing on Apalis TK1 V1.2A on Ixora.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agomfd: apalis-tk1-k20: clean-up and fix support for 0.10 k20 fw Apalis-TK1_LXDE-Image_2.7b4-20171007
Dominik Sliwa [Tue, 3 Oct 2017 15:22:39 +0000 (17:22 +0200)]
mfd: apalis-tk1-k20: clean-up and fix support for 0.10 k20 fw

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoARM: tegra: apalis-tk1: annotate and fix gpio configuration
Marcel Ziswiler [Wed, 4 Oct 2017 14:32:40 +0000 (16:32 +0200)]
ARM: tegra: apalis-tk1: annotate and fix gpio configuration

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agomfd: apalis-tk1-k20: support for 0.10 k20 fw
Dominik Sliwa [Tue, 3 Oct 2017 15:22:39 +0000 (17:22 +0200)]
mfd: apalis-tk1-k20: support for 0.10 k20 fw

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoARM: tegra: apalis-tk1: move hdmi ddc config to dt
Dominik Sliwa [Tue, 3 Oct 2017 12:58:33 +0000 (14:58 +0200)]
ARM: tegra: apalis-tk1: move hdmi ddc config to dt

We moved HDMI DDC configuration to the device-tree.
If DDC config is missing from the device-tree
we default to v1.2 config.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoARM: tegra: apalis-tk1: support v1.2 hardware revision
Marcel Ziswiler [Tue, 3 Oct 2017 00:05:17 +0000 (02:05 +0200)]
ARM: tegra: apalis-tk1: support v1.2 hardware revision

Support the V1.2 hardware revision with the following pin muxing
changes:

Ddc_scl_pv4 and ddc_sda_pv5 previously used as Apalis GPIO3 and GPIO4
are now used as DDC pins.

Gen2_i2c_scl_pt5 and gen2_i2c_sda_pt6 previously used as DDC pins are
now used as USB power enable signals.

Usb_vbus_en0_pn4 and usb_vbus_en1_pn5 previously used as USB power
enable signals are now used as GPIO3 and GPIO4.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoARM: dts: tegra124: update model and compatibility nodes
Marcel Ziswiler [Tue, 3 Oct 2017 00:02:59 +0000 (02:02 +0200)]
ARM: dts: tegra124: update model and compatibility nodes

Update model and compatibility nodes to be more in-line with mainline.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agopinctrl: tegra: clean-up
Marcel Ziswiler [Mon, 2 Oct 2017 23:59:55 +0000 (01:59 +0200)]
pinctrl: tegra: clean-up

Cosmetic clean-up to bring it more in-line with mainline driver in order
to be able to easily assess whether it is all kosher.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoBluetooth: Properly check L2CAP config option output buffer length
Ben Seri [Wed, 13 Sep 2017 08:34:32 +0000 (14:04 +0530)]
Bluetooth: Properly check L2CAP config option output buffer length

Validate the output buffer length for L2CAP config requests and responses
to avoid overflowing the stack buffer used for building the option blocks.

Bug 1989825

Change-Id: Id158ece2176c4ac339a7232dfde8c47ce2241122
Cc: stable@vger.kernel.org
Signed-off-by: Ben Seri <ben@armis.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1558952
(cherry picked from commit c005032a3ffe77437f6ebc704af377fc9bc46279)
Reviewed-on: https://git-master.nvidia.com/r/1570529
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Tested-by: Winnie Hsu <whsu@nvidia.com>
6 years agoARM: tegra: Select appropriate DMA options for LPAE
Paul Kocialkowski [Mon, 24 Apr 2017 22:59:46 +0000 (00:59 +0200)]
ARM: tegra: Select appropriate DMA options for LPAE

This automatically selects options for zone DMA and 64 bit DMA addresses
when LPAE is enabled on ARM Tegra platforms. These options are required
for proper operation with LPAE enabled.

The ZONE_DMA option is required to ensure that drivers that allocate DMA
memory get buffers from the first 4 GiB. This is necessary because a lot
of the controllers only support addressing 32 bits.

As for ARCH_DMA_ADDR_T_64BIT, there are situations where devices that do
support addresses of more than 32 bits (such as the display controller
or the GPU) can run without translating addresses through an IOMMU on a
device with more than 4 GiB of system memory.

Note that both of these options are stop-gap solutions required only
until the IOMMU can be properly integrated with the DMA mapping API and
drivers use that properly and consistently.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
[treding@nvidia.com: specify rationale for options]
Signed-off-by: Thierry Reding <treding@nvidia.com>
(backported from commit 6aa26c5d66595494e810c791602d87a572c78808)

6 years agodp.c: fix compilation with gcc 7
Max Krummenacher [Mon, 24 Jul 2017 12:26:51 +0000 (14:26 +0200)]
dp.c: fix compilation with gcc 7

With gcc 7 the following compile time error occurs:

| drivers/video/tegra/dc/dp.c:1178:12: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses]
|   cr_done ? : ({ret = -EINVAL; goto fail; });
|             ^
| drivers/video/tegra/dc/dp.c:1186:12: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses]
|   lt_done ? : ({ret = -EINVAL; goto fail; });
|             ^

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agotegra11_soctherm.c: fix compilation with gcc 7
Max Krummenacher [Mon, 24 Jul 2017 12:11:40 +0000 (14:11 +0200)]
tegra11_soctherm.c: fix compilation with gcc 7

With gcc 7 the following compile time error occurs:

| arch/arm/mach-tegra/tegra11_soctherm.c:2978:40: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses]
|    s->sensor_enable = s->sensor_enable ?: therm->zone_enable;
|                                         ^

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agodsi.c: fix compilation with gcc 7
Max Krummenacher [Mon, 24 Jul 2017 12:00:02 +0000 (14:00 +0200)]
dsi.c: fix compilation with gcc 7

With gcc 7 the following compile time error occurs:

| drivers/video/tegra/dc/dsi.c:766:34: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
| drivers/video/tegra/dc/dsi.c:757:1:
|  (platform_t_phy_ps) ? ( \
|  ~~~~~~~~~~~~~~~~~~~
| kernel-source/drivers/video/tegra/dc/dsi.c:766:34:
|    dsi->info.phy_timing.t_tlpx_ns * 1000,
| drivers/video/tegra/dc/dsi.c:757:2: note: in definition of macro 'SELECT_T_PHY'
|  (platform_t_phy_ps) ? ( \
|   ^~~~~~~~~~~~~~~~~

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agopowergate-t12x.c: fix compilation with gcc 7
Max Krummenacher [Mon, 24 Jul 2017 11:53:02 +0000 (13:53 +0200)]
powergate-t12x.c: fix compilation with gcc 7

With gcc 7 the following compile time error occurs:

| arch/arm/mach-tegra/powergate-t12x.c:814:10: error: statement will never be executed [-Werror=switch-unreachable]
|    return true;
|           ^~~~

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agotegra_udc.c: fix compilation with gcc 7
Max Krummenacher [Mon, 24 Jul 2017 09:30:15 +0000 (11:30 +0200)]
tegra_udc.c: fix compilation with gcc 7

With gcc 7 the following compile time error occurs:

| .../drivers/usb/gadget/tegra_udc.c:2565:17: error: 'out' directive writing 3 bytes into a region of size between 2 and 11 [-Werror=format-overflow=]
|    sprintf(name, "ep%dout", i);
|                  ^~~~~~~~~
| .../drivers/usb/gadget/tegra_udc.c:2565:3: note: 'sprintf' output between 7 and 16 bytes into a destination of size 14
|    sprintf(name, "ep%dout", i);
|    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

The last end point will never be greater than 32 but the compiler can
not find this out from the code. Work around this by passing a format
specifier to interpreat i as a signed char.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: activate pwm pin muxing for pwm3
Marcel Ziswiler [Tue, 5 Sep 2017 14:14:21 +0000 (16:14 +0200)]
apalis-tk1: activate pwm pin muxing for pwm3

Activate PWM pin muxing for Apalis PWM3. Note that the same PWM3 is
already active on pu6 being Apalis BKL1_PWM as well. Therefore exporting
that one for raw sysfs access will fail and one has to revert to using
the pwm backlight.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoapalis-tk1: enable large physical address extension lpae
Marcel Ziswiler [Tue, 5 Sep 2017 11:44:43 +0000 (13:44 +0200)]
apalis-tk1: enable large physical address extension lpae

Enable support for the Large Physical Address Extension aka LPAE.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agomfd: apalis-tk1: fix NULL pointer dereference
Dominik Sliwa [Thu, 17 Aug 2017 12:29:20 +0000 (14:29 +0200)]
mfd: apalis-tk1: fix NULL pointer dereference

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agospi: tegra: fix warning when using controller-data
Dominik Sliwa [Thu, 17 Aug 2017 11:35:22 +0000 (13:35 +0200)]
spi: tegra: fix warning when using controller-data

Tegra spi driver was using devm_kzalloc before dev
was bound.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoapalis-tk1: fix pcie reset for reliable gigabit ethernet operation
Marcel Ziswiler [Thu, 10 Aug 2017 13:28:40 +0000 (15:28 +0200)]
apalis-tk1: fix pcie reset for reliable gigabit ethernet operation

It turns out that the current PCIe reset implementation is not quite
working reliably due to some Intel i210 errata. Fix this by making sure
the i210's +V3.3_ETH rail is properly disabled during its reset
sequence.

Also further improve on the bringing up the PCIe switch as found on the
Apalis Evaluation board.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoapalis-tk1: update defconfig for wifi
Dominik Sliwa [Mon, 7 Aug 2017 13:04:11 +0000 (15:04 +0200)]
apalis-tk1: update defconfig for wifi

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agoARM: dts: tegra124: fix m41t0 rtc compatible string
Bhuvanchandra DV [Tue, 18 Jul 2017 10:02:29 +0000 (15:32 +0530)]
ARM: dts: tegra124: fix m41t0 rtc compatible string

Toradex Carrier boards use the ST M41T0 RTC (not M41T00). The RTC
is almost the same, but the M41T0 needs some special handling in
case the oscillator fails. Now that support for this difference is
available, using the new compatible string to make use of it.

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agortc: ds1307: support m41t0 variant
Bhuvanchandra DV [Tue, 18 Jul 2017 10:02:28 +0000 (15:32 +0530)]
rtc: ds1307: support m41t0 variant

The m41t0 variant is very similar to the already supported m41t00
variant, with the notable exception of the oscillator fail bit.
The data sheet notes:

If the oscillator fail (OF) bit is internally set to a '1,' this
indicates that the oscillator has either stopped, or was stopped
for some period of time and can be used to judge the validity of
the clock and date data.

The bit will get cleared with a regular write of the system time,
so no changes are needed to clear it.

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
(backported from commit 8566f70c8a90f3914b06e934852596ba94aaa381)

6 years agogpu: nvgpu: Remove IOCTL FREE_OBJ_CTX
Debarshi Dutta [Wed, 21 Jun 2017 10:45:09 +0000 (16:15 +0530)]
gpu: nvgpu: Remove IOCTL FREE_OBJ_CTX

We have never used the IOCTL FREE_OBJ_CTX. Using it leads to context being
only partially available, and can lead to use-after-free.

Bug 1885775

Change-Id: I9d2b632ab79760f8186d02e0f35861b3a6aae649
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1506479
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
6 years agovideo: tegra: nvmap: fix nvmap create handle vulnerability
Krishna Reddy [Fri, 4 Nov 2016 19:45:53 +0000 (12:45 -0700)]
video: tegra: nvmap: fix nvmap create handle vulnerability

Handle the race condition between malicious fd close and
copy_to_user error, which can create use after free condition.
This is fixed by deferring the fd install, which eliminates
the race that leads to use after free condition.
Fixing Google Bug 32160775.

Bug 1835857

Change-Id: I337807e4360661beced8f9e1155c47b66607b8df
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/1248391
Reviewed-on: https://git-master.nvidia.com/r/1512958
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
6 years agoapalis-tk1: snapd squashfs configuration Apalis-TK1_LXDE-Image_2.7b3-20170630
Marcel Ziswiler [Wed, 28 Jun 2017 17:04:17 +0000 (19:04 +0200)]
apalis-tk1: snapd squashfs configuration

Prepare for snapd integration.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoapalis-tk1: improve spi2 clocking aka for k20
Marcel Ziswiler [Wed, 3 May 2017 07:24:54 +0000 (09:24 +0200)]
apalis-tk1: improve spi2 clocking aka for k20

Change SPI2 clock parent to clk_m being 12 MHz which is anyway the
maximum frequency the K20 micro controller's SPI peripheral can be run.

This further allows for the EzPort to be run at exactly 2 MHz which is
the maximum allowed as well.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoapalis-tk1: add multitouch hid support
Stefan Agner [Mon, 30 Nov 2015 19:34:35 +0000 (11:34 -0800)]
apalis-tk1: add multitouch hid support

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Max Krummenacher <max.krummenacher@toradex.com>
(cherry picked from commit 15e73283a975a1b899d7f6807aa882ef885573dd)

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agoapalis-tk1-k20: can and spi improvements
Dominik Sliwa [Thu, 1 Dec 2016 13:18:47 +0000 (14:18 +0100)]
apalis-tk1-k20: can and spi improvements

This patch includes CAN driver and improvements in SPI communications
for Apalis TK1 k20 based MFD.
Requires firmware version 0.9.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
6 years agovideo: tegra: sor: set drive current for lane4
WayneWWW [Sun, 10 Dec 2017 00:42:48 +0000 (09:42 +0900)]
video: tegra: sor: set drive current for lane4

Drive current for LANE4 was not set if configured as 24bpp LVDS out.
Fix it by programming proper drive current register if using 24bpp out.

https://devtalk.nvidia.com/default/topic/1003030

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
6 years agovideo: tegra: dsi: Set max limit for reading panel
Pavan Kunapuli [Thu, 16 Mar 2017 14:02:06 +0000 (19:32 +0530)]
video: tegra: dsi: Set max limit for reading panel

In the debugfs support for reading panel registers, max payload
needs to be limited to the buff array size to avoid stack corruption.

Bug 1873360

Change-Id: Ibee7bd81027d2669297942c09b905f1dd3bb09ee
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Signed-off-by: sakets <sakets@nvidia.com>
Reviewed-on: https://git-master/r/1507653
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
6 years agovideo: tegra: nvmap: fix information leak in pin/unpin
Sri Krishna chowdary [Fri, 3 Mar 2017 05:14:08 +0000 (10:44 +0530)]
video: tegra: nvmap: fix information leak in pin/unpin

When the NVMAP_IOC_PIN_MULT_32 and NVMAP_IOC_UNPIN_MULT_32 are
called it is possible that the op.addr is not initialized. This
can cause write to some random address thus causing corruption.

This patch fixes Google Bug 31668540

bug 1832092

Change-Id: I4d12d1a6c777131ba1fa2a753ea640861f8e82a6
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1314406
(cherry picked from commit da0c43534bb61e2e0849e297d389517d5e4ed168)
Reviewed-on: http://git-master/r/1504673
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
6 years agomedia: tegra: nvavp: Fix UAF issue.
Jitendra Kumar [Thu, 27 Oct 2016 08:35:00 +0000 (14:05 +0530)]
media: tegra: nvavp: Fix UAF issue.

Use locking to protect generated fd, so that it can't be
freed before channel open completes. Also add null value checks
in release call.

CVE-2016-8449 (A-31798848)
Bug 1830023
Bug 1849492

Change-Id: Ie6e2b29c7132fdfdff6b0bfa75440bd43afffd5f
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1285817
(cherry picked from commit 2ff0fdedfd65f269359d6540df4662e958681aa7)
Reviewed-on: http://git-master/r/1299505
(cherry picked from commit ea1af2ce5a746bda36205357c9e0adaf527026bb)
Reviewed-on: http://git-master/r/1489467
(cherry picked from commit 89559abb25f82dc333eafa26391be0a50d6e9e0a)
Reviewed-on: http://git-master/r/1504674
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
6 years agogpu: nvgpu: Fix pgsz_idx used in gk20a_vm_alloc_space()
Alex Waterman [Wed, 30 Nov 2016 22:12:25 +0000 (14:12 -0800)]
gpu: nvgpu: Fix pgsz_idx used in gk20a_vm_alloc_space()

Use the correct page size index for pgsz_idx in gk20a_vm_alloc_space().
Previously the page size itself was used, not the page size index.

Bug 1837624

Change-Id: I652f5af5321c1c49dc8eb170d3f92f00c23d2b6f
Signed-off-by: Alex Waterman <alexw@nvidia.com>
(cherry picked from commit fd13e0e1c4e397335c24497a0f92c85934d6185f)
Reviewed-on: http://git-master/r/1503371
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
6 years agovideo: tegra: nvmap: Fix NULL pointer dereference
Sri Krishna chowdary [Wed, 14 Dec 2016 06:28:30 +0000 (11:58 +0530)]
video: tegra: nvmap: Fix NULL pointer dereference

Consider the following case:
1. NVMAP_IOC_CREATE on IOVMM gives a valid fd to user space
2. user space does not call NVMAP_IOC_ALLOC.
3. user space calls a client driver IOCTL which calls dma_buf_map_attachment
4. call to dma_buf_map_attachment propagates till__nvmap_sg_table
   which has heap_pgalloc as true and tries to access pages[]
   which has all NULL.
5. Similarly, a dma_buf_kmap() can result in __nvmap_kmap() being called
   which again results in NULL dereference if pages[] is accessed.

A valid __nvmap_sg_table should occur only when h->alloc is true.
So, add check for it.

bug 1838597
bug 1883708

Change-Id: I400d9d8a94ff1003db207fc9c252b9256d796f60
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
(cherry picked from commit 8244d104b7635cb0b26b651b6851498b9a84d7d6)
Reviewed-on: http://git-master/r/1489579
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
7 years agovideo: tegra: nvmap: Fix security issue in NVMAP_IOC_PARAM
Gagan Grover [Thu, 24 Nov 2016 11:28:49 +0000 (16:58 +0530)]
video: tegra: nvmap: Fix security issue in NVMAP_IOC_PARAM

Initialized the uninitialized variables and handled return status
from nvmap_get_handle_param.

Bug 1884311
Bug 1820242

Change-Id: I2390c859d2b2af39eaff44749ca64e60920fe944
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1259560
Reviewed-on: http://git-master/r/1489707
GVS: Gerrit_Virtual_Submit
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agovideo: tegra: nvmap: Fix OOB vulnerability
Sagar Kadamati [Tue, 6 Dec 2016 06:08:01 +0000 (11:38 +0530)]
video: tegra: nvmap: Fix OOB vulnerability

Check all pages' parameters before reserve pages.

Bug 1883463
Bug 1831426
Bug 200247013

Manual port: http://git-psac/r/9287

(cherry picked from commit 61a05b52b8a17593e2817076b9bf59efdd9268ad)

Change-Id: I2f47c385ff8f4a9ca6bf37ee41749bd684ca1a20
Signed-off-by: Xia Yang <xiay@nvidia.com>
Signed-off-by: Sagar Kadamati <skadamati@nvidia.com>
Reviewed-on: http://git-master/r/1273326
Reviewed-on: http://git-master/r/1488769
GVS: Gerrit_Virtual_Submit
Tested-by: Sumit Gupta <sumitg@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agogpu: nvgpu: fix crash in gk20a_channel_release
Aingara Paramakuru [Fri, 5 Sep 2014 18:38:21 +0000 (11:38 -0700)]
gpu: nvgpu: fix crash in gk20a_channel_release

gk20a_channel_release() should bail if filp->private_data is
NULL. This can happen as a result of gk20a_channel_release()
being called when __gk20a_channel_open() fails in
NVHOST_IOCTL_CHANNEL_OPEN.

Bug 200014898

Change-Id: I32cc957aca46fcd4265a8052ac5be355b644b9f7
Signed-off-by: Aingara Paramakuru <aparamakuru@nvidia.com>
Reviewed-on: http://git-master/r/496138
(cherry picked from commit cb0db6618c42ab4c33574f09f212ab1ee9a0438a)
Reviewed-on: http://git-master/r/1258588
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Tested-by: Winnie Hsu <whsu@nvidia.com>
7 years agotegra: camera: Fix UAF security issue
Frank Chen [Wed, 14 Dec 2016 19:36:41 +0000 (11:36 -0800)]
tegra: camera: Fix UAF security issue

Fix UAF (use-after-free) security issue in
camera.pcl driver

Bug 1832830

Change-Id: Ie0f8a58a7bb9d1b4949e0f68d25d6da108f06e76
Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: http://git-master/r/1271371
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
7 years agotegra: camera race condition vulnerability
Mark Salyzyn [Tue, 17 May 2016 20:23:32 +0000 (13:23 -0700)]
tegra: camera race condition vulnerability

- Add mutex_lock(cam_desc.d_mutex) around ioctl access functions.
- Check cam->cdev in PCLLK_IOCTL_DEV_DEL ioctl.

(Back ported from Nexus N9 project)

Bug 1832830

Signed-off-by: <tiangangpi@gmail.com>
Signed-off-by: Xiaya Hu <xiaya@nvidia.com>
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 28026625
Change-Id: I81fbab628fb6516afa2cf5d3e0adf333aa2eb003
Reviewed-on: http://git-master/r/1271370
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Frank Chen <frankc@nvidia.com>
Tested-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
7 years agocamera: tegra: Fix security vulnerability
Amey Asgaonkar [Fri, 29 Apr 2016 01:01:42 +0000 (18:01 -0700)]
camera: tegra: Fix security vulnerability

Check a few input params to make sure there is
no potential for a heap overflow in the driver.

(Back ported from Nexus N9 project)

Bug 1757475 (nvidia)
Bug 1832830 (nvidia)
Bug 28193342 (google)

Change-Id: I979fa38c5f453cfad7070f0340ec04adde5bac13
Signed-off-by: Amey Asgaonkar <aasgaonkar@nvidia.com>
Reviewed-on: http://git-master/r/1271369
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Frank Chen <frankc@nvidia.com>
Tested-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
7 years agotegra: camera: validate PCLLK_IOCTL_SEQ_XX params
Greg Hackmann [Fri, 19 Feb 2016 23:04:23 +0000 (15:04 -0800)]
tegra: camera: validate PCLLK_IOCTL_SEQ_XX params

The driver expects the userspace-provided table to be terminated with
addr == CAMERA_TABLE_END.  Reject tables that aren't.

(back ported from Nexus N9 project)

Bug 1832830

Change-Id: Id1e168e02fbf323d094fe8c36c6e4bd90cceee4f
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Reviewed-on: http://git-master/r/1271368
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Frank Chen <frankc@nvidia.com>
Tested-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
7 years agomedia: tegra: camera: sanity-check ioctl parameter
Greg Hackmann [Fri, 19 Feb 2016 21:33:31 +0000 (13:33 -0800)]
media: tegra: camera: sanity-check ioctl parameter

Several places in the camera stack can hit integer overflows or cause
bad allocations if userspace passes in a bogus sizeofvalue parameter.
Protect against this by using appropriately-sized integer types, adding
range checks, replacing array-allocation calls with kcalloc(), and
checking for allocations returning ZERO_SIZE_PTR.

For one specific ioctl (PCLLK_IOCTL_UPDATE) sizeofvalue = 0 is fine,
since when that happens the subdrivers won't actually touch the returned
allocation.  In fact the existing userspace camera driver makes calls
like these and expects them to succeed!  Handle this special case by
adding a __camera_get_params variant that optionally treats zero-sized
inputs as valid.

(back ported from Nexus N9 project)

Bug 1832830

Change-Id: Ie3250d8a4b814de5820fa0190b4cbd1af3ca4b3f
Reported-by: Jianqiang Zhao <zhaojianqiang1@gmail.com>
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Reviewed-on: http://git-master/r/1271367
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Frank Chen <frankc@nvidia.com>
Tested-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
7 years agotegra-cryptodev: type modifier change in plaintext_sz
Konduri Praveen [Wed, 3 May 2017 19:48:50 +0000 (01:18 +0530)]
tegra-cryptodev: type modifier change in plaintext_sz

change the type modifier from signed to unsigned
for plaintext_sz variable in tegra_sha_req structure
to avoid occurence of negative values in plaintext_sz
variable.

Bug 1883640

Change-Id: I853f1916f7d4b6ea901cfe83419d624720a7e64f
Signed-off-by: Konduri Praveen <kondurip@nvidia.com>
Reviewed-on: http://git-master/r/1474814
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agovideo: tegra: host: Add submit checks
Mikko Perttunen [Tue, 25 Oct 2016 09:31:15 +0000 (12:31 +0300)]
video: tegra: host: Add submit checks

Currently nvhost performs minimal checking for submits it passes
to hardware: The kernel does not check if job syncpoints are allocated
and the gather classes are not verified currently.

This patch adds checks for syncpoint ids and gather classes.

Adapted from 0abcbd69c4cbd0093e223b6c248fdd53c2886951.

Bug 1831406

Change-Id: Ifb9d2090009d16d0f56bc11546036167c7f72228
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: http://git-master/r/1242190
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Tested-by: Winnie Hsu <whsu@nvidia.com>
7 years agoBACKPORT: drm: crtc: integer overflow in drm_property_create_blob()
Shreshtha SAHU [Wed, 30 Nov 2016 18:38:01 +0000 (00:08 +0530)]
BACKPORT: drm: crtc: integer overflow in drm_property_create_blob()

The size here comes from the user via the ioctl, it is a number between
1-u32max so the addition here could overflow on 32 bit systems.

This patch fixes a security vulnerability reported here:
https://code.google.com/p/android/issues/detail?id=228947

Change-Id: I17ed8c6e30826074cfc6dd833deb423be9bd89c5
Fixes: f453ba046074 ('DRM: add mode setting support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Cc: stable@kernel.org # v4.2
Signed-off-by: Dave Airlie <airlied@gmail.com>
Bug 1846814

Signed-off-by: Shreshtha SAHU <ssahu@nvidia.com>
Change-Id: I308e65797972a0a0650bd96bd130dfd2fbe9c993
Reviewed-on: http://git-master/r/1262503
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agogpu: nvgpu: add ptr validation for vm_map_buffer
Xia Yang [Wed, 14 Sep 2016 18:13:57 +0000 (11:13 -0700)]
gpu: nvgpu: add ptr validation for vm_map_buffer

dma_buf_get() return value is now validated before
passed down for further process.

Bug 1812180
Bug 1883864

Change-Id: I443d676af2948c924f187988ab1c64c72b3e9232
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/1220869

(cherry picked from commit e6fe9437c609252cf28ac76d2e6b33e905eaa843 in rel-21)
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I443d676af2948c924f187988ab1c64c72b3e9232
Reviewed-on: http://git-master/r/1469135
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agoarm: tegra: curtain pllx freq to its max value
Bibek Basu [Mon, 17 Apr 2017 16:44:53 +0000 (22:14 +0530)]
arm: tegra: curtain pllx freq to its max value

This patch fixes pllx max value to 1530 and 1836Mhz
based on embedded clok settings considering aging factor
for CD575MI 24x7 and CD575MI 4/4/16 config

Bug 1900076

Change-Id: I9c6a769787fc04eac7ce4548e1a37a9a76972a6c
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/1464315
GVS: Gerrit_Virtual_Submit
Reviewed-by: Peter Chiang <pchiang@nvidia.com>
7 years agovideo: tegra: host: Protect channel ioctl
Arto Merilainen [Tue, 14 Oct 2014 07:12:26 +0000 (10:12 +0300)]
video: tegra: host: Protect channel ioctl

Channel ioctl interface is not multithreading safe and as the
common case is that we have only a single active user for an open
fd, add a mutex to force serialization of ioctl calls.

Bug 1830021

Change-Id: Ifa6595a105b913345104f216f0541c371e89efe5
(cherry picked from commit 7b24caa9a8d2ab08fe0c7be112e805e44906d956)
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1248801
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit

7 years agovideo: tegra: nvmap: fix possible use after free
Gagan Grover [Tue, 22 Nov 2016 09:31:11 +0000 (15:01 +0530)]
video: tegra: nvmap: fix possible use after free

Fix possible use after free issue.

Bug 1814555
Bug 1884319

Change-Id: I826aa34f61d43fda5419a528697ce84ba2ce1eae
Reviewed-on: http://git-master/r/1221643
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: http://git-master/r/1257999
(cherry picked from commit b1647da33cff0c498ca8439a722ea1962ecf6901 in rel-24)
Reviewed-on: http://git-master/r/1461184
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
7 years agoT124: Add emc table to program SAMSUNG DRAM
Sandipan Patra [Tue, 28 Feb 2017 10:16:07 +0000 (15:46 +0530)]
T124: Add emc table to program SAMSUNG DRAM

New emc table for samsung dram is added on JetsonTK1 target.
Based on tegra bct strap value it can be chosen dynamically.
Both emc table and embedded emc table has been updated accordingly.

Bug 1752744

Change-Id: Ifc577d925712690daec6c6f1121458f01f720846
Signed-off-by: Sandipan Patra <spatra@nvidia.com>
Reviewed-on: http://git-master/r/1312498
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agoarm: tegra12: jetson: disable usb charging detection
Roger Hsieh [Thu, 16 Feb 2017 10:00:32 +0000 (18:00 +0800)]
arm: tegra12: jetson: disable usb charging detection

Jetson TK1 doesn't support usb charging but the detection is still
running. Disable it to avoid unexpected behavior.

Bug 1861049

Change-Id: I13425d69e190a75084486ff1fc9afeb8aa7acb60
Signed-off-by: Roger Hsieh <rhsieh@nvidia.com>
Reviewed-on: http://git-master/r/1308015
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agovideo: tegra: host: Fix overflow issue allocation
Mikko Perttunen [Fri, 27 Jan 2017 07:32:20 +0000 (09:32 +0200)]
video: tegra: host: Fix overflow issue allocation

Change kmalloc to kmalloc_array to prevent overflow issues
caused by large values supplied by user.

Based on "video: tegra: host: Fix overflow issues in allocation"
in nvhost/.

Coverity ID 27942
Bug 1856419

Change-Id: I5e96d0ec184543782dfe8814ad7e856b3b71221c
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: http://git-master/r/1295062
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agovideo: tegra: nvmap: Check if handle holds a buffer before map
Sri Krishna chowdary [Tue, 15 Nov 2016 05:53:30 +0000 (11:23 +0530)]
video: tegra: nvmap: Check if handle holds a buffer before map

Consider the following case:
1. NVMAP_IOC_CREATE gives a valid fd to user space
2. user space calls NVMAP_IOC_ALLOC and it fails. So, all
of the handle's allocation fields are zero.
3. Subsequent dma_buf_vmap, mmap on fd leads to __nvmap_mmap
call.
4. handle is valid but h->alloc, h->carveout, h->heap_pgalloc,
h->vaddr all are 0.
5. We check for h->heap_pgalloc which is false, so proceed and
dereference h->carveout leading to NULL pointer exception.

A valid __nvmap_mmap should occur only when h->alloc is true.
So, add check for it.

bug 1837468

Change-Id: I9be9d94f9b74c25b9b588fb1a16a74e96161ceda
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/1253236
(cherry picked from commit c5da78cf3d0c19f1e04501a4b3f64a5acacd0ff3)
Reviewed-on: http://git-master/r/1312264
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Bibek Basu <bbasu@nvidia.com>
7 years agodrivers: crypto: Avoid use of tainted scalar value
Konduri Praveen [Tue, 2 May 2017 09:20:40 +0000 (14:50 +0530)]
drivers: crypto: Avoid use of tainted scalar value

Copy from user may taint the scalar value members
in the respective struct variables.
Add check for verifying the validity of the
scalar value members to avoid undefined behaviour.

Bug 1903278

Signed-off-by: Konduri Praveen <kondurip@nvidia.com>
Change-Id: Ic01c8d10886f9b02c61156f811b430acce8aca23
Reviewed-on: http://git-master/r/1473534
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Tested-by: Winnie Hsu <whsu@nvidia.com>
7 years agotegra-cryptodev:check valid SHA message length
Konduri Praveen [Thu, 27 Apr 2017 09:10:36 +0000 (14:40 +0530)]
tegra-cryptodev:check valid SHA message length

SHA message length is provided from user space
through IOCTL call. If this length is not valid,
then it can lead to panic due to buffer overflow.

Fix by checking message length for SHA before
copying from user space

Bug 1883640

Change-Id: Idc5c6074784290b4622b1c23e5feb43849100cb5
Signed-off-by: Konduri Praveen <kondurip@nvidia.com>
Reviewed-on: http://git-master/r/1471180
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agodccp: fix freeing skb too early for IPV6_RECVPKTINFO
Sandipan Patra [Tue, 21 Mar 2017 10:14:31 +0000 (15:44 +0530)]
dccp: fix freeing skb too early for IPV6_RECVPKTINFO

In the current DCCP implementation an skb for a DCCP_PKT_REQUEST packet
is forcibly freed via __kfree_skb in dccp_rcv_state_process if
dccp_v6_conn_request successfully returns.

However, if IPV6_RECVPKTINFO is set on a socket, the address of the skb
is saved to ireq->pktopts and the ref count for skb is incremented in
dccp_v6_conn_request, so skb is still in use. Nevertheless, it gets
freed
in dccp_rcv_state_process.

Fix by calling consume_skb instead of doing goto discard and therefore
calling __kfree_skb.

Similar fixes for TCP:

fb7e2399ec17f1004c0e0ccfd17439f8759ede01 [TCP]: skb is unexpectedly
freed.
0aea76d35c9651d55bbaf746e7914e5f9ae5a25d tcp: SYN packets are now
simply consumed

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Bug 200285540

Change-Id: I3bec712b03278102c88933d4684324c3f414b606
Signed-off-by: Sandipan Patra <spatra@nvidia.com>
Reviewed-on: http://git-master/r/1325204
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
7 years agoapalis-tk1: default to lp1 sleep Apalis-TK1_LXDE-Image_2.7b2-20170410
Dominik Sliwa [Tue, 4 Apr 2017 13:57:10 +0000 (15:57 +0200)]
apalis-tk1: default to lp1 sleep

Due to problems with LP0 sleep, make LP1 the default option.

Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
7 years agoapalis-tk1: video: use new modedb based settings
Bhuvanchandra DV [Mon, 6 Feb 2017 05:54:01 +0000 (11:24 +0530)]
apalis-tk1: video: use new modedb based settings

Use modedb to set mode on Apalis TK1 frame buffer/display
controller.

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
7 years agotegra: video: use modedb to specify frame buffer resolution
Bhuvanchandra DV [Mon, 6 Feb 2017 05:54:00 +0000 (11:24 +0530)]
tegra: video: use modedb to specify frame buffer resolution

Allow to specify framebuffer videomode using kernel command line
parameters. NVIDIAs binary X driver later on picks up those settings
and start X with current mode settings, if no EDID data are available.

Reused some of the implementation from Stefan's work for modedb
support[1] on Tegra20/30

[1] http://git.toradex.com/cgit/linux-toradex.git/commit/?h=tegra-next&id=1d3625dd9903bcc59e2df56836565ebb682948c1

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
7 years agoapalis-tk1: use soc uid instead
Bhuvanchandra DV [Mon, 20 Feb 2017 17:45:02 +0000 (23:15 +0530)]
apalis-tk1: use soc uid instead

Instead of providing revision, SKU and PID information
via soc_id pass SoC's unique ID.

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>