This patch modifies the driver to support clock names without _clk
suffix, usage of clk names with _clk suffix seems to be non-standard and
picked up everytime in DT patch review.
So lets fix this and make the other clk names deprecated till we decide
to remove them forever.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
---
 drivers/gpu/drm/msm/hdmi/hdmi.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index e918889..c454d32 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -69,6 +69,24 @@ static void hdmi_destroy(struct hdmi *hdmi)
        platform_set_drvdata(hdmi->pdev, NULL);
 }

+static struct clk *hdmi_clk_get(struct device *dev, const char *id)
+{
+       char clk_name[32];
+       struct clk *clk;
+
+       snprintf(clk_name, sizeof(clk_name), "%s_clk", id);
+       clk = devm_clk_get(dev, clk_name);
+       if (IS_ERR(clk)) {
+               clk = devm_clk_get(dev, id);
+               if (IS_ERR(clk))
+                       return ERR_CAST(clk);
+       } else {
+               dev_warn(dev, "binding deprecated for %s\n", clk_name);
+       }
+
+       return clk;
+}
+
 /* construct hdmi at bind/probe time, grab all the resources.  If
  * we are to EPROBE_DEFER we want to do it here, rather than later
  * at modeset_init() time
@@ -158,7 +176,7 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
        for (i = 0; i < config->hpd_clk_cnt; i++) {
                struct clk *clk;

-               clk = devm_clk_get(&pdev->dev, config->hpd_clk_names[i]);
+               clk = hdmi_clk_get(&pdev->dev, config->hpd_clk_names[i]);
                if (IS_ERR(clk)) {
                        ret = PTR_ERR(clk);
                        dev_err(&pdev->dev, "failed to get hpd clk: %s (%d)\n",
@@ -175,10 +193,11 @@ static struct hdmi *hdmi_init(struct platform_device 
*pdev)
                ret = -ENOMEM;
                goto fail;
        }
+
        for (i = 0; i < config->pwr_clk_cnt; i++) {
                struct clk *clk;

-               clk = devm_clk_get(&pdev->dev, config->pwr_clk_names[i]);
+               clk = hdmi_clk_get(&pdev->dev, config->pwr_clk_names[i]);
                if (IS_ERR(clk)) {
                        ret = PTR_ERR(clk);
                        dev_err(&pdev->dev, "failed to get pwr clk: %s (%d)\n",
@@ -296,7 +315,7 @@ static struct hdmi_platform_config hdmi_tx_8660_config = {
 };

 static const char *hpd_reg_names_8960[] = {"core-vdda", "hdmi-mux"};
-static const char *hpd_clk_names_8960[] = {"core_clk", "master_iface_clk", 
"slave_iface_clk"};
+static const char *hpd_clk_names_8960[] = {"core", "master_iface", 
"slave_iface"};

 static struct hdmi_platform_config hdmi_tx_8960_config = {
                .phy_init = hdmi_phy_8960_init,
@@ -306,8 +325,8 @@ static struct hdmi_platform_config hdmi_tx_8960_config = {

 static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"};
 static const char *hpd_reg_names_8x74[] = {"hpd-gdsc", "hpd-5v"};
-static const char *pwr_clk_names_8x74[] = {"extp_clk", "alt_iface_clk"};
-static const char *hpd_clk_names_8x74[] = {"iface_clk", "core_clk", 
"mdp_core_clk"};
+static const char *pwr_clk_names_8x74[] = {"extp", "alt_iface"};
+static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core"};
 static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0};

 static struct hdmi_platform_config hdmi_tx_8074_config = {
-- 
1.9.1

Reply via email to