openwrt/target/linux/layerscape/patches-5.4/805-display-0020-drm-bridge-cdns-cec-fix-LA-failed-set-issue.patch
Yangbo Lu cddd459140 layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/

For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.

The patches are sorted into the following categories:
  301-arch-xxxx
  302-dts-xxxx
  303-core-xxxx
  701-net-xxxx
  801-audio-xxxx
  802-can-xxxx
  803-clock-xxxx
  804-crypto-xxxx
  805-display-xxxx
  806-dma-xxxx
  807-gpio-xxxx
  808-i2c-xxxx
  809-jailhouse-xxxx
  810-keys-xxxx
  811-kvm-xxxx
  812-pcie-xxxx
  813-pm-xxxx
  814-qe-xxxx
  815-sata-xxxx
  816-sdhc-xxxx
  817-spi-xxxx
  818-thermal-xxxx
  819-uart-xxxx
  820-usb-xxxx
  821-vfio-xxxx

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2020-05-07 12:53:06 +02:00

130 lines
3.7 KiB
Diff

From 4e8d26c363c6e4b8b89d21feeb8c6dc57085b27d Mon Sep 17 00:00:00 2001
From: Sandor Yu <Sandor.yu@nxp.com>
Date: Fri, 27 Sep 2019 17:15:34 +0800
Subject: [PATCH] drm: bridge: cdns cec: fix LA failed set issue
improved function set_logical_addr() function.
Fix LA set failed issue in some case.
Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
---
drivers/gpu/drm/bridge/cadence/Kconfig | 6 ++++
drivers/gpu/drm/bridge/cadence/cdns-mhdp-cec.c | 38 +++++++++++---------------
2 files changed, 22 insertions(+), 22 deletions(-)
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -8,12 +8,18 @@ config DRM_CDNS_MHDP
config DRM_CDNS_HDMI
tristate "Cadence HDMI DRM driver"
+ depends on DRM_CDNS_MHDP
config DRM_CDNS_DP
tristate "Cadence DP DRM driver"
+ depends on DRM_CDNS_MHDP
config DRM_CDNS_AUDIO
tristate "Cadence MHDP Audio driver"
+ depends on DRM_CDNS_MHDP
config DRM_CDNS_HDMI_CEC
tristate "Cadence MHDP HDMI CEC driver"
+ depends on DRM_CDNS_HDMI
+ select CEC_CORE
+ select CEC_NOTIFIER
--- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp-cec.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp-cec.c
@@ -20,8 +20,6 @@
#define CEC_NAME "cdns-mhdp-cec"
#define REG_ADDR_OFF 4
-#define MAX_LA_IDX 4
-#define MAX_LA_VAL 15
/* regsiter define */
#define TX_MSG_HEADER 0x33800
@@ -158,26 +156,22 @@ static u32 mhdp_cec_write_message(struct
return true;
}
-//static void cec_abort_tx_transfer(struct cdns_mhdp_cec *cec)
-//{
-// cec_write(cec, TX_MSG_CMD, CEC_TX_ABORT);
-// cec_write(cec, TX_MSG_CMD, CEC_TX_STOP);
-//}
-
static int mhdp_cec_set_logical_addr(struct cdns_mhdp_cec *cec, u32 la)
{
- u8 i;
u8 la_reg;
+ u8 i;
- if (la >= MAX_LA_VAL) {
- dev_err(cec->dev, "Error logical Addr\n");
- return -EINVAL;
- }
-
- for (i = 0; i < MAX_LA_IDX; ++i) {
- la_reg =
- mhdp_cec_read(cec, LOGICAL_ADDRESS_LA0 + (i * REG_ADDR_OFF));
+ if (la == CEC_LOG_ADDR_INVALID)
+ /* invalid all LA address */
+ for (i = 0; i < CEC_MAX_LOG_ADDRS; ++i) {
+ mhdp_cec_write(cec, LOGICAL_ADDRESS_LA0 + (i * REG_ADDR_OFF), 0);
+ return 0;
+ }
+ /* In fact cdns mhdp cec could support max 5 La address */
+ for (i = 0; i < CEC_MAX_LOG_ADDRS; ++i) {
+ la_reg = mhdp_cec_read(cec, LOGICAL_ADDRESS_LA0 + (i * REG_ADDR_OFF));
+ /* Check LA already used */
if (la_reg & 0x10)
continue;
@@ -194,7 +188,7 @@ static int mhdp_cec_set_logical_addr(str
dev_warn(cec->dev, "All LA in use\n");
- return -EINVAL;
+ return -ENXIO;
}
static int mhdp_cec_poll_worker(void *_cec)
@@ -263,7 +257,7 @@ static int mhdp_cec_poll_worker(void *_c
static int mhdp_cec_adap_enable(struct cec_adapter *adap, bool enable)
{
- struct cdns_mhdp_cec *cec = adap->priv;
+ struct cdns_mhdp_cec *cec = cec_get_drvdata(adap);
if (enable) {
mhdp_cec_write(cec, DB_L_TIMER, 0x10);
@@ -276,7 +270,7 @@ static int mhdp_cec_adap_enable(struct c
static int mhdp_cec_adap_log_addr(struct cec_adapter *adap, u8 addr)
{
- struct cdns_mhdp_cec *cec = adap->priv;
+ struct cdns_mhdp_cec *cec = cec_get_drvdata(adap);
return mhdp_cec_set_logical_addr(cec, addr);
}
@@ -284,7 +278,7 @@ static int mhdp_cec_adap_log_addr(struct
static int mhdp_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
u32 signal_free_time, struct cec_msg *msg)
{
- struct cdns_mhdp_cec *cec = adap->priv;
+ struct cdns_mhdp_cec *cec = cec_get_drvdata(adap);
mhdp_cec_write_message(cec, msg);
@@ -307,7 +301,7 @@ int cdns_mhdp_register_cec_driver(struct
CEC_NAME,
CEC_CAP_PHYS_ADDR | CEC_CAP_LOG_ADDRS |
CEC_CAP_TRANSMIT | CEC_CAP_PASSTHROUGH
- | CEC_CAP_RC, 1);
+ | CEC_CAP_RC, CEC_MAX_LOG_ADDRS);
ret = PTR_ERR_OR_ZERO(cec->adap);
if (ret)
return ret;