From 80018286441ec3d8129279c47b46de1b3190ec56 Mon Sep 17 00:00:00 2001 From: Stefan Saraev Date: Mon, 13 May 2013 00:16:03 +0300 Subject: [PATCH] linux: update ngene/octopus patch to latest now supports more cards including cine s2 v6.5 & octopus v3. needs testing --- .../3.9.1/linux-221-ngene-octopus.patch | 904 ++++++++++++++---- 1 file changed, 729 insertions(+), 175 deletions(-) diff --git a/packages/linux/patches/3.9.1/linux-221-ngene-octopus.patch b/packages/linux/patches/3.9.1/linux-221-ngene-octopus.patch index f4cdbbb151..ea092a58f9 100644 --- a/packages/linux/patches/3.9.1/linux-221-ngene-octopus.patch +++ b/packages/linux/patches/3.9.1/linux-221-ngene-octopus.patch @@ -1,33 +1,33 @@ -From 592b8fbe08cff1b44c656633563b0e5c811545e5 Mon Sep 17 00:00:00 2001 +From c5891c83d5777a2e691c2a452a7f57a6b6a13344 Mon Sep 17 00:00:00 2001 From: Stefan Saraev -Date: Tue, 26 Mar 2013 12:48:13 +0200 +Date: Sun, 12 May 2013 23:47:07 +0300 Subject: [PATCH] dvb: ngene/octopus --- - drivers/media/dvb-frontends/Kconfig | 18 + + drivers/media/dvb-frontends/Kconfig | 26 + drivers/media/dvb-frontends/Makefile | 2 + drivers/media/dvb-frontends/stv0367dd.c | 2269 +++++++++++++++++ drivers/media/dvb-frontends/stv0367dd.h | 17 + drivers/media/dvb-frontends/stv0367dd_regs.h | 3431 ++++++++++++++++++++++++++ drivers/media/dvb-frontends/tda18212dd.c | 906 +++++++ drivers/media/dvb-frontends/tda18212dd.h | 5 + - drivers/media/pci/ddbridge/Kconfig | 4 + - drivers/media/pci/ddbridge/ddbridge-core.c | 1837 +++++++++++---- + drivers/media/pci/ddbridge/Kconfig | 14 +- + drivers/media/pci/ddbridge/ddbridge-core.c | 1947 ++++++++++++---- drivers/media/pci/ddbridge/ddbridge-regs.h | 56 +- drivers/media/pci/ddbridge/ddbridge.h | 97 +- - drivers/media/pci/ngene/Kconfig | 3 + + drivers/media/pci/ngene/Kconfig | 17 +- drivers/media/pci/ngene/Makefile | 3 +- drivers/media/pci/ngene/ngene-av.c | 348 +++ - drivers/media/pci/ngene/ngene-cards.c | 627 +++++- - drivers/media/pci/ngene/ngene-core.c | 357 +++- + drivers/media/pci/ngene/ngene-cards.c | 778 +++++-- + drivers/media/pci/ngene/ngene-core.c | 378 +++- drivers/media/pci/ngene/ngene-dvb.c | 372 +++ drivers/media/pci/ngene/ngene-eeprom.c | 284 +++ drivers/media/pci/ngene/ngene-i2c.c | 113 + drivers/media/pci/ngene/ngene.h | 40 + - drivers/staging/media/cxd2099/Makefile | 6 +- drivers/staging/media/cxd2099/TODO | 12 - - drivers/staging/media/cxd2099/cxd2099.c | 5 +- - 23 files changed, 10328 insertions(+), 484 deletions(-) + drivers/staging/media/cxd2099/cxd2099.c | 47 +- + drivers/staging/media/cxd2099/cxd2099.h | 2 +- + 23 files changed, 10416 insertions(+), 748 deletions(-) create mode 100644 drivers/media/dvb-frontends/stv0367dd.c create mode 100644 drivers/media/dvb-frontends/stv0367dd.h create mode 100644 drivers/media/dvb-frontends/stv0367dd_regs.h @@ -38,17 +38,32 @@ Subject: [PATCH] dvb: ngene/octopus delete mode 100644 drivers/staging/media/cxd2099/TODO diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig -index 5efec73..e2483f9 100644 +index 05cf66f..1e0275f 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig -@@ -56,6 +56,24 @@ config DVB_TDA18271C2DD +@@ -19,6 +19,14 @@ config DVB_STB0899 + A DVB-S/S2/DSS Multistandard demodulator. Say Y when you want + to support this demodulator based frontends + ++config DVB_CXD2099 ++ tristate "CXD2099AR Common Interface driver" ++ depends on DVB_CORE && PCI && I2C ++ ---help--- ++ Support for the CI module found on cards based on ++ - Micronas ngene PCIe bridge: cineS2 etc. ++ - Digital Devices PCIe bridge: Octopus series ++ + config DVB_STB6100 + tristate "STB6100 based tuners" + depends on DVB_CORE && I2C +@@ -63,6 +71,24 @@ config DVB_TDA18271C2DD Say Y when you want to support this tuner. +config DVB_STV0367DD + tristate "STV 0367 (DD)" + depends on DVB_CORE && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT ++ default m if DVB_FE_CUSTOMISE + help + STV 0367 DVB-C/T demodulator (Digital Devices driver). + @@ -57,7 +72,7 @@ index 5efec73..e2483f9 100644 +config DVB_TDA18212DD + tristate "NXP TDA18212 silicon tuner (DD)" + depends on DVB_CORE && I2C -+ default m if !MEDIA_SUBDRV_AUTOSELECT ++ default m if DVB_FE_CUSTOMISE + help + NXP TDA18212 silicon tuner (Digital Devices driver). + @@ -67,10 +82,10 @@ index 5efec73..e2483f9 100644 depends on DVB_CORE diff --git a/drivers/media/dvb-frontends/Makefile b/drivers/media/dvb-frontends/Makefile -index 7eb73bb..b8820aa 100644 +index 75440de..25ab5f8 100644 --- a/drivers/media/dvb-frontends/Makefile +++ b/drivers/media/dvb-frontends/Makefile -@@ -95,6 +95,8 @@ obj-$(CONFIG_DVB_STV0367) += stv0367.o +@@ -100,6 +100,8 @@ obj-$(CONFIG_DVB_STV0367) += stv0367.o obj-$(CONFIG_DVB_CXD2820R) += cxd2820r.o obj-$(CONFIG_DVB_DRXK) += drxk.o obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o @@ -6738,21 +6753,26 @@ index 0000000..687fab4 + struct i2c_adapter *i2c, u8 adr); +#endif diff --git a/drivers/media/pci/ddbridge/Kconfig b/drivers/media/pci/ddbridge/Kconfig -index 44e5dc1..bd3c922 100644 +index 44e5dc1..0a4ae75 100644 --- a/drivers/media/pci/ddbridge/Kconfig +++ b/drivers/media/pci/ddbridge/Kconfig @@ -1,11 +1,14 @@ config DVB_DDBRIDGE tristate "Digital Devices bridge support" depends on DVB_CORE && PCI && I2C +- select DVB_LNBP21 if MEDIA_SUBDRV_AUTOSELECT +- select DVB_STV6110x if MEDIA_SUBDRV_AUTOSELECT +- select DVB_STV090x if MEDIA_SUBDRV_AUTOSELECT +- select DVB_DRXK if MEDIA_SUBDRV_AUTOSELECT +- select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT + select DVB_CXD2099 - select DVB_LNBP21 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV6110x if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV090x if MEDIA_SUBDRV_AUTOSELECT - select DVB_DRXK if MEDIA_SUBDRV_AUTOSELECT - select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_STV0367DD if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_TDA18212DD if MEDIA_SUBDRV_AUTOSELECT ++ select DVB_LNBP21 if !DVB_FE_CUSTOMISE ++ select DVB_STV6110x if !DVB_FE_CUSTOMISE ++ select DVB_STV090x if !DVB_FE_CUSTOMISE ++ select DVB_DRXK if !DVB_FE_CUSTOMISE ++ select DVB_TDA18271C2DD if !DVB_FE_CUSTOMISE ++ select DVB_STV0367DD if !DVB_FE_CUSTOMISE ++ select DVB_TDA18212DD if !DVB_FE_CUSTOMISE ---help--- Support for cards with the Digital Devices PCI express bridge: - Octopus PCIe Bridge @@ -6764,7 +6784,7 @@ index 44e5dc1..bd3c922 100644 Say Y if you own such a card and want to use it. diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c -index 36e3452..624a822 100644 +index 36e3452..adff8cd 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -31,11 +31,11 @@ @@ -8931,7 +8951,7 @@ index 36e3452..624a822 100644 default: return -ENOTTY; } -@@ -1481,41 +2215,249 @@ static const struct file_operations ddb_fops = { +@@ -1481,52 +2215,336 @@ static const struct file_operations ddb_fops = { .open = ddb_open, }; @@ -9128,22 +9148,35 @@ index 36e3452..624a822 100644 + __ATTR_RO(ports), + __ATTR_RO(ts_irq), + __ATTR_RO(i2c_irq), ++ __ATTR(redirect, 0666, redirect_show, redirect_store), ++ __ATTR_NULL ++}; ++ ++static struct device_attribute ddb_mod[] = { + __ATTR_MRO(mod0, mod_show), + __ATTR_MRO(mod1, mod_show), + __ATTR_MRO(mod2, mod_show), + __ATTR_MRO(mod3, mod_show), -+ __ATTR_RO(temp), -+ __ATTR(fan, 0666, fan_show, fan_store), ++}; ++ ++static struct device_attribute ddb_temp = ++ __ATTR_RO(temp); ++ ++static struct device_attribute ddb_fan = ++ __ATTR(fan, 0666, fan_show, fan_store); ++ ++static struct device_attribute ddb_led[] = { + __ATTR(led0, 0666, led_show, led_store), + __ATTR(led1, 0666, led_show, led_store), + __ATTR(led2, 0666, led_show, led_store), + __ATTR(led3, 0666, led_show, led_store), ++}; ++ ++static struct device_attribute ddb_snr[] = { + __ATTR(snr0, 0666, snr_show, snr_store), + __ATTR(snr1, 0666, snr_show, snr_store), + __ATTR(snr2, 0666, snr_show, snr_store), + __ATTR(snr3, 0666, snr_show, snr_store), -+ __ATTR(redirect, 0666, redirect_show, redirect_store), -+ __ATTR_NULL +}; + +static struct class ddb_class = { @@ -9158,7 +9191,7 @@ index 36e3452..624a822 100644 ddb_major = register_chrdev(0, DDB_NAME, &ddb_fops); if (ddb_major < 0) return ddb_major; - +- - ddb_class = class_create(THIS_MODULE, DDB_NAME); - if (IS_ERR(ddb_class)) { - unregister_chrdev(ddb_major, DDB_NAME); @@ -9177,8 +9210,52 @@ index 36e3452..624a822 100644 unregister_chrdev(ddb_major, DDB_NAME); } ++static int ddb_device_files_create(struct ddb *dev) ++{ ++ int i, error = 0; ++ ++ if (dev->info->temp_num > 0) ++ error = device_create_file(dev->ddb_dev, &ddb_temp); ++ ++ if (!error && dev->info->fan_num > 0) ++ error = device_create_file(dev->ddb_dev, &ddb_fan); ++ ++ for (i = 0; !error && (i < dev->info->led_num); i++) ++ error = device_create_file(dev->ddb_dev, &ddb_led[i]); ++ ++ for (i = 0; !error && (i < dev->info->port_num); i++) ++ error = device_create_file(dev->ddb_dev, &ddb_mod[i]); ++ ++ for (i = 0; !error && (i < dev->info->i2c_num); i++) ++ error = device_create_file(dev->ddb_dev, &ddb_snr[i]); ++ ++ return error; ++} ++ ++static void ddb_device_files_delete(struct ddb *dev) ++{ ++ int i; ++ ++ if (dev->info->temp_num > 0) ++ device_remove_file(dev->ddb_dev, &ddb_temp); ++ ++ if (dev->info->fan_num > 0) ++ device_remove_file(dev->ddb_dev, &ddb_fan); ++ ++ for (i = 0; i < dev->info->led_num; i++) ++ device_remove_file(dev->ddb_dev, &ddb_led[i]); ++ ++ for (i = 0; i < dev->info->port_num; i++) ++ device_remove_file(dev->ddb_dev, &ddb_mod[i]); ++ ++ for (i = 0; i < dev->info->i2c_num; i++) ++ device_remove_file(dev->ddb_dev, &ddb_snr[i]); ++} ++ static int ddb_device_create(struct ddb *dev) { ++ int error = -1; ++ + mutex_lock(&ddb_mutex); dev->nr = ddb_num++; - dev->ddb_dev = device_create(ddb_class, NULL, @@ -9188,10 +9265,32 @@ index 36e3452..624a822 100644 MKDEV(ddb_major, dev->nr), dev, "ddbridge%d", dev->nr); - ddbs[dev->nr] = dev; - if (IS_ERR(dev->ddb_dev)) - return -1; +- if (IS_ERR(dev->ddb_dev)) +- return -1; ++ if (IS_ERR(dev->ddb_dev)) { ++ printk(KERN_ERR ": Could not create ddbridge device\n"); ++ goto fail1; ++ } ++ error = ddb_device_files_create(dev); ++ if (error) { ++ printk(KERN_ERR ": Could not create ddbridge sysfs files\n"); ++ goto fail2; ++ } ++ return 0; -@@ -1523,10 +2465,9 @@ static int ddb_device_create(struct ddb *dev) ++ ++fail2: ++ ddb_device_files_delete(dev); ++ device_destroy(&ddb_class, MKDEV(ddb_major, dev->nr)); ++ ++fail1: ++ mutex_lock(&ddb_mutex); ++ ddb_num--; ++ ddbs[dev->nr] = NULL; ++ mutex_unlock(&ddb_mutex); ++ ++ return error; + } static void ddb_device_destroy(struct ddb *dev) { @@ -9199,11 +9298,12 @@ index 36e3452..624a822 100644 if (IS_ERR(dev->ddb_dev)) return; - device_destroy(ddb_class, MKDEV(ddb_major, 0)); ++ ddb_device_files_delete(dev); + device_destroy(&ddb_class, MKDEV(ddb_major, dev->nr)); } -@@ -1549,7 +2490,7 @@ static void ddb_remove(struct pci_dev *pdev) +@@ -1549,7 +2567,7 @@ static void ddb_remove(struct pci_dev *pdev) ddb_ports_detach(dev); ddb_i2c_release(dev); @@ -9212,7 +9312,15 @@ index 36e3452..624a822 100644 free_irq(dev->pdev->irq, dev); #ifdef CONFIG_PCI_MSI if (dev->msi) -@@ -1574,10 +2515,9 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) +@@ -1564,7 +2582,6 @@ static void ddb_remove(struct pci_dev *pdev) + pci_disable_device(pdev); + } + +- + static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) + { + struct ddb *dev; +@@ -1574,10 +2591,9 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (pci_enable_device(pdev) < 0) return -ENODEV; @@ -9224,7 +9332,7 @@ index 36e3452..624a822 100644 dev->pdev = pdev; pci_set_drvdata(pdev, dev); -@@ -1590,7 +2530,8 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) +@@ -1590,7 +2606,8 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) stat = -ENOMEM; goto fail; } @@ -9234,7 +9342,7 @@ index 36e3452..624a822 100644 #ifdef CONFIG_PCI_MSI if (pci_msi_enabled()) -@@ -1606,11 +2547,11 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) +@@ -1606,11 +2623,11 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) irq_flag, "DDBridge", (void *) dev); if (stat < 0) goto fail1; @@ -9251,12 +9359,14 @@ index 36e3452..624a822 100644 if (ddb_i2c_init(dev) < 0) goto fail1; -@@ -1621,7 +2562,13 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) +@@ -1621,7 +2638,14 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) } if (ddb_ports_attach(dev) < 0) goto fail3; +- ddb_device_create(dev); + - ddb_device_create(dev); ++ if (ddb_device_create(dev) < 0) ++ goto fail3; + + if (dev->info->fan_num) { + ddbwritel(dev, 1, GPIO_DIRECTION); @@ -9265,7 +9375,7 @@ index 36e3452..624a822 100644 return 0; fail3: -@@ -1631,11 +2578,14 @@ fail3: +@@ -1631,11 +2655,14 @@ fail3: fail2: printk(KERN_ERR "fail2\n"); ddb_buffers_free(dev); @@ -9281,7 +9391,7 @@ index 36e3452..624a822 100644 fail: printk(KERN_ERR "fail\n"); ddb_unmap(dev); -@@ -1657,23 +2607,71 @@ static struct ddb_info ddb_octopus = { +@@ -1657,23 +2684,78 @@ static struct ddb_info ddb_octopus = { .type = DDB_OCTOPUS, .name = "Digital Devices Octopus DVB adapter", .port_num = 4, @@ -9319,6 +9429,13 @@ index 36e3452..624a822 100644 + .i2c_num = 3, +}; + ++static struct ddb_info ddb_v6_5 = { ++ .type = DDB_OCTOPUS, ++ .name = "Digital Devices Cine S2 V6.5 DVB adapter", ++ .port_num = 4, ++ .i2c_num = 4, ++}; ++ +static struct ddb_info ddb_dvbct = { + .type = DDB_OCTOPUS, + .name = "Digital Devices DVBCT V6.1 DVB adapter", @@ -9354,7 +9471,7 @@ index 36e3452..624a822 100644 .vendor = _vend, .device = _dev, \ .subvendor = _subvend, .subdevice = _subdev, \ .driver_data = (unsigned long)&_driverdata } -@@ -1682,8 +2680,13 @@ static const struct pci_device_id ddb_id_tbl[] = { +@@ -1682,8 +2764,15 @@ static const struct pci_device_id ddb_id_tbl[] = { DDB_ID(DDVID, 0x0002, DDVID, 0x0001, ddb_octopus), DDB_ID(DDVID, 0x0003, DDVID, 0x0001, ddb_octopus), DDB_ID(DDVID, 0x0003, DDVID, 0x0002, ddb_octopus_le), @@ -9362,14 +9479,41 @@ index 36e3452..624a822 100644 + DDB_ID(DDVID, 0x0003, DDVID, 0x0003, ddb_octopus_oem), + DDB_ID(DDVID, 0x0003, DDVID, 0x0010, ddb_octopus_mini), DDB_ID(DDVID, 0x0003, DDVID, 0x0020, ddb_v6), ++ DDB_ID(DDVID, 0x0003, DDVID, 0x0021, ddb_v6_5), + DDB_ID(DDVID, 0x0003, DDVID, 0x0030, ddb_dvbct), + DDB_ID(DDVID, 0x0003, DDVID, 0xdb03, ddb_satixS2v3), ++ DDB_ID(DDVID, 0x0005, DDVID, 0x0004, ddb_octopus), + DDB_ID(DDVID, 0x0011, DDVID, 0x0040, ddb_ci), + DDB_ID(DDVID, 0x0011, DDVID, 0x0041, ddb_cis), /* in case sub-ids got deleted in flash */ DDB_ID(DDVID, 0x0003, PCI_ANY_ID, PCI_ANY_ID, ddb_none), {0} -@@ -1726,4 +2729,4 @@ module_exit(module_exit_ddbridge); +@@ -1700,18 +2789,16 @@ static struct pci_driver ddb_pci_driver = { + + static __init int module_init_ddbridge(void) + { +- int ret; ++ int stat; + + printk(KERN_INFO "Digital Devices PCIE bridge driver, " + "Copyright (C) 2010-11 Digital Devices GmbH\n"); +- +- ret = ddb_class_create(); +- if (ret < 0) +- return ret; +- ret = pci_register_driver(&ddb_pci_driver); +- if (ret < 0) ++ if (ddb_class_create()) ++ return -1; ++ stat = pci_register_driver(&ddb_pci_driver); ++ if (stat < 0) + ddb_class_destroy(); +- return ret; ++ return stat; + } + + static __exit void module_exit_ddbridge(void) +@@ -1726,4 +2813,4 @@ module_exit(module_exit_ddbridge); MODULE_DESCRIPTION("Digital Devices PCIe Bridge"); MODULE_AUTHOR("Ralph Metzler"); MODULE_LICENSE("GPL"); @@ -9642,23 +9786,30 @@ index 8b1b41d..ce2df00 100644 #endif diff --git a/drivers/media/pci/ngene/Kconfig b/drivers/media/pci/ngene/Kconfig -index 637d506..515d04f 100644 +index 637d506..14975c7 100644 --- a/drivers/media/pci/ngene/Kconfig +++ b/drivers/media/pci/ngene/Kconfig -@@ -1,6 +1,7 @@ +@@ -1,13 +1,16 @@ config DVB_NGENE tristate "Micronas nGene support" depends on DVB_CORE && PCI && I2C +- select DVB_LNBP21 if MEDIA_SUBDRV_AUTOSELECT +- select DVB_STV6110x if MEDIA_SUBDRV_AUTOSELECT +- select DVB_STV090x if MEDIA_SUBDRV_AUTOSELECT +- select DVB_LGDT330X if MEDIA_SUBDRV_AUTOSELECT +- select DVB_DRXK if MEDIA_SUBDRV_AUTOSELECT +- select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT +- select MEDIA_TUNER_MT2131 if MEDIA_SUBDRV_AUTOSELECT + select DVB_CXD2099 - select DVB_LNBP21 if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV6110x if MEDIA_SUBDRV_AUTOSELECT - select DVB_STV090x if MEDIA_SUBDRV_AUTOSELECT -@@ -8,6 +9,8 @@ config DVB_NGENE - select DVB_DRXK if MEDIA_SUBDRV_AUTOSELECT - select DVB_TDA18271C2DD if MEDIA_SUBDRV_AUTOSELECT - select MEDIA_TUNER_MT2131 if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_STV0367DD if MEDIA_SUBDRV_AUTOSELECT -+ select DVB_TDA18212DD if MEDIA_SUBDRV_AUTOSELECT ++ select DVB_LNBP21 if !DVB_FE_CUSTOMISE ++ select DVB_STV6110x if !DVB_FE_CUSTOMISE ++ select DVB_STV090x if !DVB_FE_CUSTOMISE ++ select DVB_LGDT330X if !DVB_FE_CUSTOMISE ++ select DVB_DRXK if !DVB_FE_CUSTOMISE ++ select DVB_TDA18271C2DD if !DVB_FE_CUSTOMISE ++ select DVB_STV0367DD if !DVB_FE_CUSTOMISE ++ select DVB_TDA18212DD if !DVB_FE_CUSTOMISE ++ select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE ---help--- Support for Micronas PCI express cards with nGene bridge. @@ -10031,19 +10182,21 @@ index 0000000..a86459e +}; +#endif diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c -index fad2141..56635e7 100644 +index 9e82d21..c9b1bd4 100644 --- a/drivers/media/pci/ngene/ngene-cards.c +++ b/drivers/media/pci/ngene/ngene-cards.c -@@ -44,6 +44,8 @@ +@@ -42,8 +42,8 @@ + #include "mt2131.h" + #include "tda18271c2dd.h" #include "drxk.h" - #include "drxd.h" - #include "dvb-pll.h" +-#include "drxd.h" +-#include "dvb-pll.h" +#include "tda18212dd.h" +#include "stv0367dd.h" /****************************************************************************/ -@@ -86,8 +88,98 @@ static int tuner_attach_stv6110(struct ngene_channel *chan) +@@ -86,8 +86,98 @@ static int tuner_attach_stv6110(struct ngene_channel *chan) return 0; } @@ -10114,8 +10267,7 @@ index fad2141..56635e7 100644 + &chan->i2c_adapter, &chan->dev->pci_dev->dev); + return (chan->fe) ? 0 : -ENODEV; +} - --static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) ++ +static int demod_attach_stb0899(struct ngene_channel *chan) +{ + void *feconf = chan->dev->card_info->fe_config[chan->number]; @@ -10138,12 +10290,13 @@ index fad2141..56635e7 100644 + return (chan->fe) ? 0 : -ENODEV; +} +#endif -+ + +-static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) +static int locked_gate_ctrl(struct dvb_frontend *fe, int enable) { struct ngene_channel *chan = fe->sec_priv; int status; -@@ -121,12 +213,29 @@ static int tuner_attach_tda18271(struct ngene_channel *chan) +@@ -121,12 +211,29 @@ static int tuner_attach_tda18271(struct ngene_channel *chan) return 0; } @@ -10173,7 +10326,7 @@ index fad2141..56635e7 100644 return -EINVAL; } -@@ -218,18 +327,51 @@ static int demod_attach_drxk(struct ngene_channel *chan, +@@ -218,18 +325,51 @@ static int demod_attach_drxk(struct ngene_channel *chan, struct drxk_config config; memset(&config, 0, sizeof(config)); @@ -10228,7 +10381,7 @@ index fad2141..56635e7 100644 return 0; } -@@ -279,6 +421,9 @@ static int cineS2_probe(struct ngene_channel *chan) +@@ -279,6 +419,9 @@ static int cineS2_probe(struct ngene_channel *chan) } else if (port_has_drxk(i2c, chan->number^2)) { chan->demod_type = 1; demod_attach_drxk(chan, i2c); @@ -10238,28 +10391,81 @@ index fad2141..56635e7 100644 } else { printk(KERN_ERR "No demod found on chan %d\n", chan->number); return -ENODEV; -@@ -550,6 +695,136 @@ static s16 osc_deviation(void *priv, s16 deviation, int flag) - /* Switch control (I2C gates, etc.) *****************************************/ - /****************************************************************************/ +@@ -315,249 +458,140 @@ static int demod_attach_lg330x(struct ngene_channel *chan) + return (chan->fe) ? 0 : -ENODEV; + } +-static int demod_attach_drxd(struct ngene_channel *chan) +-{ +- struct drxd_config *feconf; +- +- feconf = chan->dev->card_info->fe_config[chan->number]; +- +- chan->fe = dvb_attach(drxd_attach, feconf, chan, +- &chan->i2c_adapter, &chan->dev->pci_dev->dev); +- if (!chan->fe) { +- pr_err("No DRXD found!\n"); +- return -ENODEV; +- } +- return 0; +-} ++/****************************************************************************/ ++/* Switch control (I2C gates, etc.) *****************************************/ ++/****************************************************************************/ + +-static int tuner_attach_dtt7520x(struct ngene_channel *chan) +#if 0 +static int avf_output(struct ngene_channel *chan, int state) -+{ + { +- struct drxd_config *feconf; +- +- feconf = chan->dev->card_info->fe_config[chan->number]; +- +- if (!dvb_attach(dvb_pll_attach, chan->fe, feconf->pll_address, +- &chan->i2c_adapter, +- feconf->pll_type)) { +- pr_err("No pll(%d) found!\n", feconf->pll_type); +- return -ENODEV; +- } + if (chan->dev->card_info->avf[chan->number]) + i2c_write_register(&chan->i2c_adapter, + chan->dev->card_info->avf[chan->number], + 0xf2, state ? 0x89 : 0x80); -+ return 0; -+} -+ + return 0; + } + +-/****************************************************************************/ +-/* EEPROM TAGS **************************************************************/ +-/****************************************************************************/ +- +-#define MICNG_EE_START 0x0100 +-#define MICNG_EE_END 0x0FF0 +/* Viper expander: sw11,sw12,sw21,sw22,i2csw1,i2csw2,tsen1,tsen2 */ -+ + +-#define MICNG_EETAG_END0 0x0000 +-#define MICNG_EETAG_END1 0xFFFF +- +-/* 0x0001 - 0x000F reserved for housekeeping */ +-/* 0xFFFF - 0xFFFE reserved for housekeeping */ +- +-/* Micronas assigned tags +- EEProm tags for hardware support */ +- +-#define MICNG_EETAG_DRXD1_OSCDEVIATION 0x1000 /* 2 Bytes data */ +-#define MICNG_EETAG_DRXD2_OSCDEVIATION 0x1001 /* 2 Bytes data */ +- +-#define MICNG_EETAG_MT2060_1_1STIF 0x1100 /* 2 Bytes data */ +-#define MICNG_EETAG_MT2060_2_1STIF 0x1101 /* 2 Bytes data */ +- +-/* Tag range for OEMs */ +static int exp_set(struct ngene *dev) +{ + return i2c_write(&dev->channel[0].i2c_adapter, + dev->card_info->exp, dev->exp_val); +} -+ + +-#define MICNG_EETAG_OEM_FIRST 0xC000 +-#define MICNG_EETAG_OEM_LAST 0xFFEF +static int exp_init(struct ngene *dev) +{ + if (!dev->card_info->exp) @@ -10267,16 +10473,24 @@ index fad2141..56635e7 100644 + dev->exp_val = dev->card_info->exp_init; + return exp_set(dev); +} -+ + +-static int i2c_write_eeprom(struct i2c_adapter *adapter, +- u8 adr, u16 reg, u8 data) +static int exp_set_bit(struct ngene *dev, int bit, int val) -+{ + { +- u8 m[3] = {(reg >> 8), (reg & 0xff), data}; +- struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, +- .len = sizeof(m)}; + if (val) + set_bit(bit, &dev->exp_val); + else + clear_bit(bit, &dev->exp_val); + return exp_set(dev); +} -+ + +- if (i2c_transfer(adapter, &msg, 1) != 1) { +- pr_err(DEVICE_NAME ": Error writing EEPROM!\n"); +- return -EIO; +static int viper_switch_ctrl(struct ngene_channel *chan, int type, int val) +{ + switch (type) { @@ -10289,12 +10503,23 @@ index fad2141..56635e7 100644 + exp_set_bit(chan->dev, 0 + chan->number * 2, val ? 0 : 1); + exp_set_bit(chan->dev, 1 + chan->number * 2, val ? 1 : 0); + break; -+ } -+ return 0; -+} -+ + } + return 0; + } + +-static int i2c_read_eeprom(struct i2c_adapter *adapter, +- u8 adr, u16 reg, u8 *data, int len) +static int viper_switch_ctrl2(struct ngene_channel *chan, int type, int val) -+{ + { +- u8 msg[2] = {(reg >> 8), (reg & 0xff)}; +- struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, +- .buf = msg, .len = 2 }, +- {.addr = adr, .flags = I2C_M_RD, +- .buf = data, .len = len} }; +- +- if (i2c_transfer(adapter, msgs, 2) != 2) { +- pr_err(DEVICE_NAME ": Error reading EEPROM\n"); +- return -EIO; + switch (type) { + case 0: /* I2C tuner gate on/off */ + return exp_set_bit(chan->dev, 4 + chan->number, val); @@ -10305,25 +10530,118 @@ index fad2141..56635e7 100644 + exp_set_bit(chan->dev, 0 + chan->number * 2, val ? 0 : 1); + exp_set_bit(chan->dev, 1 + chan->number * 2, 0); + break; -+ } -+ return 0; -+} -+ + } + return 0; + } + +-static int ReadEEProm(struct i2c_adapter *adapter, +- u16 Tag, u32 MaxLen, u8 *data, u32 *pLength) +static int viper_gate_ctrl(struct dvb_frontend *fe, int enable) -+{ + { +- int status = 0; +- u16 Addr = MICNG_EE_START, Length, tag = 0; +- u8 EETag[3]; +- +- while (Addr + sizeof(u16) + 1 < MICNG_EE_END) { +- if (i2c_read_eeprom(adapter, 0x50, Addr, EETag, sizeof(EETag))) +- return -1; +- tag = (EETag[0] << 8) | EETag[1]; +- if (tag == MICNG_EETAG_END0 || tag == MICNG_EETAG_END1) +- return -1; +- if (tag == Tag) +- break; +- Addr += sizeof(u16) + 1 + EETag[2]; +- } +- if (Addr + sizeof(u16) + 1 + EETag[2] > MICNG_EE_END) { +- pr_err(DEVICE_NAME +- ": Reached EOEE @ Tag = %04x Length = %3d\n", +- tag, EETag[2]); +- return -1; +- } +- Length = EETag[2]; +- if (Length > MaxLen) +- Length = (u16) MaxLen; +- if (Length > 0) { +- Addr += sizeof(u16) + 1; +- status = i2c_read_eeprom(adapter, 0x50, Addr, data, Length); +- if (!status) { +- *pLength = EETag[2]; +-#if 0 +- if (Length < EETag[2]) +- status = STATUS_BUFFER_OVERFLOW; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + struct ngene_channel *chan = fe->misc_priv; +#else /* Why is there no misc_priv available anymore !?!?! */ + /* Well, just abuse sec :-) */ + struct ngene_channel *chan = fe->sec_priv; -+#endif + #endif +- } +- } +- return status; + struct ngene *dev = chan->dev; + + return dev->card_info->switch_ctrl(chan, 0, enable); -+} -+ + } + +-static int WriteEEProm(struct i2c_adapter *adapter, +- u16 Tag, u32 Length, u8 *data) +static int python_switch_ctrl(struct ngene_channel *chan, int type, int val) -+{ + { +- int status = 0; +- u16 Addr = MICNG_EE_START; +- u8 EETag[3]; +- u16 tag = 0; +- int retry, i; +- +- while (Addr + sizeof(u16) + 1 < MICNG_EE_END) { +- if (i2c_read_eeprom(adapter, 0x50, Addr, EETag, sizeof(EETag))) +- return -1; +- tag = (EETag[0] << 8) | EETag[1]; +- if (tag == MICNG_EETAG_END0 || tag == MICNG_EETAG_END1) +- return -1; +- if (tag == Tag) +- break; +- Addr += sizeof(u16) + 1 + EETag[2]; +- } +- if (Addr + sizeof(u16) + 1 + EETag[2] > MICNG_EE_END) { +- pr_err(DEVICE_NAME +- ": Reached EOEE @ Tag = %04x Length = %3d\n", +- tag, EETag[2]); +- return -1; +- } +- +- if (Length > EETag[2]) +- return -EINVAL; +- /* Note: We write the data one byte at a time to avoid +- issues with page sizes. (which are different for +- each manufacture and eeprom size) +- */ +- Addr += sizeof(u16) + 1; +- for (i = 0; i < Length; i++, Addr++) { +- status = i2c_write_eeprom(adapter, 0x50, Addr, data[i]); +- +- if (status) +- break; +- +- /* Poll for finishing write cycle */ +- retry = 10; +- while (retry) { +- u8 Tmp; +- +- msleep(50); +- status = i2c_read_eeprom(adapter, 0x50, Addr, &Tmp, 1); +- if (status) +- break; +- if (Tmp != data[i]) +- pr_err(DEVICE_NAME +- "eeprom write error\n"); +- retry -= 1; +- } +- if (status) { +- pr_err(DEVICE_NAME +- ": Timeout polling eeprom\n"); +- break; +- } + switch (type) { + case 0: /* I2C tuner gate on/off */ + if (chan->number > 1) @@ -10332,89 +10650,136 @@ index fad2141..56635e7 100644 + case 1: /* Stream: 0=TS 1=ITU */ + avf_output(chan, val); + return 0; -+ } + } +- return status; + return 0; -+} -+ + } + +-static int eeprom_read_ushort(struct i2c_adapter *adapter, u16 tag, u16 *data) +static int viper_reset_xc(struct dvb_frontend *fe) -+{ + { +- int stat; +- u8 buf[2]; +- u32 len = 0; +- +- stat = ReadEEProm(adapter, tag, 2, buf, &len); +- if (stat) +- return stat; +- if (len != 2) +- return -EINVAL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + struct ngene_channel *chan = fe->misc_priv; +#else + struct ngene_channel *chan = fe->sec_priv; +#endif + struct ngene *dev = chan->dev; -+ + +- *data = (buf[0] << 8) | buf[1]; +- return 0; +-} + printk(KERN_INFO DEVICE_NAME ": Reset XC3028\n"); -+ + +-static int eeprom_write_ushort(struct i2c_adapter *adapter, u16 tag, u16 data) +-{ +- int stat; +- u8 buf[2]; + if (chan->number > 1) + return -EINVAL; -+ + +- buf[0] = data >> 8; +- buf[1] = data & 0xff; +- stat = WriteEEProm(adapter, tag, 2, buf); +- if (stat) +- return stat; + ngene_command_gpio_set(dev, 3 + chan->number, 0); + msleep(150); + ngene_command_gpio_set(dev, 3 + chan->number, 1); -+ return 0; -+} -+ + return 0; + } + +-static s16 osc_deviation(void *priv, s16 deviation, int flag) +static int python_gate_ctrl(struct dvb_frontend *fe, int enable) -+{ + { +- struct ngene_channel *chan = priv; +- struct i2c_adapter *adap = &chan->i2c_adapter; +- u16 data = 0; +- +- if (flag) { +- data = (u16) deviation; +- pr_info(DEVICE_NAME ": write deviation %d\n", +- deviation); +- eeprom_write_ushort(adap, 0x1000 + chan->number, data); +- } else { +- if (eeprom_read_ushort(adap, 0x1000 + chan->number, &data)) +- data = 0; +- pr_info(DEVICE_NAME ": read deviation %d\n", +- (s16) data); +- } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + struct ngene_channel *chan = fe->misc_priv; +#else /* Why is there no misc_priv available anymore !?!?! */ + struct ngene_channel *chan = fe->sec_priv; +#endif + struct ngene *dev = chan->dev; -+ + +- return (s16) data; + if (chan->number == 0) + return ngene_command_gpio_set(dev, 3, enable); + if (chan->number == 1) + return ngene_command_gpio_set(dev, 4, enable); + return -EINVAL; -+} + } +- +-/****************************************************************************/ +-/* Switch control (I2C gates, etc.) *****************************************/ +-/****************************************************************************/ +- +#endif static struct stv090x_config fe_cineS2 = { .device = STV0900, -@@ -730,6 +1005,323 @@ static struct ngene_info ngene_info_terratec = { +@@ -705,14 +739,18 @@ static struct ngene_info ngene_info_m780 = { + .fw_version = 15, + }; + ++/****************************************************************************/ ++ ++#if 0 + static struct drxd_config fe_terratec_dvbt_0 = { + .index = 0, + .demod_address = 0x70, + .demod_revision = 0xa2, + .demoda_address = 0x00, + .pll_address = 0x60, +- .pll_type = DVB_PLL_THOMSON_DTT7520X, ++ .pll_type = DRXD_PLL_DTT7520X, + .clock = 20000, ++ .pll_set = ngene_pll_set_th_dtt7520x, + .osc_deviation = osc_deviation, + }; + +@@ -722,8 +760,9 @@ static struct drxd_config fe_terratec_dvbt_1 = { + .demod_revision = 0xa2, + .demoda_address = 0x00, + .pll_address = 0x60, +- .pll_type = DVB_PLL_THOMSON_DTT7520X, ++ .pll_type = DRXD_PLL_DTT7520X, + .clock = 20000, ++ .pll_set = ngene_pll_set_th_dtt7520x, + .osc_deviation = osc_deviation, + }; + +@@ -732,13 +771,293 @@ static struct ngene_info ngene_info_terratec = { + .name = "Terratec Integra/Cinergy2400i Dual DVB-T", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_drxd, demod_attach_drxd}, +- .tuner_attach = {tuner_attach_dtt7520x, tuner_attach_dtt7520x}, + .fe_config = {&fe_terratec_dvbt_0, &fe_terratec_dvbt_1}, + .i2c_access = 1, + }; /****************************************************************************/ -+#if 0 -+static struct drxd_config fe_terratec_dvbt_0 = { -+ .index = 0, -+ .demod_address = 0x70, -+ .demod_revision = 0xa2, -+ .demoda_address = 0x00, -+ .pll_address = 0x60, -+ .pll_type = DRXD_PLL_DTT7520X, -+ .clock = 20000, -+ .pll_set = ngene_pll_set_th_dtt7520x, -+ .osc_deviation = osc_deviation, -+}; -+ -+static struct drxd_config fe_terratec_dvbt_1 = { -+ .index = 1, -+ .demod_address = 0x71, -+ .demod_revision = 0xa2, -+ .demoda_address = 0x00, -+ .pll_address = 0x60, -+ .pll_type = DRXD_PLL_DTT7520X, -+ .clock = 20000, -+ .pll_set = ngene_pll_set_th_dtt7520x, -+ .osc_deviation = osc_deviation, -+}; -+ -+static struct ngene_info ngene_info_terratec = { -+ .type = NGENE_TERRATEC, -+ .name = "Terratec Integra/Cinergy2400i Dual DVB-T", -+ .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, -+ .demod_attach = {demod_attach_drxd, demod_attach_drxd}, -+ .fe_config = {&fe_terratec_dvbt_0, &fe_terratec_dvbt_1}, -+ .i2c_access = 1, -+}; -+ -+/****************************************************************************/ -+ +static struct mt2060_config tuner_python_0 = { + .i2c_address = 0x60, + .clock_out = 3, @@ -10699,7 +11064,7 @@ index fad2141..56635e7 100644 /****************************************************************************/ -@@ -744,6 +1336,8 @@ static struct ngene_info ngene_info_terratec = { +@@ -753,6 +1072,8 @@ static struct ngene_info ngene_info_terratec = { /****************************************************************************/ static const struct pci_device_id ngene_id_tbl[] = { @@ -10708,15 +11073,16 @@ index fad2141..56635e7 100644 NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), -@@ -753,6 +1347,31 @@ static const struct pci_device_id ngene_id_tbl[] = { +@@ -761,7 +1082,32 @@ static const struct pci_device_id ngene_id_tbl[] = { + NGENE_ID(0x18c3, 0xdd10, ngene_info_duoFlex), NGENE_ID(0x18c3, 0xdd20, ngene_info_duoFlex), NGENE_ID(0x1461, 0x062e, ngene_info_m780), - NGENE_ID(0x153b, 0x1167, ngene_info_terratec), +#if 0 /* not (yet?) supported */ + NGENE_ID(0x18c3, 0x0000, ngene_info_appboard), + NGENE_ID(0x18c3, 0x0004, ngene_info_appboard), + NGENE_ID(0x18c3, 0x8011, ngene_info_appboard), + NGENE_ID(0x18c3, 0x8015, ngene_info_appboard_ntsc), + NGENE_ID(0x153b, 0x1167, ngene_info_terratec), + NGENE_ID(0x18c3, 0x0030, ngene_info_python), + NGENE_ID(0x18c3, 0x0052, ngene_info_sidewinder), + NGENE_ID(0x18c3, 0x8f00, ngene_info_racer), @@ -10740,8 +11106,17 @@ index fad2141..56635e7 100644 {0} }; MODULE_DEVICE_TABLE(pci, ngene_id_tbl); +@@ -798,7 +1144,7 @@ static void ngene_resume(struct pci_dev *dev) + printk(KERN_INFO DEVICE_NAME ": resume\n"); + } + +-static const struct pci_error_handlers ngene_errors = { ++static struct pci_error_handlers ngene_errors = { + .error_detected = ngene_error_detected, + .link_reset = ngene_link_reset, + .slot_reset = ngene_slot_reset, diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c -index 37ebc42..34411f1 100644 +index 37ebc42..84510db 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -86,6 +86,14 @@ static void event_tasklet(unsigned long data) @@ -10773,7 +11148,34 @@ index 37ebc42..34411f1 100644 if (nextWriteIndex != dev->EventQueueReadIndex) { dev->EventQueue[dev->EventQueueWriteIndex] = *(dev->EventBuffer); -@@ -316,12 +331,24 @@ static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com) +@@ -258,16 +273,22 @@ static void dump_command_io(struct ngene *dev) + u8 buf[8], *b; + + ngcpyfrom(buf, HOST_TO_NGENE, 8); +- printk(KERN_ERR "host_to_ngene (%04x): %*ph\n", HOST_TO_NGENE, 8, buf); ++ printk(KERN_ERR "host_to_ngene (%04x): %02x %02x %02x %02x %02x %02x %02x %02x\n", ++ HOST_TO_NGENE, buf[0], buf[1], buf[2], buf[3], ++ buf[4], buf[5], buf[6], buf[7]); + + ngcpyfrom(buf, NGENE_TO_HOST, 8); +- printk(KERN_ERR "ngene_to_host (%04x): %*ph\n", NGENE_TO_HOST, 8, buf); ++ printk(KERN_ERR "ngene_to_host (%04x): %02x %02x %02x %02x %02x %02x %02x %02x\n", ++ NGENE_TO_HOST, buf[0], buf[1], buf[2], buf[3], ++ buf[4], buf[5], buf[6], buf[7]); + + b = dev->hosttongene; +- printk(KERN_ERR "dev->hosttongene (%p): %*ph\n", b, 8, b); ++ printk(KERN_ERR "dev->hosttongene (%p): %02x %02x %02x %02x %02x %02x %02x %02x\n", ++ b, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]); + + b = dev->ngenetohost; +- printk(KERN_ERR "dev->ngenetohost (%p): %*ph\n", b, 8, b); ++ printk(KERN_ERR "dev->ngenetohost (%p): %02x %02x %02x %02x %02x %02x %02x %02x\n", ++ b, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]); + } + + static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com) +@@ -316,12 +337,24 @@ static int ngene_command_mutex(struct ngene *dev, struct ngene_command *com) ngwritel(1, FORCE_INT); ret = wait_event_timeout(dev->cmd_wq, dev->cmd_done == 1, 2 * HZ); @@ -10798,7 +11200,7 @@ index 37ebc42..34411f1 100644 dump_command_io(dev); return -1; } -@@ -348,6 +375,19 @@ int ngene_command(struct ngene *dev, struct ngene_command *com) +@@ -348,6 +381,19 @@ int ngene_command(struct ngene *dev, struct ngene_command *com) return result; } @@ -10818,7 +11220,7 @@ index 37ebc42..34411f1 100644 static int ngene_command_load_firmware(struct ngene *dev, u8 *ngene_fw, u32 size) -@@ -382,6 +422,83 @@ static int ngene_command_load_firmware(struct ngene *dev, +@@ -382,6 +428,83 @@ static int ngene_command_load_firmware(struct ngene *dev, return ngene_command(dev, &com); } @@ -10902,7 +11304,7 @@ index 37ebc42..34411f1 100644 static int ngene_command_config_buf(struct ngene *dev, u8 config) { -@@ -427,6 +544,18 @@ int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level) +@@ -427,6 +550,18 @@ int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level) return ngene_command(dev, &com); } @@ -10921,7 +11323,7 @@ index 37ebc42..34411f1 100644 /* 02000640 is sample on rising edge. -@@ -512,6 +641,17 @@ void FillTSBuffer(void *Buffer, int Length, u32 Flags) +@@ -512,6 +647,17 @@ void FillTSBuffer(void *Buffer, int Length, u32 Flags) } } @@ -10939,7 +11341,7 @@ index 37ebc42..34411f1 100644 static void flush_buffers(struct ngene_channel *chan) { -@@ -732,6 +872,14 @@ void set_transfer(struct ngene_channel *chan, int state) +@@ -732,6 +878,14 @@ void set_transfer(struct ngene_channel *chan, int state) if (dev->card_info->switch_ctrl) dev->card_info->switch_ctrl(chan, 1, state ^ 1); @@ -10954,7 +11356,18 @@ index 37ebc42..34411f1 100644 if (state) { spin_lock_irq(&chan->state_lock); -@@ -771,6 +919,89 @@ void set_transfer(struct ngene_channel *chan, int state) +@@ -752,8 +906,8 @@ void set_transfer(struct ngene_channel *chan, int state) + if (chan->mode & NGENE_IO_TSIN) + chan->pBufferExchange = tsin_exchange; + spin_unlock_irq(&chan->state_lock); +- } +- /* else printk(KERN_INFO DEVICE_NAME ": lock=%08x\n", ++ } else ++ ;/* printk(KERN_INFO DEVICE_NAME ": lock=%08x\n", + ngreadl(0x9310)); */ + + ret = ngene_command_stream_control(dev, chan->number, +@@ -771,6 +925,89 @@ void set_transfer(struct ngene_channel *chan, int state) } } @@ -11044,7 +11457,7 @@ index 37ebc42..34411f1 100644 /****************************************************************************/ /* nGene hardware init and release functions ********************************/ -@@ -1065,6 +1296,85 @@ static u32 Buffer2Sizes[MAX_STREAM] = { +@@ -1065,6 +1302,85 @@ static u32 Buffer2Sizes[MAX_STREAM] = { 0 }; @@ -11130,7 +11543,7 @@ index 37ebc42..34411f1 100644 static int AllocCommonBuffers(struct ngene *dev) { -@@ -1318,6 +1628,10 @@ static int ngene_buffer_config(struct ngene *dev) +@@ -1318,6 +1634,10 @@ static int ngene_buffer_config(struct ngene *dev) u8 tsin12_config[6] = { 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 }; u8 tsin1234_config[6] = { 0x30, 0x30, 0x00, 0x30, 0x30, 0x00 }; u8 tsio1235_config[6] = { 0x30, 0x30, 0x00, 0x28, 0x00, 0x38 }; @@ -11141,7 +11554,7 @@ index 37ebc42..34411f1 100644 u8 *bconf = tsin12_config; if (dev->card_info->io_type[2]&NGENE_IO_TSIN && -@@ -1327,10 +1641,22 @@ static int ngene_buffer_config(struct ngene *dev) +@@ -1327,10 +1647,22 @@ static int ngene_buffer_config(struct ngene *dev) dev->ci.en) bconf = tsio1235_config; } @@ -11164,7 +11577,7 @@ index 37ebc42..34411f1 100644 if (dev->card_info->io_type[3] == NGENE_IO_TSIN) bconf = BUFFER_CONFIG_3333; stat = ngene_command_config_buf(dev, bconf); -@@ -1403,8 +1729,10 @@ static int ngene_start(struct ngene *dev) +@@ -1403,8 +1735,10 @@ static int ngene_start(struct ngene *dev) if (stat < 0) goto fail; @@ -11176,7 +11589,7 @@ index 37ebc42..34411f1 100644 fail: ngwritel(0, NGENE_INT_ENABLE); free_irq(dev->pci_dev->irq, dev); -@@ -1688,6 +2016,33 @@ int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) +@@ -1688,10 +2022,36 @@ int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) dev->i2c_current_bus = -1; @@ -11209,7 +11622,12 @@ index 37ebc42..34411f1 100644 +#endif /* Register DVB adapters and devices for both channels */ - stat = init_channels(dev); +- stat = init_channels(dev); +- if (stat < 0) ++ if (init_channels(dev) < 0) + goto fail2; + + return 0; diff --git a/drivers/media/pci/ngene/ngene-dvb.c b/drivers/media/pci/ngene/ngene-dvb.c index fcb16a6..8049e2b 100644 --- a/drivers/media/pci/ngene/ngene-dvb.c @@ -12128,19 +12546,6 @@ index 22c39ff..e3ae00c 100644 #endif /* LocalWords: Endif -diff --git a/drivers/staging/media/cxd2099/Makefile b/drivers/staging/media/cxd2099/Makefile -index b2905e6..e509dd7 100644 ---- a/drivers/staging/media/cxd2099/Makefile -+++ b/drivers/staging/media/cxd2099/Makefile -@@ -1,5 +1,5 @@ - obj-$(CONFIG_DVB_CXD2099) += cxd2099.o - --ccflags-y += -Idrivers/media/dvb-core/ --ccflags-y += -Idrivers/media/dvb-frontends/ --ccflags-y += -Idrivers/media/tuners/ -+EXTRA_CFLAGS += -Idrivers/media/dvb-core/ -+EXTRA_CFLAGS += -Idrivers/media/dvb-frontends/ -+EXTRA_CFLAGS += -Idrivers/media/tuners/ diff --git a/drivers/staging/media/cxd2099/TODO b/drivers/staging/media/cxd2099/TODO deleted file mode 100644 index 375bb6f..0000000 @@ -12160,10 +12565,49 @@ index 375bb6f..0000000 - -Patches should be submitted to: linux-media@vger.kernel.org. diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c -index 0ff1972..ce49e2d 100644 +index 822c487..6d54b01 100644 --- a/drivers/staging/media/cxd2099/cxd2099.c +++ b/drivers/staging/media/cxd2099/cxd2099.c -@@ -117,9 +117,10 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, +@@ -66,9 +66,8 @@ static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr, + struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2}; + + if (i2c_transfer(adapter, &msg, 1) != 1) { +- dev_err(&adapter->dev, +- "Failed to write to I2C register %02x@%02x!\n", +- reg, adr); ++ printk(KERN_ERR "Failed to write to I2C register %02x@%02x!\n", ++ reg, adr); + return -1; + } + return 0; +@@ -80,7 +79,7 @@ static int i2c_write(struct i2c_adapter *adapter, u8 adr, + struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len}; + + if (i2c_transfer(adapter, &msg, 1) != 1) { +- dev_err(&adapter->dev, "Failed to write to I2C!\n"); ++ printk(KERN_ERR "Failed to write to I2C!\n"); + return -1; + } + return 0; +@@ -95,7 +94,7 @@ static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, + .buf = val, .len = 1} }; + + if (i2c_transfer(adapter, msgs, 2) != 2) { +- dev_err(&adapter->dev, "error in i2c_read_reg\n"); ++ printk(KERN_ERR "error in i2c_read_reg\n"); + return -1; + } + return 0; +@@ -110,7 +109,7 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, + .buf = data, .len = n} }; + + if (i2c_transfer(adapter, msgs, 2) != 2) { +- dev_err(&adapter->dev, "error in i2c_read\n"); ++ printk(KERN_ERR "error in i2c_read\n"); + return -1; + } + return 0; +@@ -118,9 +117,10 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, static int read_block(struct cxd *ci, u8 adr, u8 *data, u8 n) { @@ -12176,6 +12620,116 @@ index 0ff1972..ce49e2d 100644 if (!status) { ci->lastaddress = adr; status = i2c_read(ci->i2c, ci->cfg.adr, 1, data, n); +@@ -278,7 +278,7 @@ static void cam_mode(struct cxd *ci, int mode) + #ifdef BUFFER_MODE + if (!ci->en.read_data) + return; +- dev_info(&ci->i2c->dev, "enable cam buffer mode\n"); ++ printk(KERN_INFO "enable cam buffer mode\n"); + /* write_reg(ci, 0x0d, 0x00); */ + /* write_reg(ci, 0x0e, 0x01); */ + write_regm(ci, 0x08, 0x40, 0x40); +@@ -525,7 +525,7 @@ static int slot_reset(struct dvb_ca_en50221 *ca, int slot) + msleep(10); + #if 0 + read_reg(ci, 0x06, &val); +- dev_info(&ci->i2c->dev, "%d:%02x\n", i, val); ++ printk(KERN_INFO "%d:%02x\n", i, val); + if (!(val&0x10)) + break; + #else +@@ -543,7 +543,7 @@ static int slot_shutdown(struct dvb_ca_en50221 *ca, int slot) + { + struct cxd *ci = ca->data; + +- dev_info(&ci->i2c->dev, "slot_shutdown\n"); ++ printk(KERN_INFO "slot_shutdown\n"); + mutex_lock(&ci->lock); + write_regm(ci, 0x09, 0x08, 0x08); + write_regm(ci, 0x20, 0x80, 0x80); /* Reset CAM Mode */ +@@ -579,10 +579,10 @@ static int campoll(struct cxd *ci) + + if (istat&0x40) { + ci->dr = 1; +- dev_info(&ci->i2c->dev, "DR\n"); ++ printk(KERN_INFO "DR\n"); + } + if (istat&0x20) +- dev_info(&ci->i2c->dev, "WC\n"); ++ printk(KERN_INFO "WC\n"); + + if (istat&2) { + u8 slotstat; +@@ -598,7 +598,7 @@ static int campoll(struct cxd *ci) + if (ci->slot_stat) { + ci->slot_stat = 0; + write_regm(ci, 0x03, 0x00, 0x08); +- dev_info(&ci->i2c->dev, "NO CAM\n"); ++ printk(KERN_INFO "NO CAM\n"); + ci->ready = 0; + } + } +@@ -635,7 +635,7 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) + campoll(ci); + mutex_unlock(&ci->lock); + +- dev_info(&ci->i2c->dev, "read_data\n"); ++ printk(KERN_INFO "read_data\n"); + if (!ci->dr) + return 0; + +@@ -684,29 +684,30 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, + void *priv, + struct i2c_adapter *i2c) + { +- struct cxd *ci; ++ struct cxd *ci = 0; + u8 val; + + if (i2c_read_reg(i2c, cfg->adr, 0, &val) < 0) { +- dev_info(&i2c->dev, "No CXD2099 detected at %02x\n", cfg->adr); +- return NULL; ++ printk(KERN_INFO "No CXD2099 detected at %02x\n", cfg->adr); ++ return 0; + } + +- ci = kzalloc(sizeof(struct cxd), GFP_KERNEL); ++ ci = kmalloc(sizeof(struct cxd), GFP_KERNEL); + if (!ci) +- return NULL; ++ return 0; ++ memset(ci, 0, sizeof(*ci)); + + mutex_init(&ci->lock); +- ci->cfg = *cfg; ++ memcpy(&ci->cfg, cfg, sizeof(struct cxd2099_cfg)); + ci->i2c = i2c; + ci->lastaddress = 0xff; + ci->clk_reg_b = 0x4a; + ci->clk_reg_f = 0x1b; + +- ci->en = en_templ; ++ memcpy(&ci->en, &en_templ, sizeof(en_templ)); + ci->en.data = ci; + init(ci); +- dev_info(&i2c->dev, "Attached CXD2099AR at %02x\n", ci->cfg.adr); ++ printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->cfg.adr); + return &ci->en; + } + EXPORT_SYMBOL(cxd2099_attach); +diff --git a/drivers/staging/media/cxd2099/cxd2099.h b/drivers/staging/media/cxd2099/cxd2099.h +index 0eb607c..19c588a 100644 +--- a/drivers/staging/media/cxd2099/cxd2099.h ++++ b/drivers/staging/media/cxd2099/cxd2099.h +@@ -43,7 +43,7 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, + static inline struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, + void *priv, struct i2c_adapter *i2c) + { +- dev_warn(&i2c->dev, "%s: driver disabled by Kconfig\n", __func__); ++ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + return NULL; + } + #endif -- 1.7.2.5