[PATCH v1 1/2] ite-it6505 change trigger conditions

2020-08-10 Thread allen
it6505 changes trigger conditions.
---
 Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
index 2c50016..bf0e889 100644
--- a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -73,7 +73,7 @@ examples:
 
 dp-bridge@5c {
 compatible = "ite,it6505";
-interrupts = <152 IRQ_TYPE_EDGE_FALLING 152 0>;
+interrupts = <152 IRQ_TYPE_LEVEL_LOW 152 0>;
 reg = <0x5c>;
 pinctrl-names = "default";
 pinctrl-0 = <&it6505_pins>;
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 0/2] IT6505 cover letter

2020-08-10 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series refactors previous it6505 driver and contains document bindings, 
Kconfig to control the function enable or not.

allen (2):
  ite-it6505 change trigger condition
  drm/bridge: add it6505 driver

 .../bindings/display/bridge/ite,it6505.yaml|2 +-
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 3278 
 4 files changed, 3287 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 1/2] ite-it6505 change trigger conditions

2020-08-10 Thread allen
it6505 changes trigger conditions.
---
 Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
index 2c50016..bf0e889 100644
--- a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -73,7 +73,7 @@ examples:
 
 dp-bridge@5c {
 compatible = "ite,it6505";
-interrupts = <152 IRQ_TYPE_EDGE_FALLING 152 0>;
+interrupts = <152 IRQ_TYPE_LEVEL_LOW 152 0>;
 reg = <0x5c>;
 pinctrl-names = "default";
 pinctrl-0 = <&it6505_pins>;
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 2/2] drm/bridge: add refactored it6505 driver

2020-08-10 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3278 +++
 3 files changed, 3286 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c2..a9f49c7 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -48,6 +48,13 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7..86619c7 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..0601a35
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3278 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+#define INT_HDCP_FAIL BIT(3)
+#define INT_HDCP_DONE BIT(4)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_HDCP_KSV_CHECK BIT(1)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_TRIGGER 0x39
+#define HDCP_TRIGGER_START  BIT(0)
+#define HDCP_TRIGGER_CPIRQ  BIT(1)
+#define HDCP_TRIGGER_KSV_DONE  BIT(4)
+#define HDCP_TRIGGER_KSV_FAIL BIT(5)
+
+#define REG_HDCP_CTRL2 0x3A
+#define HDCP_AN_SEL BIT(0)
+#define HDCP_AN

[PATCH v10] drm/bridge: add it6505 driver

2020-07-17 Thread allen
This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Pi-Hsun Shih 
Signed-off-by: Yilun Lin 
Signed-off-by: Hermes Wu 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2890 +++
 3 files changed, 2898 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 43271c2..59750b8 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -57,6 +57,13 @@ config DRM_LVDS_CODEC
  Support for transparent LVDS encoders and decoders that don't
  require any configuration.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_MEGACHIPS_STDP_GE_B850V3_FW
tristate "MegaChips stdp4028-ge-b850v3-fw and stdp2690-ge-b850v3-fw"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index d63d4b7..86619c7 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..12a56cd
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2890 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define REG_IC_VER 0x04
+
+#define REG_RESET_CTRL 0x05
+#define VIDEO_RESET BIT(0)
+#define AUDIO_RESET BIT(1)
+#define ALL_LOGIC_RESET BIT(2)
+#define AUX_RESET BIT(3)
+#define HDCP_RESET BIT(4)
+
+#define INT_STATUS_01 0x06
+#define INT_MASK_01 0x09
+#define INT_HPD_CHANGE BIT(0)
+#define INT_RECEIVE_HPD_IRQ BIT(1)
+#define INT_SCDT_CHANGE BIT(2)
+
+#define INT_STATUS_02 0x07
+#define INT_MASK_02 0x0A
+#define INT_AUX_CMD_FAIL BIT(0)
+#define INT_AUDIO_FIFO_ERROR BIT(2)
+
+#define INT_STATUS_03 0x08
+#define INT_MASK_03 0x0B
+#define INT_LINK_TRAIN_FAIL BIT(4)
+#define INT_VID_FIFO_ERROR BIT(5)
+#define INT_IO_LATCH_FIFO_OVERFLOW BIT(7)
+
+#define REG_SYSTEM_STS 0x0D
+#define INT_STS BIT(0)
+#define HPD_STS BIT(1)
+#define VIDEO_STB BIT(2)
+
+#define REG_LINK_TRAIN_STS 0x0E
+#define LINK_STATE_CR BIT(2)
+#define LINK_STATE_EQ BIT(3)
+#define LINK_STATE_NORP BIT(4)
+
+#define REG_BANK_SEL 0x0F
+#define REG_CLK_CTRL0 0x10
+#define M_PCLK_DELAY 0x03
+
+#define REG_AUX_OPT 0x11
+#define AUX_AUTO_RST BIT(0)
+#define AUX_FIX_FREQ BIT(3)
+
+#define REG_DATA_CTRL0 0x12
+#define VIDEO_LATCH_EDGE BIT(4)
+#define ENABLE_PCLK_COUNTER BIT(7)
+
+#define REG_PCLK_COUNTER_VALUE 0x13
+
+#define REG_501_FIFO_CTRL 0x15
+#define RST_501_FIFO BIT(1)
+
+#define REG_TRAIN_CTRL0 0x16
+#define FORCE_LBR BIT(0)
+#define LANE_COUNT_MASK 0x06
+#define LANE_SWAP BIT(3)
+#define SPREAD_AMP_5 BIT(4)
+#define FORCE_CR_DONE BIT(5)
+#define FORCE_EQ_DONE BIT(6)
+
+#define REG_TRAIN_CTRL1 0x17
+#define AUTO_TRAIN BIT(0)
+#define MANUAL_TRAIN BIT(1)
+#define FORCE_RETRAIN BIT(2)
+
+#define REG_AUX_CTRL 0x23
+#define CLR_EDID_FIFO BIT(0)
+#define AUX_USER_MODE BIT(1)
+#define AUX_NO_SEGMENT_WR BIT(6)
+#define AUX_EN_FIFO_READ BIT(7)
+
+#define REG_AUX_ADR_0_7 0x24
+#define REG_AUX_ADR_8_15 0x25
+#define REG_AUX_ADR_16_19 0x26
+#define REG_AUX_OUT_DATA0 0x27
+
+#define REG_AUX_CMD_REQ 0x2B
+#define AUX_BUSY BIT(5)
+
+#define REG_AUX_DATA_0_7 0x2C
+#define REG_AUX_DATA_8_15 0x2D
+#define REG_AUX_DATA_16_23 0x2E
+#define REG_AUX_DATA_24_31 0x2F
+
+#define REG_AUX_DATA_FIFO 0x2F
+
+#define REG_AUX_ERROR_STS 0x9F
+#define M_AUX_REQ_FAIL 0x03
+
+#define REG_HDCP_CTRL1 0x38
+#define HDCP_CP_ENABLE BIT(0)
+
+#define REG_HDCP_CTRL2 0x3A
+#define HDCP_AN_SEL BIT(0)
+#define HDCP_HW_HPDIRQ_ACT BIT(2)
+
+#define REG_M0_0_7 0x4C
+#define REG_AN_0_7 0x4C
+#define REG_SP_CTRL0 0x58
+#define REG_IP_CTRL1 0x59
+#define REG_IP_CTRL2 0x5A
+
+#define REG_LINK_DRV 0x5C
+#define DRV_HS BIT(1)
+
+#define REG_DRV_LN_DATA_SEL 0x5D
+
+#defin

[PATCH v9 2/3] dt-bindings: Add binding for IT6505.

2020-04-28 Thread allen
Add a DT binding documentation for IT6505.

Acked-by: Sam Ravnborg 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
cros-ec does not have an associated driver that uses the standard Linux USB-C 
driver class.
extcon is used to model the Type-C connector.(crbug.com/982932)
---
 .../bindings/display/bridge/ite,it6505.yaml| 91 ++
 1 file changed, 91 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
new file mode 100644
index ..13feeef
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -0,0 +1,91 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/ite,it6505.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE it6505 Device Tree Bindings
+
+maintainers:
+  - Allen Chen 
+
+description: |
+  The IT6505 is a high-performance DisplayPort 1.1a transmitter,
+  fully compliant with DisplayPort 1.1a, HDCP 1.3 specifications.
+  The IT6505 supports color depth of up to 36 bits (12 bits/color)
+  and ensures robust transmission of high-quality uncompressed video
+  content, along with uncompressed and compressed digital audio content.
+
+  Aside from the various video output formats supported, the IT6505
+  also encodes and transmits up to 8 channels of I2S digital audio,
+  with sampling rate up to 192kHz and sample size up to 24 bits.
+  In addition, an S/PDIF input port takes in compressed audio of up to
+  192kHz frame rate.
+
+  Each IT6505 chip comes preprogrammed with an unique HDCP key,
+  in compliance with the HDCP 1.3 standard so as to provide secure
+  transmission of high-definition content. Users of the IT6505 need not
+  purchase any HDCP keys or ROMs.
+
+properties:
+  compatible:
+const: ite,it6505
+
+  ovdd-supply:
+maxItems: 1
+description: I/O voltage
+
+  pwr18-supply:
+maxItems: 1
+description: core voltage
+
+  interrupts:
+maxItems: 1
+description: interrupt specifier of INT pin
+
+  reset-gpios:
+maxItems: 1
+description: gpio specifier of RESET pin
+
+  extcon:
+maxItems: 1
+description: extcon specifier for the Power Delivery
+
+  port:
+type: object
+description: A port node pointing to DPI host port node
+
+required:
+  - compatible
+  - ovdd-supply
+  - pwr18-supply
+  - interrupts
+  - reset-gpios
+  - extcon
+
+examples:
+  - |
+#include 
+
+i2c3 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_FALLING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+extcon = <&usbc_extcon>;
+
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
+};
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v9 0/3] IT6505 cover letter

2020-04-28 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series contains document bindings, revert commit, add vendor prefix, 
Kconfig to control the function enable or not.

Allen Chen (1):
  WIP: drm/bridge: add it6505 driver

allen (2):
  dt-bindings: Add vendor prefix for ITE Tech. Inc.
  WIP: dt-bindings: Add binding for IT6505.

 .../bindings/display/bridge/ite,it6505.yaml|   91 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +-
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 3136 
 5 files changed, 3236 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v9 3/3] drm/bridge: add it6505 driver

2020-04-28 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3136 +++
 3 files changed, 3144 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 6ec945f..9897162 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -47,6 +47,13 @@ config DRM_LVDS_CODEC
  Support for transparent LVDS encoders and decoders that don't
  require any configuration.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_MEGACHIPS_STDP_GE_B850V3_FW
