Stephen Warren [Wed, 19 Apr 2017 16:47:13 +0000 (10:47 -0600)]
arm64: config: enable more USB gadget drivers
This enables all options required to implement the USB protocols that L4T
wishes to expose over the USB flashing port in device mode.
- ACM for serial port access.
- RNDIS for Ethernet access from Windows (or Linux).
- ECM for Ethernet access from MacOS (or Linux).
- Bridge support to bridge the two Ethernet interfaces to a single IP
address so users don't require different IPs depending on the protocol
their OS uses. This also simplifies documentation.
- Loop block device support so that the L4T system can also mount the
filesystem image that is exported over USB Mass Storage.
boot.img size increased by 140384 (T210), 120552 (T186).
(Note: boot.img taken as L4T's Image file, since these are L4T defconfigs)
Change-Id: I77cc313dcad505d5d8056c76a55a08a800c676f7 Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/1469845
(cherry picked from commit 0a36077dea7cdedace721b33c38ba9b0c9b69e09 in dev-kernel)
Reviewed-on: http://git-master/r/1484123
GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro <mapedro@nvidia.com> Reviewed-by: Jon Mayo <jmayo@nvidia.com>
Alex Frid [Tue, 25 Apr 2017 01:51:00 +0000 (18:51 -0700)]
clk: tegra: Fix shared bus connector rate update
When connector rate is updated the result cannot be used directly to
set new rate, since it represents only users of this connector, and
does not take into account rates of the sibling connector (if any).
Instead, rate update of the parent (top level bus) should be called
recursively.
R Raj Kumar [Tue, 21 Mar 2017 05:06:21 +0000 (10:36 +0530)]
mmc: tegra: add nvquirk to skip RTPM forbid call
Add new nvquirk to skip RTPM forbid call on
t21x platforms.
pm_runtime_forbid() added in driver to ensure
that minimum clk supplied to sdhci instances
even in device shutdown state.
Hien Goi [Mon, 15 May 2017 21:58:13 +0000 (14:58 -0700)]
platform:tegra:camera: changed vi4_init
-writes to CFG_INTERRUPT_MASK and CFG_INTERRUPT_STATUS were causing
vi master error messages and the writes to stall
-removed those writes in vi4_init as they are not needed
-moved vi4_init below check for bypass
Change-Id: Ic56b760f22bc97c90d3fc1cb7a36f7cf217f5640
Reviewed-on: http://git-master/r/1479306 Tested-by: Jacob Rampertab <jrampertab@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: David Wang (SW-TEGRA) <davidw@nvidia.com> Reviewed-by: Bhanu Murthy V <bmurthyv@nvidia.com>
GVS: Gerrit_Virtual_Submit Reviewed-by: Shardar Mohammed <smohammed@nvidia.com> Reviewed-by: Frank Chen <frankc@nvidia.com> Reviewed-by: Jihoon Bang <jbang@nvidia.com>
When gadget is disconnected, running sequence is like this.
. android_work: sent uevent USB_STATE=DISCONNECTED
. Call trace:
usb_string_copy+0xd0/0x128
gadget_config_name_configuration_store+0x4
gadget_config_name_attr_store+0x40/0x50
configfs_write_file+0x198/0x1f4
vfs_write+0x100/0x220
SyS_write+0x58/0xa8
. configfs_composite_unbind
. configfs_composite_bind
In configfs_composite_bind, it has
"cn->strings.s = cn->configuration;"
When usb_string_copy is invoked. it would
allocate memory, copy input string, release previous pointed memory space,
and use new allocated memory.
When gadget is connected, host sends down request to get information.
Call trace:
usb_gadget_get_string+0xec/0x168
lookup_string+0x64/0x98
composite_setup+0xa34/0x1ee8
android_setup+0xb4/0x140
If gadget is disconnected and connected quickly, in the failed case,
cn->configuration memory has been released by usb_string_copy kfree but
configfs_composite_bind hasn't been run in time to assign new allocated
"cn->configuration" pointer to "cn->strings.s".
When "strlen(s->s) of usb_gadget_get_string is being executed, the dangling
memory is accessed, "BUG: KASAN: use-after-free" error occurs.
BUG=chrome-os-partner:58412
TEST=After smaug device was connected to ubuntu PC host, detached and attached
type-C cable quickly several times without seeing
"BUG: KASAN: use-after-free in usb_gadget_get_string".
Bug 31614969
Change-Id: I58240ee7c55ae8f8fb8597d14f09c5ac07abb032 Signed-off-by: Jim Lin <jilin@nvidia.com> Signed-off-by: Siqi Lin <siqilin@google.com>
(am from https://chromium-review.googlesource.com/#/c/428059/3)
Reviewed-on: http://git-master/r/1475581 Tested-by: Sunny Li <sunnyl@nvidia.com> Reviewed-by: Hayden Du <haydend@nvidia.com>
Sahara [Sun, 4 Dec 2016 08:50:18 +0000 (12:50 +0400)]
enable ARCH_HAS_ELF_RANDOMIZE again
The patch e4622e4 somehow accidentally removed ARCH_HAS_ELF_RANDOMIZE.
Without this option, arch_mmap_rnd(), called by load_elf_binary(), does
not work properly and just returns 0 instead even though a process has
PF_RANDOMIZE flag. As a result, dynamic program's mmap base is not
randomized at all.
Bug 33351919
Change-Id: Ice2df132dc436b647fa0312dd7453f9ed6160a2a Signed-off-by: Sahara <keun-o.park@darkmatter.ae>
Reviewed-on: http://git-master/r/1475549 Tested-by: Sunny Li <sunnyl@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Hayden Du <haydend@nvidia.com>
Mark Salyzyn [Tue, 20 Dec 2016 23:59:19 +0000 (15:59 -0800)]
android: fiq_debugger: restrict access to critical commands.
Sysrq must be enabled via /proc/sys/kernel/sysrq as a security
measure to enable various critical fiq debugger commands that
either leak information or can be used as a system attack.
Default disabled, this will leave the reboot, reset, irqs, sleep,
nosleep, console and ps commands. Reboot and reset commands
will be restricted from taking any parameters. We will also
switch to showing the limited command set in this mode.
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug 32402555
Change-Id: I3f74b1ff5e4971d619bcb37a911fed68fbb538d5
Reviewed-on: http://git-master/r/1475531 Tested-by: Sunny Li <sunnyl@nvidia.com> Reviewed-by: Hayden Du <haydend@nvidia.com>
Naveen Kumar S [Wed, 10 May 2017 11:20:42 +0000 (16:50 +0530)]
video: modedb: update vmode comparision
To select full range quantization, userspace clears
LIMITED_RANGE flag in vmode. This shouldn't lead to
mode mismatch because the modes are still the same
even if LIMITED_RANGE flag doesn't match. Hence ignore
LIMITED_RANGE bit in vmode comparision while finding a
matching mode from modelist.
Gaurav Singh [Tue, 9 May 2017 16:42:37 +0000 (22:12 +0530)]
arm64: configs: Enable EDP to LVDS config
Enable config TEGRA_EDP2LVDS_PS8625 to enable
EDP to lvds bridge. PS8625 is i2c slave chip
which has EDP to LVDS support. For L4T, the
display head will be treated as EDP, this chip
takes care of converting edp to lvds signals.
Mohan Kumar [Thu, 4 May 2017 06:45:02 +0000 (12:15 +0530)]
ASoC: tegra-alt: Avoid reg access after shutdown
Below are the hypothetical scenarios
- Drivers are in suspend state while reboot and PCM Open call from
userspace is received after driver shutdown [APE is power gated
already]
- PM domain handling doesn't ensure proper functionality after driver
shutdown is called
The change handles with the below fix
- ALSA PCM Open API first executes runtime resume of each driver.
So need to prevent any reg access in runtime resume of drivers.
- ALSA PCM Open executes ADMAIF startup after runtime resume of
each driver. If ADMAIF startup returns failure based on shutdown,
PCM Open operation will fail, this will break PCM Open path and
will ensure no further ALSA APIs/Callbacks are called.
Change-Id: I9c70aeea8a2220006ba3f958532ea0dac5ae71cb Signed-off-by: David Wang <davidw@nvidia.com>
Reviewed-on: http://git-master/r/1475849
(cherry picked from commit d40ca4c535c8fadf77fb966977cac83ec671f121)
Reviewed-on: http://git-master/r/1476553 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
- Documentation is added for following chips
- SN65DSI86: DSI to eDP bridge
- SN65DSI85: DSI to LVDS bridge
- MAX9291: HDMI to GMSL bridge
- DS90UB948: FPDLINK to LVDS bridge
- DS90UH949: HDMI to FPDLINK bridge
Jon Hunter [Thu, 27 Apr 2017 16:11:18 +0000 (17:11 +0100)]
ASoC: ad193x: Add support for more sampling rates
Currently, the AD193x codec only supports 48kHz sampling rates. The
orca-viper platform needs to support 44.1kHz, 48kHz and 96kHz. Update
the driver to add support for the various sample rates supported by the
codec. Please note that it is also necessary to update the list of
sysclk frequencies that is required to support these sample rates.
Finally add some more error checking for detecting any supported audio
configurations.
Jon Hunter [Thu, 27 Apr 2017 16:09:44 +0000 (17:09 +0100)]
Asoc: tegra-alt: Allow machines to specify the fs-to-mclk ratio
For Tegra186 the Tegra utilities assumes that the codec MCLK frequency
is always 256x the sample-rate (fs). For the AD193x codecs this is not
always the case and for example, to support a 96kHz sampling rate, the
MCLK must be 128x the sample-rate. Therefore, add a new parameter,
'mclk_scale' to the Tegra clock data that specifies the scaling factor
that is used to calculate the MCLK frequency from the sample rate,
where the default is 256. This allows machine drivers to override this
default scale factor as necessary to support various sample rates.
(cherry picked from commit ced78973182fde570f5112c2c20078b4d776ad50)
Change-Id: I3808292a3970a44f02c352b2cbce6a7e9d902e5a Signed-off-by: David Wang <davidw@nvidia.com>
Reviewed-on: http://git-master/r/1473869 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
(cherry picked from commit 7a5183a0952977ef902019a840d7d738f3af9838)
Change-Id: I938acc94dc9ca4ebb917a8c7d71017f760528314 Signed-off-by: David Wang <davidw@nvidia.com>
Reviewed-on: http://git-master/r/1473868 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
xhci: check for implementation of callback function pointer
Check if the callback function pointer is_u0_ts1_detect_disabled()
is implemented before actually calling it. This is a tegra-xhci
specific function and will not be implemented by other xhci
controllers.
This commit implements XHCI "soft retry" for SuperSpeed endpoints which
encounters transfer errors.
When transfer error happens on a SuperSpeed endpoint, XHCI driver will
1. queue a "reset endpoint" command with TSP=1 (Transfer State Preserve)
2. invoke a HCD driver specific callback "->endpoint_soft_retry()" to let
HCD driver has a chance to configure its hardware
3. ring door bell for the endpoint upon seeing the command completion.
The trace_smmu_set_pte in for-loop stores trace log
for every single page which adds huge overhead when
unmap page. It's not necessary and shall be moved out.
Bhadram Varka [Fri, 17 Mar 2017 15:53:30 +0000 (21:23 +0530)]
net: phy: broadcom: enable APD mode
BCM89610 can be placed in Auto Power Down mode when
signal from the copper link partner is not present.
This change is to enable the APD mode for BCM89610.
Save the port statistics before handling serial
interrupt and dump the current port stats when
too much work is done in serial irq handler to
know which interrupt is causing this.
Based on commit: 31cf754a tty: serial8250: save/dump the port statistics
adds a check to see if PCIe partition is already powered up
and tries to un-powergate it only if it is not done already
Also plain powergate/un-powergate APIs are used instead of the
ones with clk_on and clk_off as PCIe clocks are resets are
explicitly handled by PCIe host controller driver
Aparna Das [Tue, 25 Apr 2017 23:38:18 +0000 (16:38 -0700)]
media:platform:tegra initialize mipi mutex
Tegra mipi mutex is locked in tegra_mipi_calibration
function prior to calling vmipi calibration function.
Initialize mipi mutex even for virtualized configuration.
dma-buf: fix slowness issue in dmabuf_can_defer_unmap API
The slowness was rootcaused to be from devres_find. Since,
devres_find does a simple linear search in all resources
associated with a device, it is quite possible that the
list gets huge and so the search takes a huge time.
Instead, add a new bit-field no_dmabuf_defer_unmap to the
device struct and use it to find out if a device can defer
unmap or not. By default, all devices can defer unmap.
So, initialize the field to 0.
i2c: tegra: reset the controller before going to suspend
Reset the controller before going to suspend to allow bpmp firmware
i2c driver to perform i2c trasactions in normal(default) mode after
resume, as the kernel i2c driver is by default doing transactions
in packet mode.
Alex Frid [Fri, 7 Apr 2017 03:27:11 +0000 (20:27 -0700)]
clk: tegra: Re-factor T210 PLLX registration
Registered T210 PLLX through T210 specific interface to make sure T210
calculate rate callback is invoked (not callback common for pre-T210
SoCs). Converted T210 PLLX registration interface into wrapper of PLLC
registration to avoid unnecessary duplication of the functionality.
Removed from T210 PLLSS registration code sections that
- attempt to set PLL minimum rate (unnecessary, and dangerous if PLL
is already enabled on boot)
- apply pre-T210 defaults settings
- check IDDQ setting (duplicated with T210 PLLSS check defaults)
Replaced setting of reference clock with check that default oscillator
selection is not changed, and failed registration otherwise.
Reordered registration, so that PLL initialization is called after
VCOmin adjustment.
Alex Frid [Wed, 5 Apr 2017 01:42:07 +0000 (18:42 -0700)]
clk: tegra: Update T210 CSI/DSI PLLD controls
- Applied common PLLD lock to out-of-bound CSI source selection
interfaces.
- Moved registration of pf PLLD DSI branch to PLL initialization (from
peripheral initialization).
This change enables XUDC on T210 USB2.0 only OTG port
without occupy one UPHY lane hence PCIe x1 on M.2 and
XUSB device mode could be supported simultaneously.
Issue: During module remove mmc host is powered down
and it is not powered up while loading bcmdhd driver again.
This is causing mmc command timeouts and insmod failure.
Fix: power up mmc host during bcmdhd driver loading.
-- Enable DSI and DSI2EDP in defconfig
-- This facilitates to enable 3 displays on EBP partition
-- Enable Fixed/Dummy, PMIC regulators for EBP partition.
Call unmap_dma_buf on release only if the buffer was previously
mapped. sg_table is NULL when no map was ever called on
the buffer and it is -ENOMEM when map fails.
Change-Id: I63ada3ed175a59fd1e0562384e91401cf128c5c2 Signed-off-by: Frank Chen <frankc@nvidia.com>
Reviewed-on: http://git-master/r/1467140 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bhanu Murthy V <bmurthyv@nvidia.com> Reviewed-by: David Wang (SW-TEGRA) <davidw@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Jon Mayo <jmayo@nvidia.com>
GVS: Gerrit_Virtual_Submit
configures root port to not advertise its L1SS capability
if there is no CLKREQ routing from end point to root port
which is indicated through disable-clock-request entry in
root port DT
Remove code to check for valid eld which causes pcm_open to fail if
no monitor is connected. Also remove condition which earlier allowed
pcm_open to succeed if atleast pcm capabilities are known from eld.
* Request 150 MHz EMC freqnecy when data
transfers happen in xudc driver.
* This change schedules work to set 150 MHz EMC
freq through bwmgr(bandwidth manager)
when USB requests >= 16KB are seen.
* Delayed work is scheduled to trigger after 2 sec
to restore the EMC frequency to 0 if
there are no pending transfers
Add private context for each client
tegra_mipi_context
Add nonblocking mipical API
tegra_mipical_nonblock
tegra_mipical_nonblock_check_stat
Usage:
1. Call tegra_mipical_nonblock with handle, along with lanes and timeoutms,
driver will allocate memory for tegra_mipi_context.
2. After sensor start streaming, call tegra_mipical_nonblock_check_stat with
the handle.
3. In check_stat, context will be freed.
When client call nonblock api, driver will spawn a thread to run mipical
in background, return to client immediately.
For multiple clients usecase, each thread will grab a mutex before
programming mipical HW.
Client should call nonblock_check_stat to check mipical status.
However nonblock_check_stat can sleep, since it has to wait for kthread to
finish.
vivid capture and output devices have same
card name to match from userspace.
Use of v4l2 device name as card name helps
with the tegra userspace flow.
i2c: tegra: use slow_clock only when timeout feature is enabled
- Use slow_clock only when timeout feature is enabled
- Convert dev_err to dev_dbg for i2c slow missing entries print
as this is valid and not an error.
Currently the critical trip points in thermal framework are the only
way to specify a temperature at which HW should shutdown. This is
insufficient for certain platforms which would want an orderly
software shutdown in addition to HW shutdown.
This change allows soctherm DT to specify thermtrip temperatures so
that critical trip points framework can be used for doing software
shutdown.
If gain_factor or framerate_factor does not exist in DT,
stop parsing DT and return immediately with 0.
None of sensor DT has xxx_factor in place. This is to
avoid excessive error message in kernel.
a_wait_bcon timeout will happen if ID pin is detected but no B-device is
connected. Changed a_wait_bcon timeout message to debug level to avoid
spew prints for this kind of normal use case.
Parse Over Current settings from DT and program them to generate
interrupts. Also enable hw throttling whenever there are OC events.
Log the OC events as debug messages.