From 3cd1a565d766ee41323b52755aea6477fe6e3ef1 Mon Sep 17 00:00:00 2001 From: Yi Zhou Date: Wed, 3 Apr 2019 11:13:36 +0800 Subject: [PATCH] hdmitx: hdmitx bringup for tm2 [1/1] PD#SWPL-5617 Problem: no irq and can't read edid Solution: add irq Verify: tm2 ptm Change-Id: Iedbff2da4758e9a091b56f9ec75b8130b72b846a Signed-off-by: Yi Zhou --- arch/arm/boot/dts/amlogic/mesontm2.dtsi | 29 +++++++++++++++++++++ arch/arm64/boot/dts/amlogic/mesontm2.dtsi | 29 +++++++++++++++++++++ .../media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c | 4 --- .../media/vout/hdmitx/hdmi_tx_20/hw/common.h | 1 - .../media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c | 12 +++------ .../media/vout/hdmitx/hdmi_tx_20/hw/hw_g12a.c | 30 ---------------------- 6 files changed, 62 insertions(+), 43 deletions(-) diff --git a/arch/arm/boot/dts/amlogic/mesontm2.dtsi b/arch/arm/boot/dts/amlogic/mesontm2.dtsi index 621a3c1..813422e 100644 --- a/arch/arm/boot/dts/amlogic/mesontm2.dtsi +++ b/arch/arm/boot/dts/amlogic/mesontm2.dtsi @@ -1362,6 +1362,9 @@ dev_name = "amhdmitx"; status = "okay"; vend-data = <&vend_data>; + pinctrl-names="default", "hdmitx_i2c"; + pinctrl-0=<&hdmitx_hpd &hdmitx_ddc>; + pinctrl-1=<&hdmitx_hpd_gpio>; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 @@ -1372,6 +1375,8 @@ "venci_1_gate", "hdmi_vapb_clk", "hdmi_vpu_clk"; + interrupts = <0 7 1>; + interrupt-names = "hdmitx_hpd"; /* 0:M8B 1:GXBB 2:GXTVBB 3:GXL 4:GXM * 5:TXL 6:TXLX 7:AXG 8:GXLX 9:TXHD * 10:G12A 11:G12B 12:SM1 13:TM2 @@ -2145,7 +2150,31 @@ function = "uart_c"; }; }; + hdmitx_hpd: hdmitx_hpd { + mux { + groups = "hdmitx_hpd_in"; + function = "hdmitx"; + bias-disable; + }; + }; + hdmitx_hpd_gpio: hdmitx_hpd_gpio { + mux { + groups = "GPIOH_16"; + function = "gpio_periphs"; + bias-disable; + }; + }; + + hdmitx_ddc: hdmitx_ddc { + mux { + groups = "hdmitx_sda", + "hdmitx_sck"; + function = "hdmitx"; + bias-disable; + drive-strength = <3>; + }; + }; atvdemod_agc_pins: atvdemod_agc_pins { mux { groups = "atv_if_agc_dv"; diff --git a/arch/arm64/boot/dts/amlogic/mesontm2.dtsi b/arch/arm64/boot/dts/amlogic/mesontm2.dtsi index ba66b584..51d46b4 100644 --- a/arch/arm64/boot/dts/amlogic/mesontm2.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesontm2.dtsi @@ -1341,6 +1341,9 @@ dev_name = "amhdmitx"; status = "okay"; vend-data = <&vend_data>; + pinctrl-names="default", "hdmitx_i2c"; + pinctrl-0=<&hdmitx_hpd &hdmitx_ddc>; + pinctrl-1=<&hdmitx_hpd_gpio>; clocks = <&clkc CLKID_VCLK2_ENCI &clkc CLKID_VCLK2_VENCI0 &clkc CLKID_VCLK2_VENCI1 @@ -1351,6 +1354,8 @@ "venci_1_gate", "hdmi_vapb_clk", "hdmi_vpu_clk"; + interrupts = <0 7 1>; + interrupt-names = "hdmitx_hpd"; /* HPD, 57 + 32 = 89; CEC, 151 + 32 = 183*/ /* 0:M8B 1:GXBB 2:GXTVBB 3:GXL 4:GXM * 5:TXL 6:TXLX 7:AXG 8:GXLX 9:TXHD @@ -2125,7 +2130,31 @@ function = "uart_c"; }; }; + hdmitx_hpd: hdmitx_hpd { + mux { + groups = "hdmitx_hpd_in"; + function = "hdmitx"; + bias-disable; + }; + }; + hdmitx_hpd_gpio: hdmitx_hpd_gpio { + mux { + groups = "GPIOH_16"; + function = "gpio_periphs"; + bias-disable; + }; + }; + + hdmitx_ddc: hdmitx_ddc { + mux { + groups = "hdmitx_sda", + "hdmitx_sck"; + function = "hdmitx"; + bias-disable; + drive-strength = <3>; + }; + }; atvdemod_agc_pins: atvdemod_agc_pins { mux { groups = "atv_if_agc_dv"; diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index fedc5e1..5e1a461 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -4023,8 +4023,6 @@ int get_hpd_state(void) ret = hdmitx_device.hpd_state; mutex_unlock(&setclk_mutex); - if (hdmitx_device.chip_type == MESON_CPU_ID_TM2) - return 1; return ret; } EXPORT_SYMBOL(get_hpd_state); @@ -4539,8 +4537,6 @@ static int amhdmitx_get_dt_info(struct platform_device *pdev) } #endif hdmitx_device.irq_hpd = platform_get_irq_byname(pdev, "hdmitx_hpd"); - if (hdmitx_device.chip_type == MESON_CPU_ID_TM2) - hdmitx_device.irq_hpd = 39; if (hdmitx_device.irq_hpd == -ENXIO) { pr_err("%s: ERROR: hdmitx hpd irq No not found\n", __func__); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/common.h b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/common.h index 3852e99..486207b 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/common.h +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/common.h @@ -67,7 +67,6 @@ void set_hpll_od3_g12a(unsigned int div); int hdmitx_hpd_hw_op_txlx(enum hpd_op cmd); int hdmitx_hpd_hw_op_g12a(enum hpd_op cmd); -int hdmitx_hpd_hw_op_tm2(enum hpd_op cmd); int read_hpd_gpio_txlx(void); int hdmitx_ddc_hw_op_txlx(enum ddc_op cmd); extern unsigned int hdmitx_get_format_txlx(void); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c index 6ae7516..5ca9cf3 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c @@ -114,13 +114,12 @@ int hdmitx_hpd_hw_op(enum hpd_op cmd) case MESON_CPU_ID_GXM: return hdmitx_hpd_hw_op_gxl(cmd); case MESON_CPU_ID_TXLX: + case MESON_CPU_ID_TM2: return hdmitx_hpd_hw_op_txlx(cmd); case MESON_CPU_ID_G12A: case MESON_CPU_ID_G12B: case MESON_CPU_ID_SM1: return hdmitx_hpd_hw_op_g12a(cmd); - case MESON_CPU_ID_TM2: - return hdmitx_hpd_hw_op_tm2(cmd); default: break; } @@ -648,12 +647,9 @@ static irqreturn_t intr_handler(int irq, void *dev) hdmitx_wr_reg(HDMITX_TOP_INTR_STAT_CLR, ~0); hdmitx_wr_reg(HDMITX_DWC_HDCP22REG_STAT, 0xff); - if (hdev->chip_type != MESON_CPU_ID_TM2) { - /*tm2 has a bug, wait to fix*/ - pr_info(SYS "irq %x\n", dat_top); - if (dat_dwc) - pr_info(SYS "irq %x\n", dat_dwc); - } + pr_info(SYS "irq %x\n", dat_top); + if (dat_dwc) + pr_info(SYS "irq %x\n", dat_dwc); if (hdev->hpd_lock == 1) { pr_info(HW "HDMI hpd locked\n"); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hw_g12a.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hw_g12a.c index c21f7a0..b7fa53c 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hw_g12a.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hw_g12a.c @@ -411,36 +411,6 @@ int hdmitx_hpd_hw_op_g12a(enum hpd_op cmd) return ret; } -int hdmitx_hpd_hw_op_tm2(enum hpd_op cmd) -{ - int ret = 0; - - switch (cmd) { - case HPD_INIT_DISABLE_PULLUP: - hd_set_reg_bits(P_PAD_PULL_UP_REG2, 0, 16, 1); - break; - case HPD_INIT_SET_FILTER: - hdmitx_wr_reg(HDMITX_TOP_HPD_FILTER, - ((0xa << 12) | (0xa0 << 0))); - break; - case HPD_IS_HPD_MUXED: - ret = !!(hd_read_reg(P_PERIPHS_PIN_MUX_9) & (6 << 0)); - break; - case HPD_MUX_HPD: - hd_set_reg_bits(P_PERIPHS_PIN_MUX_9, 6, 0, 4); - break; - case HPD_UNMUX_HPD: - hd_set_reg_bits(P_PERIPHS_PIN_MUX_9, 0, 0, 4); - break; - case HPD_READ_HPD_GPIO: - ret = hdmitx_rd_reg(HDMITX_DWC_PHY_STAT0) & (1 << 1); - break; - default: - break; - } - return ret; -} - void set_hpll_sspll_g12a(enum hdmi_vic vic) { struct hdmitx_dev *hdev = get_hdmitx_device(); -- 2.7.4