Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2004 01:47:20 -0500 (EST)
From:      John Wehle <john@feith.com>
To:        stacy@Millions.Ca
Cc:        mike@sentex.net
Subject:   Re: Hauppauge PVR-[23]50 driver
Message-ID:  <200401220647.i0M6lKW17352@jwlab.FEITH.COM>

next in thread | raw e-mail | index | archive | help
> So, I'm back to the freebsd driver. A quick hack job to make it
> recognise the tuner (wild ass guess as to the type) and it bombs
> on unknown audio decoder

Patches for these two problems are included below.

> (BTW, both of these errors cause a panic ... not nice).

They shouldn't cause a panic on a properly configured FreeBSD 4.9
machine.  What was the panic and the traceback?

> the driver hangs after a while, a while being => 30 minutes.

What does dmesg display on boot up?  What does your hardware look
like (motherboard, additional cards, memory, etc)?

> cxm0: missing encoder EOS

Sounds like an interrupt got lost.

> The linux ivtv driver has problems with some Hauppauge cards and dma

Details please.

> and it looks like the FreeBSD driver has inherited them.

None appeared during FreeBSD driver development (though I only
have the one card).

> At this point, I'm open to suggestions. I'm debating between
> starting to debug the driver or porting it to CURRENT. I would
> rather have this driver working on CURRENT, since I have made
> my desktop (where I have the card) boot CURRENT by default but

The driver (with limited testing) appears to:

  1) Work correctly on my machine with FreeBSD 4.9 using the
     PVR-250 version 1 card.

  2) Work correctly on FreeBSD 4.9 using a PVR-350.  Mike Tancsa
     <mike@sentex.net> worked with me to get this supported.
     Mike's machine did initially experience a hang which was
     resolved by rearranging the boards.

  3) Work incorrectly on FreeBSD 4.9 using a PVR-250 version 2 card.
     The problem is the video and audio are out of sync.  It appears
     to be due to the scaler in the video decoder dropping fields.
     Brian Skrab <brian@quynh-and-brian.org> is working with me
     to resolve this issue.

  4) Work incorrectly on FreeBSD 5.2 using a PVR-250 version 2 card.
     Same problem as # 3.  Erik Moe <emoe@cox.net> did the port and
     is working with me to resolve the video / audio sync issue.

Based on Mike Tancsa's experience I'd expect the driver to work for
your PVR-350 on FreeBSD 4.9.  I'm happy to try and help determine
why you're seeing a hang.  I'd suggest not bother with porting the
driver to FreeBSD 5.2 yourself since it'll just be duplicating
effort ... though you might team up with Erik Moe if using FreeBSD
5.2 is important.  I do plan to fold Erik's changes back into my
source tree once the 5.2 port is stable.

-- John
----------------------8<--------------------------------8<----------------
*** dev/cxm/cxm_eeprom.c.ORIGINAL	Thu Jan 22 01:35:18 2004
--- dev/cxm/cxm_eeprom.c	Fri Jan 16 01:08:07 2004
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003
   *	John Wehle <john@feith.com>.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004
   *	John Wehle <john@feith.com>.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
