[GIT PULL FOR v3.9] the rest for TeVii s421, s632 DVB cards and Montage ds3000, rs2000 demods

2012-12-28 Thread Igor M. Liplianin
The following changes since commit c19bec500168108bf28710fae304523679ffb40f:

  [media] vivi: Constify structures (2012-12-28 13:32:51 -0200)

are available in the git repository at:

  git://git.linuxtv.org/liplianin/media_tree.git ts2020_1_v3.9

for you to fetch changes up to 3a36fae7540e031a811e6c28cd37c7db4baf142b:

  m88rs2000: make use ts2020 (2012-12-29 01:40:33 +0300)


Igor M. Liplianin (4):
  Tevii S421 and S632 support, Kconfig part
  m88rs2000: SNR, BER implemented
  ds3000: lock led procedure added
  m88rs2000: make use ts2020

 drivers/media/dvb-frontends/ds3000.c|  12 +
 drivers/media/dvb-frontends/ds3000.h|   2 +
 drivers/media/dvb-frontends/m88rs2000.c | 412 
-
 drivers/media/dvb-frontends/m88rs2000.h |   6 ---
 drivers/media/dvb-frontends/ts2020.c| 381 
+-
 drivers/media/dvb-frontends/ts2020.h|   1 +
 drivers/media/pci/cx23885/cx23885-dvb.c |   1 +
 drivers/media/pci/cx88/cx88-dvb.c   |   1 +
 drivers/media/pci/dm1105/dm1105.c   |   1 +
 drivers/media/usb/dvb-usb-v2/Kconfig|   1 +
 drivers/media/usb/dvb-usb-v2/lmedm04.c  |   9 +++-
 drivers/media/usb/dvb-usb/Kconfig   |   1 +
 drivers/media/usb/dvb-usb/dw2102.c  |  56 
 13 files changed, 395 insertions(+), 489 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Re: [GIT PULL FOR v3.9] separate Montage ts2020 from ds3000 and rs2000, support for new TeVii cards

2012-12-28 Thread Igor M. Liplianin
On 27 декабря 2012 19:33:38 Mauro Carvalho Chehab wrote:
> Hi Igor,
Hi Mauro,

> 
> Em Mon, 24 Dec 2012 11:23:56 +0300
> 
> "Igor M. Liplianin"  escreveu:
> > The following changes since commit 8b2aea7878f64814544d0527c659011949d52358:
> >   [media] em28xx: prefer bulk mode on webcams (2012-12-23 17:24:30 -0200)
> > 
> > are available in the git repository at:
> >   git://git.linuxtv.org/liplianin/media_tree.git ts2020_v3.9
> > 
> > for you to fetch changes up to 2ff52e6f487c2ee841f3df9709d1b4e4416a1b15:
> >   ts2020: separate from m88rs2000 (2012-12-24 01:26:12 +0300)
> > 
> > ----
> > 
> > Igor M. Liplianin (4):
> >   Tevii S421 and S632 support
> >   
> >   
> >   m88rs2000: SNR BER implemented
> >   ds3000: lock led procedure added
> >   ts2020: separate from m88rs2000
> 
> You forgot to add your SOB and patch descriptions on the above
> patches.
Actually, I made it two months ago, enough to forget.
So, I will add SOB, description and resend. 

> 
> > Konstantin Dimitrov (3):
> >   ds3000: remove ts2020 tuner related code
> >   ts2020: add ts2020 tuner driver
> >   make the other drivers take use of the new ts2020 driver
> 
> Those now looks correct. So, I'm applying them.
> 
> Regards,
> Mauro

Regards,
Igor
-- 
Igor M. Liplianin
 Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL FOR v3.9] separate Montage ts2020 from ds3000 and rs2000, support for new TeVii cards

2012-12-24 Thread Igor M. Liplianin
The following changes since commit 8b2aea7878f64814544d0527c659011949d52358:

  [media] em28xx: prefer bulk mode on webcams (2012-12-23 17:24:30 -0200)

are available in the git repository at:

  git://git.linuxtv.org/liplianin/media_tree.git ts2020_v3.9

for you to fetch changes up to 2ff52e6f487c2ee841f3df9709d1b4e4416a1b15:

  ts2020: separate from m88rs2000 (2012-12-24 01:26:12 +0300)


Igor M. Liplianin (4):
  Tevii S421 and S632 support
  m88rs2000: SNR BER implemented
  ds3000: lock led procedure added
  ts2020: separate from m88rs2000

Konstantin Dimitrov (3):
  ds3000: remove ts2020 tuner related code
  ts2020: add ts2020 tuner driver
  make the other drivers take use of the new ts2020 driver

 drivers/media/dvb-frontends/Kconfig |   7 +++
 drivers/media/dvb-frontends/Makefile|   1 +
 drivers/media/dvb-frontends/ds3000.c| 255 
+-
 drivers/media/dvb-frontends/ds3000.h|  10 ++--
 drivers/media/dvb-frontends/m88rs2000.c | 420 
+
 drivers/media/dvb-frontends/m88rs2000.h |   6 ---
 drivers/media/dvb-frontends/ts2020.c| 372 
+
 drivers/media/dvb-frontends/ts2020.h|  50 +
 drivers/media/pci/cx23885/Kconfig   |   1 +
 drivers/media/pci/cx23885/cx23885-dvb.c |  11 +++-
 drivers/media/pci/cx88/Kconfig  |   2 +
 drivers/media/pci/cx88/cx88-dvb.c   |  11 +++-
 drivers/media/pci/dm1105/Kconfig|   1 +
 drivers/media/pci/dm1105/dm1105.c   |  11 +++-
 drivers/media/usb/dvb-usb-v2/Kconfig|   1 +
 drivers/media/usb/dvb-usb-v2/lmedm04.c  |   9 +++-
 drivers/media/usb/dvb-usb/Kconfig   |   2 +
 drivers/media/usb/dvb-usb/dw2102.c  | 143 

 18 files changed, 772 insertions(+), 541 deletions(-)
 create mode 100644 drivers/media/dvb-frontends/ts2020.c
 create mode 100644 drivers/media/dvb-frontends/ts2020.h

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cx23885: TeVii s471 card support

2012-05-11 Thread Igor M. Liplianin
The card is similar to TeVii s470, but has different LNB power control.

Signed-off-by: Igor M. Liplianin diff --git a/drivers/media/dvb/frontends/ds3000.c b/drivers/media/dvb/frontends/ds3000.c
index 6769fc4..668a1ef 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -935,7 +935,10 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
 			ds3000_writereg(state,
 ds3000_dvbs2_init_tab[i],
 ds3000_dvbs2_init_tab[i + 1]);
-		ds3000_writereg(state, 0xfe, 0x98);
+		if (c->symbol_rate >= 3000)
+			ds3000_writereg(state, 0xfe, 0x54);
+		else
+			ds3000_writereg(state, 0xfe, 0x98);
 		break;
 	default:
 		return 1;
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index 19b5499..13739e0 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -497,6 +497,10 @@ struct cx23885_board cx23885_boards[] = {
 		.name		= "TerraTec Cinergy T PCIe Dual",
 		.portb		= CX23885_MPEG_DVB,
 		.portc		= CX23885_MPEG_DVB,
+	},
+	[CX23885_BOARD_TEVII_S471] = {
+		.name		= "TeVii S471",
+		.portb		= CX23885_MPEG_DVB,
 	}
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
@@ -705,6 +709,10 @@ struct cx23885_subid cx23885_subids[] = {
 		.subvendor = 0x153b,
 		.subdevice = 0x117e,
 		.card  = CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL,
+	}, {
+		.subvendor = 0xd471,
+		.subdevice = 0x9022,
+		.card  = CX23885_BOARD_TEVII_S471,
 	},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -1460,6 +1468,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
 		ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
 		break;
 	case CX23885_BOARD_TEVII_S470:
+	case CX23885_BOARD_TEVII_S471:
 	case CX23885_BOARD_DVBWORLD_2005:
 		ts1->gen_ctrl_val  = 0x5; /* Parallel */
 		ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 6ad2270..697728f 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1046,6 +1046,13 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 	if (cx23885_boards[dev->board].ci_type > 0)
 		cx_clear(RDR_RDRCTL1, 1 << 8);
 
+	switch (dev->board) {
+	case CX23885_BOARD_TEVII_S470:
+	case CX23885_BOARD_TEVII_S471:
+		cx_clear(RDR_RDRCTL1, 1 << 8);
+		break;
+	}
+
 	return 0;
 }
 
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 54a2781..67140be 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -1185,6 +1185,13 @@ static int dvb_register(struct cx23885_tsport *port)
 			break;
 		}
 		break;
+	case CX23885_BOARD_TEVII_S471:
+		i2c_bus = &dev->i2c_bus[1];
+
+		fe0->dvb.frontend = dvb_attach(ds3000_attach,
+	&tevii_ds3000_config,
+	&i2c_bus->i2c_adap);
+		break;
 	default:
 		printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
 			" isn't supported yet\n",
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index f020f05..d884784 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -89,6 +89,7 @@
 #define CX23885_BOARD_MPX885   32
 #define CX23885_BOARD_MYGICA_X8507 33
 #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34
+#define CX23885_BOARD_TEVII_S471   35
 
 #define GPIO_0 0x0001
 #define GPIO_1 0x0002

Re: Re: [PATCH] Terratec Cinergy C PCI HD (CI)

2012-05-10 Thread Igor M. Liplianin
On 9 мая 2012 20:57:49 Bjørn Mork wrote:
> "Igor M. Liplianin"  writes:
> > This patch seems for rectifying a typo. But actually the difference
> > between
> > mantis_vp2040.c and mantis_vp2033.c code is a card name only.
> 
> Yes, there are major code duplication issues in this driver.
> 
> > Signed-off-by: Igor M. Liplianin 
> > diff -r 990a92e2410f linux/drivers/media/dvb/mantis/mantis_cards.c
> > --- a/linux/drivers/media/dvb/mantis/mantis_cards.c Wed May 09 01:37:05
> > 2012 +0300 +++ b/linux/drivers/media/dvb/mantis/mantis_cards.c  Wed May 
> > 09
> > 14:04:31 2012 +0300 @@ -276,7 +276,7 @@
> > 
> > MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, &vp2033_config),
> > MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, &vp2040_config),
> > MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config),
> > 
> > -   MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2033_config),
> > +   MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2040_config),
> > 
> > MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, &vp3030_config),
> > { }
> >  
> >  };
> 
> What's the point? It's a constructed difference.  Makes more sense to
> refactor and merge all the duplicated code instead of maintaining this
> meaningless code split.
> 
> > diff -r 990a92e2410f linux/drivers/media/dvb/mantis/mantis_core.c
> > --- a/linux/drivers/media/dvb/mantis/mantis_core.c  Wed May 09 01:37:05
> > 2012 +0300 +++ b/linux/drivers/media/dvb/mantis/mantis_core.c   Wed May 
> > 09
> > 14:04:31 2012 +0300 @@ -121,7 +121,7 @@
> > 
> > mantis->hwconfig = &vp2033_mantis_config;
> > break;
> > 
> > case MANTIS_VP_2040_DVB_C:  /* VP-2040 */
> > 
> > -   case TERRATEC_CINERGY_C_PCI:/* VP-2040 clone */
> > +   case CINERGY_C: /* VP-2040 clone */
> > 
> > case TECHNISAT_CABLESTAR_HD2:
> > mantis->hwconfig = &vp2040_mantis_config;
> > break;
> 
> And this file should never have been merged into the mainline kernel at
> all.  If you wonder how a bug like that could survive without being
> noticed, then the explanation is simple:  This code has never been built
> as part of the driver in the mainline kernel.
> 
> I tried submitting a cleanup patch to have it removed a long time ago:
> http://patchwork.linuxtv.org/patch/3680/
Oh, I wasn't aware of that.

> but it doesn't seem to have gone anywhere, like most of the patches for
> this driver -  silently ignored until everyone forgets it and moves on.
> 
> The code could certainly benefit from a major cleanup, but I don't see
> how that would ever happen.  It sort of works.  Better leave it there
> and spend valuable time elsewhere.
This patch is just a remainder. Seriously, I don't anticipate something.

Igor.
> 
> 
> 
> Bjørn
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [TEST] Regarding m88rc2000 i2c gate operation, SNR, BER and others

2012-05-09 Thread Igor M. Liplianin
Malcolm,

I made SNR, BER, UCB and signal level code for m88rc2000, but my cards show 
them correctly only if I made changes in m88rs2000_tuner_read function.
Analyzing USB logs I found that register 0x81 never set to 0x85 value.
It is always set to 0x84 regardless of read or write operation to tuner.
I was wondering is this my hardware specific? Can you test you cards with 
attached patch?

Igor
diff --git a/drivers/media/dvb/frontends/m88rs2000.c b/drivers/media/dvb/frontends/m88rs2000.c
index f6d6e39..f5ece59 100644
--- a/drivers/media/dvb/frontends/m88rs2000.c
+++ b/drivers/media/dvb/frontends/m88rs2000.c
@@ -143,7 +143,7 @@ static u8 m88rs2000_demod_read(struct m88rs2000_state *state, u8 reg)
 
 static u8 m88rs2000_tuner_read(struct m88rs2000_state *state, u8 reg)
 {
-	m88rs2000_demod_write(state, 0x81, 0x85);
+	m88rs2000_demod_write(state, 0x81, 0x84);
 	udelay(10);
 	return m88rs2000_readreg(state, 0, reg);
 }
@@ -492,33 +492,81 @@ static int m88rs2000_read_status(struct dvb_frontend *fe, fe_status_t *status)
 	return 0;
 }
 
-/* Extact code for these unknown but lmedm04 driver uses interupt callbacks */
-
 static int m88rs2000_read_ber(struct dvb_frontend *fe, u32 *ber)
 {
-	deb_info("m88rs2000_read_ber %d\n", *ber);
-	*ber = 0;
+	struct m88rs2000_state *state = fe->demodulator_priv;
+	u8 tmp0, tmp1;
+
+	m88rs2000_demod_write(state, 0x9a, 0x30);
+	tmp0 = m88rs2000_demod_read(state, 0xd8);
+	if ((tmp0 & 0x10) != 0) {
+		m88rs2000_demod_write(state, 0x9a, 0xb0);
+		*ber = 0x;
+		return 0;
+	}
+
+	*ber = (m88rs2000_demod_read(state, 0xd7) << 8) |
+		m88rs2000_demod_read(state, 0xd6);
+
+	tmp1 = m88rs2000_demod_read(state, 0xd9);
+	m88rs2000_demod_write(state, 0xd9, (tmp1 & ~7) | 4);
+	/* needs twice */
+	m88rs2000_demod_write(state, 0xd8, (tmp0 & ~8) | 0x30);
+	m88rs2000_demod_write(state, 0xd8, (tmp0 & ~8) | 0x30);
+	m88rs2000_demod_write(state, 0x9a, 0xb0);
+
 	return 0;
 }
 
 static int m88rs2000_read_signal_strength(struct dvb_frontend *fe,
-	u16 *strength)
+		u16 *signal_strength)
 {
-	*strength = 0;
+	struct m88rs2000_state *state = fe->demodulator_priv;
+	u8 rfg, bbg, gain, strength;
+
+	rfg = m88rs2000_tuner_read(state, 0x3d) & 0x1f;
+	bbg = m88rs2000_tuner_read(state, 0x21) & 0x1f;
+	gain = rfg * 2 + bbg * 3;
+
+	if (gain > 80)
+		strength = 0;
+	else if (gain > 65)
+		strength = 4 * (80 - gain);
+	else if (gain > 50)
+		strength = 65 + 4 * (65 - gain) / 3;
+	else
+		strength = 85 + 2 * (50 - gain) / 3;
+
+	*signal_strength = strength * 655;
+
+	deb_info("%s: rfg, bbg / gain = %d, %d, %d\n",
+		__func__, rfg, bbg, gain);
+
 	return 0;
 }
 
 static int m88rs2000_read_snr(struct dvb_frontend *fe, u16 *snr)
 {
-	deb_info("m88rs2000_read_snr %d\n", *snr);
-	*snr = 0;
+	struct m88rs2000_state *state = fe->demodulator_priv;
+
+	*snr = 512 * m88rs2000_demod_read(state, 0x65);
+
 	return 0;
 }
 
 static int m88rs2000_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
 {
-	deb_info("m88rs2000_read_ber %d\n", *ucblocks);
-	*ucblocks = 0;
+	struct m88rs2000_state *state = fe->demodulator_priv;
+	u8 tmp;
+
+	*ucblocks = (m88rs2000_demod_read(state, 0xd5) << 8) |
+			m88rs2000_demod_read(state, 0xd4);
+	tmp = m88rs2000_demod_read(state, 0xd8);
+	m88rs2000_demod_write(state, 0xd8, tmp & ~0x20);
+	/* needs two times */
+	m88rs2000_demod_write(state, 0xd8, tmp | 0x20);
+	m88rs2000_demod_write(state, 0xd8, tmp | 0x20);
+
 	return 0;
 }
 


[PATCH] Terratec Cinergy C PCI HD (CI)

2012-05-09 Thread Igor M. Liplianin
This patch seems for rectifying a typo. But actually the difference between
mantis_vp2040.c and mantis_vp2033.c code is a card name only.

Signed-off-by: Igor M. Liplianin diff -r 990a92e2410f linux/drivers/media/dvb/mantis/mantis_cards.c
--- a/linux/drivers/media/dvb/mantis/mantis_cards.c	Wed May 09 01:37:05 2012 +0300
+++ b/linux/drivers/media/dvb/mantis/mantis_cards.c	Wed May 09 14:04:31 2012 +0300
@@ -276,7 +276,7 @@
 	MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, &vp2033_config),
 	MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, &vp2040_config),
 	MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config),
-	MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2033_config),
+	MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2040_config),
 	MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, &vp3030_config),
 	{ }
 };
diff -r 990a92e2410f linux/drivers/media/dvb/mantis/mantis_core.c
--- a/linux/drivers/media/dvb/mantis/mantis_core.c	Wed May 09 01:37:05 2012 +0300
+++ b/linux/drivers/media/dvb/mantis/mantis_core.c	Wed May 09 14:04:31 2012 +0300
@@ -121,7 +121,7 @@
 		mantis->hwconfig = &vp2033_mantis_config;
 		break;
 	case MANTIS_VP_2040_DVB_C:	/* VP-2040 */
-	case TERRATEC_CINERGY_C_PCI:	/* VP-2040 clone */
+	case CINERGY_C:	/* VP-2040 clone */
 	case TECHNISAT_CABLESTAR_HD2:
 		mantis->hwconfig = &vp2040_mantis_config;
 		break;


Terratec Cinergy S2 USB HD Rev.2

2012-05-08 Thread Igor M. Liplianin
Terratec Cinergy S2 USB HD Rev.2 support.

Signed-off-by: Igor M. Liplianin diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
index 7ced62d..9a7a333 100644
--- a/drivers/media/dvb/dvb-usb/dw2102.c
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -1243,6 +1243,13 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
 {
 	u8 obuf[3] = { 0xe, 0x80, 0 };
 	u8 ibuf[] = { 0 };
+	
+	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
+		err("command 0x0e transfer failed.");
+
+	obuf[0] = 0xe;
+	obuf[1] = 0x02;
+	obuf[2] = 1;
 
 	if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
 		err("command 0x0e transfer failed.");
@@ -1536,6 +1543,7 @@ enum dw2102_table_entry {
 	X3M_SPC1400HD,
 	TEVII_S421,
 	TEVII_S632,
+	TERRATEC_CINERGY_S2_R2,
 };
 
 static struct usb_device_id dw2102_table[] = {
@@ -1556,6 +1564,7 @@ static struct usb_device_id dw2102_table[] = {
 	[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
 	[TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)},
 	[TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
+	[TERRATEC_CINERGY_S2_R2] = {USB_DEVICE(USB_VID_TERRATEC, 0x00b0)},
 	{ }
 };
 
@@ -1957,7 +1966,7 @@ static struct dvb_usb_device_properties su3000_properties = {
 		}},
 		}
 	},
-	.num_device_descs = 3,
+	.num_device_descs = 4,
 	.devices = {
 		{ "SU3000HD DVB-S USB2.0",
 			{ &dw2102_table[GENIATECH_SU3000], NULL },
@@ -1971,6 +1980,10 @@ static struct dvb_usb_device_properties su3000_properties = {
 			{ &dw2102_table[X3M_SPC1400HD], NULL },
 			{ NULL },
 		},
+		{ "Terratec Cinergy S2 USB HD Rev.2",
+			{ &dw2102_table[TERRATEC_CINERGY_S2_R2], NULL },
+			{ NULL },
+		},
 	}
 };
 

m88rs2000: LNB voltage control implemented

2012-05-08 Thread Igor M. Liplianin
Trival patch to get it working with my cards stuff.

Signed-off-by: Igor M. Liplianin diff --git a/drivers/media/dvb/frontends/m88rs2000.c b/drivers/media/dvb/frontends/m88rs2000.c
index 547230d..f6d6e39 100644
--- a/drivers/media/dvb/frontends/m88rs2000.c
+++ b/drivers/media/dvb/frontends/m88rs2000.c
@@ -416,9 +416,25 @@ static int m88rs2000_tab_set(struct m88rs2000_state *state,
 
 static int m88rs2000_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t volt)
 {
-	deb_info("%s: %s\n", __func__,
-		volt == SEC_VOLTAGE_13 ? "SEC_VOLTAGE_13" :
-		volt == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : "??");
+	struct m88rs2000_state *state = fe->demodulator_priv;
+	u8 data;
+
+	data = m88rs2000_demod_read(state, 0xb2);
+	data |= 0x03; /* bit0 V/H, bit1 off/on */
+
+	switch (volt) {
+	case SEC_VOLTAGE_18:
+		data &= ~0x03;
+		break;
+	case SEC_VOLTAGE_13:
+		data &= ~0x03;
+		data |= 0x01;
+		break;
+	case SEC_VOLTAGE_OFF:
+		break;
+	}
+
+	m88rs2000_demod_write(state, 0xb2, data);
 
 	return 0;
 }


[PATCH 2/2] TeVii DVB-S s421 and s632 cards support, rs2000 part

2012-05-08 Thread Igor M. Liplianin
One register needs to be changed to TS to work. So we use separate inittab.

Signed-off-by: Igor M. Liplianin 
diff --git a/drivers/media/dvb/frontends/m88rs2000.c b/drivers/media/dvb/frontends/m88rs2000.c
index 045ee5a..547230d 100644
--- a/drivers/media/dvb/frontends/m88rs2000.c
+++ b/drivers/media/dvb/frontends/m88rs2000.c
@@ -442,7 +442,11 @@ static int m88rs2000_init(struct dvb_frontend *fe)
 
 	deb_info("m88rs2000: init chip\n");
 	/* Setup frontend from shutdown/cold */
-	ret = m88rs2000_tab_set(state, m88rs2000_setup);
+	if (state->config->inittab)
+		ret = m88rs2000_tab_set(state,
+(struct inittab *)state->config->inittab);
+	else
+		ret = m88rs2000_tab_set(state, m88rs2000_setup);
 
 	return ret;
 }


[PATCH 1/2] TeVii DVB-S s421 and s632 cards support

2012-05-08 Thread Igor M. Liplianin
DVB-S chip is Montage m88rs2000, so initial patch is simple.

Signed-off-by: Igor M. Liplianin diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
index 451c5a7..4b2d190 100644
--- a/drivers/media/dvb/dvb-usb/dw2102.c
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -1,9 +1,9 @@
 /* DVB USB framework compliant Linux driver for the
  *	DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
- *	TeVii S600, S630, S650, S660, S480,
+ *	TeVii S600, S630, S650, S660, S480, S421, S632
  *	Prof 1100, 7500,
  *	Geniatech SU3000 Cards
- * Copyright (C) 2008-2011 Igor M. Liplianin (liplia...@me.by)
+ * Copyright (C) 2008-2012 Igor M. Liplianin (liplia...@me.by)
  *
  *	This program is free software; you can redistribute it and/or modify it
  *	under the terms of the GNU General Public License as published by the
@@ -27,6 +27,7 @@
 #include "stv6110.h"
 #include "stb6100.h"
 #include "stb6100_proc.h"
+#include "m88rs2000.h"
 
 #ifndef USB_PID_DW2102
 #define USB_PID_DW2102 0x2102
@@ -68,6 +69,14 @@
 #define USB_PID_PROF_1100 0xb012
 #endif
 
+#ifndef USB_PID_TEVII_S421
+#define USB_PID_TEVII_S421 0xd421
+#endif
+
+#ifndef USB_PID_TEVII_S632
+#define USB_PID_TEVII_S632 0xd632
+#endif
+
 #define DW210X_READ_MSG 0
 #define DW210X_WRITE_MSG 1
 
@@ -538,7 +547,7 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
 		}
 		/*case 0x55: cx24116
 		case 0x6a: stv0903
-		case 0x68: ds3000, stv0903
+		case 0x68: ds3000, stv0903, rs2000
 		case 0x60: ts2020, stv6110, stb6100
 		case 0xa0: eeprom */
 		default: {
@@ -987,6 +996,38 @@ static struct ds3000_config su3000_ds3000_config = {
 	.ci_mode = 1,
 };
 
+static u8 m88rs2000_inittab[] = {
+	DEMOD_WRITE, 0x9a, 0x30,
+	DEMOD_WRITE, 0x00, 0x01,
+	WRITE_DELAY, 0x19, 0x00,
+	DEMOD_WRITE, 0x00, 0x00,
+	DEMOD_WRITE, 0x9a, 0xb0,
+	DEMOD_WRITE, 0x81, 0xc1,
+	TUNER_WRITE, 0x42, 0x73,
+	TUNER_WRITE, 0x05, 0x07,
+	TUNER_WRITE, 0x20, 0x27,
+	TUNER_WRITE, 0x07, 0x02,
+	TUNER_WRITE, 0x11, 0xff,
+	TUNER_WRITE, 0x60, 0xf9,
+	TUNER_WRITE, 0x08, 0x01,
+	TUNER_WRITE, 0x00, 0x41,
+	DEMOD_WRITE, 0x81, 0x81,
+	DEMOD_WRITE, 0x86, 0xc6,
+	DEMOD_WRITE, 0x9a, 0x30,
+	DEMOD_WRITE, 0xf0, 0x80,
+	DEMOD_WRITE, 0xf1, 0xbf,
+	DEMOD_WRITE, 0xb0, 0x45,
+	DEMOD_WRITE, 0xb2, 0x01,
+	DEMOD_WRITE, 0x9a, 0xb0,
+	0xff, 0xaa, 0xff
+};
+
+static struct m88rs2000_config s421_m88rs2000_config = {
+	.demod_addr = 0x68,
+	.tuner_addr = 0x60,
+	.inittab = m88rs2000_inittab,
+};
+
 static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
 {
 	struct dvb_tuner_ops *tuner_ops = NULL;
@@ -1214,6 +1255,24 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
 	return 0;
 }
 
+static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
+{
+	u8 obuf[] = { 0x51 };
+	u8 ibuf[] = { 0 };
+
+	if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
+		err("command 0x51 transfer failed.");
+
+	d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config,
+	&d->dev->i2c_adap);
+	if (d->fe_adap[0].fe == NULL)
+		return -EIO;
+
+	info("Attached m88rs2000!\n");
+
+	return 0;
+}
+
 static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
 {
 	dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60,
@@ -1451,6 +1510,8 @@ enum dw2102_table_entry {
 	TEVII_S480_1,
 	TEVII_S480_2,
 	X3M_SPC1400HD,
+	TEVII_S421,
+	TEVII_S632,
 };
 
 static struct usb_device_id dw2102_table[] = {
@@ -1469,6 +1530,8 @@ static struct usb_device_id dw2102_table[] = {
 	[TEVII_S480_1] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_1)},
 	[TEVII_S480_2] = {USB_DEVICE(0x9022, USB_PID_TEVII_S480_2)},
 	[X3M_SPC1400HD] = {USB_DEVICE(0x1f4d, 0x3100)},
+	[TEVII_S421] = {USB_DEVICE(0x9022, USB_PID_TEVII_S421)},
+	[TEVII_S632] = {USB_DEVICE(0x9022, USB_PID_TEVII_S632)},
 	{ }
 };
 
@@ -1818,6 +1881,19 @@ static struct dvb_usb_device_description d7500 = {
 	{NULL},
 };
 
