Commit a2f75662 authored by Russell King's avatar Russell King

drm/i2c: tda998x: separate connector initialisation

Separate out the connector initialisation from the rest of the drivers
initialisation.
Tested-by: default avatarRobin Murphy <robin.murphy@arm.com>
Tested-by: default avatarJon Medhurst <tixy@linaro.org>
Acked-by: default avatarJon Medhurst <tixy@linaro.org>
Tested-by: default avatarJyri Sarha <jsarha@ti.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 25576733
...@@ -996,6 +996,31 @@ const struct drm_connector_helper_funcs tda998x_connector_helper_funcs = { ...@@ -996,6 +996,31 @@ const struct drm_connector_helper_funcs tda998x_connector_helper_funcs = {
.best_encoder = tda998x_connector_best_encoder, .best_encoder = tda998x_connector_best_encoder,
}; };
static int tda998x_connector_init(struct tda998x_priv *priv,
struct drm_device *drm)
{
struct drm_connector *connector = &priv->connector;
int ret;
connector->interlace_allowed = 1;
if (priv->hdmi->irq)
connector->polled = DRM_CONNECTOR_POLL_HPD;
else
connector->polled = DRM_CONNECTOR_POLL_CONNECT |
DRM_CONNECTOR_POLL_DISCONNECT;
drm_connector_helper_add(connector, &tda998x_connector_helper_funcs);
ret = drm_connector_init(drm, connector, &tda998x_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA);
if (ret)
return ret;
drm_mode_connector_attach_encoder(&priv->connector, &priv->encoder);
return 0;
}
/* DRM encoder functions */ /* DRM encoder functions */
static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
...@@ -1241,16 +1266,6 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder, ...@@ -1241,16 +1266,6 @@ tda998x_encoder_mode_set(struct drm_encoder *encoder,
mutex_unlock(&priv->audio_mutex); mutex_unlock(&priv->audio_mutex);
} }
static void tda998x_encoder_set_polling(struct tda998x_priv *priv,
struct drm_connector *connector)
{
if (priv->hdmi->irq)
connector->polled = DRM_CONNECTOR_POLL_HPD;
else
connector->polled = DRM_CONNECTOR_POLL_CONNECT |
DRM_CONNECTOR_POLL_DISCONNECT;
}
static void tda998x_destroy(struct tda998x_priv *priv) static void tda998x_destroy(struct tda998x_priv *priv)
{ {
/* disable all IRQs and free the IRQ handler */ /* disable all IRQs and free the IRQ handler */
...@@ -1662,7 +1677,6 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) ...@@ -1662,7 +1677,6 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
crtcs = 1 << 0; crtcs = 1 << 0;
} }
priv->connector.interlace_allowed = 1;
priv->encoder.possible_crtcs = crtcs; priv->encoder.possible_crtcs = crtcs;
ret = tda998x_create(client, priv); ret = tda998x_create(client, priv);
...@@ -1672,24 +1686,16 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) ...@@ -1672,24 +1686,16 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data)
if (!dev->of_node && params) if (!dev->of_node && params)
tda998x_set_config(priv, params); tda998x_set_config(priv, params);
tda998x_encoder_set_polling(priv, &priv->connector);
drm_encoder_helper_add(&priv->encoder, &tda998x_encoder_helper_funcs); drm_encoder_helper_add(&priv->encoder, &tda998x_encoder_helper_funcs);
ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs, ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs,
DRM_MODE_ENCODER_TMDS, NULL); DRM_MODE_ENCODER_TMDS, NULL);
if (ret) if (ret)
goto err_encoder; goto err_encoder;
drm_connector_helper_add(&priv->connector, ret = tda998x_connector_init(priv, drm);
&tda998x_connector_helper_funcs);
ret = drm_connector_init(drm, &priv->connector,
&tda998x_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA);
if (ret) if (ret)
goto err_connector; goto err_connector;
drm_mode_connector_attach_encoder(&priv->connector, &priv->encoder);
return 0; return 0;
err_connector: err_connector:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment