Lines Matching +full:hpd +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0-only
72 const struct hdmi_platform_config *config = hdmi->config; in gpio_config()
77 struct hdmi_gpio_data gpio = config->gpios[i]; in gpio_config()
94 struct hdmi_gpio_data gpio = config->gpios[i]; in gpio_config()
114 const struct hdmi_platform_config *config = hdmi->config; in enable_hpd_clocks()
115 struct device *dev = &hdmi->pdev->dev; in enable_hpd_clocks()
119 for (i = 0; i < config->hpd_clk_cnt; i++) { in enable_hpd_clocks()
120 if (config->hpd_freq && config->hpd_freq[i]) { in enable_hpd_clocks()
121 ret = clk_set_rate(hdmi->hpd_clks[i], in enable_hpd_clocks()
122 config->hpd_freq[i]); in enable_hpd_clocks()
126 config->hpd_clk_names[i], ret); in enable_hpd_clocks()
129 ret = clk_prepare_enable(hdmi->hpd_clks[i]); in enable_hpd_clocks()
132 "failed to enable hpd clk: %s (%d)\n", in enable_hpd_clocks()
133 config->hpd_clk_names[i], ret); in enable_hpd_clocks()
137 for (i = config->hpd_clk_cnt - 1; i >= 0; i--) in enable_hpd_clocks()
138 clk_disable_unprepare(hdmi->hpd_clks[i]); in enable_hpd_clocks()
145 struct hdmi *hdmi = hdmi_connector->hdmi; in msm_hdmi_hpd_enable()
146 const struct hdmi_platform_config *config = hdmi->config; in msm_hdmi_hpd_enable()
147 struct device *dev = &hdmi->pdev->dev; in msm_hdmi_hpd_enable()
152 for (i = 0; i < config->hpd_reg_cnt; i++) { in msm_hdmi_hpd_enable()
153 ret = regulator_enable(hdmi->hpd_regs[i]); in msm_hdmi_hpd_enable()
155 DRM_DEV_ERROR(dev, "failed to enable hpd regulator: %s (%d)\n", in msm_hdmi_hpd_enable()
156 config->hpd_reg_names[i], ret); in msm_hdmi_hpd_enable()
169 DRM_DEV_ERROR(dev, "failed to configure GPIOs: %d\n", ret); in msm_hdmi_hpd_enable()
182 /* enable HPD events: */ in msm_hdmi_hpd_enable()
188 spin_lock_irqsave(&hdmi->reg_lock, flags); in msm_hdmi_hpd_enable()
192 /* Toggle HPD circuit to trigger HPD sense */ in msm_hdmi_hpd_enable()
197 spin_unlock_irqrestore(&hdmi->reg_lock, flags); in msm_hdmi_hpd_enable()
207 struct hdmi *hdmi = hdmi_connector->hdmi; in hdp_disable()
208 const struct hdmi_platform_config *config = hdmi->config; in hdp_disable()
209 struct device *dev = &hdmi->pdev->dev; in hdp_disable()
212 /* Disable HPD interrupt */ in hdp_disable()
222 dev_warn(dev, "failed to unconfigure GPIOs: %d\n", ret); in hdp_disable()
228 for (i = 0; i < config->hpd_reg_cnt; i++) { in hdp_disable()
229 ret = regulator_disable(hdmi->hpd_regs[i]); in hdp_disable()
231 dev_warn(dev, "failed to disable hpd regulator: %s (%d)\n", in hdp_disable()
232 config->hpd_reg_names[i], ret); in hdp_disable()
241 struct drm_connector *connector = &hdmi_connector->base; in msm_hdmi_hotplug_work()
242 drm_helper_hpd_irq_event(connector->dev); in msm_hdmi_hotplug_work()
248 struct hdmi *hdmi = hdmi_connector->hdmi; in msm_hdmi_connector_irq()
251 /* Process HPD: */ in msm_hdmi_connector_irq()
259 /* ack & disable (temporarily) HPD events: */ in msm_hdmi_connector_irq()
271 queue_work(hdmi->workq, &hdmi_connector->hpd_work); in msm_hdmi_connector_irq()
279 pm_runtime_get_sync(&hdmi->pdev->dev); in detect_reg()
285 pm_runtime_put_autosuspend(&hdmi->pdev->dev); in detect_reg()
294 const struct hdmi_platform_config *config = hdmi->config; in detect_gpio()
295 struct hdmi_gpio_data hpd_gpio = config->gpios[HPD_GPIO_INDEX]; in detect_gpio()
306 struct hdmi *hdmi = hdmi_connector->hdmi; in hdmi_connector_detect()
307 const struct hdmi_platform_config *config = hdmi->config; in hdmi_connector_detect()
308 struct hdmi_gpio_data hpd_gpio = config->gpios[HPD_GPIO_INDEX]; in hdmi_connector_detect()
313 * some platforms may not have hpd gpio. Rely only on the status in hdmi_connector_detect()
327 } while (--retry); in hdmi_connector_detect()
335 DBG("hpd gpio tells us: %d", stat_gpio); in hdmi_connector_detect()
355 struct hdmi *hdmi = hdmi_connector->hdmi; in msm_hdmi_connector_get_modes()
363 edid = drm_get_edid(connector, hdmi->i2c); in msm_hdmi_connector_get_modes()
367 hdmi->hdmi_mode = drm_detect_hdmi_monitor(edid); in msm_hdmi_connector_get_modes()
382 struct hdmi *hdmi = hdmi_connector->hdmi; in msm_hdmi_connector_mode_valid()
383 const struct hdmi_platform_config *config = hdmi->config; in msm_hdmi_connector_mode_valid()
384 struct msm_drm_private *priv = connector->dev->dev_private; in msm_hdmi_connector_mode_valid()
385 struct msm_kms *kms = priv->kms; in msm_hdmi_connector_mode_valid()
388 requested = 1000 * mode->clock; in msm_hdmi_connector_mode_valid()
389 actual = kms->funcs->round_pixclk(kms, in msm_hdmi_connector_mode_valid()
390 requested, hdmi_connector->hdmi->encoder); in msm_hdmi_connector_mode_valid()
396 if (config->pwr_clk_cnt > 0) in msm_hdmi_connector_mode_valid()
397 actual = clk_round_rate(hdmi->pwr_clks[0], actual); in msm_hdmi_connector_mode_valid()
429 return ERR_PTR(-ENOMEM); in msm_hdmi_connector_init()
431 hdmi_connector->hdmi = hdmi; in msm_hdmi_connector_init()
432 INIT_WORK(&hdmi_connector->hpd_work, msm_hdmi_hotplug_work); in msm_hdmi_connector_init()
434 connector = &hdmi_connector->base; in msm_hdmi_connector_init()
436 drm_connector_init_with_ddc(hdmi->dev, connector, in msm_hdmi_connector_init()
439 hdmi->i2c); in msm_hdmi_connector_init()
442 connector->polled = DRM_CONNECTOR_POLL_CONNECT | in msm_hdmi_connector_init()
445 connector->interlace_allowed = 0; in msm_hdmi_connector_init()
446 connector->doublescan_allowed = 0; in msm_hdmi_connector_init()
448 drm_connector_attach_encoder(connector, hdmi->encoder); in msm_hdmi_connector_init()