drm/i2c: tda998x: prepare for video input configuration
authorRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 14 Aug 2013 19:43:29 +0000 (21:43 +0200)
committerDave Airlie <airlied@redhat.com>
Sun, 18 Aug 2013 23:10:19 +0000 (09:10 +1000)
The video-input-port (VIP) is highly configurable. This prepares
current driver to allow to configure VIP configuration, as some
boards connect lcd controller and TDA998x "pin-swapped" and depend
on VIP to swap the pins by register configuration.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Darren Etheridge <detheridge@ti.com>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Tested-by: Russell King <rmk_kernel@arm.linux.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/i2c/tda998x_drv.c

index a701411fcc0d45229dee3cf930ae148202eb0d15..527d11b5ff142902ad97d504455f79cc228b572e 100644 (file)
@@ -32,6 +32,9 @@ struct tda998x_priv {
        uint16_t rev;
        uint8_t current_page;
        int dpms;
+       u8 vip_cntrl_0;
+       u8 vip_cntrl_1;
+       u8 vip_cntrl_2;
 };
 
 #define to_tda998x_priv(x)  ((struct tda998x_priv *)to_encoder_slave(x)->slave_priv)
@@ -448,12 +451,9 @@ tda998x_encoder_dpms(struct drm_encoder *encoder, int mode)
                reg_write(encoder, REG_ENA_VP_1, 0xff);
                reg_write(encoder, REG_ENA_VP_2, 0xff);
                /* set muxing after enabling ports: */
-               reg_write(encoder, REG_VIP_CNTRL_0,
-                               VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3));
-               reg_write(encoder, REG_VIP_CNTRL_1,
-                               VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1));
-               reg_write(encoder, REG_VIP_CNTRL_2,
-                               VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5));
+               reg_write(encoder, REG_VIP_CNTRL_0, priv->vip_cntrl_0);
+               reg_write(encoder, REG_VIP_CNTRL_1, priv->vip_cntrl_1);
+               reg_write(encoder, REG_VIP_CNTRL_2, priv->vip_cntrl_2);
                break;
        case DRM_MODE_DPMS_OFF:
                /* disable audio and video ports */
@@ -823,6 +823,10 @@ tda998x_encoder_init(struct i2c_client *client,
        if (!priv)
                return -ENOMEM;
 
+       priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3);
+       priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1);
+       priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5);
+
        priv->current_page = 0;
        priv->cec = i2c_new_dummy(client->adapter, 0x34);
        priv->dpms = DRM_MODE_DPMS_OFF;