tristate "MegaChips stdp4028-ge-b850v3-fw and stdp2690-ge-b850v3-fw"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index b04ac2d..ed14813 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..4cf4401
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3136 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* Vendor option */
+#define AUDIO_SELECT I2S
+#define AUDIO_TYPE LPCM
+#define AUDIO_SAMPLE_RATE SAMPLE_RATE_48K
+#define AUDIO_CHANNEL_COUNT 2
+
+/*
+ * 0: Standard I2S
+ * 1: 32bit I2S
+ */
+#define I2S_INPUT_FORMAT 1
+
+/*
+ * 0: Left-justified
+ * 1: Right-justified
+ */
+#define I2S_JUSTIFIED 0
+
+/*
+ * 0: Data delay 1T correspond to WS
+ * 1: No data delay correspond to WS
+ */
+#define I2S_DATA_DELAY 0
+
+/*
+ * 0: Left channel
+ * 1: Right channel
+ */
+#define I2S_WS_CHANNEL 0
+
+/*
+ * 0: MSB shift first
+ * 1: LSB shift first
+ */
+#define I2S_DATA_SEQUENCE 0
+
+/*
+ * IT6505 maximum link rate
+ * RBR : 1.62 Gbps/lane
+ * HBR : 2.7  Gbps/lane
+ * HBR2: 5.4  Gbps/lane
+ * HBR3: 8.1  Gbps/lane
+ */
+#define MAX_LINK_RATE HBR
+
+/* IT6505 maximum lane count */
+#define MAX_LANE_COUNT 4
+
+#define TRAINING_LINK_RATE HBR
+#define TRAINING_LANE_COUNT 4
+#define ENABLE_DP_LANE_SWAP 0
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PIXEL_CLK_DELAY 1
+#define PIXEL_CLK_INVERSE 0
+#define ADJUST_PHASE_THRESHOLD 8
+#define MAX_PIXEL_CLK 95000
+#define DEFAULT_DRV_HOLD 0
+#define DEFAULT_PWR_ON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/*
+ * Vendor option afe settings for different platforms
+ * 0: for bitland 10e, quanta zde
+ * 1: for google kukui p1/p2, huaqin krane
+ */
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2A, 0x85}
+};
+
+enum it6505_sys_state {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_TRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_HDCP,
+   SYS_NOROP,
+   SYS_UNKNOWN,
+};
+
+enum it6505_audio_select {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_audio_sample_rate {
+   SAMPLE_RATE_24K = 0x6,
+   SAMPLE_RATE_32K = 0x3,
+   SAMPLE_RATE_48K = 0x2,
+   SAMPLE_RATE_96K = 0xA,
+   SAMPLE_RATE_192K = 0xE,
+   SAMPLE_RATE_44_1K = 0x0,
+   SAMPLE_RATE_88_2K = 0x8,
+   SAMPLE_RATE_176_4K = 0xC,
+};
+
+enum it6505_audio_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+};
+
+enum it6505_audio_word_length {
+   WORD_LENGTH_16BIT = 0,
+   WORD_LENGTH_18BIT,
+   WORD_LENGTH_20BIT,
+   WORD_LENGTH_24BIT,
+};
+
+/*
+ * Audio Sample Word Length
+ * WORD_LENGTH_16BIT
+ * WORD_LENGTH_18BIT
+ * WORD_LENGTH_20BIT
+ * WORD_LENGTH_24BIT
+ */
+#define AUDIO_WORD_LENGTH WORD_LENGTH_24BIT
+
+enum it6505_link_rate {
+   RBR,
+   HBR,
+   HBR2,
+   HBR3,
+};
+
+struct it6505_audio_sample_rate_map {
+   enum it6505_audio_sample_rate rate;
+   int sample_rate_value;
+};
+
+struct it6505_platform_data {
+   struct regulator *pwr18;

[PATCH v8 3/3] drm/bridge: add it6505 driver

2020-03-23 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 3064 +++
 3 files changed, 3072 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index aaed234..5dddea3 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -38,6 +38,13 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_CODEC
tristate "Transparent LVDS encoders and decoders support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 6fb062b..3547b18 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
 obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..5743516
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3064 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* Vendor option */
+#define AUDIO_SELECT I2S
+#define AUDIO_TYPE LPCM
+#define AUDIO_SAMPLE_RATE SAMPLE_RATE_48K
+#define AUDIO_CHANNEL_COUNT 2
+
+/*
+ * 0: Standard I2S
+ * 1: 32bit I2S
+ */
+#define I2S_INPUT_FORMAT 1
+
+/*
+ * 0: Left-justified
+ * 1: Right-justified
+ */
+#define I2S_JUSTIFIED 0
+
+/*
+ * 0: Data delay 1T correspond to WS
+ * 1: No data delay correspond to WS
+ */
+#define I2S_DATA_DELAY 0
+
+/*
+ * 0: Left channel
+ * 1: Right channel
+ */
+#define I2S_WS_CHANNEL 0
+
+/*
+ * 0: MSB shift first
+ * 1: LSB shift first
+ */
+#define I2S_DATA_SEQUENCE 0
+
+/*
+ * IT6505 maximum link rate
+ * RBR : 1.62 Gbps/lane
+ * HBR : 2.7  Gbps/lane
+ * HBR2: 5.4  Gbps/lane
+ * HBR3: 8.1  Gbps/lane
+ */
+#define MAX_LINK_RATE HBR
+
+/* IT6505 maximum lane count */
+#define MAX_LANE_COUNT 4
+
+#define TRAINING_LINK_RATE HBR
+#define TRAINING_LANE_COUNT 4
+#define ENABLE_DP_LANE_SWAP 0
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PIXEL_CLK_DELAY 1
+#define PIXEL_CLK_INVERSE 0
+#define ADJUST_PHASE_THRESHOLD 8
+#define MAX_PIXEL_CLK 95000
+#define DEFAULT_DRV_HOLD 0
+#define DEFAULT_PWR_ON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/*
+ * Vendor option afe settings for different platforms
+ * 0: for bitland 10e, quanta zde
+ * 1: for google kukui p1/p2, huaqin krane
+ */
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2A, 0x85}
+};
+
+enum it6505_sys_state {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_TRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_HDCP,
+   SYS_NOROP,
+   SYS_UNKNOWN,
+};
+
+enum it6505_audio_select {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_audio_sample_rate {
+   SAMPLE_RATE_24K = 0x6,
+   SAMPLE_RATE_32K = 0x3,
+   SAMPLE_RATE_48K = 0x2,
+   SAMPLE_RATE_96K = 0xA,
+   SAMPLE_RATE_192K = 0xE,
+   SAMPLE_RATE_44_1K = 0x0,
+   SAMPLE_RATE_88_2K = 0x8,
+   SAMPLE_RATE_176_4K = 0xC,
+};
+
+enum it6505_audio_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+};
+
+enum it6505_audio_word_length {
+   WORD_LENGTH_16BIT = 0,
+   WORD_LENGTH_18BIT,
+   WORD_LENGTH_20BIT,
+   WORD_LENGTH_24BIT,
+};
+
+/*
+ * Audio Sample Word Length
+ * WORD_LENGTH_16BIT
+ * WORD_LENGTH_18BIT
+ * WORD_LENGTH_20BIT
+ * WORD_LENGTH_24BIT
+ */
+#define AUDIO_WORD_LENGTH WORD_LENGTH_24BIT
+
+enum it6505_link_rate {
+   RBR,
+   HBR,
+   HBR2,
+   HBR3,
+};
+
+struct it6505_audio_sample_rate_map {
+   enum it6505_audio_sample_rate rate;
+   int sample_rate_value;
+};
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   st

[PATCH v8 0/3] IT6505 cover letter

2020-03-23 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series contains document bindings, revert commit, add vendor prefix, 
Kconfig to control the function enable or not.

Allen Chen (1):
  WIP: drm/bridge: add it6505 driver

allen (2):
  dt-bindings: Add vendor prefix for ITE Tech. Inc.
  WIP: dt-bindings: Add binding for IT6505.

 .../bindings/display/bridge/ite,it6505.yaml|   91 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +-
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 3064 
 5 files changed, 3164 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v8 2/3] dt-bindings: Add binding for IT6505.

2020-03-23 Thread allen
Add a DT binding documentation for IT6505.

Acked-by: Sam Ravnborg 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
cros-ec does not have an associated driver that uses the standard Linux USB-C 
driver class.
extcon is used to model the Type-C connector.(crbug.com/982932)
---
 .../bindings/display/bridge/ite,it6505.yaml| 91 ++
 1 file changed, 91 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
new file mode 100644
index ..13feeef
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -0,0 +1,91 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/ite,it6505.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE it6505 Device Tree Bindings
+
+maintainers:
+  - Allen Chen 
+
+description: |
+  The IT6505 is a high-performance DisplayPort 1.1a transmitter,
+  fully compliant with DisplayPort 1.1a, HDCP 1.3 specifications.
+  The IT6505 supports color depth of up to 36 bits (12 bits/color)
+  and ensures robust transmission of high-quality uncompressed video
+  content, along with uncompressed and compressed digital audio content.
+
+  Aside from the various video output formats supported, the IT6505
+  also encodes and transmits up to 8 channels of I2S digital audio,
+  with sampling rate up to 192kHz and sample size up to 24 bits.
+  In addition, an S/PDIF input port takes in compressed audio of up to
+  192kHz frame rate.
+
+  Each IT6505 chip comes preprogrammed with an unique HDCP key,
+  in compliance with the HDCP 1.3 standard so as to provide secure
+  transmission of high-definition content. Users of the IT6505 need not
+  purchase any HDCP keys or ROMs.
+
+properties:
+  compatible:
+const: ite,it6505
+
+  ovdd-supply:
+maxItems: 1
+description: I/O voltage
+
+  pwr18-supply:
+maxItems: 1
+description: core voltage
+
+  interrupts:
+maxItems: 1
+description: interrupt specifier of INT pin
+
+  reset-gpios:
+maxItems: 1
+description: gpio specifier of RESET pin
+
+  extcon:
+maxItems: 1
+description: extcon specifier for the Power Delivery
+
+  port:
+type: object
+description: A port node pointing to DPI host port node
+
+required:
+  - compatible
+  - ovdd-supply
+  - pwr18-supply
+  - interrupts
+  - reset-gpios
+  - extcon
+
+examples:
+  - |
+#include 
+
+i2c3 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_FALLING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+extcon = <&usbc_extcon>;
+
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
+};
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 0/3] IT6505 cover letter

2020-03-09 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series contains document bindings, revert commit, add vendor prefix, 
Kconfig to control the function enable or not.

Allen Chen (1):
  WIP: drm/bridge: add it6505 driver

allen (2):
  dt-bindings: Add vendor prefix for ITE Tech. Inc.
  WIP: dt-bindings: Add binding for IT6505.

 .../bindings/display/bridge/ite,it6505.yaml|   96 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +-
 drivers/gpu/drm/bridge/Kconfig |   11 +-
 drivers/gpu/drm/bridge/Makefile|6 +-
 drivers/gpu/drm/bridge/ite-it6505.c| 3022 
 5 files changed, 3132 insertions(+), 5 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 2/3] dt-bindings: Add binding for IT6505.

2020-03-09 Thread allen
Add a DT binding documentation for IT6505.

Acked-by: Sam Ravnborg 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 .../bindings/display/bridge/ite,it6505.yaml| 96 ++
 1 file changed, 96 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
new file mode 100644
index ..e9f6b58
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/ite,it6505.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE it6505 Device Tree Bindings
+
+maintainers:
+  - Allen Chen 
+
+description: |
+  The IT6505 is a high-performance DisplayPort 1.1a transmitter,
+  fully compliant with DisplayPort 1.1a, HDCP 1.3 specifications.
+  The IT6505 supports color depth of up to 36 bits (12 bits/color)
+  and ensures robust transmission of high-quality uncompressed video
+  content, along with uncompressed and compressed digital audio content.
+
+  Aside from the various video output formats supported, the IT6505
+  also encodes and transmits up to 8 channels of I2S digital audio,
+  with sampling rate up to 192kHz and sample size up to 24 bits.
+  In addition, an S/PDIF input port takes in compressed audio of up to
+  192kHz frame rate.
+
+  Each IT6505 chip comes preprogrammed with an unique HDCP key,
+  in compliance with the HDCP 1.3 standard so as to provide secure
+  transmission of high-definition content. Users of the IT6505 need not
+  purchase any HDCP keys or ROMs.
+
+properties:
+  compatible:
+const: ite,it6505
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge
+
+  ovdd-supply:
+maxItems: 1
+description: I/O voltage
+
+  pwr18-supply:
+maxItems: 1
+description: core voltage
+
+  interrupts:
+maxItems: 1
+description: interrupt specifier of INT pin
+
+  reset-gpios:
+maxItems: 1
+description: gpio specifier of RESET pin
+
+  extcon:
+maxItems: 1
+description: extcon specifier for the Power Delivery
+
+  port:
+type: object
+description: A port node pointing to DPI host port node
+
+required:
+  - compatible
+  - reg
+  - ovdd-supply
+  - pwr18-supply
+  - interrupts
+  - reset-gpios
+  - extcon
+
+examples:
+  - |
+#include 
+
+i2c3 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_FALLING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+extcon = <&usbc_extcon>;
+
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
+};
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 3/3] drm/bridge: add it6505 driver

2020-03-09 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |   11 +-
 drivers/gpu/drm/bridge/Makefile |6 +-
 drivers/gpu/drm/bridge/ite-it6505.c | 3022 +++
 3 files changed, 3035 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index aaed234..ff81681 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -38,8 +38,15 @@ config DRM_DISPLAY_CONNECTOR
  on ARM-based platforms. Saying Y here when this driver is not needed
  will not cause any issue.
 
-config DRM_LVDS_CODEC
-   tristate "Transparent LVDS encoders and decoders support"
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
+config DRM_LVDS_ENCODER
+   tristate "Transparent parallel to LVDS encoder support"
depends on OF
select DRM_KMS_HELPER
select DRM_PANEL_BRIDGE
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 6fb062b..e6c80ab 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
-obj-$(CONFIG_DRM_DISPLAY_CONNECTOR) += display-connector.o
-obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o
+obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_GENERIC_GPIO_MUX) += generic-gpio-mux.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
+obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..bbae6fd
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,3022 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* Vendor option */
+#define AUDIO_SELECT I2S
+#define AUDIO_TYPE LPCM
+#define AUDIO_SAMPLE_RATE SAMPLE_RATE_48K
+#define AUDIO_CHANNEL_COUNT 2
+
+/*
+ * 0: Standard I2S
+ * 1: 32bit I2S
+ */
+#define I2S_INPUT_FORMAT 1
+
+/*
+ * 0: Left-justified
+ * 1: Right-justified
+ */
+#define I2S_JUSTIFIED 0
+
+/*
+ * 0: Data delay 1T correspond to WS
+ * 1: No data delay correspond to WS
+ */
+#define I2S_DATA_DELAY 0
+
+/*
+ * 0: Left channel
+ * 1: Right channel
+ */
+#define I2S_WS_CHANNEL 0
+
+/*
+ * 0: MSB shift first
+ * 1: LSB shift first
+ */
+#define I2S_DATA_SEQUENCE 0
+
+/*
+ * IT6505 maximum link rate
+ * RBR : 1.62 Gbps/lane
+ * HBR : 2.7  Gbps/lane
+ * HBR2: 5.4  Gbps/lane
+ * HBR3: 8.1  Gbps/lane
+ */
+#define MAX_LINK_RATE HBR
+
+/* IT6505 maximum lane count */
+#define MAX_LANE_COUNT 4
+
+#define TRAINING_LINK_RATE HBR
+#define TRAINING_LANE_COUNT 4
+#define ENABLE_DP_LANE_SWAP 0
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PIXEL_CLK_DELAY 1
+#define PIXEL_CLK_INVERSE 0
+#define ADJUST_PHASE_THRESHOLD 8
+#define MAX_PIXEL_CLK 95000
+#define DEFAULT_DRV_HOLD 0
+#define DEFAULT_PWR_ON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/*
+ * Vendor option afe settings for different platforms
+ * 0: for bitland 10e, quanta zde
+ * 1: for google kukui p1/p2, huaqin krane
+ */
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2A, 0x85}
+};
+
+enum it6505_sys_state {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_TRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_HDCP,
+   SYS_NOROP,
+   SYS_UNKNOWN,
+};
+
+enum it6505_audio_select {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_audio_sample_rate {
+   SAMPLE_RATE_24K = 0x6,
+   SAMPLE_RATE_32K = 0x3,
+   SAMPLE_RATE_48K = 0x2,
+   SAMPLE_RATE_96K = 0xA,
+   SAMPLE_RATE_192K = 0xE,
+   SAMPLE_RATE_44_1K = 0x0,
+   SAMPLE_RATE_88_2K = 0x8,
+   SAMPLE_RATE_176_4K = 0xC,
+   SAMPLE_RATE_UNKNOWN = 0xFF,
+};
+
+enum it6505_audio_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+};
+
+enum it6505_audio_word_length {
+   WORD_LENGTH_16BIT = 0,
+   WORD_LENGTH_18BIT,
+   WORD_LENGTH_20BIT,
+   WORD_LENGTH_24BIT,
+};
+
+/*
+ * Audio Sample Word Length
+ * WORD_LENGTH_16BIT
+ * WORD_LENGTH_18BIT
+ * WORD_LENG

[PATCH v6 4/4] drm/bridge: add it6505 driver

2020-01-20 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2698 +++
 3 files changed, 2706 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3436297..c8cfaf7 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -45,6 +45,13 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf..f5abca5 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..a244c1c
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2698 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+/* Vendor option */
+#define AUDIO_SELECT I2S
+#define AUDIO_TYPE LPCM
+#define AUDIO_SAMPLE_RATE SAMPLE_RATE_48K
+#define AUDIO_CHANNEL_COUNT 2
+
+/*
+ * 0: Standard I2S
+ * 1: 32bit I2S
+ */
+#define I2S_INPUT_FORMAT 1
+
+/*
+ * 0: Left-justified
+ * 1: Right-justified
+ */
+#define I2S_JUSTIFIED 0
+
+/*
+ * 0: Data delay 1T correspond to WS
+ * 1: No data delay correspond to WS
+ */
+#define I2S_DATA_DELAY 0
+
+/*
+ * 0: Left channel
+ * 1: Right channel
+ */
+#define I2S_WS_CHANNEL 0
+
+/*
+ * 0: MSB shift first
+ * 1: LSB shift first
+ */
+#define I2S_DATA_SEQUENCE 0
+
+/*
+ * IT6505 maximum link rate
+ * RBR : 1.62 Gbps/lane
+ * HBR : 2.7  Gbps/lane
+ * HBR2: 5.4  Gbps/lane
+ * HBR3: 8.1  Gbps/lane
+ */
+#define MAX_LINK_RATE HBR
+
+/* IT6505 maximum lane count */
+#define MAX_LANE_COUNT 4
+
+#define TRAINING_LINK_RATE HBR
+#define TRAINING_LANE_COUNT 4
+#define ENABLE_DP_LANE_SWAP 0
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PIXEL_CLK_DELAY 1
+#define PIXEL_CLK_INVERSE 0
+#define ADJUST_PHASE_THRESHOLD 8
+#define MAX_PIXEL_CLK 95000
+#define DEFAULT_DRV_HOLD 0
+#define DEFAULT_PWR_ON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/*
+ * Vendor option afe settings for different platforms
+ * 0: for bitland 10e, quanta zde
+ * 1: for google kukui p1/p2, huaqin krane
+ */
+#define AFE_SETTING 1
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2A, 0x85}
+};
+
+enum it6505_sys_state {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_HDCP,
+   SYS_NOROP,
+   SYS_UNKNOWN,
+};
+
+enum it6505_audio_select {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_audio_sample_rate {
+   SAMPLE_RATE_24K = 0x6,
+   SAMPLE_RATE_32K = 0x3,
+   SAMPLE_RATE_48K = 0x2,
+   SAMPLE_RATE_96K = 0xA,
+   SAMPLE_RATE_192K = 0xE,
+   SAMPLE_RATE_44_1K = 0x0,
+   SAMPLE_RATE_88_2K = 0x8,
+   SAMPLE_RATE_176_4K = 0xC,
+   SAMPLE_RATE_UNKNOWN = 0xFF,
+};
+
+enum it6505_audio_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+};
+
+enum it6505_audio_word_length {
+   WORD_LENGTH_16BIT = 0,
+   WORD_LENGTH_18BIT,
+   WORD_LENGTH_20BIT,
+   WORD_LENGTH_24BIT,
+};
+
+/*
+ * Audio Sample Word Length
+ * WORD_LENGTH_16BIT
+ * WORD_LENGTH_18BIT
+ * WORD_LENGTH_20BIT
+ * WORD_LENGTH_24BIT
+ */
+#define AUDIO_WORD_LENGTH WORD_LENGTH_24BIT
+
+enum it6505_link_rate {
+   RBR,
+   HBR,
+   HBR2,
+   HBR3,
+};
+
+struct it6505_audio_sample_rate_map {
+   enum it6505_audio_sample_rate rate;
+   int sample_rate_value;
+};
+
+struct it6505_platform_d

