hdmitx: add enci clktree

PD#162219: hdmitx: add enci clktree

Add enci clktree support for 480i and 576i.

Change-Id: Id7bc3444bd634deb1a52c8faf7f3d2f017d33e73
Signed-off-by: Kaifu Hu <kaifu.hu@amlogic.com>
This commit is contained in:
Kaifu Hu
2018-03-20 17:14:45 +08:00
committed by Jianxin Pan
parent 48356ebe30
commit 6d6abcb26a
6 changed files with 80 additions and 10 deletions

View File

@@ -1021,10 +1021,16 @@
pinctrl-names="default", "hdmitx_i2c";
pinctrl-0=<&hdmitx_hpd &hdmitx_ddc>;
pinctrl-1=<&hdmitx_hpd_gpio &i2c3_master_pins1>;
clocks = <&clkc CLKID_VAPB_MUX>,
<&clkc CLKID_VPU_MUX>;
clock-names = "hdmi_vapb_clk",
"hdmi_vpu_clk";
clocks = <&clkc CLKID_VCLK2_ENCI
&clkc CLKID_VCLK2_VENCI0
&clkc CLKID_VCLK2_VENCI1
&clkc CLKID_VAPB_MUX
&clkc CLKID_VPU_MUX>;
clock-names = "venci_top_gate",
"venci_0_gate",
"venci_1_gate",
"hdmi_vapb_clk",
"hdmi_vpu_clk";
/* HPD, 57 + 32 = 89; CEC, 151 + 32 = 183*/
interrupts = <0 57 1>;
interrupt-names = "hdmitx_hpd";

View File

