From nobody@FreeBSD.org  Sat Aug 26 23:02:55 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 38E2516A4F0
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Aug 2006 23:02:55 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7E4AF43FD6
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Aug 2006 23:02:51 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k7QN2pRZ002626
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Aug 2006 23:02:51 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k7QN2pcP002625;
	Sat, 26 Aug 2006 23:02:51 GMT
	(envelope-from nobody)
Message-Id: <200608262302.k7QN2pcP002625@www.freebsd.org>
Date: Sat, 26 Aug 2006 23:02:51 GMT
From: George <imitheos@hotmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Pixelview PlayTV Pro 2 and bktr
X-Send-Pr-Version: www-2.3

>Number:         102549
>Category:       kern
>Synopsis:       [bktr] [patch] fix Pixelview PlayTV Pro 2 on bktr
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 26 23:10:18 GMT 2006
>Closed-Date:    Thu Mar 25 15:05:53 UTC 2010
>Last-Modified:  Thu Mar 25 15:05:53 UTC 2010
>Originator:     George
>Release:        7.0-Current
>Organization:
>Environment:
FreeBSD hostname 7.0-CURRENT FreeBSD 7.0-CURRENT #4: Fri Aug 25
14:58:22 EEST 2006     root@hostname:/usr/obj/usr/src/sys/hostname amd64

>Description:
I have a Prolink Pixelview PlayTV Pro 2 card which didn't work with the bktr
driver. I made some changes to the bktr driver which i include and now it works.

If i use the normal driver then everything works fine. i can watch tv with fxtv
fine (xawtv runs but segfaults when i try to change channel)

bktr0: <BrookTree 878> mem 0xcfffe000-0xcfffefff irq 21 at device 10.0 on pci1
bktr0: [GIANT-LOCKED]
bktr0: PixelView PlayTV Pro 2 , Ymec TVision TVF-5533MF tuner.
pci1: <multimedia> at device 10.1 (no driver attached)

If i use the "new smbus" interface then the system boots fine but when i
run fxtv the system crashes.

bktr0: <BrookTree 878> mem 0xcfffe000-0xcfffefff irq 21 at device 10.0 on pci1
bktr0: [GIANT-LOCKED]
smbus0: <System Management Bus> on bktr0
smb0: <SMBus generic I/O> on smbus0
iicbb0: <I2C bit-banging driver> on bktr0
iicbus0: <Philips I2C bus> on iicbb0 master-only
ic0 on iicbus0
iicsmb0: <SMBus over I2C bridge> on iicbus0
smbus1: <System Management Bus> on iicsmb0
smb1: <SMBus generic I/O> on smbus1
bktr0: PixelView PlayTV Pro 2 .
pci1: <multimedia> at device 10.1 (no driver attached)


>How-To-Repeat:
Use the above card with the bktr driver.
>Fix:
# Inserted 2 more cards to the list
# In linux my card (Prolink PixelView PlayTV Pro 2) works with both
# definitions although they have different mux values. I don't know why
# so i added both (Maybe the bktr maintainer will know why)
# I cross-checked the "audio MUX values" from existing bktr card with
# the linux driver and copied accordingly
# First = tv, Fourth = mute, Five = always 1
# I don't know if it is right, but both definitions work fine with my
# card.


--- bktr_card.c.orig    Fri Aug 25 11:17:43 2006
+++ bktr_card.c Fri Aug 25 11:18:02 2006
@@ -415,6 +415,30 @@
           0,                                   /* EEProm size */
           { 0x01, 0x04, 0x01, 0x03, 1 },       /* audio MUX values */
           0x00ffffff },
