Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a3485be authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb:
  V4L/DVB (5939): dvb-pll: make struct dvb_pll_fcv1236d static
  V4L/DVB (5933): Dvb-usb/af9005-fe.c: error check fixes
  V4L/DVB (5932): Af9005 fix tuner module unload
  V4L/DVB (5920): ivtv: fix incorrect fw size report.
  V4L/DVB (5918): ivtv: fix TV-out VBI handling, only reset on last close.
  V4L/DVB (5917): ivtv: improve mailbox responsiveness.
  V4L/DVB (5916): ivtv: fix pause/continue/play handling
  V4L/DVB (5900): usbvision: fix bugs [sg]_register functions
  V4L/DVB (5899): bttv: Fix Viewcast Osprey 440 support
  V4L/DVB (5893): DVB: fix includes of video.h when __KERNEL__ is undefined
  V4L/DVB (5891): zr36067: Turn off raw capture properly
  V4L/DVB (5890): zr36067: Add UYVY, RGB555X, RGB565X, and RGB32 formats
  V4L/DVB (5888): zr36067: Driver was not returning correct image size
  V4L/DVB (5887): zr36067: Fix poll() operation
  V4L/DVB (5886): zr36067: Fix problem setting norms
parents 80ba80a9 0a0f2c87
Loading
Loading
Loading
Loading
+16 −31
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@

struct af9005_fe_state {
	struct dvb_usb_device *d;
	struct dvb_frontend *tuner;

	fe_status_t stat;

	/* retraining parameters */
@@ -345,7 +343,7 @@ static int af9005_reset_pre_viterbi(struct dvb_frontend *fe)
				       1 & 0xff);
	if (ret)
		return ret;
	af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8,
	ret = af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8,
					 1 >> 8);
	if (ret)
		return ret;
@@ -447,7 +445,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat)
	u8 temp;
	int ret;

	if (state->tuner == NULL)
	if (fe->ops.tuner_ops.release == NULL)
		return -ENODEV;

	*stat = 0;
@@ -493,7 +491,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat)
static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber)
{
	struct af9005_fe_state *state = fe->demodulator_priv;
	if (state->tuner == NULL)
	if (fe->ops.tuner_ops.release  == NULL)
		return -ENODEV;
	af9005_fe_refresh_state(fe);
	*ber = state->ber;
@@ -503,7 +501,7 @@ static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber)
static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc)
{
	struct af9005_fe_state *state = fe->demodulator_priv;
	if (state->tuner == NULL)
	if (fe->ops.tuner_ops.release == NULL)
		return -ENODEV;
	af9005_fe_refresh_state(fe);
	*unc = state->unc;
@@ -517,7 +515,7 @@ static int af9005_fe_read_signal_strength(struct dvb_frontend *fe,
	int ret;
	u8 if_gain, rf_gain;

	if (state->tuner == NULL)
	if (fe->ops.tuner_ops.release == NULL)
		return -ENODEV;
	ret =
	    af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain,
@@ -881,10 +879,8 @@ static int af9005_fe_init(struct dvb_frontend *fe)
	     af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst,
					reg_ofdm_rst_pos, reg_ofdm_rst_len, 1)))
		return ret;
	if ((ret =
	     af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst,
					reg_ofdm_rst_pos, reg_ofdm_rst_len, 0)))
		return ret;
	ret = af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst,
					 reg_ofdm_rst_pos, reg_ofdm_rst_len, 0);

	if (ret)
		return ret;
@@ -1041,7 +1037,7 @@ static int af9005_fe_init(struct dvb_frontend *fe)
		return ret;

	/* attach tuner and init */
	if (state->tuner == NULL) {
	if (fe->ops.tuner_ops.release == NULL) {
		/* read tuner and board id from eeprom */
		ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2);
		if (ret) {
@@ -1058,20 +1054,16 @@ static int af9005_fe_init(struct dvb_frontend *fe)
				return ret;
			}
			if1 = (u16) (buf[0] << 8) + buf[1];
			state->tuner =
			    dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap,
				       &af9005_mt2060_config, if1);
			if (state->tuner == NULL) {
			if (dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap,
					 &af9005_mt2060_config, if1) == NULL) {
				deb_info("MT2060 attach failed\n");
				return -ENODEV;
			}
			break;
		case 3:	/* QT1010 */
		case 9:	/* QT1010B */
			state->tuner =
			    dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap,
				       &af9005_qt1010_config);
			if (state->tuner == NULL) {
			if (dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap,
					&af9005_qt1010_config) ==NULL) {
				deb_info("QT1010 attach failed\n");
				return -ENODEV;
			}
