aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/hdmi/hdmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/msm/hdmi/hdmi.c')
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index a125a7e32742..c6c9b02e0ada 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -258,28 +258,30 @@ static void set_hdmi_pdev(struct drm_device *dev,
258 priv->hdmi_pdev = pdev; 258 priv->hdmi_pdev = pdev;
259} 259}
260 260
261#ifdef CONFIG_OF
262static int get_gpio(struct device *dev, struct device_node *of_node, const char *name)
263{
264 int gpio = of_get_named_gpio(of_node, name, 0);
265 if (gpio < 0) {
266 char name2[32];
267 snprintf(name2, sizeof(name2), "%s-gpio", name);
268 gpio = of_get_named_gpio(of_node, name2, 0);
269 if (gpio < 0) {
270 dev_err(dev, "failed to get gpio: %s (%d)\n",
271 name, gpio);
272 gpio = -1;
273 }
274 }
275 return gpio;
276}
277#endif
278
261static int hdmi_bind(struct device *dev, struct device *master, void *data) 279static int hdmi_bind(struct device *dev, struct device *master, void *data)
262{ 280{
263 static struct hdmi_platform_config config = {}; 281 static struct hdmi_platform_config config = {};
264#ifdef CONFIG_OF 282#ifdef CONFIG_OF
265 struct device_node *of_node = dev->of_node; 283 struct device_node *of_node = dev->of_node;
266 284
267 int get_gpio(const char *name)
268 {
269 int gpio = of_get_named_gpio(of_node, name, 0);
270 if (gpio < 0) {
271 char name2[32];
272 snprintf(name2, sizeof(name2), "%s-gpio", name);
273 gpio = of_get_named_gpio(of_node, name2, 0);
274 if (gpio < 0) {
275 dev_err(dev, "failed to get gpio: %s (%d)\n",
276 name, gpio);
277 gpio = -1;
278 }
279 }
280 return gpio;
281 }
282
283 if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { 285 if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) {
284 static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; 286 static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"};
285 static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; 287 static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"};
@@ -312,12 +314,12 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
312 } 314 }
313 315
314 config.mmio_name = "core_physical"; 316 config.mmio_name = "core_physical";
315 config.ddc_clk_gpio = get_gpio("qcom,hdmi-tx-ddc-clk"); 317 config.ddc_clk_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk");
316 config.ddc_data_gpio = get_gpio("qcom,hdmi-tx-ddc-data"); 318 config.ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data");
317 config.hpd_gpio = get_gpio("qcom,hdmi-tx-hpd"); 319 config.hpd_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd");
318 config.mux_en_gpio = get_gpio("qcom,hdmi-tx-mux-en"); 320 config.mux_en_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en");
319 config.mux_sel_gpio = get_gpio("qcom,hdmi-tx-mux-sel"); 321 config.mux_sel_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel");
320 config.mux_lpm_gpio = get_gpio("qcom,hdmi-tx-mux-lpm"); 322 config.mux_lpm_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm");
321 323
322#else 324#else
323 static const char *hpd_clk_names[] = { 325 static const char *hpd_clk_names[] = {