abhijit [Tue, 13 Jun 2017 17:17:41 +0000 (22:47 +0530)]
net: eqos: handle rollover of PHC
Issue: ptp get_systime is not handling the rollover of nsec counter.
Fix: Handle the nsec rollover by reading the nsec counter twice. if
second read value is lower than first value, read the sec counter
again to handle rollover.
abhijit [Mon, 29 May 2017 09:31:36 +0000 (15:01 +0530)]
net: eqos: Register PTP callback at correct place
Issue: CAN HW timestamp information is incorrect in case one of the
Tegra is made PTP master.
Fix: CAN HW timestamp is based on get_ptp_hwtime function which is
exported by PTP notifier framework. Above function relies on callback
registered by eqos driver. This callack was registered when adjust
PTP time was called. But adjust is not called for PTP master. Moved
the callback registration to set HWTSTAMP ioctl which is required by
both PTP master and slave.
abhijit [Fri, 19 May 2017 12:19:36 +0000 (17:49 +0530)]
net: eqos: Add ioctl for Timestamp information
Issue: Required a way to read both HW PTP time and kernel time (either
CLOCK_REALTIME or CLOCK_MONOTONIC) atomically. This read will be done
with periodicity of 1 second.
Fix: Added private ioctl to get the above information. Reading of these
time values is protected by raw spinlock. Also modified ptp_lock spinlock
to be raw spinlock to prevent race conditions under RT kernel.
Narayan Reddy [Wed, 14 Jun 2017 05:38:00 +0000 (11:08 +0530)]
net: eqos: start phy interrupts after MAC reset.
Issue: After PHY reset through the GPIO, autonegotion
will start from the PHY side which results in triggering
the PHY interrupts. Through the IRQ handler phy_change
workqueue will be scheduled and which will be trying to
access the PHY registers through MDIO bus. While accessing
the MDIO address/data registers in workqueue context EQOS
MAC is in reset mode which results in APB timeout.
Fix: start phy interrupts once EQOS MAC is out of reset
Peter Zijlstra [Thu, 11 Aug 2016 16:54:13 +0000 (18:54 +0200)]
locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write()
The current percpu-rwsem read side is entirely free of serializing insns
at the cost of having a synchronize_sched() in the write path.
The latency of the synchronize_sched() is too high for cgroups. The
commit 1ed1328792ff talks about the write path being a fairly cold path
but this is not the case for Android which moves task to the foreground
cgroup and back around binder IPC calls from foreground processes to
background processes, so it is significantly hotter than human initiated
operations.
Switch cgroup_threadgroup_rwsem into the slow mode for now to avoid the
problem, hopefully it should not be that slow after another commit:
80127a39681b ("locking/percpu-rwsem: Optimize readers and reduce global impact").
We could just add rcu_sync_enter() into cgroup_init() but we do not want
another synchronize_sched() at boot time, so this patch adds the new helper
which doesn't block but currently can only be called before the first use.
Peter Zijlstra [Thu, 14 Jul 2016 18:08:46 +0000 (20:08 +0200)]
locking/percpu-rwsem: Optimize readers and reduce global impact
Currently the percpu-rwsem switches to (global) atomic ops while a
writer is waiting; which could be quite a while and slows down
releasing the readers.
This patch cures this problem by ordering the reader-state vs
reader-count (see the comments in __percpu_down_read() and
percpu_down_write()). This changes a global atomic op into a full
memory barrier, which doesn't have the global cacheline contention.
This also enables using the percpu-rwsem with rcu_sync disabled in order
to bias the implementation differently, reducing the writer latency by
adding some cost to readers.
Bhanu Murthy V [Fri, 10 Jun 2016 23:17:52 +0000 (16:17 -0700)]
drivers: media: camera: Add sync op support
Add sync file op support in VI driver.
Sub devices will be synchronized when the MFI interrupt
arrives to VI driver. At present this interrupt is
configured when the ROI of focus area ends during the
current frame capture.
Fix vi2 and vi4 differences using fops in addition to
the original commit.
Cleanup MFI code in the active isr flow.
Bhanu Murthy V [Fri, 10 Jun 2016 19:49:17 +0000 (12:49 -0700)]
drivers: media: lc898212: Focuser sync support
Add support for synchronized focuser position writes
w.r.t sensor capture.
Add external sync CID for focuser to enable/disable
external synchronization to set position.
Bhanu Murthy V [Fri, 10 Jun 2016 23:09:45 +0000 (16:09 -0700)]
v4l2-core: Add sync op to subdev_core_ops
If multiple sub devices need to be synchronized w.r.t one
sub device state, then this op can be used.
For example in camera system, configuring focuser position and
sensor capture have to be synchronized when the ROI for focuser
ends. Writing focus position on improper boundary causes unexpected
output.
Naveen Kumar S [Thu, 8 Jun 2017 14:34:42 +0000 (20:04 +0530)]
fbcon: use mode from fbconsole to enable dc
fbconsole takes over when a userspace entity (Xorg) gets
killed. But in this scenario, DC was getting enabled
with X's mode instead of using fbconsole's mode. This
lead to DC and fbconsole having different modes if X had
updated its mode earlier. Updated fbconsole unblanking logic
to use fbconsole's mode to enable DC during a switch from
graphical to text mode.
Naveen Kumar S [Thu, 8 Jun 2017 14:27:53 +0000 (19:57 +0530)]
Revert "fbcon: update mode before enabling controller"
This reverts commit 5bdda4518527d11c7e690e39a1ae6a1a9b1bb56a.
This change helped in updating dc mode when a userspace
client got killed abruptly. But it was observed that display
was not unblanking during hotplug. Hence reverting this patch.
Shreshtha SAHU [Tue, 9 May 2017 06:30:17 +0000 (12:00 +0530)]
tegra210-emc: Get max temperature of two DDR die
DDR temperature is polled to decide the refresh rate
of DDR during high temperatures. In case of two die
solution, each die can have different temperature.
Hence take max temperature of two DDR die to detemine
DDR refresh speed next action.
Saket Sinha [Fri, 26 May 2017 05:55:28 +0000 (11:25 +0530)]
fbcon: Block rounding off mode for VT running X.
When X is active i.e. GNOME/Ubuntu Desktop is running, fb_display
does not get updated and still contain stale values of unplug event.
Rounding mode of stale values causes wrong resolution being picked up
on hotplugging HDMI.
Manikanta [Thu, 1 Jun 2017 10:05:54 +0000 (15:35 +0530)]
net: wireless: bcmdhd: check for kthread_run error
Issue: wifiloader service loads bcmdhd module.
During encryption wifiloader service is kiiled,
when bcmdhd driver is loading. In this scenario
bcmdhd driver is crashing because kthread_run()
failure is not handled.
Naveen Kumar S [Mon, 5 Jun 2017 09:14:03 +0000 (14:44 +0530)]
fbcon: update mode before enabling controller
When switching from a graphical mode (X) to text mode (fbconsole),
fbconsole enables display controller and then updates screen
resolution. If the previous graphical userspace client's mode was
different from fbconsole's mode, DC and fbconsole will get enabled
with different modes. Hence, first update screen with fbconsole's
resolution and then unblank/enable DC.
Bhanu Murthy V [Fri, 19 Aug 2016 00:08:21 +0000 (17:08 -0700)]
drivers: camera: Mode selection logic
Segregate mode selection logic into standard
and special types. Standard mode selection
will be based on pixel format and special type
selection will depend on sensor settings defined
by controls.
Naveen Kumar S [Wed, 31 May 2017 10:07:45 +0000 (15:37 +0530)]
video: fbmem: assign bpp value for var_screeninfo
bits per pixel is not specified in few scenarios.
E.g.: Modes set through nvdisp_setmode.
In such cases, fbconsole fails during subsequent
operations. Hence assign bpp value from previous mode
if bpp is not set.
Jon Hunter [Tue, 23 May 2017 15:51:25 +0000 (16:51 +0100)]
dmaengine: tegra-adma: Fix system suspend handling
If ADMA is active when system suspend occurs, it is not suspended and
hence, the state and clock configuration is not handled correctly in
the suspend path.
Add proper system suspend and resume callbacks to ensure that the ADMA
is suspended and resumed if active when system suspend occurs.
Finally, make the system suspend callbacks for the ADMA late suspend
callbacks to ensure that the sound core has suspended any on-going
activity, including stopping the ADMA if active, before we attempt to
suspend the ADMA.
Jon Hunter [Tue, 23 May 2017 15:44:28 +0000 (16:44 +0100)]
ASoC: tegra-alt: Fix system suspend handling
There are a couple issues with system suspend handling in the Tegra
ASoC codec drivers which are:
1. Most drivers the system suspend callback does nothing and this
means that if the codec device is active when suspend occurs then
the codec will not be suspended correctly. This has been seen to
cause system crashes in the I2S driver when the system is suspended
and resuming while audio playback is active.
2. The codec suspend handlers may be called twice when entering
suspend. Suspend handlers should only be called once, but currently
they are called twice; once by the PM core and once when the APE
power-domain is turned off (if it is on when suspend occurs).
Fix the above two problems by:
a). Adding proper system suspend and resume handlers for all codec
drivers, to suspend and resume the device if not runtime PM
suspended on entering suspend.
b). Remove the code to call the PM callbacks from the APE power-domain
code.
Finally, make the system suspend callbacks for these codec drivers
late suspend callbacks to ensure that the sound core has suspended
any on-going activity, before we attempt to suspend these codec
devices.
Jon Hunter [Mon, 22 May 2017 15:02:11 +0000 (16:02 +0100)]
ASoC: tegra-alt: Fix parent runtime PM handling
Linux runtime PM automatically handles the runtime resuming and
suspending of a parent device and therefore, it is not necessary
for a child device to explicitly runtime resume or suspend the
parent.
The various Tegra ASoC codec drivers explicitly runtime resume
and suspend the parent device from within their runtime PM callback
handler. This should not be necessary.
Furthermore, currently the various Tegra ASoC codec drivers are
not suspended correctly if active when system suspend occurs. During
system suspend it is common to directly call the runtime PM callbacks
to suspend and resume the device if active from the system suspend
callbacks. However, the APIs, pm_runtime_get/put(), cannot be called
during system suspend and so the runtime PM callbacks for these codec
drivers cannot be called from the context of the system suspend
callbacks.
Remove the calls to runtime resume and suspend the parent device from
the runtime PM callbacks for the various Tegra ASoC drivers. This will
allow us to fix suspending and resuming of the Tegra ASoC drivers
across system suspend.
Pavan Kunapuli [Tue, 23 May 2017 06:29:14 +0000 (11:59 +0530)]
mmc: core: Check non-removable device presence status
Provide option to check for the presence of non-removable devices.
This would be used for devices like SDIO that are not physically
removed but would have to be re-enumerated when Wifi module is loaded
or unloaded.
Bhadram Varka [Wed, 22 Mar 2017 11:24:42 +0000 (16:54 +0530)]
net: eqos: fix timeout error
Issue: EQOS trying to access the PHY registers through
mdiobus_write/read from the phy_change IRQ handler.
At this stage PHY is not in proper state to respond
to the register read/write which leads to below timeout -
Bitan Biswas [Wed, 26 Apr 2017 12:37:08 +0000 (18:07 +0530)]
soc: tegra: pmc: DT add wake fix
tegra_of_device_add_pmc_wake was ignoring
device's own nvidia,pmc-wakeup attribute when
child nodes were present. Process own attribute
first before processing child nodes.
- T21x wake support is through DT
and does not use built-in wakeups table
- tegra210-comms-p2530-0930.dtsi has
WAKE8 in bcmdhd_wlan node
I2C controller registers should be accessed after enabling the clock
but during multi packet feature addition (commit: 3af1f17167)
mistakenly i2c registers (fifo flush) access is done before clock is
enabled. This issue was missed as clock never disabled once clock got
enabled. Moving flushing fifos(accessing controller registers) after
clock enable to fix this issue.
Suresh Mangipudi [Tue, 16 May 2017 10:26:11 +0000 (15:56 +0530)]
pm/resume: Add support for early resume
Sometimes, there is a need to sequence the resume of different
drivers regardless of their registration. For example, for Tegra
platform, GPIO resume should be before the pinmux resume to avoid
glitch. On this, GPIO resume will configure the GPIO control
register before pins are enable after resume.
Add support to have the early_resume() callback which get called
before resume() so that respective driver's resume can be sequenced
over other drivers.
Mohan Kumar [Tue, 16 May 2017 05:59:32 +0000 (11:29 +0530)]
adma: tegra: fix the adma get position
The two adma registers for dma position are read while
adma is transferring data. That might be a case when we
read the second register "TRANSFER_STATUS", the first
register "TRANSFER_DONE_COUNT" gets increment.
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.