#include <linux/clk.h>
#include <linux/component.h>
#include <linux/gpio/consumer.h>
+#include <linux/extcon-provider.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status);
pm_runtime_put(&vc4_hdmi->pdev->dev);
+#ifdef CONFIG_EXTCON
+ if (status != vc4_hdmi->status) {
+ extcon_set_state_sync(vc4_hdmi->edev, EXTCON_DISP_HDMI,
+ (status == connector_status_connected ?
+ true : false));
+ vc4_hdmi->status = status;
+ }
+#endif
+
return status;
}
put_device(&vc4_hdmi->ddc->dev);
}
+#ifdef CONFIG_EXTCON
+static const unsigned int vc4_hdmi_extcon_cable[] = {
+ EXTCON_DISP_HDMI,
+ EXTCON_NONE,
+};
+#endif
+
static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
{
const struct vc4_hdmi_variant *variant = of_device_get_match_data(dev);
if (ret)
return ret;
+#ifdef CONFIG_EXTCON
+ vc4_hdmi->status = connector_status_disconnected;
+
+ /* Initialize extcon device */
+ vc4_hdmi->edev = devm_extcon_dev_allocate(dev, vc4_hdmi_extcon_cable);
+ if (IS_ERR(vc4_hdmi->edev)) {
+ dev_err(dev, "failed to allocate memory for extcon\n");
+ return PTR_ERR(vc4_hdmi->edev);
+ }
+
+ ret = devm_extcon_dev_register(dev, vc4_hdmi->edev);
+ if (ret) {
+ dev_err(dev, "failed to register extcon device\n");
+ return ret;
+ }
+#endif
+
/* Only use the GPIO HPD pin if present in the DT, otherwise
* we'll use the HDMI core's register.
*/
struct vc4_hdmi_register;
struct vc4_hdmi_connector_state;
+#ifdef CONFIG_EXTCON
+struct extcon_dev;
+#endif
+
enum vc4_hdmi_phy_channel {
PHY_LANE_0 = 0,
PHY_LANE_1,
* for use outside of KMS hooks. Protected by @mutex.
*/
enum vc4_hdmi_output_format output_format;
+
+#ifdef CONFIG_EXTCON
+ enum drm_connector_status status;
+ struct extcon_dev *edev;
+#endif
};
#define connector_to_vc4_hdmi(_connector) \