]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: add support for dvo Chrontel 7010B
authorbraggle@free.fr <braggle@free.fr>
Thu, 16 May 2013 10:57:38 +0000 (12:57 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 20 May 2013 20:02:49 +0000 (22:02 +0200)
This patch add dvo detection for the Chrontel 7010B on some old hardware.

References: https://bugzilla.kernel.org/show_bug.cgi?id=55101
Signed-off-by: Braggle <braggle at free.fr>
[danvet: Fix up whitespace mangling.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/dvo_ch7xxx.c
drivers/gpu/drm/i915/intel_dvo.c

index 3edd981e077013f780cc8d637b9a5ba60b0f2aa6..757e0fa110430b3eab1d2654b453e5f8f1260060 100644 (file)
@@ -32,12 +32,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define CH7xxx_REG_DID         0x4b
 
 #define CH7011_VID             0x83 /* 7010 as well */
+#define CH7010B_VID            0x05
 #define CH7009A_VID            0x84
 #define CH7009B_VID            0x85
 #define CH7301_VID             0x95
 
 #define CH7xxx_VID             0x84
 #define CH7xxx_DID             0x17
+#define CH7010_DID             0x16
 
 #define CH7xxx_NUM_REGS                0x4c
 
@@ -87,11 +89,20 @@ static struct ch7xxx_id_struct {
        char *name;
 } ch7xxx_ids[] = {
        { CH7011_VID, "CH7011" },
+       { CH7010B_VID, "CH7010B" },
        { CH7009A_VID, "CH7009A" },
        { CH7009B_VID, "CH7009B" },
        { CH7301_VID, "CH7301" },
 };
 
+static struct ch7xxx_did_struct {
+       uint8_t did;
+       char *name;
+} ch7xxx_dids[] = {
+       { CH7xxx_DID, "CH7XXX" },
+       { CH7010_DID, "CH7010B" },
+};
+
 struct ch7xxx_priv {
        bool quiet;
 };
@@ -108,6 +119,18 @@ static char *ch7xxx_get_id(uint8_t vid)
        return NULL;
 }
 
+static char *ch7xxx_get_did(uint8_t did)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(ch7xxx_dids); i++) {
+               if (ch7xxx_dids[i].did == did)
+                       return ch7xxx_dids[i].name;
+       }
+
+       return NULL;
+}
+
 /** Reads an 8 bit register */
 static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
 {
@@ -179,7 +202,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo,
        /* this will detect the CH7xxx chip on the specified i2c bus */
        struct ch7xxx_priv *ch7xxx;
        uint8_t vendor, device;
-       char *name;
+       char *name, *devid;
 
        ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL);
        if (ch7xxx == NULL)
@@ -204,7 +227,8 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo,
        if (!ch7xxx_readb(dvo, CH7xxx_REG_DID, &device))
                goto out;
 
-       if (device != CH7xxx_DID) {
+       devid = ch7xxx_get_did(device);
+       if (!devid) {
                DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s "
                                "slave %d.\n",
                          vendor, adapter->name, dvo->slave_addr);
index 00e70dbe82da017fbfdf643d62df2c14bfbbe3a5..ee328ce8e9fe8c49b4c5e7b5dd101b713aa6e72c 100644 (file)
@@ -53,6 +53,13 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
                .slave_addr = CH7xxx_ADDR,
                .dev_ops = &ch7xxx_ops,
        },
+       {
+               .type = INTEL_DVO_CHIP_TMDS,
+               .name = "ch7xxx",
+               .dvo_reg = DVOC,
+               .slave_addr = 0x75, /* For some ch7010 */
+               .dev_ops = &ch7xxx_ops,
+       },
        {
                .type = INTEL_DVO_CHIP_LVDS,
                .name = "ivch",