By Date: <-- -->
By Thread: <-- -->

Norwood PCI TV card support (non-pro) - updated patch



In message <7be2631f4e.peter (at) chocky.org>
          Peter Naulls <peter (at) chocky.org> wrote:

> 
> This is an updated version of the patch I posed last month.  It
> corrects the tuner type, and turns off audio when the device is closed.
> 
> I'm still not entirely happy with this, so haven't signed it off.  In
> particular, there's noise in the TV card's audio buffer which turns up
> the first time the device is opened after the module is loaded - maybe
> someone more familiar with its tuner can comment. There's also no way to
> detect the card, due to lack of subsystem ID. I wonder if there's data
> elsewhere on the card that can be used to identify it.

There seem to be no comments on this, and I don't have any other changes
myself.  Therefore:

- Add support for Norwood PCI TV card (non-Pro) to cx88 driver

Singed-off-by: Peter Naulls <peter (at) chocky.org>

>
> diff -r e5def6db2835 linux/drivers/media/common/ir-keymaps.c
> --- a/linux/drivers/media/common/ir-keymaps.c	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/drivers/media/common/ir-keymaps.c	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -1475,3 +1475,52  (at)  (at)  IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR
>  };
>  
>  EXPORT_SYMBOL_GPL(ir_codes_hauppauge_new);
> +
> +
> +/* Norwood Micro (non-Pro) TV Tuner 
> +   By Peter Naulls <peter (at) chocky.org> 
> +   Key comments are the functions given in the manual */
> +IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE] = {
> +	/* Keys 0 to 9 */
> +	[ 0x20 ] = KEY_0,
> +	[ 0x21 ] = KEY_1,
> +	[ 0x22 ] = KEY_2,
> +	[ 0x23 ] = KEY_3,
> +	[ 0x24 ] = KEY_4,
> +	[ 0x25 ] = KEY_5,
> +	[ 0x26 ] = KEY_6,
> +	[ 0x27 ] = KEY_7,
> +	[ 0x28 ] = KEY_8,
> +	[ 0x29 ] = KEY_9,
> +
> +	[ 0x78 ] = KEY_TUNER,             /* Video Source        */
> +	[ 0x2c ] = KEY_EXIT,              /* Open/Close software */
> +	[ 0x2a ] = KEY_SELECT,            /* 2 Digit Select      */
> +	[ 0x69 ] = KEY_AGAIN,             /* Recall              */
> +
> +	[ 0x32 ] = KEY_BRIGHTNESSUP,      /* Brightness increase */
> +	[ 0x33 ] = KEY_BRIGHTNESSDOWN,    /* Brightness decrease */
> +	[ 0x6b ] = KEY_KPPLUS,            /* (not named >>>>>)   */
> +	[ 0x6c ] = KEY_KPMINUS,           /* (not named <<<<<)   */
> +
> +	[ 0x2d ] = KEY_MUTE,              /* Mute                */ 
> +	[ 0x30 ] = KEY_VOLUMEUP,          /* Volume up           */
> +	[ 0x31 ] = KEY_VOLUMEDOWN,        /* Volume down         */
> +	[ 0x60 ] = KEY_CHANNELUP,         /* Channel up          */
> +	[ 0x61 ] = KEY_CHANNELDOWN,       /* Channel down        */
> +
> +	[ 0x3f ] = KEY_RECORD,            /* Record              */
> +	[ 0x37 ] = KEY_PLAY,              /* Play                */    
> +	[ 0x36 ] = KEY_PAUSE,             /* Pause               */
> +	[ 0x2b ] = KEY_STOP,              /* Stop                */
> +	[ 0x67 ] = KEY_FASTFORWARD,       /* Foward              */  
> +	[ 0x66 ] = KEY_REWIND,            /* Rewind              */
> +	[ 0x3e ] = KEY_SEARCH,            /* Auto Scan           */
> +	[ 0x2e ] = KEY_CAMERA,            /* Capture Video       */
> +	[ 0x6d ] = KEY_MENU,              /* Show/Hide Control   */ 
> +	[ 0x2f ] = KEY_ZOOM,              /* Full Screen         */ 
> +	[ 0x34 ] = KEY_RADIO,             /* FM                  */
> +	[ 0x65 ] = KEY_POWER,             /* Computer power      */
> +};
> +
> +EXPORT_SYMBOL_GPL(ir_codes_norwood);
> diff -r e5def6db2835 linux/drivers/media/video/cx88/cx88-cards.c
> --- a/linux/drivers/media/video/cx88/cx88-cards.c	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/drivers/media/video/cx88/cx88-cards.c	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -1159,6 +1159,27  (at)  (at)  struct cx88_board cx88_boards[] = {
>  #endif
>  		.blackbird = 1,
>  	},
> +	[CX88_BOARD_NORWOOD_MICRO] = {
> +		.name		= "Norwood Micro TV Tuner",
> +		.tuner_type     = TUNER_TNF_5335MF,
> +		.radio_type     = UNSET,
> +		.tuner_addr	= ADDR_UNSET,
> +		.radio_addr	= ADDR_UNSET,
> +		.input          = {{
> +			.type   = CX88_VMUX_TELEVISION,
> +			.vmux   = 0,
> +			.gpio0  = 0x709,
> +		},{
> +			.type   = CX88_VMUX_COMPOSITE1,
> +			.vmux   = 1,
> +			.gpio0	= 0x70b,
> +		},{
> +			.type   = CX88_VMUX_SVIDEO,
> +			.vmux   = 2,
> +			.gpio0	= 0x70b,
> +		}},
> +	},
> +
>  };
>  const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
>  
> diff -r e5def6db2835 linux/drivers/media/video/cx88/cx88-core.c
> --- a/linux/drivers/media/video/cx88/cx88-core.c	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/drivers/media/video/cx88/cx88-core.c	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -121,7 +121,7  (at)  (at)  static u32* cx88_risc_field(u32 *rp, str
>  			*(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
>  			offset+=bpl;
>  		} else {
> -			/* scanline needs to be splitted */
> +			/* scanline needs to be split */
>  			todo = bpl;
>  			*(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|
>  					    (sg_dma_len(sg)-offset));
> diff -r e5def6db2835 linux/drivers/media/video/cx88/cx88-input.c
> --- a/linux/drivers/media/video/cx88/cx88-input.c	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/drivers/media/video/cx88/cx88-input.c	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -89,7 +89,15  (at)  (at)  static void cx88_ir_handle_key(struct cx
>  		   (gpio & ir->mask_keydown) ? " down" : "",
>  		   (gpio & ir->mask_keyup) ? " up" : "");
>  
> -	if (ir->mask_keydown) {
> +	if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) {
> +                u32 gpio_key = cx_read(MO_GP0_IO);
> +
> +		data = (data << 4) | ((gpio_key & 0xf0) >> 4);
> +
> +		ir_input_keydown(ir->input, &ir->ir, data, data);
> +		ir_input_nokey(ir->input, &ir->ir);
> +
> + 	} else if (ir->mask_keydown) {
>  		/* bit set on keydown */
>  		if (gpio & ir->mask_keydown) {
>  			ir_input_keydown(ir->input, &ir->ir, data, data);
>  (at)  (at)  -229,7 +237,14  (at)  (at)  int cx88_ir_init(struct cx88_core *core,
>  		ir_type = IR_TYPE_PD;
>  		ir->sampling = 0xff00; /* address */
>  		break;
> -	}
> +	case CX88_BOARD_NORWOOD_MICRO:
> +		ir_codes         = ir_codes_norwood;
> +		ir->gpio_addr    = MO_GP1_IO;
> +		ir->mask_keycode = 0x0e;
> +		ir->mask_keyup   = 0x80;
> +		ir->polling      = 50; /* ms */
> +		break;
> +        }
>  
>  	if (NULL == ir_codes) {
>  		kfree(ir);
> diff -r e5def6db2835 linux/drivers/media/video/cx88/cx88-video.c
> --- a/linux/drivers/media/video/cx88/cx88-video.c	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/drivers/media/video/cx88/cx88-video.c	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -1127,6 +1127,12  (at)  (at)  static int video_release(struct inode *i
>  
>  	cx88_call_i2c_clients (dev->core, TUNER_SET_STANDBY, NULL);
>  
> +	/* Shut off audio */
> +	if (dev->core->board == CX88_BOARD_NORWOOD_MICRO) {
> +		struct cx88_core *core = dev->core;
> +		cx_clear(MO_GP0_IO, 0x0001);
> +	}
> +
>  	return 0;
>  }
>  
>  (at)  (at)  -2243,6 +2249,12  (at)  (at)  static int __devinit cx8800_initdev(stru
>  	video_mux(core,0);
>  	mutex_unlock(&core->lock);
>  
> +	/* Prevent audio output until the device is opened */
> +	if (core->board == CX88_BOARD_NORWOOD_MICRO) {
> +		struct cx88_core *core = dev->core;
> +		cx_clear(MO_GP0_IO, 0x0001);
> +	}
> +
>  	/* start tvaudio thread */
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
>  	if (core->tuner_type != TUNER_ABSENT)
> diff -r e5def6db2835 linux/drivers/media/video/cx88/cx88.h
> --- a/linux/drivers/media/video/cx88/cx88.h	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/drivers/media/video/cx88/cx88.h	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -1,4 +1,5  (at)  (at) 
>  /*
> + * $Id: cx88.h,v 1.99 2006/01/29 20:28:54 mkrufky Exp $
>   *
>   * v4l2 device driver for cx2388x based TV cards
>   *
>  (at)  (at)  -199,6 +200,7  (at)  (at)  extern struct sram_channel cx88_sram_cha
>  #define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID 46
>  #define CX88_BOARD_PCHDTV_HD5500           47
>  #define CX88_BOARD_KWORLD_MCE200_DELUXE    48
> +#define CX88_BOARD_NORWOOD_MICRO           49
>  
>  enum cx88_itype {
>  	CX88_VMUX_COMPOSITE1 = 1,
> diff -r e5def6db2835 linux/include/media/ir-common.h
> --- a/linux/include/media/ir-common.h	Fri Apr 28 10:14:45 2006 -0300
> +++ b/linux/include/media/ir-common.h	Sat Apr 29 16:00:23 2006 -0700
>  (at)  (at)  -89,6 +89,7  (at)  (at)  extern IR_KEYTAB_TYPE ir_codes_winfast[I
>  extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
>  extern IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE];
>  extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE];
> +extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE];
>  
>  #endif
>  
> 
> 
> 

-- 
Peter Naulls - peter (at) chocky.org        | http://www.chocky.org/
----------------------------------------------------------------------------
RISC OS Community Wiki - add your own content   | http://www.riscos.info/

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list