From 9fd38c3cf46eb7a3bb159edeafb5a8856761ecd3 Mon Sep 17 00:00:00 2001 From: Xubilv Date: Fri, 11 Dec 2015 03:12:11 -0500 Subject: [PATCH] video: rockchip: mipi: add driver to support mipi dsi Change-Id: I9a872aa14a55e90a360d7287be51dbca30662c1e Signed-off-by: Xubilv --- drivers/video/rockchip/screen/lcd_mipi.c | 4 +- .../rockchip/transmitter/rk32_mipi_dsi.c | 48 +++++-------------- .../rockchip/transmitter/rk32_mipi_dsi.h | 1 - 3 files changed, 13 insertions(+), 40 deletions(-) diff --git a/drivers/video/rockchip/screen/lcd_mipi.c b/drivers/video/rockchip/screen/lcd_mipi.c index d9e4352c0ab0..8f6e8c516202 100755 --- a/drivers/video/rockchip/screen/lcd_mipi.c +++ b/drivers/video/rockchip/screen/lcd_mipi.c @@ -352,7 +352,7 @@ static int rk_mipi_screen_init_dt(struct mipi_screen *screen) screen->lcd_en_gpio = INVALID_GPIO; MIPI_SCREEN_DBG("%s: Can not get child => mipi_power_ctr.\n", __func__); } else { - grandchildnode = of_get_child_by_name(childnode, "mipi_lcd_rst"); + grandchildnode = of_find_node_by_name(childnode, "mipi_lcd_rst"); if (!grandchildnode) { screen->lcd_rst_gpio = INVALID_GPIO; MIPI_SCREEN_DBG("%s: Can not read property: mipi_lcd_rst.\n", __func__); @@ -383,7 +383,7 @@ static int rk_mipi_screen_init_dt(struct mipi_screen *screen) MIPI_SCREEN_DBG("lcd->lcd_rst_gpio=%d,dsi->lcd_rst_atv_val=%d\n", screen->lcd_rst_gpio, screen->lcd_rst_atv_val); } - grandchildnode = of_get_child_by_name(childnode, "mipi_lcd_en"); + grandchildnode = of_find_node_by_name(childnode, "mipi_lcd_en"); if (!grandchildnode) { screen->lcd_en_gpio = INVALID_GPIO; MIPI_SCREEN_DBG("%s: Can not read property: mipi_lcd_en.\n", __func__); diff --git a/drivers/video/rockchip/transmitter/rk32_mipi_dsi.c b/drivers/video/rockchip/transmitter/rk32_mipi_dsi.c index 1b82380a28bc..0a31a7591dd9 100755 --- a/drivers/video/rockchip/transmitter/rk32_mipi_dsi.c +++ b/drivers/video/rockchip/transmitter/rk32_mipi_dsi.c @@ -217,7 +217,6 @@ static int rk32_phy_power_up(struct dsi *dsi) /* enable ref clock */ clk_prepare_enable(dsi->phy.refclk); clk_prepare_enable(dsi->dsi_pclk); - clk_prepare_enable(dsi->dsi_pd); udelay(10); switch (dsi->host.lane) { @@ -461,9 +460,7 @@ static int rk312x_phy_power_up(struct dsi *dsi) clk_prepare_enable(dsi->dsi_host_pclk); if (dsi->ops.id == DWC_DSI_VERSION_RK312x) { clk_prepare_enable(dsi->h2p_hclk); - clk_prepare_enable(dsi->dsi_pd); - } else - clk_prepare_enable(dsi->dsi_pd); + } udelay(10); @@ -509,7 +506,6 @@ static int rk32_phy_power_down(struct dsi *dsi) rk32_dsi_set_bits(dsi, 0, phy_shutdownz); clk_disable_unprepare(dsi->phy.refclk); clk_disable_unprepare(dsi->dsi_pclk); - clk_disable_unprepare(dsi->dsi_pd); return 0; } @@ -524,9 +520,7 @@ static int rk312x_phy_power_down(struct dsi *dsi) if (dsi->ops.id == DWC_DSI_VERSION_RK312x) { clk_disable_unprepare(dsi->h2p_hclk); - clk_disable_unprepare(dsi->dsi_pd); - } else - clk_disable_unprepare(dsi->dsi_pd); + } return 0; } @@ -1736,24 +1730,24 @@ static int rk32_mipi_dsi_probe(struct platform_device *pdev) printk(KERN_INFO "%s\n", data->label); if (dsi->ops.id == DWC_DSI_VERSION) { res_host = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dsi->host.membase = devm_request_and_ioremap(&pdev->dev, res_host); - if (!dsi->host.membase) { + dsi->host.membase = devm_ioremap_resource(&pdev->dev, res_host); + if (IS_ERR(dsi->host.membase)) { dev_err(&pdev->dev, "get resource mipi host membase fail!\n"); - return -ENOMEM; + return PTR_ERR(dsi->host.membase); } } else if (dsi->ops.id == DWC_DSI_VERSION_RK312x || dsi->ops.id == DWC_DSI_VERSION_RK3368) { res_host = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mipi_dsi_host"); - dsi->host.membase = devm_request_and_ioremap(&pdev->dev, res_host); - if (!dsi->host.membase) { + dsi->host.membase = devm_ioremap_resource(&pdev->dev, res_host); + if (IS_ERR(dsi->host.membase)) { dev_err(&pdev->dev, "get resource mipi host membase fail!\n"); - return -ENOMEM; + return PTR_ERR(dsi->host.membase); } res_phy = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mipi_dsi_phy"); - dsi->phy.membase = devm_request_and_ioremap(&pdev->dev, res_phy); - if (!dsi->phy.membase) { + dsi->phy.membase = devm_ioremap_resource(&pdev->dev, res_phy); + if (IS_ERR(dsi->phy.membase)) { dev_err(&pdev->dev, "get resource mipi phy membase fail!\n"); - return -ENOMEM; + return PTR_ERR(dsi->phy.membase); } } @@ -1777,12 +1771,6 @@ static int rk32_mipi_dsi_probe(struct platform_device *pdev) dev_err(&pdev->dev, "get pclk_mipi_dsi_host clock fail\n"); return PTR_ERR(dsi->dsi_host_pclk); } - - dsi->dsi_pd = devm_clk_get(&pdev->dev, "pd_mipi_dsi"); - if (unlikely(IS_ERR(dsi->dsi_pd))) { - dev_err(&pdev->dev, "get pd_mipi_dsi clock fail\n"); - return PTR_ERR(dsi->dsi_pd); - } } if (dsi->ops.id == DWC_DSI_VERSION_RK312x) { @@ -1798,21 +1786,8 @@ static int rk32_mipi_dsi_probe(struct platform_device *pdev) dev_err(&pdev->dev, "get hclk_vio_h2p clock fail\n"); return PTR_ERR(dsi->h2p_hclk); } - - dsi->dsi_pd = devm_clk_get(&pdev->dev, "pd_mipi_dsi"); - if (unlikely(IS_ERR(dsi->dsi_pd))) { - dev_err(&pdev->dev, "get pd_mipi_dsi clock fail\n"); - return PTR_ERR(dsi->dsi_pd); - } } - if (dsi->ops.id == DWC_DSI_VERSION) { - dsi->dsi_pd = devm_clk_get(&pdev->dev, "pd_mipi_dsi"); - if (unlikely(IS_ERR(dsi->dsi_pd))) { - dev_err(&pdev->dev, "get pd_mipi_dsi clock fail\n"); - return PTR_ERR(dsi->dsi_pd); - } - } dsi->host.irq = platform_get_irq(pdev, 0); if (dsi->host.irq < 0) { dev_err(&pdev->dev, "no irq resource?\n"); @@ -1917,7 +1892,6 @@ static int rk32_mipi_dsi_probe(struct platform_device *pdev) } else if (dsi->ops.id == DWC_DSI_VERSION_RK3368) clk_prepare_enable(dsi->dsi_host_pclk); - clk_prepare_enable(dsi->dsi_pd); dsi->clk_on = 1; udelay(10); } diff --git a/drivers/video/rockchip/transmitter/rk32_mipi_dsi.h b/drivers/video/rockchip/transmitter/rk32_mipi_dsi.h index de4b17225124..945df73d6cb5 100755 --- a/drivers/video/rockchip/transmitter/rk32_mipi_dsi.h +++ b/drivers/video/rockchip/transmitter/rk32_mipi_dsi.h @@ -307,7 +307,6 @@ struct dsi { struct clk *dsi_pclk; /* for mipi phy */ struct clk *dsi_host_pclk; /* for mipi host */ struct clk *h2p_hclk; - struct clk *dsi_pd; #endif struct dentry *debugfs_dir; struct platform_device *pdev; -- 2.34.1