[PATCH v6 2/4] Revert "drm/tegra: Move drm_dp_link helpers to Tegra DRM"

2020-01-20 Thread allen
IT6505 driver ite-it6505.c file using drm_dp_link helpers, so revert.
This reverts commit 9a42c7c647a9ad0f7ebb147a52eda3dcb7c84292.

Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/drm_dp_helper.c | 128 ++
 drivers/gpu/drm/tegra/Makefile  |   1 -
 drivers/gpu/drm/tegra/dp.c  | 876 
 drivers/gpu/drm/tegra/dp.h  | 177 
 drivers/gpu/drm/tegra/dpaux.c   |   1 -
 drivers/gpu/drm/tegra/sor.c |   1 -
 include/drm/drm_dp_helper.h |  16 +
 7 files changed, 144 insertions(+), 1056 deletions(-)
 delete mode 100644 drivers/gpu/drm/tegra/dp.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.h

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 2c7870a..f567141 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -352,6 +352,134 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
 EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
 
 /**
+ * drm_dp_link_probe() - probe a DisplayPort link for capabilities
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to structure in which to return link capabilities
+ *
+ * The structure filled in by this function can usually be passed directly
+ * into drm_dp_link_power_up() and drm_dp_link_configure() to power up and
+ * configure the link based on the link's capabilities.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 values[3];
+   int err;
+
+   memset(link, 0, sizeof(*link));
+
+   err = drm_dp_dpcd_read(aux, DP_DPCD_REV, values, sizeof(values));
+   if (err < 0)
+   return err;
+
+   link->revision = values[0];
+   link->rate = drm_dp_bw_code_to_link_rate(values[1]);
+   link->num_lanes = values[2] & DP_MAX_LANE_COUNT_MASK;
+
+   if (values[2] & DP_ENHANCED_FRAME_CAP)
+   link->capabilities |= DP_LINK_CAP_ENHANCED_FRAMING;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_probe);
+
+/**
+ * drm_dp_link_power_up() - power up a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 value;
+   int err;
+
+   /* DP_SET_POWER register is only available on DPCD v1.1 and later */
+   if (link->revision < 0x11)
+   return 0;
+
+   err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
+   if (err < 0)
+   return err;
+
+   value &= ~DP_SET_POWER_MASK;
+   value |= DP_SET_POWER_D0;
+
+   err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
+   if (err < 0)
+   return err;
+
+   /*
+* According to the DP 1.1 specification, a "Sink Device must exit the
+* power saving state within 1 ms" (Section 2.5.3.1, Table 5-52, "Sink
+* Control Field" (register 0x600).
+*/
+   usleep_range(1000, 2000);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_power_up);
+
+/**
+ * drm_dp_link_power_down() - power down a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 value;
+   int err;
+
+   /* DP_SET_POWER register is only available on DPCD v1.1 and later */
+   if (link->revision < 0x11)
+   return 0;
+
+   err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
+   if (err < 0)
+   return err;
+
+   value &= ~DP_SET_POWER_MASK;
+   value |= DP_SET_POWER_D3;
+
+   err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_power_down);
+
+/**
+ * drm_dp_link_configure() - configure a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 values[2];
+   int err;
+
+   values[0] = drm_dp_link_rate_to_bw_code(link->rate);
+   values[1] = link->num_lanes;
+
+   if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
+   values[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
+
+   err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, values, sizeof(values));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_configure);
+
+/**
  * drm_dp_downstream_max_clock() - extract branch device max
  * pixel 

[PATCH v6 3/4] dt-bindings: Add binding for IT6505.

2020-01-20 Thread allen
Add a DT binding documentation for IT6505.

Acked-by: Sam Ravnborg 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 .../bindings/display/bridge/ite,it6505.yaml| 89 ++
 1 file changed, 89 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
new file mode 100644
index ..5c152ca8
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/ite,it6505.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE it6505 Device Tree Bindings
+
+maintainers:
+  - Allen Chen 
+
+description: |
+  The IT6505 is a high-performance DisplayPort 1.1a transmitter,
+  fully compliant with DisplayPort 1.1a, HDCP 1.3 specifications.
+  The IT6505 supports color depth of up to 36 bits (12 bits/color)
+  and ensures robust transmission of high-quality uncompressed video
+  content, along with uncompressed and compressed digital audio content.
+
+  Aside from the various video output formats supported, the IT6505
+  also encodes and transmits up to 8 channels of I2S digital audio,
+  with sampling rate up to 192kHz and sample size up to 24 bits.
+  In addition, an S/PDIF input port takes in compressed audio of up to
+  192kHz frame rate.
+
+  Each IT6505 chip comes preprogrammed with an unique HDCP key,
+  in compliance with the HDCP 1.3 standard so as to provide secure
+  transmission of high-definition content. Users of the IT6505 need not
+  purchase any HDCP keys or ROMs.
+
+properties:
+  compatible:
+const: ite,it6505
+
+  reg:
+maxItems: 1
+description: i2c address of the bridge
+
+  ovdd-supply:
+maxItems: 1
+description: I/O voltage
+
+  pwr18-supply:
+maxItems: 1
+description: core voltage
+
+  interrupts:
+maxItems: 1
+description: interrupt specifier of INT pin
+
+  reset-gpios:
+maxItems: 1
+description: gpio specifier of RESET pin
+
+  extcon:
+maxItems: 1
+description: extcon specifier for the Power Delivery
+
+  port:
+type: object
+description: A port node pointing to DPI host port node
+
+required:
+  - compatible
+  - reg
+  - ovdd-supply
+  - pwr18-supply
+  - interrupts
+  - reset-gpios
+  - extcon
+
+examples:
+  - |
+dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+extcon = <&usbc_extcon>;
+
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v6 0/4] IT6505 cover letter

2020-01-20 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth
of up to 36 bits (12 bits/color) and ensures robust transmission of high-quality
uncompressed video content, along with uncompressed and compressed digital audio
content.

This series contains document bindings, revert commit, add vendor prefix,
Kconfig to control the function enable or not.

Allen Chen (1):
  WIP: drm/bridge: add it6505 driver

allen (3):
  dt-bindings: Add vendor prefix for ITE Tech. Inc.
  Revert "drm/tegra: Move drm_dp_link helpers to Tegra DRM"
  WIP: dt-bindings: Add binding for IT6505.

 .../bindings/display/bridge/ite,it6505.yaml|   89 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 2698 
 drivers/gpu/drm/drm_dp_helper.c|  128 +
 drivers/gpu/drm/tegra/Makefile |1 -
 drivers/gpu/drm/tegra/dp.c |  876 ---
 drivers/gpu/drm/tegra/dp.h |  177 --
 drivers/gpu/drm/tegra/dpaux.c  |1 -
 drivers/gpu/drm/tegra/sor.c|1 -
 include/drm/drm_dp_helper.h|   16 +
 12 files changed, 2941 insertions(+), 1056 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.h

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/edid: fixup EDID 1.4 judge reduced-blanking timings logic

2019-12-12 Thread allen
According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD
(Defines EDID Structure Version 1, Revision 4) page: 39
How to determine whether the monitor support RB timing or not?
EDID 1.4
First:  read detailed timing descriptor and make sure byte 0 = 0x00,
byte 1 = 0x00, byte 2 = 0x00 and byte 3 = 0xFD
Second: read EDID bit 0 in feature support byte at address 18h = 1
and detailed timing descriptor byte 10 = 0x04
Third:  if EDID bit 0 in feature support byte = 1 &&
detailed timing descriptor byte 10 = 0x04
then we can check byte 15, if bit 4 in byte 15 = 1 is support RB
if EDID bit 0 in feature support byte != 1 ||
detailed timing descriptor byte 10 != 0x04,
then byte 15 can not be used

The linux code is_rb function not follow the VESA's rule

Signed-off-by: Allen Chen 
Reported-by: kbuild test robot 
---
 drivers/gpu/drm/drm_edid.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index f5926bf..826ed78 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2017,13 +2017,21 @@ struct drm_display_mode *drm_mode_find_dmt(struct 
drm_device *dev,
}
 }
 
+static bool
+is_display_descriptor(const u8 *r, u8 tag)
+{
+   return (!r[0] && !r[1] && !r[2] && r[3] == tag) ? true : false;
+}
+
 static void
 is_rb(struct detailed_timing *t, void *data)
 {
u8 *r = (u8 *)t;
-   if (r[3] == EDID_DETAIL_MONITOR_RANGE)
-   if (r[15] & 0x10)
-   *(bool *)data = true;
+
+   if (is_display_descriptor(r, EDID_DETAIL_MONITOR_RANGE)) {
+   if (r[10] == BIT(2))
+   *(int *)data = !!(r[15] & 0x10);
+   }
 }
 
 /* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
@@ -2031,9 +2039,13 @@ struct drm_display_mode *drm_mode_find_dmt(struct 
drm_device *dev,
 drm_monitor_supports_rb(struct edid *edid)
 {
if (edid->revision >= 4) {
-   bool ret = false;
-   drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
-   return ret;
+   if (edid->features & BIT(0)) {
+   int ret = -1;
+
+   drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
+   if (ret != -1)
+   return ret;
+   }
}
 
return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 2/4] Revert "drm/tegra: Move drm_dp_link helpers to Tegra DRM"

2019-12-10 Thread allen
This reverts commit 9a42c7c647a9ad0f7ebb147a52eda3dcb7c84292.

Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/drm_dp_helper.c | 128 ++
 drivers/gpu/drm/tegra/Makefile  |   1 -
 drivers/gpu/drm/tegra/dp.c  | 876 
 drivers/gpu/drm/tegra/dp.h  | 177 
 drivers/gpu/drm/tegra/dpaux.c   |   1 -
 drivers/gpu/drm/tegra/sor.c |   1 -
 include/drm/drm_dp_helper.h |  16 +
 7 files changed, 144 insertions(+), 1056 deletions(-)
 delete mode 100644 drivers/gpu/drm/tegra/dp.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.h

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 2c7870a..f567141 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -352,6 +352,134 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
 EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
 
 /**
+ * drm_dp_link_probe() - probe a DisplayPort link for capabilities
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to structure in which to return link capabilities
+ *
+ * The structure filled in by this function can usually be passed directly
+ * into drm_dp_link_power_up() and drm_dp_link_configure() to power up and
+ * configure the link based on the link's capabilities.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 values[3];
+   int err;
+
+   memset(link, 0, sizeof(*link));
+
+   err = drm_dp_dpcd_read(aux, DP_DPCD_REV, values, sizeof(values));
+   if (err < 0)
+   return err;
+
+   link->revision = values[0];
+   link->rate = drm_dp_bw_code_to_link_rate(values[1]);
+   link->num_lanes = values[2] & DP_MAX_LANE_COUNT_MASK;
+
+   if (values[2] & DP_ENHANCED_FRAME_CAP)
+   link->capabilities |= DP_LINK_CAP_ENHANCED_FRAMING;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_probe);
+
+/**
+ * drm_dp_link_power_up() - power up a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 value;
+   int err;
+
+   /* DP_SET_POWER register is only available on DPCD v1.1 and later */
+   if (link->revision < 0x11)
+   return 0;
+
+   err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
+   if (err < 0)
+   return err;
+
+   value &= ~DP_SET_POWER_MASK;
+   value |= DP_SET_POWER_D0;
+
+   err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
+   if (err < 0)
+   return err;
+
+   /*
+* According to the DP 1.1 specification, a "Sink Device must exit the
+* power saving state within 1 ms" (Section 2.5.3.1, Table 5-52, "Sink
+* Control Field" (register 0x600).
+*/
+   usleep_range(1000, 2000);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_power_up);
+
+/**
+ * drm_dp_link_power_down() - power down a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 value;
+   int err;
+
+   /* DP_SET_POWER register is only available on DPCD v1.1 and later */
+   if (link->revision < 0x11)
+   return 0;
+
+   err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
+   if (err < 0)
+   return err;
+
+   value &= ~DP_SET_POWER_MASK;
+   value |= DP_SET_POWER_D3;
+
+   err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_power_down);
+
+/**
+ * drm_dp_link_configure() - configure a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 values[2];
+   int err;
+
+   values[0] = drm_dp_link_rate_to_bw_code(link->rate);
+   values[1] = link->num_lanes;
+
+   if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
+   values[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
+
+   err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, values, sizeof(values));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_configure);
+
+/**
  * drm_dp_downstream_max_clock() - extract branch device max
  * pixel rate for legacy VGA
  * converter or m

[PATCH v5 4/4] drm/bridge: add it6505 driver

2019-12-10 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2753 +++
 3 files changed, 2761 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3436297..c8cfaf7 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -45,6 +45,13 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf..f5abca5 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..f9429d2
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2753 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AX 0
+#define BX 1
+#define AUDSEL I2S
+#define AUDTYPE LPCM
+#define AUDFS AUD48K
+#define AUDCH 2
+
+/*
+ * 0: Standard I2S
+ * 1: 32bit I2S
+ */
+#define I2SINPUTFMT 1
+
+/*
+ * 0: Left-justified
+ * 1: Right-justified
+ */
+#define I2SJUSTIFIED 0
+
+/*
+ * 0: Data delay 1T correspond to WS
+ * 1: No data delay correspond to WS
+ */
+#define I2SDATADELAY 0
+
+/*
+ * 0: left channel
+ * 1: right channel
+ */
+#define I2SWSCHANNEL 0
+
+/*
+ * 0: MSB shift first
+ * 1: LSB shift first
+ */
+#define I2SDATASEQ 0
+
+/*
+ * IT6505 maximum link rate
+ * RBR : 1.62 Gbps/lane
+ * HBR : 2.7  Gbps/lane
+ * HBR2: 5.4  Gbps/lane
+ * HBR3: 8.1  Gbps/lane
+ */
+#define MAX_LINK_RATE HBR
+
+/* IT6505 maximum lane count */
+#define MAX_LANE_COUNT 4
+
+/* User define training link rate */
+#define TRAINING_LINK_RATE HBR
+
+/* User define training lane count */
+#define TRAINING_LANE_COUNT 4
+#define LANESWAP 0
+#define ENSSC 1
+#define FLAGTRAINDOWN 150
+#define POLLINGKSVLIST 400
+#define TRAINFAILCNT 5
+#define TRAINFAILHPD 3
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PCLK_DELAY 1
+#define PCLK_INV 0
+#define ADJUST_PHASE_THRESHOLD 8
+#define PWROFFRETRYTIME 5
+#define MAXPCLK 95000
+#define DEFAULTHDCP 1
+#define DEFAULTAUDIO 0
+#define DEFAULTPWRONOFF 1
+#define DEFAULTDRVHOLD 0
+#define DEFAULTPWRON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/* AX or BX */
+#define CHIP_VERSION BX
+
+/*
+ * User define afe settings for different platforms
+ * 0: for bitland 10e, quanta zde
+ * 1: for google kukui p1/p2, huaqin krane
+ */
+#define AFE_SETTING 1
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2a, 0x85}
+};
+
+enum sys_status {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_ReHDCP,
+   SYS_NOROP,
+   SYS_Unknown,
+};
+
+enum it6505_aud_sel {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_aud_fs {
+   AUD24K = 0x6,
+   AUD32K = 0x3,
+   AUD48K = 0x2,
+   AUD96K = 0xA,
+   AUD192K = 0xE,
+   AUD44P1K = 0x0,
+   AUD88P2K = 0x8,
+   AUD176P4K = 0xC,
+};
+
+enum it6505_aud_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+};
+
+enum aud_word_length {
+   AUD16BIT = 0,
+   AUD18BIT,
+   AUD20BIT,
+   AUD24BIT,
+};
+
+/* Audio Sample Word Length: AUD16BIT, AUD18BIT, AUD20BIT, AUD24BIT */
+#define AUDWORDLENGTH AUD24BIT
+
+enum it6505_link_rate {
+   RBR,
+   HBR,
+   HBR2,
+   HBR3,
+};
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   struct regulator *ovdd;
+   struct gpio_desc *gpiod_hpd;
+   struct gp

