After programming the TX Register, it takes 3-4 clock cycles for TX
data synchronization to the CEC core domain. The TX_EMPTY interrupt
should not be cleared until this data synchronization is complete.
Enable CEC HW feature to automatically clears the TX_EMPTY interrupt
after TX data synchronization is complete. It takes time for HW to
clear the interrupt and TX_EMPTY can still appear high, hence SW
needs to poll WR_LOCK until it goes to 0. This will avoid SW to
attempt the next TX block during the same TX_EMPTY interrupt.
Also read RX_REGISTER based on the buffer occupancy which is
indicated by the CEC_RX_BUFFER_STAT_0 register.
Bug 4954851
Change-Id: I3ec3792c9ae3b8a00c800c921cf4e4d09369e6b9
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3322519
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
Tested-by: Ruopeng Huang (SW-TEGRA) <robhuang@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This change adds SC7 wake support to cec driver.
CEC engine can detect TV packets in SC7 state and
can wake up when particular pattern detected.
In resume functionality, the total arrived packets on FIFO
needs to read and reported back to user-space.
This change adds -
1. Program CEC engine to activate for SC7 wake.
2. Program required opcode and physical address.
3. Register for wake and read packets in resume path.
4. Provide sysfs control to program physical address.
Verification of SC7 wake is done for below cases -
1. TV turn on and off is tested.
2. TV source input change is tested.
3. CEC Analyzer set-stream is tested.
Bug 4974679
Change-Id: Ia1ceeb13b89614c96d0b6d42f2bb58419865414b
Signed-off-by: Robert Huang <robhuang@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3300821
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Prafull Suryawanshi <prafulls@nvidia.com>
This change includes below -
1. For T23x, CEC engine is moved to AON partition. As AON partition
does not powergate, skip all powergate/unpowergate calls for t23x.
2. The clock on which CEC engine operates, 32k/rtc_clk, it is always
running clock in AON partition. So skip clock enable/disable APIs.
3. This change also skips calls to TEGRA DC engine which is not available
from T23x.
4. RX Buffer size is increased to 64 depth from 1 depth. So new register is
provided to program depth so that interrupt gets triggered when certain
depth is filled. By default it is 64 depth so program it to 1 depth
to match old behavior.
5. When tegradc is absent, read physical address from SPARE register which
will be populated by UEFI.
6. This change also adds new register definitions in header file which
needs to program when adding support for CEC SC7 wakeup.
7. Timing registers updated for T23x as per HW guidelines.
8. Some initialization code is changed for T23x.
9. Add devicetree binding documentation.
bug 200727002
Change-Id: I71c2d323632c61e4c4b82bcdbca9e72179761224
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2523595
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Add genpd/pm_runtime support to handle power domains
in Tegra Display driver. Also updated CEC and HDA_DC
drivers to add pm_runtime calls.
Added new APIs in CEC and SOR drivers to abstract
calls to pm_runtime and tegra_powergate APIs based
on specific Kernel version. Guarded powergate_id
with CONFIG_TEGRA_POWERGATE since its not needed
when pm_runtime APIs are used, and the powergate IDs
are defined in tegra_powergate.h which is not used
in K5.9.
Removed pm_runtime autosuspend setting since display
driver doesn't assign PM suspend/resume hooks at
present. Suspend/resume calls are linked to platform
device callbacks.
Removed pm_runtime_enable() call in dc_common probe
since there's logically no need of power-domains
in dc_common and also there is no power-domains node
in display_hub node in device-tree. Same with DSI.
All the power-domains handled by each DC are listed
in "power-domains" and "power-domain-names" properties
under respective dc nodes in device tree.
bug 200601926
Change-Id: I0fc9d21ff56185a69de6e0663b5932a93cf40e2b
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2358953
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This change fixes below follow-up issues with the earlier fix
to access_ok() API done as part of
https://git-master.nvidia.com/r/c/linux-nvidia/+/2361042:
1. Definition of VERIFY_READ and VERIFY_WRITE have been removed
after K4.14. Hence, used them only for kernel versions < K5.4.
2. Changed access_type parameter of tegra_cec_access_ok() API
to bool. WRITE or READ will be chosen based on the bool value.
3. In the last CL, VERIFY_WRITE was changed to VERIFY_READ in
two access_ok() calls by mistake. Corrected them in this CL.
4. Defined access_type variable with attribute __maybe_unused
since gcc doesn't seem to consider a variable as used if only
passed as function parameter.
bug 200601926
Change-Id: I9f3540cd028280ca679b4b69d5b4a72aa943b2ae
Signed-off-by: Naveen Kumar S <nkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2394585
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shu Zhong <shuz@nvidia.com>
Reviewed-by: Ujwal Patel <ujwalp@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Fix build linux-5.7-rc5 errors including following:
- change timespec to timespec64. replace getnstimeofday
with ktime_get_ts64
- replace usage of macro FIELD_SIZEOF with sizeof_field in ethtool.c
nvethernet and eqos files.
- support 2 arguments for of_get_phy_mode call
bug 200617764
Change-Id: I46067d7d36d08ee9556b2722e9ccec707b8853d4
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2347244
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
There are two type of temp WARs in the nvidia repo:
1) Some functions are defined in driver files that depend on
CONFIG_TEGRA_GRHOST_NVCSI. So these function call should
have dependency protection in the header file.
2) The powergate header file is adding an unnecessary define
check for tegra194-powergate.h and this broke two places
that were referring one of the defines in it.
So this change fix the WARs above by:
a) Removing those temp WARs by adding dummy NOP functions for
those platofrms that don't have CONFIG_TEGRA_GRHOST_NVCSI.
b) Removing the define check in tegra194-powergate.h and the
version check when referring TEGRA194_POWER_DOMAIN_DISP.
Bug 2284925
Change-Id: Iad86bfe20f2981b3d31bccf5f51184799fe7e289
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1803439
GVS: Gerrit_Virtual_Submit
Reviewed-by: David Bang <dbang@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
drivers inside platform tegra and nvdisp
point to display repo.
changing that to nvidia/
Bug 200295104
Change-Id: I91e0356555c251df3eae98218a69f4bc7e3cd208
Signed-off-by: Ishan Mittal <imittal@nvidia.com>
To prevent too many bufferred message from flushing out to serial when
we turn on/off display and blocking other high priority task due to
disabled IRQ, we change some prints to debug level to workaround that
problem as a short-term solution. The long-term will be implemented
later.
bug 200205349
Change-Id: I6609844d5c2ee58b2df6a51e9537bb7dd1448995
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: http://git-master/r/1326683
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Chun Xu <chunx@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
use generic APIs tegra_unpowergate_partition() and
tegra_powergate_partition() to unpowergate DISP power
domain needed for CEC without enabling disp clocks so
that display pll clocks are disabled in idle state even
though DISP partition is awake.
Bug 1810989
Change-Id: I37428b9012729a4458724314732f80a571057fd6
Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: http://git-master/r/1317241
(cherry picked from commit dffb3d3b5fb67cb6920fdbfc72cd3d6c37f0061c)
Provide error recovery from IOCTL to user space.
Bug 1866338
Change-Id: I705ada6c8d4cb13f1c882993468f467da2908fdf
Signed-off-by: Chun XU <chunx@nvidia.com>
Reviewed-on: http://git-master/r/1300499
(cherry picked from commit a646f4903c8794641432fa838a27ee5584944eb5)
Turn on the TV as soon as possible for better user experience
by sending <Text View On> and <ACTIVE SOURCE> CEC commands if
the previous reboot is not recovery. If the previous reboot
reason is recovery, don't send <Text View On> to avoid turning
on TV when there is an auto OTA on-going.
CEC driver uses RESERVED2 logical address as the source address.
Later, the upper layer will send OneTouchPlay command by using
its valid logical address.
Bug 200253563
Change-Id: Iecd759bb50c1f21549f55906e68e3faab905f86b
Signed-off-by: Chun XU <chunx@nvidia.com>
Reviewed-on: http://git-master/r/1277092
(cherry picked from commit 2beab2dcfc4e40712004500df99633d59ae0e70c)
Powergate identifiers are different on Tegra210 and Tegra186,
so add per-SoC match data to use the correct value on each
SoC.
bug 200257351
Change-Id: I81b938386ab9cbaec735baac44ee74fccf39731c
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/1297136
(cherry picked from commit 5438b348e036c31dcf9db0d1364fa6c6ac053428)
Create a symlink for tegra_cec if it is not under platform bus or
it has been created with different name.
Bug 200214224
Bug 200185815
Bug 1764073
Change-Id: Ib2f89db016982ca916894c37e47bbdf177fb617e
Signed-off-by: Chun XU <chunx@nvidia.com>
Reviewed-on: http://git-master/r/1175137
(cherry picked from commit 506e6370d234c4770afb22372ef1955faa7822cf)
Use tegra_nvdisp_unpowergate_partition/tegra_nvdisp_powergate_partition
in Tegra CEC driver to control DISA power domain.
Bug 200214236
Bug 200214232
Bug 200185815
Change-Id: Ib860570f901278e9211b5262fddf8c63a700c5f9
Signed-off-by: Chun XU <chunx@nvidia.com>
Reviewed-on: http://git-master/r/1176912
(cherry picked from commit 8e9f75ac1dadf04a8f89a74dac3e67cd1a06f886)
Unpowergate DISA power domain if it is powergated during CEC driver initialization.
Bug 200175747
Change-Id: I8b3d879fe0c33eaef74c1b4d3b549559c4977e4d
Signed-off-by: Chun XU <chunx@nvidia.com>
Reviewed-on: http://git-master/r/1142593
Reviewed-on: http://git-master/r/1164149
(cherry picked from commit c341176715597fe8268b20b291bcef07bb429500)
Bug 1591149
Initialization of cec engine is slow.
Short-circuit the init in event of suspend.
Change-Id: Ibfbd6f36883a7bf45fdb5137120b041a52f42086
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/714423
(cherry picked from commit d5f4a6602678c87e8caa5032e43f2415c314d800)
Reviewed-on: http://git-master/r/716496
Reviewed-on: http://git-master/r/1164147
(cherry picked from commit 82a640a1ea11e850f769b78b5d0c531731b1ffd8)
Auxdata still have to be provided in of_platform_populate()
during early boot device detection to get the device correctly
named as "tegra_cec". Failing to do so will result in device
probe failure as of_device_make_bus_id() will name the device
as "[phys_base].tegra_cec" and cause clock assignment failure.
Bug 200013561
Change-Id: Ib0f898f89146cba7f02cffb768c6a2eb558400ce
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/433871
Reviewed-on: http://git-master/r/1164144
(cherry picked from commit 43402b18ee6def21d7d55420f5acd22403e86f1d)
Change write() to work per frame.
Change write() to return -1 on error and set up errno
write() API:
-Userspace is responsible for re-transmission.
-Read from user-space byte by byte, each byte representing
a block, up to 16 bytes as specified by HDMI standard.
-Return 0 on success transmission, -1 otherwise, with errno
setup as follows:
EIO - TX_REGISTER_UNDERRUN, should not happen, otherwise
driver is have serious timing issue.
ECOMM - BUS arbitration failure or anomaly BUS activity.
Transmission is abandoned.
ECONNRESET - For broadcast message only, someone on the BUS
asserted NAK during transmission.
EHOSTUNREACH - For direct message only, message was not ACK'd.
(Required by logical address allocation)
EMSGSIZE - Message size > 16 bit.
EFAULT - Page fault accessing message buffer.
EINTR - call interrupted by singal.
read() API is unchanged, works per packet with no error report.
Change-Id: Iabdd92b5658dd63c7b500a7ec88d79a64c8c0a43
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/304664
(cherry picked from commit 6ab7a446c4a3e8e4970ceec5a3c715453a24e4a5)
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/347779
Reviewed-on: http://git-master/r/1164143
(cherry picked from commit 67a6c2d3cfbeeca5cb5ed57aae53f34d07decd4f)
Remove wait_event_interruptible() from interrupt context
Change init_done to be atomic_t and reset as early as possible
Bug 1395893
Change-Id: Ib0cf423a3405293000b0c0d9aa105da5bba22e53
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/304631
(cherry picked from commit ef034436a3c8aaf7a9ce5dd9ebaf8dc90dbcce4b)
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/346042
Reviewed-on: http://git-master/r/1164141
(cherry picked from commit 76e681f957b27323227c9990679631636084b6ae)
cancel the workqueue in suspend method before turning
off the clock
Bug 1360341
Change-Id: I126da686a6ba0c5eec55b67df1e9f962ce16fc48
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/280159
(cherry picked from commit 7cc6da6e41c7889f7ed8da7833d293b3b884bc0e)
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/346041
Reviewed-on: http://git-master/r/1164140
(cherry picked from commit e57647e7daacd5a3c22016cbe3f01ddb800d702c)
Add wait_event to make sure that CEC functions
do not execute until CEC init completes
Bug 1283088
Change-Id: I1d26360326338f549a14cbf109a24c2935ebe472
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/232566
(cherry picked from commit 6e94e976c1e2121d81d19018b79a97d353b11d70)
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/346039
Reviewed-on: http://git-master/r/1164139
(cherry picked from commit 794145e9f8c16c7e36119f3652dd185cf12eb5dc)
In T124, the RX_REGISTER_FULL interrupt is cleared
by reading the RX_REGISTER instead of writing to the
INT_STAT register as before.
Bug 1364229
Change-Id: Ib080a48910304553b0752a3ede55ab0d7653dd77
Signed-off-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-on: http://git-master/r/275982
Reviewed-on: http://git-master/r/1164137
(cherry picked from commit b890e7f50d3d032fc3ede4c4935fdf2c4501f063)
tegra_cec.c: fix warnings as compilation fails after enabling warning as
errors flag
Bug 1258710
Change-Id: Iecd3051d482f5a7488c9f95f6124ad39371f0bd9
Signed-off-by: Benjamin Lu <benjaminl@nvidia.com>
Reviewed-on: http://git-master/r/1164136
(cherry picked from commit 8112e3cd46d11eca51e95cc2fed66d2f7946553a)
READ API:
read API ignores count and will always return 16 bit data.
read API expects user to supply it with min of 16 bits data
it returns CEC packet in following format
bit 0-7: data
bit 8: EOM
bit 9: ACK
WRITE API:
write API ignores count and will always accept 32 bit data.
write API expects user to supply it with min of 32 bits data
it accepts CEC packet supllied in following format
bit 0-7: data
bit 8: EOM
bit 12: Address mode, 0 = Direct, 1 = Broadcast
bit 16: Generate Start bit, 0 = Disable, 1 = Enable
bit 17: Retry frame, 0 = Disable, 1 = Enable
Logical address is set to 4, as of now there is no mechanism to change this
address from userspace.
Driver is disabled by default in Kconfig
Bug 200198493
Change-Id: Ia3835cec0bb717e63dabca5c5fcb1236847bf492
Reviewed-on: http://git-master/r/1164135
(cherry picked from commit 955ec819872e66c4732b38cd74c7ff3a302d95f2)
Signed-off-by: Chun XU <chunx@nvidia.com>