+
+       {  CARD_PIXELVIEW_PLAYTV_PRO_2,         /* the card id */
+          "PixelView PlayTV Pro 2 ",           /* the 'name' */
+          NULL,                                /* the tuner */
+          0,                                   /* the tuner i2c address */
+          0,                                   /* dbx is optional */
+          0,
+          0,
+          0,                                   /* EEProm type */
+          0,                                   /* EEProm size */
+          { 0x00, 0x0a, 0x07, 0x0c, 1 },       /* audio MUX values */
+          0x0f },
+
+       {  CARD_PIXELVIEW_PLAYTV_MPEG2,         /* the card id */
+          "PixelView PlayTV MPEG2 ",           /* the 'name' */
+          NULL,                                /* the tuner */
+          0,                                   /* the tuner i2c address */
+          0,                                   /* dbx is optional */
+          0,
+          0,
+          0,                                   /* EEProm type */
+          0,                                   /* EEProm size */
+          { 0x21, 0x24, 0x2c, 0x29, 1 },       /* audio MUX values */
+          0x3f },
 };
 
 struct bt848_card_sig bt848_card_signature[1]= {

# Add the card definitions and increase the max card number

--- bktr_card.h.orig    Fri Aug 25 11:18:11 2006
+++ bktr_card.h Fri Aug 25 11:18:26 2006
@@ -82,7 +82,9 @@
 #define CARD_PIXELVIEW_PLAYTV_PAK      20
 #define CARD_TERRATVALUE       21
 #define        CARD_PIXELVIEW_PLAYTV_PRO_REV_4C        22
-#define Bt848_MAX_CARD         23
+#define        CARD_PIXELVIEW_PLAYTV_PRO_2     23
+#define        CARD_PIXELVIEW_PLAYTV_MPEG2     24
+#define Bt848_MAX_CARD         25
  
 #define CARD_IO_GV             CARD_IO_BCTV2
 

# Change bandLimits from char to int so that band change crosspoint can be
# added. NetBSD code has it as int also, so i guess the char->int change
# doesn't have any ill side-effects

--- bktr_reg.h.orig     Fri Aug 25 11:34:00 2006
+++ bktr_reg.h  Fri Aug 25 11:34:10 2006
@@ -401,7 +401,7 @@
        char*           name;
        u_char          type;
        u_char          pllControl[4];
-       u_char          bandLimits[ 2 ];
+       u_int           bandLimits[ 2 ];
        u_char          bandAddrs[ 4 ];        /* 3 first for the 3 TV 
                                               ** bands. Last for radio 
                                               ** band (0x00=NoRadio).

# Added band-switch crosspoints (copied from the linux driver)
# Also inserted a new tuner definition because none of the existing ones
# worked with my tuner. Practically it is the same definition with the
# Temic PAL tuner but with changed switch values. I guess TSA552x is the
# right flags because they give 8e which the tuner uses.
# It also has a radio so i added TSA552x_RADIO, but i couldn't make it
# work. I believe it has a newer chipset than the MSP one. But the
# TV part works fine.

--- bktr_tuner.c.orig   Fri Aug 25 12:34:26 2006
+++ bktr_tuner.c        Fri Aug 25 11:54:12 2006
@@ -157,7 +157,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00},                       /* band-switch crosspoints */
+          { 157, 463 },                        /* band-switch crosspoints */
           { 0x02, 0x04, 0x01, 0x00 } },        /* the band-switch values */
 
        /* TEMIC_PAL */
@@ -167,7 +167,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00},                       /* band-switch crosspoints */
+          { 140, 463 },                        /* band-switch crosspoints */
           { 0x02, 0x04, 0x01, 0x00 } },        /* the band-switch values */
 
        /* TEMIC_SECAM */
@@ -187,7 +187,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 157, 451 },                        /* band-switch crosspoints */
           { 0xa0, 0x90, 0x30, 0x00 } },        /* the band-switch values */
 
        /* PHILIPS_PAL */
@@ -197,7 +197,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 168, 447 },                        /* band-switch crosspoints */
           { 0xa0, 0x90, 0x30, 0x00 } },        /* the band-switch values */
 
        /* PHILIPS_SECAM */