[PATCH v5 3/4] dt-bindings: Add binding for IT6505.

2019-12-10 Thread allen
Add a DT binding documentation for IT6505.

Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 .../bindings/display/bridge/ite,it6505.yaml| 99 ++
 1 file changed, 99 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
new file mode 100644
index ..23a106a
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/ite,it6505.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ITE it6505 Device Tree Bindings
+
+maintainers:
+  - Allen Chen 
+
+description: |
+  The IT6505 is a high-performance DisplayPort 1.1a transmitter,
+fully compliant with DisplayPort 1.1a, HDCP 1.3 specifications.
+The IT6505 supports color depth of up to 36 bits (12 bits/color)
+and ensures robust transmission of high-quality uncompressed video
+content, along with uncompressed and compressed digital audio content.
+
+  Aside from the various video output formats supported, the IT6505
+also encodes and transmits up to 8 channels of I2S digital audio,
+with sampling rate up to 192kHz and sample size up to 24 bits.
+In addition, an S/PDIF input port takes in compressed audio of up to
+192kHz frame rate.
+
+  Each IT6505 chip comes preprogrammed with an unique HDCP key,
+in compliance with the HDCP 1.3 standard so as to provide secure
+transmission of high-definition content. Users of the IT6505 need not
+purchase any HDCP keys or ROMs.
+
+properties:
+  compatible:
+const: ite,it6505
+
+  reg:
+- maxItems: 1
+- description: i2c address of the bridge
+
+  ovdd-supply:
+- maxItems: 1
+- description: I/O voltage
+
+  pwr18-supply:
+- maxItems: 1
+- description: core voltage
+
+  interrupts:
+- maxItems: 1
+- description: interrupt specifier of INT pin
+
+  reset-gpios:
+- maxItems: 1
+- description: gpio specifier of RESET pin
+
+  hpd-gpios:
+- maxItems: 1
+- description:
+- Hotplug detect GPIO
+- Indicates which GPIO should be used for hotplug detection
+
+  extcon:
+- maxItems: 1
+- description: extcon specifier for the Power Delivery
+
+  port:
+- type: object
+- description: A port node pointing to DPI host port node
+
+required:
+  - compatible
+  - reg
+  - ovdd-supply
+  - pwr18-supply
+  - interrupts
+  - reset-gpios
+  - hpd-gpios
+  - extcon
+
+examples:
+  - |
+dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+hpd-gpios = <&pio 9 0>;
+extcon = <&usbc_extcon>;
+
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
+
+---
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 0/4] IT6505 cover letter

2019-12-10 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth
of up to 36 bits (12 bits/color) and ensures robust transmission of high-quality
uncompressed video content, along with uncompressed and compressed digital audio
content.

This series contains document bindings, revert commit, add vendor prefix,
Kconfig to control the function enable or not.

Allen Chen (1):
  WIP: drm/bridge: add it6505 driver

allen (3):
  dt-bindings: Add vendor prefix for ITE Tech. Inc.
  Revert "drm/tegra: Move drm_dp_link helpers to Tegra DRM"
  WIP: dt-bindings: Add binding for IT6505.

 .../bindings/display/bridge/ite,it6505.yaml|   99 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 2753 
 drivers/gpu/drm/drm_dp_helper.c|  128 +
 drivers/gpu/drm/tegra/Makefile |1 -
 drivers/gpu/drm/tegra/dp.c |  876 ---
 drivers/gpu/drm/tegra/dp.h |  177 --
 drivers/gpu/drm/tegra/dpaux.c  |1 -
 drivers/gpu/drm/tegra/sor.c|1 -
 include/drm/drm_dp_helper.h|   16 +
 12 files changed, 3006 insertions(+), 1056 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.yaml
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.h

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic

2019-11-27 Thread allen
According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD
(Defines EDID Structure Version 1, Revision 4) page: 39
How to determine whether the monitor support RB timing or not?
EDID 1.4
First:  read detailed timing descriptor and make sure byte 0 = 0x00,
byte 1 = 0x00, byte 2 = 0x00 and byte 3 = 0xFD
Second: read EDID bit 0 in feature support byte at address 18h = 1
and detailed timing descriptor byte 10 = 0x04
Third:  if EDID bit 0 in feature support byte = 1 &&
detailed timing descriptor byte 10 = 0x04
then we can check byte 15, if bit 4 in byte 15 = 1 is support RB
if EDID bit 0 in feature support byte != 1 ||
detailed timing descriptor byte 10 != 0x04,
then byte 15 can not be used

The linux code is_rb function not follow the VESA's rule

Signed-off-by: Allen Chen 
Reported-by: kbuild test robot 
---
 drivers/gpu/drm/drm_edid.c | 36 ++--
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index f5926bf..e11e585 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -93,6 +93,12 @@ struct detailed_mode_closure {
int modes;
 };
 
+struct edid_support_rb_closure {
+   struct edid *edid;
+   bool valid_support_rb;
+   bool support_rb;
+};
+
 #define LEVEL_DMT  0
 #define LEVEL_GTF  1
 #define LEVEL_GTF2 2
@@ -2017,23 +2023,41 @@ struct drm_display_mode *drm_mode_find_dmt(struct 
drm_device *dev,
}
 }
 
+static bool
+is_display_descriptor(const u8 *r, u8 tag)
+{
+   return (!r[0] && !r[1] && !r[2] && r[3] == tag) ? true : false;
+}
+
 static void
 is_rb(struct detailed_timing *t, void *data)
 {
u8 *r = (u8 *)t;
-   if (r[3] == EDID_DETAIL_MONITOR_RANGE)
-   if (r[15] & 0x10)
-   *(bool *)data = true;
+   struct edid_support_rb_closure *closure = data;
+   struct edid *edid = closure->edid;
+
+   if (is_display_descriptor(r, EDID_DETAIL_MONITOR_RANGE)) {
+   if (edid->features & BIT(0) && r[10] == BIT(2)) {
+   closure->valid_support_rb = true;
+   closure->support_rb = (r[15] & 0x10) ? true : false;
+   }
+   }
 }
 
 /* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
 static bool
 drm_monitor_supports_rb(struct edid *edid)
 {
+   struct edid_support_rb_closure closure = {
+   .edid = edid,
+   .valid_support_rb = false,
+   .support_rb = false,
+   };
+
if (edid->revision >= 4) {
-   bool ret = false;
-   drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
-   return ret;
+   drm_for_each_detailed_block((u8 *)edid, is_rb, &closure);
+   if (closure.valid_support_rb)
+   return closure.support_rb;
}
 
return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 4/4] drm/bridge: add it6505 driver

2019-11-15 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2697 +++
 3 files changed, 2705 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3436297..c8cfaf7 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -45,6 +45,13 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf..f5abca5 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index ..166310a
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2697 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AX 0
+#define BX 1
+#define AUDSEL I2S
+#define AUDTYPE LPCM
+#define AUDFS AUD48K
+#define AUDCH 2
+/* 0: Standard I2S;1: 32bit I2S */
+#define I2SINPUTFMT 1
+/* 0: Left-justified;1: Right-justified */
+#define I2SJUSTIFIED 0
+/* 0: Data delay 1T correspond to WS;1: No data delay correspond to WS */
+#define I2SDATADELAY 0
+/* 0: is left channel;1: is right channel */
+#define I2SWSCHANNEL 0
+/* 0: MSB shift first;1: LSB shift first */
+#define I2SDATASEQ 0
+
+#define LANESWAP 0
+#define LANE 4
+#define _HBR 1
+#define ENSSC 1
+#define FLAGTRAINDOWN 150
+#define POLLINGKSVLIST 400
+#define TRAINFAILCNT 5
+#define TRAINFAILHPD 3
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PCLK_DELAY 1
+#define PCLK_INV 0
+#define ADJUST_PHASE_THRESHOLD 8
+#define PWROFFRETRYTIME 5
+#define MAXPCLK 95000
+#define DEFAULTHDCP 1
+#define DEFAULTAUDIO 0
+#define DEFAULTPWRONOFF 1
+#define DEFAULTDRVHOLD 0
+#define DEFAULTPWRON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/* AX or BX */
+#define CHIP_VERSION BX
+
+/*
+ * afe settings for different platforms
+ * 0: for bitland 10e, quanta zde
+ * 1: for google kukui p1/p2, huaqin krane
+ */
+#define AFE_SETTING 1
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2a, 0x85}
+};
+
+enum sys_status {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_ReHDCP,
+   SYS_NOROP,
+   SYS_Unknown,
+};
+
+enum it6505_aud_sel {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_aud_fs {
+   AUD24K = 0x6,
+   AUD32K = 0x3,
+   AUD48K = 0x2,
+   AUD96K = 0xA,
+   AUD192K = 0xE,
+   AUD44P1K = 0x0,
+   AUD88P2K = 0x8,
+   AUD176P4K = 0xC,
+};
+
+enum it6505_aud_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+   HBR,
+};
+
+enum aud_word_length {
+   AUD16BIT = 0,
+   AUD18BIT,
+   AUD20BIT,
+   AUD24BIT,
+};
+
+/* Audio Sample Word Length: AUD16BIT, AUD18BIT, AUD20BIT, AUD24BIT */
+#define AUDWORDLENGTH AUD24BIT
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   struct regulator *ovdd;
+   struct gpio_desc *gpiod_hpd;
+   struct gpio_desc *gpiod_reset;
+};
+
+struct it6505 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct it6505_platform_data pdata;
+   struct mutex lock;
+   struct mutex mode_lock;
+   struct regmap *regmap;
+   struct drm_display_mode vid_info;
+
+   struct notifier_block event_nb;
+   struc