*************** int
*** 116,121 ****
--- 116,123 ----
  cxm_eeprom_tuner_type( struct cxm_softc *sc )
  {
  	unsigned char eeprom[256];
+ 	unsigned int i;
+ 	unsigned int len;
  	unsigned int subsystem_vendor_id;
  	unsigned int tuner_code;
  	int tuner_type;
*************** cxm_eeprom_tuner_type( struct cxm_softc 
*** 129,141 ****
  
  	switch (subsystem_vendor_id) {
  	case CXM_VENDORID_HAUPPAUGE:
  		if (eeprom[0] != 0x84) {
  			printf("%s: unknown Hauppauge eeprom format %#x\n",
  			       sc->name, (unsigned int)eeprom[0]);
  			break;
  		}
  
! 		tuner_code = eeprom[9];
  
  		switch (tuner_code) {
  		case 0x03: /* Philips FI1216 */
--- 131,189 ----
  
  	switch (subsystem_vendor_id) {
  	case CXM_VENDORID_HAUPPAUGE:
+ 
+ 		/*
+ 		 * The Hauppauge eeprom format is tagged.
+ 		 */
+ 
  		if (eeprom[0] != 0x84) {
  			printf("%s: unknown Hauppauge eeprom format %#x\n",
  			       sc->name, (unsigned int)eeprom[0]);
  			break;
  		}
  
! 		tuner_code = -1;
! 
! 		for (i = 0; i < sizeof(eeprom); i += len) {
! 			len = 0;
! 			if (eeprom[i] == 0x84) {
! 				len = (unsigned int)eeprom[i + 2] << 8
! 				      | eeprom[i + 1];
! 				i += 3;
! 			}
! 			else if ((eeprom[i] & 0xf0) == 0x70) {
! 				if (eeprom[i] & 0x08)
! 					break;
! 				len = eeprom[i] & 0x07;
! 				i++;
! 			}
! 			else {
! 				printf(
! 				  "%s: unknown Hauppauge eeprom packet %#x\n",
! 				       sc->name, (unsigned int)eeprom[i]);
! 				return -1;
! 			}
! 
! 			if (i >= sizeof(eeprom)
! 			    || (i + len) > sizeof(eeprom)) {
! 				printf("%s: corrupt Hauppauge eeprom packet\n",
! 				       sc->name);
! 				return -1;
! 			}
! 
! 			switch (eeprom[i]) {
! 			case 0x00:
! 				tuner_code = eeprom[i + 6];
! 				break;
! 
! 			case 0x0a:
! 				tuner_code = eeprom[i + 2];
! 				break;
! 
! 			default:
! 				break;
! 			}
! 		}
  
  		switch (tuner_code) {
  		case 0x03: /* Philips FI1216 */
*** dev/cxm/cxm_audio.c.ORIGINAL	Thu Jan 22 01:35:31 2004
--- dev/cxm/cxm_audio.c	Fri Jan 16 01:08:26 2004
***************
*** 1,5 ****
  /*
!  * Copyright (c) 2003
   *	John Wehle <john@feith.com>.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /*
!  * Copyright (c) 2003, 2004
   *	John Wehle <john@feith.com>.  All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
*************** cxm_msp_init( struct cxm_softc *sc )
*** 275,292 ****
  			     0x001f, rev2, sizeof(rev2)) != sizeof(rev2))
  		return -1;
  
! 	snprintf(sc->msp_name, sizeof(sc->msp_name), "34%02d%c-%c%d",
! 		 rev2[0], rev1[1] + '@', rev1[0] + '@', rev2[1] & 0x1f);
! 
! 	if (sc->msp_name[2] != '3' || sc->msp_name[4] != 'G') {
  		printf("%s: unknown audio decoder MSP%s\n",
  		       sc->name, sc->msp_name);
  		return -1;
  	}
  
- 	nsettings = msp343xG_init.nsettings;
- 	settings = msp343xG_init.settings;
- 
  	for (i = 0; i < nsettings; i++)
  		if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400,
  				      settings[i].dev, settings[i].addr,
--- 275,305 ----
  			     0x001f, rev2, sizeof(rev2)) != sizeof(rev2))
  		return -1;
  
! 	snprintf(sc->msp_name, sizeof(sc->msp_name), "%c4%02d%c-%c%d",
! 		 ((rev1[1] >> 4) & 0x0f) + '3', rev2[0],
! 		 (rev1[1] & 0x0f) + '@', rev1[0] + '@', rev2[1] & 0x1f);
! 
! 	/*
! 	 * MSP 34x5G and MSP 44x8G are the only
! 	 * audio decoders currently supported.
! 	 */
! 
! 	if (strncmp(&sc->msp_name[0], "34", 2) == 0
! 	    && strncmp(&sc->msp_name[3], "5G", 2) == 0) {
! 		nsettings = msp343xG_init.nsettings;
! 		settings = msp343xG_init.settings;
! 	  }
! 	else if (strncmp(&sc->msp_name[0], "44", 2) == 0
! 		 && strncmp(&sc->msp_name[3], "8G", 2) == 0) {
! 		nsettings = msp343xG_init.nsettings;
! 		settings = msp343xG_init.settings;
! 	  }
! 	else {
  		printf("%s: unknown audio decoder MSP%s\n",
  		       sc->name, sc->msp_name);
  		return -1;
  	}
  
  	for (i = 0; i < nsettings; i++)
  		if (cxm_msp_dpl_write(sc->iicbus, CXM_I2C_MSP3400,
  				      settings[i].dev, settings[i].addr,
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401220647.i0M6lKW17352>