diff mbox

cx231xx: add support for Kworld..

Message ID BANLkTimKck8GwXPNOQdu17PD1QtppfJCVg@mail.gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Márcio Alves April 11, 2011, 10:57 p.m. UTC
patch to cx231xx: add support for Kworld UB430

Comments

Jarod Wilson April 12, 2011, 4:28 p.m. UTC | #1
On Apr 11, 2011, at 6:57 PM, Márcio Alves wrote:

> patch to cx231xx: add support for Kworld UB430
> Signed-off-by: Márcio A Alves <froooozen@gmail.com>
> 
> diff -upr ../new_build2/linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h
> --- ../new_build2/linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h	2011-02-28 01:45:23.000000000 -0300
> +++ linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h	2011-04-11 14:23:31.836858001 -0300
> @@ -125,6 +125,7 @@
>  #define USB_PID_GRANDTEC_DVBT_USB_COLD			0x0fa0
>  #define USB_PID_GRANDTEC_DVBT_USB_WARM			0x0fa1
>  #define USB_PID_INTEL_CE9500				0x9500
> +#define USB_PID_KWORLD_UB430				0xe424
>  #define USB_PID_KWORLD_399U				0xe399
>  #define USB_PID_KWORLD_399U_2				0xe400
>  #define USB_PID_KWORLD_395U				0xe396

That addition does nothing, since cx231xx-*.c don't include that
header. Its only for use by drivers under dvb-usb/. Just leave
this out.

...
> diff -upr ../new_build2/linux//drivers/media/video/cx231xx/cx231xx.h linux//drivers/media/video/cx231xx/cx231xx.h
> --- ../new_build2/linux//drivers/media/video/cx231xx/cx231xx.h	2011-03-11 13:25:49.000000000 -0300
> +++ linux//drivers/media/video/cx231xx/cx231xx.h	2011-04-11 14:20:30.616858003 -0300
> @@ -64,7 +64,8 @@
>  #define CX231XX_BOARD_HAUPPAUGE_EXETER  8
>  #define CX231XX_BOARD_HAUPPAUGE_USBLIVE2 9
>  #define CX231XX_BOARD_PV_PLAYTV_USB_HYBRID 10
> -#define CX231XX_BOARD_PV_XCAPTURE_USB 11
> +#define CX231XX_BOARD_KWORLD_UB430_USB_HYBRID 11
> +#define CX231XX_BOARD_PV_XCAPTURE_USB 12
>  
>  /* Limits minimum and default number of buffers */
>  #define CX231XX_MIN_BUF                 4

You should add to the end of the list, as device 12, not move an
already existing device.

Those two minor nits aside, the patch looks sane.
diff mbox

Patch

Signed-off-by: Márcio A Alves <froooozen@gmail.com>

diff -upr ../new_build2/linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h
--- ../new_build2/linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h	2011-02-28 01:45:23.000000000 -0300
+++ linux//drivers/media/dvb/dvb-usb/dvb-usb-ids.h	2011-04-11 14:23:31.836858001 -0300
@@ -125,6 +125,7 @@ 
 #define USB_PID_GRANDTEC_DVBT_USB_COLD			0x0fa0
 #define USB_PID_GRANDTEC_DVBT_USB_WARM			0x0fa1
 #define USB_PID_INTEL_CE9500				0x9500
+#define USB_PID_KWORLD_UB430				0xe424
 #define USB_PID_KWORLD_399U				0xe399
 #define USB_PID_KWORLD_399U_2				0xe400
 #define USB_PID_KWORLD_395U				0xe396
diff -upr ../new_build2/linux//drivers/media/video/cx231xx/cx231xx-cards.c linux//drivers/media/video/cx231xx/cx231xx-cards.c
--- ../new_build2/linux//drivers/media/video/cx231xx/cx231xx-cards.c	2011-02-25 01:45:17.000000000 -0300
+++ linux//drivers/media/video/cx231xx/cx231xx-cards.c	2011-04-11 15:15:42.776857999 -0300
@@ -401,6 +401,44 @@  struct cx231xx_board cx231xx_boards[] =
 			.gpio = NULL,
 		} },
 	},
