From cc700864fee6a811382bbfecbeb31fd936b89fc0 Mon Sep 17 00:00:00 2001 From: Weiming Liu Date: Fri, 28 Jul 2017 13:11:18 +0800 Subject: [PATCH] lcd: enable clkree gate PD#146437: lcd: enable clktree gate Change-Id: I9fcc1b37ec291a27a169092a129663fbdab5aefa Signed-off-by: Weiming Liu --- .../boot/dts/amlogic/mesonaxg_s400-panel.dtsi | 8 +++-- drivers/amlogic/media/vout/lcd/lcd_common.c | 37 ++++++++++++++++++++++ include/linux/amlogic/media/vout/lcd/lcd_vout.h | 2 ++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi b/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi index b7907e0..bce53fd 100644 --- a/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi @@ -24,10 +24,14 @@ key_valid = <0>; clocks = <&clkc CLKID_MIPI_DSI_HOST &clkc CLKID_MIPI_DSI_PHY - &clkc CLKID_DSI_MEAS_COMP>; + &clkc CLKID_DSI_MEAS_COMP + &clkc CLKID_MIPI_ENABLE_GATE + &clkc CLKID_MIPI_BANDGAP_GATE>; clock-names = "dsi_host", "dsi_phy", - "dsi_meas"; + "dsi_meas", + "mipi_enable_gate", + "mipi_bandgap_gate"; pinctrl_version = <1>; /* for uboot */ /* power type: diff --git a/drivers/amlogic/media/vout/lcd/lcd_common.c b/drivers/amlogic/media/vout/lcd/lcd_common.c index e614300..dcd0be7 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_common.c +++ b/drivers/amlogic/media/vout/lcd/lcd_common.c @@ -936,6 +936,29 @@ void lcd_clk_gate_switch(int status) switch (lcd_drv->chip_type) { case LCD_CHIP_AXG: + if (status) { + if (IS_ERR(lcd_drv->mipi_enable_gate)) + LCDERR("%s: mipi_enable_gate\n", __func__); + else + clk_prepare_enable(lcd_drv->mipi_enable_gate); + + if (IS_ERR(lcd_drv->mipi_bandgap_gate)) + LCDERR("%s: mipi_bandgap_gate\n", __func__); + else + clk_prepare_enable(lcd_drv->mipi_bandgap_gate); + } else { + if (IS_ERR(lcd_drv->mipi_enable_gate)) + LCDERR("%s: mipi_enable_gate\n", __func__); + else + clk_disable_unprepare( + lcd_drv->mipi_enable_gate); + + if (IS_ERR(lcd_drv->mipi_bandgap_gate)) + LCDERR("%s: mipi_bandgap_gate\n", __func__); + else + clk_disable_unprepare( + lcd_drv->mipi_bandgap_gate); + } break; default: if (status) { @@ -986,6 +1009,20 @@ void lcd_clktree_probe(void) LCDERR("%s: clk dsi_meas\n", __func__); else clk_prepare_enable(lcd_drv->dsi_meas); + + lcd_drv->mipi_enable_gate = devm_clk_get( + lcd_drv->dev, "mipi_enable_gate"); + if (IS_ERR(lcd_drv->mipi_enable_gate)) + LCDERR("%s: clk mipi_enable_gate\n", __func__); + else + clk_prepare_enable(lcd_drv->mipi_enable_gate); + + lcd_drv->mipi_bandgap_gate = devm_clk_get( + lcd_drv->dev, "mipi_bandgap_gate"); + if (IS_ERR(lcd_drv->mipi_bandgap_gate)) + LCDERR("%s: clk mipi_bandgap_gate\n", __func__); + else + clk_prepare_enable(lcd_drv->mipi_bandgap_gate); break; default: lcd_drv->vencl_top = devm_clk_get(lcd_drv->dev, "vencl_top"); diff --git a/include/linux/amlogic/media/vout/lcd/lcd_vout.h b/include/linux/amlogic/media/vout/lcd/lcd_vout.h index 4d5f52b..e8acc9b 100644 --- a/include/linux/amlogic/media/vout/lcd/lcd_vout.h +++ b/include/linux/amlogic/media/vout/lcd/lcd_vout.h @@ -361,6 +361,8 @@ struct aml_lcd_drv_s { struct clk *dsi_host; struct clk *dsi_phy; struct clk *dsi_meas; + struct clk *mipi_enable_gate; + struct clk *mipi_bandgap_gate; struct device *dev; struct lcd_config_s *lcd_config; -- 2.7.4