Commit 2c6e7583 authored by Peter Rosin's avatar Peter Rosin Committed by Russell King

drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable

This fits better with the drm_bridge callbacks for when this
driver becomes a drm_bridge.
Suggested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
[edited by rmk to just split the tda998x_encoder_dpms() function
 and restore the double-disable protection we originally had,
 preserving original behaviour.]
Tested-by: default avatarPeter Rosin <peda@axentia.se>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent b1eb4f84
...@@ -1308,18 +1308,9 @@ static int tda998x_connector_init(struct tda998x_priv *priv, ...@@ -1308,18 +1308,9 @@ static int tda998x_connector_init(struct tda998x_priv *priv,
/* DRM encoder functions */ /* DRM encoder functions */
static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) static void tda998x_enable(struct tda998x_priv *priv)
{ {
struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); if (!priv->is_on) {
bool on;
/* we only care about on or off: */
on = mode == DRM_MODE_DPMS_ON;
if (on == priv->is_on)
return;
if (on) {
/* enable video ports, audio will be enabled later */ /* enable video ports, audio will be enabled later */
reg_write(priv, REG_ENA_VP_0, 0xff); reg_write(priv, REG_ENA_VP_0, 0xff);
reg_write(priv, REG_ENA_VP_1, 0xff); reg_write(priv, REG_ENA_VP_1, 0xff);
...@@ -1330,7 +1321,12 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) ...@@ -1330,7 +1321,12 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2);
priv->is_on = true; priv->is_on = true;
} else { }
}
static void tda998x_disable(struct tda998x_priv *priv)
{
if (priv->is_on) {
/* disable video ports */ /* disable video ports */
reg_write(priv, REG_ENA_VP_0, 0x00); reg_write(priv, REG_ENA_VP_0, 0x00);
reg_write(priv, REG_ENA_VP_1, 0x00); reg_write(priv, REG_ENA_VP_1, 0x00);
...@@ -1340,6 +1336,23 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) ...@@ -1340,6 +1336,23 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
} }
} }
static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
{
struct tda998x_priv *priv = enc_to_tda998x_priv(encoder);
bool on;
/* we only care about on or off: */
on = mode == DRM_MODE_DPMS_ON;
if (on == priv->is_on)
return;
if (on)
tda998x_enable(priv);
else
tda998x_disable(priv);
}
static void static void
tda998x_encoder_mode_set(struct drm_encoder *encoder, tda998x_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode, struct drm_display_mode *mode,
......
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