aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/ttpci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 18:42:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 18:42:54 -0400
commit1eb63378354ac37b7e27d256bbf84684751bac32 (patch)
tree0775591a2dced778d1ba0bd8a946831e424d02d7 /drivers/media/dvb/ttpci
parent1a4ceab195e66bce9c1638fdded6d92988100ba4 (diff)
parentbac2dacd5fb9ddad093d7a2dc5ab44e764874821 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (348 commits) [media] pctv452e: Remove bogus code [media] adv7175: Make use of media bus pixel codes [media] media: vb2: fix incorrect return value [media] em28xx: implement VIDIOC_ENUM_FRAMESIZES [media] cx23885: Stop the risc video fifo before reconfiguring it [media] cx23885: Avoid incorrect error handling and reporting [media] cx23885: Avoid stopping the risc engine during buffer timeout [media] cx23885: Removed a spurious function cx23885_set_scale() [media] cx23885: v4l2 api compliance, set the audioset field correctly [media] cx23885: hook the audio selection functions into the main driver [media] cx23885: add generic functions for dealing with audio input selection [media] cx23885: fixes related to maximum number of inputs and range checking [media] cx23885: Initial support for the MPX-885 mini-card [media] cx25840: Ensure AUDIO6 and AUDIO7 trigger line-in baseband use [media] cx23885: Enable audio line in support from the back panel [media] cx23885: Allow the audio mux config to be specified on a per input basis [media] cx25840: Enable support for non-tuner LR1/LR2 audio inputs [media] cx23885: Name an internal i2c part and declare a bitfield by name [media] cx23885: Ensure VBI buffers timeout quickly - bugfix for vbi hangs during streaming [media] cx23885: remove channel dump diagnostics when a vbi buffer times out ... Fix up trivial conflicts in drivers/misc/altera-stapl/altera.c (header file rename vs add)
Diffstat (limited to 'drivers/media/dvb/ttpci')
-rw-r--r--drivers/media/dvb/ttpci/Makefile4
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c32
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c47
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c1
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c2
-rw-r--r--drivers/media/dvb/ttpci/budget.h1
-rw-r--r--drivers/media/dvb/ttpci/ttpci-eeprom.c29
-rw-r--r--drivers/media/dvb/ttpci/ttpci-eeprom.h1
8 files changed, 77 insertions, 40 deletions
diff --git a/drivers/media/dvb/ttpci/Makefile b/drivers/media/dvb/ttpci/Makefile
index 8a4d5bb20a5..f6e869372e3 100644
--- a/drivers/media/dvb/ttpci/Makefile
+++ b/drivers/media/dvb/ttpci/Makefile
@@ -17,5 +17,5 @@ obj-$(CONFIG_DVB_BUDGET_CI) += budget-ci.o
17obj-$(CONFIG_DVB_BUDGET_PATCH) += budget-patch.o 17obj-$(CONFIG_DVB_BUDGET_PATCH) += budget-patch.o
18obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o 18obj-$(CONFIG_DVB_AV7110) += dvb-ttpci.o
19 19
20EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 20ccflags-y += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
21EXTRA_CFLAGS += -Idrivers/media/common/tuners 21ccflags-y += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index cdd31cae46c..ee8ee1d481f 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -25,6 +25,8 @@
25 * the project's page is at http://www.linuxtv.org/ 25 * the project's page is at http://www.linuxtv.org/
26 */ 26 */
27 27
28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
29
28#include <linux/kernel.h> 30#include <linux/kernel.h>
29#include <linux/types.h> 31#include <linux/types.h>
30#include <linux/delay.h> 32#include <linux/delay.h>
@@ -253,7 +255,7 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
253 255
254 switch (av7110->current_input) { 256 switch (av7110->current_input) {
255 case 1: 257 case 1:
256 dprintk(1, "switching SAA7113 to Analog Tuner Input.\n"); 258 dprintk(1, "switching SAA7113 to Analog Tuner Input\n");
257 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source 259 msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source
258 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source 260 msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source
259 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source 261 msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source
@@ -263,7 +265,7 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
263 265
264 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { 266 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
265 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) 267 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60))
266 dprintk(1, "setting band in demodulator failed.\n"); 268 dprintk(1, "setting band in demodulator failed\n");
267 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 269 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
268 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD) 270 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD)
269 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF) 271 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF)
@@ -272,17 +274,17 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
272 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); 274 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
273 break; 275 break;
274 case 2: 276 case 2:
275 dprintk(1, "switching SAA7113 to Video AV CVBS Input.\n"); 277 dprintk(1, "switching SAA7113 to Video AV CVBS Input\n");
276 if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1) 278 if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1)
277 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); 279 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
278 break; 280 break;
279 case 3: 281 case 3:
280 dprintk(1, "switching SAA7113 to Video AV Y/C Input.\n"); 282 dprintk(1, "switching SAA7113 to Video AV Y/C Input\n");
281 if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1) 283 if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1)
282 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); 284 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
283 break; 285 break;
284 default: 286 default:
285 dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input.\n"); 287 dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input\n");
286 } 288 }
287 } else { 289 } else {
288 adswitch = 0; 290 adswitch = 0;
@@ -299,7 +301,7 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
299 301
300 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { 302 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
301 if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) 303 if (ves1820_writereg(dev, 0x09, 0x0f, 0x20))
302 dprintk(1, "setting band in demodulator failed.\n"); 304 dprintk(1, "setting band in demodulator failed\n");
303 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 305 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
304 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) 306 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
305 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) 307 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
@@ -413,7 +415,7 @@ static int vidioc_g_frequency(struct file *file, void *fh, struct v4l2_frequency
413 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 415 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
414 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv; 416 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
415 417
416 dprintk(2, "VIDIOC_G_FREQ: freq:0x%08x.\n", f->frequency); 418 dprintk(2, "VIDIOC_G_FREQ: freq:0x%08x\n", f->frequency);
417 419
418 if (!av7110->analog_tuner_flags || av7110->current_input != 1) 420 if (!av7110->analog_tuner_flags || av7110->current_input != 1)
419 return -EINVAL; 421 return -EINVAL;
@@ -429,7 +431,7 @@ static int vidioc_s_frequency(struct file *file, void *fh, struct v4l2_frequency
429 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 431 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
430 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv; 432 struct av7110 *av7110 = (struct av7110 *)dev->ext_priv;
431 433
432 dprintk(2, "VIDIOC_S_FREQUENCY: freq:0x%08x.\n", f->frequency); 434 dprintk(2, "VIDIOC_S_FREQUENCY: freq:0x%08x\n", f->frequency);
433 435
434 if (!av7110->analog_tuner_flags || av7110->current_input != 1) 436 if (!av7110->analog_tuner_flags || av7110->current_input != 1)
435 return -EINVAL; 437 return -EINVAL;
@@ -689,12 +691,12 @@ int av7110_init_analog_module(struct av7110 *av7110)
689 691
690 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 && 692 if (i2c_writereg(av7110, 0x80, 0x0, 0x80) == 1 &&
691 i2c_writereg(av7110, 0x80, 0x0, 0) == 1) { 693 i2c_writereg(av7110, 0x80, 0x0, 0) == 1) {
692 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3400\n", 694 pr_info("DVB-C analog module @ card %d detected, initializing MSP3400\n",
693 av7110->dvb_adapter.num); 695 av7110->dvb_adapter.num);
694 av7110->adac_type = DVB_ADAC_MSP34x0; 696 av7110->adac_type = DVB_ADAC_MSP34x0;
695 } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 && 697 } else if (i2c_writereg(av7110, 0x84, 0x0, 0x80) == 1 &&
696 i2c_writereg(av7110, 0x84, 0x0, 0) == 1) { 698 i2c_writereg(av7110, 0x84, 0x0, 0) == 1) {
697 printk("dvb-ttpci: DVB-C analog module @ card %d detected, initializing MSP3415\n", 699 pr_info("DVB-C analog module @ card %d detected, initializing MSP3415\n",
698 av7110->dvb_adapter.num); 700 av7110->dvb_adapter.num);
699 av7110->adac_type = DVB_ADAC_MSP34x5; 701 av7110->adac_type = DVB_ADAC_MSP34x5;
700 } else 702 } else
@@ -715,7 +717,7 @@ int av7110_init_analog_module(struct av7110 *av7110)
715 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART 717 msp_writereg(av7110, MSP_WR_DSP, 0x000d, 0x1900); // prescale SCART
716 718
717 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) { 719 if (i2c_writereg(av7110, 0x48, 0x01, 0x00)!=1) {
718 INFO(("saa7113 not accessible.\n")); 720 pr_info("saa7113 not accessible\n");
719 } else { 721 } else {
720 u8 *i = saa7113_init_regs; 722 u8 *i = saa7113_init_regs;
721 723
@@ -733,7 +735,7 @@ int av7110_init_analog_module(struct av7110 *av7110)
733 /* setup for DVB by default */ 735 /* setup for DVB by default */
734 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) { 736 if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
735 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) 737 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20))
736 dprintk(1, "setting band in demodulator failed.\n"); 738 dprintk(1, "setting band in demodulator failed\n");
737 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 739 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
738 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) 740 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
739 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) 741 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
@@ -797,7 +799,7 @@ int av7110_init_v4l(struct av7110 *av7110)
797 ret = saa7146_vv_init(dev, vv_data); 799 ret = saa7146_vv_init(dev, vv_data);
798 800
799 if (ret) { 801 if (ret) {
800 ERR(("cannot init capture device. skipping.\n")); 802 ERR("cannot init capture device. skipping\n");
801 return -ENODEV; 803 return -ENODEV;
802 } 804 }
803 vv_data->ops.vidioc_enum_input = vidioc_enum_input; 805 vv_data->ops.vidioc_enum_input = vidioc_enum_input;
@@ -814,12 +816,12 @@ int av7110_init_v4l(struct av7110 *av7110)
814 vv_data->ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out; 816 vv_data->ops.vidioc_s_fmt_sliced_vbi_out = vidioc_s_fmt_sliced_vbi_out;
815 817
816 if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) { 818 if (saa7146_register_device(&av7110->v4l_dev, dev, "av7110", VFL_TYPE_GRABBER)) {
817 ERR(("cannot register capture device. skipping.\n")); 819 ERR("cannot register capture device. skipping\n");
818 saa7146_vv_release(dev); 820 saa7146_vv_release(dev);
819 return -ENODEV; 821 return -ENODEV;
820 } 822 }
821 if (saa7146_register_device(&av7110->vbi_dev, dev, "av7110", VFL_TYPE_VBI)) 823 if (saa7146_register_device(&av7110->vbi_dev, dev, "av7110", VFL_TYPE_VBI))
822 ERR(("cannot register vbi v4l2 device. skipping.\n")); 824 ERR("cannot register vbi v4l2 device. skipping\n");
823 return 0; 825 return 0;
824} 826}
825 827
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index e957d7690bc..78d32f7e49f 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -33,6 +33,8 @@
33 * the project's page is at http://www.linuxtv.org/ 33 * the project's page is at http://www.linuxtv.org/
34 */ 34 */
35 35
36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
37
36#include "budget.h" 38#include "budget.h"
37#include "stv0299.h" 39#include "stv0299.h"
38#include "stb0899_drv.h" 40#include "stb0899_drv.h"
@@ -149,7 +151,7 @@ static int ciintf_read_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int ad
149 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 1); 151 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 1);
150 if (result == -ETIMEDOUT) { 152 if (result == -ETIMEDOUT) {
151 ciintf_slot_shutdown(ca, slot); 153 ciintf_slot_shutdown(ca, slot);
152 printk(KERN_INFO "budget-av: cam ejected 1\n"); 154 pr_info("cam ejected 1\n");
153 } 155 }
154 return result; 156 return result;
155} 157}
@@ -168,7 +170,7 @@ static int ciintf_write_attribute_mem(struct dvb_ca_en50221 *ca, int slot, int a
168 result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 1); 170 result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 1);
169 if (result == -ETIMEDOUT) { 171 if (result == -ETIMEDOUT) {
170 ciintf_slot_shutdown(ca, slot); 172 ciintf_slot_shutdown(ca, slot);
171 printk(KERN_INFO "budget-av: cam ejected 2\n"); 173 pr_info("cam ejected 2\n");
172 } 174 }
173 return result; 175 return result;
174} 176}
@@ -187,7 +189,7 @@ static int ciintf_read_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addre
187 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0); 189 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0);
188 if (result == -ETIMEDOUT) { 190 if (result == -ETIMEDOUT) {
189 ciintf_slot_shutdown(ca, slot); 191 ciintf_slot_shutdown(ca, slot);
190 printk(KERN_INFO "budget-av: cam ejected 3\n"); 192 pr_info("cam ejected 3\n");
191 return -ETIMEDOUT; 193 return -ETIMEDOUT;
192 } 194 }
193 return result; 195 return result;
@@ -207,7 +209,7 @@ static int ciintf_write_cam_control(struct dvb_ca_en50221 *ca, int slot, u8 addr
207 result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 3, 1, value, 0, 0); 209 result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 3, 1, value, 0, 0);
208 if (result == -ETIMEDOUT) { 210 if (result == -ETIMEDOUT) {
209 ciintf_slot_shutdown(ca, slot); 211 ciintf_slot_shutdown(ca, slot);
210 printk(KERN_INFO "budget-av: cam ejected 5\n"); 212 pr_info("cam ejected 5\n");
211 } 213 }
212 return result; 214 return result;
213} 215}
@@ -289,7 +291,7 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open
289 if (saa7146_read(saa, PSR) & MASK_06) { 291 if (saa7146_read(saa, PSR) & MASK_06) {
290 if (budget_av->slot_status == SLOTSTATUS_NONE) { 292 if (budget_av->slot_status == SLOTSTATUS_NONE) {
291 budget_av->slot_status = SLOTSTATUS_PRESENT; 293 budget_av->slot_status = SLOTSTATUS_PRESENT;
292 printk(KERN_INFO "budget-av: cam inserted A\n"); 294 pr_info("cam inserted A\n");
293 } 295 }
294 } 296 }
295 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO); 297 saa7146_setgpio(saa, 3, SAA7146_GPIO_OUTLO);
@@ -306,11 +308,11 @@ static int ciintf_poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open
306 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1); 308 result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, 0, 1, 0, 1);
307 if ((result >= 0) && (budget_av->slot_status == SLOTSTATUS_NONE)) { 309 if ((result >= 0) && (budget_av->slot_status == SLOTSTATUS_NONE)) {
308 budget_av->slot_status = SLOTSTATUS_PRESENT; 310 budget_av->slot_status = SLOTSTATUS_PRESENT;
309 printk(KERN_INFO "budget-av: cam inserted B\n"); 311 pr_info("cam inserted B\n");
310 } else if (result < 0) { 312 } else if (result < 0) {
311 if (budget_av->slot_status != SLOTSTATUS_NONE) { 313 if (budget_av->slot_status != SLOTSTATUS_NONE) {
312 ciintf_slot_shutdown(ca, slot); 314 ciintf_slot_shutdown(ca, slot);
313 printk(KERN_INFO "budget-av: cam ejected 5\n"); 315 pr_info("cam ejected 5\n");
314 return 0; 316 return 0;
315 } 317 }
316 } 318 }
@@ -365,11 +367,11 @@ static int ciintf_init(struct budget_av *budget_av)
365 367
366 if ((result = dvb_ca_en50221_init(&budget_av->budget.dvb_adapter, 368 if ((result = dvb_ca_en50221_init(&budget_av->budget.dvb_adapter,
367 &budget_av->ca, 0, 1)) != 0) { 369 &budget_av->ca, 0, 1)) != 0) {
368 printk(KERN_ERR "budget-av: ci initialisation failed.\n"); 370 pr_err("ci initialisation failed\n");
369 goto error; 371 goto error;
370 } 372 }
371 373
372 printk(KERN_INFO "budget-av: ci interface initialised.\n"); 374 pr_info("ci interface initialised\n");
373 return 0; 375 return 0;
374 376
375error: 377error:
@@ -896,7 +898,6 @@ static const struct stb0899_s1_reg knc1_stb0899_s1_init_1[] = {
896 { STB0899_DISRX_ST0 , 0x04 }, 898 { STB0899_DISRX_ST0 , 0x04 },
897 { STB0899_DISRX_ST1 , 0x00 }, 899 { STB0899_DISRX_ST1 , 0x00 },
898 { STB0899_DISPARITY , 0x00 }, 900 { STB0899_DISPARITY , 0x00 },
899 { STB0899_DISFIFO , 0x00 },
900 { STB0899_DISSTATUS , 0x20 }, 901 { STB0899_DISSTATUS , 0x20 },
901 { STB0899_DISF22 , 0x8c }, 902 { STB0899_DISF22 , 0x8c },
902 { STB0899_DISF22RX , 0x9a }, 903 { STB0899_DISF22RX , 0x9a },
@@ -1197,6 +1198,7 @@ static u8 read_pwm(struct budget_av *budget_av)
1197#define SUBID_DVBC_KNC1 0x0020 1198#define SUBID_DVBC_KNC1 0x0020
1198#define SUBID_DVBC_KNC1_PLUS 0x0021 1199#define SUBID_DVBC_KNC1_PLUS 0x0021
1199#define SUBID_DVBC_KNC1_MK3 0x0022 1200#define SUBID_DVBC_KNC1_MK3 0x0022
1201#define SUBID_DVBC_KNC1_TDA10024 0x0028
1200#define SUBID_DVBC_KNC1_PLUS_MK3 0x0023 1202#define SUBID_DVBC_KNC1_PLUS_MK3 0x0023
1201#define SUBID_DVBC_CINERGY1200 0x1156 1203#define SUBID_DVBC_CINERGY1200 0x1156
1202#define SUBID_DVBC_CINERGY1200_MK3 0x1176 1204#define SUBID_DVBC_CINERGY1200_MK3 0x1176
@@ -1316,6 +1318,7 @@ static void frontend_init(struct budget_av *budget_av)
1316 case SUBID_DVBC_EASYWATCH_MK3: 1318 case SUBID_DVBC_EASYWATCH_MK3:
1317 case SUBID_DVBC_CINERGY1200_MK3: 1319 case SUBID_DVBC_CINERGY1200_MK3:
1318 case SUBID_DVBC_KNC1_MK3: 1320 case SUBID_DVBC_KNC1_MK3:
1321 case SUBID_DVBC_KNC1_TDA10024:
1319 case SUBID_DVBC_KNC1_PLUS_MK3: 1322 case SUBID_DVBC_KNC1_PLUS_MK3:
1320 budget_av->reinitialise_demod = 1; 1323 budget_av->reinitialise_demod = 1;
1321 budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; 1324 budget_av->budget.dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
@@ -1343,8 +1346,7 @@ static void frontend_init(struct budget_av *budget_av)
1343 } 1346 }
1344 1347
1345 if (fe == NULL) { 1348 if (fe == NULL) {
1346 printk(KERN_ERR "budget-av: A frontend driver was not found " 1349 pr_err("A frontend driver was not found for device [%04x:%04x] subsystem [%04x:%04x]\n",
1347 "for device [%04x:%04x] subsystem [%04x:%04x]\n",
1348 saa->pci->vendor, 1350 saa->pci->vendor,
1349 saa->pci->device, 1351 saa->pci->device,
1350 saa->pci->subsystem_vendor, 1352 saa->pci->subsystem_vendor,
@@ -1356,7 +1358,7 @@ static void frontend_init(struct budget_av *budget_av)
1356 1358
1357 if (dvb_register_frontend(&budget_av->budget.dvb_adapter, 1359 if (dvb_register_frontend(&budget_av->budget.dvb_adapter,
1358 budget_av->budget.dvb_frontend)) { 1360 budget_av->budget.dvb_frontend)) {
1359 printk(KERN_ERR "budget-av: Frontend registration failed!\n"); 1361 pr_err("Frontend registration failed!\n");
1360 dvb_frontend_detach(budget_av->budget.dvb_frontend); 1362 dvb_frontend_detach(budget_av->budget.dvb_frontend);
1361 budget_av->budget.dvb_frontend = NULL; 1363 budget_av->budget.dvb_frontend = NULL;
1362 } 1364 }
@@ -1414,7 +1416,7 @@ static struct v4l2_input knc1_inputs[KNC1_INPUTS] = {
1414 1416
1415static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) 1417static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
1416{ 1418{
1417 dprintk(1, "VIDIOC_ENUMINPUT %d.\n", i->index); 1419 dprintk(1, "VIDIOC_ENUMINPUT %d\n", i->index);
1418 if (i->index >= KNC1_INPUTS) 1420 if (i->index >= KNC1_INPUTS)
1419 return -EINVAL; 1421 return -EINVAL;
1420 memcpy(i, &knc1_inputs[i->index], sizeof(struct v4l2_input)); 1422 memcpy(i, &knc1_inputs[i->index], sizeof(struct v4l2_input));
@@ -1428,7 +1430,7 @@ static int vidioc_g_input(struct file *file, void *fh, unsigned int *i)
1428 1430
1429 *i = budget_av->cur_input; 1431 *i = budget_av->cur_input;
1430 1432
1431 dprintk(1, "VIDIOC_G_INPUT %d.\n", *i); 1433 dprintk(1, "VIDIOC_G_INPUT %d\n", *i);
1432 return 0; 1434 return 0;
1433} 1435}
1434 1436
@@ -1437,7 +1439,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
1437 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 1439 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
1438 struct budget_av *budget_av = (struct budget_av *)dev->ext_priv; 1440 struct budget_av *budget_av = (struct budget_av *)dev->ext_priv;
1439 1441
1440 dprintk(1, "VIDIOC_S_INPUT %d.\n", input); 1442 dprintk(1, "VIDIOC_S_INPUT %d\n", input);
1441 return saa7113_setinput(budget_av, input); 1443 return saa7113_setinput(budget_av, input);
1442} 1444}
1443 1445
@@ -1476,7 +1478,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1476 1478
1477 if (0 != saa7146_vv_init(dev, &vv_data)) { 1479 if (0 != saa7146_vv_init(dev, &vv_data)) {
1478 /* fixme: proper cleanup here */ 1480 /* fixme: proper cleanup here */
1479 ERR(("cannot init vv subsystem.\n")); 1481 ERR("cannot init vv subsystem\n");
1480 return err; 1482 return err;
1481 } 1483 }
1482 vv_data.ops.vidioc_enum_input = vidioc_enum_input; 1484 vv_data.ops.vidioc_enum_input = vidioc_enum_input;
@@ -1485,7 +1487,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1485 1487
1486 if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1", VFL_TYPE_GRABBER))) { 1488 if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1", VFL_TYPE_GRABBER))) {
1487 /* fixme: proper cleanup here */ 1489 /* fixme: proper cleanup here */
1488 ERR(("cannot register capture v4l2 device.\n")); 1490 ERR("cannot register capture v4l2 device\n");
1489 saa7146_vv_release(dev); 1491 saa7146_vv_release(dev);
1490 return err; 1492 return err;
1491 } 1493 }
@@ -1502,13 +1504,12 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1502 1504
1503 mac = budget_av->budget.dvb_adapter.proposed_mac; 1505 mac = budget_av->budget.dvb_adapter.proposed_mac;
1504 if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) { 1506 if (i2c_readregs(&budget_av->budget.i2c_adap, 0xa0, 0x30, mac, 6)) {
1505 printk(KERN_ERR "KNC1-%d: Could not read MAC from KNC1 card\n", 1507 pr_err("KNC1-%d: Could not read MAC from KNC1 card\n",
1506 budget_av->budget.dvb_adapter.num); 1508 budget_av->budget.dvb_adapter.num);
1507 memset(mac, 0, 6); 1509 memset(mac, 0, 6);
1508 } else { 1510 } else {
1509 printk(KERN_INFO "KNC1-%d: MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", 1511 pr_info("KNC1-%d: MAC addr = %pM\n",
1510 budget_av->budget.dvb_adapter.num, 1512 budget_av->budget.dvb_adapter.num, mac);
1511 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
1512 } 1513 }
1513 1514
1514 budget_av->budget.dvb_adapter.priv = budget_av; 1515 budget_av->budget.dvb_adapter.priv = budget_av;
@@ -1558,6 +1559,7 @@ MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
1558MAKE_BUDGET_INFO(knc1spx4, "KNC1 DVB-S Plus X4", BUDGET_KNC1SP); 1559MAKE_BUDGET_INFO(knc1spx4, "KNC1 DVB-S Plus X4", BUDGET_KNC1SP);
1559MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP); 1560MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
1560MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3); 1561MAKE_BUDGET_INFO(knc1cmk3, "KNC1 DVB-C MK3", BUDGET_KNC1C_MK3);
1562MAKE_BUDGET_INFO(knc1ctda10024, "KNC1 DVB-C TDA10024", BUDGET_KNC1C_TDA10024);
1561MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3); 1563MAKE_BUDGET_INFO(knc1cpmk3, "KNC1 DVB-C Plus MK3", BUDGET_KNC1CP_MK3);
1562MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP); 1564MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP);
1563MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S); 1565MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
@@ -1587,6 +1589,7 @@ static struct pci_device_id pci_tbl[] = {
1587 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020), 1589 MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
1588 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021), 1590 MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
1589 MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022), 1591 MAKE_EXTENSION_PCI(knc1cmk3, 0x1894, 0x0022),
1592 MAKE_EXTENSION_PCI(knc1ctda10024, 0x1894, 0x0028),
1590 MAKE_EXTENSION_PCI(knc1cpmk3, 0x1894, 0x0023), 1593 MAKE_EXTENSION_PCI(knc1cpmk3, 0x1894, 0x0023),
1591 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030), 1594 MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030),
1592 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031), 1595 MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031),
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 926f299b522..ca02e972217 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -1053,7 +1053,6 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_1[] = {
1053 { STB0899_DISRX_ST0 , 0x04 }, 1053 { STB0899_DISRX_ST0 , 0x04 },
1054 { STB0899_DISRX_ST1 , 0x00 }, 1054 { STB0899_DISRX_ST1 , 0x00 },
1055 { STB0899_DISPARITY , 0x00 }, 1055 { STB0899_DISPARITY , 0x00 },
1056 { STB0899_DISFIFO , 0x00 },
1057 { STB0899_DISSTATUS , 0x20 }, 1056 { STB0899_DISSTATUS , 0x20 },
1058 { STB0899_DISF22 , 0x8c }, 1057 { STB0899_DISF22 , 0x8c },
1059 { STB0899_DISF22RX , 0x9a }, 1058 { STB0899_DISF22RX , 0x9a },
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index 37666d4edab..37d02fe0913 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -110,6 +110,7 @@ static int start_ts_capture(struct budget *budget)
110 break; 110 break;
111 case BUDGET_CIN1200C_MK3: 111 case BUDGET_CIN1200C_MK3:
112 case BUDGET_KNC1C_MK3: 112 case BUDGET_KNC1C_MK3:
113 case BUDGET_KNC1C_TDA10024:
113 case BUDGET_KNC1CP_MK3: 114 case BUDGET_KNC1CP_MK3:
114 if (budget->video_port == BUDGET_VIDEO_PORTA) { 115 if (budget->video_port == BUDGET_VIDEO_PORTA) {
115 saa7146_write(dev, DD1_INIT, 0x06000200); 116 saa7146_write(dev, DD1_INIT, 0x06000200);
@@ -434,6 +435,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
434 case BUDGET_KNC1CP: 435 case BUDGET_KNC1CP:
435 case BUDGET_CIN1200C: 436 case BUDGET_CIN1200C:
436 case BUDGET_KNC1C_MK3: 437 case BUDGET_KNC1C_MK3:
438 case BUDGET_KNC1C_TDA10024:
437 case BUDGET_KNC1CP_MK3: 439 case BUDGET_KNC1CP_MK3:
438 case BUDGET_CIN1200C_MK3: 440 case BUDGET_CIN1200C_MK3:
439 budget->buffer_width = TS_WIDTH_DVBC; 441 budget->buffer_width = TS_WIDTH_DVBC;
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h
index 3ad0c6789ba..3d8a806c20b 100644
--- a/drivers/media/dvb/ttpci/budget.h
+++ b/drivers/media/dvb/ttpci/budget.h
@@ -104,6 +104,7 @@ static struct saa7146_pci_extension_data x_var = { \
104#define BUDGET_KNC1C_MK3 16 104#define BUDGET_KNC1C_MK3 16
105#define BUDGET_KNC1CP_MK3 17 105#define BUDGET_KNC1CP_MK3 17
106#define BUDGET_KNC1S2 18 106#define BUDGET_KNC1S2 18
107#define BUDGET_KNC1C_TDA10024 19
107 108
108#define BUDGET_VIDEO_PORTA 0 109#define BUDGET_VIDEO_PORTA 0
109#define BUDGET_VIDEO_PORTB 1 110#define BUDGET_VIDEO_PORTB 1
diff --git a/drivers/media/dvb/ttpci/ttpci-eeprom.c b/drivers/media/dvb/ttpci/ttpci-eeprom.c
index 7dd54b3026a..32d43156c54 100644
--- a/drivers/media/dvb/ttpci/ttpci-eeprom.c
+++ b/drivers/media/dvb/ttpci/ttpci-eeprom.c
@@ -85,6 +85,35 @@ static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC)
85 return 0; 85 return 0;
86} 86}
87 87
88int ttpci_eeprom_decode_mac(u8 *decodedMAC, u8 *encodedMAC)
89{
90 u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c,
91 0x54, 0xd3, 0x7b, 0xf1, 0x9E, 0x23, 0x16, 0xf6,
92 0x1d, 0x36, 0x64, 0x78};
93 u8 data[20];
94 int i;
95
96 memcpy(data, encodedMAC, 20);
97
98 for (i = 0; i < 20; i++)
99 data[i] ^= xor[i];
100 for (i = 0; i < 10; i++)
101 data[i] = ((data[2 * i + 1] << 8) | data[2 * i])
102 >> ((data[2 * i + 1] >> 6) & 3);
103
104 if (check_mac_tt(data))
105 return -ENODEV;
106
107 decodedMAC[0] = data[2];
108 decodedMAC[1] = data[1];
109 decodedMAC[2] = data[0];
110 decodedMAC[3] = data[6];
111 decodedMAC[4] = data[5];
112 decodedMAC[5] = data[4];
113 return 0;
114}
115EXPORT_SYMBOL(ttpci_eeprom_decode_mac);
116
88static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC) 117static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encodedMAC)
89{ 118{
90 int ret; 119 int ret;
diff --git a/drivers/media/dvb/ttpci/ttpci-eeprom.h b/drivers/media/dvb/ttpci/ttpci-eeprom.h
index e2dc6cfe205..dcc33d5a5cb 100644
--- a/drivers/media/dvb/ttpci/ttpci-eeprom.h
+++ b/drivers/media/dvb/ttpci/ttpci-eeprom.h
@@ -28,6 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30 30
31extern int ttpci_eeprom_decode_mac(u8 *decodedMAC, u8 *encodedMAC);
31extern int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *propsed_mac); 32extern int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *propsed_mac);
32 33
33#endif 34#endif