@@ -1080,7 +1072,7 @@ static int af9005_fe_init(struct dvb_frontend *fe)
			err("Unsupported tuner type %d", buf[0]);
			return -ENODEV;
		}
		ret = state->tuner->ops.tuner_ops.init(state->tuner);
		ret = fe->ops.tuner_ops.init(fe);
		if (ret)
			return ret;
	}
@@ -1118,7 +1110,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe,

	deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency,
		 fep->u.ofdm.bandwidth);
	if (state->tuner == NULL) {
	if (fe->ops.tuner_ops.release == NULL) {
		err("Tuner not attached");
		return -ENODEV;
	}
@@ -1199,7 +1191,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe,
		return ret;
	/* set tuner */
	deb_info("set tuner\n");
	ret = state->tuner->ops.tuner_ops.set_params(state->tuner, fep);
	ret = fe->ops.tuner_ops.set_params(fe, fep);
	if (ret)
		return ret;

@@ -1435,12 +1427,6 @@ static void af9005_fe_release(struct dvb_frontend *fe)
{
	struct af9005_fe_state *state =
	    (struct af9005_fe_state *)fe->demodulator_priv;
	if (state->tuner != NULL && state->tuner->ops.tuner_ops.release != NULL) {
		state->tuner->ops.tuner_ops.release(state->tuner);
#ifdef CONFIG_DVB_CORE_ATTACH
		symbol_put_addr(state->tuner->ops.tuner_ops.release);
#endif
	}
	kfree(state);
}

@@ -1458,7 +1444,6 @@ struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d)
	deb_info("attaching frontend af9005\n");

	state->d = d;
	state->tuner = NULL;
	state->opened = 0;

	memcpy(&state->frontend.ops, &af9005_fe_ops,
+1 −1
Original line number Diff line number Diff line
@@ -501,7 +501,7 @@ static struct dvb_pll_desc dvb_pll_opera1 = {

/* Philips FCV1236D
 */
struct dvb_pll_desc dvb_pll_fcv1236d = {
static struct dvb_pll_desc dvb_pll_fcv1236d = {
/* Bit_0: RF Input select
 * Bit_1: 0=digital, 1=analog
 */
+134 −104
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include <linux/firmware.h>
#include <net/checksum.h>

#include <asm/io.h>

@@ -45,7 +46,7 @@ static void boot_msp34xx(struct bttv *btv, int pin);
static void boot_bt832(struct bttv *btv);
static void hauppauge_eeprom(struct bttv *btv);
static void avermedia_eeprom(struct bttv *btv);
static void osprey_eeprom(struct bttv *btv);
static void osprey_eeprom(struct bttv *btv, const u8 ee[256]);
static void modtec_eeprom(struct bttv *btv);
static void init_PXC200(struct bttv *btv);
static void init_RTV24(struct bttv *btv);
@@ -2843,13 +2844,28 @@ struct tvcard bttv_tvcards[] = {
		.has_remote     = 1,
	},
		/* ---- card 0x8c ---------------------------------- */
	/* Has four Bt878 chips behind a PCI bridge, each chip has:
	     one external BNC composite input (mux 2)
	     three internal composite inputs (unknown muxes)
	     an 18-bit stereo A/D (CS5331A), which has:
	       one external stereo unblanced (RCA) audio connection
	       one (or 3?) internal stereo balanced (XLR) audio connection
	       input is selected via gpio to a 14052B mux
		 (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300)
	       gain is controlled via an X9221A chip on the I2C bus @0x28
	       sample rate is controlled via gpio to an MK1413S
		 (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3)
	     There is neither a tuner nor an svideo input. */
	[BTTV_BOARD_OSPREY440]  = {
		.name           = "Osprey 440",
		.video_inputs   = 1,
		.audio_inputs   = 1,
		.video_inputs   = 4,
		.audio_inputs   = 2, /* this is meaningless */
		.tuner          = UNSET,
		.svhs           = 1,
		.muxsel         = { 2 },
		.svhs           = UNSET,
		.muxsel         = { 2, 3, 0, 1 }, /* 3,0,1 are guesses */
		.gpiomask	= 0x303,
		.gpiomute	= 0x000, /* int + 32kHz */
		.gpiomux	= { 0, 0, 0x000, 0x100},
		.pll            = PLL_28,
		.tuner_type     = UNSET,
		.tuner_addr     = ADDR_UNSET,
@@ -3453,11 +3469,12 @@ void __devinit bttv_init_card2(struct bttv *btv)
	case BTTV_BOARD_OSPREY2xx:
	case BTTV_BOARD_OSPREY2x0_SVID:
	case BTTV_BOARD_OSPREY2x0:
	case BTTV_BOARD_OSPREY440:
	case BTTV_BOARD_OSPREY500:
	case BTTV_BOARD_OSPREY540:
	case BTTV_BOARD_OSPREY2000:
		bttv_readee(btv,eeprom_data,0xa0);
		osprey_eeprom(btv);
		osprey_eeprom(btv, eeprom_data);
		break;
	case BTTV_BOARD_IDS_EAGLE:
		init_ids_eagle(btv);
@@ -3748,106 +3765,119 @@ static int __devinit pvr_boot(struct bttv *btv)
/* ----------------------------------------------------------------------- */
/* some osprey specific stuff                                              */

static void __devinit osprey_eeprom(struct bttv *btv)
static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
{
       int i = 0;
       unsigned char *ee = eeprom_data;
       unsigned long serial = 0;
	int i;
	u32 serial = 0;
	int cardid = -1;

       if (btv->c.type == 0) {
	/* This code will nevery actually get called in this case.... */
	if (btv->c.type == BTTV_BOARD_UNKNOWN) {
		/* this might be an antique... check for MMAC label in eeprom */
	       if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
		       unsigned char checksum = 0;
		if (!strncmp(ee, "MMAC", 4)) {
			u8 checksum = 0;
			for (i = 0; i < 21; i++)
				checksum += ee[i];
			if (checksum != ee[21])
				return;
		       btv->c.type = BTTV_BOARD_OSPREY1x0_848;
			cardid = BTTV_BOARD_OSPREY1x0_848;
			for (i = 12; i < 21; i++)
				serial *= 10, serial += ee[i] - '0';
		}
       } else {
		unsigned short type;
	       int offset = 4*16;

	       for (; offset < 8*16; offset += 16) {
		       unsigned short checksum = 0;
		       /* verify the checksum */
		       for (i = 0; i < 14; i++)
				checksum += ee[i+offset];
			checksum = ~checksum;  /* no idea why */
			if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
				   ((checksum & 0x0FF) == ee[offset+15])) {

		for (i = 4*16; i < 8*16; i += 16) {
			u16 checksum = ip_compute_csum(ee + i, 16);

			if ((checksum&0xff) + (checksum>>8) == 0xff)
				break;
		}
	       }

	       if (offset >= 8*16)
		if (i >= 8*16)
			return;
		ee += i;

		/* found a valid descriptor */
	       type = (ee[offset+4]<<8) | (ee[offset+5]);
		type = be16_to_cpup((u16*)(ee+4));

		switch(type) {
		/* 848 based */
		case 0x0004:
		       btv->c.type = BTTV_BOARD_OSPREY1x0_848;
			cardid = BTTV_BOARD_OSPREY1x0_848;
			break;
		case 0x0005:
		       btv->c.type = BTTV_BOARD_OSPREY101_848;
			cardid = BTTV_BOARD_OSPREY101_848;
			break;

		/* 878 based */
		case 0x0012:
		case 0x0013:
		       btv->c.type = BTTV_BOARD_OSPREY1x0;
			cardid = BTTV_BOARD_OSPREY1x0;
			break;
		case 0x0014:
		case 0x0015:
		       btv->c.type = BTTV_BOARD_OSPREY1x1;
			cardid = BTTV_BOARD_OSPREY1x1;
			break;
		case 0x0016:
		case 0x0017:
		case 0x0020:
		       btv->c.type = BTTV_BOARD_OSPREY1x1_SVID;
			cardid = BTTV_BOARD_OSPREY1x1_SVID;
			break;
		case 0x0018:
		case 0x0019:
		case 0x001E:
		case 0x001F:
		       btv->c.type = BTTV_BOARD_OSPREY2xx;
			cardid = BTTV_BOARD_OSPREY2xx;
			break;
		case 0x001A:
		case 0x001B:
		       btv->c.type = BTTV_BOARD_OSPREY2x0_SVID;
			cardid = BTTV_BOARD_OSPREY2x0_SVID;
			break;
		case 0x0040:
		       btv->c.type = BTTV_BOARD_OSPREY500;
			cardid = BTTV_BOARD_OSPREY500;
			break;
		case 0x0050:
		case 0x0056:
		       btv->c.type = BTTV_BOARD_OSPREY540;
			cardid = BTTV_BOARD_OSPREY540;
			/* bttv_osprey_540_init(btv); */
			break;
		case 0x0060:
		case 0x0070:
		case 0x00A0:
		       btv->c.type = BTTV_BOARD_OSPREY2x0;
			cardid = BTTV_BOARD_OSPREY2x0;
			/* enable output on select control lines */
			gpio_inout(0xffffff,0x000303);
			break;
		case 0x00D8:
			cardid = BTTV_BOARD_OSPREY440;
			break;
		default:
			/* unknown...leave generic, but get serial # */
			printk(KERN_INFO "bttv%d: "
			       "osprey eeprom: unknown card type 0x%04x\n",
			       btv->c.nr, type);
			break;
		}
	       serial =  (ee[offset+6] << 24)
		       | (ee[offset+7] << 16)
		       | (ee[offset+8] <<  8)
		       | (ee[offset+9]);
		serial = be32_to_cpup((u32*)(ee+6));
	}

       printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
	      btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
	printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
	       btv->c.nr, cardid,
	       cardid>0 ? bttv_tvcards[cardid].name : "Unknown", serial);

	if (cardid<0 || btv->c.type == cardid)
		return;

	/* card type isn't set correctly */
	if (card[btv->c.nr] < bttv_num_tvcards) {
		printk(KERN_WARNING "bttv%d: osprey eeprom: "
		       "Not overriding user specified card type\n", btv->c.nr);
	} else {
		printk(KERN_INFO "bttv%d: osprey eeprom: "
		       "Changing card type from %d to %d\n", btv->c.nr,
		       btv->c.type, cardid);
		btv->c.type = cardid;
	}
}

/* ----------------------------------------------------------------------- */
+1 −0
Original line number Diff line number Diff line
@@ -417,6 +417,7 @@ struct ivtv_mailbox_data {
#define IVTV_F_I_WORK_HANDLER_YUV  17	/* there is work to be done for YUV */
#define IVTV_F_I_WORK_HANDLER_PIO  18	/* there is work to be done for PIO */
#define IVTV_F_I_PIO		   19	/* PIO in progress */
#define IVTV_F_I_DEC_PAUSED	   20 	/* the decoder is paused */

/* Event notifications */
#define IVTV_F_I_EV_DEC_STOPPED	   28	/* decoder stopped event */
+10 −0
Original line number Diff line number Diff line
@@ -757,6 +757,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
	    itv->output_mode = OUT_NONE;

	itv->speed = 0;
	clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
	ivtv_release_stream(s);
}

@@ -799,7 +800,16 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
		ivtv_unmute(itv);
		ivtv_release_stream(s);
	} else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) {
		struct ivtv_stream *s_vout = &itv->streams[IVTV_DEC_STREAM_TYPE_VOUT];

		ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0);

		/* If all output streams are closed, and if the user doesn't have
		   IVTV_DEC_STREAM_TYPE_VOUT open, then disable VBI on TV-out. */
		if (itv->output_mode == OUT_NONE && !test_bit(IVTV_F_S_APPL_IO, &s_vout->s_flags)) {
			/* disable VBI on TV-out */
			ivtv_disable_vbi(itv);
		}
	} else {
		ivtv_stop_capture(id, 0);
	}
Loading