Lines Matching +full:hpd +full:- +full:gpio

1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/gpio/consumer.h>
65 const struct hdmi_platform_config *config = hdmi->config; in enable_hpd_clocks()
66 struct device *dev = &hdmi->pdev->dev; in enable_hpd_clocks()
70 for (i = 0; i < config->hpd_clk_cnt; i++) { in enable_hpd_clocks()
71 if (config->hpd_freq && config->hpd_freq[i]) { in enable_hpd_clocks()
72 ret = clk_set_rate(hdmi->hpd_clks[i], in enable_hpd_clocks()
73 config->hpd_freq[i]); in enable_hpd_clocks()
77 config->hpd_clk_names[i], ret); in enable_hpd_clocks()
80 ret = clk_prepare_enable(hdmi->hpd_clks[i]); in enable_hpd_clocks()
83 "failed to enable hpd clk: %s (%d)\n", in enable_hpd_clocks()
84 config->hpd_clk_names[i], ret); in enable_hpd_clocks()
88 for (i = config->hpd_clk_cnt - 1; i >= 0; i--) in enable_hpd_clocks()
89 clk_disable_unprepare(hdmi->hpd_clks[i]); in enable_hpd_clocks()
96 struct hdmi *hdmi = hdmi_bridge->hdmi; in msm_hdmi_hpd_enable()
97 const struct hdmi_platform_config *config = hdmi->config; in msm_hdmi_hpd_enable()
98 struct device *dev = &hdmi->pdev->dev; in msm_hdmi_hpd_enable()
103 ret = regulator_bulk_enable(config->hpd_reg_cnt, hdmi->hpd_regs); in msm_hdmi_hpd_enable()
105 DRM_DEV_ERROR(dev, "failed to enable hpd regulators: %d\n", ret); in msm_hdmi_hpd_enable()
115 if (hdmi->hpd_gpiod) in msm_hdmi_hpd_enable()
116 gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1); in msm_hdmi_hpd_enable()
127 /* enable HPD events: */ in msm_hdmi_hpd_enable()
133 spin_lock_irqsave(&hdmi->reg_lock, flags); in msm_hdmi_hpd_enable()
137 /* Toggle HPD circuit to trigger HPD sense */ in msm_hdmi_hpd_enable()
142 spin_unlock_irqrestore(&hdmi->reg_lock, flags); in msm_hdmi_hpd_enable()
152 struct hdmi *hdmi = hdmi_bridge->hdmi; in msm_hdmi_hpd_disable()
153 const struct hdmi_platform_config *config = hdmi->config; in msm_hdmi_hpd_disable()
154 struct device *dev = &hdmi->pdev->dev; in msm_hdmi_hpd_disable()
157 /* Disable HPD interrupt */ in msm_hdmi_hpd_disable()
169 ret = regulator_bulk_disable(config->hpd_reg_cnt, hdmi->hpd_regs); in msm_hdmi_hpd_disable()
171 dev_warn(dev, "failed to disable hpd regulator: %d\n", ret); in msm_hdmi_hpd_disable()
177 struct hdmi *hdmi = hdmi_bridge->hdmi; in msm_hdmi_hpd_irq()
180 /* Process HPD: */ in msm_hdmi_hpd_irq()
188 /* ack & disable (temporarily) HPD events: */ in msm_hdmi_hpd_irq()
200 queue_work(hdmi->workq, &hdmi_bridge->hpd_work); in msm_hdmi_hpd_irq()
208 pm_runtime_get_sync(&hdmi->pdev->dev); in detect_reg()
214 pm_runtime_put(&hdmi->pdev->dev); in detect_reg()
223 return gpiod_get_value(hdmi->hpd_gpiod) ? in detect_gpio()
232 struct hdmi *hdmi = hdmi_bridge->hdmi; in msm_hdmi_bridge_detect()
237 * some platforms may not have hpd gpio. Rely only on the status in msm_hdmi_bridge_detect()
240 if (!hdmi->hpd_gpiod) in msm_hdmi_bridge_detect()
251 } while (--retry); in msm_hdmi_bridge_detect()
253 /* the status we get from reading gpio seems to be more reliable, in msm_hdmi_bridge_detect()
255 * gpio status to agree: in msm_hdmi_bridge_detect()
259 DBG("hpd gpio tells us: %d", stat_gpio); in msm_hdmi_bridge_detect()