+	[CX231XX_BOARD_KWORLD_UB430_USB_HYBRID] = {
+		.name = "Kworld UB430 USB Hybrid",
+		.tuner_type = TUNER_NXP_TDA18271,
+		.tuner_addr = 0x60,
+		.decoder = CX231XX_AVDECODER,
+		.output_mode = OUT_MODE_VIP11,
+		.demod_xfer_mode = 0,
+		.ctl_pin_status_mask = 0xFFFFFFC4,
+		.agc_analog_digital_select_gpio = 0x11,	/* According with PV cxPolaris.inf file */
+		.tuner_sif_gpio = -1,
+		.tuner_scl_gpio = -1,
+		.tuner_sda_gpio = -1,
+		.gpio_pin_status_mask = 0x4001000,
+		.tuner_i2c_master = 2,
+		.demod_i2c_master = 1,
+		.ir_i2c_master = 2,
+		.has_dvb = 1,
+		.demod_addr = 0x10,
+		.norm = V4L2_STD_PAL_M,
+		.input = {{
+			.type = CX231XX_VMUX_TELEVISION,
+			.vmux = CX231XX_VIN_3_1,
+			.amux = CX231XX_AMUX_VIDEO,
+			.gpio = NULL,
+		}, {
+			.type = CX231XX_VMUX_COMPOSITE1,
+			.vmux = CX231XX_VIN_2_1,
+			.amux = CX231XX_AMUX_LINE_IN,
+			.gpio = NULL,
+		}, {
+			.type = CX231XX_VMUX_SVIDEO,
+			.vmux = CX231XX_VIN_1_1 |
+				(CX231XX_VIN_1_2 << 8) |
+				CX25840_SVIDEO_ON,
+			.amux = CX231XX_AMUX_LINE_IN,
+			.gpio = NULL,
+		} },
+	},
 	[CX231XX_BOARD_PV_PLAYTV_USB_HYBRID] = {
 		.name = "Pixelview PlayTV USB Hybrid",
 		.tuner_type = TUNER_NXP_TDA18271,
@@ -500,6 +538,8 @@  struct usb_device_id cx231xx_id_table[]
 	 .driver_info = CX231XX_BOARD_PV_PLAYTV_USB_HYBRID},
 	{USB_DEVICE(USB_VID_PIXELVIEW, 0x5014),
 	 .driver_info = CX231XX_BOARD_PV_XCAPTURE_USB},
+	{USB_DEVICE(0x1b80, 0xe424),
+	 .driver_info = CX231XX_BOARD_KWORLD_UB430_USB_HYBRID},
 	{},
 };
 
@@ -534,12 +574,13 @@  int cx231xx_tuner_callback(void *ptr, in
 		case TDA18271_CALLBACK_CMD_AGC_ENABLE:
 			if (dev->model == CX231XX_BOARD_PV_PLAYTV_USB_HYBRID)
 				rc = cx231xx_set_agc_analog_digital_mux_select(dev, arg);
+		
 			break;
 		default:
 			rc = -EINVAL;
 			break;
 		}
-	}
+	} 
 	return rc;
 }
 EXPORT_SYMBOL_GPL(cx231xx_tuner_callback);
diff -upr ../new_build2/linux//drivers/media/video/cx231xx/cx231xx-dvb.c linux//drivers/media/video/cx231xx/cx231xx-dvb.c
--- ../new_build2/linux//drivers/media/video/cx231xx/cx231xx-dvb.c	2011-01-17 01:45:24.000000000 -0300
+++ linux//drivers/media/video/cx231xx/cx231xx-dvb.c	2011-04-11 14:16:15.986858003 -0300
@@ -703,6 +703,30 @@  static int dvb_init(struct cx231xx *dev)
 			   &hcw_tda18271_config);
 		break;
 
+	case CX231XX_BOARD_KWORLD_UB430_USB_HYBRID:
+
+		printk(KERN_INFO "%s: looking for demod on i2c bus: %d\n",
+		       __func__, i2c_adapter_id(&dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap));
+
+		dev->dvb->frontend = dvb_attach(mb86a20s_attach,
+						&pv_mb86a20s_config,
+						&dev->i2c_bus[dev->board.demod_i2c_master].i2c_adap);
+
+		if (dev->dvb->frontend == NULL) {
+			printk(DRIVER_NAME
+			       ": Failed to attach mb86a20s demod\n");
+			result = -EINVAL;
+			goto out_free;
+		}
+
+		/* define general-purpose callback pointer */
+		dvb->frontend->callback = cx231xx_tuner_callback;
+
+		dvb_attach(tda18271_attach, dev->dvb->frontend,
+			   0x60, &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap,
+			   &pv_tda18271_config);
+		break;
+
 	case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID:
 
 		printk(KERN_INFO "%s: looking for demod on i2c bus: %d\n",
diff -upr ../new_build2/linux//drivers/media/video/cx231xx/cx231xx.h linux//drivers/media/video/cx231xx/cx231xx.h
--- ../new_build2/linux//drivers/media/video/cx231xx/cx231xx.h	2011-03-11 13:25:49.000000000 -0300
+++ linux//drivers/media/video/cx231xx/cx231xx.h	2011-04-11 14:20:30.616858003 -0300
@@ -64,7 +64,8 @@ 
 #define CX231XX_BOARD_HAUPPAUGE_EXETER  8
 #define CX231XX_BOARD_HAUPPAUGE_USBLIVE2 9
 #define CX231XX_BOARD_PV_PLAYTV_USB_HYBRID 10
-#define CX231XX_BOARD_PV_XCAPTURE_USB 11
+#define CX231XX_BOARD_KWORLD_UB430_USB_HYBRID 11
+#define CX231XX_BOARD_PV_XCAPTURE_USB 12
 
 /* Limits minimum and default number of buffers */
 #define CX231XX_MIN_BUF                 4