@@ -207,7 +207,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 168, 447 },                        /* band-switch crosspoints */
           { 0xa7, 0x97, 0x37, 0x00 } },        /* the band-switch values */
 
        /* TEMIC_PAL I */
@@ -217,7 +217,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 170, 450 },                        /* band-switch crosspoints */
           { 0x02, 0x04, 0x01,0x00 } },         /* the band-switch values */
 
        /* PHILIPS_PALI */
@@ -227,7 +227,7 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 140, 463 },                        /* band-switch crosspoints */
           { 0xa0, 0x90, 0x30,0x00 } },         /* the band-switch values */
 
        /* PHILIPS_FR1236_NTSC */
@@ -237,7 +237,7 @@
            TSA552x_FCONTROL,
            TSA552x_FCONTROL,
            TSA552x_RADIO  },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 160, 453 },                        /* band-switch crosspoints */
          { 0xa0, 0x90, 0x30,0xa4 } },          /* the band-switch values */
 
        /* PHILIPS_FR1216_PAL */
@@ -247,7 +247,7 @@
             TSA552x_FCONTROL,
             TSA552x_FCONTROL,
             TSA552x_RADIO },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 168, 447 },                        /* band-switch crosspoints */
           { 0xa0, 0x90, 0x30, 0xa4 } },        /* the band-switch values */
 
        /* PHILIPS_FR1236_SECAM */
@@ -267,7 +267,7 @@
              TSCH5_FCONTROL,
              TSCH5_FCONTROL,
              TSCH5_RADIO },
-           { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 137, 385 },                        /* band-switch crosspoints */
            { 0x14, 0x12, 0x11, 0x04 } },        /* the band-switch values */
 
         /* ALPS TSBH1 NTSC */
@@ -277,7 +277,7 @@
              TSBH1_FCONTROL,
              TSBH1_FCONTROL,
              0x00 },
-           { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 137, 385 },                        /* band-switch crosspoints */
            { 0x01, 0x02, 0x08, 0x00 } },        /* the band-switch values */
 
        /* MT2032 Microtune */
@@ -297,8 +297,19 @@
             TSA552x_SCONTROL,
             TSA552x_SCONTROL,
             0x00 },
-          { 0x00, 0x00 },                      /* band-switch crosspoints */
+          { 170, 450 },                        /* band-switch crosspoints */
           { 0xa0, 0x90, 0x30, 0x8e } },        /* the band-switch values */
+
+        /* YMEC_TVF_5533 */
+         /* Same characteristics as many Philips and Tena */
+        { "Ymec TVision TVF-5533MF" ,          /* the 'name' */
+          TTYPE_PAL,                           /* input type */
+          { TSA552x_FCONTROL,                  /* control byte for Tuner PLL */
+            TSA552x_FCONTROL,
+            TSA552x_FCONTROL,
+            TSA552x_RADIO },
+          { 160, 454 },                        /* band-switch crosspoints */
+          { 0x01, 0x02, 0x04, 0x08 } },        /* the band-switch values */
 };
 
 
--- bktr_tuner.h.orig   Fri Aug 25 11:43:29 2006
+++ bktr_tuner.h        Fri Aug 25 11:43:51 2006
@@ -61,7 +61,8 @@
 #define ALPS_TSBH1             13
 #define TUNER_MT2032           14
 #define        LG_TPI8PSB12P_PAL       15
-#define Bt848_MAX_TUNER                16
+#define YMEC_TVF_5533          16
+#define Bt848_MAX_TUNER                17
 
 /* experimental code for Automatic Frequency Control */ 
 #define TUNER_AFC

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Thu Mar 25 15:05:52 UTC 2010 
State-Changed-Why:  
This seems like a duplicate from 105604 (or rather reversed), the one 
mentioned is more complete though and doesn't alter the bandwitch 
crosspoints and things like that, so I think this one is safer. I found 
this PR through Mark Linimon's "easy_pr's" page. Thank you for making 
FreeBSD better! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=102549 
>Unformatted:
