Exemple #1
0
/* initialize connector */
struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi)
{
    struct drm_connector *connector = NULL;
    struct hdmi_connector *hdmi_connector;
    int ret;

    hdmi_connector = kzalloc(sizeof(*hdmi_connector), GFP_KERNEL);
    if (!hdmi_connector)
        return ERR_PTR(-ENOMEM);

    hdmi_connector->hdmi = hdmi;
    INIT_WORK(&hdmi_connector->hpd_work, msm_hdmi_hotplug_work);

    connector = &hdmi_connector->base;

    drm_connector_init(hdmi->dev, connector, &hdmi_connector_funcs,
                       DRM_MODE_CONNECTOR_HDMIA);
    drm_connector_helper_add(connector, &msm_hdmi_connector_helper_funcs);

    connector->polled = DRM_CONNECTOR_POLL_CONNECT |
                        DRM_CONNECTOR_POLL_DISCONNECT;

    connector->interlace_allowed = 0;
    connector->doublescan_allowed = 0;

    ret = hpd_enable(hdmi_connector);
    if (ret) {
        dev_err(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);
        return ERR_PTR(ret);
    }

    drm_mode_connector_attach_encoder(connector, hdmi->encoder);

    return connector;
}
Exemple #2
0
/* initialize connector */
struct drm_connector *hdmi_connector_init(struct hdmi *hdmi)
{
	struct drm_connector *connector = NULL;
	struct hdmi_connector *hdmi_connector;
	int ret;

	hdmi_connector = kzalloc(sizeof(*hdmi_connector), GFP_KERNEL);
	if (!hdmi_connector) {
		ret = -ENOMEM;
		goto fail;
	}

	hdmi_connector->hdmi = hdmi_reference(hdmi);
	INIT_WORK(&hdmi_connector->hpd_work, hotplug_work);

	connector = &hdmi_connector->base;

	drm_connector_init(hdmi->dev, connector, &hdmi_connector_funcs,
			DRM_MODE_CONNECTOR_HDMIA);
	drm_connector_helper_add(connector, &hdmi_connector_helper_funcs);

	connector->polled = DRM_CONNECTOR_POLL_HPD;

	connector->interlace_allowed = 1;
	connector->doublescan_allowed = 0;

	drm_sysfs_connector_add(connector);

	ret = hpd_enable(hdmi_connector);
	if (ret) {
		dev_err(hdmi->dev->dev, "failed to enable HPD: %d\n", ret);
		goto fail;
	}

	drm_mode_connector_attach_encoder(connector, hdmi->encoder);

	return connector;

fail:
	if (connector)
		hdmi_connector_destroy(connector);

	return ERR_PTR(ret);
}