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 <yi.zhou@amlogic.com>
This commit is contained in:
Yi Zhou
2019-04-03 11:13:36 +08:00
committed by Jianxiong Pan
parent e3f35d98bc
commit 3cd1a565d7
6 changed files with 62 additions and 43 deletions

View File

@@ -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";

View File

@@ -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";

View File

@@ -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__);

View File

@@ -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);

View File

@@ -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");

View File

@@ -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();