if (flag&2) {
hdmitx_set_top_pclk(hdev);
- hdmitx_set_vclk2_encp(hdev);
+
+ hd_write_reg(P_HHI_GCLK_OTHER,
+ hd_read_reg(P_HHI_GCLK_OTHER)|(1<<17));
}
}
-void hdmitx_set_vclk2_encp(struct hdmitx_dev *hdev)
+static void hdmitx_disable_encp_clk(struct hdmitx_dev *hdev)
{
- hd_write_reg(P_HHI_GCLK_OTHER,
- hd_read_reg(P_HHI_GCLK_OTHER)|(1<<17));
+ hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 0, 2, 1);
+
+#ifdef CONFIG_AMLOGIC_VPU
+ switch_vpu_clk_gate_vmod(VPU_VENCP, VPU_CLK_GATE_OFF);
+ switch_vpu_mem_pd_vmod(VPU_VENCP, VPU_MEM_POWER_DOWN);
+#endif
}
-void hdmitx_disable_vclk2_enci(struct hdmitx_dev *hdev)
+static void hdmitx_enable_encp_clk(struct hdmitx_dev *hdev)
{
- if (hdev->hdmitx_clk_tree.venci_top_gate)
- clk_disable_unprepare(hdev->hdmitx_clk_tree.venci_top_gate);
+#ifdef CONFIG_AMLOGIC_VPU
+ switch_vpu_clk_gate_vmod(VPU_VENCP, VPU_CLK_GATE_ON);
+ switch_vpu_mem_pd_vmod(VPU_VENCP, VPU_MEM_POWER_ON);
+#endif
- if (hdev->hdmitx_clk_tree.venci_0_gate)
- clk_disable_unprepare(hdev->hdmitx_clk_tree.venci_0_gate);
+ hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 1, 2, 1);
+}
- if (hdev->hdmitx_clk_tree.venci_1_gate)
- clk_disable_unprepare(hdev->hdmitx_clk_tree.venci_1_gate);
+static void hdmitx_disable_enci_clk(struct hdmitx_dev *hdev)
+{
+ hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 0, 0, 1);
#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
+ 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);
}
-void hdmitx_set_vclk2_enci(struct hdmitx_dev *hdev)
+static void hdmitx_enable_enci_clk(struct hdmitx_dev *hdev)
{
if (hdev->hdmitx_clk_tree.venci_top_gate)
clk_prepare_enable(hdev->hdmitx_clk_tree.venci_top_gate);
switch_vpu_mem_pd_vmod(VPU_VENCI, VPU_MEM_POWER_ON);
#endif
+ hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 1, 0, 1);
+}
+
+static void hdmitx_disable_tx_pixel_clk(struct hdmitx_dev *hdev)
+{
+ hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 0, 5, 1);
}
void hdmitx_set_cts_sys_clk(struct hdmitx_dev *hdev)
if (div == -1)
return;
hd_set_reg_bits(P_HHI_VID_CLK_DIV, div, 24, 4);
- hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 1, 2, 1);
hd_set_reg_bits(P_HHI_VID_CLK_CNTL, 1, 19, 1);
}
if (div == -1)
return;
hd_set_reg_bits(P_HHI_VID_CLK_DIV, div, 28, 4);
- hd_set_reg_bits(P_HHI_VID_CLK_CNTL2, 1, 0, 1);
hd_set_reg_bits(P_HHI_VID_CLK_CNTL, 1, 19, 1);
}
pr_info("j = %d vid_clk_div = %d\n", j, p_enc[j].vid_clk_div);
set_vid_clk_div(p_enc[j].vid_clk_div);
set_hdmi_tx_pixel_div(p_enc[j].hdmi_tx_pixel_div);
- set_encp_div(p_enc[j].encp_div);
- set_enci_div(p_enc[j].enci_div);
+
+ if (hdev->para->hdmitx_vinfo.viu_mux == VIU_MUX_ENCI) {
+ set_enci_div(p_enc[j].enci_div);
+ hdmitx_enable_enci_clk(hdev);
+ } else {
+ set_encp_div(p_enc[j].encp_div);
+ hdmitx_enable_encp_clk(hdev);
+ }
}
static int likely_frac_rate_mode(char *m)
hdmitx_set_clk_(hdev);
}
+void hdmitx_disable_clk(struct hdmitx_dev *hdev)
+{
+ /* cts_encp/enci_clk */
+ if (hdev->para->hdmitx_vinfo.viu_mux == VIU_MUX_ENCI)
+ hdmitx_disable_enci_clk(hdev);
+ else
+ hdmitx_disable_encp_clk(hdev);
+
+ /* hdmi_tx_pixel_clk */
+ hdmitx_disable_tx_pixel_clk(hdev);
+}
+