[PATCH v4 2/4] Revert "drm/tegra: Move drm_dp_link helpers to Tegra DRM"

2019-11-15 Thread allen
This reverts commit 9a42c7c647a9ad0f7ebb147a52eda3dcb7c84292.

Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/drm_dp_helper.c | 128 ++
 drivers/gpu/drm/tegra/Makefile  |   1 -
 drivers/gpu/drm/tegra/dp.c  | 876 
 drivers/gpu/drm/tegra/dp.h  | 177 
 drivers/gpu/drm/tegra/dpaux.c   |   1 -
 drivers/gpu/drm/tegra/sor.c |   1 -
 include/drm/drm_dp_helper.h |  16 +
 7 files changed, 144 insertions(+), 1056 deletions(-)
 delete mode 100644 drivers/gpu/drm/tegra/dp.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.h

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 2c7870a..f567141 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -352,6 +352,134 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
 EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
 
 /**
+ * drm_dp_link_probe() - probe a DisplayPort link for capabilities
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to structure in which to return link capabilities
+ *
+ * The structure filled in by this function can usually be passed directly
+ * into drm_dp_link_power_up() and drm_dp_link_configure() to power up and
+ * configure the link based on the link's capabilities.
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 values[3];
+   int err;
+
+   memset(link, 0, sizeof(*link));
+
+   err = drm_dp_dpcd_read(aux, DP_DPCD_REV, values, sizeof(values));
+   if (err < 0)
+   return err;
+
+   link->revision = values[0];
+   link->rate = drm_dp_bw_code_to_link_rate(values[1]);
+   link->num_lanes = values[2] & DP_MAX_LANE_COUNT_MASK;
+
+   if (values[2] & DP_ENHANCED_FRAME_CAP)
+   link->capabilities |= DP_LINK_CAP_ENHANCED_FRAMING;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_probe);
+
+/**
+ * drm_dp_link_power_up() - power up a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 value;
+   int err;
+
+   /* DP_SET_POWER register is only available on DPCD v1.1 and later */
+   if (link->revision < 0x11)
+   return 0;
+
+   err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
+   if (err < 0)
+   return err;
+
+   value &= ~DP_SET_POWER_MASK;
+   value |= DP_SET_POWER_D0;
+
+   err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
+   if (err < 0)
+   return err;
+
+   /*
+* According to the DP 1.1 specification, a "Sink Device must exit the
+* power saving state within 1 ms" (Section 2.5.3.1, Table 5-52, "Sink
+* Control Field" (register 0x600).
+*/
+   usleep_range(1000, 2000);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_power_up);
+
+/**
+ * drm_dp_link_power_down() - power down a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 value;
+   int err;
+
+   /* DP_SET_POWER register is only available on DPCD v1.1 and later */
+   if (link->revision < 0x11)
+   return 0;
+
+   err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
+   if (err < 0)
+   return err;
+
+   value &= ~DP_SET_POWER_MASK;
+   value |= DP_SET_POWER_D3;
+
+   err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_power_down);
+
+/**
+ * drm_dp_link_configure() - configure a DisplayPort link
+ * @aux: DisplayPort AUX channel
+ * @link: pointer to a structure containing the link configuration
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link)
+{
+   u8 values[2];
+   int err;
+
+   values[0] = drm_dp_link_rate_to_bw_code(link->rate);
+   values[1] = link->num_lanes;
+
+   if (link->capabilities & DP_LINK_CAP_ENHANCED_FRAMING)
+   values[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
+
+   err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, values, sizeof(values));
+   if (err < 0)
+   return err;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_dp_link_configure);
+
+/**
  * drm_dp_downstream_max_clock() - extract branch device max
  * pixel rate for legacy VGA
  * converter or m

[PATCH v4 0/4] IT6505 cover letter

2019-11-15 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series contains document bindings, revert commit, add vendor prefix, 
Kconfig to control the function enable or not.

Allen Chen (2):
  dt-bindings: Add binding for IT6505.
  drm/bridge: add it6505 driver

allen (2):
  dt-bindings: Add vendor prefix for ITE Tech. Inc.
  Revert "drm/tegra: Move drm_dp_link helpers to Tegra DRM"

 .../bindings/display/bridge/ite,it6505.txt |   28 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 2697 
 drivers/gpu/drm/drm_dp_helper.c|  128 +
 drivers/gpu/drm/tegra/Makefile |1 -
 drivers/gpu/drm/tegra/dp.c |  876 ---
 drivers/gpu/drm/tegra/dp.h |  177 --
 drivers/gpu/drm/tegra/dpaux.c  |1 -
 drivers/gpu/drm/tegra/sor.c|1 -
 include/drm/drm_dp_helper.h|   16 +
 12 files changed, 2879 insertions(+), 1056 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.c
 delete mode 100644 drivers/gpu/drm/tegra/dp.h

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 3/4] dt-bindings: Add binding for IT6505.

2019-11-15 Thread allen
From: Allen Chen 

Add a DT binding documentation for IT6505.

Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 .../bindings/display/bridge/ite,it6505.txt | 28 ++
 1 file changed, 28 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
new file mode 100644
index ..72da0c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
@@ -0,0 +1,28 @@
+iTE it6505 DP bridge bindings
+
+Required properties:
+- compatible: "ite,it6505"
+- reg: i2c address of the bridge
+- ovdd-supply: I/O voltage
+- pwr18-supply: Core voltage
+- interrupts: interrupt specifier of INT pin
+- reset-gpios: gpio specifier of RESET pin
+   - hpd-gpios:
+   Hotplug detect GPIO.
+   Indicates which GPIO should be used for hotplug detection
+   - port@[x]: SoC specific port nodes with endpoint definitions as defined
+   in 
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
+
+Example:
+   dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+hpd-gpios = <&pio 9 0>;
+extcon = <&usbc_extcon>;
+};
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic

2019-11-04 Thread allen
According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD
(Defines EDID Structure Version 1, Revision 4) page: 39
How to determine whether the monitor support RB timing or not?
EDID 1.4
First:  read detailed timing descriptor and make sure byte0 = 0,
byte1 = 0, byte2 = 0 and byte3 = 0xFD
Second: read detailed timing descriptor byte10 = 0x04 and
EDID byte18h bit0 = 1
Third:  if EDID byte18h bit0 == 1 && byte10 == 0x04,
then we can check byte15, if byte15 bit4 =1 is support RB
if EDID byte18h bit0 != 1 || byte10 != 0x04,
then byte15 can not be used

The linux code is_rb function not follow the VESA's rule

EDID 1.3
LCD flat panels do not require long blanking intervals as a retrace
period so default support reduced-blanking timings.

Signed-off-by: Allen Chen 
Reported-by: kbuild test robot 
---
 drivers/gpu/drm/drm_edid.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index e5e7e65..9b67b80 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -93,6 +93,11 @@ struct detailed_mode_closure {
int modes;
 };
 
+struct edid_support_rb_closure {
+   struct edid *edid;
+   s8 support_rb;
+};
+
 #define LEVEL_DMT  0
 #define LEVEL_GTF  1
 #define LEVEL_GTF2 2
@@ -2018,22 +2023,31 @@ struct drm_display_mode *drm_mode_find_dmt(struct 
drm_device *dev,
 is_rb(struct detailed_timing *t, void *data)
 {
u8 *r = (u8 *)t;
-   if (r[3] == EDID_DETAIL_MONITOR_RANGE)
-   if (r[15] & 0x10)
-   *(bool *)data = true;
+   struct edid_support_rb_closure *closure = data;
+   struct edid *edid = closure->edid;
+
+   if (!r[0] && !r[1] && !r[2] && r[3] == EDID_DETAIL_MONITOR_RANGE) {
+   if (edid->features & BIT(0) && r[10] == BIT(2))
+   closure->support_rb = (r[15] & 0x10) ? 1 : 0;
+   }
 }
 
 /* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
 static bool
 drm_monitor_supports_rb(struct edid *edid)
 {
+   struct edid_support_rb_closure closure = {
+   .edid = edid,
+   .support_rb = -1,
+   };
+
if (edid->revision >= 4) {
-   bool ret = false;
-   drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
-   return ret;
+   drm_for_each_detailed_block((u8 *)edid, is_rb, &closure);
+   if (closure.support_rb >= 0)
+   return closure.support_rb;
}
 
-   return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
+   return true;
 }
 
 static void
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic

2019-11-01 Thread allen
According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD
(Defines EDID Structure Version 1, Revision 4) page: 39
How to determine whether the monitor support RB timing or not?
EDID 1.4
First:  read detailed timing descriptor and make sure byte0 = 0,
byte1 = 0, byte2 = 0 and byte3 = 0xFD
Second: read detailed timing descriptor byte10 = 0x04 and
EDID byte18h bit0 = 1
Third:  if EDID byte18h bit0 == 1 && byte10 == 0x04,
then we can check byte15, if byte15 bit4 =1 is support RB
if EDID byte18h bit0 != 1 || byte10 != 0x04,
then byte15 can not be used

The linux code is_rb function not follow the VESA's rule

EDID 1.3
LCD flat panels do not require long blanking intervals as a retrace
period so default support reduced-blanking timings.

Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/drm_edid.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index e5e7e65..08e914d 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -93,6 +93,11 @@ struct detailed_mode_closure {
int modes;
 };
 
+struct edid_support_rb_closure {
+   struct edid *edid;
+   u8 support_rb;
+};
+
 #define LEVEL_DMT  0
 #define LEVEL_GTF  1
 #define LEVEL_GTF2 2
@@ -2018,22 +2023,31 @@ struct drm_display_mode *drm_mode_find_dmt(struct 
drm_device *dev,
 is_rb(struct detailed_timing *t, void *data)
 {
u8 *r = (u8 *)t;
-   if (r[3] == EDID_DETAIL_MONITOR_RANGE)
-   if (r[15] & 0x10)
-   *(bool *)data = true;
+   struct edid_support_rb_closure *closure = data;
+   struct edid *edid = closure->edid;
+
+   if (!r[0] && !r[1] && !r[2] && r[3] == EDID_DETAIL_MONITOR_RANGE) {
+   if (edid->features & BIT(0) && r[10] == BIT(2))
+   closure->support_rb = (r[15] & 0x10) ? 1 : 0;
+   }
 }
 
 /* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
 static bool
 drm_monitor_supports_rb(struct edid *edid)
 {
+   struct edid_support_rb_closure closure = {
+   .edid = edid,
+   .support_rb = -1,
+   };
+
if (edid->revision >= 4) {
-   bool ret = false;
-   drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
-   return ret;
+   drm_for_each_detailed_block((u8 *)edid, is_rb, &closure);
+   if (closure.support_rb >= 0)
+   return closure.support_rb;
}
 
-   return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
+   return true;
 }
 
 static void
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/amdkfd: fix a potential NULL pointer dereference

2019-09-19 Thread Allen Pais
alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.

Signed-off-by: Allen Pais 
---
 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
index c56ac47..caa82a8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
@@ -62,6 +62,11 @@ int kfd_interrupt_init(struct kfd_dev *kfd)
}
 
kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1);
+   if (unlikely(!kfd->ih_wq)) {
+   fifo_free(&kfd->ih_fifo);
+   dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n");
+   return kfd->ih_wq;
+   }
spin_lock_init(&kfd->interrupt_lock);
 
INIT_WORK(&kfd->interrupt_work, interrupt_wq);
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/radeon: fix a potential NULL pointer dereference

2019-09-19 Thread Allen Pais
alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.

Signed-off-by: Allen Pais 
---
 drivers/gpu/drm/radeon/radeon_display.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index bd52f15..1a41764 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -683,6 +683,10 @@ static void radeon_crtc_init(struct drm_device *dev, int 
index)
drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256);
radeon_crtc->crtc_id = index;
radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0);
+   if (unlikely(!radeon_crtc->flip_queue)) {
+   kfree(radeon_crtc);
+   return;
+   }
rdev->mode_info.crtcs[index] = radeon_crtc;
 
if (rdev->family >= CHIP_BONAIRE) {
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3 2/2] drm/bridge: add it6505 driver

2019-09-11 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
Signed-off-by: Pi-Hsun Shih 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2531 +++
 3 files changed, 2539 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 1cc9f50..d8d7d28 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -45,6 +45,13 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf..f5abca5 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 000..5e046f6
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2531 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AX 0
+#define BX 1
+#define AUDSEL I2S
+#define AUDTYPE LPCM
+#define AUDFS AUD48K
+#define AUDCH 2
+/* 0: Standard I2S;1: 32bit I2S */
+#define I2SINPUTFMT 1
+/* 0: Left-justified;1: Right-justified */
+#define I2SJUSTIFIED 0
+/* 0: Data delay 1T correspond to WS;1: No data delay correspond to WS */
+#define I2SDATADELAY 0
+/* 0: is left channel;1: is right channel */
+#define I2SWSCHANNEL 0
+/* 0: MSB shift first;1: LSB shift first */
+#define I2SDATASEQ 0
+
+#define LANESWAP 0
+#define LANE 4
+#define _HBR 1
+#define ENSSC 1
+#define FLAGTRAINDOWN 150
+#define POLLINGKSVLIST 400
+#define TRAINFAILCNT 5
+#define TRAINFAILHPD 3
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PCLK_DELAY 1
+#define PCLK_INV 0
+#define EDIDRETRYTIME 5
+#define SHOWVIDEOTIMING 2
+#define PWROFFRETRYTIME 5
+#define MAXPCLK 8
+#define DEFAULTHDCP 1
+#define DEFAULTAUDIO 0
+#define DEFAULTPWRONOFF 1
+#define DEFAULTDRVHOLD 0
+#define DEFAULTPWRON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/* AX or BX */
+#define CHIP_VERSION BX
+
+/*
+ * 0: for bitland
+ * 1: for google kukui p2, huaqin
+ */
+#define AFE_SETTING 1
+
+static u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2a, 0x85}
+};
+
+enum sys_status {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_ReHDCP,
+   SYS_NOROP,
+   SYS_Unknown,
+};
+
+enum it6505_aud_sel {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_aud_fs {
+   AUD24K = 0x6,
+   AUD32K = 0x3,
+   AUD48K = 0x2,
+   AUD96K = 0xA,
+   AUD192K = 0xE,
+   AUD44P1K = 0x0,
+   AUD88P2K = 0x8,
+   AUD176P4K = 0xC,
+};
+
+enum it6505_aud_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+   HBR,
+};
+
+enum aud_word_length {
+   AUD16BIT = 0,
+   AUD18BIT,
+   AUD20BIT,
+   AUD24BIT,
+};
+
+/* Audio Sample Word Length: AUD16BIT, AUD18BIT, AUD20BIT, AUD24BIT */
+#define AUDWORDLENGTH AUD24BIT
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   struct regulator *ovdd;
+   struct gpio_desc *gpiod_hpd;
+   struct gpio_desc *gpiod_reset;
+};
+
+struct it6505 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct it6505_platform_data pdata;
+   struct mutex lock;
+   struct mutex mode_lock;
+   struct regmap *regmap;
+   struct drm_display_mode vid_info;
+
+   struct notifier_block event_nb;
+   struct extcon_dev *extcon;
+   struct work_struct extcon_wq;
+   enum sys_status status;
+   