+struct dvb_usb_device_properties *s421;
+static struct dvb_usb_device_description d421 = {
+	"TeVii S421 PCI",
+	{&dw2102_table[TEVII_S421], NULL},
+	{NULL},
+};
+
+static struct dvb_usb_device_description d632 = {
+	"TeVii S632 USB",
+	{&dw2102_table[TEVII_S632], NULL},
+	{NULL},
+};
+
 static struct dvb_usb_device_properties su3000_properties = {
 	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
 	.usb_ctrl = DEVICE_SPECIFIC,
@@ -1915,6 +1991,20 @@ static int dw2102_probe(struct usb_interface *intf,
 	p7500->rc.legacy.rc_map_size = ARRAY_SIZE(rc_map_tbs_table);
 	p7500->adapter->fe[0].frontend_attach = prof_7500_frontend_attach;
 
+
+	s421 = kmemdup(&su3000_properties,
+		   sizeof(struct dvb_usb_device_properties), GFP_KERNEL);
+	if (!s421) {
+		kfree(p1100);
+		kfree(s660);
+		kfree(p7500);
+		return -ENOMEM;
+	}
+	s421->num_device_descs = 2;
+	s421->devices[0] = d421;
+	s421->devices[1] = d632;
+	s421->adapter->fe[0].frontend_attach = m88rs2000_frontend_attach;
+
 	if (0 == dvb_usb_device

Re: Re: [PATCH 2/3] ts2020: add ts2020 tuner driver

2012-05-08 Thread Igor M. Liplianin
On 8 мая 2012 10:09:47 Konstantin Dimitrov wrote:
> On Tue, May 8, 2012 at 9:32 AM, Igor M. Liplianin  wrote:
> > On 7 Ð¼Ð°Ñ  2012 00:22:30 Konstantin Dimitrov wrote:
> >> add separate ts2020 tuner driver
> >> 
> >> Signed-off-by: Konstantin Dimitrov 
> >> 
> >> --- a/linux/drivers/media/dvb/frontends/Kconfig       2012-04-20
> >> 06:45:55.0 +0300
> >> +++ b/linux/drivers/media/dvb/frontends/Kconfig       2012-05-07
> >> 00:58:26.888543350 +0300
> >> @@ -221,6 +221,13 @@
> >> Â  Â  Â  help
> >> Â  Â  Â  Â  A DVB-S tuner module. Say Y when you want to support this
> >> frontend.
> >> 
> >> +config DVB_TS2020
> >> + Â  Â  tristate "Montage Tehnology TS2020 based tuners"
> >> + Â  Â  depends on DVB_CORE && I2C
> >> + Â  Â  default m if DVB_FE_CUSTOMISE
> >> + Â  Â  help
> >> + Â  Â  Â  A DVB-S/S2 silicon tuner. Say Y when you want to support this
> >> tuner. +
> >> Â config DVB_DS3000
> >> Â  Â  Â  tristate "Montage Tehnology DS3000 based"
> >> Â  Â  Â  depends on DVB_CORE && I2C
> >> --- a/linux/drivers/media/dvb/frontends/Makefile      2012-04-20
> >> 06:45:55.0 +0300
> >> +++ b/linux/drivers/media/dvb/frontends/Makefile      2012-05-07
> >> 00:54:44.624546145 +0300
> >> @@ -87,6 +87,7 @@
> >> Â obj-$(CONFIG_DVB_EC100) += ec100.o
> >> Â obj-$(CONFIG_DVB_HD29L2) += hd29l2.o
> >> Â obj-$(CONFIG_DVB_DS3000) += ds3000.o
> >> +obj-$(CONFIG_DVB_TS2020) += ts2020.o
> >> Â obj-$(CONFIG_DVB_MB86A16) += mb86a16.o
> >> Â obj-$(CONFIG_DVB_MB86A20S) += mb86a20s.o
> >> Â obj-$(CONFIG_DVB_IX2505V) += ix2505v.o
> >> --- a/linux/drivers/media/dvb/frontends/ts2020.h      2012-05-07
> >> 01:36:49.876514403 +0300
> >> +++ b/linux/drivers/media/dvb/frontends/ts2020.h      2012-05-07
> >> 01:12:54.148532449 +0300
> >> @@ -0,0 +1,68 @@
> >> +/*
> >> + Â  Â Montage Technology TS2020 - Silicon Tuner driver
> >> + Â  Â Copyright (C) 2009-2012 Konstantin Dimitrov
> >> 
> >> +
> >> + Â  Â Copyright (C) 2009-2012 TurboSight.com
> >> +
> >> + Â  Â This program is free software; you can redistribute it and/or 
modify
> >> + Â  Â it under the terms of the GNU General Public License as published 
by
> >> + Â  Â the Free Software Foundation; either version 2 of the License, or
> >> + Â  Â (at your option) any later version.
> >> +
> >> + Â  Â This program is distributed in the hope that it will be useful,
> >> + Â  Â but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> + Â  Â MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Â See the
> >> + Â  Â GNU General Public License for more details.
> >> +
> >> + Â  Â You should have received a copy of the GNU General Public License
> >> + Â  Â along with this program; if not, write to the Free Software
> >> + Â  Â Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> >> + */
> >> +
> >> +#ifndef TS2020_H
> >> +#define TS2020_H
> >> +
> >> +#include 
> >> +
> >> +struct ts2020_config {
> >> + Â  Â  u8 tuner_address;
> >> +};
> >> +
> >> +struct ts2020_state {
> >> + Â  Â  struct i2c_adapter *i2c;
> >> + Â  Â  const struct ts2020_config *config;
> >> + Â  Â  struct dvb_frontend *frontend;
> >> + Â  Â  int status;
> >> +};
> >> +
> >> +#if defined(CONFIG_DVB_TS2020) || \
> >> + Â  Â  (defined(CONFIG_DVB_TS2020_MODULE) && defined(MODULE))
> >> +
> >> +extern struct dvb_frontend *ts2020_attach(
> >> + Â  Â  struct dvb_frontend *fe,
> >> + Â  Â  const struct ts2020_config *config,
> >> + Â  Â  struct i2c_adapter *i2c);
> >> +
> >> +extern int ts2020_get_signal_strength(
> >> + Â  Â  struct dvb_frontend *fe,
> >> + Â  Â  u16 *strength);
> >> +#else
> >> +static inline struct dvb_frontend *ts2020_attach(
> >> + Â  Â  struct dvb_frontend *fe,
> >> + Â  Â  const struct ts2020_config *config,
> >> + Â  Â  struct i2c_adapter *i2c)
> >> +{
> >> + Â  Â  printk(KERN_WARNING "%s: driver disabled by Kconfig\n", 
__func__);
> >> + Â  Â  return NULL;
> >> +}
> >> +
> >> +static inline int ts2020_get_signal_strength(
> >> + Â  Â  struct dvb_frontend *fe,
> >> + Â  Â  u16 *strength)
> &g

Re: [PATCH 2/3] ts2020: add ts2020 tuner driver

2012-05-07 Thread Igor M. Liplianin
 +
> + /* rounded to the closest integer */
> + nlpf = ((mlpf * f3db * 1000) + (2766 * TS2020_XTAL_FREQ / 2))
> + / (2766 * TS2020_XTAL_FREQ);
> + if (nlpf > 23)
> + nlpf = 23;
> + if (nlpf < 1)
> + nlpf = 1;
> +
> + /* rounded to the closest integer */
> + mlpf_new = ((TS2020_XTAL_FREQ * nlpf * 2766) +
> + (1000 * f3db / 2)) / (1000 * f3db);
> +
> + if (mlpf_new < mlpf_min) {
> + nlpf++;
> + mlpf_new = ((TS2020_XTAL_FREQ * nlpf * 2766) +
> + (1000 * f3db / 2)) / (1000 * f3db);
> + }
> +
> + if (mlpf_new > mlpf_max)
> + mlpf_new = mlpf_max;
> +
> + ts2020_writereg(fe, 0x04, mlpf_new);
> + ts2020_writereg(fe, 0x06, nlpf);
> + ts2020_writereg(fe, 0x51, 0x1b);
> + ts2020_writereg(fe, 0x51, 0x1f);
> + ts2020_writereg(fe, 0x50, 0x04);
> + ts2020_writereg(fe, 0x50, 0x00);
> + msleep(5);
> +
> + /* unknown */
> + ts2020_writereg(fe, 0x51, 0x1e);
> + ts2020_writereg(fe, 0x51, 0x1f);
> + ts2020_writereg(fe, 0x50, 0x01);
> + ts2020_writereg(fe, 0x50, 0x00);
> + msleep(60);
> +
> + return 0;
> +}
> +
> +static int ts2020_sleep(struct dvb_frontend *fe)
> +{
> + /* TODO: power down */
> + return 0;
> +}
> +
> +static int ts2020_release(struct dvb_frontend *fe)
> +{
> + struct ts2020_state *state = fe->tuner_priv;
> +
> + fe->tuner_priv = NULL;
> + kfree(state);
> +
> + return 0;
> +}
> +
> +static int ts2020_get_state(struct dvb_frontend *fe,
> + enum tuner_param param, struct tuner_state *state)
> +{
> + switch (param) {
> + case DVBFE_TUNER_FREQUENCY:
> + ts2020_get_frequency(fe, &state->frequency);
> + break;
> + default:
> + break;
> + }
> +
> + return 0;
> +}
> +
> +static int ts2020_set_state(struct dvb_frontend *fe,
> + enum tuner_param param, struct tuner_state *state)
> +{
> + switch (param) {
> + case DVBFE_TUNER_FREQUENCY:
> + ts2020_set_frequency(fe, state->frequency);
> + break;
> + default:
> + return -EINVAL;
> + break;
> + }
> +
> + return 0;
> +}
> +
> +static struct dvb_tuner_ops ts2020_ops = {
> + .info = {
> + .name = "Montage Technology TS2020 Silicon Tuner",
> + .frequency_min = 95,
> + .frequency_max = 215,
> + .frequency_step = 0,
> + },
> +
> + .init = ts2020_init,
> + .sleep = ts2020_sleep,
> + .get_status = ts2020_get_status,
> + .get_state = ts2020_get_state,
> + .set_state = ts2020_set_state,
Why not to use set_frequency/get_frequency directly, without payload of state 
structure and get_state/set_state and separate header file?
Truly, it is expansion of code for just simple operation.
I don't buy that stuff.

> + .release = ts2020_release
> +};
> +
> +int ts2020_get_signal_strength(struct dvb_frontend *fe,
> + u16 *signal_strength)
> +{
> + u16 sig_reading, sig_strength;
> + u8 rfgain, bbgain;
> +
> + rfgain = ts2020_readreg(fe, 0x3d) & 0x1f;
> + bbgain = ts2020_readreg(fe, 0x21) & 0x1f;
> +
> + if (rfgain > 15)
> + rfgain = 15;
> + if (bbgain > 13)
> + bbgain = 13;
> +
> + sig_reading = rfgain * 2 + bbgain * 3;
> +
> + sig_strength = 40 + (64 - sig_reading) * 50 / 64 ;
> +
> + /* cook the value to be suitable for szap-s2 human readable output */
> + *signal_strength = sig_strength * 1000;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(ts2020_get_signal_strength);
> +
> +struct dvb_frontend *ts2020_attach(struct dvb_frontend *fe,
> + const struct ts2020_config *config, struct i2c_adapter *i2c)
> +{
> + struct ts2020_state *state = NULL;
> +
> + /* allocate memory for the internal state */
> + state = kzalloc(sizeof(struct ts2020_state), GFP_KERNEL);
> + if (!state)
> + return NULL;
> +
> + /* setup the state */
> + state->config = config;
> + state->i2c = i2c;
> + state->frontend = fe;
> + fe->tuner_priv = state;
> + fe->ops.tuner_ops = ts2020_ops;
> +
> + return fe;
> +}
> +EXPORT_SYMBOL(ts2020_attach);
> +
> +MODULE_AUTHOR("Konstantin Dimitrov ");
> +MODULE_DESCRIPTION("Montage Technology TS2020 - Silicon tuner driver
> module"); +MODULE_LICENSE("GPL");
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] make the other drivers take use of the new ts2020 driver

2012-05-07 Thread Igor M. Liplianin
1105"
> @@ -847,6 +849,13 @@
> 
>  static struct ds3000_config dvbworld_ds3000_config = {
>   .demod_address = 0x68,
> +
> + .tuner_get_frequency = ts2020_get_frequency,
> + .tuner_set_frequency = ts2020_set_frequency,
> +};
> +
> +static struct ts2020_config dvbworld_ts2020_config  = {
> + .tuner_address = 0x60,
>  };
> 
>  static int __devinit frontend_init(struct dm1105_dev *dev)
> @@ -898,8 +907,11 @@
>   dev->fe = dvb_attach(
>   ds3000_attach, &dvbworld_ds3000_config,
>   &dev->i2c_adap);
> - if (dev->fe)
> + if (dev->fe) {
> + dvb_attach(ts2020_attach, dev->fe,
> + &dvbworld_ts2020_config, &dev->i2c_adap);
>   dev->fe->ops.set_voltage = dm1105_set_voltage;
> + }
> 
>   break;
>   case DM1105_BOARD_DVBWORLD_2002:
> --- a/linux/drivers/media/dvb/dvb-usb/dw2102.c2012-01-22
> 03:53:17.0 +0200
> +++ b/linux/drivers/media/dvb/dvb-usb/dw2102.c2012-05-07
> 03:03:22.739917389 +0300
> @@ -22,6 +22,8 @@
>  #include "tda1002x.h"
>  #include "mt312.h"
>  #include "zl10039.h"
> +#include "ts2020.h"
> +#include "ts2020_cfg.h"
>  #include "ds3000.h"
>  #include "stv0900.h"
>  #include "stv6110.h"
> @@ -934,6 +936,13 @@
> 
>  static struct ds3000_config dw2104_ds3000_config = {
>   .demod_address = 0x68,
> +
> + .tuner_get_frequency = ts2020_get_frequency,
> + .tuner_set_frequency = ts2020_set_frequency,
> +};
> +
> +static struct ts2020_config dw2104_ts2020_config  = {
> + .tuner_address = 0x60,
>  };
> 
>  static struct stv0900_config dw2104a_stv0900_config = {
> @@ -985,6 +994,13 @@
>  static struct ds3000_config su3000_ds3000_config = {
>   .demod_address = 0x68,
>   .ci_mode = 1,
> +
> + .tuner_get_frequency = ts2020_get_frequency,
> + .tuner_set_frequency = ts2020_set_frequency,
> +};
> +
> +static struct ts2020_config su3000_ts2020_config  = {
> + .tuner_address = 0x60,
>  };
> 
>  static int dw2104_frontend_attach(struct dvb_usb_adapter *d)
> @@ -1037,6 +1053,8 @@
>   d->fe_adap[0].fe = dvb_attach(ds3000_attach, &dw2104_ds3000_config,
>   &d->dev->i2c_adap);
>   if (d->fe_adap[0].fe != NULL) {
> + dvb_attach(ts2020_attach, d->fe_adap[0].fe,
> + &dw2104_ts2020_config, &d->dev->i2c_adap);
>   d->fe_adap[0].fe->ops.set_voltage = dw210x_set_voltage;
>   info("Attached DS3000!\n");
>   return 0;
> @@ -1149,6 +1167,9 @@
>   if (d->fe_adap[0].fe == NULL)
>   return -EIO;
> 
> + dvb_attach(ts2020_attach, d->fe_adap[0].fe, &dw2104_ts2020_config,
> + &d->dev->i2c_adap);
> +
>   st->old_set_voltage = d->fe_adap[0].fe->ops.set_voltage;
>   d->fe_adap[0].fe->ops.set_voltage = s660_set_voltage;
> 
> @@ -1209,6 +1230,9 @@
>   if (d->fe_adap[0].fe == NULL)
>   return -EIO;
> 
> + dvb_attach(ts2020_attach, d->fe_adap[0].fe, &su3000_ts2020_config,
> + &d->dev->i2c_adap);
> +
>   info("Attached DS3000!\n");
> 
>   return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCHES FOR 3.2] cx23885 alsa cleaned and prepaired

2011-10-14 Thread Igor M. Liplianin
В сообщении от 14 октября 2011 23:25:07 автор Mauro Carvalho Chehab написал:
> Em 10-10-2011 11:52, Igor M. Liplianin escreveu:
> > Hi Mauro and Steven,
> > 
> > It's been a long time since cx23885-alsa pull was requested.
> > To speed things up I created a git branch where I put the patches.
> > Some patches merged, like introduce then correct checkpatch compliance
> > or convert spinlock to mutex and back to spinlock, insert printk then
> > remove printk as well. Minor corrections from me was silently merged,
> > for major I created additional patches.
> > 
> > Hope it helps.
> > 
> > The following changes since commit 
e30528854797f057aa6ffb6dc9f890e923c467fd:
> >   [media] it913x-fe changes to power up and down of tuner (2011-10-08
> >   08:03:27 -0300)
> > 
> > are available in the git repository at:
> >   git://linuxtv.org/liplianin/media_tree.git cx23885-alsa-clean-2
> 
> Ok, all the other patches look sane. I just had to do another patchset
> reorder, moving patch 39 to happen before patch 29, and folding one of the
> Igor's fixes with a patch sent by Steven.
> 
> I'm assuming that all of you are ok with that. So, I'm pushing the
> changeset into my tree.
Great. Thank you Mauro.

> 
> > Igor M. Liplianin (2):
> >   cx23885: videobuf: Remove the videobuf_sg_dma_map/unmap functions
> >   cx25840-audio: fix missing state declaration
> > 
> > Mijhail Moreyra (6):
> >   cx23885: merge mijhail's header changes for alsa
> >   cx23885: ALSA support
> >   cx23885: core changes requireed for ALSA
> >   cx23885: add definitions for HVR1500 to support audio
> >   cx23885: correct the contrast, saturation and hue controls
> >   cx23885: hooks the alsa changes into the video subsystem
> > 
> > Steven Toth (31):
> >   cx23885: prepare the cx23885 makefile for alsa support
> >   cx23885: convert from snd_card_new() to snd_card_create()
> >   cx23885: convert call clients into subdevices
> >   cx23885: minor function renaming to ensure uniformity
> >   cx23885: setup the dma mapping for raw audio support
> >   cx23885: mute the audio during channel change
> >   cx23885: add two additional defines to simplify VBI register bitmap
> >   handling cx23885: initial support for VBI with the cx23885
> >   cx23885: initialize VBI support in the core, add IRQ support,
> >   register vbi device cx23885: minor printk cleanups and device
> >   registration
> >   cx25840: enable raw cc processing only for the cx23885 hardware
> >   cx23885: vbi line window adjustments
> >   cx23885: add vbi buffer formatting, window changes and video core
> >   changes cx23885: Ensure the VBI pixel format is established
> >   correctly. cx23885: ensure video is streaming before allowing vbi
> >   to stream cx23885: remove channel dump diagnostics when a vbi
> >   buffer times out. cx23885: Ensure VBI buffers timeout quickly -
> >   bugfix for vbi hangs during streaming. cx23885: Name an internal
> >   i2c part and declare a bitfield by name cx25840: Enable support
> >   for non-tuner LR1/LR2 audio inputs cx23885: Enable audio line in
> >   support from the back panel
> >   cx25840: Ensure AUDIO6 and AUDIO7 trigger line-in baseband use.
> >   cx23885: Initial support for the MPX-885 mini-card
> >   cx23885: fixes related to maximum number of inputs and range
> >   checking cx23885: add generic functions for dealing with audio
> >   input selection cx23885: hook the audio selection functions into
> >   the main driver cx23885: v4l2 api compliance, set the audioset
> >   field correctly cx23885: Removed a spurious function
> >   cx23885_set_scale().
> >   cx23885: Avoid stopping the risc engine during buffer timeout.
> >   cx23885: Avoid incorrect error handling and reporting
> >   cx23885: Stop the risc video fifo before reconfiguring it.
> >   cx23885: Allow the audio mux config to be specified on a per input
> >   basis.
> >  
> >  drivers/media/video/cx23885/Makefile|2 +-
> >  drivers/media/video/cx23885/cx23885-alsa.c  |  535
> >  +++ drivers/media/video/cx23885/cx23885-cards.c
> >  |   53 +++
> >  drivers/media/video/cx23885/cx23885-core.c  |   99 -
> >  drivers/media/video/cx23885/cx23885-i2c.c   |1 +
> >  drivers/media/video/cx23885/cx23885-reg.h   |3 +
> >  drivers/media/video/cx23885/cx23885-vbi.c   |   72 +++-
> >

Re: [GIT PATCHES FOR 3.2] cx23885 alsa cleaned and prepaired

2011-10-11 Thread Igor M. Liplianin
В сообщении от 11 октября 2011 21:17:57 автор Steven Toth написал:
> > It's been a long time since cx23885-alsa pull was requested.
> > To speed things up I created a git branch where I put the patches.
> 
> > are available in the git repository at:
> ...
> 
> >  git://linuxtv.org/liplianin/media_tree.git cx23885-alsa-clean-2
> 
> Thank you for working on this Igor.
> 
> I most certainly have some additional patches that will probably no
> longer apply cleanly. However, given that you've gone to the trouble
> of building a new tree, assuming we can get these merged, then I'll
> rebase and regenerate any patches I have to match the current cx23885
> driver.

Thank you for the driver Steven.

Is current state of branch good for pulling?

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 3.2] cx23885 alsa cleaned and prepaired

2011-10-10 Thread Igor M. Liplianin
Hi Mauro and Steven,

It's been a long time since cx23885-alsa pull was requested.
To speed things up I created a git branch where I put the patches.
Some patches merged, like introduce then correct checkpatch compliance
or convert spinlock to mutex and back to spinlock, insert printk then remove 
printk as well.
Minor corrections from me was silently merged, for major I created additional 
patches.

Hope it helps.

The following changes since commit e30528854797f057aa6ffb6dc9f890e923c467fd:

  [media] it913x-fe changes to power up and down of tuner (2011-10-08 08:03:27 
-0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git cx23885-alsa-clean-2

Igor M. Liplianin (2):
  cx23885: videobuf: Remove the videobuf_sg_dma_map/unmap functions
  cx25840-audio: fix missing state declaration

Mijhail Moreyra (6):
  cx23885: merge mijhail's header changes for alsa
  cx23885: ALSA support
  cx23885: core changes requireed for ALSA
  cx23885: add definitions for HVR1500 to support audio
  cx23885: correct the contrast, saturation and hue controls
  cx23885: hooks the alsa changes into the video subsystem

Steven Toth (31):
  cx23885: prepare the cx23885 makefile for alsa support
  cx23885: convert from snd_card_new() to snd_card_create()
  cx23885: convert call clients into subdevices
  cx23885: minor function renaming to ensure uniformity
  cx23885: setup the dma mapping for raw audio support
  cx23885: mute the audio during channel change
  cx23885: add two additional defines to simplify VBI register bitmap 
handling
  cx23885: initial support for VBI with the cx23885
  cx23885: initialize VBI support in the core, add IRQ support, register 
vbi device
  cx23885: minor printk cleanups and device registration
  cx25840: enable raw cc processing only for the cx23885 hardware
  cx23885: vbi line window adjustments
  cx23885: add vbi buffer formatting, window changes and video core changes
  cx23885: Ensure the VBI pixel format is established correctly.
  cx23885: ensure video is streaming before allowing vbi to stream
  cx23885: remove channel dump diagnostics when a vbi buffer times out.
  cx23885: Ensure VBI buffers timeout quickly - bugfix for vbi hangs during 
streaming.
  cx23885: Name an internal i2c part and declare a bitfield by name
  cx25840: Enable support for non-tuner LR1/LR2 audio inputs
  cx23885: Enable audio line in support from the back panel
  cx25840: Ensure AUDIO6 and AUDIO7 trigger line-in baseband use.
  cx23885: Initial support for the MPX-885 mini-card
  cx23885: fixes related to maximum number of inputs and range checking
  cx23885: add generic functions for dealing with audio input selection
  cx23885: hook the audio selection functions into the main driver
  cx23885: v4l2 api compliance, set the audioset field correctly
  cx23885: Removed a spurious function cx23885_set_scale().
  cx23885: Avoid stopping the risc engine during buffer timeout.
  cx23885: Avoid incorrect error handling and reporting
  cx23885: Stop the risc video fifo before reconfiguring it.
  cx23885: Allow the audio mux config to be specified on a per input basis.

 drivers/media/video/cx23885/Makefile|2 +-
 drivers/media/video/cx23885/cx23885-alsa.c  |  535 +++
 drivers/media/video/cx23885/cx23885-cards.c |   53 +++
 drivers/media/video/cx23885/cx23885-core.c  |   99 -
 drivers/media/video/cx23885/cx23885-i2c.c   |1 +
 drivers/media/video/cx23885/cx23885-reg.h   |3 +
 drivers/media/video/cx23885/cx23885-vbi.c   |   72 +++-
 drivers/media/video/cx23885/cx23885-video.c |  373 ---
 drivers/media/video/cx23885/cx23885.h   |   56 +++
 drivers/media/video/cx25840/cx25840-audio.c |   10 +-
 drivers/media/video/cx25840/cx25840-core.c  |   19 +
 11 files changed, 1144 insertions(+), 79 deletions(-)
 create mode 100644 drivers/media/video/cx23885/cx23885-alsa.c
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Media_build Issue with altera on cx23885

2011-10-06 Thread Igor M. Liplianin
В сообщении от 5 октября 2011 23:04:34 автор Evan Platt написал:
> V4L-DVB was previously working correctly for me.  I was experiencing
> some problems which had been solved before by recompiling v4l.  So I
> cloned the latest media_build tree and ran the build process.
> 
> Afterward, the driver does not load correctly and dmesg shows an error
> (cx23885: Unknown symbol altera_init (err 0)).  I know there was a
> change to move altera from staging to misc but I see that the changes
> were propogated to media_build on 9/26/11.
> 
> I ran menuconfig and made sure that MISC_DEVICES was set to 'y' to
> include altera-stapl but to no avail.
> 
> Please advise.
> 
> Some relevant information:
> 
> Device:  Hauppauge HVR-1250 Tuner
> Driver:  cx23885
> Environment: Ubuntu 11.04, 2.6.38-11-generic
> 
> Thanks!
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hi Evan,
Just try attached patch against media_build. It fixes altera-stapl build for 
media_build tree.

Mauro, is this a correct patch?

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
diff --git a/v4l/Makefile b/v4l/Makefile
index 311924e..14bfe46 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -257,6 +257,7 @@ links::
 	@find ../linux/drivers/media -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
 	@find ../linux/sound -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
 	@find ../linux/drivers/staging -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
+	@find ../linux/drivers/misc -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
 
 config-compat.h:: $(obj)/.version .myconfig scripts/make_config_compat.pl
 	perl scripts/make_config_compat.pl $(SRCDIR) $(obj)/.myconfig $(obj)/config-compat.h
diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl
index 1832e5b..112ef0d 100755
--- a/v4l/scripts/make_makefile.pl
+++ b/v4l/scripts/make_makefile.pl
@@ -205,6 +205,7 @@ open OUT, '>Makefile.media' or die 'Unable to write Makefile.media';
 open_makefile('../linux/drivers/media/Makefile');
 
 find({wanted => \&parse_dir, no_chdir => 1}, '../linux/drivers/staging');
+find({wanted => \&parse_dir, no_chdir => 1}, '../linux/drivers/misc');
 
 # Creating Install rule
 print OUT "media-install::\n";


Re: [PATCH] pctv452e: hm.. tidy bogus code up

2011-10-06 Thread Igor M. Liplianin
В сообщении от 6 октября 2011 11:35:51 автор André Weidemann написал:
> Hi Mauro,
> 
> On 30.09.2011 22:58, Igor M. Liplianin wrote:
> > Currently, usb_register calls two times with cloned structures, but for
> > different driver names. Let's remove it.
> 
> It looks like the comments and the patch under
> http://patchwork.linuxtv.org/patch/8042/ got mixed up.
> 
> Regards,
>   André
git format-patch generated original in attachement.
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
From 2e078ba46048c34b501174c5abc766a3bf812bb0 Mon Sep 17 00:00:00 2001
From: Igor M. Liplianin 
Date: Fri, 30 Sep 2011 23:13:29 +0300
Subject: [PATCH] pctv452e: hm.. tidy bogus code up
To: , 

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/dvb-usb/pctv452e.c |   16 +---
 1 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/pctv452e.c 
b/drivers/media/dvb/dvb-usb/pctv452e.c
index 9a5c811..f9aec5c 100644
--- a/drivers/media/dvb/dvb-usb/pctv452e.c
+++ b/drivers/media/dvb/dvb-usb/pctv452e.c
@@ -1012,7 +1012,7 @@ static struct dvb_usb_device_properties 
tt_connect_s2_3600_properties = {
 
.i2c_algo = &pctv452e_i2c_algo,
 
-   .generic_bulk_ctrl_endpoint = 1, /* allow generice rw function*/
+   .generic_bulk_ctrl_endpoint = 1, /* allow generic rw function*/
 
.num_device_descs = 2,
.devices = {
@@ -1055,22 +1055,9 @@ static struct usb_driver pctv452e_usb_driver = {
.id_table   = pctv452e_usb_table,
 };
 
-static struct usb_driver tt_connects2_3600_usb_driver = {
-   .name   = "dvb-usb-tt-connect-s2-3600-01.fw",
-   .probe  = pctv452e_usb_probe,
-   .disconnect = pctv452e_usb_disconnect,
-   .id_table   = pctv452e_usb_table,
-};
-
 static int __init pctv452e_usb_init(void)
 {
int ret = usb_register(&pctv452e_usb_driver);
-
-   if (ret) {
-   err("%s: usb_register failed! Error %d", __FILE__, ret);
-   return ret;
-   }
-   ret = usb_register(&tt_connects2_3600_usb_driver);
if (ret)
err("%s: usb_register failed! Error %d", __FILE__, ret);
 
@@ -1080,7 +1067,6 @@ static int __init pctv452e_usb_init(void)
 static void __exit pctv452e_usb_exit(void)
 {
usb_deregister(&pctv452e_usb_driver);
-   usb_deregister(&tt_connects2_3600_usb_driver);
 }
 
 module_init(pctv452e_usb_init);
-- 
1.7.5.1



[PATCH] pctv452e: hm.. tidy bogus code up

2011-09-30 Thread Igor M. Liplianin
Currently, usb_register calls two times with cloned structures, but for 
different driver names. Let's remove it.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/dvb-usb/pctv452e.c |   16 +---
 1 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/pctv452e.c b/drivers/media/dvb/dvb-
usb/pctv452e.c
index 9a5c811..f9aec5c 100644
--- a/drivers/media/dvb/dvb-usb/pctv452e.c
+++ b/drivers/media/dvb/dvb-usb/pctv452e.c
@@ -1012,7 +1012,7 @@ static struct dvb_usb_device_properties 
tt_connect_s2_3600_properties = {
 
.i2c_algo = &pctv452e_i2c_algo,
 
-   .generic_bulk_ctrl_endpoint = 1, /* allow generice rw function*/
+   .generic_bulk_ctrl_endpoint = 1, /* allow generic rw function*/
 
.num_device_descs = 2,
.devices = {
@@ -1055,22 +1055,9 @@ static struct usb_driver pctv452e_usb_driver = {
.id_table   = pctv452e_usb_table,
 };
 
-static struct usb_driver tt_connects2_3600_usb_driver = {
-   .name   = "dvb-usb-tt-connect-s2-3600-01.fw",
-   .probe  = pctv452e_usb_probe,
-   .disconnect = pctv452e_usb_disconnect,
-   .id_table   = pctv452e_usb_table,
-};
-
 static int __init pctv452e_usb_init(void)
 {
int ret = usb_register(&pctv452e_usb_driver);
-
-   if (ret) {
-   err("%s: usb_register failed! Error %d", __FILE__, ret);
-   return ret;
-   }
-   ret = usb_register(&tt_connects2_3600_usb_driver);
if (ret)
err("%s: usb_register failed! Error %d", __FILE__, ret);
 
@@ -1080,7 +1067,6 @@ static int __init pctv452e_usb_init(void)
 static void __exit pctv452e_usb_exit(void)
 {
usb_deregister(&pctv452e_usb_driver);
-   usb_deregister(&tt_connects2_3600_usb_driver);
 }
 
 module_init(pctv452e_usb_init);
-- 
1.7.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add support for PCTV452E.

2011-09-27 Thread Igor M. Liplianin
В сообщении от 27 сентября 2011 10:55:11 автор Dominik Kuhlen написал:
> Hi all,
> 
> sorry for being quiet such a long time
> 
> On Tuesday 13 September 2011 08:04:51 Steffen Barszus wrote:
> > On Wed, 15 Jun 2011 18:44:35 +0300
> > 
> > "Igor M. Liplianin"  wrote:
> > > From my point of view we can count the beginning was here:
> > > 
> > > http://www.spinics.net/lists/linux-dvb/msg26431.html
> > > 
> > > The later history is difficult to restore, but possible.
> > 
> > After some searching it looks like this is the first occurrence of the
> > driver:
> > http://www.linuxtv.org/pipermail/linux-dvb/2007-October/021403.html
> > 
> > Further it looks like Dominik Kuhlen is not responding at that mail (as
> > he has been on copy on one of the last mails.
> > 
> > So looks like we cant get the signed-off-by from him.
> 
> Where do you want me to put that line?
> Although I cannot test the current code atm I trust the other testers and
> I'd like to see it included in the main tree. Improvements can still be
> added later...
> 
> Dominik
Welcome, Dominik!

Igor
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 3.2] NetUP Dual DVB-T/C CI RF: fix card hardware revision detection and PID filter for second demux

2011-09-24 Thread Igor M. Liplianin
The following changes since commit 4e2c53fde651be6225d9f940c02b2eabc2f9591c:

  [media] dvb: Add support for pctv452e (2011-09-24 00:07:42 -0300)

are available in the git repository at:
  http://linuxtv.org/git/liplianin/media_tree.git netup_patches

Abylay Ospan (2):
  NetUP Dual DVB-T/C CI RF: fix card hardware revision detect
  NetUP Dual DVB-T/C CI RF: connect hardware PID filtering for second 
demux/dvr

 drivers/media/video/cx23885/altera-ci.c |   48 ++-
 drivers/media/video/cx23885/altera-ci.h |2 +-
 drivers/media/video/cx23885/cx23885-cards.c |2 +-
 drivers/media/video/cx23885/cx23885-dvb.c   |3 +-
 4 files changed, 36 insertions(+), 19 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add support for PCTV452E.

2011-09-23 Thread Igor M. Liplianin
В сообщении от 24 сентября 2011 00:11:21 автор Igor M. Liplianin написал:
> В сообщении от 23 сентября 2011 23:58:15 автор Oliver Freyermuth написал:
> > Thanks for the review!
> > 
> > As this is the first time I touched module- / kernel-code and I am not
> > really familiar with the structures of the rc-system, I do not really
> > feel up to porting to non-legacy rc-support (Igors version also appears
> > to use rc-legacy), and up to now, it was only combining patches and
> > fixing small glitches for me.
> > However, feel free to use me as a tester (I have the hardware available,
> > after all) or flood me with links to guidelines or further instructions.
> > 
> > Thanks again,
> > 
> >  Oliver Freyermuth
> 
> Note, this patch is good for testing with media_build system. Just in case
> someone want not to load ~500 Mb kernel git tree, then configure, compile,
> install vmlinuz and so on, so on.
Sorry, wrong patch, forget to amend. This patch.
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
>From ae2acc4401230c17b68f74f806501de5d710a386 Mon Sep 17 00:00:00 2001
From: Igor M. Liplianin 
Date: Sat, 24 Sep 2011 00:33:50 +0300
Subject: [PATCH] Add support for pctv452e
To: , 

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/dvb-usb/Kconfig   |   13 +
 drivers/media/dvb/dvb-usb/Makefile  |4 +
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h |3 +
 drivers/media/dvb/dvb-usb/pctv452e.c| 1093 +++
 drivers/media/dvb/frontends/Kconfig |   10 +
 drivers/media/dvb/frontends/Makefile|1 +
 drivers/media/dvb/frontends/lnbp22.c|  148 +
 drivers/media/dvb/frontends/lnbp22.h|   57 ++
 drivers/media/dvb/ttpci/ttpci-eeprom.c  |   29 +
 drivers/media/dvb/ttpci/ttpci-eeprom.h  |1 +
 10 files changed, 1359 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/dvb/dvb-usb/pctv452e.c
 create mode 100644 drivers/media/dvb/frontends/lnbp22.c
 create mode 100644 drivers/media/dvb/frontends/lnbp22.h

diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 2c773827..5825716 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -258,6 +258,19 @@ config DVB_USB_AF9005_REMOTE
 	  Say Y here to support the default remote control decoding for the
 	  Afatech AF9005 based receiver.
 
+config DVB_USB_PCTV452E
+	tristate "Pinnacle PCTV HDTV Pro USB device/TT Connect S2-3600"
+	depends on DVB_USB
+	select TTPCI_EEPROM
+	select DVB_LNBP22 if !DVB_FE_CUSTOMISE
+	select DVB_STB0899 if !DVB_FE_CUSTOMISE
+	select DVB_STB6100 if !DVB_FE_CUSTOMISE
+	help
+	  Support for external USB adapter designed by Pinnacle,
+	  shipped under the brand name 'PCTV HDTV Pro USB'.
+	  Also supports TT Connect S2-3600/3650 cards.
+	  Say Y if you own such a device and want to use it.
+
 config DVB_USB_DW2102
 	tristate "DvbWorld & TeVii DVB-S/S2 USB2.0 support"
 	depends on DVB_USB
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 06f75f6..7d0710b 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -64,6 +64,9 @@ obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
 dvb-usb-anysee-objs = anysee.o
 obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o
 
+dvb-usb-pctv452e-objs = pctv452e.o
+obj-$(CONFIG_DVB_USB_PCTV452E) += dvb-usb-pctv452e.o
+
 dvb-usb-dw2102-objs = dw2102.o
 obj-$(CONFIG_DVB_USB_DW2102) += dvb-usb-dw2102.o
 
@@ -104,4 +107,5 @@ obj-$(CONFIG_DVB_USB_MXL111SF) += mxl111sf-tuner.o
 ccflags-y += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
 # due to tuner-xc3028
 ccflags-y += -Idrivers/media/common/tuners
+EXTRA_CFLAGS += -Idrivers/media/dvb/ttpci
 
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 7433261..2ad33ba 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -241,6 +241,9 @@
 #define USB_PID_PCTV_200E0x020e
 #define USB_PID_PCTV_400E0x020f
 #define USB_PID_PCTV_450E0x0222
+#define USB_PID_PCTV_452E0x021f
+#define USB_PID_TECHNOTREND_CONNECT_S2_3600		0x3007
+#define USB_PID_TECHNOTREND_CONNECT_S2_3650_CI		0x300a
 #define USB_PID_NEBULA_DIGITV0x0201
 #define USB_PID_DVICO_BLUEBIRD_LGDT			0xd820
 #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD		0xd500
diff --git a/drivers/media/dvb/dvb-usb/pctv452e.c b/drivers/media/dvb/dvb-usb/pctv452e.c
new file mode 100644
index 000..9a5c811
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/pctv452e.c
@@ -0,0 +1,1093 @@
+/*
+ * PCTV 452e DVB driver
+ *
+ * Copyright (c) 2006-2008 Dominik Kuhlen 
+ *
+ * TT connect S2-3650-CI Common Interface support, MAC readout
+ * Copyright (C) 2008 Michael H. Schimek 
+ *
+ * This program is free software; you can redistribute it and/or
+ *

Re: [PATCH] Add support for PCTV452E.

2011-09-23 Thread Igor M. Liplianin
В сообщении от 23 сентября 2011 23:58:15 автор Oliver Freyermuth написал:
> Thanks for the review!
> 
> As this is the first time I touched module- / kernel-code and I am not
> really familiar with the structures of the rc-system, I do not really
> feel up to porting to non-legacy rc-support (Igors version also appears
> to use rc-legacy), and up to now, it was only combining patches and
> fixing small glitches for me.
> However, feel free to use me as a tester (I have the hardware available,
> after all) or flood me with links to guidelines or further instructions.
> 
> Thanks again,
>  Oliver Freyermuth
>

Note, this patch is good for testing with media_build system. Just in case 
someone want not to load ~500 Mb kernel git tree, then configure, compile, 
install vmlinuz and so on, so on.

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add support for PCTV452E.

2011-09-23 Thread Igor M. Liplianin
Here is my version.
Made with git format-patch for branch staging/for_v3.2
From cc44ac937f36ed51335eb11a7e28cf047a979a1c Mon Sep 17 00:00:00 2001
From: Igor M. Liplianin 
Date: Fri, 23 Sep 2011 23:31:25 +0300
Subject: [PATCH] Add support for pctv452e
To: , 

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/dvb-usb/Kconfig   |   13 +
 drivers/media/dvb/dvb-usb/Makefile  |4 +
 drivers/media/dvb/dvb-usb/dvb-usb-ids.h |3 +
 drivers/media/dvb/dvb-usb/pctv452e.c| 1182 +++
 drivers/media/dvb/frontends/Kconfig |   10 +
 drivers/media/dvb/frontends/Makefile|1 +
 drivers/media/dvb/frontends/lnbp22.c|  148 
 drivers/media/dvb/frontends/lnbp22.h|   57 ++
 drivers/media/dvb/ttpci/ttpci-eeprom.c  |   29 +
 drivers/media/dvb/ttpci/ttpci-eeprom.h  |1 +
 10 files changed, 1448 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/dvb/dvb-usb/pctv452e.c
 create mode 100644 drivers/media/dvb/frontends/lnbp22.c
 create mode 100644 drivers/media/dvb/frontends/lnbp22.h

diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 2c773827..5825716 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -258,6 +258,19 @@ config DVB_USB_AF9005_REMOTE
 	  Say Y here to support the default remote control decoding for the
 	  Afatech AF9005 based receiver.
 
+config DVB_USB_PCTV452E
+	tristate "Pinnacle PCTV HDTV Pro USB device/TT Connect S2-3600"
+	depends on DVB_USB
+	select TTPCI_EEPROM
+	select DVB_LNBP22 if !DVB_FE_CUSTOMISE
+	select DVB_STB0899 if !DVB_FE_CUSTOMISE
+	select DVB_STB6100 if !DVB_FE_CUSTOMISE
+	help
+	  Support for external USB adapter designed by Pinnacle,
+	  shipped under the brand name 'PCTV HDTV Pro USB'.
+	  Also supports TT Connect S2-3600/3650 cards.
+	  Say Y if you own such a device and want to use it.
+
 config DVB_USB_DW2102
 	tristate "DvbWorld & TeVii DVB-S/S2 USB2.0 support"
 	depends on DVB_USB
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 06f75f6..7d0710b 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -64,6 +64,9 @@ obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
 dvb-usb-anysee-objs = anysee.o
 obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o
 
+dvb-usb-pctv452e-objs = pctv452e.o
+obj-$(CONFIG_DVB_USB_PCTV452E) += dvb-usb-pctv452e.o
+
 dvb-usb-dw2102-objs = dw2102.o
 obj-$(CONFIG_DVB_USB_DW2102) += dvb-usb-dw2102.o
 
@@ -104,4 +107,5 @@ obj-$(CONFIG_DVB_USB_MXL111SF) += mxl111sf-tuner.o
 ccflags-y += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
 # due to tuner-xc3028
 ccflags-y += -Idrivers/media/common/tuners
+EXTRA_CFLAGS += -Idrivers/media/dvb/ttpci
 
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 7433261..2ad33ba 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -241,6 +241,9 @@
 #define USB_PID_PCTV_200E0x020e
 #define USB_PID_PCTV_400E0x020f
 #define USB_PID_PCTV_450E0x0222
+#define USB_PID_PCTV_452E0x021f
+#define USB_PID_TECHNOTREND_CONNECT_S2_3600		0x3007
+#define USB_PID_TECHNOTREND_CONNECT_S2_3650_CI		0x300a
 #define USB_PID_NEBULA_DIGITV0x0201
 #define USB_PID_DVICO_BLUEBIRD_LGDT			0xd820
 #define USB_PID_DVICO_BLUEBIRD_LG064F_COLD		0xd500
diff --git a/drivers/media/dvb/dvb-usb/pctv452e.c b/drivers/media/dvb/dvb-usb/pctv452e.c
new file mode 100644
index 000..6151b3e
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/pctv452e.c
@@ -0,0 +1,1182 @@
+/*
+ * PCTV 452e DVB driver
+ *
+ * Copyright (c) 2006-2008 Dominik Kuhlen 
+ *
+ * TT connect S2-3650-CI Common Interface support, MAC readout
+ * Copyright (C) 2008 Michael H. Schimek 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+/* dvb usb framework */
+#define DVB_USB_LOG_PREFIX "pctv452e"
+#include "dvb-usb.h"
+
+/* Demodulator */
+#include "stb0899_drv.h"
+#include "stb0899_reg.h"
+#include "stb0899_cfg.h"
+/* Tuner */
+#include "stb6100.h"
+#include "stb6100_cfg.h"
+/* FE Power */
+#include "lnbp22.h"
+
+#include "dvb_ca_en50221.h"
+#include "ttpci-eeprom.h"
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+#define ISO_BUF_COUNT  4
+#define FRAMES_PER_ISO_BUF 4
+#define ISO_FRAME_SIZE 940
+#define ISOC_INTERFACE_ALTERNATIVE 3
+
+#define SYNC_BYTE_OUT 0xaa
+#define SYNC_BYTE_IN  0x55
+
+/* guessed: (copied from ttusb-budget) */
+#define PCTV_CM

Fwd: various patches for TT S2-3650 CI

2011-09-23 Thread Igor M. Liplianin

--  Forwarded Message  --

Subject: various patches for TT S2-3650 CI
Date: 16 мая 2011, 00:53:18
From: Damien Fouilleul 
Получатель:  "Igor M. Liplianin" 
Копия:  Dominik Kuhlen 

Hi Igor,

I do not know what procedure you expect for submitting patches to s2-lilipian, 
so i apologize in advance if i'm just spamming your mailbox.

i've own a 3650 for a few months, and i could not get it working with the 
current driver in s2-lilipian on my setup, consisting of universal LNB 
connected to a Stab HH-100 rotor.
the windows drivers works flawlessly, so i decided to get USB sniffer and 
compare the linux and windows driver. The following patches are a direct 
result of a couple of months of investigation.

In a nutshell, the current driver for the LNBP22 SEC does not allow it for 
providing enough current to power up the rotor, which requires about 300mA for 
about a second to charge up its DC/DC capacitors. The following patch enable a 
bit in the driver, which raises the current overload threshold. I've also 
documented the status register based on my own investigations.

Regarding the pctv452e driver, I fixed an issue with the remote control being 
too sensitive; i've discovered a bit in the remote control data, which gets 
flipped every time a key is pressed, and does't when a key is held down. By 
combining this finding and some code I lifted from the cinergyT2-core (which 
does a good job at managing repeatable keys), i've come up with the following 
patch.

I've also modified the USB transfer parameters to match the values used by the 
windows driver. It does help on my old powerpc macmini running mythtv-backend, 
it could barely cope with the number of interrupts generated by using the 
original parameters.

I hope you'll find this useful

Damien




-----
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks


lnbp22.diff
Description: Binary data


pctv452e.diff
Description: Binary data


[GIT PATCHES FOR 3.2] fix type error in cx23885 and altera-stapl move out from staging

2011-09-23 Thread Igor M. Liplianin
The following changes since commit 3a7a62378be538944ff00904b8e0b795fe16609a:

  [media] ati_remote: update Kconfig description (2011-09-22 10:55:10 -0300)

are available in the git repository at:
  http://linuxtv.org/git/liplianin/media_tree.git netup_patches

Igor M. Liplianin (2):
  cx23885: fix type error
  altera-stapl: it is time to move out from staging

 drivers/media/video/cx23885/Kconfig|2 +-
 drivers/media/video/cx23885/cx23885-cards.c|2 +-
 drivers/misc/Kconfig   |1 +
 drivers/misc/Makefile  |1 +
 drivers/{staging => misc}/altera-stapl/Kconfig |2 +
 drivers/misc/altera-stapl/Makefile |3 ++
 .../{staging => misc}/altera-stapl/altera-comp.c   |0
 .../{staging => misc}/altera-stapl/altera-exprt.h  |0
 .../{staging => misc}/altera-stapl/altera-jtag.c   |2 +-
 .../{staging => misc}/altera-stapl/altera-jtag.h   |0
 .../{staging => misc}/altera-stapl/altera-lpt.c|0
 drivers/{staging => misc}/altera-stapl/altera.c|   35 +++
 drivers/staging/Kconfig|2 -
 drivers/staging/Makefile   |1 -
 drivers/staging/altera-stapl/Makefile  |3 --
 .../staging/altera-stapl => include/misc}/altera.h |0
 16 files changed, 23 insertions(+), 31 deletions(-)
 rename drivers/{staging => misc}/altera-stapl/Kconfig (77%)
 create mode 100644 drivers/misc/altera-stapl/Makefile
 rename drivers/{staging => misc}/altera-stapl/altera-comp.c (100%)
 rename drivers/{staging => misc}/altera-stapl/altera-exprt.h (100%)
 rename drivers/{staging => misc}/altera-stapl/altera-jtag.c (99%)
 rename drivers/{staging => misc}/altera-stapl/altera-jtag.h (100%)
 rename drivers/{staging => misc}/altera-stapl/altera-lpt.c (100%)
 rename drivers/{staging => misc}/altera-stapl/altera.c (99%)
 delete mode 100644 drivers/staging/altera-stapl/Makefile
 rename {drivers/staging/altera-stapl => include/misc}/altera.h (100%)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Revert "V4L/DVB: cx23885: Enable Message Signaled Interrupts(MSI)"

2011-06-30 Thread Igor M. Liplianin
В сообщении от 30 июня 2011 00:49:33 автор Jarod Wilson написал:
> This reverts commit e38030f3ff02684eb9e25e983a03ad318a10a2ea.
> 
> MSI flat-out doesn't work right on cx2388x devices yet. There are now
> multiple reports of cards that hard-lock systems when MSI is enabled,
> including my own HVR-1250 when trying to use its built-in IR receiver.
> Disable MSI and it works just fine. Similar for another user's HVR-1270.
> Issues have also been reported with the HVR-1850 when MSI is enabled,
> and the 1850 behavior sounds similar to an as-yet-undiagnosed issue I've
> seen with an 1800.
> 
> References:
> 
> http://www.spinics.net/lists/linux-media/msg25956.html
> http://www.spinics.net/lists/linux-media/msg33676.html
> http://www.spinics.net/lists/linux-media/msg34734.html
It's chronic problem now ...
http://www.spinics.net/lists/linux-media/msg22494.html

And how I cure it for particular card.
http://www.spinics.net/lists/linux-media/msg28334.html

Now I see, to revert commit e38030f3ff02684eb9e25e983a03ad318a10a2ea is a 
necessity.

> 
> CC: Andy Walls 
> CC: Kusanagi Kouichi 
> Signed-off-by: Jarod Wilson 
> ---
>  drivers/media/video/cx23885/cx23885-core.c |9 ++---
>  1 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/video/cx23885/cx23885-core.c
> b/drivers/media/video/cx23885/cx23885-core.c index 64d9b21..419777a 100644
> --- a/drivers/media/video/cx23885/cx23885-core.c
> +++ b/drivers/media/video/cx23885/cx23885-core.c
> @@ -2060,12 +2060,8 @@ static int __devinit cx23885_initdev(struct pci_dev
> *pci_dev, goto fail_irq;
>   }
> 
> - if (!pci_enable_msi(pci_dev))
> - err = request_irq(pci_dev->irq, cx23885_irq,
> -   IRQF_DISABLED, dev->name, dev);
> - else
> - err = request_irq(pci_dev->irq, cx23885_irq,
> -   IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
> + err = request_irq(pci_dev->irq, cx23885_irq,
> +   IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
>   if (err < 0) {
>   printk(KERN_ERR "%s: can't get IRQ %d\n",
>  dev->name, pci_dev->irq);
> @@ -2114,7 +2110,6 @@ static void __devexit cx23885_finidev(struct pci_dev
> *pci_dev)
> 
>   /* unregister stuff */
>   free_irq(pci_dev->irq, dev);
> - pci_disable_msi(pci_dev);
> 
>   cx23885_dev_unregister(dev);
>   v4l2_device_unregister(v4l2_dev);

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add support for PCTV452E.

2011-06-15 Thread Igor M. Liplianin
>From my point of view we can count the beginning was here:

http://www.spinics.net/lists/linux-dvb/msg26431.html

The later history is difficult to restore, but possible.

BR
Igor
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Doman me.by is dead ...

2011-06-05 Thread Igor M. Liplianin
It happens domain "me.by" died :(
I'm subscribed using "liplia...@tut.by" for now.
I have couple addresses yet
liplia...@netup.ru
liplia...@tcm.by

Best regards
Igor
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] dm1105: GPIO handling added, I2C on GPIO added, LNB control through GPIO reworked

2011-05-05 Thread Igor M. Liplianin
Here is patch for GPIO's handling.
It allows to support I2C on GPIO's and per board LNB control through GPIO's.
Also incuded some support for Hendrik Skarpeid card.
For those, who needs to tweak the driver,
I think it is clear how to change and test GPIO's for LNB and other GPIO 
related stuff now.

Signed-off-by: Igor M. Liplianin 
diff -r abd3aac6644e linux/drivers/media/dvb/dm1105/dm1105.c
--- a/linux/drivers/media/dvb/dm1105/dm1105.c	Fri Jul 02 00:38:54 2010 -0300
+++ b/linux/drivers/media/dvb/dm1105/dm1105.c	Sat Oct 23 11:58:32 2010 +0300
@@ -20,6 +20,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,11 +51,12 @@
 
 #define UNSET (-1U)
 
-#define DM1105_BOARD_NOAUTO		UNSET
-#define DM1105_BOARD_UNKNOWN		0
-#define DM1105_BOARD_DVBWORLD_2002	1
-#define DM1105_BOARD_DVBWORLD_2004	2
-#define DM1105_BOARD_AXESS_DM05		3
+#define DM1105_BOARD_NOAUTO			UNSET
+#define DM1105_BOARD_UNKNOWN			0
+#define DM1105_BOARD_DVBWORLD_2002		1
+#define DM1105_BOARD_DVBWORLD_2004		2
+#define DM1105_BOARD_AXESS_DM05			3
+#define DM1105_BOARD_UNBRANDED_I2C_ON_GPIO	4
 
 /* --- */
 /*
@@ -158,22 +160,38 @@
 #define DM1105_MAX0x04
 
 #define DRIVER_NAME"dm1105"
+#define DM1105_I2C_GPIO_NAME			"dm1105-gpio"
 
 #define DM1105_DMA_PACKETS			47
 #define DM1105_DMA_PACKET_LENGTH		(128*4)
 #define DM1105_DMA_BYTES			(128 * 4 * DM1105_DMA_PACKETS)
 
+/*  */
+#define GPIO08	(1 << 8)
+#define GPIO13	(1 << 13)
+#define GPIO14	(1 << 14)
+#define GPIO15	(1 << 15)
+#define GPIO16	(1 << 16)
+#define GPIO17	(1 << 17)
+#define GPIO_ALL0x03
+
 /* GPIO's for LNB power control */
-#define DM1105_LNB_MASK0x
-#define DM1105_LNB_OFF0x0002
-#define DM1105_LNB_13V0x00010100
-#define DM1105_LNB_18V0x0100
+#define DM1105_LNB_MASK(GPIO_ALL & ~(GPIO14 | GPIO13))
+#define DM1105_LNB_OFFGPIO17
+#define DM1105_LNB_13V(GPIO16 | GPIO08)
+#define DM1105_LNB_18VGPIO08
 
 /* GPIO's for LNB power control for Axess DM05 */
-#define DM05_LNB_MASK0x
-#define DM05_LNB_OFF0x0002/* actually 13v */
-#define DM05_LNB_13V0x0002
-#define DM05_LNB_18V0x0003
+#define DM05_LNB_MASK(GPIO_ALL & ~(GPIO14 | GPIO13))
+#define DM05_LNB_OFFGPIO17/* actually 13v */
+#define DM05_LNB_13VGPIO17
+#define DM05_LNB_18V(GPIO17 | GPIO16)
+
+/* GPIO's for LNB power control for unbranded with I2C on GPIO */
+#define UNBR_LNB_MASK(GPIO17 | GPIO16)
+#define UNBR_LNB_OFF0
+#define UNBR_LNB_13VGPIO17
+#define UNBR_LNB_18V(GPIO17 | GPIO16)
 
 static unsigned int card[]  = {[0 ... 3] = UNSET };
 module_param_array(card,  int, NULL, 0444);
@@ -188,7 +206,11 @@
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
 struct dm1105_board {
-	char*name;
+	char	*name;
+	struct	{
+		u32	mask, off, v13, v18;
+	} lnb;
+	u32	gpio_scl, gpio_sda;
 };
 
 struct dm1105_subid {
@@ -200,15 +222,50 @@
 static const struct dm1105_board dm1105_boards[] = {
 	[DM1105_BOARD_UNKNOWN] = {
 		.name		= "UNKNOWN/GENERIC",
+		.lnb = {
+			.mask = DM1105_LNB_MASK,
+			.off = DM1105_LNB_OFF,
+			.v13 = DM1105_LNB_13V,
+			.v18 = DM1105_LNB_18V,
+		},
 	},
 	[DM1105_BOARD_DVBWORLD_2002] = {
 		.name		= "DVBWorld PCI 2002",
+		.lnb = {
+			.mask = DM1105_LNB_MASK,
+			.off = DM1105_LNB_OFF,
+			.v13 = DM1105_LNB_13V,
+			.v18 = DM1105_LNB_18V,
+		},
 	},
 	[DM1105_BOARD_DVBWORLD_2004] = {
 		.name		= "DVBWorld PCI 2004",
+		.lnb = {
+			.mask = DM1105_LNB_MASK,
+			.off = DM1105_LNB_OFF,
+			.v13 = DM1105_LNB_13V,
+			.v18 = DM1105_LNB_18V,
+		},
 	},
 	[DM1105_BOARD_AXESS_DM05] = {
 		.name		= "Axess/EasyTv DM05",
+		.lnb = {
+			.mask = DM05_LNB_MASK,
+			.off = DM05_LNB_OFF,
+			.v13 = DM05_LNB_13V,
+			.v18 = DM05_LNB_18V,
+		},
+	},
+	[DM1105_BOARD_UNBRANDED_I2C_ON_GPIO] = {
+		.name		= "Unbranded DM1105 with i2c on GPIOs",
+		.lnb = {
+			.mask = UNBR_LNB_MASK,
+			.off = UNBR_LNB_OFF,
+			.v13 = UNBR_LNB_13V,
+			.v18 = UNBR_LNB_18V,
+		},
+		.gpio_scl	= GPIO14,
+		.gpio_sda	= GPIO13,
 	},
 };
 
@@ -294,6 +351,8 @@
 
 	/* i2c */
 	struct i2c_adapter i2c_adap;
+	struct i2c_adapter i2c_bb_adap;
+	struct i2c_algo_bit_data i2c_bit;
 
 	/* irq */
 	struct work_struct work;
@@ -329,6 +388,103 @@
 #define dm_setl(reg, bit)	dm_andorl((reg), (bit), (bit))
 #define dm_clearl(reg, bit)	dm_andorl((reg), (bit), 0)
 
+/* The chip has 18 GPIOs. In HOST mode GPIO's used as 15 bit address lines,
+ so we can use only 3 GPIO's from GPIO15 to GPIO17.
+ Here I don't check whether HOST is enebled as it is not implemented yet.
+ */
+static void dm1105_gpio_set(struct dm1105_dev *dev, u32 mask)
+{
+	if (mask & 0xfffc)
+		printk(KERN_ERR "%s: Only 18 GPIO's are allowed\n", __func__);
+
+	if (mask & 0x0003)
+		dm_setl(D

Re: [linux-dvb] TeVii S470 (cx23885 / ds3000) makes the machine unstable

2011-05-05 Thread Igor M. Liplianin
ost kernel: IRQ
> 18/cx23885[0]: IRQF_DISABLED is not guaranteed on shared IRQs
> 
> 
> # uname -a
> Linux mythbackend 2.6.34.8-68.fc13.i686.PAE #1 SMP Thu Feb 17 14:54:10 UTC
> 2011 i686 i686 i386 GNU/Linux #
> 
> 
> I searched the Net and found a similar question that was raised some time
> ago, but there was not even a discussion on this topic...
> 
> If  someone  else  has  the  same  DVB-S  card  -  please  share  your
> experience! I'd appreciate any ideas!
Hello,

Your kernel seems necessary to update...

Best Regards
Igor
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DM1105: could not attach frontend 195d:1105

2011-05-05 Thread Igor M. Liplianin
В сообщении от 4 мая 2011 00:33:51 автор Mauro Carvalho Chehab написал:
> Hi Igor,
> 
> Em 23-10-2010 07:20, Igor M. Liplianin escreveu:
> > В сообщении от 10 марта 2010 14:15:49 автор Hendrik Skarpeid написал:
> >> Igor M. Liplianin skrev:
> >>> On 3 марта 2010 18:42:42 Hendrik Skarpeid wrote:
> >>>> Igor M. Liplianin wrote:
> >>>>> Now to find GPIO's for LNB power control and ... watch TV :)
> >>>> 
> >>>> Yep. No succesful tuning at the moment. There might also be an issue
> >>>> with the reset signal and writing to GPIOCTR, as the module at the
> >>>> moment loads succesfully only once.
> >>>> As far as I can make out, the LNB power control is probably GPIO 16
> >>>> and 17, not sure which is which, and how they work.
> >>>> GPIO15 is wired to tuner #reset
> >>> 
> >>> New patch to test
> >> 
> >> I think the LNB voltage may be a little to high on my card, 14.5V and
> >> 20V. I would be a little more happy if they were 14 and 19, 13 and 18
> >> would be perfect.
> >> Anyways, as Igor pointet out, I don't have any signal from the LNB,
> >> checked with another tuner card. It's a quad LNB, and the other outputs
> >> are fine. Maybe it's' toasted from to high supply voltage! I little word
> >> of warning then.
> >> Anyways, here's my tweaked driver.
> > 
> > Here is reworked patch for clear GPIO's handling.
> > It allows to support I2C on GPIO's and per board LNB control through
> > GPIO's. Also incuded support for Hendrik's card.
> > I think it is clear how to change and test GPIO's for LNB and other stuff
> > now.
> > 
> > To Hendrik:
> > Not shure, but there is maybe GPIO for raise/down LNB voltage a little
> > (~1v). It is used for long coaxial lines to compensate voltage
> > dropping.
> > 
> > Signed-off-by: Igor M. Liplianin 
> 
> I'm not sure if this patch is still valid or not, and if it should or not
> be applied, as there were several discussions around it. As a reference,
> it is stored at patchwork with:
>   X-Patchwork-Id: 279091
> 
> And still applies fine (yet, patchwork lost patch history/comments and
> SOB).
> 
> Igor, could you please update me if I should apply this patch or if the
> patch got rejected/superseeded?
> 
> Thanks!
> Mauro.
Hi Mauro,
The patch should be applied.
Do I need to do something, it means apply to a tree and send pull request? 

Thanks!
Igor
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 2.6.39] cx23885, altera-ci, stv0367: uncorrected blocks counter and other fixes

2011-03-05 Thread Igor M. Liplianin
The following changes since commit 88a763df226facb74fdb254563e30e9efb64275c:

  [media] dw2102: prof 1100 corrected (2011-03-02 16:56:54 -0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git dual_dvb_t_c_ci_rf-1

Abylay Ospan (5):
  cx23885: Altera FPGA CI interface reworked.
  stv0367: change default value for AGC register.
  stv0367: implement uncorrected blocks counter.
  Fix CI code for NetUP Dual DVB-T/C CI RF card
  Force xc5000 firmware loading for NetUP Dual DVB-T/C CI RF card

 drivers/media/dvb/frontends/stv0367.c |   24 +---
 drivers/media/video/cx23885/altera-ci.c   |   14 ++
 drivers/media/video/cx23885/cx23885-dvb.c |   23 +--
 3 files changed, 44 insertions(+), 17 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCHES FOR 2.6.39] cx23885, altera-ci: remove operator return in void procedure

2011-03-01 Thread Igor M. Liplianin
The following changes since commit 9e650fdb12171a5a5839152863eaab9426984317:

  [media] drivers:media:radio: Update Kconfig and Makefile for wl128x FM driver 
(2011-02-27 
07:50:42 -0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git dual_dvb_t_c_ci_rf

Abylay Ospan (1):
  stv0900: Update status when LOCK is missed

Igor M. Liplianin (2):
  cx23885, altera-ci: remove operator return  in void procedure
  stv0900: speed up DVB-S searching

 drivers/media/dvb/frontends/stv0900_core.c |6 +-
 drivers/media/video/cx23885/altera-ci.h|2 --
 2 files changed, 5 insertions(+), 3 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prof 7301: switching frontend to stv090x, fixing "LOCK FAILED" issue

2011-02-28 Thread Igor M. Liplianin
В сообщении от 1 марта 2011 00:24:32 автор Mariusz Bialonczyk написал:
> On 02/28/2011 09:37 PM, Igor M. Liplianin wrote:
> > Sorry, I have nothing against you personally.
> 
> me too :)
> 
> > I have excuses, but you not intresting, I think.
> > Peace, friendship, chewing gum, like we use to say in my childhood :)
> > 
> > Switching to other driver not helps me, so be patient.
> > 
> > I patched stv0900 and send pull request.
> 
> I've tested it - and for the first sight it seems that it indeed
> solves the problem. Thank you :)
> 
> And about frontend: I think I found a solution which I hope will
> satisfy all of us. I think it would be great if user have
> an alternative option to use stv090x frontend anyway. I mean your
> frontend as default, but a module parameter which enables using
> stv090x instead of stv0900 (enabling what's is inside my patch).
> This will be a flexible solution which shouldn't harm anyone,
> but instead gives an option.
> 
> Igor, Mauro, do you have objections against this solution?
> If you agree, then I'll try to prepare an RFC patch for that.
Well, I didn't change my mind.
There is not an option, but splitting efforts in two ways.

> 
> regards,

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prof 7301: switching frontend to stv090x, fixing "LOCK FAILED" issue

2011-02-28 Thread Igor M. Liplianin
В сообщении от 28 февраля 2011 21:45:46 автор Mariusz Bialonczyk написал:
> On 02/28/2011 06:01 PM, Igor M. Liplianin wrote:
> > For those who ...
> > He asked me to get rid of my driver. Why should I?
> 
> Maybe because (now) your frontend has problems with tunning on this card?
> I though that references are known for you:
> 1.
> http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/24
> 573 2.
> http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/25
> 275 3. http://linuxdvb.org.ru/wbb/index.php?page=Thread&threadID=641
> 
> And to be more specific: I am not asking to get rid of your driver,
> my patch doesn't touch your stv0900 implementation, it only change the
> frontend for one particular card.
> 
> > I have 7301, test it myself and see nothing bad with stv0900.
> 
> If it is working for you - lucky you! But keep in mind that it it doesn't
> mean that it is working for others. Have you tested it with my patch
> applied? Besides it is not using your frontend, maybe it just *work*?
> 
> > Obviously, I better patch stv0900 then convert the driver to stv090x.
> 
> Sure, go ahead... I am only wondering why wasn't you so helpful when I was
> trying to contact you and offer debugging help when I discovered the
> problem after I started using this card. Your only response was:
> "I know this issue. Your card is fine."
> So now I resolved the problem myself and sent a working solution (tested
> by some people - always with good results) and you disagree now.
> 
> I'm only hoping that a hardware *usability* will win over an ego!
> 
> regards,
http://git.linuxtv.org/liplianin/media_tree.git?a=shortlog;h=refs/heads/dual_dvb_t_c_ci_rf

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prof 7301: switching frontend to stv090x, fixing "LOCK FAILED" issue

2011-02-28 Thread Igor M. Liplianin
В сообщении от 28 февраля 2011 21:45:46 автор Mariusz Bialonczyk написал:
> On 02/28/2011 06:01 PM, Igor M. Liplianin wrote:
> > For those who ...
> > He asked me to get rid of my driver. Why should I?
> 
> Maybe because (now) your frontend has problems with tunning on this card?
> I though that references are known for you:
> 1.
> http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/24
> 573 2.
> http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/25
> 275 3. http://linuxdvb.org.ru/wbb/index.php?page=Thread&threadID=641
> 
> And to be more specific: I am not asking to get rid of your driver,
> my patch doesn't touch your stv0900 implementation, it only change the
> frontend for one particular card.
> 
> > I have 7301, test it myself and see nothing bad with stv0900.
> 
> If it is working for you - lucky you! But keep in mind that it it doesn't
> mean that it is working for others. Have you tested it with my patch
> applied? Besides it is not using your frontend, maybe it just *work*?
> 
> > Obviously, I better patch stv0900 then convert the driver to stv090x.
> 
> Sure, go ahead... I am only wondering why wasn't you so helpful when I was
> trying to contact you and offer debugging help when I discovered the
> problem after I started using this card. Your only response was:
> "I know this issue. Your card is fine."
> So now I resolved the problem myself and sent a working solution (tested
> by some people - always with good results) and you disagree now.
> 
> I'm only hoping that a hardware *usability* will win over an ego!
> 
> regards,
Sorry, I have nothing against you personally.
I have excuses, but you not intresting, I think.
Peace, friendship, chewing gum, like we use to say in my childhood :)

Switching to other driver not helps me, so be patient.

I patched stv0900 and send pull request.
Tested on Prof 7301, 7500, NetUP Dual DVB-S2, DVBWorld 2104 cards by myself.
With all of that vendors I have good relationships.

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PATCHES FOR 2.6.39] cx23885, altera-ci: remove operator return in void procedure

2011-02-28 Thread Igor M. Liplianin
The following changes since commit 9e650fdb12171a5a5839152863eaab9426984317:

  [media] drivers:media:radio: Update Kconfig and Makefile for wl128x FM driver 
(2011-02-27 
07:50:42 -0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git dual_dvb_t_c_ci_rf

Igor M. Liplianin (2):
  cx23885, altera-ci: remove operator return  in void procedure
  stv0900: speed up DVB-S searching

 drivers/media/dvb/frontends/stv0900_core.c |5 -
 drivers/media/video/cx23885/altera-ci.h|2 --
 2 files changed, 4 insertions(+), 3 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prof 7301: switching frontend to stv090x, fixing "LOCK FAILED" issue

2011-02-28 Thread Igor M. Liplianin
В сообщении от 28 февраля 2011 18:09:56 автор Andreas Oberritter написал:
> Hello Igor,
> 
> On 02/28/2011 04:41 PM, Igor M. Liplianin wrote:
> > В сообщении от 28 февраля 2011 13:37:01 автор Mariusz Bialonczyk написал:
> >> On 2011-01-16 21:44, Mariusz Bialonczyk wrote:
> >>> Fixing the very annoying tunning issue. When switching from DVB-S2 to
> >>> DVB-S, it often took minutes to have a lock.
> >>> 
> >>  > [...]
> >>> 
> >>> The patch is changing the frontend from stv0900 to stv090x.
> >>> The card now works much more reliable. There is no problem with
> >>> switching from DVB-S2 to DVB-S, tunning works flawless.
> >> 
> >> Igor, can I get your ACK on this patch?
> >> 
> >> regards,
> > 
> > Never.
> > Think first what you are asking for.
> 
> for those who aren't involved in the development of these drivers, may I
> ask you what's the problem with this patch?
For those who ...
He asked me to get rid of my driver. Why should I?
I have 7301, test it myself and see nothing bad with stv0900.
Obviously, I better patch stv0900 then convert the driver to stv090x.
And if you ask something then be prepaired to not be given smth.

Best Regards
Igor
> 
> Regards,
> Andreas

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Prof 7301: switching frontend to stv090x, fixing "LOCK FAILED" issue

2011-02-28 Thread Igor M. Liplianin
В сообщении от 28 февраля 2011 13:37:01 автор Mariusz Bialonczyk написал:
> On 2011-01-16 21:44, Mariusz Bialonczyk wrote:
> > Fixing the very annoying tunning issue. When switching from DVB-S2 to
> > DVB-S, it often took minutes to have a lock.
> > 
>  > [...]
> > 
> > The patch is changing the frontend from stv0900 to stv090x.
> > The card now works much more reliable. There is no problem with switching
> > from DVB-S2 to DVB-S, tunning works flawless.
> 
> Igor, can I get your ACK on this patch?
> 
> regards,
Never. 
Think first what you are asking for.

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 2.6.39] ds3000: wrong hardware tune function implemented

2011-02-27 Thread Igor M. Liplianin
The following changes since commit 9e650fdb12171a5a5839152863eaab9426984317:

  [media] drivers:media:radio: Update Kconfig and Makefile for wl128x FM driver 
(2011-02-27 
07:50:42 -0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git ds3000-new

Igor M. Liplianin (1):
  ds3000: wrong hardware tune function implemented

 drivers/media/dvb/frontends/ds3000.c |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 2.6.39] dw2102 updates

2011-02-27 Thread Igor M. Liplianin
The following changes since commit 9e650fdb12171a5a5839152863eaab9426984317:

  [media] drivers:media:radio: Update Kconfig and Makefile for wl128x FM driver 
(2011-02-27 
07:50:42 -0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git dw2102

Igor M. Liplianin (5):
  dw2102: X3M TV SPC1400HD added.
  dw2102: remove unnecessary delays for i2c transfer for some cards.
  dw2102: i2c transfer corrected for some cards.
  dw2102: i2c transfer corrected for yet another cards.
  dw2102: prof 1100 corrected.

 drivers/media/dvb/dvb-usb/dw2102.c |   47 +--
 1 files changed, 28 insertions(+), 19 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 2.6.39] cx23885, altera-ci: remove operator return in void procedure

2011-02-27 Thread Igor M. Liplianin
The following changes since commit 9e650fdb12171a5a5839152863eaab9426984317:

  [media] drivers:media:radio: Update Kconfig and Makefile for wl128x FM driver 
(2011-02-27 
07:50:42 -0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git dual_dvb_t_c_ci_rf

Igor M. Liplianin (1):
  cx23885, altera-ci: remove operator return  in void procedure

 drivers/media/video/cx23885/altera-ci.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: dw2102.c: quadratic increment intended?

2011-02-27 Thread Igor M. Liplianin
В сообщении от 27 февраля 2011 22:57:50 автор Malcolm Priestley написал:
> On Sun, 2011-02-27 at 20:30 +0200, Igor M. Liplianin wrote:
> > В сообщении от 27 февраля 2011 16:40:19 автор Török Edwin написал:
> > > Hi,
> > 
> > Hi
> > 
> > > Please see http://llvm.org/bugs/show_bug.cgi?id=9259#c5, is the code
> > > intended to do a quadratic increment there?
> > > 
> > > While looking at this, I wonder if this isn't also a bug in the
> > > original
> > > 
> > > code:
> > > /* read stv0299 register */
> > > request = 0xb5;
> > > value = msg[0].buf[0];/* register */
> > > for (i = 0; i < msg[1].len; i++) {
> > > 
> > > value = value + i;
> > > ret = dw2102_op_rw(d->udev, 0xb5,
> > > 
> > > value, buf6, 2, DW2102_READ_MSG);
> > > 
> > > msg[1].buf[i] = buf6[0];
> > > 
> > > }
> > > 
> > > I don't know anything about the hardware this driver is written for,
> > > but is 'value' really intended to increment quadratically? That seems
> > > suspicious. One
> > > 
> > > wonders if the following is what was intended:
> > > [...]
> > > for (i = 0; i < msg[1].len; i++) {
> > > 
> > > ret = dw2102_op_rw(d->udev, 0xb5,
> > > 
> > > value + i, buf6, 2, DW2102_READ_MSG);
> > > 
> > > msg[1].buf[i] = buf6[0];
> > > 
> > > }
> > 
> > Accidentally, this didn't affect driver, as it reads registers by one
> > register at one time. But it should be corrected.
> 
> stv0299, along with other stv02xx family members can read and write the
> entire register map from the start register.
You misundestood me. I spoke about driver features, not about stv0299 features.
Except that, you are right.

> 
> However, there is a limitation, the buffer size of the I2C master
> hardware.

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: dw2102.c: quadratic increment intended?

2011-02-27 Thread Igor M. Liplianin
В сообщении от 27 февраля 2011 16:40:19 автор Török Edwin написал:
> Hi,
Hi

> 
> Please see http://llvm.org/bugs/show_bug.cgi?id=9259#c5, is the code
> intended to do a quadratic increment there?
> 
> While looking at this, I wonder if this isn't also a bug in the original
> code:
> 
> /* read stv0299 register */
> request = 0xb5;
> value = msg[0].buf[0];/* register */
> for (i = 0; i < msg[1].len; i++) {
> value = value + i;
> ret = dw2102_op_rw(d->udev, 0xb5,
> value, buf6, 2, DW2102_READ_MSG);
> msg[1].buf[i] = buf6[0];
> 
> }
> 
> I don't know anything about the hardware this driver is written for, but is
> 'value' really intended to increment quadratically? That seems
> suspicious. One
> wonders if the following is what was intended:
> 
> [...]
> for (i = 0; i < msg[1].len; i++) {
> ret = dw2102_op_rw(d->udev, 0xb5,
> value + i, buf6, 2, DW2102_READ_MSG);
> msg[1].buf[i] = buf6[0];
> 
> }
> 
Accidentally, this didn't affect driver, as it reads registers by one register 
at one time.
But it should be corrected.

> Best regards,
> --Edwin

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PATCHES FOR 2.6.39] ds3000 frontend, dw2102 driver patches

2011-02-25 Thread Igor M. Liplianin
Git repository was created for better handling long series of patches.
It includes dw2102 series and 5'th to 9'th from ds3000 series in right order.
Patces 1 to 4 already included in staging/for_v2.6.39 branch.

The following changes since commit a26a7a97ddce9c3152fca28e7eaacc96d9207148:

  [media] pvrusb2: Use sysfs_attr_init() where appropriate (2011-02-24 20:47:36 
-0300)

are available in the git repository at:
  git://linuxtv.org/liplianin/media_tree.git ds3000

Igor M. Liplianin (17):
  dw2102: Extend keymap parameter for not used remote
  dw2102: use separate firmwares for Prof 1100, TeVii S630, S660
  dw2102: add support for Geniatech SU3000 USB DVB-S2 card.
  dw2102: Add Terratec Cinergy S2 USB HD
  dw2102: Prof 7500: Lock LED implemented.
  dw2102: Prof 7500 remote fix.
  dw2102: Prof 1100 initialization fix
  dw2102: unnecessary NULL's removed
  dw2102: corrections for TeVii s660 LNB power control
  dw2102: fix TeVii s660 remote control
  dw2102: add support for the TeVii S480 PCIe.
  dw2102: Copyright, cards list updated
  ds3000: clean up in tune procedure
  ds3000: remove unnecessary dnxt, dcur structures
  ds3000: add carrier offset calculation
  ds3000: hardware tune algorithm
  cx88: add support for TeVii S464 PCI card.

 drivers/media/dvb/dvb-usb/dw2102.c |  507 +---
 drivers/media/dvb/frontends/ds3000.c   |  600 +---
 drivers/media/dvb/frontends/ds3000.h   |3 +
 drivers/media/dvb/frontends/stv0900.h  |2 +
 drivers/media/dvb/frontends/stv0900_core.c |   23 +-
 drivers/media/video/cx88/cx88-cards.c  |   17 +
 drivers/media/video/cx88/cx88-dvb.c|   23 +
 drivers/media/video/cx88/cx88-input.c  |1 +
 drivers/media/video/cx88/cx88.h|1 +
 9 files changed, 798 insertions(+), 379 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/9 v2] ds3000: clean up in tune procedure

2011-02-25 Thread Igor M. Liplianin
В сообщении от 25 февраля 2011 01:33:41 автор Mauro Carvalho Chehab написал:
> Em 24-02-2011 17:25, Igor M. Liplianin escreveu:
> > В сообщении от 24 февраля 2011 21:11:13 автор Mauro Carvalho Chehab написал:
> >> Em 24-02-2011 16:04, Mauro Carvalho Chehab escreveu:
> >>> Hi Igor,
> >>> 
> >>> Em 01-02-2011 20:40, Igor M. Liplianin escreveu:
> >>>> Variable 'retune' does not make sense.
> >>>> Loop is not needed for only one try.
> >>>> Remove unnecessary dprintk's.
> >>>> 
> >>>> Signed-off-by: Igor M. Liplianin 
> >>> 
> >>> This patch didn't apply. Please fix and resend.
> >> 
> >> PS.: I won't try to apply patches 7, 8 and 9, as they are all related to
> >> tune changes. They'll probably fail to apply, and, even if not failing
> >> or if I fix the conflicts, they may be breaking the driver. So, please
> >> put them on your next patch series.
> >> 
> >> thanks!
> >> Mauro
> > 
> > Hi Mauro,
> > 
> > Will do tonight.
> 
> OK.
> 
> > BTW, Why did you dropp/miss dw2102 patches?
> > They was sent before ds3000 series.
> 
> I probably missed, or they are still on my queue. While in general I apply
> patches in order, sometimes I reorder them, trying to merge first the more
> trivial ones (or the ones that I had already analyzed, like the altera
> ones). Please take a look at Patchwork. If they're there, then I'll
> probably be handling until the weekend. Otherwise, just re-send them to
> me.
Patches you already included are OK, but 5 to 9 needs(and depend) to be applied 
after dw2102 
series. I can rebase in differend order, but what's a matter?
I will create git tree somwere (probably at assembla), push there and send you 
pull request.

> 
> That's said, it is probably a good idea if you could have a git repository
> somewhere to send me patches. Git works better when there are lots of
> patches, so, works better for driver maintainers. If you want, I may
> create you an account at LinuxTV (or you may host it on any other place).
I will appreciate you very much if you create it for me, as I have a lot of 
stuff to commit.

Thank you in advance.
Igor
> 
> Thanks,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/9 v2] ds3000: clean up in tune procedure

2011-02-24 Thread Igor M. Liplianin
В сообщении от 24 февраля 2011 22:25:35 автор Igor M. Liplianin написал:
> В сообщении от 24 февраля 2011 21:11:13 автор Mauro Carvalho Chehab написал:
> > Em 24-02-2011 16:04, Mauro Carvalho Chehab escreveu:
> > > Hi Igor,
> > > 
> > > Em 01-02-2011 20:40, Igor M. Liplianin escreveu:
> > >> Variable 'retune' does not make sense.
> > >> Loop is not needed for only one try.
> > >> Remove unnecessary dprintk's.
> > >> 
> > >> Signed-off-by: Igor M. Liplianin 
> > > 
> > > This patch didn't apply. Please fix and resend.
> > 
> > PS.: I won't try to apply patches 7, 8 and 9, as they are all related to
> > tune changes. They'll probably fail to apply, and, even if not failing or
> > if I fix the conflicts, they may be breaking the driver. So, please put
> > them on your next patch series.
> > 
> > thanks!
> > Mauro
> 
> Hi Mauro,
> 
> Will do tonight.
> 
> BTW, Why did you dropp/miss dw2102 patches?
> They was sent before ds3000 series.
Do I must resend them?

> 
> Thank you in advance.

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/9 v2] ds3000: clean up in tune procedure

2011-02-24 Thread Igor M. Liplianin
В сообщении от 24 февраля 2011 21:11:13 автор Mauro Carvalho Chehab написал:
> Em 24-02-2011 16:04, Mauro Carvalho Chehab escreveu:
> > Hi Igor,
> > 
> > Em 01-02-2011 20:40, Igor M. Liplianin escreveu:
> >> Variable 'retune' does not make sense.
> >> Loop is not needed for only one try.
> >> Remove unnecessary dprintk's.
> >> 
> >> Signed-off-by: Igor M. Liplianin 
> > 
> > This patch didn't apply. Please fix and resend.
> 
> PS.: I won't try to apply patches 7, 8 and 9, as they are all related to
> tune changes. They'll probably fail to apply, and, even if not failing or
> if I fix the conflicts, they may be breaking the driver. So, please put
> them on your next patch series.
> 
> thanks!
> Mauro
Hi Mauro,

Will do tonight.

BTW, Why did you dropp/miss dw2102 patches?
They was sent before ds3000 series.

Thank you in advance.

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DM1105: could not attach frontend 195d:1105

2011-02-02 Thread Igor M. Liplianin
В сообщении от 2 февраля 2011 20:39:33 автор Igor M. Liplianin написал:
> В сообщении от 1 февраля 2011 07:17:19 автор Matt Vickers написал:
> > On 1/02/2011 6:55 a.m., Igor M. Liplianin wrote:
> > > В сообщении от 31 января 2011 11:33:54 автор Matt Vickers написал:
> > >> On 23/10/2010 10:20 p.m., Igor M. Liplianin wrote:
> > >>> В сообщении от 10 марта 2010 14:15:49 автор Hendrik Skarpeid написал:
> > >>>> Igor M. Liplianin skrev:
> > >>>>> On 3 марта 2010 18:42:42 Hendrik Skarpeid wrote:
> > >>>>>> Igor M. Liplianin wrote:
> > >>>>>>> Now to find GPIO's for LNB power control and ... watch TV :)
> > >>>>>> 
> > >>>>>> Yep. No succesful tuning at the moment. There might also be an
> > >>>>>> issue with the reset signal and writing to GPIOCTR, as the module
> > >>>>>> at the moment loads succesfully only once.
> > >>>>>> As far as I can make out, the LNB power control is probably GPIO
> > >>>>>> 16 and 17, not sure which is which, and how they work.
> > >>>>>> GPIO15 is wired to tuner #reset
> > >>>>> 
> > >>>>> New patch to test
> > >>>> 
> > >>>> I think the LNB voltage may be a little to high on my card, 14.5V
> > >>>> and 20V. I would be a little more happy if they were 14 and 19, 13
> > >>>> and 18 would be perfect.
> > >>>> Anyways, as Igor pointet out, I don't have any signal from the LNB,
> > >>>> checked with another tuner card. It's a quad LNB, and the other
> > >>>> outputs are fine. Maybe it's' toasted from to high supply voltage! I
> > >>>> little word of warning then.
> > >>>> Anyways, here's my tweaked driver.
> > >>> 
> > >>> Here is reworked patch for clear GPIO's handling.
> > >>> It allows to support I2C on GPIO's and per board LNB control through
> > >>> GPIO's. Also incuded support for Hendrik's card.
> > >>> I think it is clear how to change and test GPIO's for LNB and other
> > >>> stuff now.
> > >>> 
> > >>> To Hendrik:
> > >>> Not shure, but there is maybe GPIO for raise/down LNB voltage a
> > >>> little (~1v). It is used for long coaxial lines to compensate
> > >>> voltage dropping.
> > >>> 
> > >>> Signed-off-by: Igor M. Liplianin
> > >> 
> > >> Hi Igor,
> > >> 
> > >> I have a brandless DVB-S tv tuner card also, with a dm1105n chip. I
> > >> was getting the "DM1105: could not attach frontend 195d:1105" message
> > >> with the latest kernel also, but I applied this patch to the dm1105
> > >> module and now the card's being recognised  (though is still listed
> > >> as an ethernet controller with lspci)
> > >> 
> > >> My dmesg output is:
> > >> 
> > >> dm1105 :01:05.0: PCI INT A ->  GSI 17 (level, low) ->  IRQ 17
> > >> DVB: registering new adapter (dm1105)
> > >> dm1105 :01:05.0: MAC 00:00:00:00:00:00
> > >> DVB: registering adapter 0 frontend 0 (SL SI21XX DVB-S)...
> > >> Registered IR keymap rc-dm1105-nec
> > >> input: DVB on-card IR receiver as
> > >> /devices/pci:00/:00:1e.0/:01:05.0/rc/rc0/input6
> > >> rc0: DVB on-card IR receiver as
> > >> /devices/pci:00/:00:1e.0/:01:05.0/rc/rc0
> > >> 
> > >> The card is one of these:
> > >> http://www.hongsun.biz/ProView.asp?ID=90
> > >> 
> > >> Scanning doesn't appear to give me any results.  Should this be
> > >> working?
> > >> 
> > >>Anything I can do to test the card out for you?
> > >> 
> > >> Cheers,
> > >> Matt.
> > > 
> > > Hi Matt,
> > > Is there any label on tuner can?
> > > Have you a close look picture of PCB ?
> > > 
> > > Cheers,
> > > Igor.
> > 
> > Hi Igor,
> > 
> > The label on the tuner can is SP1514LHb S1009, so I'm guessing this is a
> > near-identical card to the one that Paul was asking you about in January
> > 
> > of last year, e.g:
> > >  1: DVB-S
> > >  5: 16cc
> > >  1: Unsure, but 

Re: DM1105: could not attach frontend 195d:1105

2011-02-02 Thread Igor M. Liplianin
В сообщении от 1 февраля 2011 07:17:19 автор Matt Vickers написал:
> On 1/02/2011 6:55 a.m., Igor M. Liplianin wrote:
> > В сообщении от 31 января 2011 11:33:54 автор Matt Vickers написал:
> >> On 23/10/2010 10:20 p.m., Igor M. Liplianin wrote:
> >>> В сообщении от 10 марта 2010 14:15:49 автор Hendrik Skarpeid написал:
> >>>> Igor M. Liplianin skrev:
> >>>>> On 3 марта 2010 18:42:42 Hendrik Skarpeid wrote:
> >>>>>> Igor M. Liplianin wrote:
> >>>>>>> Now to find GPIO's for LNB power control and ... watch TV :)
> >>>>>> 
> >>>>>> Yep. No succesful tuning at the moment. There might also be an issue
> >>>>>> with the reset signal and writing to GPIOCTR, as the module at the
> >>>>>> moment loads succesfully only once.
> >>>>>> As far as I can make out, the LNB power control is probably GPIO 16
> >>>>>> and 17, not sure which is which, and how they work.
> >>>>>> GPIO15 is wired to tuner #reset
> >>>>> 
> >>>>> New patch to test
> >>>> 
> >>>> I think the LNB voltage may be a little to high on my card, 14.5V and
> >>>> 20V. I would be a little more happy if they were 14 and 19, 13 and 18
> >>>> would be perfect.
> >>>> Anyways, as Igor pointet out, I don't have any signal from the LNB,
> >>>> checked with another tuner card. It's a quad LNB, and the other
> >>>> outputs are fine. Maybe it's' toasted from to high supply voltage! I
> >>>> little word of warning then.
> >>>> Anyways, here's my tweaked driver.
> >>> 
> >>> Here is reworked patch for clear GPIO's handling.
> >>> It allows to support I2C on GPIO's and per board LNB control through
> >>> GPIO's. Also incuded support for Hendrik's card.
> >>> I think it is clear how to change and test GPIO's for LNB and other
> >>> stuff now.
> >>> 
> >>> To Hendrik:
> >>>   Not shure, but there is maybe GPIO for raise/down LNB voltage a little
> >>>   (~1v). It is used for long coaxial lines to compensate voltage
> >>>   dropping.
> >>> 
> >>> Signed-off-by: Igor M. Liplianin
> >> 
> >> Hi Igor,
> >> 
> >> I have a brandless DVB-S tv tuner card also, with a dm1105n chip. I was
> >> getting the "DM1105: could not attach frontend 195d:1105" message with
> >> the latest kernel also, but I applied this patch to the dm1105 module
> >> and now the card's being recognised  (though is still listed as an
> >> ethernet controller with lspci)
> >> 
> >> My dmesg output is:
> >> 
> >> dm1105 :01:05.0: PCI INT A ->  GSI 17 (level, low) ->  IRQ 17
> >> DVB: registering new adapter (dm1105)
> >> dm1105 :01:05.0: MAC 00:00:00:00:00:00
> >> DVB: registering adapter 0 frontend 0 (SL SI21XX DVB-S)...
> >> Registered IR keymap rc-dm1105-nec
> >> input: DVB on-card IR receiver as
> >> /devices/pci:00/:00:1e.0/:01:05.0/rc/rc0/input6
> >> rc0: DVB on-card IR receiver as
> >> /devices/pci:00/:00:1e.0/:01:05.0/rc/rc0
> >> 
> >> The card is one of these:
> >> http://www.hongsun.biz/ProView.asp?ID=90
> >> 
> >> Scanning doesn't appear to give me any results.  Should this be working?
> >> 
> >>Anything I can do to test the card out for you?
> >> 
> >> Cheers,
> >> Matt.
> > 
> > Hi Matt,
> > Is there any label on tuner can?
> > Have you a close look picture of PCB ?
> > 
> > Cheers,
> > Igor.
> 
> Hi Igor,
> 
> The label on the tuner can is SP1514LHb S1009, so I'm guessing this is a
> near-identical card to the one that Paul was asking you about in January
> 
> of last year, e.g:
> >  1: DVB-S
> >  5: 16cc
> >  1: Unsure, but it has an LNB in and an LNB out, so I guess it does have
> >  loop through?
> >  4: Si2109
> >  L: Si labs
> >  H: Horizontal
> >  b: Lead free
> 
> Here are two images I took of the card:
> 
> A view of the entire board:
> 
> http://matt.vicke.rs/pics/pcb_full.jpg
> 
> And here is a closer view of the board between the tuner and the dm1105n
> chip.
> 
> http://matt.vicke.rs/pics/pcb_detail.jpg
> 
> With your patch and the card=4 parameter the card is recognised, and the
> dvb device created. Scanning will run (I'm attempting to locate channels
> on Optus D1, which I can successfully scan using a set top box, so the
> dish is correctly aligned), but the card reports tuning failed on all of
> the Optus D1 frequencies that I attempt. I also tried running w_scan but
> had no success.
> 
> Cheers,
> Matt.
Hi Matt,

Did you read this post?
http://www.mail-archive.com/linux-media@vger.kernel.org/msg17269.html
It seems the card needs some soldering :(

Cheers
Igor
> 
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-media"
> >> in the body of a message to majord...@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9 v2] ds3000: remove unnecessary dnxt, dcur structures

2011-02-01 Thread Igor M. Liplianin
All necessary parameters already stored in frontend cache.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |  108 -
 1 files changed, 13 insertions(+), 95 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index 11f1aa2..b2ba5f4 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -229,31 +229,11 @@ static u8 ds3000_dvbs2_init_tab[] = {
0xb8, 0x00,
 };
 
-/* DS3000 doesn't need some parameters as input and auto-detects them */
-/* save input from the application of those parameters */
-struct ds3000_tuning {
-   u32 frequency;
-   u32 symbol_rate;
-   fe_spectral_inversion_t inversion;
-   enum fe_code_rate fec;
-
-   /* input values */
-   u8 inversion_val;
-   fe_modulation_t delivery;
-   u8 rolloff;
-};
-
 struct ds3000_state {
struct i2c_adapter *i2c;
const struct ds3000_config *config;
-
struct dvb_frontend frontend;
-
-   struct ds3000_tuning dcur;
-   struct ds3000_tuning dnxt;
-
u8 skip_fw_load;
-
/* previous uncorrected block counter for DVB-S2 */
u16 prevUCBS2;
 };
@@ -401,45 +381,6 @@ static int ds3000_tuner_readreg(struct ds3000_state 
*state, u8 reg)
return b1[0];
 }
 
-static int ds3000_set_inversion(struct ds3000_state *state,
-   fe_spectral_inversion_t inversion)
-{
-   dprintk("%s(%d)\n", __func__, inversion);
-
-   switch (inversion) {
-   case INVERSION_OFF:
-   case INVERSION_ON:
-   case INVERSION_AUTO:
-   break;
-   default:
-   return -EINVAL;
-   }
-
-   state->dnxt.inversion = inversion;
-
-   return 0;
-}
-
-static int ds3000_set_symbolrate(struct ds3000_state *state, u32 rate)
-{
-   int ret = 0;
-
-   dprintk("%s()\n", __func__);
-
-   dprintk("%s() symbol_rate = %d\n", __func__, state->dnxt.symbol_rate);
-
-   /*  check if symbol rate is within limits */
-   if ((state->dnxt.symbol_rate >
-   state->frontend.ops.info.symbol_rate_max) ||
-   (state->dnxt.symbol_rate <
-   state->frontend.ops.info.symbol_rate_min))
-   ret = -EOPNOTSUPP;
-
-   state->dnxt.symbol_rate = rate;
-
-   return ret;
-}
-
 static int ds3000_load_firmware(struct dvb_frontend *fe,
const struct firmware *fw);
 
@@ -790,13 +731,6 @@ static int ds3000_read_ucblocks(struct dvb_frontend *fe, 
u32 *ucblocks)
return 0;
 }
 
-/* Overwrite the current tuning params, we are about to tune */
-static void ds3000_clone_params(struct dvb_frontend *fe)
-{
-   struct ds3000_state *state = fe->demodulator_priv;
-   memcpy(&state->dcur, &state->dnxt, sizeof(state->dcur));
-}
-
 static int ds3000_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
 {
struct ds3000_state *state = fe->demodulator_priv;
@@ -1027,22 +961,6 @@ static int ds3000_tune(struct dvb_frontend *fe,
 
dprintk("%s() ", __func__);
 
-   state->dnxt.delivery = c->modulation;
-   state->dnxt.frequency = c->frequency;
-   state->dnxt.rolloff = 2; /* fixme */
-   state->dnxt.fec = c->fec_inner;
-
-   ret = ds3000_set_inversion(state, p->inversion);
-   if (ret !=  0)
-   return ret;
-
-   ret = ds3000_set_symbolrate(state, c->symbol_rate);
-   if (ret !=  0)
-   return ret;
-
-   /* discard the 'current' tuning parameters and prepare to tune */
-   ds3000_clone_params(fe);
-
/* Reset status register */
status = 0;
/* Tune */
@@ -1053,14 +971,14 @@ static int ds3000_tune(struct dvb_frontend *fe,
ds3000_tuner_writereg(state, 0x08, 0x01);
ds3000_tuner_writereg(state, 0x00, 0x01);
/* calculate and set freq divider */
-   if (state->dcur.frequency < 1146000) {
+   if (p->frequency < 1146000) {
ds3000_tuner_writereg(state, 0x10, 0x11);
-   ndiv = ((state->dcur.frequency * (6 + 8) * 4) +
+   ndiv = ((p->frequency * (6 + 8) * 4) +
(DS3000_XTAL_FREQ / 2)) /
DS3000_XTAL_FREQ - 1024;
} else {
ds3000_tuner_writereg(state, 0x10, 0x01);
-   ndiv = ((state->dcur.frequency * (6 + 8) * 2) +
+   ndiv = ((p->frequency * (6 + 8) * 2) +
(DS3000_XTAL_FREQ / 2)) /
DS3000_XTAL_FREQ - 1024;
}
@@ -1106,8 +1024,8 @@ static int ds3000_tune(struct dvb_frontend *fe,
ds3000_tuner_writereg(state, 0x50, 0x00);
msleep(5);
 
-   f3db = ((sta

[PATCH 9/9 v2] ds3000: hardware tune algorithm

2011-02-01 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index e2037b5..3c6e08e 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -967,22 +967,21 @@ static int ds3000_set_carrier_offset(struct dvb_frontend 
*fe,
return 0;
 }
 
-static int ds3000_tune(struct dvb_frontend *fe,
+static int ds3000_set_frontend(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p)
 {
struct ds3000_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
 
int i;
-   u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf, div4;
+   fe_status_t status;
+   u8 mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf, div4;
s32 offset_khz;
u16 value, ndiv;
u32 f3db;
 
dprintk("%s() ", __func__);
 
-   /* Reset status register */
-   status = 0;
/* Tune */
/* unknown */
ds3000_tuner_writereg(state, 0x07, 0x02);
@@ -1218,10 +1217,16 @@ static int ds3000_tune(struct dvb_frontend *fe,
return 1;
 }
 
+static int ds3000_tune(struct dvb_frontend *fe,
+   struct dvb_frontend_parameters *p)
+{
+   return ds3000_set_frontend(fe, p);
+}
+
 static enum dvbfe_algo ds3000_get_algo(struct dvb_frontend *fe)
 {
dprintk("%s()\n", __func__);
-   return DVBFE_ALGO_SW;
+   return DVBFE_ALGO_HW;
 }
 
 /*
@@ -1296,7 +1301,8 @@ static struct dvb_frontend_ops ds3000_ops = {
 
.set_property = ds3000_set_property,
.get_property = ds3000_get_property,
-   .set_frontend = ds3000_tune,
+   .set_frontend = ds3000_set_frontend,
+   .tune = ds3000_tune,
 };
 
 module_param(debug, int, 0644);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9 v2] ds3000: add carrier offset calculation

2011-02-01 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |   30 --
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index b2ba5f4..e2037b5 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -948,6 +948,25 @@ static int ds3000_get_property(struct dvb_frontend *fe,
return 0;
 }
 
+static int ds3000_set_carrier_offset(struct dvb_frontend *fe,
+   s32 carrier_offset_khz)
+{
+   struct ds3000_state *state = fe->demodulator_priv;
+   s32 tmp;
+
+   tmp = carrier_offset_khz;
+   tmp *= 65536;
+   tmp = (2 * tmp + DS3000_SAMPLE_RATE) / (2 * DS3000_SAMPLE_RATE);
+
+   if (tmp < 0)
+   tmp += 65536;
+
+   ds3000_writereg(state, 0x5f, tmp >> 8);
+   ds3000_writereg(state, 0x5e, tmp & 0xff);
+
+   return 0;
+}
+
 static int ds3000_tune(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p)
 {
@@ -955,7 +974,8 @@ static int ds3000_tune(struct dvb_frontend *fe,
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
 
int i;
-   u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf;
+   u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf, div4;
+   s32 offset_khz;
u16 value, ndiv;
u32 f3db;
 
@@ -970,9 +990,12 @@ static int ds3000_tune(struct dvb_frontend *fe,
ds3000_tuner_writereg(state, 0x60, 0x79);
ds3000_tuner_writereg(state, 0x08, 0x01);
ds3000_tuner_writereg(state, 0x00, 0x01);
+   div4 = 0;
+
/* calculate and set freq divider */
if (p->frequency < 1146000) {
ds3000_tuner_writereg(state, 0x10, 0x11);
+   div4 = 1;
ndiv = ((p->frequency * (6 + 8) * 4) +
(DS3000_XTAL_FREQ / 2)) /
DS3000_XTAL_FREQ - 1024;
@@ -1076,6 +1099,9 @@ static int ds3000_tune(struct dvb_frontend *fe,
ds3000_tuner_writereg(state, 0x50, 0x00);
msleep(60);
 
+   offset_khz = (ndiv - ndiv % 2 + 1024) * DS3000_XTAL_FREQ
+   / (6 + 8) / (div4 + 1) / 2 - p->frequency;
+
/* ds3000 global reset */
ds3000_writereg(state, 0x07, 0x80);
ds3000_writereg(state, 0x07, 0x00);
@@ -1179,7 +1205,7 @@ static int ds3000_tune(struct dvb_frontend *fe,
/* start ds3000 build-in uC */
ds3000_writereg(state, 0xb2, 0x00);
 
-   /* TODO: calculate and set carrier offset */
+   ds3000_set_carrier_offset(fe, offset_khz);
 
for (i = 0; i < 30 ; i++) {
ds3000_read_status(fe, &status);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9 v2] ds3000: yet clean up in tune procedure

2011-02-01 Thread Igor M. Liplianin
Remove a lot of debug messages and delays.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |   50 +-
 1 files changed, 7 insertions(+), 43 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index 7c61936..11f1aa2 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -536,25 +536,6 @@ static int ds3000_set_voltage(struct dvb_frontend *fe, 
fe_sec_voltage_t 
voltage)
return 0;
 }
 
-static void ds3000_dump_registers(struct dvb_frontend *fe)
-{
-   struct ds3000_state *state = fe->demodulator_priv;
-   int x, y, reg = 0, val;
-
-   for (y = 0; y < 16; y++) {
-   dprintk("%s: %02x: ", __func__, y);
-   for (x = 0; x < 16; x++) {
-   reg = (y << 4) + x;
-   val = ds3000_readreg(state, reg);
-   if (x != 15)
-   dprintk("%02x ",  val);
-   else
-   dprintk("%02x\n", val);
-   }
-   }
-   dprintk("%s: -- DS3000 DUMP DONE --\n", __func__);
-}
-
 static int ds3000_read_status(struct dvb_frontend *fe, fe_status_t* status)
 {
struct ds3000_state *state = fe->demodulator_priv;
@@ -589,16 +570,6 @@ static int ds3000_read_status(struct dvb_frontend *fe, 
fe_status_t* status)
return 0;
 }
 
-#define FE_IS_TUNED (FE_HAS_SIGNAL + FE_HAS_LOCK)
-static int ds3000_is_tuned(struct dvb_frontend *fe)
-{
-   fe_status_t tunerstat;
-
-   ds3000_read_status(fe, &tunerstat);
-
-   return ((tunerstat & FE_IS_TUNED) == FE_IS_TUNED);
-}
-
 /* read DS3000 BER value */
 static int ds3000_read_ber(struct dvb_frontend *fe, u32* ber)
 {
@@ -1049,7 +1020,7 @@ static int ds3000_tune(struct dvb_frontend *fe,
struct ds3000_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
 
-   int ret = 0, i;
+   int i;
u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf;
u16 value, ndiv;
u32 f3db;
@@ -1292,22 +1263,15 @@ static int ds3000_tune(struct dvb_frontend *fe,
 
/* TODO: calculate and set carrier offset */
 
-   /* wait before retrying */
for (i = 0; i < 30 ; i++) {
-   if (ds3000_is_tuned(fe)) {
-   dprintk("%s: Tuned\n", __func__);
-   ds3000_dump_registers(fe);
-   goto tuned;
-   }
-   msleep(1);
-   }
-
-   dprintk("%s: Not tuned\n", __func__);
-   ds3000_dump_registers(fe);
+   ds3000_read_status(fe, &status);
+   if (status && FE_HAS_LOCK)
+   return 0;
 
+   msleep(10);
+   }
 
-tuned:
-   return ret;
+   return 1;
 }
 
 static enum dvbfe_algo ds3000_get_algo(struct dvb_frontend *fe)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9 v2] ds3000: clean up in tune procedure

2011-02-01 Thread Igor M. Liplianin
Variable 'retune' does not make sense.
Loop is not needed for only one try.
Remove unnecessary dprintk's.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |  442 +-
 1 files changed, 216 insertions(+), 226 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index 3373890..7c61936 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -1049,7 +1049,7 @@ static int ds3000_tune(struct dvb_frontend *fe,
struct ds3000_state *state = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
 
-   int ret = 0, retune, i;
+   int ret = 0, i;
u8 status, mlpf, mlpf_new, mlpf_max, mlpf_min, nlpf;
u16 value, ndiv;
u32 f3db;
@@ -1072,249 +1072,239 @@ static int ds3000_tune(struct dvb_frontend *fe,
/* discard the 'current' tuning parameters and prepare to tune */
ds3000_clone_params(fe);
 
-   retune = 1; /* try 1 times */
-   dprintk("%s:   retune = %d\n", __func__, retune);
-   dprintk("%s:   frequency   = %d\n", __func__, state->dcur.frequency);
-   dprintk("%s:   symbol_rate = %d\n", __func__, state->dcur.symbol_rate);
-   dprintk("%s:   FEC   = %d \n", __func__,
-   state->dcur.fec);
-   dprintk("%s:   Inversion   = %d\n", __func__, state->dcur.inversion);
-
-   do {
-   /* Reset status register */
-   status = 0;
-   /* Tune */
-   /* unknown */
-   ds3000_tuner_writereg(state, 0x07, 0x02);
-   ds3000_tuner_writereg(state, 0x10, 0x00);
-   ds3000_tuner_writereg(state, 0x60, 0x79);
-   ds3000_tuner_writereg(state, 0x08, 0x01);
-   ds3000_tuner_writereg(state, 0x00, 0x01);
-   /* calculate and set freq divider */
-   if (state->dcur.frequency < 1146000) {
-   ds3000_tuner_writereg(state, 0x10, 0x11);
-   ndiv = ((state->dcur.frequency * (6 + 8) * 4) +
-   (DS3000_XTAL_FREQ / 2)) /
-   DS3000_XTAL_FREQ - 1024;
-   } else {
-   ds3000_tuner_writereg(state, 0x10, 0x01);
-   ndiv = ((state->dcur.frequency * (6 + 8) * 2) +
-   (DS3000_XTAL_FREQ / 2)) /
-   DS3000_XTAL_FREQ - 1024;
-   }
+   /* Reset status register */
+   status = 0;
+   /* Tune */
+   /* unknown */
+   ds3000_tuner_writereg(state, 0x07, 0x02);
+   ds3000_tuner_writereg(state, 0x10, 0x00);
+   ds3000_tuner_writereg(state, 0x60, 0x79);
+   ds3000_tuner_writereg(state, 0x08, 0x01);
+   ds3000_tuner_writereg(state, 0x00, 0x01);
+   /* calculate and set freq divider */
+   if (state->dcur.frequency < 1146000) {
+   ds3000_tuner_writereg(state, 0x10, 0x11);
+   ndiv = ((state->dcur.frequency * (6 + 8) * 4) +
+   (DS3000_XTAL_FREQ / 2)) /
+   DS3000_XTAL_FREQ - 1024;
+   } else {
+   ds3000_tuner_writereg(state, 0x10, 0x01);
+   ndiv = ((state->dcur.frequency * (6 + 8) * 2) +
+   (DS3000_XTAL_FREQ / 2)) /
+   DS3000_XTAL_FREQ - 1024;
+   }
 
-   ds3000_tuner_writereg(state, 0x01, (ndiv & 0x0f00) >> 8);
-   ds3000_tuner_writereg(state, 0x02, ndiv & 0x00ff);
-
-   /* set pll */
-   ds3000_tuner_writereg(state, 0x03, 0x06);
-   ds3000_tuner_writereg(state, 0x51, 0x0f);
-   ds3000_tuner_writereg(state, 0x51, 0x1f);
-   ds3000_tuner_writereg(state, 0x50, 0x10);
-   ds3000_tuner_writereg(state, 0x50, 0x00);
-   msleep(5);
-
-   /* unknown */
-   ds3000_tuner_writereg(state, 0x51, 0x17);
-   ds3000_tuner_writereg(state, 0x51, 0x1f);
-   ds3000_tuner_writereg(state, 0x50, 0x08);
-   ds3000_tuner_writereg(state, 0x50, 0x00);
-   msleep(5);
-
-   value = ds3000_tuner_readreg(state, 0x3d);
-   value &= 0x0f;
-   if ((value > 4) && (value < 15)) {
-   value -= 3;
-   if (value < 4)
-   value = 4;
-   value = ((value << 3) | 0x01) & 0x79;
-   }
+   ds3000_tuner_writereg(state, 0x01, (ndiv & 0x0f00) >> 8);
+   ds3000_tuner_writereg(state, 0x02, ndiv & 0x00ff);
+
+   /* set pll */
+   ds3000_tu

[PATCH 4/9 v2] ds3000: loading firmware during demod init

2011-02-01 Thread Igor M. Liplianin
Speed up tuning, as firmware is not necessary to load every attempt to tune

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |   14 ++
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index 02ba759..3373890 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -1056,14 +1056,6 @@ static int ds3000_tune(struct dvb_frontend *fe,
 
dprintk("%s() ", __func__);
 
-   /* Load the firmware if required */
-   ret = ds3000_firmware_ondemand(fe);
-   if (ret != 0) {
-   printk(KERN_ERR "%s: Unable initialise the firmware\n",
-   __func__);
-   return ret;
-   }
-
state->dnxt.delivery = c->modulation;
state->dnxt.frequency = c->frequency;
state->dnxt.rolloff = 2; /* fixme */
@@ -1353,6 +1345,12 @@ static int ds3000_initfe(struct dvb_frontend *fe)
ds3000_tuner_writereg(state, 0x42, 0x73);
ds3000_tuner_writereg(state, 0x05, 0x01);
ds3000_tuner_writereg(state, 0x62, 0xf5);
+   /* Load the firmware if required */
+   ret = ds3000_firmware_ondemand(fe);
+   if (ret != 0) {
+   printk(KERN_ERR "%s: Unable initialize firmware\n", __func__);
+   return ret;
+   }
 
return 0;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/9 v2] ds3000: loading firmware in bigger chunks

2011-02-01 Thread Igor M. Liplianin
Decrease firmware loading time. Before it is ~4000 i2c calls,
now it is ~256 i2c calls to load ds3000 firmware.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index b20005c..02ba759 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -305,7 +305,7 @@ static int ds3000_writeFW(struct ds3000_state *state, int 
reg,
struct i2c_msg msg;
u8 *buf;
 
-   buf = kmalloc(3, GFP_KERNEL);
+   buf = kmalloc(33, GFP_KERNEL);
if (buf == NULL) {
printk(KERN_ERR "Unable to kmalloc\n");
ret = -ENOMEM;
@@ -317,10 +317,10 @@ static int ds3000_writeFW(struct ds3000_state *state, int 
reg,
msg.addr = state->config->demod_address;
msg.flags = 0;
msg.buf = buf;
-   msg.len = 3;
+   msg.len = 33;
 
-   for (i = 0; i < len; i += 2) {
-   memcpy(buf + 1, data + i, 2);
+   for (i = 0; i < len; i += 32) {
+   memcpy(buf + 1, data + i, 32);
 
dprintk("%s: write reg 0x%02x, len = %d\n", __func__, reg, len);
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9 v2] ds3000: decrease mpeg clock output

2011-02-01 Thread Igor M. Liplianin
TeVii s480 works fine with that on DVB-S2 channels

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index 4773916..b20005c 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -1230,7 +1230,7 @@ static int ds3000_tune(struct dvb_frontend *fe,
ds3000_writereg(state,
ds3000_dvbs2_init_tab[i],
ds3000_dvbs2_init_tab[i + 1]);
-   ds3000_writereg(state, 0xfe, 0x54);
+   ds3000_writereg(state, 0xfe, 0x98);
break;
default:
return 1;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9 v2] ds3000: fill in demod init function

2011-02-01 Thread Igor M. Liplianin
Make some initializations in init, not in tune function

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/ds3000.c |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb/frontends/ds3000.c 
b/drivers/media/dvb/frontends/ds3000.c
index 125dfad..4773916 100644
--- a/drivers/media/dvb/frontends/ds3000.c
+++ b/drivers/media/dvb/frontends/ds3000.c
@@ -1092,10 +1092,6 @@ static int ds3000_tune(struct dvb_frontend *fe,
/* Reset status register */
status = 0;
/* Tune */
-   /* TS2020 init */
-   ds3000_tuner_writereg(state, 0x42, 0x73);
-   ds3000_tuner_writereg(state, 0x05, 0x01);
-   ds3000_tuner_writereg(state, 0x62, 0xf5);
/* unknown */
ds3000_tuner_writereg(state, 0x07, 0x02);
ds3000_tuner_writereg(state, 0x10, 0x00);
@@ -1345,7 +1341,19 @@ static enum dvbfe_algo ds3000_get_algo(struct 
dvb_frontend *fe)
  */
 static int ds3000_initfe(struct dvb_frontend *fe)
 {
+   struct ds3000_state *state = fe->demodulator_priv;
+   int ret;
+
dprintk("%s()\n", __func__);
+   /* hard reset */
+   ds3000_writereg(state, 0x08, 0x01 | ds3000_readreg(state, 0x08));
+   msleep(1);
+
+   /* TS2020 init */
+   ds3000_tuner_writereg(state, 0x42, 0x73);
+   ds3000_tuner_writereg(state, 0x05, 0x01);
+   ds3000_tuner_writereg(state, 0x62, 0xf5);
+
return 0;
 }
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DM1105: could not attach frontend 195d:1105

2011-01-31 Thread Igor M. Liplianin
В сообщении от 31 января 2011 11:33:54 автор Matt Vickers написал:
> On 23/10/2010 10:20 p.m., Igor M. Liplianin wrote:
> > В сообщении от 10 марта 2010 14:15:49 автор Hendrik Skarpeid написал:
> >> Igor M. Liplianin skrev:
> >>> On 3 марта 2010 18:42:42 Hendrik Skarpeid wrote:
> >>>> Igor M. Liplianin wrote:
> >>>>> Now to find GPIO's for LNB power control and ... watch TV :)
> >>>> 
> >>>> Yep. No succesful tuning at the moment. There might also be an issue
> >>>> with the reset signal and writing to GPIOCTR, as the module at the
> >>>> moment loads succesfully only once.
> >>>> As far as I can make out, the LNB power control is probably GPIO 16
> >>>> and 17, not sure which is which, and how they work.
> >>>> GPIO15 is wired to tuner #reset
> >>> 
> >>> New patch to test
> >> 
> >> I think the LNB voltage may be a little to high on my card, 14.5V and
> >> 20V. I would be a little more happy if they were 14 and 19, 13 and 18
> >> would be perfect.
> >> Anyways, as Igor pointet out, I don't have any signal from the LNB,
> >> checked with another tuner card. It's a quad LNB, and the other outputs
> >> are fine. Maybe it's' toasted from to high supply voltage! I little word
> >> of warning then.
> >> Anyways, here's my tweaked driver.
> > 
> > Here is reworked patch for clear GPIO's handling.
> > It allows to support I2C on GPIO's and per board LNB control through
> > GPIO's. Also incuded support for Hendrik's card.
> > I think it is clear how to change and test GPIO's for LNB and other stuff
> > now.
> > 
> > To Hendrik:
> > Not shure, but there is maybe GPIO for raise/down LNB voltage a little
> > (~1v). It is used for long coaxial lines to compensate voltage
> > dropping.
> > 
> > Signed-off-by: Igor M. Liplianin
> 
> Hi Igor,
> 
> I have a brandless DVB-S tv tuner card also, with a dm1105n chip. I was
> getting the "DM1105: could not attach frontend 195d:1105" message with
> the latest kernel also, but I applied this patch to the dm1105 module
> and now the card's being recognised  (though is still listed as an
> ethernet controller with lspci)
> 
> My dmesg output is:
> 
> dm1105 :01:05.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
> DVB: registering new adapter (dm1105)
> dm1105 :01:05.0: MAC 00:00:00:00:00:00
> DVB: registering adapter 0 frontend 0 (SL SI21XX DVB-S)...
> Registered IR keymap rc-dm1105-nec
> input: DVB on-card IR receiver as
> /devices/pci:00/:00:1e.0/:01:05.0/rc/rc0/input6
> rc0: DVB on-card IR receiver as
> /devices/pci:00/:00:1e.0/:01:05.0/rc/rc0
> 
> The card is one of these:
> http://www.hongsun.biz/ProView.asp?ID=90
> 
> Scanning doesn't appear to give me any results.  Should this be working?
>   Anything I can do to test the card out for you?
> 
> Cheers,
> Matt.
Hi Matt,
Is there any label on tuner can?
Have you a close look picture of PCB ?

Cheers,
Igor.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9 v3] cx23885: implement tuner_bus parameter for cx23885_board structure.

2011-01-25 Thread Igor M. Liplianin
There is two external I2C buses in cx23885 chip.
Currently, analog tuners supported for second I2C bus only
In NetUP Dual DVB-T/C CI RF card tuners connected to first bus
So, in order to support analog tuners sitting on first bus
we need modifications.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |5 +
 drivers/media/video/cx23885/cx23885-core.c  |5 +++--
 drivers/media/video/cx23885/cx23885-video.c |7 ---
 drivers/media/video/cx23885/cx23885.h   |2 ++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index a3fe26c..fb2045a 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -94,6 +94,7 @@ struct cx23885_board cx23885_boards[] = {
.portc  = CX23885_MPEG_DVB,
.tuner_type = TUNER_PHILIPS_TDA8290,
.tuner_addr = 0x42, /* 0x84 >> 1 */
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   =   CX25840_VIN7_CH3 |
@@ -216,6 +217,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Mygica X8506 DMB-TH",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -245,6 +247,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Magic-Pro ProHDTV Extreme 2",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -293,6 +296,7 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.tuner_type = TUNER_XC2028,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   = CX25840_VIN2_CH1 |
@@ -317,6 +321,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "GoTView X5 3D Hybrid",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {{
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 9ad4c9c..d621d76 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -970,11 +970,12 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
/* Assume some sensible defaults */
dev->tuner_type = cx23885_boards[dev->board].tuner_type;
dev->tuner_addr = cx23885_boards[dev->board].tuner_addr;
+   dev->tuner_bus = cx23885_boards[dev->board].tuner_bus;
dev->radio_type = cx23885_boards[dev->board].radio_type;
dev->radio_addr = cx23885_boards[dev->board].radio_addr;
 
-   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x\n",
-   __func__, dev->tuner_type, dev->tuner_addr);
+   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x tuner_bus = %d\n",
+   __func__, dev->tuner_type, dev->tuner_addr, dev->tuner_bus);
dprintk(1, "%s() radio_type = 0x%x radio_addr = 0x%x\n",
__func__, dev->radio_type, dev->radio_addr);
 
diff --git a/drivers/media/video/cx23885/cx23885-video.c 
b/drivers/media/video/cx23885/cx23885-video.c
index 644fcb8..ee57f6b 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1468,16 +1468,17 @@ int cx23885_video_register(struct cx23885_dev *dev)
 
cx23885_irq_add_enable(dev, 0x01);
 
-   if (TUNER_ABSENT != dev->tuner_type) {
+   if ((TUNER_ABSENT != dev->tuner_type) &&
+   ((dev->tuner_bus == 0) || (dev->tuner_bus == 1))) {
struct v4l2_subdev *sd = NULL;
 
if (dev->tuner_addr)
sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
-   &dev->i2c_bus[1].i2c_adap,
+   &dev->i2c_bus[dev->tuner_bus].i2c_adap,
"tuner", dev->tuner_addr, NULL);
else
sd = v4l2_i2c_new_subdev(&dev->

[PATCH 4/9 v3] xc5000: add support for DVB-C tuning.

2011-01-25 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/common/tuners/xc5000.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/media/common/tuners/xc5000.c 
b/drivers/media/common/tuners/xc5000.c
index 76ac5cd..e3218c9 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -683,6 +683,24 @@ static int xc5000_set_params(struct dvb_frontend *fe,
return -EINVAL;
}
priv->rf_mode = XC_RF_MODE_AIR;
+   } else if (fe->ops.info.type == FE_QAM) {
+   dprintk(1, "%s() QAM\n", __func__);
+   switch (params->u.qam.modulation) {
+   case QAM_16:
+   case QAM_32:
+   case QAM_64:
+   case QAM_128:
+   case QAM_256:
+   case QAM_AUTO:
+   dprintk(1, "%s() QAM modulation\n", __func__);
+   priv->bandwidth = BANDWIDTH_8_MHZ;
+   priv->video_standard = DTV7_8;
+   priv->freq_hz = params->frequency - 275;
+   priv->rf_mode = XC_RF_MODE_CABLE;
+   break;
+   default:
+   return -EINVAL;
+   }
} else {
printk(KERN_ERR "xc5000 modulation type not supported!\n");
return -EINVAL;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9 v3] cx23885: implement num_fds_portb, num_fds_portc parameters for cx23885_board structure.

2011-01-25 Thread Igor M. Liplianin
This is needed for multifrontend support.
NetUP Dual DVB-T/C CI RF card has frontends connected to port B & C
Each frontend has two switchable cores - DVB-T & DVB-C

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |2 ++
 drivers/media/video/cx23885/cx23885-core.c  |6 ++
 drivers/media/video/cx23885/cx23885.h   |1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index fb2045a..ea88722 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -344,6 +344,8 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
+   .num_fds_portb  = 2,
+   .num_fds_portc  = 2,
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
.input  = { {
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index d621d76..d778b1a 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1005,6 +1005,9 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portb)
+   dev->ts1.num_frontends =
+   cx23885_boards[dev->board].num_fds_portb;
if (cx23885_dvb_register(&dev->ts1) < 0) {
printk(KERN_ERR "%s() Failed to register dvb adapters 
on VID_B\n",
   __func__);
@@ -1019,6 +1022,9 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portc)
+   dev->ts2.num_frontends =
+   cx23885_boards[dev->board].num_fds_portc;
if (cx23885_dvb_register(&dev->ts2) < 0) {
printk(KERN_ERR
"%s() Failed to register dvb on VID_C\n",
diff --git a/drivers/media/video/cx23885/cx23885.h 
b/drivers/media/video/cx23885/cx23885.h
index d8c76b0..8db2797 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -205,6 +205,7 @@ typedef enum {
 struct cx23885_board {
char*name;
port_t  porta, portb, portc;
+   int num_fds_portb, num_fds_portc;
unsigned inttuner_type;
unsigned intradio_type;
unsigned char   tuner_addr;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9 v3] cx23885: disable MSI for NetUP cards, otherwise CI is not working

2011-01-25 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-core.c |4 
 drivers/media/video/cx23885/cx23885-reg.h  |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index d778b1a..9933810 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1041,6 +1041,10 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 
cx23885_dev_checkrevision(dev);
 
+   /* disable MSI for NetUP cards, otherwise CI is not working */
+   if (cx23885_boards[dev->board].ci_type > 0)
+   cx_clear(RDR_RDRCTL1, 1 << 8);
+
return 0;
 }
 
diff --git a/drivers/media/video/cx23885/cx23885-reg.h 
b/drivers/media/video/cx23885/cx23885-reg.h
index a28772d..c87ac68 100644
--- a/drivers/media/video/cx23885/cx23885-reg.h
+++ b/drivers/media/video/cx23885/cx23885-reg.h
@@ -292,6 +292,7 @@ Channel manager Data Structure entry = 20 DWORD
 #define RDR_CFG0   0x0005
 #define RDR_CFG1   0x00050004
 #define RDR_CFG2   0x00050008
+#define RDR_RDRCTL10x0005030c
 #define RDR_TLCTL0 0x00050318
 
 /* APB DMAC Current Buffer Pointer */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9 v3] cx23885, altera-ci: enable all PID's less than 0x20 in hardware PID filter.

2011-01-25 Thread Igor M. Liplianin
It takes too long time to scan due to low symbol rate PID's
like PAT, PMT, CAT, NIT.
For that matter we enabled permanently all PID's
less 0x20 in hardware PID filter for NetUP Dual DVB-T/C CI RF card
to combine rates.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/altera-ci.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
index e5c0873..ad6cc68 100644
--- a/drivers/media/video/cx23885/altera-ci.c
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -521,7 +521,8 @@ static void altera_pid_control(struct netup_hw_pid_filter 
*pid_filt,
struct fpga_internal *inter = pid_filt->internal;
u8 store = 0;
 
-   if (pid == 0x2000)
+   /* pid 0-0x1f always enabled, don't touch them */
+   if ((pid == 0x2000) || (pid < 0x20))
return;
 
mutex_lock(&inter->fpga_mutex);
@@ -567,8 +568,9 @@ static void altera_toggle_fullts_streaming(struct 
netup_hw_pid_filter *pid_filt,
 
netup_fpga_op_rw(inter, NETUP_CI_PID_ADDR1,
((i >> 8) & 0x03) | (pid_filt->nr << 2), 0);
-
-   netup_fpga_op_rw(inter, NETUP_CI_PID_DATA, store, 0);
+   /* pid 0-0x1f always enabled */
+   netup_fpga_op_rw(inter, NETUP_CI_PID_DATA,
+   (i > 3 ? store : 0), 0);
}
 
mutex_unlock(&inter->fpga_mutex);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9 v3] Initial commit to support NetUP Dual DVB-T/C CI RF card.

2011-01-25 Thread Igor M. Liplianin
The card based on cx23885 PCI-e brige. Altera FPGA for CI,
multistandard demods stv0367 from STM for QAM & OFDM,  Xcieve xc5000 tuners
and additional cx25840 for second analog input.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/stv0367.h   |4 +-
 drivers/media/video/cx23885/Kconfig |3 +-
 drivers/media/video/cx23885/cx23885-cards.c |  103 -
 drivers/media/video/cx23885/cx23885-core.c  |   22 ++--
 drivers/media/video/cx23885/cx23885-dvb.c   |  172 +-
 drivers/media/video/cx23885/cx23885.h   |4 +-
 6 files changed, 286 insertions(+), 22 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv0367.h 
b/drivers/media/dvb/frontends/stv0367.h
index 822a8e9..93cc4a5 100644
--- a/drivers/media/dvb/frontends/stv0367.h
+++ b/drivers/media/dvb/frontends/stv0367.h
@@ -4,8 +4,8 @@
  * Driver for ST STV0367 DVB-T & DVB-C demodulator IC.
  *
  * Copyright (C) ST Microelectronics.
- * Copyright (C) 2010 NetUP Inc.
- * Copyright (C) 2010 Igor M. Liplianin 
+ * Copyright (C) 2010,2011 NetUP Inc.
+ * Copyright (C) 2010,2011 Igor M. Liplianin 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 5e5faad..3b6e7f2 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_CX23885
tristate "Conexant cx23885 (2388x successor) support"
-   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
+   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT && SND
+   select SND_PCM
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TUNER
diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index b298b73..a3fe26c 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -24,10 +24,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "cx23885.h"
 #include "tuner-xc2028.h"
 #include "netup-init.h"
+#include "altera-ci.h"
+#include "xc5000.h"
 #include "cx23888-ir.h"
 
 static unsigned int enable_885_ir;
@@ -187,7 +191,7 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
},
[CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
-   .cimax  = 1,
+   .ci_type= 1,
.name   = "NetUP Dual DVB-S2 CI",
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
@@ -329,6 +333,19 @@ struct cx23885_board cx23885_boards[] = {
  CX25840_SVIDEO_CHROMA4,
} },
},
+   [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
+   .ci_type= 2,
+   .name   = "NetUP Dual DVB-T/C-CI RF",
+   .porta  = CX23885_ANALOG_VIDEO,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   .tuner_type = TUNER_XC5000,
+   .tuner_addr = 0x64,
+   .input  = { {
+   .type   = CX23885_VMUX_TELEVISION,
+   .vmux   = CX25840_COMPOSITE1,
+   } },
+   },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -520,6 +537,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x5654,
.subdevice = 0x2390,
.card  = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
+   }, {
+   .subvendor = 0x1b55,
+   .subdevice = 0xe2e4,
+   .card  = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -740,6 +761,9 @@ int cx23885_tuner_callback(void *priv, int component, int 
command, int arg)
/* Tuner Reset Command */
bitmask = 0x02;
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   altera_ci_tuner_reset(dev, port->nr);
+   break;
}
 
if (bitmask) {
@@ -998,6 +1022,33 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   /* GPIO-0 ~INT in
+  GPIO-1 TMS out
+  GPIO-2 ~reset chips out
+  GPIO-3 to GPIO-10 data/addr for CA in/out
+  GPIO-11 ~C

[PATCH 2/9 v3] Altera FPGA based CI driver module.

2011-01-25 Thread Igor M. Liplianin
An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |9 +
 drivers/media/video/cx23885/Makefile|1 +
 drivers/media/video/cx23885/altera-ci.c |  830 +++
 drivers/media/video/cx23885/altera-ci.h |  102 
 4 files changed, 942 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/cx23885/altera-ci.c
 create mode 100644 drivers/media/video/cx23885/altera-ci.h

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 6b4a516..5e5faad 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -33,3 +33,12 @@ config VIDEO_CX23885
  To compile this driver as a module, choose M here: the
  module will be called cx23885
 
+config MEDIA_ALTERA_CI
+   tristate "Altera FPGA based CI module"
+   depends on VIDEO_CX23885 && DVB_CORE
+   select STAPL_ALTERA
+   ---help---
+ An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.
+
+ To compile this driver as a module, choose M here: the
+ module will be called altera-ci
diff --git a/drivers/media/video/cx23885/Makefile 
b/drivers/media/video/cx23885/Makefile
index e2ee95f..23293c7 100644
--- a/drivers/media/video/cx23885/Makefile
+++ b/drivers/media/video/cx23885/Makefile
@@ -5,6 +5,7 @@ cx23885-objs:= cx23885-cards.o cx23885-video.o 
cx23885-vbi.o \
cx23885-f300.o
 
 obj-$(CONFIG_VIDEO_CX23885) += cx23885.o
+obj-$(CONFIG_MEDIA_ALTERA_CI) += altera-ci.o
 
 EXTRA_CFLAGS += -Idrivers/media/video
 EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
new file mode 100644
index 000..e5c0873
--- /dev/null
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -0,0 +1,830 @@
+/*
+ * altera-ci.c
+ *
+ *  CI driver in conjunction with NetUp Dual DVB-T/C RF CI card
+ *
+ * Copyright (C) 2010,2011 NetUP Inc.
+ * Copyright (C) 2010,2011 Igor M. Liplianin 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * currently cx23885 GPIO's used.
+ * GPIO-0 ~INT in
+ * GPIO-1 TMS out
+ * GPIO-2 ~reset chips out
+ * GPIO-3 to GPIO-10 data/addr for CA in/out
+ * GPIO-11 ~CS out
+ * GPIO-12 AD_RG out
+ * GPIO-13 ~WR out
+ * GPIO-14 ~RD out
+ * GPIO-15 ~RDY in
+ * GPIO-16 TCK out
+ * GPIO-17 TDO in
+ * GPIO-18 TDI out
+ */
+/*
+ *  Bit definitions for MC417_RWD and MC417_OEN registers
+ * bits 31-16
+ * +---+
+ * | Reserved  |
+ * +---+
+ *   bit 15  bit 14  bit 13 bit 12  bit 11  bit 10  bit 9   bit 8
+ * +---+---+---+---+---+---+---+---+
+ * |  TDI  |  TDO  |  TCK  |  RDY# |  #RD  |  #WR  | AD_RG |  #CS  |
+ * +---+---+---+---+---+---+---+---+
+ *  bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+ * +---+---+---+---+---+---+---+---+
+ * |  DATA7|  DATA6|  DATA5|  DATA4|  DATA3|  DATA2|  DATA1|  DATA0|
+ * +---+---+---+---+---+---+---+---+
+ */
+#include 
+#include 
+#include 
+#include "altera-ci.h"
+#include "dvb_ca_en50221.h"
+
+/* FPGA regs */
+#define NETUP_CI_INT_CTRL  0x00
+#define NETUP_CI_BUSCTRL2  0x01
+#define NETUP_CI_ADDR0 0x04
+#define NETUP_CI_ADDR1 0x05
+#define NETUP_CI_DATA  0x06
+#define NETUP_CI_BUSCTRL   0x07
+#define NETUP_CI_PID_ADDR0 0x08
+#define NETUP_CI_PID_ADDR1 0x09
+#define NETUP_CI_PID_DATA  0x0a
+#define NETUP_CI_TSA_DIV   0x0c
+#define NETUP_CI_TSB_DIV   0x0d
+#define NETUP_CI_REVISION  0x0f
+
+/* const for ci op */
+#define NETUP_CI_FLG_CTL   1
+#define NETUP_CI_FLG_RD1
+#define NETUP_CI_FLG_AD1
+
+static unsigned int ci_dbg;
+module_param(ci_dbg, int, 0644);
+MODULE_PARM_DESC(ci_dbg, "Enable CI debugging");
+
+static unsigned int pid_dbg;
+module_param(pid_dbg, int, 0644);
+MODULE_PARM_DESC(pid_dbg, "Enable PID filtering debugging");
+
+MODULE_DESCRIPTION("altera FPGA CI module");
+MODULE_AUTHOR("Igor M. Liplianin  ");
+MODULE_LICENSE("GPL");
+
+#define ci_dbg_print(args

Re: [PATCH 2/9 v2] Altera FPGA based CI driver module.

2011-01-18 Thread Igor M. Liplianin
В сообщении от 16 января 2011 19:52:38 автор Mauro Carvalho Chehab написал:
> Em 02-01-2011 10:01, Igor M. Liplianin escreveu:
> > An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.
> > 
> > Signed-off-by: Igor M. Liplianin 
> 
> Igor,
> 
> There's something wrong with this patch. I got lots of error after applying
> it:
> 
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_read_attribute_mem':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:304:
> multiple definition of `netup_ci_read_attribute_mem'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:241: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function `netup_ci_op_cam':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:269:
> multiple definition of `netup_ci_op_cam'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:171: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_slot_shutdown':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:364:
> multiple definition of `netup_ci_slot_shutdown'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:293: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_slot_ts_ctl':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:370:
> multiple definition of `netup_ci_slot_ts_ctl'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:320: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_write_cam_ctl':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:322:
> multiple definition of `netup_ci_write_cam_ctl'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:259: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_read_cam_ctl':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:315:
> multiple definition of `netup_ci_read_cam_ctl'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:252: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_write_attribute_mem':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:310:
> multiple definition of `netup_ci_write_attribute_mem'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:247: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_poll_ci_slot_status':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:448:
> multiple definition of `netup_poll_ci_slot_status'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:403: first defined here
> drivers/media/video/cx23885/altera-ci.o: In function
> `netup_ci_slot_reset':
> /home/v4l/v4l/patchwork/drivers/media/video/cx23885/altera-ci.c:327:
> multiple definition of `netup_ci_slot_reset'
> drivers/media/video/cx23885/cx23885.o:/home/v4l/v4l/patchwork/drivers/medi
> a/video/cx23885/cimax2.c:264: first defined here
> 
> 
> Please fix it and submit a new version. The better is to replace all those
> new symbols to start with altera_ci.
I see, allyesconfig...

> 
> While here, please, on the first patch, move the Altera FPGA driver to
> staging, to give people some time do discuss about it.
It means that cx23885 driver will depend on staging. Is it OK?

> 
> PS.: there are a few CodingStyle errors on this patch. Please always review
> your patches with ./scripts/checkpatch.pl.
I'll do it.
> 
> Thanks!
> Mauro

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/18] Altera FPGA firmware download module.

2011-01-10 Thread Igor M. Liplianin
В сообщении от 5 января 2011 12:26:03 автор Laurent Pinchart написал:
> Hi,
> 
> On Friday 31 December 2010 16:04:13 Ben Gamari wrote:
> > On Fri, 31 Dec 2010 09:47:41 -0200, Mauro Carvalho Chehab wrote:
> > > > I understand this. However, a complete JTAG state machine in the
> > > > kernel, plus an Altera firmware parser, seems to be a lot of code
> > > > that could live in userspace.
> > > 
> > > Moving it to userspace would mean a kernel driver that would depend on
> > > an userspace daemon^Wfirmware loader to work. I would NAK such
> > > designs.
> > 
> > Why? I agree that JTAG is a lot to place in the kernel and is much
> > better suited to be in user space. What exactly is your objection to
> > depending on a userspace utility? There is no shortage of precedent for
> > loading firmware in userspace (e.g. fx2 usb devices).
> 
> I agree with this. Mauro, why would a userspace firmware loader be such a
> bad idea ?
> 
> > > > If I understand it correctly the driver assumes the firmware is in an
> > > > Altera proprietary format. If we really want JTAG code in the kernel
> > > > we should at least split the file parser and the TAP access code.
> > > 
> > > Agreed, but I don't think this would be a good reason to block the code
> > > merge for .38.
> > 
> > I agree with the above isn't good reason to block it but if there is
> > still debate about the general architecture of the code (see above),
> > then it seems aren't ready yet. The code looks very nice, but I'm not at
> > all convinced that it needs to be in the kernel. Just my two-tenths of a
> > cent.
We all realize, that FPGA programming not belongs to DVB only, it is more 
common.
But my intention to write driver for DVB and V4L device... 
Yes, it needed for DVB device to work, and it works on real hardware.
FPGA model used in device has not flash memory. So every time the so-called 
"firmware" has to be 
loaded on early device initialization stage. Then FPGA itself drives CI and 
hardware PID filter. 
Fhysically, FPGA JTAG interface connected to cx23885 GPIO lines.

Take a look on  media/dvb/dvb-usb drivers. There is a lot of FX2 firmware 
dependant devices, but 
no one of them uses userspace utilities to push firmware inside.
If someone has something to put on table, I mean code implementation, then put 
it on.

Everithing is possible to change, but it is needed to begin with something.
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: TeVii S470 dvb-s2 issues - 2nd try ,)

2011-01-02 Thread Igor M. Liplianin
В сообщении от 18 декабря 2010 16:23:05 автор Andy Walls написал:
> On Sat, 2010-12-18 at 14:40 +0100, Boris Cuber wrote:
> > Am Friday 17 December 2010 schrieben Sie:
> > > On Fri, 2010-12-17 at 12:19 +0100, Boris Cuber wrote:
> > > > Hello linux-media people!
> > > > 
> > > > I have to problems with my dvb card ("TeVii S470"). I already
> > > > filed 2 bug reports some time ago, but no one seems to have
> > > > noticed/read them, so i'm trying it here now.
> > > > If you need a "full" dmesg, then please take a look at
> > > > https://bugzilla.kernel.org/attachment.cgi?id=40552
> > > > 
> > > > 1) "TeVii S470 dvbs-2 card (cx23885) is not usable after
> > > > pm-suspend/resume" https://bugzilla.kernel.org/show_bug.cgi?id=16467
> > > 
> > > The cx23885 driver does not implement power management.  It would
> > > likely take many, many hours of coding and testing to implement it
> > > properly.
> > > 
> > > If you need resume/suspend, use the power management scripts on your
> > > machine to kill all the applications using the TeVii S470, and then
> > > unload the cx23885 module just before suspend.
> > > 
> > > On resume, have the power management scripts reload the cx23885 module.
> > 
> > Well, this doesn't work. If i did tune a channel before or used the dvb
> > card somehow for watching tv, unloading and reloading the cx23885
> > module also makes the card unuseable.
> > In dmesg there's lots of "do_IRQ: 1.161 No irq handler for vector (irq
> > -1)" messages then. This can only be fixed by rebooting the computer.
> 
> That is s a known issue with the CX2388[578] chip and PCIe MSI.
> 
> The CX2388[578] will not accept a different value for its "MSI Data"
> field in its PCI config space, when MSI has been enabled on the hardware
> once.
> 
> The kernel will always try to give a different value for the "MSI Data"
> field to the CX2388[578] chip, on cx23885 module unload and reload.
> 
> So suspend and then resume didn't reset the chip hardware?
> 
> You can set "pci=nomsi" on your kernel command line to prevent the
> cx23885 driver, and your whole system unfortunately, from using MSI.
> 
Clearing bit 8 in RDR_RDRCTL1 register disables MSI for cx23885 chip 
effectively.
It is usefull workaround for now.
I submitted appropriate patch for NetUP cards already.

> Regards,
> Andy
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9 v2] Altera FPGA based CI driver module.

2011-01-02 Thread Igor M. Liplianin
An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |9 +
 drivers/media/video/cx23885/Makefile|1 +
 drivers/media/video/cx23885/altera-ci.c |  837 +++
 drivers/media/video/cx23885/altera-ci.h |  102 
 4 files changed, 949 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/cx23885/altera-ci.c
 create mode 100644 drivers/media/video/cx23885/altera-ci.h

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 6b4a516..5e5faad 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -33,3 +33,12 @@ config VIDEO_CX23885
  To compile this driver as a module, choose M here: the
  module will be called cx23885
 
+config MEDIA_ALTERA_CI
+   tristate "Altera FPGA based CI module"
+   depends on VIDEO_CX23885 && DVB_CORE
+   select STAPL_ALTERA
+   ---help---
+ An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.
+
+ To compile this driver as a module, choose M here: the
+ module will be called altera-ci
diff --git a/drivers/media/video/cx23885/Makefile 
b/drivers/media/video/cx23885/Makefile
index e2ee95f..23293c7 100644
--- a/drivers/media/video/cx23885/Makefile
+++ b/drivers/media/video/cx23885/Makefile
@@ -5,6 +5,7 @@ cx23885-objs:= cx23885-cards.o cx23885-video.o 
cx23885-vbi.o \
cx23885-f300.o
 
 obj-$(CONFIG_VIDEO_CX23885) += cx23885.o
+obj-$(CONFIG_MEDIA_ALTERA_CI) += altera-ci.o
 
 EXTRA_CFLAGS += -Idrivers/media/video
 EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
new file mode 100644
index 000..019797b
--- /dev/null
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -0,0 +1,837 @@
+/*
+ * altera-ci.c
+ *
+ *  CI driver in conjunction with NetUp Dual DVB-T/C RF CI card
+ *
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * currently cx23885 GPIO's used.
+ * GPIO-0 ~INT in
+ * GPIO-1 TMS out
+ * GPIO-2 ~reset chips out
+ * GPIO-3 to GPIO-10 data/addr for CA in/out
+ * GPIO-11 ~CS out
+ * GPIO-12 AD_RG out
+ * GPIO-13 ~WR out
+ * GPIO-14 ~RD out
+ * GPIO-15 ~RDY in
+ * GPIO-16 TCK out
+ * GPIO-17 TDO in
+ * GPIO-18 TDI out
+ */
+/*
+ *  Bit definitions for MC417_RWD and MC417_OEN registers
+ * bits 31-16
+ * +---+
+ * | Reserved  |
+ * +---+
+ *   bit 15  bit 14  bit 13 bit 12  bit 11  bit 10  bit 9   bit 8
+ * +---+---+---+---+---+---+---+---+
+ * |  TDI  |  TDO  |  TCK  |  RDY# |  #RD  |  #WR  | AD_RG |  #CS  |
+ * +---+---+---+---+---+---+---+---+
+ *  bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+ * +---+---+---+---+---+---+---+---+
+ * |  DATA7|  DATA6|  DATA5|  DATA4|  DATA3|  DATA2|  DATA1|  DATA0|
+ * +---+---+---+---+---+---+---+---+
+ */
+#include 
+#include 
+#include 
+#include "altera-ci.h"
+#include "dvb_ca_en50221.h"
+
+/* FPGA regs */
+#define NETUP_CI_INT_CTRL  0x00
+#define NETUP_CI_BUSCTRL2  0x01
+#define NETUP_CI_ADDR0 0x04
+#define NETUP_CI_ADDR1 0x05
+#define NETUP_CI_DATA  0x06
+#define NETUP_CI_BUSCTRL   0x07
+#define NETUP_CI_PID_ADDR0 0x08
+#define NETUP_CI_PID_ADDR1 0x09
+#define NETUP_CI_PID_DATA  0x0a
+#define NETUP_CI_TSA_DIV   0x0c
+#define NETUP_CI_TSB_DIV   0x0d
+#define NETUP_CI_REVISION  0x0f
+
+/* const for ci op */
+#define NETUP_CI_FLG_CTL   1
+#define NETUP_CI_FLG_RD1
+#define NETUP_CI_FLG_AD1
+
+static unsigned int ci_dbg;
+module_param(ci_dbg, int, 0644);
+MODULE_PARM_DESC(ci_dbg, "Enable CI debugging");
+
+static unsigned int pid_dbg;
+module_param(pid_dbg, int, 0644);
+MODULE_PARM_DESC(pid_dbg, "Enable PID filtering debugging");
+
+MODULE_DESCRIPTION("altera FPGA CI module");
+MODULE_AUTHOR("Igor M. Liplianin  ");
+MODULE_LICENSE("GPL");
+
+#define ci_dbg_print(args...) 

[PATCH 8/9 v2] cx23885: disable MSI for NetUP cards, otherwise CI is not working

2011-01-02 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-core.c |4 
 drivers/media/video/cx23885/cx23885-reg.h  |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 3a09dd2..e6d7232 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1039,6 +1039,10 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 
cx23885_dev_checkrevision(dev);
 
+   /* disable MSI for NetUP cards, otherwise CI is not working */
+   if (cx23885_boards[dev->board].ci_type > 0)
+   cx_clear(RDR_RDRCTL1, 1 << 8);
+
return 0;
 }
 
diff --git a/drivers/media/video/cx23885/cx23885-reg.h 
b/drivers/media/video/cx23885/cx23885-reg.h
index a28772d..c87ac68 100644
--- a/drivers/media/video/cx23885/cx23885-reg.h
+++ b/drivers/media/video/cx23885/cx23885-reg.h
@@ -292,6 +292,7 @@ Channel manager Data Structure entry = 20 DWORD
 #define RDR_CFG0   0x0005
 #define RDR_CFG1   0x00050004
 #define RDR_CFG2   0x00050008
+#define RDR_RDRCTL10x0005030c
 #define RDR_TLCTL0 0x00050318
 
 /* APB DMAC Current Buffer Pointer */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9 v2] cx23885: implement tuner_bus parameter for cx23885_board structure.

2011-01-02 Thread Igor M. Liplianin
There is two external I2C buses in cx23885 chip.
Currently, analog tuners supported for second I2C bus only
In NetUP Dual DVB-T/C CI RF card tuners connected to first bus
So, in order to support analog tuners sitting on first bus
we need modifications.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |5 +
 drivers/media/video/cx23885/cx23885-core.c  |5 +++--
 drivers/media/video/cx23885/cx23885-video.c |7 ---
 drivers/media/video/cx23885/cx23885.h   |2 ++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index 1ef4f7b..7de6379 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -94,6 +94,7 @@ struct cx23885_board cx23885_boards[] = {
.portc  = CX23885_MPEG_DVB,
.tuner_type = TUNER_PHILIPS_TDA8290,
.tuner_addr = 0x42, /* 0x84 >> 1 */
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   =   CX25840_VIN7_CH3 |
@@ -216,6 +217,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Mygica X8506 DMB-TH",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -245,6 +247,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Magic-Pro ProHDTV Extreme 2",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -293,6 +296,7 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.tuner_type = TUNER_XC2028,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   = CX25840_VIN2_CH1 |
@@ -317,6 +321,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "GoTView X5 3D Hybrid",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {{
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 9ad4c9c..4fa2984 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -970,11 +970,12 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
/* Assume some sensible defaults */
dev->tuner_type = cx23885_boards[dev->board].tuner_type;
dev->tuner_addr = cx23885_boards[dev->board].tuner_addr;
+   dev->tuner_bus = cx23885_boards[dev->board].tuner_bus;
dev->radio_type = cx23885_boards[dev->board].radio_type;
dev->radio_addr = cx23885_boards[dev->board].radio_addr;
 
-   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x\n",
-   __func__, dev->tuner_type, dev->tuner_addr);
+   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x tuner_bus = 
0x%x\n",
+   __func__, dev->tuner_type, dev->tuner_addr, dev->tuner_bus);
dprintk(1, "%s() radio_type = 0x%x radio_addr = 0x%x\n",
__func__, dev->radio_type, dev->radio_addr);
 
diff --git a/drivers/media/video/cx23885/cx23885-video.c 
b/drivers/media/video/cx23885/cx23885-video.c
index 644fcb8..ee57f6b 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1468,16 +1468,17 @@ int cx23885_video_register(struct cx23885_dev *dev)
 
cx23885_irq_add_enable(dev, 0x01);
 
-   if (TUNER_ABSENT != dev->tuner_type) {
+   if ((TUNER_ABSENT != dev->tuner_type) &&
+   ((dev->tuner_bus == 0) || (dev->tuner_bus == 1))) {
struct v4l2_subdev *sd = NULL;
 
if (dev->tuner_addr)
sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
-   &dev->i2c_bus[1].i2c_adap,
+   &dev->i2c_bus[dev->tuner_bus].i2c_adap,
"tuner", dev->tuner_addr, NULL);
else
sd = v4l2_i2c_new_subdev(&dev

[PATCH 9/9 v2] cx23885, altera-ci: enable all PID's less than 0x20 in hardware PID filter.

2011-01-02 Thread Igor M. Liplianin
It takes too long time to scan due to low symbol rate PID's
like PAT, PMT, CAT, NIT.
For that matter we enabled permanently all PID's
less 0x20 in hardware PID filter for NetUP Dual DVB-T/C CI RF card
to combine rates.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/altera-ci.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
index 019797b..e2c9fee 100644
--- a/drivers/media/video/cx23885/altera-ci.c
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -646,8 +646,9 @@ static void altera_toggle_fullts_streaming(struct 
netup_hw_pid_filter *pid_filt,
 
netup_fpga_op_rw(inter, NETUP_CI_PID_ADDR1,
((i >> 8) & 0x03) | (pid_filt->nr << 2), 0);
-
-   netup_fpga_op_rw(inter, NETUP_CI_PID_DATA, store, 0);
+   /* pid 0-0x1f always enabled */
+   netup_fpga_op_rw(inter, NETUP_CI_PID_DATA,
+   (i > 3 ? store : 0), 0);
}
 
mutex_unlock(&inter->fpga_mutex);
@@ -724,8 +725,8 @@ static void altera_pid_control(struct netup_hw_pid_filter 
*pid_filt,
 {
struct fpga_internal *inter = pid_filt->internal;
u8 store = 0;
-
-   if (pid == 0x2000)
+   /* pid 0-0x1f always enabled, don't touch them */
+   if ((pid == 0x2000) || (pid < 0x20))
return;
 
mutex_lock(&inter->fpga_mutex);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9 v2] cx23885: implement num_fds_portb, num_fds_portc parameters for cx23885_board structure.

2011-01-02 Thread Igor M. Liplianin
This is needed for multifrontend support.
NetUP Dual DVB-T/C CI RF card has frontends connected to port B & C
Each frontend has two switchable cores - DVB-T & DVB-C

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |2 ++
 drivers/media/video/cx23885/cx23885-core.c  |4 
 drivers/media/video/cx23885/cx23885.h   |1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index 7de6379..461413a 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -344,6 +344,8 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
+   .num_fds_portb  = 2,
+   .num_fds_portc  = 2,
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
.input  = { {
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 4fa2984..3a09dd2 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1005,6 +1005,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portb)
+   dev->ts1.num_frontends = 
cx23885_boards[dev->board].num_fds_portb;
if (cx23885_dvb_register(&dev->ts1) < 0) {
printk(KERN_ERR "%s() Failed to register dvb adapters 
on VID_B\n",
   __func__);
@@ -1019,6 +1021,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portc)
+   dev->ts2.num_frontends = 
cx23885_boards[dev->board].num_fds_portc;
if (cx23885_dvb_register(&dev->ts2) < 0) {
printk(KERN_ERR
"%s() Failed to register dvb on VID_C\n",
diff --git a/drivers/media/video/cx23885/cx23885.h 
b/drivers/media/video/cx23885/cx23885.h
index d43f80b..e678667 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -205,6 +205,7 @@ typedef enum {
 struct cx23885_board {
char*name;
port_t  porta, portb, portc;
+   int num_fds_portb, num_fds_portc;
unsigned inttuner_type;
unsigned intradio_type;
unsigned char   tuner_addr;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9 v2] Initial commit to support NetUP Dual DVB-T/C CI RF card.

2011-01-02 Thread Igor M. Liplianin
The card based on cx23885 PCI-e brige. Altera FPGA for CI,
multistandard demods stv0367 from STM for QAM & OFDM,  Xcieve xc5000 tuners
and additional cx25840 for second analog input.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |3 +-
 drivers/media/video/cx23885/cx23885-cards.c |  103 -
 drivers/media/video/cx23885/cx23885-core.c  |   22 ++--
 drivers/media/video/cx23885/cx23885-dvb.c   |  172 +-
 drivers/media/video/cx23885/cx23885.h   |4 +-
 5 files changed, 284 insertions(+), 20 deletions(-)

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 5e5faad..3b6e7f2 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_CX23885
tristate "Conexant cx23885 (2388x successor) support"
-   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
+   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT && SND
+   select SND_PCM
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TUNER
diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index b298b73..1ef4f7b 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -24,10 +24,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "cx23885.h"
 #include "tuner-xc2028.h"
 #include "netup-init.h"
+#include "altera-ci.h"
+#include "xc5000.h"
 #include "cx23888-ir.h"
 
 static unsigned int enable_885_ir;
@@ -187,7 +191,7 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
},
[CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
-   .cimax  = 1,
+   .ci_type= 1,
.name   = "NetUP Dual DVB-S2 CI",
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
@@ -329,6 +333,19 @@ struct cx23885_board cx23885_boards[] = {
  CX25840_SVIDEO_CHROMA4,
} },
},
+   [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
+   .ci_type= 2,
+   .name   = "NetUP Dual DVB-T/C-CI RF",
+   .porta  = CX23885_ANALOG_VIDEO,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   .tuner_type = TUNER_XC5000,
+   .tuner_addr = 0x64,
+   .input  = { {
+   .type   = CX23885_VMUX_TELEVISION,
+   .vmux   = CX25840_COMPOSITE1,
+   } },
+   },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -520,6 +537,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x5654,
.subdevice = 0x2390,
.card  = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
+   }, {
+   .subvendor = 0x1b55,
+   .subdevice = 0xe2e4,
+   .card  = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -740,6 +761,9 @@ int cx23885_tuner_callback(void *priv, int component, int 
command, int arg)
/* Tuner Reset Command */
bitmask = 0x02;
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   altera_ci_tuner_reset(dev, port->nr);
+   break;
}
 
if (bitmask) {
@@ -998,6 +1022,33 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   /* GPIO-0 ~INT in
+  GPIO-1 TMS out
+  GPIO-2 ~reset chips out
+  GPIO-3 to GPIO-10 data/addr for CA in/out
+  GPIO-11 ~CS out
+  GPIO-12 ADDR out
+  GPIO-13 ~WR out
+  GPIO-14 ~RD out
+  GPIO-15 ~RDY in
+  GPIO-16 TCK out
+  GPIO-17 TDO in
+  GPIO-18 TDI out
+*/
+   cx_set(GP0_IO, 0x0006); /* GPIO-1,2 as out */
+   /* GPIO-0 as INT, reset & TMS low */
+   cx_clear(GP0_IO, 0x00010006);
+   mdelay(100);/* reset delay */
+   cx_set(GP0_IO, 0x0004); /* reset high */
+   cx_write(MC417_CTL, 0x0037);/* enable GPIO-3..18 pins */
+   /* GPIO-17 is TDO in, GPIO-15 is ~R

[PATCH 4/9 v2] xc5000: add support for DVB-C tuning.

2011-01-02 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/common/tuners/xc5000.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/media/common/tuners/xc5000.c 
b/drivers/media/common/tuners/xc5000.c
index 76ac5cd..e3218c9 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -683,6 +683,24 @@ static int xc5000_set_params(struct dvb_frontend *fe,
return -EINVAL;
}
priv->rf_mode = XC_RF_MODE_AIR;
+   } else if (fe->ops.info.type == FE_QAM) {
+   dprintk(1, "%s() QAM\n", __func__);
+   switch (params->u.qam.modulation) {
+   case QAM_16:
+   case QAM_32:
+   case QAM_64:
+   case QAM_128:
+   case QAM_256:
+   case QAM_AUTO:
+   dprintk(1, "%s() QAM modulation\n", __func__);
+   priv->bandwidth = BANDWIDTH_8_MHZ;
+   priv->video_standard = DTV7_8;
+   priv->freq_hz = params->frequency - 275;
+   priv->rf_mode = XC_RF_MODE_CABLE;
+   break;
+   default:
+   return -EINVAL;
+   }
} else {
printk(KERN_ERR "xc5000 modulation type not supported!\n");
return -EINVAL;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/18] cx23885, altera-ci: enable all PID's less than 0x20 in hardware PID filter.

2011-01-01 Thread Igor M. Liplianin
It takes too long time to scan due to low symbol rate PID's
like PAT, PMT, CAT, NIT.
For that matter we enabled permanently all PID's
less 0x20 in hardware PID filter for NetUP Dual DVB-T/C CI RF card
to combine rates.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/altera-ci.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
index 90147d6..aa67a33 100644
--- a/drivers/media/video/cx23885/altera-ci.c
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -652,8 +652,9 @@ static void altera_toggle_fullts_streaming(struct 
netup_hw_pid_filter 
*pid_filt,
 
netup_fpga_op_rw(inter, NETUP_CI_PID_ADDR1,
((i >> 8) & 0x03) | (pid_filt->nr << 2), 0);
-
-   netup_fpga_op_rw(inter, NETUP_CI_PID_DATA, store, 0);
+   /* pid 0-0x1f always enabled */
+   netup_fpga_op_rw(inter, NETUP_CI_PID_DATA,
+   (i > 3 ? store : 0), 0);
}
 
mutex_unlock(&inter->fpga_mutex);
@@ -730,8 +731,8 @@ static void altera_pid_control(struct netup_hw_pid_filter 
*pid_filt,
 {
struct fpga_internal *inter = pid_filt->internal;
u8 store = 0;
-
-   if (pid == 0x2000)
+   /* pid 0-0x1f always enabled, don't touch them */
+   if ((pid == 0x2000) || (pid < 0x20))
return;
 
mutex_lock(&inter->fpga_mutex);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/18] cx23885: disable MSI for NetUP cards, otherwise CI is not working

2011-01-01 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-core.c |4 
 drivers/media/video/cx23885/cx23885-reg.h  |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-
core.c
index 3a09dd2..e6d7232 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1039,6 +1039,10 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 
cx23885_dev_checkrevision(dev);
 
+   /* disable MSI for NetUP cards, otherwise CI is not working */
+   if (cx23885_boards[dev->board].ci_type > 0)
+   cx_clear(RDR_RDRCTL1, 1 << 8);
+
return 0;
 }
 
diff --git a/drivers/media/video/cx23885/cx23885-reg.h 
b/drivers/media/video/cx23885/cx23885-reg.h
index a28772d..c87ac68 100644
--- a/drivers/media/video/cx23885/cx23885-reg.h
+++ b/drivers/media/video/cx23885/cx23885-reg.h
@@ -292,6 +292,7 @@ Channel manager Data Structure entry = 20 DWORD
 #define RDR_CFG0   0x0005
 #define RDR_CFG1   0x00050004
 #define RDR_CFG2   0x00050008
+#define RDR_RDRCTL10x0005030c
 #define RDR_TLCTL0 0x00050318
 
 /* APB DMAC Current Buffer Pointer */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/18] cx25840: Fix subdev registration in cx25840-core.c

2011-01-01 Thread Igor M. Liplianin
В сообщении от 1 января 2011 14:58:30 автор Andy Walls написал:
> Igor,
> 
> The proper fix is here:
> 
> https://patchwork.kernel.org/patch/376612/
> 
> So, NAK on your particular patch.
So, it is safe to skip my patch.
Mauro, please skip it.

> 
> Mauro,
> 
> I do not see the above patch at linux next.  And I couldn't find it in your
> kernel.org tree.  What is its status?
> 
> This fixes a regression that is known to break cx23885 hardware
> initialization and can break ivtv hardware initialization.
> 
> Regards,
> Andy
> 
> "Igor M. Liplianin"  wrote:
> >On my system, cx23885 based card reports default volume value above 7.
> >So, register cx25840 subdev fails. Although, the card don't have a/v
> >inputs it needs a/v firmware to be loaded.
> >
> >Signed-off-by: Igor M. Liplianin 
> >---
> >
> > drivers/media/video/cx25840/cx25840-core.c |2 ++
> > 1 files changed, 2 insertions(+), 0 deletions(-)
> >
> >diff --git a/drivers/media/video/cx25840/cx25840-core.c
> >b/drivers/media/video/cx25840/cx25840-core.c index dfb198d..dc0cec7
> >100644
> >--- a/drivers/media/video/cx25840/cx25840-core.c
> >+++ b/drivers/media/video/cx25840/cx25840-core.c
> >@@ -1991,6 +1991,8 @@ static int cx25840_probe(struct i2c_client *client,
> >
> > if (!is_cx2583x(state)) {
> > 
> > default_volume = 228 - cx25840_read(client, 0x8d4);
> > default_volume = ((default_volume / 2) + 23) << 9;
> >
> >+if (default_volume > 65535)
> >+default_volume = 65535;
> >
> > state->volume = v4l2_ctrl_new_std(&state->hdl,
> > 
> > &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/18] xc5000: add support for DVB-C tuning.

2011-01-01 Thread Igor M. Liplianin
В сообщении от 1 января 2011 11:43:28 автор Benny Amorsen написал:
> It is always good to see more DVB-C devices supported... Do you happen
> to know some devices which have DVB-C support and use this chip?
> 
> 
> /Benny
See next patch ...

-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks


[PATCH 14/18] cx25840: Fix subdev registration in cx25840-core.c

2011-01-01 Thread Igor M. Liplianin
On my system, cx23885 based card reports default volume value above 7.
So, register cx25840 subdev fails. Although, the card don't have a/v inputs
it needs a/v firmware to be loaded.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx25840/cx25840-core.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx25840/cx25840-core.c 
b/drivers/media/video/cx25840/cx25840-core.c
index dfb198d..dc0cec7 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1991,6 +1991,8 @@ static int cx25840_probe(struct i2c_client *client,
if (!is_cx2583x(state)) {
default_volume = 228 - cx25840_read(client, 0x8d4);
default_volume = ((default_volume / 2) + 23) << 9;
+   if (default_volume > 65535)
+   default_volume = 65535;
 
state->volume = v4l2_ctrl_new_std(&state->hdl,
&cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/18] cx25840: Fix subdev registration in cx25840-core.c

2011-01-01 Thread Igor M. Liplianin
On my system, cx23885 based card reports default volume value above 7.
So, register cx25840 subdev fails. Although, the card don't have a/v inputs
it needs a/v firmware to be loaded.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx25840/cx25840-core.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx25840/cx25840-core.c 
b/drivers/media/video/cx25840/cx25840-core.c
index dfb198d..dc0cec7 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1991,6 +1991,8 @@ static int cx25840_probe(struct i2c_client *client,
if (!is_cx2583x(state)) {
default_volume = 228 - cx25840_read(client, 0x8d4);
default_volume = ((default_volume / 2) + 23) << 9;
+   if (default_volume > 65535)
+   default_volume = 65535;
 
state->volume = v4l2_ctrl_new_std(&state->hdl,
&cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/18] stv0367: coding style corrections

2011-01-01 Thread Igor M. Liplianin
---
 drivers/media/dvb/frontends/stv0367.c |   68 
 1 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv0367.c 
b/drivers/media/dvb/frontends/stv0367.c
index aaa2b44..67301a3 100644
--- a/drivers/media/dvb/frontends/stv0367.c
+++ b/drivers/media/dvb/frontends/stv0367.c
@@ -784,7 +784,7 @@ int stv0367_writeregs (struct stv0367_state *state, u16 
reg, u8 *data, int len)
 
ret = i2c_transfer (state->i2c, &msg, 1);
if (ret != 1)
-   printk("%s: i2c write error! \n", __func__);
+   printk("%s: i2c write error!\n", __func__);
 
return (ret != 1) ? -EREMOTEIO : 0;
 }
@@ -818,7 +818,7 @@ static u8 stv0367_readreg (struct stv0367_state *state, u16 
reg)
 
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2)
-   printk("%s: i2c read error \n", __func__);
+   printk("%s: i2c read error\n", __func__);
 
if (i2cdebug) printk("%s: %02x: %02x\n", __func__, reg, b1[0]);
 
@@ -1032,12 +1032,12 @@ static u32 stv0367ter_get_mclk(struct stv0367_state 
*state, u32 ExtClk_Hz)
 
mclk_Hz = ((ExtClk_Hz / 2) * n) / (m * (1 << p));
 
-   printk("N=%d M=%d P=%d mclk_Hz=%d ExtClk_Hz=%d \n",
+   printk("N=%d M=%d P=%d mclk_Hz=%d ExtClk_Hz=%d\n",
n, m, p, mclk_Hz, ExtClk_Hz);
} else
mclk_Hz = ExtClk_Hz;
 
-   printk("%s: mclk_Hz=%d \n", __func__, mclk_Hz);
+   printk("%s: mclk_Hz=%d\n", __func__, mclk_Hz);
 
return mclk_Hz;
 }
@@ -1205,7 +1205,7 @@ fe_stv0367_ter_signal_type_t stv0367ter_check_syr(struct 
stv0367_state *state)
else
SYRStatus =  FE_TER_SYMBOLOK;
 
-   dprintk("stv0367ter_check_syr SYRStatus %s \n",
+   dprintk("stv0367ter_check_syr SYRStatus %s\n",
SYR_var == 0 ? "No Symbol" : "OK");
 
return SYRStatus;
@@ -1239,7 +1239,7 @@ fe_stv0367_ter_signal_type_t 
stv0367ter_check_cpamp(struct stv0367_state *state,
break;
}
 
-   dprintk("%s: CPAMPMin=%d wd=%d \n", __func__, CPAMPMin, wd);
+   dprintk("%s: CPAMPMin=%d wd=%d\n", __func__, CPAMPMin, wd);
 
CPAMPvalue = stv0367_readbits(state, F367TER_PPM_CPAMP_DIRECT);
while ((CPAMPvalue < CPAMPMin) && (wd > 0)) {
@@ -1308,8 +1308,8 @@ fe_stv0367_ter_signal_type_t stv0367ter_lock_algo(struct 
stv0367_state *state)
 
tmp  = stv0367_readreg(state, R367TER_SYR_STAT);
tmp2 = stv0367_readreg(state, R367TER_STATUS);
-   printk("state=0x%x \n", (int)state);
-   printk("LOCK OK! mode=%d SYR_STAT=0x%x R367TER_STATUS=0x%x \n",
+   printk("state=0x%x\n", (int)state);
+   printk("LOCK OK! mode=%d SYR_STAT=0x%x R367TER_STATUS=0x%x\n",
mode, tmp, tmp2);
 
tmp  = stv0367_readreg(state, R367TER_PRVIT);
@@ -1317,7 +1317,7 @@ fe_stv0367_ter_signal_type_t stv0367ter_lock_algo(struct 
stv0367_state *state)
printk("PRVIT=0x%x I2CRPT=0x%x\n", tmp, tmp2);
 
tmp  = stv0367_readreg(state, R367TER_GAIN_SRC1);
-   printk("GAIN_SRC1=0x%x \n", tmp);
+   printk("GAIN_SRC1=0x%x\n", tmp);
 
if ((mode != 0) && (mode != 1) && (mode != 2)) {
return FE_TER_SWNOK;
@@ -1436,7 +1436,7 @@ fe_stv0367_ter_signal_type_t stv0367ter_lock_algo(struct 
stv0367_state *state)
 
stv0367_writebits(state, F367TER_SYR_TR_DIS, 1);
 
-   printk("FE_TER_LOCKOK !!! \n");
+   printk("FE_TER_LOCKOK !!!\n");
 
return  FE_TER_LOCKOK;
 
@@ -1545,7 +1545,7 @@ int stv0367ter_init(struct dvb_frontend *fe)
break;
default:
case 2700:
-   printk("FE_STV0367TER_SetCLKgen for 27Mhz \n");
+   printk("FE_STV0367TER_SetCLKgen for 27Mhz\n");
stv0367_writereg(state, R367TER_PLLMDIV, 0x1);
stv0367_writereg(state, R367TER_PLLNDIV, 0x8);
stv0367_writereg(state, R367TER_PLLSETUP, 0x18);
@@ -1583,7 +1583,7 @@ static int stv0367ter_algo(struct dvb_frontend *fe,
s32 timing_offset = 0;
u32 trl_nomrate = 0, InternalFreq = 0, temp = 0;
 
-   dprintk("%s: \n", __func__);
+   dprintk("%s:\n", __func__);
 
ter_state->frequency = param->frequency;
ter_state->force = FE_TER_FORCENONE
@@ -1591,24 +1591,24 @@ static int stv0367ter_algo(struct dvb_frontend *fe,
ter_state->if_iq_mode = state->config->if_iq_mode;
switch (state->config->if_iq_mode) {
case FE_TER_NORMAL_IF_TUNER:  /* Normal IF mode */
-   printk("ALGO: FE_TER_NORMAL_IF_TUNER selected \n");
+   printk("ALGO: FE_TER_NORMAL_IF_TUNER selected\n");
stv0367_writebits(state, F367TER_TUNER_BB, 0);
stv0367_writebits(state, F367TER_LONGPATH_IF, 0);
stv0367_writebits(state, F367TER_DEMUX_SWAP, 0);
break;

[PATCH 10/18] cx23885: remove duplicate set interrupt mask

2011-01-01 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-core.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 307eaf4..3a09dd2 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -904,12 +904,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
dev->pci_bus  = dev->pci->bus->number;
dev->pci_slot = PCI_SLOT(dev->pci->devfn);
cx23885_irq_add(dev, 0x001f00);
-   if (cx23885_boards[dev->board].ci_type == 1)
-   cx23885_irq_add(dev, 0x0180); /* for CiMaxes */
-
-   if (cx23885_boards[dev->board].ci_type == 2)
-   cx23885_irq_add(dev, 0x0080); /* for FPGA */
-
 
/* External Master 1 Bus */
dev->i2c_bus[0].nr = 0;
@@ -2074,10 +2068,10 @@ static int __devinit cx23885_initdev(struct pci_dev 
*pci_dev,
 
switch (dev->board) {
case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
-   cx23885_irq_add_enable(dev, 0x0180); /* for NetUP */
+   cx23885_irq_add_enable(dev, PCI_MSK_GPIO1 | PCI_MSK_GPIO0);
break;
case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
-   cx23885_irq_add_enable(dev, 0x0080);
+   cx23885_irq_add_enable(dev, PCI_MSK_GPIO0);
break;
}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/18] stv0367: Fix potential divide error

2011-01-01 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/stv0367.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv0367.c 
b/drivers/media/dvb/frontends/stv0367.c
index 0575741..e6bee7f 100644
--- a/drivers/media/dvb/frontends/stv0367.c
+++ b/drivers/media/dvb/frontends/stv0367.c
@@ -3275,12 +3275,14 @@ static int stv0367cab_read_snr(struct dvb_frontend *fe, 
u16 *snr)
power = 1;
break;
}
+
for (i = 0; i < 10; i++) {
regval += (stv0367_readbits(state, F367CAB_SNR_LO)
+ 256 * stv0367_readbits(state, F367CAB_SNR_HI));
}
+
+   regval /= 10; /*for average over 10 times in for loop above*/
if (regval != 0) {
-   regval /= 10; /*for average over 10 times in for loop above*/
temp = power
* (1 << (3 + stv0367_readbits(state, F367CAB_SNR_PER)));
temp /= regval;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/18] Initial commit to support NetUP Dual DVB-T/C CI RF card.

2011-01-01 Thread Igor M. Liplianin
The card based on cx23885 PCI-e brige. Altera FPGA for CI,
multistandard demods stv0367 from STM for QAM & OFDM,  Xcieve xc5000 tuners
and additional cx25840 for second analog input.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |3 +-
 drivers/media/video/cx23885/cx23885-cards.c |  103 -
 drivers/media/video/cx23885/cx23885-core.c  |   24 +++--
 drivers/media/video/cx23885/cx23885-dvb.c   |  172 +-
 drivers/media/video/cx23885/cx23885.h   |4 +-
 5 files changed, 288 insertions(+), 18 deletions(-)

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 5e5faad..3b6e7f2 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_CX23885
tristate "Conexant cx23885 (2388x successor) support"
-   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
+   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT && SND
+   select SND_PCM
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TUNER
diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index b298b73..1ef4f7b 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -24,10 +24,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "cx23885.h"
 #include "tuner-xc2028.h"
 #include "netup-init.h"
+#include "altera-ci.h"
+#include "xc5000.h"
 #include "cx23888-ir.h"
 
 static unsigned int enable_885_ir;
@@ -187,7 +191,7 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
},
[CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
-   .cimax  = 1,
+   .ci_type= 1,
.name   = "NetUP Dual DVB-S2 CI",
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
@@ -329,6 +333,19 @@ struct cx23885_board cx23885_boards[] = {
  CX25840_SVIDEO_CHROMA4,
} },
},
+   [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
+   .ci_type= 2,
+   .name   = "NetUP Dual DVB-T/C-CI RF",
+   .porta  = CX23885_ANALOG_VIDEO,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   .tuner_type = TUNER_XC5000,
+   .tuner_addr = 0x64,
+   .input  = { {
+   .type   = CX23885_VMUX_TELEVISION,
+   .vmux   = CX25840_COMPOSITE1,
+   } },
+   },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -520,6 +537,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x5654,
.subdevice = 0x2390,
.card  = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
+   }, {
+   .subvendor = 0x1b55,
+   .subdevice = 0xe2e4,
+   .card  = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -740,6 +761,9 @@ int cx23885_tuner_callback(void *priv, int component, int 
command, int arg)
/* Tuner Reset Command */
bitmask = 0x02;
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   altera_ci_tuner_reset(dev, port->nr);
+   break;
}
 
if (bitmask) {
@@ -998,6 +1022,33 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   /* GPIO-0 ~INT in
+  GPIO-1 TMS out
+  GPIO-2 ~reset chips out
+  GPIO-3 to GPIO-10 data/addr for CA in/out
+  GPIO-11 ~CS out
+  GPIO-12 ADDR out
+  GPIO-13 ~WR out
+  GPIO-14 ~RD out
+  GPIO-15 ~RDY in
+  GPIO-16 TCK out
+  GPIO-17 TDO in
+  GPIO-18 TDI out
+*/
+   cx_set(GP0_IO, 0x0006); /* GPIO-1,2 as out */
+   /* GPIO-0 as INT, reset & TMS low */
+   cx_clear(GP0_IO, 0x00010006);
+   mdelay(100);/* reset delay */
+   cx_set(GP0_IO, 0x0004); /* reset high */
+   cx_write(MC417_CTL, 0x0037);/* enable GPIO-3..18 pins */
+   /* GPIO-17 is TDO in, GPIO-15 is ~R

[PATCH 06/18] cx23885: implement tuner_bus parameter for cx23885_board structure.

2011-01-01 Thread Igor M. Liplianin
There is two external I2C buses in cx23885 chip.
Currently, analog tuners supported for second I2C bus only
In NetUP Dual DVB-T/C CI RF card tuners connected to first bus
So, in order to support analog tuners sitting on first bus
we need modifications.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |5 +
 drivers/media/video/cx23885/cx23885-core.c  |5 +++--
 drivers/media/video/cx23885/cx23885-video.c |7 ---
 drivers/media/video/cx23885/cx23885.h   |2 ++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index 1ef4f7b..7de6379 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -94,6 +94,7 @@ struct cx23885_board cx23885_boards[] = {
.portc  = CX23885_MPEG_DVB,
.tuner_type = TUNER_PHILIPS_TDA8290,
.tuner_addr = 0x42, /* 0x84 >> 1 */
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   =   CX25840_VIN7_CH3 |
@@ -216,6 +217,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Mygica X8506 DMB-TH",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -245,6 +247,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Magic-Pro ProHDTV Extreme 2",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -293,6 +296,7 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.tuner_type = TUNER_XC2028,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   = CX25840_VIN2_CH1 |
@@ -317,6 +321,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "GoTView X5 3D Hybrid",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {{
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 7c6f08e..a5998dd 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -976,11 +976,12 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
/* Assume some sensible defaults */
dev->tuner_type = cx23885_boards[dev->board].tuner_type;
dev->tuner_addr = cx23885_boards[dev->board].tuner_addr;
+   dev->tuner_bus = cx23885_boards[dev->board].tuner_bus;
dev->radio_type = cx23885_boards[dev->board].radio_type;
dev->radio_addr = cx23885_boards[dev->board].radio_addr;
 
-   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x\n",
-   __func__, dev->tuner_type, dev->tuner_addr);
+   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x tuner_bus = 
0x%x\n",
+   __func__, dev->tuner_type, dev->tuner_addr, dev->tuner_bus);
dprintk(1, "%s() radio_type = 0x%x radio_addr = 0x%x\n",
__func__, dev->radio_type, dev->radio_addr);
 
diff --git a/drivers/media/video/cx23885/cx23885-video.c 
b/drivers/media/video/cx23885/cx23885-video.c
index 644fcb8..ee57f6b 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1468,16 +1468,17 @@ int cx23885_video_register(struct cx23885_dev *dev)
 
cx23885_irq_add_enable(dev, 0x01);
 
-   if (TUNER_ABSENT != dev->tuner_type) {
+   if ((TUNER_ABSENT != dev->tuner_type) &&
+   ((dev->tuner_bus == 0) || (dev->tuner_bus == 1))) {
struct v4l2_subdev *sd = NULL;
 
if (dev->tuner_addr)
sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
-   &dev->i2c_bus[1].i2c_adap,
+   &dev->i2c_bus[dev->tuner_bus].i2c_adap,
"tuner", dev->tuner_addr, NULL);
else
sd = v4l2_i2c_new_subdev(&dev

[PATCH 07/18] cx23885: implement num_fds_portb, num_fds_portc parameters for cx23885_board structure.

2011-01-01 Thread Igor M. Liplianin
This is needed for multifrontend support.
NetUP Dual DVB-T/C CI RF card has frontends connected to port B & C
Each frontend has two switchable cores - DVB-T & DVB-C

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |2 ++
 drivers/media/video/cx23885/cx23885-core.c  |4 
 drivers/media/video/cx23885/cx23885.h   |1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index 7de6379..461413a 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -344,6 +344,8 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
+   .num_fds_portb  = 2,
+   .num_fds_portc  = 2,
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
.input  = { {
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index a5998dd..307eaf4 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1011,6 +1011,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portb)
+   dev->ts1.num_frontends = 
cx23885_boards[dev->board].num_fds_portb;
if (cx23885_dvb_register(&dev->ts1) < 0) {
printk(KERN_ERR "%s() Failed to register dvb adapters 
on VID_B\n",
   __func__);
@@ -1025,6 +1027,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portc)
+   dev->ts2.num_frontends = 
cx23885_boards[dev->board].num_fds_portc;
if (cx23885_dvb_register(&dev->ts2) < 0) {
printk(KERN_ERR
"%s() Failed to register dvb on VID_C\n",
diff --git a/drivers/media/video/cx23885/cx23885.h 
b/drivers/media/video/cx23885/cx23885.h
index d43f80b..e678667 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -205,6 +205,7 @@ typedef enum {
 struct cx23885_board {
char*name;
port_t  porta, portb, portc;
+   int num_fds_portb, num_fds_portc;
unsigned inttuner_type;
unsigned intradio_type;
unsigned char   tuner_addr;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/18] xc5000: add support for DVB-C tuning.

2011-01-01 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/common/tuners/xc5000.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/media/common/tuners/xc5000.c 
b/drivers/media/common/tuners/xc5000.c
index 76ac5cd..e3218c9 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -683,6 +683,24 @@ static int xc5000_set_params(struct dvb_frontend *fe,
return -EINVAL;
}
priv->rf_mode = XC_RF_MODE_AIR;
+   } else if (fe->ops.info.type == FE_QAM) {
+   dprintk(1, "%s() QAM\n", __func__);
+   switch (params->u.qam.modulation) {
+   case QAM_16:
+   case QAM_32:
+   case QAM_64:
+   case QAM_128:
+   case QAM_256:
+   case QAM_AUTO:
+   dprintk(1, "%s() QAM modulation\n", __func__);
+   priv->bandwidth = BANDWIDTH_8_MHZ;
+   priv->video_standard = DTV7_8;
+   priv->freq_hz = params->frequency - 275;
+   priv->rf_mode = XC_RF_MODE_CABLE;
+   break;
+   default:
+   return -EINVAL;
+   }
} else {
printk(KERN_ERR "xc5000 modulation type not supported!\n");
return -EINVAL;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/18] Altera FPGA based CI driver module.

2011-01-01 Thread Igor M. Liplianin
An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |9 +
 drivers/media/video/cx23885/Makefile|1 +
 drivers/media/video/cx23885/altera-ci.c |  837 +++
 drivers/media/video/cx23885/altera-ci.h |  102 
 4 files changed, 949 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/cx23885/altera-ci.c
 create mode 100644 drivers/media/video/cx23885/altera-ci.h

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 6b4a516..5e5faad 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -33,3 +33,12 @@ config VIDEO_CX23885
  To compile this driver as a module, choose M here: the
  module will be called cx23885
 
+config MEDIA_ALTERA_CI
+   tristate "Altera FPGA based CI module"
+   depends on VIDEO_CX23885 && DVB_CORE
+   select STAPL_ALTERA
+   ---help---
+ An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.
+
+ To compile this driver as a module, choose M here: the
+ module will be called altera-ci
diff --git a/drivers/media/video/cx23885/Makefile 
b/drivers/media/video/cx23885/Makefile
index e2ee95f..23293c7 100644
--- a/drivers/media/video/cx23885/Makefile
+++ b/drivers/media/video/cx23885/Makefile
@@ -5,6 +5,7 @@ cx23885-objs:= cx23885-cards.o cx23885-video.o 
cx23885-vbi.o \
cx23885-f300.o
 
 obj-$(CONFIG_VIDEO_CX23885) += cx23885.o
+obj-$(CONFIG_MEDIA_ALTERA_CI) += altera-ci.o
 
 EXTRA_CFLAGS += -Idrivers/media/video
 EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
new file mode 100644
index 000..019797b
--- /dev/null
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -0,0 +1,837 @@
+/*
+ * altera-ci.c
+ *
+ *  CI driver in conjunction with NetUp Dual DVB-T/C RF CI card
+ *
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * currently cx23885 GPIO's used.
+ * GPIO-0 ~INT in
+ * GPIO-1 TMS out
+ * GPIO-2 ~reset chips out
+ * GPIO-3 to GPIO-10 data/addr for CA in/out
+ * GPIO-11 ~CS out
+ * GPIO-12 AD_RG out
+ * GPIO-13 ~WR out
+ * GPIO-14 ~RD out
+ * GPIO-15 ~RDY in
+ * GPIO-16 TCK out
+ * GPIO-17 TDO in
+ * GPIO-18 TDI out
+ */
+/*
+ *  Bit definitions for MC417_RWD and MC417_OEN registers
+ * bits 31-16
+ * +---+
+ * | Reserved  |
+ * +---+
+ *   bit 15  bit 14  bit 13 bit 12  bit 11  bit 10  bit 9   bit 8
+ * +---+---+---+---+---+---+---+---+
+ * |  TDI  |  TDO  |  TCK  |  RDY# |  #RD  |  #WR  | AD_RG |  #CS  |
+ * +---+---+---+---+---+---+---+---+
+ *  bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
+ * +---+---+---+---+---+---+---+---+
+ * |  DATA7|  DATA6|  DATA5|  DATA4|  DATA3|  DATA2|  DATA1|  DATA0|
+ * +---+---+---+---+---+---+---+---+
+ */
+#include 
+#include 
+#include 
+#include "altera-ci.h"
+#include "dvb_ca_en50221.h"
+
+/* FPGA regs */
+#define NETUP_CI_INT_CTRL  0x00
+#define NETUP_CI_BUSCTRL2  0x01
+#define NETUP_CI_ADDR0 0x04
+#define NETUP_CI_ADDR1 0x05
+#define NETUP_CI_DATA  0x06
+#define NETUP_CI_BUSCTRL   0x07
+#define NETUP_CI_PID_ADDR0 0x08
+#define NETUP_CI_PID_ADDR1 0x09
+#define NETUP_CI_PID_DATA  0x0a
+#define NETUP_CI_TSA_DIV   0x0c
+#define NETUP_CI_TSB_DIV   0x0d
+#define NETUP_CI_REVISION  0x0f
+
+/* const for ci op */
+#define NETUP_CI_FLG_CTL   1
+#define NETUP_CI_FLG_RD1
+#define NETUP_CI_FLG_AD1
+
+static unsigned int ci_dbg;
+module_param(ci_dbg, int, 0644);
+MODULE_PARM_DESC(ci_dbg, "Enable CI debugging");
+
+static unsigned int pid_dbg;
+module_param(pid_dbg, int, 0644);
+MODULE_PARM_DESC(pid_dbg, "Enable PID filtering debugging");
+
+MODULE_DESCRIPTION("altera FPGA CI module");
+MODULE_AUTHOR("Igor M. Liplianin  ");
+MODULE_LICENSE("GPL");
+
+#define ci_dbg_print(args...) 

Re: [PATCH 01/18] Altera FPGA firmware download module.

2011-01-01 Thread Igor M. Liplianin
В сообщении от 31 декабря 2010 12:53:16 автор Mauro Carvalho Chehab написал:
> Em 31-12-2010 03:26, Igor M. Liplianin escreveu:
> > It uses STAPL files and programs Altera FPGA through JTAG.
> > Interface to JTAG must be provided from main device module,
> > for example through cx23885 GPIO.
> > 
> > Signed-off-by: Igor M. Liplianin 
> 
> There's something wrong with the way you sent your patches: They
> were sent with some random dates (most patches are from Aug), so
> they went out-of-order in patchwork and at the default email display
> order.
> 
> Also, patch 4/18 seems missed.
> 
> Cheers,
> Mauro
Sorry, I'm experimenting with automating to send patches and have such result...
Gmail account blocked for a day :(

«5.4.5 Daily sending quota exceeded. b52sm12000609eei.19»
I will resend with new dates. In addition I will make some fixes Randy Dunlap 
write about.
 
-- 
Igor M. Liplianin
Microsoft Windows Free Zone - Linux used for all Computing Tasks
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/18] stv0367: Fix potential divide error

2010-12-30 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/dvb/frontends/stv0367.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/stv0367.c 
b/drivers/media/dvb/frontends/stv0367.c
index 0575741..e6bee7f 100644
--- a/drivers/media/dvb/frontends/stv0367.c
+++ b/drivers/media/dvb/frontends/stv0367.c
@@ -3275,12 +3275,14 @@ static int stv0367cab_read_snr(struct dvb_frontend *fe, 
u16 *snr)
power = 1;
break;
}
+
for (i = 0; i < 10; i++) {
regval += (stv0367_readbits(state, F367CAB_SNR_LO)
+ 256 * stv0367_readbits(state, F367CAB_SNR_HI));
}
+
+   regval /= 10; /*for average over 10 times in for loop above*/
if (regval != 0) {
-   regval /= 10; /*for average over 10 times in for loop above*/
temp = power
* (1 << (3 + stv0367_readbits(state, F367CAB_SNR_PER)));
temp /= regval;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/18] cx23885: implement tuner_bus parameter for cx23885_board structure.

2010-12-30 Thread Igor M. Liplianin
There is two external I2C buses in cx23885 chip.
Currently, analog tuners supported for second I2C bus only
In NetUP Dual DVB-T/C CI RF card tuners connected to first bus
So, in order to support analog tuners sitting on first bus
we need modifications.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |5 +
 drivers/media/video/cx23885/cx23885-core.c  |5 +++--
 drivers/media/video/cx23885/cx23885-video.c |7 ---
 drivers/media/video/cx23885/cx23885.h   |2 ++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index 1ef4f7b..7de6379 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -94,6 +94,7 @@ struct cx23885_board cx23885_boards[] = {
.portc  = CX23885_MPEG_DVB,
.tuner_type = TUNER_PHILIPS_TDA8290,
.tuner_addr = 0x42, /* 0x84 >> 1 */
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   =   CX25840_VIN7_CH3 |
@@ -216,6 +217,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Mygica X8506 DMB-TH",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -245,6 +247,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "Magic-Pro ProHDTV Extreme 2",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {
@@ -293,6 +296,7 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.tuner_type = TUNER_XC2028,
.tuner_addr = 0x61,
+   .tuner_bus  = 1,
.input  = {{
.type   = CX23885_VMUX_TELEVISION,
.vmux   = CX25840_VIN2_CH1 |
@@ -317,6 +321,7 @@ struct cx23885_board cx23885_boards[] = {
.name   = "GoTView X5 3D Hybrid",
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
+   .tuner_bus  = 1,
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.input  = {{
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 7c6f08e..a5998dd 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -976,11 +976,12 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
/* Assume some sensible defaults */
dev->tuner_type = cx23885_boards[dev->board].tuner_type;
dev->tuner_addr = cx23885_boards[dev->board].tuner_addr;
+   dev->tuner_bus = cx23885_boards[dev->board].tuner_bus;
dev->radio_type = cx23885_boards[dev->board].radio_type;
dev->radio_addr = cx23885_boards[dev->board].radio_addr;
 
-   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x\n",
-   __func__, dev->tuner_type, dev->tuner_addr);
+   dprintk(1, "%s() tuner_type = 0x%x tuner_addr = 0x%x tuner_bus = 
0x%x\n",
+   __func__, dev->tuner_type, dev->tuner_addr, dev->tuner_bus);
dprintk(1, "%s() radio_type = 0x%x radio_addr = 0x%x\n",
__func__, dev->radio_type, dev->radio_addr);
 
diff --git a/drivers/media/video/cx23885/cx23885-video.c 
b/drivers/media/video/cx23885/cx23885-video.c
index 644fcb8..ee57f6b 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -1468,16 +1468,17 @@ int cx23885_video_register(struct cx23885_dev *dev)
 
cx23885_irq_add_enable(dev, 0x01);
 
-   if (TUNER_ABSENT != dev->tuner_type) {
+   if ((TUNER_ABSENT != dev->tuner_type) &&
+   ((dev->tuner_bus == 0) || (dev->tuner_bus == 1))) {
struct v4l2_subdev *sd = NULL;
 
if (dev->tuner_addr)
sd = v4l2_i2c_new_subdev(&dev->v4l2_dev,
-   &dev->i2c_bus[1].i2c_adap,
+   &dev->i2c_bus[dev->tuner_bus].i2c_adap,
"tuner", dev->tuner_addr, NULL);
else
sd = v4l2_i2c_new_subdev(&dev

[PATCH 07/18] cx23885: implement num_fds_portb, num_fds_portc parameters for cx23885_board structure.

2010-12-30 Thread Igor M. Liplianin
This is needed for multifrontend support.
NetUP Dual DVB-T/C CI RF card has frontends connected to port B & C
Each frontend has two switchable cores - DVB-T & DVB-C

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-cards.c |2 ++
 drivers/media/video/cx23885/cx23885-core.c  |4 
 drivers/media/video/cx23885/cx23885.h   |1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index 7de6379..461413a 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -344,6 +344,8 @@ struct cx23885_board cx23885_boards[] = {
.porta  = CX23885_ANALOG_VIDEO,
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
+   .num_fds_portb  = 2,
+   .num_fds_portc  = 2,
.tuner_type = TUNER_XC5000,
.tuner_addr = 0x64,
.input  = { {
diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index a5998dd..307eaf4 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1011,6 +1011,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portb)
+   dev->ts1.num_frontends = 
cx23885_boards[dev->board].num_fds_portb;
if (cx23885_dvb_register(&dev->ts1) < 0) {
printk(KERN_ERR "%s() Failed to register dvb adapters 
on VID_B\n",
   __func__);
@@ -1025,6 +1027,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
}
 
if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
+   if (cx23885_boards[dev->board].num_fds_portc)
+   dev->ts2.num_frontends = 
cx23885_boards[dev->board].num_fds_portc;
if (cx23885_dvb_register(&dev->ts2) < 0) {
printk(KERN_ERR
"%s() Failed to register dvb on VID_C\n",
diff --git a/drivers/media/video/cx23885/cx23885.h 
b/drivers/media/video/cx23885/cx23885.h
index d43f80b..e678667 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -205,6 +205,7 @@ typedef enum {
 struct cx23885_board {
char*name;
port_t  porta, portb, portc;
+   int num_fds_portb, num_fds_portc;
unsigned inttuner_type;
unsigned intradio_type;
unsigned char   tuner_addr;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/18] cx23885: remove duplicate set interrupt mask

2010-12-30 Thread Igor M. Liplianin
Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/cx23885-core.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/cx23885/cx23885-core.c 
b/drivers/media/video/cx23885/cx23885-core.c
index 307eaf4..3a09dd2 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -904,12 +904,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
dev->pci_bus  = dev->pci->bus->number;
dev->pci_slot = PCI_SLOT(dev->pci->devfn);
cx23885_irq_add(dev, 0x001f00);
-   if (cx23885_boards[dev->board].ci_type == 1)
-   cx23885_irq_add(dev, 0x0180); /* for CiMaxes */
-
-   if (cx23885_boards[dev->board].ci_type == 2)
-   cx23885_irq_add(dev, 0x0080); /* for FPGA */
-
 
/* External Master 1 Bus */
dev->i2c_bus[0].nr = 0;
@@ -2074,10 +2068,10 @@ static int __devinit cx23885_initdev(struct pci_dev 
*pci_dev,
 
switch (dev->board) {
case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
-   cx23885_irq_add_enable(dev, 0x0180); /* for NetUP */
+   cx23885_irq_add_enable(dev, PCI_MSK_GPIO1 | PCI_MSK_GPIO0);
break;
case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
-   cx23885_irq_add_enable(dev, 0x0080);
+   cx23885_irq_add_enable(dev, PCI_MSK_GPIO0);
break;
}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/18] Initial commit to support NetUP Dual DVB-T/C CI RF card.

2010-12-30 Thread Igor M. Liplianin
The card based on cx23885 PCI-e brige. Altera FPGA for CI,
multistandard demods stv0367 from STM for QAM & OFDM,  Xcieve xc5000 tuners
and additional cx25840 for second analog input.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |3 +-
 drivers/media/video/cx23885/cx23885-cards.c |  103 -
 drivers/media/video/cx23885/cx23885-core.c  |   24 +++--
 drivers/media/video/cx23885/cx23885-dvb.c   |  172 +-
 drivers/media/video/cx23885/cx23885.h   |4 +-
 5 files changed, 288 insertions(+), 18 deletions(-)

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 5e5faad..3b6e7f2 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,7 @@
 config VIDEO_CX23885
tristate "Conexant cx23885 (2388x successor) support"
-   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
+   depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT && SND
+   select SND_PCM
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TUNER
diff --git a/drivers/media/video/cx23885/cx23885-cards.c 
b/drivers/media/video/cx23885/cx23885-cards.c
index b298b73..1ef4f7b 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -24,10 +24,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "cx23885.h"
 #include "tuner-xc2028.h"
 #include "netup-init.h"
+#include "altera-ci.h"
+#include "xc5000.h"
 #include "cx23888-ir.h"
 
 static unsigned int enable_885_ir;
@@ -187,7 +191,7 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
},
[CX23885_BOARD_NETUP_DUAL_DVBS2_CI] = {
-   .cimax  = 1,
+   .ci_type= 1,
.name   = "NetUP Dual DVB-S2 CI",
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
@@ -329,6 +333,19 @@ struct cx23885_board cx23885_boards[] = {
  CX25840_SVIDEO_CHROMA4,
} },
},
+   [CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF] = {
+   .ci_type= 2,
+   .name   = "NetUP Dual DVB-T/C-CI RF",
+   .porta  = CX23885_ANALOG_VIDEO,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   .tuner_type = TUNER_XC5000,
+   .tuner_addr = 0x64,
+   .input  = { {
+   .type   = CX23885_VMUX_TELEVISION,
+   .vmux   = CX25840_COMPOSITE1,
+   } },
+   },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -520,6 +537,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x5654,
.subdevice = 0x2390,
.card  = CX23885_BOARD_GOTVIEW_X5_3D_HYBRID,
+   }, {
+   .subvendor = 0x1b55,
+   .subdevice = 0xe2e4,
+   .card  = CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF,
},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -740,6 +761,9 @@ int cx23885_tuner_callback(void *priv, int component, int 
command, int arg)
/* Tuner Reset Command */
bitmask = 0x02;
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   altera_ci_tuner_reset(dev, port->nr);
+   break;
}
 
if (bitmask) {
@@ -998,6 +1022,33 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
case CX23885_BOARD_GOTVIEW_X5_3D_HYBRID:
cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */
break;
+   case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
+   /* GPIO-0 ~INT in
+  GPIO-1 TMS out
+  GPIO-2 ~reset chips out
+  GPIO-3 to GPIO-10 data/addr for CA in/out
+  GPIO-11 ~CS out
+  GPIO-12 ADDR out
+  GPIO-13 ~WR out
+  GPIO-14 ~RD out
+  GPIO-15 ~RDY in
+  GPIO-16 TCK out
+  GPIO-17 TDO in
+  GPIO-18 TDI out
+*/
+   cx_set(GP0_IO, 0x0006); /* GPIO-1,2 as out */
+   /* GPIO-0 as INT, reset & TMS low */
+   cx_clear(GP0_IO, 0x00010006);
+   mdelay(100);/* reset delay */
+   cx_set(GP0_IO, 0x0004); /* reset high */
+   cx_write(MC417_CTL, 0x0037);/* enable GPIO-3..18 pins */
+   /* GPIO-17 is TDO in, GPIO-15 is ~R

[PATCH 02/18] Altera FPGA based CI driver module.

2010-12-30 Thread Igor M. Liplianin
An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.

Signed-off-by: Igor M. Liplianin 
---
 drivers/media/video/cx23885/Kconfig |9 +
 drivers/media/video/cx23885/Makefile|1 +
 drivers/media/video/cx23885/altera-ci.c |  834 +++
 drivers/media/video/cx23885/altera-ci.h |  102 
 4 files changed, 946 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/cx23885/altera-ci.c
 create mode 100644 drivers/media/video/cx23885/altera-ci.h

diff --git a/drivers/media/video/cx23885/Kconfig 
b/drivers/media/video/cx23885/Kconfig
index 6b4a516..5e5faad 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -33,3 +33,12 @@ config VIDEO_CX23885
  To compile this driver as a module, choose M here: the
  module will be called cx23885
 
+config MEDIA_ALTERA_CI
+   tristate "Altera FPGA based CI module"
+   depends on VIDEO_CX23885 && DVB_CORE
+   select STAPL_ALTERA
+   ---help---
+ An Altera FPGA CI module for NetUP Dual DVB-T/C RF CI card.
+
+ To compile this driver as a module, choose M here: the
+ module will be called altera-ci
diff --git a/drivers/media/video/cx23885/Makefile 
b/drivers/media/video/cx23885/Makefile
index e2ee95f..23293c7 100644
--- a/drivers/media/video/cx23885/Makefile
+++ b/drivers/media/video/cx23885/Makefile
@@ -5,6 +5,7 @@ cx23885-objs:= cx23885-cards.o cx23885-video.o 
cx23885-vbi.o \
cx23885-f300.o
 
 obj-$(CONFIG_VIDEO_CX23885) += cx23885.o
+obj-$(CONFIG_MEDIA_ALTERA_CI) += altera-ci.o
 
 EXTRA_CFLAGS += -Idrivers/media/video
 EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/video/cx23885/altera-ci.c 
b/drivers/media/video/cx23885/altera-ci.c
new file mode 100644
index 000..107189b
--- /dev/null
+++ b/drivers/media/video/cx23885/altera-ci.c
@@ -0,0 +1,834 @@
+/*
+ * altera-ci.c
+ *
+ *  CI driver in conjunction with NetUp Dual DVB-T/C RF CI card
+ *
+ * Copyright (C) 2010 NetUP Inc.
+ * Copyright (C) 2010 Igor M. Liplianin 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* currently cx23885 GPIO's used.
+   GPIO-0 ~INT in
+   GPIO-1 TMS out
+   GPIO-2 ~reset chips out
+   GPIO-3 to GPIO-10 data/addr for CA in/out
+   GPIO-11 ~CS out
+   GPIO-12 AD_RG out
+   GPIO-13 ~WR out
+   GPIO-14 ~RD out
+   GPIO-15 ~RDY in
+   GPIO-16 TCK out
+   GPIO-17 TDO in
+   GPIO-18 TDI out
+*/
+/ Bit definitions for MC417_RWD and MC417_OEN registers  ***
+  bits 31-16
++---+
+| Reserved  |
++---+
+  bit 15  bit 14  bit 13 bit 12  bit 11  bit 10  bit 9   bit 8
++---+---+---+---+---+---+---+---+
+|  TDI  |  TDO  |  TCK  |  RDY# |  #RD  |  #WR  | AD_RG |  #CS  |
++---+---+---+---+---+---+---+---+
+ bit 7   bit 6   bit 5   bit 4   bit 3   bit 2   bit 1   bit 0
++---+---+---+---+---+---+---+---+
+|  DATA7|  DATA6|  DATA5|  DATA4|  DATA3|  DATA2|  DATA1|  DATA0|
++---+---+---+---+---+---+---+---+
+***/
+#include 
+#include 
+#include 
+#include "altera-ci.h"
+#include "dvb_ca_en50221.h"
+
+/* FPGA regs */
+#define NETUP_CI_INT_CTRL  0x00
+#define NETUP_CI_BUSCTRL2  0x01
+#define NETUP_CI_ADDR0 0x04
+#define NETUP_CI_ADDR1 0x05
+#define NETUP_CI_DATA  0x06
+#define NETUP_CI_BUSCTRL   0x07
+#define NETUP_CI_PID_ADDR0 0x08
+#define NETUP_CI_PID_ADDR1 0x09
+#define NETUP_CI_PID_DATA  0x0a
+#define NETUP_CI_TSA_DIV   0x0c
+#define NETUP_CI_TSB_DIV   0x0d
+#define NETUP_CI_REVISION  0x0f
+
+/* const for ci op */
+#define NETUP_CI_FLG_CTL   1
+#define NETUP_CI_FLG_RD1
+#define NETUP_CI_FLG_AD1
+
+static unsigned int ci_dbg;
+module_param(ci_dbg, int, 0644);
+MODULE_PARM_DESC(ci_dbg, "Enable CI debugging");
+
+static unsigned int pid_dbg;
+module_param(pid_dbg, int, 0644);
+MODULE_PARM_DESC(pid_dbg, "Enable PID filtering debugging");
+
+MODULE_DESCRIPTION("altera FPGA CI module");
+MODULE_AUTHOR("Igor M. Liplianin  ");
+MODULE_LICENSE("GPL");
+
+#define ci_dbg_print(args...) \
+   do { \
+   if

  1   2   3   >