aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRahul Sharma <rahul.sharma@samsung.com>2014-05-20 01:06:05 -0400
committerInki Dae <daeinki@gmail.com>2014-06-01 13:07:09 -0400
commit049d34e94f9aa2c3ed22a7bad75dd188ec7dacb9 (patch)
tree644a0638e2f35b8f3224e2a7ad5494f68d6257a9
parent122beea84bb90236b1ae545f08267af58591c21b (diff)
drm/exynos: use regmap interface to set hdmiphy control bit in pmu
Exynos drm hdmi driver used to get dummy hdmiphy clock to control the PMU bit for hdmiphy. This bit needs to be set before setting any resolution to hdmi hardware. This was handled using dummy hdmiphy clock which is removed here. PMU is already defined as system controller for exynos SoCs. Hdmi driver is modified to control the phy enable bit inside PMU using regmap interfaces. Devicetree binding document for hdmi is also updated. Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r--Documentation/devicetree/bindings/video/exynos_hdmi.txt2
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c27
-rw-r--r--drivers/gpu/drm/exynos/regs-hdmi.h4
3 files changed, 25 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
index 75ada041389e..1fd8cf9cbfac 100644
--- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt
+++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt
@@ -28,6 +28,7 @@ Required properties:
28 "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi". 28 "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy" and "mout_hdmi".
29- ddc: phandle to the hdmi ddc node 29- ddc: phandle to the hdmi ddc node
30- phy: phandle to the hdmi phy node 30- phy: phandle to the hdmi phy node
31- samsung,syscon-phandle: phandle for system controller node for PMU.
31 32
32Example: 33Example:
33 34
@@ -38,4 +39,5 @@ Example:
38 hpd-gpio = <&gpx3 7 1>; 39 hpd-gpio = <&gpx3 7 1>;
39 ddc = <&hdmi_ddc_node>; 40 ddc = <&hdmi_ddc_node>;
40 phy = <&hdmi_phy_node>; 41 phy = <&hdmi_phy_node>;
42 samsung,syscon-phandle = <&pmu_system_controller>;
41 }; 43 };
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index ed6176ebfbcd..941b235ca1db 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -38,6 +38,8 @@
38#include <linux/of_gpio.h> 38#include <linux/of_gpio.h>
39#include <linux/hdmi.h> 39#include <linux/hdmi.h>
40#include <linux/component.h> 40#include <linux/component.h>
41#include <linux/mfd/syscon.h>
42#include <linux/regmap.h>
41 43
42#include <drm/exynos_drm.h> 44#include <drm/exynos_drm.h>
43 45
@@ -81,7 +83,6 @@ struct hdmi_resources {
81 struct clk *sclk_hdmi; 83 struct clk *sclk_hdmi;
82 struct clk *sclk_pixel; 84 struct clk *sclk_pixel;
83 struct clk *sclk_hdmiphy; 85 struct clk *sclk_hdmiphy;
84 struct clk *hdmiphy;
85 struct clk *mout_hdmi; 86 struct clk *mout_hdmi;
86 struct regulator_bulk_data *regul_bulk; 87 struct regulator_bulk_data *regul_bulk;
87 int regul_count; 88 int regul_count;
@@ -208,6 +209,7 @@ struct hdmi_context {
208 const struct hdmiphy_config *phy_confs; 209 const struct hdmiphy_config *phy_confs;
209 unsigned int phy_conf_count; 210 unsigned int phy_conf_count;
210 211
212 struct regmap *pmureg;
211 enum hdmi_type type; 213 enum hdmi_type type;
212}; 214};
213 215
@@ -2013,7 +2015,10 @@ static void hdmi_poweron(struct exynos_drm_display *display)
2013 if (regulator_bulk_enable(res->regul_count, res->regul_bulk)) 2015 if (regulator_bulk_enable(res->regul_count, res->regul_bulk))
2014 DRM_DEBUG_KMS("failed to enable regulator bulk\n"); 2016 DRM_DEBUG_KMS("failed to enable regulator bulk\n");
2015 2017
2016 clk_prepare_enable(res->hdmiphy); 2018 /* set pmu hdmiphy control bit to enable hdmiphy */
2019 regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
2020 PMU_HDMI_PHY_ENABLE_BIT, 1);
2021
2017 clk_prepare_enable(res->hdmi); 2022 clk_prepare_enable(res->hdmi);
2018 clk_prepare_enable(res->sclk_hdmi); 2023 clk_prepare_enable(res->sclk_hdmi);
2019 2024
@@ -2040,7 +2045,11 @@ static void hdmi_poweroff(struct exynos_drm_display *display)
2040 2045
2041 clk_disable_unprepare(res->sclk_hdmi); 2046 clk_disable_unprepare(res->sclk_hdmi);
2042 clk_disable_unprepare(res->hdmi); 2047 clk_disable_unprepare(res->hdmi);
2043 clk_disable_unprepare(res->hdmiphy); 2048
2049 /* reset pmu hdmiphy control bit to disable hdmiphy */
2050 regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
2051 PMU_HDMI_PHY_ENABLE_BIT, 0);
2052
2044 regulator_bulk_disable(res->regul_count, res->regul_bulk); 2053 regulator_bulk_disable(res->regul_count, res->regul_bulk);
2045 2054
2046 pm_runtime_put_sync(hdata->dev); 2055 pm_runtime_put_sync(hdata->dev);
@@ -2143,11 +2152,6 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
2143 DRM_ERROR("failed to get clock 'sclk_hdmiphy'\n"); 2152 DRM_ERROR("failed to get clock 'sclk_hdmiphy'\n");
2144 goto fail; 2153 goto fail;
2145 } 2154 }
2146 res->hdmiphy = devm_clk_get(dev, "hdmiphy");
2147 if (IS_ERR(res->hdmiphy)) {
2148 DRM_ERROR("failed to get clock 'hdmiphy'\n");
2149 goto fail;
2150 }
2151 res->mout_hdmi = devm_clk_get(dev, "mout_hdmi"); 2155 res->mout_hdmi = devm_clk_get(dev, "mout_hdmi");
2152 if (IS_ERR(res->mout_hdmi)) { 2156 if (IS_ERR(res->mout_hdmi)) {
2153 DRM_ERROR("failed to get clock 'mout_hdmi'\n"); 2157 DRM_ERROR("failed to get clock 'mout_hdmi'\n");
@@ -2383,6 +2387,13 @@ out_get_phy_port:
2383 goto err_hdmiphy; 2387 goto err_hdmiphy;
2384 } 2388 }
2385 2389
2390 hdata->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
2391 "samsung,syscon-phandle");
2392 if (IS_ERR(hdata->pmureg)) {
2393 DRM_ERROR("syscon regmap lookup failed.\n");
2394 goto err_hdmiphy;
2395 }
2396
2386 pm_runtime_enable(dev); 2397 pm_runtime_enable(dev);
2387 hdmi_display.ctx = hdata; 2398 hdmi_display.ctx = hdata;
2388 2399
diff --git a/drivers/gpu/drm/exynos/regs-hdmi.h b/drivers/gpu/drm/exynos/regs-hdmi.h
index 84a69cdd8e8d..6d846b979045 100644
--- a/drivers/gpu/drm/exynos/regs-hdmi.h
+++ b/drivers/gpu/drm/exynos/regs-hdmi.h
@@ -585,4 +585,8 @@
585#define HDMI_PHY_DISABLE_MODE_SET 0x80 585#define HDMI_PHY_DISABLE_MODE_SET 0x80
586#define HDMI_PHY_ENABLE_MODE_SET 0x00 586#define HDMI_PHY_ENABLE_MODE_SET 0x00
587 587
588/* PMU Registers for PHY */
589#define PMU_HDMI_PHY_CONTROL 0x700
590#define PMU_HDMI_PHY_ENABLE_BIT BIT(0)
591
588#endif /* SAMSUNG_REGS_HDMI_H */ 592#endif /* SAMSUNG_REGS_HDMI_H */