[PATCH v3 0/2] IT6505 cover letter

2019-09-11 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series contains document bindings, Kconfig to control the function enable 
or not.

Allen Chen (2):
  WIP: dt-bindings: Add binding for IT6505.
  WIP: drm/bridge: add it6505 driver

 .../bindings/display/bridge/ite,it6505.txt |   28 +
 .../devicetree/bindings/vendor-prefixes.yaml   |2 +
 drivers/gpu/drm/bridge/Kconfig |7 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 2531 
 5 files changed, 2569 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

-- 
1.9.1



[PATCH v3 1/2] dt-bindings: Add binding for IT6505.

2019-09-11 Thread allen
From: Allen Chen 

Add a DT binding documentation for IT6505.

Signed-off-by: Allen Chen 

Signed-off-by: Pi-Hsun Shih 

---
cros-ec does not have an associated driver that uses the standard Linux USB-C 
driver class.
extcon is used to model the Type-C connector.(crbug.com/982932)
---
 .../bindings/display/bridge/ite,it6505.txt | 28 ++
 .../devicetree/bindings/vendor-prefixes.yaml   |  2 ++
 2 files changed, 30 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
new file mode 100644
index 000..72da0c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
@@ -0,0 +1,28 @@
+iTE it6505 DP bridge bindings
+
+Required properties:
+- compatible: "ite,it6505"
+- reg: i2c address of the bridge
+- ovdd-supply: I/O voltage
+- pwr18-supply: Core voltage
+- interrupts: interrupt specifier of INT pin
+- reset-gpios: gpio specifier of RESET pin
+   - hpd-gpios:
+   Hotplug detect GPIO.
+   Indicates which GPIO should be used for hotplug detection
+   - port@[x]: SoC specific port nodes with endpoint definitions as defined
+   in 
Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.txt
+
+Example:
+   dp-bridge@5c {
+compatible = "ite,it6505";
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+hpd-gpios = <&pio 9 0>;
+extcon = <&usbc_extcon>;
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml 
b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 967e78c..fb3b643 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -461,6 +461,8 @@ patternProperties:
 description: Intersil
   "^issi,.*":
 description: Integrated Silicon Solutions Inc.
+  "^ite,.*":
+description: ITE Tech. Inc.
   "^itead,.*":
 description: ITEAD Intelligent Systems Co.Ltd
   "^iwave,.*":
-- 
1.9.1



[PATCH v2 1/2] dt-bindings: Add binding for IT6505.

2019-09-03 Thread allen
From: Allen Chen 

Add a DT binding documentation for IT6505.

Signed-off-by: Allen Chen 

---
Comments in v1 would be addressed later in v3.
---
 .../bindings/display/bridge/ite,it6505.txt | 30 ++
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
new file mode 100644
index 000..c3506ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
@@ -0,0 +1,30 @@
+iTE it6505 DP bridge bindings
+
+Required properties:
+- compatible: "ite,it6505"
+- reg: i2c address of the bridge
+- ovdd-supply: I/O voltage
+- pwr18-supply: Core voltage
+- interrupts: interrupt specifier of INT pin
+- reset-gpios: gpio specifier of RESET pin
+
+Example:
+   it6505dptx: it6505dptx@5c {
+compatible = "ite,it6505";
+status = "okay";
+interrupt-parent = <&pio>;
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+hpd-gpios = <&pio 9 0>;
+extcon = <&usbc_extcon>;
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 2c3fc51..c088646 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -184,6 +184,7 @@ iom Iomega Corporation
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+iteiTE Tech. Inc.
 itead  ITEAD Intelligent Systems Co.Ltd
 iwave  iWave Systems Technologies Pvt. Ltd.
 jdiJapan Display Inc.
-- 
1.9.1



[PATCH v2 2/2] drm/bridge: add it6505 driver

2019-09-03 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |7 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2531 +++
 3 files changed, 2539 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index b6e5621..8843288 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -43,6 +43,13 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 06cbdcc..77d60b3 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 000..5031200
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2531 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AX 0
+#define BX 1
+#define AUDSEL I2S
+#define AUDTYPE LPCM
+#define AUDFS AUD48K
+#define AUDCH 2
+/* 0: Standard I2S;1: 32bit I2S */
+#define I2SINPUTFMT 1
+/* 0: Left-justified;1: Right-justified */
+#define I2SJUSTIFIED 0
+/* 0: Data delay 1T correspond to WS;1: No data delay correspond to WS */
+#define I2SDATADELAY 0
+/* 0: is left channel;1: is right channel */
+#define I2SWSCHANNEL 0
+/* 0: MSB shift first;1: LSB shift first */
+#define I2SDATASEQ 0
+
+#define LANESWAP 0
+#define LANE 4
+#define _HBR 1
+#define ENSSC 1
+#define FLAGTRAINDOWN 150
+#define POLLINGKSVLIST 400
+#define TRAINFAILCNT 5
+#define TRAINFAILHPD 3
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PCLK_DELAY 1
+#define PCLK_INV 0
+#define EDIDRETRYTIME 5
+#define SHOWVIDEOTIMING 2
+#define PWROFFRETRYTIME 5
+#define MAXPCLK 8
+#define DEFAULTHDCP 1
+#define DEFAULTAUDIO 0
+#define DEFAULTPWRONOFF 1
+#define DEFAULTDRVHOLD 0
+#define DEFAULTPWRON 0
+#define AUX_FIFO_MAX_SIZE 0x10
+
+/* AX or BX */
+#define CHIP_VERSION BX
+
+/*
+ * 0: for bitland
+ * 1: for google kukui p2, huaqin
+ */
+#define AFE_SETTING 1
+
+u8 afe_setting_table[2][3] = {
+   {0, 0, 0},
+   {0x93, 0x2a, 0x85}
+};
+
+enum sys_status {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_ReHDCP,
+   SYS_NOROP,
+   SYS_Unknown,
+};
+
+enum it6505_aud_sel {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_aud_fs {
+   AUD24K = 0x6,
+   AUD32K = 0x3,
+   AUD48K = 0x2,
+   AUD96K = 0xA,
+   AUD192K = 0xE,
+   AUD44P1K = 0x0,
+   AUD88P2K = 0x8,
+   AUD176P4K = 0xC,
+};
+
+enum it6505_aud_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+   HBR,
+};
+
+enum aud_word_length {
+   AUD16BIT = 0,
+   AUD18BIT,
+   AUD20BIT,
+   AUD24BIT,
+};
+
+/* Audio Sample Word Length: AUD16BIT, AUD18BIT, AUD20BIT, AUD24BIT */
+#define AUDWORDLENGTH AUD24BIT
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   struct regulator *ovdd;
+   struct gpio_desc *gpiod_hpd;
+   struct gpio_desc *gpiod_reset;
+};
+
+struct it6505 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct it6505_platform_data pdata;
+   struct mutex lock;
+   struct mutex mode_lock;
+   struct regmap *regmap;
+   struct drm_display_mode vid_info;
+
+   struct notifier_block event_nb;
+   struct extcon_dev *extcon;
+   struct work_struct extcon_wq;
+   enum sys_status status;
+   bool hbr;
+   u8 

[PATCH 2/3] drm/bridge: add it6505 driver

2019-05-09 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |   22 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2637 +++
 3 files changed, 2660 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 9c9c4df..d12e48c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -43,6 +43,28 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
+config DRM_ITE_IT6505_ENHDCP
+   tristate "Enable IT6505 HDCP function"
+   depends on DRM_ITE_IT6505
+   default y
+
+config DRM_ITE_IT6505_ENAUD
+tristate "Enable IT6505 audio function"
+depends on DRM_ITE_IT6505
+default y
+
+config DRM_ITE_IT6505_ENPWRONOFF
+tristate "Enable IT6505 power on/off function"
+depends on DRM_ITE_IT6505
+default y
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf..f5abca5 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 000..13079a8
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2637 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AX 0
+#define BX 1
+#define AUDSEL I2S
+#define AUDTYPE LPCM
+#define AUDFS AUD48K
+#define AUDCH 2
+/* 0: Standard I2S;1: 32bit I2S */
+#define I2SINPUTFMT 1
+/* 0: Left-justified;1: Right-justified */
+#define I2SJUSTIFIED 0
+/* 0: Data delay 1T correspond to WS;1: No data delay correspond to WS */
+#define I2SDATADELAY 0
+/* 0: is left channel;1: is right channel */
+#define I2SWSCHANNEL 0
+/* 0: MSB shift first;1: LSB shift first */
+#define I2SDATASEQ 0
+
+#define LANESWAP 0
+#define LANE 4
+#define _HBR 1
+#define ENHFRAME 1
+#define ENSSC 1
+
+#define FLAGTRAINDOWN 100
+#define TRAINFAILCNT 5
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PCLK_DELAY 1
+#define PCLK_INV 0
+#define EDIDRETRYTIME 5
+#define SHOWVIDEOTIMING 2
+#define PWROFFRETRYTIME 5
+
+/* AX or BX */
+#define CHIP_VERSION BX
+
+/* if use this define will power on in probe */
+/* #define TEST_MODE */
+
+/* if use this define will enable AUX debug option */
+/* #define ENAUX_TRANSFER_DEBUG */
+
+/* if use this define will enable SHA debug */
+/* #define SHA_DEBUG */
+
+enum sys_status {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_ReHDCP,
+   SYS_PWRDN,
+   SYS_NOROP,
+   SYS_Unknown,
+};
+
+enum it6505_aud_sel {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_aud_fs {
+   AUD24K = 0x6,
+   AUD32K = 0x3,
+   AUD48K = 0x2,
+   AUD96K = 0xA,
+   AUD192K = 0xE,
+   AUD44P1K = 0x0,
+   AUD88P2K = 0x8,
+   AUD176P4K = 0xC,
+};
+
+enum it6505_aud_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+   HBR,
+};
+
+enum aud_word_length {
+   AUD16BIT = 0,
+   AUD18BIT,
+   AUD20BIT,
+   AUD24BIT,
+};
+
+/* Audio Sample Word Length: AUD16BIT, AUD18BIT, AUD20BIT, AUD24BIT */
+#define AUDWORDLENGTH AUD24BIT
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   struct regulator *ovdd;
+   struct gpio_desc *gpiod_hpd;
+   struct gpio_desc *gpiod_pd;
+   struct gpio_desc *gpiod_reset;
+
+   int hpd_irq;
+   int intp_irq;
+};
+
+struct it6505_dp_port {
+   struct it6505 *it6505_dp;
+   struct notifier_block event_nb;
+   struct extcon_dev *extcon;
+   struct work_str

[PATCH 1/3] dt-bindings: Add binding for IT6505.

2019-05-09 Thread allen
From: Allen Chen 

Add a DT binding documentation for IT6505.

Signed-off-by: Allen Chen 

---
 .../bindings/display/bridge/ite,it6505.txt | 30 ++
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
new file mode 100644
index 000..c3506ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
@@ -0,0 +1,30 @@
+iTE it6505 DP bridge bindings
+
+Required properties:
+- compatible: "ite,it6505"
+- reg: i2c address of the bridge
+- ovdd-supply: I/O voltage
+- pwr18-supply: Core voltage
+- interrupts: interrupt specifier of INT pin
+- reset-gpios: gpio specifier of RESET pin
+
+Example:
+   it6505dptx: it6505dptx@5c {
+compatible = "ite,it6505";
+status = "okay";
+interrupt-parent = <&pio>;
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+hpd-gpios = <&pio 9 0>;
+extcon = <&usbc_extcon>;
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 2c3fc51..c088646 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -184,6 +184,7 @@ iom Iomega Corporation
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+iteiTE Tech. Inc.
 itead  ITEAD Intelligent Systems Co.Ltd
 iwave  iWave Systems Technologies Pvt. Ltd.
 jdiJapan Display Inc.
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 0/3] IT6505 cover letter

2019-05-09 Thread allen
The IT6505 is a high-performance DisplayPort 1.1a transmitter, fully compliant 
with DisplayPort 1.1a, HDCP 1.3 specifications. The IT6505 supports color depth 
of up to 36 bits (12 bits/color) and ensures robust transmission of 
high-quality uncompressed video content, along with uncompressed and compressed 
digital audio content.

This series contains document bindings, Kconfig to control the function enable 
or not.

Allen Chen (3):
  dt-bindings: Add binding for IT6505.
  drm/bridge: add it6505 driver
  drm/bridge: it6505 driver add char device feature.

 .../bindings/display/bridge/ite,it6505.txt |   30 +
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 drivers/gpu/drm/bridge/Kconfig |   22 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/ite-it6505.c| 2768 
 5 files changed, 2822 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 3/3] drm/bridge: it6505 driver add char device feature.

2019-05-09 Thread allen
From: Allen Chen 

This add can let us find it6505 char device in the /dev file and use read/write 
function to let the driver be hold.

Signed-off-by: Allen Chen 

---
 drivers/gpu/drm/bridge/ite-it6505.c | 131 
 1 file changed, 131 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