@@ -58,6 +58,7 @@
#include <linux/amlogic/media/vout/hdmi_tx/hdmi_config.h>
#include "hw/tvenc_conf.h"
#include "hw/common.h"
#include "hw/hw_clk.h"
#include "hdmi_tx_hdcp.h"
#define DEVICE_NAME "amhdmitx"
@@ -1547,7 +1548,7 @@ static ssize_t store_debug(struct device *dev,
/* support format lists */
const char *disp_mode_t[] = {
#if 0
#if 1
"480i60hz",
"576i50hz",
#endif
@@ -2702,6 +2703,8 @@ static int hdmitx_module_disable(enum vmode_e cur_vmod)
hdev->HWOp.CntlConfig(hdev, CONF_CLR_AVI_PACKET, 0);
hdev->HWOp.CntlConfig(hdev, CONF_CLR_VSDB_PACKET, 0);
hdev->HWOp.CntlMisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE);
if (hdev->para->hdmitx_vinfo.viu_mux == VIU_MUX_ENCI)
hdmitx_disable_vclk2_enci(hdev);
hdev->para = hdmi_get_fmt_name("invalid", hdev->fmt_attr);
hdmitx_validate_vmode("null");
@@ -3573,10 +3576,11 @@ static void amhdmitx_clktree_probe(struct device *hdmitx_dev)
{
struct clk *hdmi_clk_vapb, *hdmi_clk_vpu;
struct clk *hdcp22_tx_skp, *hdcp22_tx_esm;
struct clk *venci_top_gate, *venci_0_gate, *venci_1_gate;
hdmi_clk_vapb = devm_clk_get(hdmitx_dev, "hdmi_vapb_clk");
if (IS_ERR(hdmi_clk_vapb))
pr_err(SYS "vapb_clk failed to probe\n");
pr_warn(SYS "vapb_clk failed to probe\n");
else {
hdmitx_device.hdmitx_clk_tree.hdmi_clk_vapb = hdmi_clk_vapb;
clk_prepare_enable(hdmitx_device.hdmitx_clk_tree.hdmi_clk_vapb);
@@ -3584,7 +3588,7 @@ static void amhdmitx_clktree_probe(struct device *hdmitx_dev)
hdmi_clk_vpu = devm_clk_get(hdmitx_dev, "hdmi_vpu_clk");
if (IS_ERR(hdmi_clk_vpu))
pr_err(SYS "vpu_clk failed to probe\n");
pr_warn(SYS "vpu_clk failed to probe\n");
else {
hdmitx_device.hdmitx_clk_tree.hdmi_clk_vpu = hdmi_clk_vpu;
clk_prepare_enable(hdmitx_device.hdmitx_clk_tree.hdmi_clk_vpu);
@@ -3592,15 +3596,33 @@ static void amhdmitx_clktree_probe(struct device *hdmitx_dev)
hdcp22_tx_skp = devm_clk_get(hdmitx_dev, "hdcp22_tx_skp");
if (IS_ERR(hdcp22_tx_skp))
pr_err(SYS "hdcp22_tx_skp failed to probe\n");
pr_warn(SYS "hdcp22_tx_skp failed to probe\n");
else
hdmitx_device.hdmitx_clk_tree.hdcp22_tx_skp = hdcp22_tx_skp;
hdcp22_tx_esm = devm_clk_get(hdmitx_dev, "hdcp22_tx_esm");
if (IS_ERR(hdcp22_tx_esm))
pr_err(SYS "hdcp22_tx_esm failed to probe\n");
pr_warn(SYS "hdcp22_tx_esm failed to probe\n");
else
hdmitx_device.hdmitx_clk_tree.hdcp22_tx_esm = hdcp22_tx_esm;
venci_top_gate = devm_clk_get(hdmitx_dev, "venci_top_gate");
if (IS_ERR(venci_top_gate))
pr_warn(SYS "venci_top_gate failed to probe\n");
else
hdmitx_device.hdmitx_clk_tree.venci_top_gate = venci_top_gate;
venci_0_gate = devm_clk_get(hdmitx_dev, "venci_0_gate");
if (IS_ERR(venci_0_gate))
pr_warn(SYS "venci_0_gate failed to probe\n");
else
hdmitx_device.hdmitx_clk_tree.venci_0_gate = venci_0_gate;
venci_1_gate = devm_clk_get(hdmitx_dev, "venci_1_gate");
if (IS_ERR(venci_1_gate))
pr_warn(SYS "venci_0_gate failed to probe\n");
else
hdmitx_device.hdmitx_clk_tree.venci_1_gate = venci_1_gate;
}
static int amhdmitx_probe(struct platform_device *pdev)

View File

@@ -1110,6 +1110,7 @@ static void hdmi_tvenc480i_set(struct hdmitx_vidpara *param)
unsigned long vso_begin_evn = 0, vso_begin_odd = 0;
hd_set_reg_bits(P_HHI_GCLK_OTHER, 1, 8, 1);
switch (param->VIC) {
case HDMI_480i60:
case HDMI_480i60_16x9:
@@ -1873,6 +1874,9 @@ static void hdmitx_set_scdc(struct hdmitx_dev *hdev)
void hdmitx_set_enc_hw(struct hdmitx_dev *hdev)
{
if (hdev->para->hdmitx_vinfo.viu_mux == VIU_MUX_ENCI)
hdmitx_set_vclk2_enci(hdev);
set_vmode_enc_hw(hdev);
if (hdev->flag_3dfp) {

View File

@@ -23,6 +23,9 @@
#include "common.h"
#include "mach_reg.h"
#include "hw_clk.h"
#ifdef CONFIG_AMLOGIC_VPU
#include <linux/amlogic/media/vpu/vpu.h>
#endif
/*
* HDMITX Clock configuration
@@ -71,9 +74,40 @@ void hdmitx_set_vclk2_encp(struct hdmitx_dev *hdev)
hd_read_reg(P_HHI_GCLK_OTHER)|(1<<17));
}
void hdmitx_disable_vclk2_enci(struct hdmitx_dev *hdev)
{
if (hdev->hdmitx_clk_tree.venci_top_gate)
clk_disable_unprepare(hdev->hdmitx_clk_tree.venci_top_gate);
if (hdev->hdmitx_clk_tree.venci_0_gate)
clk_disable_unprepare(hdev->hdmitx_clk_tree.venci_0_gate);
if (hdev->hdmitx_clk_tree.venci_1_gate)
clk_disable_unprepare(hdev->hdmitx_clk_tree.venci_1_gate);
#ifdef CONFIG_AMLOGIC_VPU
switch_vpu_clk_gate_vmod(VPU_VENCI, VPU_CLK_GATE_OFF);
switch_vpu_mem_pd_vmod(VPU_VENCI, VPU_MEM_POWER_DOWN);
#endif
}
void hdmitx_set_vclk2_enci(struct hdmitx_dev *hdev)
{
hd_set_reg_bits(P_HHI_GCLK_OTHER, 1, 8, 1);
if (hdev->hdmitx_clk_tree.venci_top_gate)
clk_prepare_enable(hdev->hdmitx_clk_tree.venci_top_gate);
if (hdev->hdmitx_clk_tree.venci_0_gate)
clk_prepare_enable(hdev->hdmitx_clk_tree.venci_0_gate);
if (hdev->hdmitx_clk_tree.venci_1_gate)
clk_prepare_enable(hdev->hdmitx_clk_tree.venci_1_gate);
#ifdef CONFIG_AMLOGIC_VPU
switch_vpu_clk_gate_vmod(VPU_VENCI, VPU_CLK_GATE_ON);
switch_vpu_mem_pd_vmod(VPU_VENCI, VPU_MEM_POWER_ON);
#endif
}
void hdmitx_set_cts_sys_clk(struct hdmitx_dev *hdev)

View File

@@ -60,6 +60,7 @@ void hdmitx_set_hdcp_pclk(struct hdmitx_dev *hdev);
void hdmitx_set_cts_hdcp22_clk(struct hdmitx_dev *hdev);
void hdmitx_set_sys_clk(struct hdmitx_dev *hdev, unsigned char flag);
void hdmitx_set_vclk2_encp(struct hdmitx_dev *hdev);
void hdmitx_disable_vclk2_enci(struct hdmitx_dev *hdev);
void hdmitx_set_vclk2_enci(struct hdmitx_dev *hdev);

View File

@@ -216,6 +216,9 @@ struct hdmitx_clk_tree_s {
struct clk *hdmi_clk_vpu;
struct clk *hdcp22_tx_skp;
struct clk *hdcp22_tx_esm;
struct clk *venci_top_gate;
struct clk *venci_0_gate;
struct clk *venci_1_gate;
};
#define EDID_MAX_BLOCK 4