index 13079a8..1529e61 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -70,6 +70,13 @@
 /* if use this define will enable SHA debug */
 /* #define SHA_DEBUG */
 
+/* register char device for it6505 */
+#define IT6505_CLASS_NAME "it6505_class"
+#define IT6505_DEVICE_NAME "it6505_device"
+#define IT6505_MAX_DEV 128
+/* The device major number */
+static int it6505_major_num;
+
 enum sys_status {
SYS_UNPLUG = 0,
SYS_HPD,
@@ -144,6 +151,8 @@ struct it6505 {
struct it6505_platform_data pdata;
struct mutex lock;
struct regmap *regmap;
+   struct cdev cdev;
+   struct device class_dev;
struct it6505_dp_port *port;
/* thread sequence control */
struct semaphore sem_notifier;
@@ -2502,6 +2511,80 @@ static int it6505_init_pdata(struct it6505 *it6505)
return PTR_ERR_OR_ZERO(pdata->gpiod_reset);
 }
 
+static int it6505_open(struct inode *inode, struct file *file)
+{
+   struct it6505 *ctx = container_of(inode->i_cdev, struct it6505, cdev);
+
+   DRM_DEBUG_DRIVER("[%s]: successful", __func__);
+   if (!ctx)
+   DRM_DEBUG_DRIVER("[%s]:get it6505 struct fail!", __func__);
+   file->private_data = ctx;
+   get_device(&ctx->class_dev);
+   return 0;
+}
+
+static int it6505_release(struct inode *inode, struct file *file)
+{
+   struct it6505 *ctx = file->private_data;
+
+   DRM_DEBUG_DRIVER("[%s]: successful", __func__);
+   put_device(&ctx->class_dev);
+   return 0;
+}
+
+static ssize_t it6505_read(struct file *file, char *buf,
+  size_t count, loff_t *ptr)
+{
+   struct it6505 *ctx = file->private_data;
+   char kbuff[16];
+   size_t len;
+
+   DRM_DEBUG_DRIVER("[%s]start count=%zu", __func__, count);
+   DRM_DEBUG_DRIVER("it6505_drv_hold:%d", ctx->it6505_drv_hold);
+   len = snprintf(kbuff, sizeof(kbuff), "%d", ctx->it6505_drv_hold);
+   len = min3(count, len, sizeof(kbuff));
+   return copy_to_user(buf, kbuff, len) ? -EFAULT : len;
+}
+
+static ssize_t it6505_write(struct file *file, const char *buff,
+   size_t count, loff_t *ptr)
+{
+   struct it6505 *ctx = file->private_data;
+   char kbuff[16];
+   int num;
+
+   DRM_DEBUG_DRIVER("[%s]start count=%zu", __func__, count);
+   count = min(count, sizeof(kbuff) - 1);
+   if (copy_from_user(kbuff, buff, count))
+   return -EFAULT;
+   kbuff[count] = '\0';
+   if (kstrtoint(kbuff, 10, &num) < 0)
+   return -EINVAL;
+   ctx->it6505_drv_hold = num;
+   DRM_DEBUG_DRIVER("set it6505_drv_hold:%d", ctx->it6505_drv_hold);
+   return count;
+}
+
+static struct class it6505_class_file = {
+   .owner  = THIS_MODULE,
+   .name   = IT6505_CLASS_NAME,
+};
+
+static const struct file_operations it6505_fops = {
+   .owner = THIS_MODULE,
+   .read  = it6505_read,
+   .write = it6505_write,
+   .open  = it6505_open,
+   .release = it6505_release
+};
+
+static void it6505_release_device(struct device *dev)
+{
+   struct it6505 *ctx = container_of(dev, struct it6505, class_dev);
+
+   kfree(ctx);
+}
+
 static int it6505_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
 {
@@ -2575,8 +2658,38 @@ static int it6505_i2c_probe(struct i2c_client *client,
ctx->bridge.funcs = &it6505_bridge_funcs;
 
drm_bridge_add(&ctx->bridge);
+   device_initialize(&ctx->class_dev);
+   ctx->class_dev.parent = &client->dev;
+   ctx->class_dev.release = it6505_release_device;
+   cdev_init(&ctx->cdev, &it6505_fops);
+   err = dev_set_name(&ctx->class_dev, "%s", IT6505_DEVICE_NAME);
+   DRM_DEBUG_DRIVER("[%s] dev_set_name:%s",
+__func__, err ? "failed" : "success");
+   if (err) {
+   DRM_DEBUG_DRIVER("dev_set_name failed => %d", err);
+   goto put_class_dev;
+   }
+   /*
+* Add the class device
+* Link to the character device for creating the /dev entry
+* in devtmpfs.
+*/
+   ctx->class_dev.devt = MKDEV(it6505_major_num, 0);
+   ctx->class_dev.class = &it6505_class_file;
+
+   /* We can n

[PATCH 3/3] drm/bridge: it6505 driver add char device feature.

2019-05-08 Thread allen
From: Allen Chen 

This add can let us find it6505 char device in the /dev file and use read/write 
function to let the driver be hold.

Signed-off-by: Allen Chen 

---
 drivers/gpu/drm/bridge/ite-it6505.c | 131 
 1 file changed, 131 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
index 13079a8..1529e61 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -70,6 +70,13 @@
 /* if use this define will enable SHA debug */
 /* #define SHA_DEBUG */
 
+/* register char device for it6505 */
+#define IT6505_CLASS_NAME "it6505_class"
+#define IT6505_DEVICE_NAME "it6505_device"
+#define IT6505_MAX_DEV 128
+/* The device major number */
+static int it6505_major_num;
+
 enum sys_status {
SYS_UNPLUG = 0,
SYS_HPD,
@@ -144,6 +151,8 @@ struct it6505 {
struct it6505_platform_data pdata;
struct mutex lock;
struct regmap *regmap;
+   struct cdev cdev;
+   struct device class_dev;
struct it6505_dp_port *port;
/* thread sequence control */
struct semaphore sem_notifier;
@@ -2502,6 +2511,80 @@ static int it6505_init_pdata(struct it6505 *it6505)
return PTR_ERR_OR_ZERO(pdata->gpiod_reset);
 }
 
+static int it6505_open(struct inode *inode, struct file *file)
+{
+   struct it6505 *ctx = container_of(inode->i_cdev, struct it6505, cdev);
+
+   DRM_DEBUG_DRIVER("[%s]: successful", __func__);
+   if (!ctx)
+   DRM_DEBUG_DRIVER("[%s]:get it6505 struct fail!", __func__);
+   file->private_data = ctx;
+   get_device(&ctx->class_dev);
+   return 0;
+}
+
+static int it6505_release(struct inode *inode, struct file *file)
+{
+   struct it6505 *ctx = file->private_data;
+
+   DRM_DEBUG_DRIVER("[%s]: successful", __func__);
+   put_device(&ctx->class_dev);
+   return 0;
+}
+
+static ssize_t it6505_read(struct file *file, char *buf,
+  size_t count, loff_t *ptr)
+{
+   struct it6505 *ctx = file->private_data;
+   char kbuff[16];
+   size_t len;
+
+   DRM_DEBUG_DRIVER("[%s]start count=%zu", __func__, count);
+   DRM_DEBUG_DRIVER("it6505_drv_hold:%d", ctx->it6505_drv_hold);
+   len = snprintf(kbuff, sizeof(kbuff), "%d", ctx->it6505_drv_hold);
+   len = min3(count, len, sizeof(kbuff));
+   return copy_to_user(buf, kbuff, len) ? -EFAULT : len;
+}
+
+static ssize_t it6505_write(struct file *file, const char *buff,
+   size_t count, loff_t *ptr)
+{
+   struct it6505 *ctx = file->private_data;
+   char kbuff[16];
+   int num;
+
+   DRM_DEBUG_DRIVER("[%s]start count=%zu", __func__, count);
+   count = min(count, sizeof(kbuff) - 1);
+   if (copy_from_user(kbuff, buff, count))
+   return -EFAULT;
+   kbuff[count] = '\0';
+   if (kstrtoint(kbuff, 10, &num) < 0)
+   return -EINVAL;
+   ctx->it6505_drv_hold = num;
+   DRM_DEBUG_DRIVER("set it6505_drv_hold:%d", ctx->it6505_drv_hold);
+   return count;
+}
+
+static struct class it6505_class_file = {
+   .owner  = THIS_MODULE,
+   .name   = IT6505_CLASS_NAME,
+};
+
+static const struct file_operations it6505_fops = {
+   .owner = THIS_MODULE,
+   .read  = it6505_read,
+   .write = it6505_write,
+   .open  = it6505_open,
+   .release = it6505_release
+};
+
+static void it6505_release_device(struct device *dev)
+{
+   struct it6505 *ctx = container_of(dev, struct it6505, class_dev);
+
+   kfree(ctx);
+}
+
 static int it6505_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
 {
@@ -2575,8 +2658,38 @@ static int it6505_i2c_probe(struct i2c_client *client,
ctx->bridge.funcs = &it6505_bridge_funcs;
 
drm_bridge_add(&ctx->bridge);
+   device_initialize(&ctx->class_dev);
+   ctx->class_dev.parent = &client->dev;
+   ctx->class_dev.release = it6505_release_device;
+   cdev_init(&ctx->cdev, &it6505_fops);
+   err = dev_set_name(&ctx->class_dev, "%s", IT6505_DEVICE_NAME);
+   DRM_DEBUG_DRIVER("[%s] dev_set_name:%s",
+__func__, err ? "failed" : "success");
+   if (err) {
+   DRM_DEBUG_DRIVER("dev_set_name failed => %d", err);
+   goto put_class_dev;
+   }
+   /*
+* Add the class device
+* Link to the character device for creating the /dev entry
+* in devtmpfs.
+*/
+   ctx->class_dev.devt = MKDEV(it6505_major_num, 0);
+   ctx->class_dev.class = &it6505_class_file;
+
+   /* We can n

[PATCH 1/3] dt-bindings: Add binding for IT6505.

2019-05-08 Thread allen
From: Allen Chen 

Add a DT binding documentation for IT6505.

Signed-off-by: Allen Chen 

---
 .../bindings/display/bridge/ite,it6505.txt | 30 ++
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/ite,it6505.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt 
b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
new file mode 100644
index 000..c3506ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/ite,it6505.txt
@@ -0,0 +1,30 @@
+iTE it6505 DP bridge bindings
+
+Required properties:
+- compatible: "ite,it6505"
+- reg: i2c address of the bridge
+- ovdd-supply: I/O voltage
+- pwr18-supply: Core voltage
+- interrupts: interrupt specifier of INT pin
+- reset-gpios: gpio specifier of RESET pin
+
+Example:
+   it6505dptx: it6505dptx@5c {
+compatible = "ite,it6505";
+status = "okay";
+interrupt-parent = <&pio>;
+interrupts = <152 IRQ_TYPE_EDGE_RISING 152 0>;
+reg = <0x5c>;
+pinctrl-names = "default";
+pinctrl-0 = <&it6505_pins>;
+ovdd-supply = <&mt6358_vsim1_reg>;
+pwr18-supply = <&it6505_pp18_reg>;
+reset-gpios = <&pio 179 1>;
+hpd-gpios = <&pio 9 0>;
+extcon = <&usbc_extcon>;
+port {
+it6505_in: endpoint {
+remote-endpoint = <&dpi_out>;
+};
+};
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 2c3fc51..c088646 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -184,6 +184,7 @@ iom Iomega Corporation
 isee   ISEE 2007 S.L.
 isil   Intersil
 issi   Integrated Silicon Solutions Inc.
+iteiTE Tech. Inc.
 itead  ITEAD Intelligent Systems Co.Ltd
 iwave  iWave Systems Technologies Pvt. Ltd.
 jdiJapan Display Inc.
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 2/3] drm/bridge: add it6505 driver

2019-05-08 Thread allen
From: Allen Chen 

This adds support for the iTE IT6505.
This device can convert DPI signal to DP output.

Signed-off-by: Jitao Shi 
Signed-off-by: Yilun Lin 
Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/bridge/Kconfig  |   22 +
 drivers/gpu/drm/bridge/Makefile |1 +
 drivers/gpu/drm/bridge/ite-it6505.c | 2637 +++
 3 files changed, 2660 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/ite-it6505.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 9c9c4df..d12e48c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -43,6 +43,28 @@ config DRM_DUMB_VGA_DAC
  Support for non-programmable RGB to VGA DAC bridges, such as ADI
  ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs.
 
+config DRM_ITE_IT6505
+   tristate "ITE IT6505 DP bridge"
+   depends on OF
+   select DRM_KMS_HELPER
+   help
+ ITE IT6505 DP bridge chip driver.
+
+config DRM_ITE_IT6505_ENHDCP
+   tristate "Enable IT6505 HDCP function"
+   depends on DRM_ITE_IT6505
+   default y
+
+config DRM_ITE_IT6505_ENAUD
+tristate "Enable IT6505 audio function"
+depends on DRM_ITE_IT6505
+default y
+
+config DRM_ITE_IT6505_ENPWRONOFF
+tristate "Enable IT6505 power on/off function"
+depends on DRM_ITE_IT6505
+default y
+
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf..f5abca5 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
+obj-$(CONFIG_DRM_ITE_IT6505) += ite-it6505.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
 obj-$(CONFIG_DRM_MEGACHIPS_STDP_GE_B850V3_FW) += 
megachips-stdp-ge-b850v3-fw.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
b/drivers/gpu/drm/bridge/ite-it6505.c
new file mode 100644
index 000..13079a8
--- /dev/null
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -0,0 +1,2637 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AX 0
+#define BX 1
+#define AUDSEL I2S
+#define AUDTYPE LPCM
+#define AUDFS AUD48K
+#define AUDCH 2
+/* 0: Standard I2S;1: 32bit I2S */
+#define I2SINPUTFMT 1
+/* 0: Left-justified;1: Right-justified */
+#define I2SJUSTIFIED 0
+/* 0: Data delay 1T correspond to WS;1: No data delay correspond to WS */
+#define I2SDATADELAY 0
+/* 0: is left channel;1: is right channel */
+#define I2SWSCHANNEL 0
+/* 0: MSB shift first;1: LSB shift first */
+#define I2SDATASEQ 0
+
+#define LANESWAP 0
+#define LANE 4
+#define _HBR 1
+#define ENHFRAME 1
+#define ENSSC 1
+
+#define FLAGTRAINDOWN 100
+#define TRAINFAILCNT 5
+#define AUX_WAIT_TIMEOUT_MS 15
+#define PCLK_DELAY 1
+#define PCLK_INV 0
+#define EDIDRETRYTIME 5
+#define SHOWVIDEOTIMING 2
+#define PWROFFRETRYTIME 5
+
+/* AX or BX */
+#define CHIP_VERSION BX
+
+/* if use this define will power on in probe */
+/* #define TEST_MODE */
+
+/* if use this define will enable AUX debug option */
+/* #define ENAUX_TRANSFER_DEBUG */
+
+/* if use this define will enable SHA debug */
+/* #define SHA_DEBUG */
+
+enum sys_status {
+   SYS_UNPLUG = 0,
+   SYS_HPD,
+   SYS_AUTOTRAIN,
+   SYS_WAIT,
+   SYS_TRAINFAIL,
+   SYS_ReHDCP,
+   SYS_PWRDN,
+   SYS_NOROP,
+   SYS_Unknown,
+};
+
+enum it6505_aud_sel {
+   I2S = 0,
+   SPDIF,
+};
+
+enum it6505_aud_fs {
+   AUD24K = 0x6,
+   AUD32K = 0x3,
+   AUD48K = 0x2,
+   AUD96K = 0xA,
+   AUD192K = 0xE,
+   AUD44P1K = 0x0,
+   AUD88P2K = 0x8,
+   AUD176P4K = 0xC,
+};
+
+enum it6505_aud_type {
+   LPCM = 0,
+   NLPCM,
+   DSS,
+   HBR,
+};
+
+enum aud_word_length {
+   AUD16BIT = 0,
+   AUD18BIT,
+   AUD20BIT,
+   AUD24BIT,
+};
+
+/* Audio Sample Word Length: AUD16BIT, AUD18BIT, AUD20BIT, AUD24BIT */
+#define AUDWORDLENGTH AUD24BIT
+
+struct it6505_platform_data {
+   struct regulator *pwr18;
+   struct regulator *ovdd;
+   struct gpio_desc *gpiod_hpd;
+   struct gpio_desc *gpiod_pd;
+   struct gpio_desc *gpiod_reset;
+
+   int hpd_irq;
+   int intp_irq;
+};
+
+struct it6505_dp_port {
+   struct it6505 *it6505_dp;
+   struct notifier_block event_nb;
+   struct extcon_dev *extcon;
+   struct work_str

Re: [PATCH v2] drm/tegra: Replace dev_* with DRM_DEV_*

2017-09-26 Thread Allen
Harsha,

>
> @r@
> @@
>
> (
> -dev_info
> +DRM_DEV_INFO
> |
> -dev_err
> +DRM_DEV_ERROR
> |
> -dev_dbg
> +DRM_DEV_DEBUG
> )
>
> Signed-off-by: Harsha Sharma 
> ---
> Changes in v2:
>  -Break line over 80 characters
>  -Changes in comments not required
>
>  drivers/gpu/drm/tegra/dc.c |  53 +++-
>  drivers/gpu/drm/tegra/dpaux.c  |  24 +++---
>  drivers/gpu/drm/tegra/dsi.c|  68 ---
>  drivers/gpu/drm/tegra/falcon.c |  16 ++--
>  drivers/gpu/drm/tegra/fb.c |  22 +++--
>  drivers/gpu/drm/tegra/gem.c|   8 +-
>  drivers/gpu/drm/tegra/gr2d.c   |  10 ++-
>  drivers/gpu/drm/tegra/gr3d.c   |  20 +++--
>  drivers/gpu/drm/tegra/hdmi.c   |  66 +--
>  drivers/gpu/drm/tegra/output.c |   8 +-
>  drivers/gpu/drm/tegra/rgb.c|  12 +--
>  drivers/gpu/drm/tegra/sor.c| 184 
> +
>  drivers/gpu/drm/tegra/vic.c|  15 ++--
>  13 files changed, 304 insertions(+), 202 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 4df3911..fbc9cc1 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -1137,7 +1137,7 @@ static void tegra_dc_commit_state(struct tegra_dc *dc,
>

 One of the first things you'll probably need to do is to break this
huge patch into
smaller chunks. It becomes difficult to even review this patch(though
the change is
pretty straight forward.).

- Allen
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 04/10] drivers:mpt: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/message/fusion/mptbase.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 84eab28..7920b2b 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -4328,15 +4328,15 @@ initChainBuffers(MPT_ADAPTER *ioc)
if (ioc->ReqToChain == NULL) {
sz = ioc->req_depth * sizeof(int);
mem = kmalloc(sz, GFP_ATOMIC);
-   if (mem == NULL)
-   return -1;
+   if (!mem)
+   return -ENOMEM;
 
ioc->ReqToChain = (int *) mem;
dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReqToChain alloc  @ 
%p, sz=%d bytes\n",
ioc->name, mem, sz));
mem = kmalloc(sz, GFP_ATOMIC);
-   if (mem == NULL)
-   return -1;
+   if (!mem)
+   return -ENOMEM;
 
ioc->RequestNB = (int *) mem;
dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestNB alloc  @ 
%p, sz=%d bytes\n",
@@ -4402,8 +4402,8 @@ initChainBuffers(MPT_ADAPTER *ioc)
sz = num_chain * sizeof(int);
if (ioc->ChainToChain == NULL) {
mem = kmalloc(sz, GFP_ATOMIC);
-   if (mem == NULL)
-   return -1;
+   if (!mem)
+   return -ENOMEM;
 
ioc->ChainToChain = (int *) mem;
dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainToChain alloc @ 
%p, sz=%d bytes\n",
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 01/10] arch:powerpc: return -ENOMEM on failed allocation

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 arch/powerpc/platforms/cell/spider-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spider-pci.c 
b/arch/powerpc/platforms/cell/spider-pci.c
index d1e61e2..82aa3f7 100644
--- a/arch/powerpc/platforms/cell/spider-pci.c
+++ b/arch/powerpc/platforms/cell/spider-pci.c
@@ -106,7 +106,7 @@ static int __init spiderpci_pci_setup_chip(struct 
pci_controller *phb,
dummy_page_va = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!dummy_page_va) {
pr_err("SPIDERPCI-IOWA:Alloc dummy_page_va failed.\n");
-   return -1;
+   return -ENOMEM;
}
 
dummy_page_da = dma_map_single(phb->parent, dummy_page_va,
@@ -137,7 +137,7 @@ int __init spiderpci_iowa_init(struct iowa_bus *bus, void 
*data)
if (!priv) {
pr_err("SPIDERPCI-IOWA:"
   "Can't allocate struct spiderpci_iowa_private");
-   return -1;
+   return -ENOMEM;
}
 
if (of_address_to_resource(np, 0, &r)) {
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 06/10] drivers:ethernet: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/net/ethernet/sun/cassini.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sun/cassini.c 
b/drivers/net/ethernet/sun/cassini.c
index 382993c..fc0ea3a 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -3984,7 +3984,7 @@ static inline int cas_alloc_rx_desc(struct cas *cp, int 
ring)
size = RX_DESC_RINGN_SIZE(ring);
for (i = 0; i < size; i++) {
if ((page[i] = cas_page_alloc(cp, GFP_KERNEL)) == NULL)
-   return -1;
+   return -ENOMEM;
}
return 0;
 }
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drivers:gpu:Use ARRAY_SIZE() for the size calculation of the array.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c 
b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
index 4395a4f..0487936 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
@@ -274,7 +274,7 @@ static const struct pctl_data pctl0_data[] = {
{0x135, 0x12a810},
{0x149, 0x7a82c}
 };
-#define PCTL0_DATA_LEN (sizeof(pctl0_data)/sizeof(pctl0_data[0]))
+#define PCTL0_DATA_LEN (ARRAY_SIZE(pctl0_data))
 
 #define PCTL0_RENG_EXEC_END_PTR 0x151
 #define PCTL0_STCTRL_REG_SAVE_RANGE0_BASE  0xa640
@@ -310,7 +310,7 @@ static const struct pctl_data pctl1_data[] = {
{0x1f0, 0x5000a7f6},
{0x1f1, 0x5000a7e4}
 };
-#define PCTL1_DATA_LEN (sizeof(pctl1_data)/sizeof(pctl1_data[0]))
+#define PCTL1_DATA_LEN (ARRAY_SIZE(pctl1_data))
 
 #define PCTL1_RENG_EXEC_END_PTR 0x1f1
 #define PCTL1_STCTRL_REG_SAVE_RANGE0_BASE  0xa000
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 02/10] drivers:crypto: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/crypto/omap-aes-gcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-aes-gcm.c b/drivers/crypto/omap-aes-gcm.c
index 7d4f8a4..2542224 100644
--- a/drivers/crypto/omap-aes-gcm.c
+++ b/drivers/crypto/omap-aes-gcm.c
@@ -186,7 +186,7 @@ static int do_encrypt_iv(struct aead_request *req, u32 
*tag, u32 *iv)
sk_req = skcipher_request_alloc(ctx->ctr, GFP_KERNEL);
if (!sk_req) {
pr_err("skcipher: Failed to allocate request\n");
-   return -1;
+   return -ENOMEM;
}
 
init_completion(&result.completion);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 09/10] driver:video: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/video/fbdev/matrox/matroxfb_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c 
b/drivers/video/fbdev/matrox/matroxfb_base.c
index f6a0b9a..5cd238d 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -2058,7 +2058,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const 
struct pci_device_id* dumm
 
minfo = kzalloc(sizeof(*minfo), GFP_KERNEL);
if (!minfo)
-   return -1;
+   return -ENOMEM;
 
minfo->pcidev = pdev;
minfo->dead = 0;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 01/10] arch:powerpc: return -ENOMEM on failed allocation

2017-09-14 Thread Allen
> I think the changelog for this series of conversions
> should show that you've validated the change by
> inspecting the return call chain at each modified line.
>
> Also, it seems you've cc'd the same mailing lists for
> all of the patches modified by this series.
>
> It would be better to individually address each patch
> in the series only cc'ing the appropriate maintainers
> and mailing lists.
>
> A cover letter would be good too.

 Point noted. Thanks.

- Allen
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 05/10] drivers:net: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/net/bonding/bond_alb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index c02cc81..89df377 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -864,7 +864,7 @@ static int rlb_initialize(struct bonding *bond)
 
new_hashtbl = kmalloc(size, GFP_KERNEL);
if (!new_hashtbl)
-   return -1;
+   return -ENOMEM;
 
spin_lock_bh(&bond->mode_lock);
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 05/10] drivers:net: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen
> propagates the -1. That is only called by bond_open() with:
>
> if (bond_alb_initialize(bond, (BOND_MODE(bond) == BOND_MODE_ALB)))
> return -ENOMEM;
>
> So you might want to also modify this code, to return the return
> value, rather than use the hard coded ENOMEM.
>

 I'll modify the above and send it out a separate patch.

Thank you.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 06/10] drivers:ethernet: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen
>
> static int cas_alloc_rxds(struct cas *cp)
> {
> int i;
>
> for (i = 0; i < N_RX_DESC_RINGS; i++) {
> if (cas_alloc_rx_desc(cp, i) < 0) {
> cas_free_rxds(cp);
> return -1;
> }
> }
> return 0;
> }
>
> Again, your change is correct, but in the end the value is not used.
> And if you fix it at the cas_alloc_rxds level, you also need a fix at
> the next level up:
>
> err = -ENOMEM;
> if (cas_tx_tiny_alloc(cp) < 0)
> goto err_unlock;
>
> /* alloc rx descriptors */
> if (cas_alloc_rxds(cp) < 0)
> goto err_tx_tiny;
>
> again, the return value is discarded.

 I agree. I could send out v2 with fixes at both level.

- Allen
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 10/10] fs:btrfs: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 fs/btrfs/check-integrity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 7d5a9b5..efa4c23 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2913,7 +2913,7 @@ int btrfsic_mount(struct btrfs_fs_info *fs_info,
state = kvzalloc(sizeof(*state), GFP_KERNEL);
if (!state) {
pr_info("btrfs check-integrity: allocation failed!\n");
-   return -1;
+   return -ENOMEM;
}
 
if (!btrfsic_is_initialized) {
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 07/10] driver:megaraid: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/scsi/megaraid/megaraid_mbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
index ec3c438..b09a0a6 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -724,8 +724,8 @@ megaraid_init_mbox(adapter_t *adapter)
 * controllers
 */
raid_dev = kzalloc(sizeof(mraid_device_t), GFP_KERNEL);
-   if (raid_dev == NULL) return -1;
-
+   if (!raid_dev)
+   return -ENOMEM;
 
/*
 * Attach the adapter soft state to raid device soft state
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 03/10] driver:gpu: return -ENOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/gpu/drm/gma500/mid_bios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/mid_bios.c 
b/drivers/gpu/drm/gma500/mid_bios.c
index d75ecb3..1fa1633 100644
--- a/drivers/gpu/drm/gma500/mid_bios.c
+++ b/drivers/gpu/drm/gma500/mid_bios.c
@@ -237,7 +237,7 @@ static int mid_get_vbt_data_r10(struct drm_psb_private 
*dev_priv, u32 addr)
 
gct = kmalloc(sizeof(*gct) * vbt.panel_count, GFP_KERNEL);
if (!gct)
-   return -1;
+   return -ENOMEM;
 
gct_virtual = ioremap(addr + sizeof(vbt),
sizeof(*gct) * vbt.panel_count);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 08/10] driver:cxgbit: return -NOMEM on allocation failure.

2017-09-14 Thread Allen Pais
Signed-off-by: Allen Pais 
---
 drivers/target/iscsi/cxgbit/cxgbit_target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c 
b/drivers/target/iscsi/cxgbit/cxgbit_target.c
index 514986b..47127d6 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_target.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c
@@ -399,7 +399,7 @@ cxgbit_map_skb(struct iscsi_cmd *cmd, struct sk_buff *skb, 
u32 data_offset,
if (padding) {
page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (!page)
-   return -1;
+   return -ENOMEM;
skb_fill_page_desc(skb, i, page, 0, padding);
skb->data_len += padding;
skb->len += padding;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


<    1   2