aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx88
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-11-13 07:07:38 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-18 05:14:27 -0500
commit65bc2fe86e667077b38a63ce6cb40677be09bc4f (patch)
tree4265666424069755951d918f5357b79b94972a4d /drivers/media/pci/cx88
parent3b0cb24f96dc06d0c5c049e8327aad50c8b6ddb4 (diff)
[media] cx88: convert it to use pr_foo() macros
Instead of calling printk() directly, use pr_foo() macros, as suggested at the Kernel's coding style. Please notice that a conversion to dev_foo() is not trivial, as several parts on this driver uses pr_cont(). Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci/cx88')
-rw-r--r--drivers/media/pci/cx88/cx88-alsa.c26
-rw-r--r--drivers/media/pci/cx88/cx88-blackbird.c31
-rw-r--r--drivers/media/pci/cx88/cx88-cards.c103
-rw-r--r--drivers/media/pci/cx88/cx88-core.c126
-rw-r--r--drivers/media/pci/cx88/cx88-dsp.c17
-rw-r--r--drivers/media/pci/cx88/cx88-dvb.c61
-rw-r--r--drivers/media/pci/cx88/cx88-i2c.c19
-rw-r--r--drivers/media/pci/cx88/cx88-input.c3
-rw-r--r--drivers/media/pci/cx88/cx88-mpeg.c153
-rw-r--r--drivers/media/pci/cx88/cx88-tvaudio.c15
-rw-r--r--drivers/media/pci/cx88/cx88-vbi.c12
-rw-r--r--drivers/media/pci/cx88/cx88-video.c71
-rw-r--r--drivers/media/pci/cx88/cx88-vp3054-i2c.c8
-rw-r--r--drivers/media/pci/cx88/cx88.h9
14 files changed, 311 insertions, 343 deletions
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index 495f9a0569e0..d2f1880a157e 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -24,6 +24,9 @@
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26 26
27#include "cx88.h"
28#include "cx88-reg.h"
29
27#include <linux/module.h> 30#include <linux/module.h>
28#include <linux/init.h> 31#include <linux/init.h>
29#include <linux/device.h> 32#include <linux/device.h>
@@ -42,18 +45,11 @@
42#include <sound/tlv.h> 45#include <sound/tlv.h>
43#include <media/i2c/wm8775.h> 46#include <media/i2c/wm8775.h>
44 47
45#include "cx88.h"
46#include "cx88-reg.h"
47
48#define dprintk(level, fmt, arg...) do { \ 48#define dprintk(level, fmt, arg...) do { \
49 if (debug + 1 > level) \ 49 if (debug + 1 > level) \
50 printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg);\ 50 printk(KERN_DEBUG pr_fmt("%s: alsa: " fmt), \
51} while(0) 51 chip->core->name, ##arg); \
52 52} while (0)
53#define dprintk_core(level, fmt, arg...) do { \
54 if (debug + 1 > level) \
55 printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg);\
56} while(0)
57 53
58/**************************************************************************** 54/****************************************************************************
59 Data type declarations - Can be moded to a header file later 55 Data type declarations - Can be moded to a header file later
@@ -230,12 +226,12 @@ static void cx8801_aud_irq(snd_cx88_card_t *chip)
230 return; 226 return;
231 cx_write(MO_AUD_INTSTAT, status); 227 cx_write(MO_AUD_INTSTAT, status);
232 if (debug > 1 || (status & mask & ~0xff)) 228 if (debug > 1 || (status & mask & ~0xff))
233 cx88_print_irqbits(core->name, "irq aud", 229 cx88_print_irqbits("irq aud",
234 cx88_aud_irqs, ARRAY_SIZE(cx88_aud_irqs), 230 cx88_aud_irqs, ARRAY_SIZE(cx88_aud_irqs),
235 status, mask); 231 status, mask);
236 /* risc op code error */ 232 /* risc op code error */
237 if (status & AUD_INT_OPC_ERR) { 233 if (status & AUD_INT_OPC_ERR) {
238 printk(KERN_WARNING "%s/1: Audio risc op code error\n",core->name); 234 pr_warn("Audio risc op code error\n");
239 cx_clear(MO_AUD_DMACNTRL, 0x11); 235 cx_clear(MO_AUD_DMACNTRL, 0x11);
240 cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH25]); 236 cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH25]);
241 } 237 }
@@ -279,9 +275,7 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)
279 } 275 }
280 276
281 if (MAX_IRQ_LOOP == loop) { 277 if (MAX_IRQ_LOOP == loop) {
282 printk(KERN_ERR 278 pr_err("IRQ loop detected, disabling interrupts\n");
283 "%s/1: IRQ loop detected, disabling interrupts\n",
284 core->name);
285 cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); 279 cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT);
286 } 280 }
287 281
@@ -423,7 +417,7 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
423 int err; 417 int err;
424 418
425 if (!chip) { 419 if (!chip) {
426 printk(KERN_ERR "BUG: cx88 can't find device struct. Can't proceed with open\n"); 420 pr_err("BUG: cx88 can't find device struct. Can't proceed with open\n");
427 return -ENODEV; 421 return -ENODEV;
428 } 422 }
429 423
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c
index b532e49e8f33..4163e777825d 100644
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -26,6 +26,8 @@
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28 28
29#include "cx88.h"
30
29#include <linux/module.h> 31#include <linux/module.h>
30#include <linux/init.h> 32#include <linux/init.h>
31#include <linux/slab.h> 33#include <linux/slab.h>
@@ -38,8 +40,6 @@
38#include <media/v4l2-event.h> 40#include <media/v4l2-event.h>
39#include <media/drv-intf/cx2341x.h> 41#include <media/drv-intf/cx2341x.h>
40 42
41#include "cx88.h"
42
43MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards"); 43MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards");
44MODULE_AUTHOR("Jelle Foks <jelle@foks.us>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 44MODULE_AUTHOR("Jelle Foks <jelle@foks.us>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
45MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
@@ -49,10 +49,11 @@ static unsigned int debug;
49module_param(debug,int,0644); 49module_param(debug,int,0644);
50MODULE_PARM_DESC(debug,"enable debug messages [blackbird]"); 50MODULE_PARM_DESC(debug,"enable debug messages [blackbird]");
51 51
52#define dprintk(level, fmt, arg...) do { \ 52#define dprintk(level, fmt, arg...) do { \
53 if (debug + 1 > level) \ 53 if (debug + 1 > level) \
54 printk(KERN_DEBUG "%s/2-bb: " fmt, dev->core->name , ## arg); \ 54 printk(KERN_DEBUG pr_fmt("%s: blackbird:" fmt), \
55} while(0) 55 __func__, ##arg); \
56} while (0)
56 57
57/* ------------------------------------------------------------------ */ 58/* ------------------------------------------------------------------ */
58 59
@@ -446,14 +447,14 @@ static int blackbird_load_firmware(struct cx8802_dev *dev)
446 447
447 if (retval != 0) { 448 if (retval != 0) {
448 pr_err("Hotplug firmware request failed (%s).\n", 449 pr_err("Hotplug firmware request failed (%s).\n",
449 CX2341X_FIRM_ENC_FILENAME); 450 CX2341X_FIRM_ENC_FILENAME);
450 pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n"); 451 pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n");
451 return -EIO; 452 return -EIO;
452 } 453 }
453 454
454 if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { 455 if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) {
455 pr_err("Firmware size mismatch (have %zd, expected %d)\n", 456 pr_err("Firmware size mismatch (have %zd, expected %d)\n",
456 firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); 457 firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
457 release_firmware(firmware); 458 release_firmware(firmware);
458 return -EINVAL; 459 return -EINVAL;
459 } 460 }
@@ -1118,12 +1119,11 @@ static int blackbird_register_video(struct cx8802_dev *dev)
1118 dev->mpeg_dev.queue = &dev->vb2_mpegq; 1119 dev->mpeg_dev.queue = &dev->vb2_mpegq;
1119 err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1); 1120 err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1);
1120 if (err < 0) { 1121 if (err < 0) {
1121 printk(KERN_INFO "%s/2: can't register mpeg device\n", 1122 pr_info("can't register mpeg device\n");
1122 dev->core->name);
1123 return err; 1123 return err;
1124 } 1124 }
1125 printk(KERN_INFO "%s/2: registered device %s [mpeg]\n", 1125 pr_info("registered device %s [mpeg]\n",
1126 dev->core->name, video_device_node_name(&dev->mpeg_dev)); 1126 video_device_node_name(&dev->mpeg_dev));
1127 return 0; 1127 return 0;
1128} 1128}
1129 1129
@@ -1158,8 +1158,7 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
1158 v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl, NULL); 1158 v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl, NULL);
1159 1159
1160 /* blackbird stuff */ 1160 /* blackbird stuff */
1161 printk("%s/2: cx23416 based mpeg encoder (blackbird reference design)\n", 1161 pr_info("cx23416 based mpeg encoder (blackbird reference design)\n");
1162 core->name);
1163 host_setup(dev->core); 1162 host_setup(dev->core);
1164 1163
1165 blackbird_initialize_codec(dev); 1164 blackbird_initialize_codec(dev);
@@ -1219,8 +1218,8 @@ static struct cx8802_driver cx8802_blackbird_driver = {
1219 1218
1220static int __init blackbird_init(void) 1219static int __init blackbird_init(void)
1221{ 1220{
1222 printk(KERN_INFO "cx2388x blackbird driver version %s loaded\n", 1221 pr_info("cx2388x blackbird driver version %s loaded\n",
1223 CX88_VERSION); 1222 CX88_VERSION);
1224 return cx8802_register_driver(&cx8802_blackbird_driver); 1223 return cx8802_register_driver(&cx8802_blackbird_driver);
1225} 1224}
1226 1225
diff --git a/drivers/media/pci/cx88/cx88-cards.c b/drivers/media/pci/cx88/cx88-cards.c
index 31295b36dafc..1a65db957dcb 100644
--- a/drivers/media/pci/cx88/cx88-cards.c
+++ b/drivers/media/pci/cx88/cx88-cards.c
@@ -20,16 +20,16 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#include "cx88.h"
24#include "tea5767.h"
25#include "xc4000.h"
26
23#include <linux/init.h> 27#include <linux/init.h>
24#include <linux/module.h> 28#include <linux/module.h>
25#include <linux/pci.h> 29#include <linux/pci.h>
26#include <linux/delay.h> 30#include <linux/delay.h>
27#include <linux/slab.h> 31#include <linux/slab.h>
28 32
29#include "cx88.h"
30#include "tea5767.h"
31#include "xc4000.h"
32
33static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; 33static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
34static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; 34static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
35static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; 35static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -50,19 +50,11 @@ static int disable_ir;
50module_param(disable_ir, int, 0444); 50module_param(disable_ir, int, 0444);
51MODULE_PARM_DESC(disable_ir, "Disable IR support"); 51MODULE_PARM_DESC(disable_ir, "Disable IR support");
52 52
53#define info_printk(core, fmt, arg...) \
54 printk(KERN_INFO "%s: " fmt, core->name , ## arg)
55
56#define warn_printk(core, fmt, arg...) \
57 printk(KERN_WARNING "%s: " fmt, core->name , ## arg)
58
59#define err_printk(core, fmt, arg...) \
60 printk(KERN_ERR "%s: " fmt, core->name , ## arg)
61
62#define dprintk(level,fmt, arg...) do { \ 53#define dprintk(level,fmt, arg...) do { \
63 if (cx88_core_debug >= level) \ 54 if (cx88_core_debug >= level) \
64 printk(KERN_DEBUG "%s: " fmt, core->name , ## arg); \ 55 printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \
65 } while(0) 56 __func__, ##arg); \
57} while (0)
66 58
67 59
68/* ------------------------------------------------------------------ */ 60/* ------------------------------------------------------------------ */
@@ -2829,7 +2821,7 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
2829 if (eeprom_data[4] != 0x7d || 2821 if (eeprom_data[4] != 0x7d ||
2830 eeprom_data[5] != 0x10 || 2822 eeprom_data[5] != 0x10 ||
2831 eeprom_data[7] != 0x66) { 2823 eeprom_data[7] != 0x66) {
2832 warn_printk(core, "Leadtek eeprom invalid.\n"); 2824 pr_warn("Leadtek eeprom invalid.\n");
2833 return; 2825 return;
2834 } 2826 }
2835 2827
@@ -2847,8 +2839,8 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
2847 break; 2839 break;
2848 } 2840 }
2849 2841
2850 info_printk(core, "Leadtek Winfast 2000XP Expert config: tuner=%d, eeprom[0]=0x%02x\n", 2842 pr_info("Leadtek Winfast 2000XP Expert config: tuner=%d, eeprom[0]=0x%02x\n",
2851 core->board.tuner_type, eeprom_data[0]); 2843 core->board.tuner_type, eeprom_data[0]);
2852} 2844}
2853 2845
2854static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) 2846static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
@@ -2904,12 +2896,11 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
2904 cx_set(MO_GP0_IO, 0x008989FF); 2896 cx_set(MO_GP0_IO, 0x008989FF);
2905 break; 2897 break;
2906 default: 2898 default:
2907 warn_printk(core, "warning: unknown hauppauge model #%d\n", 2899 pr_warn("warning: unknown hauppauge model #%d\n", tv.model);
2908 tv.model);
2909 break; 2900 break;
2910 } 2901 }
2911 2902
2912 info_printk(core, "hauppauge eeprom: model=%d\n", tv.model); 2903 pr_info("hauppauge eeprom: model=%d\n", tv.model);
2913} 2904}
2914 2905
2915/* ----------------------------------------------------------------------- */ 2906/* ----------------------------------------------------------------------- */
@@ -2955,7 +2946,7 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
2955 const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner)) 2946 const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
2956 ? gdi_tuner[eeprom_data[0x0d]].name : NULL; 2947 ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
2957 2948
2958 info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown"); 2949 pr_info("GDI: tuner=%s\n", name ? name : "unknown");
2959 if (NULL == name) 2950 if (NULL == name)
2960 return; 2951 return;
2961 core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id; 2952 core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
@@ -3106,8 +3097,8 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
3106 msg.len = (i != 12 ? 5 : 2); 3097 msg.len = (i != 12 ? 5 : 2);
3107 err = i2c_transfer(&core->i2c_adap, &msg, 1); 3098 err = i2c_transfer(&core->i2c_adap, &msg, 1);
3108 if (err != 1) { 3099 if (err != 1) {
3109 warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n", 3100 pr_warn("dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n",
3110 i, err); 3101 i, err);
3111 return; 3102 return;
3112 } 3103 }
3113 } 3104 }
@@ -3229,14 +3220,14 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
3229 struct cx88_core *core; 3220 struct cx88_core *core;
3230 3221
3231 if (!i2c_algo) { 3222 if (!i2c_algo) {
3232 printk(KERN_ERR "cx88: Error - i2c private data undefined.\n"); 3223 pr_err("Error - i2c private data undefined.\n");
3233 return -EINVAL; 3224 return -EINVAL;
3234 } 3225 }
3235 3226
3236 core = i2c_algo->data; 3227 core = i2c_algo->data;
3237 3228
3238 if (!core) { 3229 if (!core) {
3239 printk(KERN_ERR "cx88: Error - device struct undefined.\n"); 3230 pr_err("Error - device struct undefined.\n");
3240 return -EINVAL; 3231 return -EINVAL;
3241 } 3232 }
3242 3233
@@ -3254,8 +3245,8 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
3254 dprintk(1, "Calling XC5000 callback\n"); 3245 dprintk(1, "Calling XC5000 callback\n");
3255 return cx88_xc5000_tuner_callback(core, command, arg); 3246 return cx88_xc5000_tuner_callback(core, command, arg);
3256 } 3247 }
3257 err_printk(core, "Error: Calling callback for tuner %d\n", 3248 pr_err("Error: Calling callback for tuner %d\n",
3258 core->board.tuner_type); 3249 core->board.tuner_type);
3259 return -EINVAL; 3250 return -EINVAL;
3260} 3251}
3261EXPORT_SYMBOL(cx88_tuner_callback); 3252EXPORT_SYMBOL(cx88_tuner_callback);
@@ -3268,25 +3259,19 @@ static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
3268 3259
3269 if (0 == pci->subsystem_vendor && 3260 if (0 == pci->subsystem_vendor &&
3270 0 == pci->subsystem_device) { 3261 0 == pci->subsystem_device) {
3271 printk(KERN_ERR 3262 pr_err("Your board has no valid PCI Subsystem ID and thus can't\n");
3272 "%s: Your board has no valid PCI Subsystem ID and thus can't\n" 3263 pr_err("be autodetected. Please pass card=<n> insmod option to\n");
3273 "%s: be autodetected. Please pass card=<n> insmod option to\n" 3264 pr_err("workaround that. Redirect complaints to the vendor of\n");
3274 "%s: workaround that. Redirect complaints to the vendor of\n" 3265 pr_err("the TV card\n");
3275 "%s: the TV card. Best regards,\n"
3276 "%s: -- tux\n",
3277 core->name,core->name,core->name,core->name,core->name);
3278 } else { 3266 } else {
3279 printk(KERN_ERR 3267 pr_err("Your board isn't known (yet) to the driver. You can\n");
3280 "%s: Your board isn't known (yet) to the driver. You can\n" 3268 pr_err("try to pick one of the existing card configs via\n");
3281 "%s: try to pick one of the existing card configs via\n" 3269 pr_err("card=<n> insmod option. Updating to the latest\n");
3282 "%s: card=<n> insmod option. Updating to the latest\n" 3270 pr_err("version might help as well.\n");
3283 "%s: version might help as well.\n",
3284 core->name,core->name,core->name,core->name);
3285 } 3271 }
3286 err_printk(core, "Here is a list of valid choices for the card=<n> insmod option:\n"); 3272 pr_err("Here is a list of valid choices for the card=<n> insmod option:\n");
3287 for (i = 0; i < ARRAY_SIZE(cx88_boards); i++) 3273 for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
3288 printk(KERN_ERR "%s: card=%d -> %s\n", 3274 pr_err(" card=%d -> %s\n", i, cx88_boards[i].name);
3289 core->name, i, cx88_boards[i].name);
3290} 3275}
3291 3276
3292static void cx88_card_setup_pre_i2c(struct cx88_core *core) 3277static void cx88_card_setup_pre_i2c(struct cx88_core *core)
@@ -3508,8 +3493,8 @@ static void cx88_card_setup(struct cx88_core *core)
3508 for (i = 0; i < ARRAY_SIZE(buffer); i++) 3493 for (i = 0; i < ARRAY_SIZE(buffer); i++)
3509 if (2 != i2c_master_send(&core->i2c_client, 3494 if (2 != i2c_master_send(&core->i2c_client,
3510 buffer[i],2)) 3495 buffer[i],2))
3511 warn_printk(core, "Unable to enable tuner(%i).\n", 3496 pr_warn("Unable to enable tuner(%i).\n",
3512 i); 3497 i);
3513 } 3498 }
3514 break; 3499 break;
3515 case CX88_BOARD_MSI_TVANYWHERE_MASTER: 3500 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
@@ -3608,29 +3593,24 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
3608 3593
3609 /* check pci quirks */ 3594 /* check pci quirks */
3610 if (pci_pci_problems & PCIPCI_TRITON) { 3595 if (pci_pci_problems & PCIPCI_TRITON) {
3611 printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n", 3596 pr_info("quirk: PCIPCI_TRITON -- set TBFX\n");
3612 name);
3613 ctrl |= CX88X_EN_TBFX; 3597 ctrl |= CX88X_EN_TBFX;
3614 } 3598 }
3615 if (pci_pci_problems & PCIPCI_NATOMA) { 3599 if (pci_pci_problems & PCIPCI_NATOMA) {
3616 printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n", 3600 pr_info("quirk: PCIPCI_NATOMA -- set TBFX\n");
3617 name);
3618 ctrl |= CX88X_EN_TBFX; 3601 ctrl |= CX88X_EN_TBFX;
3619 } 3602 }
3620 if (pci_pci_problems & PCIPCI_VIAETBF) { 3603 if (pci_pci_problems & PCIPCI_VIAETBF) {
3621 printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n", 3604 pr_info("quirk: PCIPCI_VIAETBF -- set TBFX\n");
3622 name);
3623 ctrl |= CX88X_EN_TBFX; 3605 ctrl |= CX88X_EN_TBFX;
3624 } 3606 }
3625 if (pci_pci_problems & PCIPCI_VSFX) { 3607 if (pci_pci_problems & PCIPCI_VSFX) {
3626 printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n", 3608 pr_info("quirk: PCIPCI_VSFX -- set VSFX\n");
3627 name);
3628 ctrl |= CX88X_EN_VSFX; 3609 ctrl |= CX88X_EN_VSFX;
3629 } 3610 }
3630#ifdef PCIPCI_ALIMAGIK 3611#ifdef PCIPCI_ALIMAGIK
3631 if (pci_pci_problems & PCIPCI_ALIMAGIK) { 3612 if (pci_pci_problems & PCIPCI_ALIMAGIK) {
3632 printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n", 3613 pr_info("quirk: PCIPCI_ALIMAGIK -- latency fixup\n");
3633 name);
3634 lat = 0x0A; 3614 lat = 0x0A;
3635 } 3615 }
3636#endif 3616#endif
@@ -3646,8 +3626,8 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
3646 pci_write_config_byte(pci, CX88X_DEVCTRL, value); 3626 pci_write_config_byte(pci, CX88X_DEVCTRL, value);
3647 } 3627 }
3648 if (UNSET != lat) { 3628 if (UNSET != lat) {
3649 printk(KERN_INFO "%s: setting pci latency timer to %d\n", 3629 pr_info("setting pci latency timer to %d\n",
3650 name, latency); 3630 latency);
3651 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency); 3631 pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
3652 } 3632 }
3653 return 0; 3633 return 0;
@@ -3659,9 +3639,8 @@ int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
3659 pci_resource_len(pci,0), 3639 pci_resource_len(pci,0),
3660 core->name)) 3640 core->name))
3661 return 0; 3641 return 0;
3662 printk(KERN_ERR 3642 pr_err("func %d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
3663 "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n", 3643 PCI_FUNC(pci->devfn),
3664 core->name, PCI_FUNC(pci->devfn),
3665 (unsigned long long)pci_resource_start(pci, 0), 3644 (unsigned long long)pci_resource_start(pci, 0),
3666 pci->subsystem_vendor, pci->subsystem_device); 3645 pci->subsystem_vendor, pci->subsystem_device);
3667 return -EBUSY; 3646 return -EBUSY;
@@ -3755,7 +3734,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
3755 if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB)) 3734 if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB))
3756 core->board.num_frontends = 1; 3735 core->board.num_frontends = 1;
3757 3736
3758 info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n", 3737 pr_info("subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
3759 pci->subsystem_vendor, pci->subsystem_device, core->board.name, 3738 pci->subsystem_vendor, pci->subsystem_device, core->board.name,
3760 core->boardnr, card[core->nr] == core->boardnr ? 3739 core->boardnr, card[core->nr] == core->boardnr ?
3761 "insmod option" : "autodetected", 3740 "insmod option" : "autodetected",
diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c
index 1ffd341f990d..27203e094655 100644
--- a/drivers/media/pci/cx88/cx88-core.c
+++ b/drivers/media/pci/cx88/cx88-core.c
@@ -25,6 +25,8 @@
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#include "cx88.h"
29
28#include <linux/init.h> 30#include <linux/init.h>
29#include <linux/list.h> 31#include <linux/list.h>
30#include <linux/module.h> 32#include <linux/module.h>
@@ -38,7 +40,6 @@
38#include <linux/videodev2.h> 40#include <linux/videodev2.h>
39#include <linux/mutex.h> 41#include <linux/mutex.h>
40 42
41#include "cx88.h"
42#include <media/v4l2-common.h> 43#include <media/v4l2-common.h>
43#include <media/v4l2-ioctl.h> 44#include <media/v4l2-ioctl.h>
44 45
@@ -60,10 +61,15 @@ static unsigned int nocomb;
60module_param(nocomb,int,0644); 61module_param(nocomb,int,0644);
61MODULE_PARM_DESC(nocomb,"disable comb filter"); 62MODULE_PARM_DESC(nocomb,"disable comb filter");
62 63
63#define dprintk(level,fmt, arg...) do { \ 64#define dprintk0(fmt, arg...) \
64 if (cx88_core_debug >= level) \ 65 printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \
65 printk(KERN_DEBUG "%s: " fmt, core->name , ## arg); \ 66 __func__, ##arg) \
66 } while(0) 67
68#define dprintk(level, fmt, arg...) do { \
69 if (cx88_core_debug >= level) \
70 printk(KERN_DEBUG pr_fmt("%s: core:" fmt), \
71 __func__, ##arg); \
72} while (0)
67 73
68static unsigned int cx88_devcount; 74static unsigned int cx88_devcount;
69static LIST_HEAD(cx88_devlist); 75static LIST_HEAD(cx88_devlist);
@@ -363,7 +369,7 @@ int cx88_sram_channel_setup(struct cx88_core *core,
363 cx_write(ch->cnt1_reg, (bpl >> 3) -1); 369 cx_write(ch->cnt1_reg, (bpl >> 3) -1);
364 cx_write(ch->cnt2_reg, (lines*16) >> 3); 370 cx_write(ch->cnt2_reg, (lines*16) >> 3);
365 371
366 dprintk(2,"sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines); 372 dprintk(2, "sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines);
367 return 0; 373 return 0;
368} 374}
369 375
@@ -399,12 +405,12 @@ static int cx88_risc_decode(u32 risc)
399 }; 405 };
400 int i; 406 int i;
401 407
402 printk(KERN_DEBUG "0x%08x [ %s", risc, 408 dprintk0("0x%08x [ %s", risc,
403 instr[risc >> 28] ? instr[risc >> 28] : "INVALID"); 409 instr[risc >> 28] ? instr[risc >> 28] : "INVALID");
404 for (i = ARRAY_SIZE(bits)-1; i >= 0; i--) 410 for (i = ARRAY_SIZE(bits)-1; i >= 0; i--)
405 if (risc & (1 << (i + 12))) 411 if (risc & (1 << (i + 12)))
406 printk(KERN_CONT " %s", bits[i]); 412 pr_cont(" %s", bits[i]);
407 printk(KERN_CONT " count=%d ]\n", risc & 0xfff); 413 pr_cont(" count=%d ]\n", risc & 0xfff);
408 return incr[risc >> 28] ? incr[risc >> 28] : 1; 414 return incr[risc >> 28] ? incr[risc >> 28] : 1;
409} 415}
410 416
@@ -428,43 +434,39 @@ void cx88_sram_channel_dump(struct cx88_core *core,
428 u32 risc; 434 u32 risc;
429 unsigned int i,j,n; 435 unsigned int i,j,n;
430 436
431 printk(KERN_DEBUG "%s: %s - dma channel status dump\n", 437 dprintk0("%s - dma channel status dump\n",
432 core->name,ch->name); 438 ch->name);
433 for (i = 0; i < ARRAY_SIZE(name); i++) 439 for (i = 0; i < ARRAY_SIZE(name); i++)
434 printk(KERN_DEBUG "%s: cmds: %-12s: 0x%08x\n", 440 dprintk0(" cmds: %-12s: 0x%08x\n",
435 core->name,name[i], 441 name[i],
436 cx_read(ch->cmds_start + 4*i)); 442 cx_read(ch->cmds_start + 4*i));
437 for (n = 1, i = 0; i < 4; i++) { 443 for (n = 1, i = 0; i < 4; i++) {
438 risc = cx_read(ch->cmds_start + 4 * (i+11)); 444 risc = cx_read(ch->cmds_start + 4 * (i+11));
439 printk(KERN_CONT "%s: risc%d: ", core->name, i); 445 pr_cont(" risc%d: ", i);
440 if (--n) 446 if (--n)
441 printk(KERN_CONT "0x%08x [ arg #%d ]\n", risc, n); 447 pr_cont("0x%08x [ arg #%d ]\n", risc, n);
442 else 448 else
443 n = cx88_risc_decode(risc); 449 n = cx88_risc_decode(risc);
444 } 450 }
445 for (i = 0; i < 16; i += n) { 451 for (i = 0; i < 16; i += n) {
446 risc = cx_read(ch->ctrl_start + 4 * i); 452 risc = cx_read(ch->ctrl_start + 4 * i);
447 printk(KERN_DEBUG "%s: iq %x: ", core->name, i); 453 dprintk0(" iq %x: ", i);
448 n = cx88_risc_decode(risc); 454 n = cx88_risc_decode(risc);
449 for (j = 1; j < n; j++) { 455 for (j = 1; j < n; j++) {
450 risc = cx_read(ch->ctrl_start + 4 * (i+j)); 456 risc = cx_read(ch->ctrl_start + 4 * (i+j));
451 printk(KERN_CONT "%s: iq %x: 0x%08x [ arg #%d ]\n", 457 pr_cont(" iq %x: 0x%08x [ arg #%d ]\n",
452 core->name, i+j, risc, j); 458 i + j, risc, j);
453 } 459 }
454 } 460 }
455 461
456 printk(KERN_DEBUG "%s: fifo: 0x%08x -> 0x%x\n", 462 dprintk0("fifo: 0x%08x -> 0x%x\n",
457 core->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); 463 ch->fifo_start, ch->fifo_start+ch->fifo_size);
458 printk(KERN_DEBUG "%s: ctrl: 0x%08x -> 0x%x\n", 464 dprintk0("ctrl: 0x%08x -> 0x%x\n",
459 core->name, ch->ctrl_start, ch->ctrl_start+6*16); 465 ch->ctrl_start, ch->ctrl_start + 6 * 16);
460 printk(KERN_DEBUG "%s: ptr1_reg: 0x%08x\n", 466 dprintk0(" ptr1_reg: 0x%08x\n", cx_read(ch->ptr1_reg));
461 core->name,cx_read(ch->ptr1_reg)); 467 dprintk0(" ptr2_reg: 0x%08x\n", cx_read(ch->ptr2_reg));
462 printk(KERN_DEBUG "%s: ptr2_reg: 0x%08x\n", 468 dprintk0(" cnt1_reg: 0x%08x\n", cx_read(ch->cnt1_reg));
463 core->name,cx_read(ch->ptr2_reg)); 469 dprintk0(" cnt2_reg: 0x%08x\n", cx_read(ch->cnt2_reg));
464 printk(KERN_DEBUG "%s: cnt1_reg: 0x%08x\n",
465 core->name,cx_read(ch->cnt1_reg));
466 printk(KERN_DEBUG "%s: cnt2_reg: 0x%08x\n",
467 core->name,cx_read(ch->cnt2_reg));
468} 470}
469 471
470static const char *cx88_pci_irqs[32] = { 472static const char *cx88_pci_irqs[32] = {
@@ -474,24 +476,24 @@ static const char *cx88_pci_irqs[32] = {
474 "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" 476 "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
475}; 477};
476 478
477void cx88_print_irqbits(const char *name, const char *tag, const char *strings[], 479void cx88_print_irqbits(const char *tag, const char *strings[],
478 int len, u32 bits, u32 mask) 480 int len, u32 bits, u32 mask)
479{ 481{
480 unsigned int i; 482 unsigned int i;
481 483
482 printk(KERN_DEBUG "%s: %s [0x%x]", name, tag, bits); 484 dprintk0("%s [0x%x]", tag, bits);
483 for (i = 0; i < len; i++) { 485 for (i = 0; i < len; i++) {
484 if (!(bits & (1 << i))) 486 if (!(bits & (1 << i)))
485 continue; 487 continue;
486 if (strings[i]) 488 if (strings[i])
487 printk(KERN_CONT " %s", strings[i]); 489 pr_cont(" %s", strings[i]);
488 else 490 else
489 printk(KERN_CONT " %d", i); 491 pr_cont(" %d", i);
490 if (!(mask & (1 << i))) 492 if (!(mask & (1 << i)))
491 continue; 493 continue;
492 printk(KERN_CONT "*"); 494 pr_cont("*");
493 } 495 }
494 printk(KERN_CONT "\n"); 496 pr_cont("\n");
495} 497}
496 498
497/* ------------------------------------------------------------------ */ 499/* ------------------------------------------------------------------ */
@@ -505,7 +507,7 @@ int cx88_core_irq(struct cx88_core *core, u32 status)
505 handled++; 507 handled++;
506 } 508 }
507 if (!handled) 509 if (!handled)
508 cx88_print_irqbits(core->name, "irq pci", 510 cx88_print_irqbits("irq pci",
509 cx88_pci_irqs, ARRAY_SIZE(cx88_pci_irqs), 511 cx88_pci_irqs, ARRAY_SIZE(cx88_pci_irqs),
510 status, core->pci_irqmask); 512 status, core->pci_irqmask);
511 return handled; 513 return handled;
@@ -551,7 +553,7 @@ void cx88_shutdown(struct cx88_core *core)
551 553
552int cx88_reset(struct cx88_core *core) 554int cx88_reset(struct cx88_core *core)
553{ 555{
554 dprintk(1,"%s\n",__func__); 556 dprintk(1, "");
555 cx88_shutdown(core); 557 cx88_shutdown(core);
556 558
557 /* clear irq status */ 559 /* clear irq status */
@@ -663,7 +665,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
663 unsigned int sheight = norm_maxh(core->tvnorm); 665 unsigned int sheight = norm_maxh(core->tvnorm);
664 u32 value; 666 u32 value;
665 667
666 dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height, 668 dprintk(1, "set_scale: %dx%d [%s%s,%s]\n", width, height,
667 V4L2_FIELD_HAS_TOP(field) ? "T" : "", 669 V4L2_FIELD_HAS_TOP(field) ? "T" : "",
668 V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "", 670 V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "",
669 v4l2_norm_to_name(core->tvnorm)); 671 v4l2_norm_to_name(core->tvnorm));
@@ -675,30 +677,30 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
675 value &= 0x3fe; 677 value &= 0x3fe;
676 cx_write(MO_HDELAY_EVEN, value); 678 cx_write(MO_HDELAY_EVEN, value);
677 cx_write(MO_HDELAY_ODD, value); 679 cx_write(MO_HDELAY_ODD, value);
678 dprintk(1,"set_scale: hdelay 0x%04x (width %d)\n", value,swidth); 680 dprintk(1, "set_scale: hdelay 0x%04x (width %d)\n", value, swidth);
679 681
680 value = (swidth * 4096 / width) - 4096; 682 value = (swidth * 4096 / width) - 4096;
681 cx_write(MO_HSCALE_EVEN, value); 683 cx_write(MO_HSCALE_EVEN, value);
682 cx_write(MO_HSCALE_ODD, value); 684 cx_write(MO_HSCALE_ODD, value);
683 dprintk(1,"set_scale: hscale 0x%04x\n", value); 685 dprintk(1, "set_scale: hscale 0x%04x\n", value);
684 686
685 cx_write(MO_HACTIVE_EVEN, width); 687 cx_write(MO_HACTIVE_EVEN, width);
686 cx_write(MO_HACTIVE_ODD, width); 688 cx_write(MO_HACTIVE_ODD, width);
687 dprintk(1,"set_scale: hactive 0x%04x\n", width); 689 dprintk(1, "set_scale: hactive 0x%04x\n", width);
688 690
689 // recalc V scale Register (delay is constant) 691 // recalc V scale Register (delay is constant)
690 cx_write(MO_VDELAY_EVEN, norm_vdelay(core->tvnorm)); 692 cx_write(MO_VDELAY_EVEN, norm_vdelay(core->tvnorm));
691 cx_write(MO_VDELAY_ODD, norm_vdelay(core->tvnorm)); 693 cx_write(MO_VDELAY_ODD, norm_vdelay(core->tvnorm));
692 dprintk(1,"set_scale: vdelay 0x%04x\n", norm_vdelay(core->tvnorm)); 694 dprintk(1, "set_scale: vdelay 0x%04x\n", norm_vdelay(core->tvnorm));
693 695
694 value = (0x10000 - (sheight * 512 / height - 512)) & 0x1fff; 696 value = (0x10000 - (sheight * 512 / height - 512)) & 0x1fff;
695 cx_write(MO_VSCALE_EVEN, value); 697 cx_write(MO_VSCALE_EVEN, value);
696 cx_write(MO_VSCALE_ODD, value); 698 cx_write(MO_VSCALE_ODD, value);
697 dprintk(1,"set_scale: vscale 0x%04x\n", value); 699 dprintk(1, "set_scale: vscale 0x%04x\n", value);
698 700
699 cx_write(MO_VACTIVE_EVEN, sheight); 701 cx_write(MO_VACTIVE_EVEN, sheight);
700 cx_write(MO_VACTIVE_ODD, sheight); 702 cx_write(MO_VACTIVE_ODD, sheight);
701 dprintk(1,"set_scale: vactive 0x%04x\n", sheight); 703 dprintk(1, "set_scale: vactive 0x%04x\n", sheight);
702 704
703 // setup filters 705 // setup filters
704 value = 0; 706 value = 0;
@@ -720,7 +722,7 @@ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int heig
720 722
721 cx_andor(MO_FILTER_EVEN, 0x7ffc7f, value); /* preserve PEAKEN, PSEL */ 723 cx_andor(MO_FILTER_EVEN, 0x7ffc7f, value); /* preserve PEAKEN, PSEL */
722 cx_andor(MO_FILTER_ODD, 0x7ffc7f, value); 724 cx_andor(MO_FILTER_ODD, 0x7ffc7f, value);
723 dprintk(1,"set_scale: filter 0x%04x\n", value); 725 dprintk(1, "set_scale: filter 0x%04x\n", value);
724 726
725 return 0; 727 return 0;
726} 728}
@@ -743,11 +745,11 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
743 do_div(pll,xtal); 745 do_div(pll,xtal);
744 reg = (pll & 0x3ffffff) | (pre[prescale] << 26); 746 reg = (pll & 0x3ffffff) | (pre[prescale] << 26);
745 if (((reg >> 20) & 0x3f) < 14) { 747 if (((reg >> 20) & 0x3f) < 14) {
746 printk("%s/0: pll out of range\n",core->name); 748 pr_err("pll out of range\n");
747 return -1; 749 return -1;
748 } 750 }
749 751
750 dprintk(1,"set_pll: MO_PLL_REG 0x%08x [old=0x%08x,freq=%d]\n", 752 dprintk(1, "set_pll: MO_PLL_REG 0x%08x [old=0x%08x,freq=%d]\n",
751 reg, cx_read(MO_PLL_REG), ofreq); 753 reg, cx_read(MO_PLL_REG), ofreq);
752 cx_write(MO_PLL_REG, reg); 754 cx_write(MO_PLL_REG, reg);
753 for (i = 0; i < 100; i++) { 755 for (i = 0; i < 100; i++) {
@@ -757,10 +759,10 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
757 prescale,ofreq); 759 prescale,ofreq);
758 return 0; 760 return 0;
759 } 761 }
760 dprintk(1,"pll not locked yet, waiting ...\n"); 762 dprintk(1, "pll not locked yet, waiting ...\n");
761 msleep(10); 763 msleep(10);
762 } 764 }
763 dprintk(1,"pll NOT locked [pre=%d,ofreq=%d]\n",prescale,ofreq); 765 dprintk(1, "pll NOT locked [pre=%d,ofreq=%d]\n", prescale, ofreq);
764 return -1; 766 return -1;
765} 767}
766 768
@@ -836,8 +838,8 @@ static int set_tvaudio(struct cx88_core *core)
836 core->tvaudio = WW_EIAJ; 838 core->tvaudio = WW_EIAJ;
837 839
838 } else { 840 } else {
839 printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n", 841 pr_info("tvaudio support needs work for this tv norm [%s], sorry\n",
840 core->name, v4l2_norm_to_name(core->tvnorm)); 842 v4l2_norm_to_name(core->tvnorm));
841 core->tvaudio = WW_NONE; 843 core->tvaudio = WW_NONE;
842 return 0; 844 return 0;
843 } 845 }
@@ -912,12 +914,12 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
912 cxoformat = 0x181f0008; 914 cxoformat = 0x181f0008;
913 } 915 }
914 916
915 dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n", 917 dprintk(1, "set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n",
916 v4l2_norm_to_name(core->tvnorm), fsc8, adc_clock, vdec_clock, 918 v4l2_norm_to_name(core->tvnorm), fsc8, adc_clock, vdec_clock,
917 step_db, step_dr); 919 step_db, step_dr);
918 set_pll(core,2,vdec_clock); 920 set_pll(core,2,vdec_clock);
919 921
920 dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n", 922 dprintk(1, "set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n",
921 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); 923 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
922 /* Chroma AGC must be disabled if SECAM is used, we enable it 924 /* Chroma AGC must be disabled if SECAM is used, we enable it
923 by default on PAL and NTSC */ 925 by default on PAL and NTSC */
@@ -925,35 +927,36 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
925 norm & V4L2_STD_SECAM ? cxiformat : cxiformat | 0x400); 927 norm & V4L2_STD_SECAM ? cxiformat : cxiformat | 0x400);
926 928
927 // FIXME: as-is from DScaler 929 // FIXME: as-is from DScaler
928 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", 930 dprintk(1, "set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
929 cxoformat, cx_read(MO_OUTPUT_FORMAT)); 931 cxoformat, cx_read(MO_OUTPUT_FORMAT));
930 cx_write(MO_OUTPUT_FORMAT, cxoformat); 932 cx_write(MO_OUTPUT_FORMAT, cxoformat);
931 933
932 // MO_SCONV_REG = adc clock / video dec clock * 2^17 934 // MO_SCONV_REG = adc clock / video dec clock * 2^17
933 tmp64 = adc_clock * (u64)(1 << 17); 935 tmp64 = adc_clock * (u64)(1 << 17);
934 do_div(tmp64, vdec_clock); 936 do_div(tmp64, vdec_clock);
935 dprintk(1,"set_tvnorm: MO_SCONV_REG 0x%08x [old=0x%08x]\n", 937 dprintk(1, "set_tvnorm: MO_SCONV_REG 0x%08x [old=0x%08x]\n",
936 (u32)tmp64, cx_read(MO_SCONV_REG)); 938 (u32)tmp64, cx_read(MO_SCONV_REG));
937 cx_write(MO_SCONV_REG, (u32)tmp64); 939 cx_write(MO_SCONV_REG, (u32)tmp64);
938 940
939 // MO_SUB_STEP = 8 * fsc / video dec clock * 2^22 941 // MO_SUB_STEP = 8 * fsc / video dec clock * 2^22
940 tmp64 = step_db * (u64)(1 << 22); 942 tmp64 = step_db * (u64)(1 << 22);
941 do_div(tmp64, vdec_clock); 943 do_div(tmp64, vdec_clock);
942 dprintk(1,"set_tvnorm: MO_SUB_STEP 0x%08x [old=0x%08x]\n", 944 dprintk(1, "set_tvnorm: MO_SUB_STEP 0x%08x [old=0x%08x]\n",
943 (u32)tmp64, cx_read(MO_SUB_STEP)); 945 (u32)tmp64, cx_read(MO_SUB_STEP));
944 cx_write(MO_SUB_STEP, (u32)tmp64); 946 cx_write(MO_SUB_STEP, (u32)tmp64);
945 947
946 // MO_SUB_STEP_DR = 8 * 4406250 / video dec clock * 2^22 948 // MO_SUB_STEP_DR = 8 * 4406250 / video dec clock * 2^22
947 tmp64 = step_dr * (u64)(1 << 22); 949 tmp64 = step_dr * (u64)(1 << 22);
948 do_div(tmp64, vdec_clock); 950 do_div(tmp64, vdec_clock);
949 dprintk(1,"set_tvnorm: MO_SUB_STEP_DR 0x%08x [old=0x%08x]\n", 951 dprintk(1, "set_tvnorm: MO_SUB_STEP_DR 0x%08x [old=0x%08x]\n",
950 (u32)tmp64, cx_read(MO_SUB_STEP_DR)); 952 (u32)tmp64, cx_read(MO_SUB_STEP_DR));
951 cx_write(MO_SUB_STEP_DR, (u32)tmp64); 953 cx_write(MO_SUB_STEP_DR, (u32)tmp64);
952 954
953 // bdelay + agcdelay 955 // bdelay + agcdelay
954 bdelay = vdec_clock * 65 / 20000000 + 21; 956 bdelay = vdec_clock * 65 / 20000000 + 21;
955 agcdelay = vdec_clock * 68 / 20000000 + 15; 957 agcdelay = vdec_clock * 68 / 20000000 + 15;
956 dprintk(1,"set_tvnorm: MO_AGC_BURST 0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n", 958 dprintk(1,
959 "set_tvnorm: MO_AGC_BURST 0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",
957 (bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST), bdelay, agcdelay); 960 (bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST), bdelay, agcdelay);
958 cx_write(MO_AGC_BURST, (bdelay << 8) | agcdelay); 961 cx_write(MO_AGC_BURST, (bdelay << 8) | agcdelay);
959 962
@@ -961,7 +964,8 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
961 tmp64 = norm_htotal(norm) * (u64)vdec_clock; 964 tmp64 = norm_htotal(norm) * (u64)vdec_clock;
962 do_div(tmp64, fsc8); 965 do_div(tmp64, fsc8);
963 htotal = (u32)tmp64; 966 htotal = (u32)tmp64;
964 dprintk(1,"set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n", 967 dprintk(1,
968 "set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n",
965 htotal, cx_read(MO_HTOTAL), (u32)tmp64); 969 htotal, cx_read(MO_HTOTAL), (u32)tmp64);
966 cx_andor(MO_HTOTAL, 0x07ff, htotal); 970 cx_andor(MO_HTOTAL, 0x07ff, htotal);
967 971
diff --git a/drivers/media/pci/cx88/cx88-dsp.c b/drivers/media/pci/cx88/cx88-dsp.c
index 57380c750702..4f1ec8d13389 100644
--- a/drivers/media/pci/cx88/cx88-dsp.c
+++ b/drivers/media/pci/cx88/cx88-dsp.c
@@ -19,15 +19,15 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#include "cx88.h"
23#include "cx88-reg.h"
24
22#include <linux/slab.h> 25#include <linux/slab.h>
23#include <linux/kernel.h> 26#include <linux/kernel.h>
24#include <linux/module.h> 27#include <linux/module.h>
25#include <linux/jiffies.h> 28#include <linux/jiffies.h>
26#include <asm/div64.h> 29#include <asm/div64.h>
27 30
28#include "cx88.h"
29#include "cx88-reg.h"
30
31#define INT_PI ((s32)(3.141592653589 * 32768.0)) 31#define INT_PI ((s32)(3.141592653589 * 32768.0))
32 32
33#define compat_remainder(a, b) \ 33#define compat_remainder(a, b) \
@@ -71,8 +71,11 @@ static unsigned int dsp_debug;
71module_param(dsp_debug, int, 0644); 71module_param(dsp_debug, int, 0644);
72MODULE_PARM_DESC(dsp_debug, "enable audio dsp debug messages"); 72MODULE_PARM_DESC(dsp_debug, "enable audio dsp debug messages");
73 73
74#define dprintk(level, fmt, arg...) if (dsp_debug >= level) \ 74#define dprintk(level, fmt, arg...) do { \
75 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) 75 if (dsp_debug >= level) \
76 printk(KERN_DEBUG pr_fmt("%s: dsp:" fmt), \
77 __func__, ##arg); \
78} while (0)
76 79
77static s32 int_cos(u32 x) 80static s32 int_cos(u32 x)
78{ 81{
@@ -176,8 +179,8 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
176 dual_freq = FREQ_EIAJ_DUAL; 179 dual_freq = FREQ_EIAJ_DUAL;
177 break; 180 break;
178 default: 181 default:
179 printk(KERN_WARNING "%s/0: unsupported audio mode %d for %s\n", 182 pr_warn("unsupported audio mode %d for %s\n",
180 core->name, core->tvaudio, __func__); 183 core->tvaudio, __func__);
181 return UNSET; 184 return UNSET;
182 } 185 }
183 186
diff --git a/drivers/media/pci/cx88/cx88-dvb.c b/drivers/media/pci/cx88/cx88-dvb.c
index 157bc14874eb..378135ddb6fb 100644
--- a/drivers/media/pci/cx88/cx88-dvb.c
+++ b/drivers/media/pci/cx88/cx88-dvb.c
@@ -21,6 +21,9 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24#include "cx88.h"
25#include "dvb-pll.h"
26
24#include <linux/module.h> 27#include <linux/module.h>
25#include <linux/init.h> 28#include <linux/init.h>
26#include <linux/device.h> 29#include <linux/device.h>
@@ -29,8 +32,6 @@
29#include <linux/file.h> 32#include <linux/file.h>
30#include <linux/suspend.h> 33#include <linux/suspend.h>
31 34
32#include "cx88.h"
33#include "dvb-pll.h"
34#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
35 36
36#include "mt352.h" 37#include "mt352.h"
@@ -77,8 +78,11 @@ MODULE_PARM_DESC(dvb_buf_tscnt, "DVB Buffer TS count [dvb]");
77 78
78DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 79DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
79 80
80#define dprintk(level,fmt, arg...) if (debug >= level) \ 81#define dprintk(level, fmt, arg...) do { \
81 printk(KERN_DEBUG "%s/2-dvb: " fmt, core->name, ## arg) 82 if (debug >= level) \
83 printk(KERN_DEBUG pr_fmt("%s: dvb:" fmt), \
84 __func__, ##arg); \
85} while (0)
82 86
83/* ------------------------------------------------------------------ */ 87/* ------------------------------------------------------------------ */
84 88
@@ -178,7 +182,7 @@ static int cx88_dvb_bus_ctrl(struct dvb_frontend* fe, int acquire)
178 182
179 fe_id = vb2_dvb_find_frontend(&dev->frontends, fe); 183 fe_id = vb2_dvb_find_frontend(&dev->frontends, fe);
180 if (!fe_id) { 184 if (!fe_id) {
181 printk(KERN_ERR "%s() No frontend found\n", __func__); 185 pr_err("%s() No frontend found\n", __func__);
182 return -EINVAL; 186 return -EINVAL;
183 } 187 }
184 188
@@ -625,8 +629,7 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
625 return -EINVAL; 629 return -EINVAL;
626 630
627 if (!fe0->dvb.frontend) { 631 if (!fe0->dvb.frontend) {
628 printk(KERN_ERR "%s/2: dvb frontend not attached. Can't attach xc3028\n", 632 pr_err("dvb frontend not attached. Can't attach xc3028\n");
629 dev->core->name);
630 return -EINVAL; 633 return -EINVAL;
631 } 634 }
632 635
@@ -639,16 +642,14 @@ static int attach_xc3028(u8 addr, struct cx8802_dev *dev)
639 642
640 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg); 643 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
641 if (!fe) { 644 if (!fe) {
642 printk(KERN_ERR "%s/2: xc3028 attach failed\n", 645 pr_err("xc3028 attach failed\n");
643 dev->core->name);
644 dvb_frontend_detach(fe0->dvb.frontend); 646 dvb_frontend_detach(fe0->dvb.frontend);
645 dvb_unregister_frontend(fe0->dvb.frontend); 647 dvb_unregister_frontend(fe0->dvb.frontend);
646 fe0->dvb.frontend = NULL; 648 fe0->dvb.frontend = NULL;
647 return -EINVAL; 649 return -EINVAL;
648 } 650 }
649 651
650 printk(KERN_INFO "%s/2: xc3028 attached\n", 652 pr_info("xc3028 attached\n");
651 dev->core->name);
652 653
653 return 0; 654 return 0;
654} 655}
@@ -664,23 +665,21 @@ static int attach_xc4000(struct cx8802_dev *dev, struct xc4000_config *cfg)
664 return -EINVAL; 665 return -EINVAL;
665 666
666 if (!fe0->dvb.frontend) { 667 if (!fe0->dvb.frontend) {
667 printk(KERN_ERR "%s/2: dvb frontend not attached. Can't attach xc4000\n", 668 pr_err("dvb frontend not attached. Can't attach xc4000\n");
668 dev->core->name);
669 return -EINVAL; 669 return -EINVAL;
670 } 670 }
671 671
672 fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap, 672 fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap,
673 cfg); 673 cfg);
674 if (!fe) { 674 if (!fe) {
675 printk(KERN_ERR "%s/2: xc4000 attach failed\n", 675 pr_err("xc4000 attach failed\n");
676 dev->core->name);
677 dvb_frontend_detach(fe0->dvb.frontend); 676 dvb_frontend_detach(fe0->dvb.frontend);
678 dvb_unregister_frontend(fe0->dvb.frontend); 677 dvb_unregister_frontend(fe0->dvb.frontend);
679 fe0->dvb.frontend = NULL; 678 fe0->dvb.frontend = NULL;
680 return -EINVAL; 679 return -EINVAL;
681 } 680 }
682 681
683 printk(KERN_INFO "%s/2: xc4000 attached\n", dev->core->name); 682 pr_info("xc4000 attached\n");
684 683
685 return 0; 684 return 0;
686} 685}
@@ -798,12 +797,12 @@ static int cx8802_alloc_frontends(struct cx8802_dev *dev)
798 if (!core->board.num_frontends) 797 if (!core->board.num_frontends)
799 return -ENODEV; 798 return -ENODEV;
800 799
801 printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, 800 pr_info("%s: allocating %d frontend(s)\n", __func__,
802 core->board.num_frontends); 801 core->board.num_frontends);
803 for (i = 1; i <= core->board.num_frontends; i++) { 802 for (i = 1; i <= core->board.num_frontends; i++) {
804 fe = vb2_dvb_alloc_frontend(&dev->frontends, i); 803 fe = vb2_dvb_alloc_frontend(&dev->frontends, i);
805 if (!fe) { 804 if (!fe) {
806 printk(KERN_ERR "%s() failed to alloc\n", __func__); 805 pr_err("%s() failed to alloc\n", __func__);
807 vb2_dvb_dealloc_frontends(&dev->frontends); 806 vb2_dvb_dealloc_frontends(&dev->frontends);
808 return -ENOMEM; 807 return -ENOMEM;
809 } 808 }
@@ -1007,7 +1006,7 @@ static int dvb_register(struct cx8802_dev *dev)
1007 int res = -EINVAL; 1006 int res = -EINVAL;
1008 1007
1009 if (0 != core->i2c_rc) { 1008 if (0 != core->i2c_rc) {
1010 printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name); 1009 pr_err("no i2c-bus available, cannot attach dvb drivers\n");
1011 goto frontend_detach; 1010 goto frontend_detach;
1012 } 1011 }
1013 1012
@@ -1182,8 +1181,7 @@ static int dvb_register(struct cx8802_dev *dev)
1182 goto frontend_detach; 1181 goto frontend_detach;
1183 } 1182 }
1184#else 1183#else
1185 printk(KERN_ERR "%s/2: built without vp3054 support\n", 1184 pr_err("built without vp3054 support\n");
1186 core->name);
1187#endif 1185#endif
1188 break; 1186 break;
1189 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: 1187 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
@@ -1615,15 +1613,12 @@ static int dvb_register(struct cx8802_dev *dev)
1615 break; 1613 break;
1616 1614
1617 default: 1615 default:
1618 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", 1616 pr_err("The frontend of your DVB/ATSC card isn't supported yet\n");
1619 core->name);
1620 break; 1617 break;
1621 } 1618 }
1622 1619
1623 if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) { 1620 if ( (NULL == fe0->dvb.frontend) || (fe1 && NULL == fe1->dvb.frontend) ) {
1624 printk(KERN_ERR 1621 pr_err("frontend initialization failed\n");
1625 "%s/2: frontend initialization failed\n",
1626 core->name);
1627 goto frontend_detach; 1622 goto frontend_detach;
1628 } 1623 }
1629 /* define general-purpose callback pointer */ 1624 /* define general-purpose callback pointer */
@@ -1762,7 +1757,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
1762 goto fail_core; 1757 goto fail_core;
1763 1758
1764 /* dvb stuff */ 1759 /* dvb stuff */
1765 printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name); 1760 pr_info("cx2388x based DVB/ATSC card\n");
1766 dev->ts_gen_cntrl = 0x0c; 1761 dev->ts_gen_cntrl = 0x0c;
1767 1762
1768 err = cx8802_alloc_frontends(dev); 1763 err = cx8802_alloc_frontends(dev);
@@ -1774,8 +1769,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
1774 1769
1775 fe = vb2_dvb_get_frontend(&core->dvbdev->frontends, i); 1770 fe = vb2_dvb_get_frontend(&core->dvbdev->frontends, i);
1776 if (fe == NULL) { 1771 if (fe == NULL) {
1777 printk(KERN_ERR "%s() failed to get frontend(%d)\n", 1772 pr_err("%s() failed to get frontend(%d)\n",
1778 __func__, i); 1773 __func__, i);
1779 err = -ENODEV; 1774 err = -ENODEV;
1780 goto fail_probe; 1775 goto fail_probe;
1781 } 1776 }
@@ -1803,8 +1798,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
1803 err = dvb_register(dev); 1798 err = dvb_register(dev);
1804 if (err) 1799 if (err)
1805 /* frontends/adapter de-allocated in dvb_register */ 1800 /* frontends/adapter de-allocated in dvb_register */
1806 printk(KERN_ERR "%s/2: dvb_register failed (err = %d)\n", 1801 pr_err("dvb_register failed (err = %d)\n", err);
1807 core->name, err);
1808 return err; 1802 return err;
1809fail_probe: 1803fail_probe:
1810 vb2_dvb_dealloc_frontends(&core->dvbdev->frontends); 1804 vb2_dvb_dealloc_frontends(&core->dvbdev->frontends);
@@ -1839,8 +1833,7 @@ static struct cx8802_driver cx8802_dvb_driver = {
1839 1833
1840static int __init dvb_init(void) 1834static int __init dvb_init(void)
1841{ 1835{
1842 printk(KERN_INFO "cx88/2: cx2388x dvb driver version %s loaded\n", 1836 pr_info("cx2388x dvb driver version %s loaded\n", CX88_VERSION);
1843 CX88_VERSION);
1844 return cx8802_register_driver(&cx8802_dvb_driver); 1837 return cx8802_register_driver(&cx8802_dvb_driver);
1845} 1838}
1846 1839
diff --git a/drivers/media/pci/cx88/cx88-i2c.c b/drivers/media/pci/cx88/cx88-i2c.c
index 804f7417d19f..831f8db5150e 100644
--- a/drivers/media/pci/cx88/cx88-i2c.c
+++ b/drivers/media/pci/cx88/cx88-i2c.c
@@ -27,12 +27,13 @@
27 27
28*/ 28*/
29 29
30#include "cx88.h"
31
30#include <linux/module.h> 32#include <linux/module.h>
31#include <linux/init.h> 33#include <linux/init.h>
32 34
33#include <asm/io.h> 35#include <asm/io.h>
34 36
35#include "cx88.h"
36#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
37 38
38static unsigned int i2c_debug; 39static unsigned int i2c_debug;
@@ -47,8 +48,11 @@ static unsigned int i2c_udelay = 5;
47module_param(i2c_udelay, int, 0644); 48module_param(i2c_udelay, int, 0644);
48MODULE_PARM_DESC(i2c_udelay, "i2c delay at insmod time, in usecs (should be 5 or higher). Lower value means higher bus speed."); 49MODULE_PARM_DESC(i2c_udelay, "i2c delay at insmod time, in usecs (should be 5 or higher). Lower value means higher bus speed.");
49 50
50#define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ 51#define dprintk(level, fmt, arg...) do { \
51 printk(KERN_DEBUG "%s: " fmt, core->name , ## arg) 52 if (i2c_debug >= level) \
53 printk(KERN_DEBUG pr_fmt("%s: i2c:" fmt), \
54 __func__, ##arg); \
55} while (0)
52 56
53/* ----------------------------------------------------------------------- */ 57/* ----------------------------------------------------------------------- */
54 58
@@ -126,8 +130,8 @@ static void do_i2c_scan(const char *name, struct i2c_client *c)
126 rc = i2c_master_recv(c,&buf,0); 130 rc = i2c_master_recv(c,&buf,0);
127 if (rc < 0) 131 if (rc < 0)
128 continue; 132 continue;
129 printk("%s: i2c scan: found device @ 0x%x [%s]\n", 133 pr_info("i2c scan: found device @ 0x%x [%s]\n",
130 name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); 134 i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
131 } 135 }
132} 136}
133 137
@@ -166,8 +170,7 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
166 case CX88_BOARD_HAUPPAUGE_HVR1300: 170 case CX88_BOARD_HAUPPAUGE_HVR1300:
167 case CX88_BOARD_HAUPPAUGE_HVR3000: 171 case CX88_BOARD_HAUPPAUGE_HVR3000:
168 case CX88_BOARD_HAUPPAUGE_HVR4000: 172 case CX88_BOARD_HAUPPAUGE_HVR4000:
169 printk("%s: i2c init: enabling analog demod on HVR1300/3000/4000 tuner\n", 173 pr_info("i2c init: enabling analog demod on HVR1300/3000/4000 tuner\n");
170 core->name);
171 i2c_transfer(core->i2c_client.adapter, &tuner_msg, 1); 174 i2c_transfer(core->i2c_client.adapter, &tuner_msg, 1);
172 break; 175 break;
173 default: 176 default:
@@ -176,7 +179,7 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
176 if (i2c_scan) 179 if (i2c_scan)
177 do_i2c_scan(core->name,&core->i2c_client); 180 do_i2c_scan(core->name,&core->i2c_client);
178 } else 181 } else
179 printk("%s: i2c register FAILED\n", core->name); 182 pr_err("i2c register FAILED\n");
180 183
181 return core->i2c_rc; 184 return core->i2c_rc;
182} 185}
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index cd7687183381..3a05629ba6e4 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -22,13 +22,14 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include "cx88.h"
26
25#include <linux/init.h> 27#include <linux/init.h>
26#include <linux/hrtimer.h> 28#include <linux/hrtimer.h>
27#include <linux/pci.h> 29#include <linux/pci.h>
28#include <linux/slab.h> 30#include <linux/slab.h>
29#include <linux/module.h> 31#include <linux/module.h>
30 32
31#include "cx88.h"
32#include <media/rc-core.h> 33#include <media/rc-core.h>
33 34
34#define MODULE_NAME "cx88xx" 35#define MODULE_NAME "cx88xx"
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c
index 86b46b62d985..ed3fcc8149bd 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -22,6 +22,8 @@
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25#include "cx88.h"
26
25#include <linux/module.h> 27#include <linux/module.h>
26#include <linux/slab.h> 28#include <linux/slab.h>
27#include <linux/init.h> 29#include <linux/init.h>
@@ -30,8 +32,6 @@
30#include <linux/interrupt.h> 32#include <linux/interrupt.h>
31#include <asm/delay.h> 33#include <asm/delay.h>
32 34
33#include "cx88.h"
34
35/* ------------------------------------------------------------------ */ 35/* ------------------------------------------------------------------ */
36 36
37MODULE_DESCRIPTION("mpeg driver for cx2388x based TV cards"); 37MODULE_DESCRIPTION("mpeg driver for cx2388x based TV cards");
@@ -45,15 +45,11 @@ static unsigned int debug;
45module_param(debug,int,0644); 45module_param(debug,int,0644);
46MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); 46MODULE_PARM_DESC(debug,"enable debug messages [mpeg]");
47 47
48#define dprintk(level, fmt, arg...) do { \ 48#define dprintk(level, fmt, arg...) do { \
49 if (debug + 1 > level) \ 49 if (debug + 1 > level) \
50 printk(KERN_DEBUG "%s/2-mpeg: " fmt, dev->core->name, ## arg); \ 50 printk(KERN_DEBUG pr_fmt("%s: mpeg:" fmt), \
51} while(0) 51 __func__, ##arg); \
52 52} while (0)
53#define mpeg_dbg(level, fmt, arg...) do { \
54 if (debug + 1 > level) \
55 printk(KERN_DEBUG "%s/2-mpeg: " fmt, core->name, ## arg); \
56} while(0)
57 53
58#if defined(CONFIG_MODULES) && defined(MODULE) 54#if defined(CONFIG_MODULES) && defined(MODULE)
59static void request_module_async(struct work_struct *work) 55static void request_module_async(struct work_struct *work)
@@ -92,7 +88,7 @@ int cx8802_start_dma(struct cx8802_dev *dev,
92{ 88{
93 struct cx88_core *core = dev->core; 89 struct cx88_core *core = dev->core;
94 90
95 dprintk(1, "cx8802_start_dma w: %d, h: %d, f: %d\n", 91 dprintk(1, "w: %d, h: %d, f: %d\n",
96 core->width, core->height, core->field); 92 core->width, core->height, core->field);
97 93
98 /* setup fifo + format */ 94 /* setup fifo + format */
@@ -105,12 +101,12 @@ int cx8802_start_dma(struct cx8802_dev *dev,
105 /* FIXME: this needs a review. 101 /* FIXME: this needs a review.
106 * also: move to cx88-blackbird + cx88-dvb source files? */ 102 * also: move to cx88-blackbird + cx88-dvb source files? */
107 103
108 dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id); 104 dprintk(1, "core->active_type_id = 0x%08x\n", core->active_type_id);
109 105
110 if ( (core->active_type_id == CX88_MPEG_DVB) && 106 if ( (core->active_type_id == CX88_MPEG_DVB) &&
111 (core->board.mpeg & CX88_MPEG_DVB) ) { 107 (core->board.mpeg & CX88_MPEG_DVB) ) {
112 108
113 dprintk( 1, "cx8802_start_dma doing .dvb\n"); 109 dprintk(1, "cx8802_start_dma doing .dvb\n");
114 /* negedge driven & software reset */ 110 /* negedge driven & software reset */
115 cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl); 111 cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl);
116 udelay(100); 112 udelay(100);
@@ -154,7 +150,7 @@ int cx8802_start_dma(struct cx8802_dev *dev,
154 udelay(100); 150 udelay(100);
155 } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) && 151 } else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) &&
156 (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) { 152 (core->board.mpeg & CX88_MPEG_BLACKBIRD) ) {
157 dprintk( 1, "cx8802_start_dma doing .blackbird\n"); 153 dprintk(1, "cx8802_start_dma doing .blackbird\n");
158 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ 154 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
159 155
160 cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */ 156 cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */
@@ -166,8 +162,8 @@ int cx8802_start_dma(struct cx8802_dev *dev,
166 cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */ 162 cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */
167 udelay(100); 163 udelay(100);
168 } else { 164 } else {
169 printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __func__, 165 pr_err("%s() Failed. Unsupported value in .mpeg (0x%08x)\n",
170 core->board.mpeg ); 166 __func__, core->board.mpeg);
171 return -EINVAL; 167 return -EINVAL;
172 } 168 }
173 169
@@ -176,7 +172,7 @@ int cx8802_start_dma(struct cx8802_dev *dev,
176 q->count = 0; 172 q->count = 0;
177 173
178 /* enable irqs */ 174 /* enable irqs */
179 dprintk( 1, "setting the interrupt mask\n" ); 175 dprintk(1, "setting the interrupt mask\n");
180 cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT); 176 cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT);
181 cx_set(MO_TS_INTMSK, 0x1f0011); 177 cx_set(MO_TS_INTMSK, 0x1f0011);
182 178
@@ -189,7 +185,7 @@ int cx8802_start_dma(struct cx8802_dev *dev,
189static int cx8802_stop_dma(struct cx8802_dev *dev) 185static int cx8802_stop_dma(struct cx8802_dev *dev)
190{ 186{
191 struct cx88_core *core = dev->core; 187 struct cx88_core *core = dev->core;
192 dprintk( 1, "cx8802_stop_dma\n" ); 188 dprintk(1, "\n");
193 189
194 /* stop dma */ 190 /* stop dma */
195 cx_clear(MO_TS_DMACNTRL, 0x11); 191 cx_clear(MO_TS_DMACNTRL, 0x11);
@@ -208,7 +204,7 @@ static int cx8802_restart_queue(struct cx8802_dev *dev,
208{ 204{
209 struct cx88_buffer *buf; 205 struct cx88_buffer *buf;
210 206
211 dprintk( 1, "cx8802_restart_queue\n" ); 207 dprintk(1, "\n");
212 if (list_empty(&q->active)) 208 if (list_empty(&q->active))
213 return 0; 209 return 0;
214 210
@@ -249,25 +245,25 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
249 struct cx88_buffer *prev; 245 struct cx88_buffer *prev;
250 struct cx88_dmaqueue *cx88q = &dev->mpegq; 246 struct cx88_dmaqueue *cx88q = &dev->mpegq;
251 247
252 dprintk( 1, "cx8802_buf_queue\n" ); 248 dprintk(1, "\n");
253 /* add jump to start */ 249 /* add jump to start */
254 buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8); 250 buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8);
255 buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC); 251 buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
256 buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8); 252 buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8);
257 253
258 if (list_empty(&cx88q->active)) { 254 if (list_empty(&cx88q->active)) {
259 dprintk( 1, "queue is empty - first active\n" ); 255 dprintk(1, "queue is empty - first active\n");
260 list_add_tail(&buf->list, &cx88q->active); 256 list_add_tail(&buf->list, &cx88q->active);
261 dprintk(1,"[%p/%d] %s - first active\n", 257 dprintk(1,"[%p/%d] %s - first active\n",
262 buf, buf->vb.vb2_buf.index, __func__); 258 buf, buf->vb.vb2_buf.index, __func__);
263 259
264 } else { 260 } else {
265 buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1); 261 buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
266 dprintk( 1, "queue is not empty - append to active\n" ); 262 dprintk(1, "queue is not empty - append to active\n");
267 prev = list_entry(cx88q->active.prev, struct cx88_buffer, list); 263 prev = list_entry(cx88q->active.prev, struct cx88_buffer, list);
268 list_add_tail(&buf->list, &cx88q->active); 264 list_add_tail(&buf->list, &cx88q->active);
269 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); 265 prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
270 dprintk( 1, "[%p/%d] %s - append to active\n", 266 dprintk(1, "[%p/%d] %s - append to active\n",
271 buf, buf->vb.vb2_buf.index, __func__); 267 buf, buf->vb.vb2_buf.index, __func__);
272 } 268 }
273} 269}
@@ -291,7 +287,7 @@ static void do_cancel_buffers(struct cx8802_dev *dev)
291 287
292void cx8802_cancel_buffers(struct cx8802_dev *dev) 288void cx8802_cancel_buffers(struct cx8802_dev *dev)
293{ 289{
294 dprintk( 1, "cx8802_cancel_buffers" ); 290 dprintk(1, "\n");
295 cx8802_stop_dma(dev); 291 cx8802_stop_dma(dev);
296 do_cancel_buffers(dev); 292 do_cancel_buffers(dev);
297} 293}
@@ -310,7 +306,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
310 struct cx88_core *core = dev->core; 306 struct cx88_core *core = dev->core;
311 u32 status, mask, count; 307 u32 status, mask, count;
312 308
313 dprintk( 1, "cx8802_mpeg_irq\n" ); 309 dprintk(1, "\n");
314 status = cx_read(MO_TS_INTSTAT); 310 status = cx_read(MO_TS_INTSTAT);
315 mask = cx_read(MO_TS_INTMSK); 311 mask = cx_read(MO_TS_INTMSK);
316 if (0 == (status & mask)) 312 if (0 == (status & mask))
@@ -319,20 +315,20 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
319 cx_write(MO_TS_INTSTAT, status); 315 cx_write(MO_TS_INTSTAT, status);
320 316
321 if (debug || (status & mask & ~0xff)) 317 if (debug || (status & mask & ~0xff))
322 cx88_print_irqbits(core->name, "irq mpeg ", 318 cx88_print_irqbits("irq mpeg ",
323 cx88_mpeg_irqs, ARRAY_SIZE(cx88_mpeg_irqs), 319 cx88_mpeg_irqs, ARRAY_SIZE(cx88_mpeg_irqs),
324 status, mask); 320 status, mask);
325 321
326 /* risc op code error */ 322 /* risc op code error */
327 if (status & (1 << 16)) { 323 if (status & (1 << 16)) {
328 printk(KERN_WARNING "%s: mpeg risc op code error\n",core->name); 324 pr_warn("mpeg risc op code error\n");
329 cx_clear(MO_TS_DMACNTRL, 0x11); 325 cx_clear(MO_TS_DMACNTRL, 0x11);
330 cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); 326 cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
331 } 327 }
332 328
333 /* risc1 y */ 329 /* risc1 y */
334 if (status & 0x01) { 330 if (status & 0x01) {
335 dprintk( 1, "wake up\n" ); 331 dprintk(1, "wake up\n");
336 spin_lock(&dev->slock); 332 spin_lock(&dev->slock);
337 count = cx_read(MO_TS_GPCNT); 333 count = cx_read(MO_TS_GPCNT);
338 cx88_wakeup(dev->core, &dev->mpegq, count); 334 cx88_wakeup(dev->core, &dev->mpegq, count);
@@ -341,7 +337,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev)
341 337
342 /* other general errors */ 338 /* other general errors */
343 if (status & 0x1f0100) { 339 if (status & 0x1f0100) {
344 dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 ); 340 dprintk(0, "general errors: 0x%08x\n", status & 0x1f0100);
345 spin_lock(&dev->slock); 341 spin_lock(&dev->slock);
346 cx8802_stop_dma(dev); 342 cx8802_stop_dma(dev);
347 spin_unlock(&dev->slock); 343 spin_unlock(&dev->slock);
@@ -362,9 +358,9 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id)
362 (core->pci_irqmask | PCI_INT_TSINT); 358 (core->pci_irqmask | PCI_INT_TSINT);
363 if (0 == status) 359 if (0 == status)
364 goto out; 360 goto out;
365 dprintk( 1, "cx8802_irq\n" ); 361 dprintk(1, "cx8802_irq\n");
366 dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP ); 362 dprintk(1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP);
367 dprintk( 1, " status: %d\n", status ); 363 dprintk(1, " status: %d\n", status);
368 handled = 1; 364 handled = 1;
369 cx_write(MO_PCI_INTSTAT, status); 365 cx_write(MO_PCI_INTSTAT, status);
370 366
@@ -374,9 +370,8 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id)
374 cx8802_mpeg_irq(dev); 370 cx8802_mpeg_irq(dev);
375 } 371 }
376 if (MAX_IRQ_LOOP == loop) { 372 if (MAX_IRQ_LOOP == loop) {
377 dprintk( 0, "clearing mask\n" ); 373 dprintk(0, "clearing mask\n");
378 printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", 374 pr_warn("irq loop -- clearing mask\n");
379 core->name);
380 cx_write(MO_PCI_INTMSK,0); 375 cx_write(MO_PCI_INTMSK,0);
381 } 376 }
382 377
@@ -395,16 +390,16 @@ static int cx8802_init_common(struct cx8802_dev *dev)
395 pci_set_master(dev->pci); 390 pci_set_master(dev->pci);
396 err = pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32)); 391 err = pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32));
397 if (err) { 392 if (err) {
398 printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name); 393 pr_err("Oops: no 32bit PCI DMA ???\n");
399 return -EIO; 394 return -EIO;
400 } 395 }
401 396
402 dev->pci_rev = dev->pci->revision; 397 dev->pci_rev = dev->pci->revision;
403 pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat); 398 pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat);
404 printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n", 399 pr_info("found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n",
405 dev->core->name, 400 pci_name(dev->pci), dev->pci_rev, dev->pci->irq,
406 pci_name(dev->pci), dev->pci_rev, dev->pci->irq, 401 dev->pci_lat,
407 dev->pci_lat,(unsigned long long)pci_resource_start(dev->pci,0)); 402 (unsigned long long)pci_resource_start(dev->pci, 0));
408 403
409 /* initialize driver struct */ 404 /* initialize driver struct */
410 spin_lock_init(&dev->slock); 405 spin_lock_init(&dev->slock);
@@ -416,8 +411,7 @@ static int cx8802_init_common(struct cx8802_dev *dev)
416 err = request_irq(dev->pci->irq, cx8802_irq, 411 err = request_irq(dev->pci->irq, cx8802_irq,
417 IRQF_SHARED, dev->core->name, dev); 412 IRQF_SHARED, dev->core->name, dev);
418 if (err < 0) { 413 if (err < 0) {
419 printk(KERN_ERR "%s: can't get IRQ %d\n", 414 pr_err("can't get IRQ %d\n", dev->pci->irq);
420 dev->core->name, dev->pci->irq);
421 return err; 415 return err;
422 } 416 }
423 cx_set(MO_PCI_INTMSK, core->pci_irqmask); 417 cx_set(MO_PCI_INTMSK, core->pci_irqmask);
@@ -429,7 +423,7 @@ static int cx8802_init_common(struct cx8802_dev *dev)
429 423
430static void cx8802_fini_common(struct cx8802_dev *dev) 424static void cx8802_fini_common(struct cx8802_dev *dev)
431{ 425{
432 dprintk( 2, "cx8802_fini_common\n" ); 426 dprintk(2, "\n");
433 cx8802_stop_dma(dev); 427 cx8802_stop_dma(dev);
434 pci_disable_device(dev->pci); 428 pci_disable_device(dev->pci);
435 429
@@ -442,14 +436,13 @@ static void cx8802_fini_common(struct cx8802_dev *dev)
442static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) 436static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
443{ 437{
444 struct cx8802_dev *dev = pci_get_drvdata(pci_dev); 438 struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
445 struct cx88_core *core = dev->core;
446 unsigned long flags; 439 unsigned long flags;
447 440
448 /* stop mpeg dma */ 441 /* stop mpeg dma */
449 spin_lock_irqsave(&dev->slock, flags); 442 spin_lock_irqsave(&dev->slock, flags);
450 if (!list_empty(&dev->mpegq.active)) { 443 if (!list_empty(&dev->mpegq.active)) {
451 dprintk( 2, "suspend\n" ); 444 dprintk(2, "suspend\n");
452 printk("%s: suspend mpeg\n", core->name); 445 pr_info("suspend mpeg\n");
453 cx8802_stop_dma(dev); 446 cx8802_stop_dma(dev);
454 } 447 }
455 spin_unlock_irqrestore(&dev->slock, flags); 448 spin_unlock_irqrestore(&dev->slock, flags);
@@ -468,23 +461,20 @@ static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
468static int cx8802_resume_common(struct pci_dev *pci_dev) 461static int cx8802_resume_common(struct pci_dev *pci_dev)
469{ 462{
470 struct cx8802_dev *dev = pci_get_drvdata(pci_dev); 463 struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
471 struct cx88_core *core = dev->core;
472 unsigned long flags; 464 unsigned long flags;
473 int err; 465 int err;
474 466
475 if (dev->state.disabled) { 467 if (dev->state.disabled) {
476 err=pci_enable_device(pci_dev); 468 err=pci_enable_device(pci_dev);
477 if (err) { 469 if (err) {
478 printk(KERN_ERR "%s: can't enable device\n", 470 pr_err("can't enable device\n");
479 dev->core->name);
480 return err; 471 return err;
481 } 472 }
482 dev->state.disabled = 0; 473 dev->state.disabled = 0;
483 } 474 }
484 err=pci_set_power_state(pci_dev, PCI_D0); 475 err=pci_set_power_state(pci_dev, PCI_D0);
485 if (err) { 476 if (err) {
486 printk(KERN_ERR "%s: can't enable device\n", 477 pr_err("can't enable device\n");
487 dev->core->name);
488 pci_disable_device(pci_dev); 478 pci_disable_device(pci_dev);
489 dev->state.disabled = 1; 479 dev->state.disabled = 1;
490 480
@@ -498,7 +488,7 @@ static int cx8802_resume_common(struct pci_dev *pci_dev)
498 /* restart video+vbi capture */ 488 /* restart video+vbi capture */
499 spin_lock_irqsave(&dev->slock, flags); 489 spin_lock_irqsave(&dev->slock, flags);
500 if (!list_empty(&dev->mpegq.active)) { 490 if (!list_empty(&dev->mpegq.active)) {
501 printk("%s: resume mpeg\n", core->name); 491 pr_info("resume mpeg\n");
502 cx8802_restart_queue(dev,&dev->mpegq); 492 cx8802_restart_queue(dev,&dev->mpegq);
503 } 493 }
504 spin_unlock_irqrestore(&dev->slock, flags); 494 spin_unlock_irqrestore(&dev->slock, flags);
@@ -550,7 +540,7 @@ static int cx8802_request_acquire(struct cx8802_driver *drv)
550 drv->advise_acquire(drv); 540 drv->advise_acquire(drv);
551 } 541 }
552 542
553 mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __func__, cx_read(MO_GP0_IO)); 543 dprintk(1, "Post acquire GPIO=%x\n", cx_read(MO_GP0_IO));
554 } 544 }
555 545
556 return 0; 546 return 0;
@@ -571,7 +561,7 @@ static int cx8802_request_release(struct cx8802_driver *drv)
571 561
572 drv->advise_release(drv); 562 drv->advise_release(drv);
573 core->active_type_id = CX88_BOARD_NONE; 563 core->active_type_id = CX88_BOARD_NONE;
574 mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO)); 564 dprintk(1, "Post release GPIO=%x\n", cx_read(MO_GP0_IO));
575 } 565 }
576 566
577 return 0; 567 return 0;
@@ -605,24 +595,22 @@ int cx8802_register_driver(struct cx8802_driver *drv)
605 struct cx8802_driver *driver; 595 struct cx8802_driver *driver;
606 int err, i = 0; 596 int err, i = 0;
607 597
608 printk(KERN_INFO 598 pr_info("registering cx8802 driver, type: %s access: %s\n",
609 "cx88/2: registering cx8802 driver, type: %s access: %s\n", 599 drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
610 drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird", 600 drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
611 drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
612 601
613 if ((err = cx8802_check_driver(drv)) != 0) { 602 if ((err = cx8802_check_driver(drv)) != 0) {
614 printk(KERN_ERR "cx88/2: cx8802_driver is invalid\n"); 603 pr_err("cx8802_driver is invalid\n");
615 return err; 604 return err;
616 } 605 }
617 606
618 mutex_lock(&cx8802_mutex); 607 mutex_lock(&cx8802_mutex);
619 608
620 list_for_each_entry(dev, &cx8802_devlist, devlist) { 609 list_for_each_entry(dev, &cx8802_devlist, devlist) {
621 printk(KERN_INFO 610 pr_info("subsystem: %04x:%04x, board: %s [card=%d]\n",
622 "%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n", 611 dev->pci->subsystem_vendor,
623 dev->core->name, dev->pci->subsystem_vendor, 612 dev->pci->subsystem_device, dev->core->board.name,
624 dev->pci->subsystem_device, dev->core->board.name, 613 dev->core->boardnr);
625 dev->core->boardnr);
626 614
627 /* Bring up a new struct for each driver instance */ 615 /* Bring up a new struct for each driver instance */
628 driver = kzalloc(sizeof(*drv),GFP_KERNEL); 616 driver = kzalloc(sizeof(*drv),GFP_KERNEL);
@@ -645,9 +633,7 @@ int cx8802_register_driver(struct cx8802_driver *drv)
645 i++; 633 i++;
646 list_add_tail(&driver->drvlist, &dev->drvlist); 634 list_add_tail(&driver->drvlist, &dev->drvlist);
647 } else { 635 } else {
648 printk(KERN_ERR 636 pr_err("cx8802 probe failed, err = %d\n", err);
649 "%s/2: cx8802 probe failed, err = %d\n",
650 dev->core->name, err);
651 } 637 }
652 mutex_unlock(&drv->core->lock); 638 mutex_unlock(&drv->core->lock);
653 } 639 }
@@ -664,19 +650,17 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
664 struct cx8802_driver *d, *dtmp; 650 struct cx8802_driver *d, *dtmp;
665 int err = 0; 651 int err = 0;
666 652
667 printk(KERN_INFO 653 pr_info("unregistering cx8802 driver, type: %s access: %s\n",
668 "cx88/2: unregistering cx8802 driver, type: %s access: %s\n", 654 drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
669 drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird", 655 drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
670 drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
671 656
672 mutex_lock(&cx8802_mutex); 657 mutex_lock(&cx8802_mutex);
673 658
674 list_for_each_entry(dev, &cx8802_devlist, devlist) { 659 list_for_each_entry(dev, &cx8802_devlist, devlist) {
675 printk(KERN_INFO 660 pr_info("subsystem: %04x:%04x, board: %s [card=%d]\n",
676 "%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n", 661 dev->pci->subsystem_vendor,
677 dev->core->name, dev->pci->subsystem_vendor, 662 dev->pci->subsystem_device, dev->core->board.name,
678 dev->pci->subsystem_device, dev->core->board.name, 663 dev->core->boardnr);
679 dev->core->boardnr);
680 664
681 mutex_lock(&dev->core->lock); 665 mutex_lock(&dev->core->lock);
682 666
@@ -690,8 +674,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
690 list_del(&d->drvlist); 674 list_del(&d->drvlist);
691 kfree(d); 675 kfree(d);
692 } else 676 } else
693 printk(KERN_ERR "%s/2: cx8802 driver remove failed (%d)\n", 677 pr_err("cx8802 driver remove failed (%d)\n",
694 dev->core->name, err); 678 err);
695 } 679 }
696 680
697 mutex_unlock(&dev->core->lock); 681 mutex_unlock(&dev->core->lock);
@@ -715,7 +699,7 @@ static int cx8802_probe(struct pci_dev *pci_dev,
715 if (NULL == core) 699 if (NULL == core)
716 return -EINVAL; 700 return -EINVAL;
717 701
718 printk("%s/2: cx2388x 8802 Driver Manager\n", core->name); 702 pr_info("cx2388x 8802 Driver Manager\n");
719 703
720 err = -ENODEV; 704 err = -ENODEV;
721 if (!core->board.mpeg) 705 if (!core->board.mpeg)
@@ -758,7 +742,7 @@ static void cx8802_remove(struct pci_dev *pci_dev)
758 742
759 dev = pci_get_drvdata(pci_dev); 743 dev = pci_get_drvdata(pci_dev);
760 744
761 dprintk( 1, "%s\n", __func__); 745 dprintk(1, "%s\n", __func__);
762 746
763 flush_request_modules(dev); 747 flush_request_modules(dev);
764 748
@@ -768,16 +752,15 @@ static void cx8802_remove(struct pci_dev *pci_dev)
768 struct cx8802_driver *drv, *tmp; 752 struct cx8802_driver *drv, *tmp;
769 int err; 753 int err;
770 754
771 printk(KERN_WARNING "%s/2: Trying to remove cx8802 driver while cx8802 sub-drivers still loaded?!\n", 755 pr_warn("Trying to remove cx8802 driver while cx8802 sub-drivers still loaded?!\n");
772 dev->core->name);
773 756
774 list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) { 757 list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) {
775 err = drv->remove(drv); 758 err = drv->remove(drv);
776 if (err == 0) { 759 if (err == 0) {
777 list_del(&drv->drvlist); 760 list_del(&drv->drvlist);
778 } else 761 } else
779 printk(KERN_ERR "%s/2: cx8802 driver remove failed (%d)\n", 762 pr_err("cx8802 driver remove failed (%d)\n",
780 dev->core->name, err); 763 err);
781 kfree(drv); 764 kfree(drv);
782 } 765 }
783 } 766 }
diff --git a/drivers/media/pci/cx88/cx88-tvaudio.c b/drivers/media/pci/cx88/cx88-tvaudio.c
index dd8e6f324204..b1d8680235e6 100644
--- a/drivers/media/pci/cx88/cx88-tvaudio.c
+++ b/drivers/media/pci/cx88/cx88-tvaudio.c
@@ -35,6 +35,8 @@
35 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 35 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36*/ 36*/
37 37
38#include "cx88.h"
39
38#include <linux/module.h> 40#include <linux/module.h>
39#include <linux/errno.h> 41#include <linux/errno.h>
40#include <linux/freezer.h> 42#include <linux/freezer.h>
@@ -50,8 +52,6 @@
50#include <linux/delay.h> 52#include <linux/delay.h>
51#include <linux/kthread.h> 53#include <linux/kthread.h>
52 54
53#include "cx88.h"
54
55static unsigned int audio_debug; 55static unsigned int audio_debug;
56module_param(audio_debug, int, 0644); 56module_param(audio_debug, int, 0644);
57MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]"); 57MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]");
@@ -64,9 +64,11 @@ static unsigned int radio_deemphasis;
64module_param(radio_deemphasis,int,0644); 64module_param(radio_deemphasis,int,0644);
65MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, 0=None, 1=50us (elsewhere), 2=75us (USA)"); 65MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, 0=None, 1=50us (elsewhere), 2=75us (USA)");
66 66
67#define dprintk(fmt, arg...) if (audio_debug) \ 67#define dprintk(fmt, arg...) do { \
68 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) 68 if (audio_debug) \
69 69 printk(KERN_DEBUG pr_fmt("%s: tvaudio:" fmt), \
70 __func__, ##arg); \
71} while (0)
70/* ----------------------------------------------------------- */ 72/* ----------------------------------------------------------- */
71 73
72static const char * const aud_ctl_names[64] = { 74static const char * const aud_ctl_names[64] = {
@@ -797,8 +799,7 @@ void cx88_set_tvaudio(struct cx88_core *core)
797 break; 799 break;
798 case WW_NONE: 800 case WW_NONE:
799 case WW_I2SPT: 801 case WW_I2SPT:
800 printk("%s/0: unknown tv audio mode [%d]\n", 802 pr_info("unknown tv audio mode [%d]\n", core->tvaudio);
801 core->name, core->tvaudio);
802 break; 803 break;
803 } 804 }
804 return; 805 return;
diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c
index d3237cf8ffa3..227f0f66e015 100644
--- a/drivers/media/pci/cx88/cx88-vbi.c
+++ b/drivers/media/pci/cx88/cx88-vbi.c
@@ -1,17 +1,21 @@
1/* 1/*
2 */ 2 */
3
4#include "cx88.h"
5
3#include <linux/kernel.h> 6#include <linux/kernel.h>
4#include <linux/module.h> 7#include <linux/module.h>
5#include <linux/init.h> 8#include <linux/init.h>
6 9
7#include "cx88.h"
8
9static unsigned int vbi_debug; 10static unsigned int vbi_debug;
10module_param(vbi_debug,int,0644); 11module_param(vbi_debug,int,0644);
11MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]"); 12MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
12 13
13#define dprintk(level,fmt, arg...) if (vbi_debug >= level) \ 14#define dprintk(level, fmt, arg...) do { \
14 printk(KERN_DEBUG "%s: " fmt, dev->core->name , ## arg) 15 if (vbi_debug >= level) \
16 printk(KERN_DEBUG pr_fmt("%s: vbi:" fmt), \
17 __func__, ##arg); \
18} while (0)
15 19
16/* ------------------------------------------------------------------ */ 20/* ------------------------------------------------------------------ */
17 21
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index 418e2db40b39..3d349dfb23ff 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -25,6 +25,8 @@
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#include "cx88.h"
29
28#include <linux/init.h> 30#include <linux/init.h>
29#include <linux/list.h> 31#include <linux/list.h>
30#include <linux/module.h> 32#include <linux/module.h>
@@ -37,7 +39,6 @@
37#include <linux/kthread.h> 39#include <linux/kthread.h>
38#include <asm/div64.h> 40#include <asm/div64.h>
39 41
40#include "cx88.h"
41#include <media/v4l2-common.h> 42#include <media/v4l2-common.h>
42#include <media/v4l2-ioctl.h> 43#include <media/v4l2-ioctl.h>
43#include <media/v4l2-event.h> 44#include <media/v4l2-event.h>
@@ -70,8 +71,12 @@ static unsigned int irq_debug;
70module_param(irq_debug,int,0644); 71module_param(irq_debug,int,0644);
71MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]"); 72MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]");
72 73
73#define dprintk(level,fmt, arg...) if (video_debug >= level) \ 74#define dprintk(level, fmt, arg...) do { \
74 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) 75 if (video_debug >= level) \
76 printk(KERN_DEBUG pr_fmt("%s: video:" fmt), \
77 __func__, ##arg); \
78} while (0)
79
75 80
76/* ------------------------------------------------------------------- */ 81/* ------------------------------------------------------------------- */
77/* static data */ 82/* static data */
@@ -414,7 +419,6 @@ static int stop_video_dma(struct cx8800_dev *dev)
414static int restart_video_queue(struct cx8800_dev *dev, 419static int restart_video_queue(struct cx8800_dev *dev,
415 struct cx88_dmaqueue *q) 420 struct cx88_dmaqueue *q)
416{ 421{
417 struct cx88_core *core = dev->core;
418 struct cx88_buffer *buf; 422 struct cx88_buffer *buf;
419 423
420 if (!list_empty(&q->active)) { 424 if (!list_empty(&q->active)) {
@@ -513,7 +517,6 @@ static void buffer_queue(struct vb2_buffer *vb)
513 struct cx8800_dev *dev = vb->vb2_queue->drv_priv; 517 struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
514 struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb); 518 struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
515 struct cx88_buffer *prev; 519 struct cx88_buffer *prev;
516 struct cx88_core *core = dev->core;
517 struct cx88_dmaqueue *q = &dev->vidq; 520 struct cx88_dmaqueue *q = &dev->vidq;
518 521
519 /* add jump to start */ 522 /* add jump to start */
@@ -1090,13 +1093,13 @@ static void cx8800_vid_irq(struct cx8800_dev *dev)
1090 return; 1093 return;
1091 cx_write(MO_VID_INTSTAT, status); 1094 cx_write(MO_VID_INTSTAT, status);
1092 if (irq_debug || (status & mask & ~0xff)) 1095 if (irq_debug || (status & mask & ~0xff))
1093 cx88_print_irqbits(core->name, "irq vid", 1096 cx88_print_irqbits("irq vid",
1094 cx88_vid_irqs, ARRAY_SIZE(cx88_vid_irqs), 1097 cx88_vid_irqs, ARRAY_SIZE(cx88_vid_irqs),
1095 status, mask); 1098 status, mask);
1096 1099
1097 /* risc op code error */ 1100 /* risc op code error */
1098 if (status & (1 << 16)) { 1101 if (status & (1 << 16)) {
1099 printk(KERN_WARNING "%s/0: video risc op code error\n",core->name); 1102 pr_warn("video risc op code error\n");
1100 cx_clear(MO_VID_DMACNTRL, 0x11); 1103 cx_clear(MO_VID_DMACNTRL, 0x11);
1101 cx_clear(VID_CAPTURE_CONTROL, 0x06); 1104 cx_clear(VID_CAPTURE_CONTROL, 0x06);
1102 cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH21]); 1105 cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH21]);
@@ -1140,8 +1143,7 @@ static irqreturn_t cx8800_irq(int irq, void *dev_id)
1140 cx8800_vid_irq(dev); 1143 cx8800_vid_irq(dev);
1141 } 1144 }
1142 if (10 == loop) { 1145 if (10 == loop) {
1143 printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", 1146 pr_warn("irq loop -- clearing mask\n");
1144 core->name);
1145 cx_write(MO_PCI_INTMSK,0); 1147 cx_write(MO_PCI_INTMSK,0);
1146 } 1148 }
1147 1149
@@ -1307,15 +1309,15 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1307 /* print pci info */ 1309 /* print pci info */
1308 dev->pci_rev = pci_dev->revision; 1310 dev->pci_rev = pci_dev->revision;
1309 pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); 1311 pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat);
1310 printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n", 1312 pr_info("found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n",
1311 core->name, 1313 pci_name(pci_dev), dev->pci_rev, pci_dev->irq,
1312 pci_name(pci_dev), dev->pci_rev, pci_dev->irq, 1314 dev->pci_lat,
1313 dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0)); 1315 (unsigned long long)pci_resource_start(pci_dev, 0));
1314 1316
1315 pci_set_master(pci_dev); 1317 pci_set_master(pci_dev);
1316 err = pci_set_dma_mask(pci_dev,DMA_BIT_MASK(32)); 1318 err = pci_set_dma_mask(pci_dev,DMA_BIT_MASK(32));
1317 if (err) { 1319 if (err) {
1318 printk("%s/0: Oops: no 32bit PCI DMA ???\n",core->name); 1320 pr_err("Oops: no 32bit PCI DMA ???\n");
1319 goto fail_core; 1321 goto fail_core;
1320 } 1322 }
1321 1323
@@ -1332,8 +1334,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1332 err = request_irq(pci_dev->irq, cx8800_irq, 1334 err = request_irq(pci_dev->irq, cx8800_irq,
1333 IRQF_SHARED, core->name, dev); 1335 IRQF_SHARED, core->name, dev);
1334 if (err < 0) { 1336 if (err < 0) {
1335 printk(KERN_ERR "%s/0: can't get IRQ %d\n", 1337 pr_err("can't get IRQ %d\n", pci_dev->irq);
1336 core->name,pci_dev->irq);
1337 goto fail_core; 1338 goto fail_core;
1338 } 1339 }
1339 cx_set(MO_PCI_INTMSK, core->pci_irqmask); 1340 cx_set(MO_PCI_INTMSK, core->pci_irqmask);
@@ -1470,12 +1471,11 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1470 err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER, 1471 err = video_register_device(&dev->video_dev, VFL_TYPE_GRABBER,
1471 video_nr[core->nr]); 1472 video_nr[core->nr]);
1472 if (err < 0) { 1473 if (err < 0) {
1473 printk(KERN_ERR "%s/0: can't register video device\n", 1474 pr_err("can't register video device\n");
1474 core->name);
1475 goto fail_unreg; 1475 goto fail_unreg;
1476 } 1476 }
1477 printk(KERN_INFO "%s/0: registered device %s [v4l2]\n", 1477 pr_info("registered device %s [v4l2]\n",
1478 core->name, video_device_node_name(&dev->video_dev)); 1478 video_device_node_name(&dev->video_dev));
1479 1479
1480 cx88_vdev_init(core, dev->pci, &dev->vbi_dev, 1480 cx88_vdev_init(core, dev->pci, &dev->vbi_dev,
1481 &cx8800_vbi_template, "vbi"); 1481 &cx8800_vbi_template, "vbi");
@@ -1484,12 +1484,11 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1484 err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI, 1484 err = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI,
1485 vbi_nr[core->nr]); 1485 vbi_nr[core->nr]);
1486 if (err < 0) { 1486 if (err < 0) {
1487 printk(KERN_ERR "%s/0: can't register vbi device\n", 1487 pr_err("can't register vbi device\n");
1488 core->name);
1489 goto fail_unreg; 1488 goto fail_unreg;
1490 } 1489 }
1491 printk(KERN_INFO "%s/0: registered device %s\n", 1490 pr_info("registered device %s\n",
1492 core->name, video_device_node_name(&dev->vbi_dev)); 1491 video_device_node_name(&dev->vbi_dev));
1493 1492
1494 if (core->board.radio.type == CX88_RADIO) { 1493 if (core->board.radio.type == CX88_RADIO) {
1495 cx88_vdev_init(core, dev->pci, &dev->radio_dev, 1494 cx88_vdev_init(core, dev->pci, &dev->radio_dev,
@@ -1499,12 +1498,11 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1499 err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO, 1498 err = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO,
1500 radio_nr[core->nr]); 1499 radio_nr[core->nr]);
1501 if (err < 0) { 1500 if (err < 0) {
1502 printk(KERN_ERR "%s/0: can't register radio device\n", 1501 pr_err("can't register radio device\n");
1503 core->name);
1504 goto fail_unreg; 1502 goto fail_unreg;
1505 } 1503 }
1506 printk(KERN_INFO "%s/0: registered device %s\n", 1504 pr_info("registered device %s\n",
1507 core->name, video_device_node_name(&dev->radio_dev)); 1505 video_device_node_name(&dev->radio_dev));
1508 } 1506 }
1509 1507
1510 /* start tvaudio thread */ 1508 /* start tvaudio thread */
@@ -1512,8 +1510,8 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
1512 core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio"); 1510 core->kthread = kthread_run(cx88_audio_thread, core, "cx88 tvaudio");
1513 if (IS_ERR(core->kthread)) { 1511 if (IS_ERR(core->kthread)) {
1514 err = PTR_ERR(core->kthread); 1512 err = PTR_ERR(core->kthread);
1515 printk(KERN_ERR "%s/0: failed to create cx88 audio thread, err=%d\n", 1513 pr_err("failed to create cx88 audio thread, err=%d\n",
1516 core->name, err); 1514 err);
1517 } 1515 }
1518 } 1516 }
1519 mutex_unlock(&core->lock); 1517 mutex_unlock(&core->lock);
@@ -1571,11 +1569,11 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
1571 /* stop video+vbi capture */ 1569 /* stop video+vbi capture */
1572 spin_lock_irqsave(&dev->slock, flags); 1570 spin_lock_irqsave(&dev->slock, flags);
1573 if (!list_empty(&dev->vidq.active)) { 1571 if (!list_empty(&dev->vidq.active)) {
1574 printk("%s/0: suspend video\n", core->name); 1572 pr_info("suspend video\n");
1575 stop_video_dma(dev); 1573 stop_video_dma(dev);
1576 } 1574 }
1577 if (!list_empty(&dev->vbiq.active)) { 1575 if (!list_empty(&dev->vbiq.active)) {
1578 printk("%s/0: suspend vbi\n", core->name); 1576 pr_info("suspend vbi\n");
1579 cx8800_stop_vbi_dma(dev); 1577 cx8800_stop_vbi_dma(dev);
1580 } 1578 }
1581 spin_unlock_irqrestore(&dev->slock, flags); 1579 spin_unlock_irqrestore(&dev->slock, flags);
@@ -1603,8 +1601,7 @@ static int cx8800_resume(struct pci_dev *pci_dev)
1603 if (dev->state.disabled) { 1601 if (dev->state.disabled) {
1604 err=pci_enable_device(pci_dev); 1602 err=pci_enable_device(pci_dev);
1605 if (err) { 1603 if (err) {
1606 printk(KERN_ERR "%s/0: can't enable device\n", 1604 pr_err("can't enable device\n");
1607 core->name);
1608 return err; 1605 return err;
1609 } 1606 }
1610 1607
@@ -1612,7 +1609,7 @@ static int cx8800_resume(struct pci_dev *pci_dev)
1612 } 1609 }
1613 err= pci_set_power_state(pci_dev, PCI_D0); 1610 err= pci_set_power_state(pci_dev, PCI_D0);
1614 if (err) { 1611 if (err) {
1615 printk(KERN_ERR "%s/0: can't set power state\n", core->name); 1612 pr_err("can't set power state\n");
1616 pci_disable_device(pci_dev); 1613 pci_disable_device(pci_dev);
1617 dev->state.disabled = 1; 1614 dev->state.disabled = 1;
1618 1615
@@ -1630,11 +1627,11 @@ static int cx8800_resume(struct pci_dev *pci_dev)
1630 /* restart video+vbi capture */ 1627 /* restart video+vbi capture */
1631 spin_lock_irqsave(&dev->slock, flags); 1628 spin_lock_irqsave(&dev->slock, flags);
1632 if (!list_empty(&dev->vidq.active)) { 1629 if (!list_empty(&dev->vidq.active)) {
1633 printk("%s/0: resume video\n", core->name); 1630 pr_info("resume video\n");
1634 restart_video_queue(dev,&dev->vidq); 1631 restart_video_queue(dev,&dev->vidq);
1635 } 1632 }
1636 if (!list_empty(&dev->vbiq.active)) { 1633 if (!list_empty(&dev->vbiq.active)) {
1637 printk("%s/0: resume vbi\n", core->name); 1634 pr_info("resume vbi\n");
1638 cx8800_restart_vbi_queue(dev,&dev->vbiq); 1635 cx8800_restart_vbi_queue(dev,&dev->vbiq);
1639 } 1636 }
1640 spin_unlock_irqrestore(&dev->slock, flags); 1637 spin_unlock_irqrestore(&dev->slock, flags);
diff --git a/drivers/media/pci/cx88/cx88-vp3054-i2c.c b/drivers/media/pci/cx88/cx88-vp3054-i2c.c
index deede6e25d94..4f47ea2ae344 100644
--- a/drivers/media/pci/cx88/cx88-vp3054-i2c.c
+++ b/drivers/media/pci/cx88/cx88-vp3054-i2c.c
@@ -22,15 +22,15 @@
22 22
23*/ 23*/
24 24
25#include "cx88.h"
26#include "cx88-vp3054-i2c.h"
27
25#include <linux/module.h> 28#include <linux/module.h>
26#include <linux/slab.h> 29#include <linux/slab.h>
27#include <linux/init.h> 30#include <linux/init.h>
28 31
29#include <asm/io.h> 32#include <asm/io.h>
30 33
31#include "cx88.h"
32#include "cx88-vp3054-i2c.h"
33
34MODULE_DESCRIPTION("driver for cx2388x VP3054 design"); 34MODULE_DESCRIPTION("driver for cx2388x VP3054 design");
35MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>"); 35MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
36MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
@@ -133,7 +133,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev)
133 133
134 rc = i2c_bit_add_bus(&vp3054_i2c->adap); 134 rc = i2c_bit_add_bus(&vp3054_i2c->adap);
135 if (0 != rc) { 135 if (0 != rc) {
136 printk("%s: vp3054_i2c register FAILED\n", core->name); 136 pr_err("vp3054_i2c register FAILED\n");
137 137
138 kfree(dev->vp3054); 138 kfree(dev->vp3054);
139 dev->vp3054 = NULL; 139 dev->vp3054 = NULL;
diff --git a/drivers/media/pci/cx88/cx88.h b/drivers/media/pci/cx88/cx88.h
index ecd4b7bece99..01c1287baf93 100644
--- a/drivers/media/pci/cx88/cx88.h
+++ b/drivers/media/pci/cx88/cx88.h
@@ -19,6 +19,11 @@
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21 21
22#ifndef CX88_H
23#define CX88_H
24
25#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26
22#include <linux/pci.h> 27#include <linux/pci.h>
23#include <linux/i2c.h> 28#include <linux/i2c.h>
24#include <linux/i2c-algo-bit.h> 29#include <linux/i2c-algo-bit.h>
@@ -614,7 +619,7 @@ struct cx8802_dev {
614 619
615extern unsigned int cx88_core_debug; 620extern unsigned int cx88_core_debug;
616 621
617extern void cx88_print_irqbits(const char *name, const char *tag, const char *strings[], 622extern void cx88_print_irqbits(const char *tag, const char *strings[],
618 int len, u32 bits, u32 mask); 623 int len, u32 bits, u32 mask);
619 624
620extern int cx88_core_irq(struct cx88_core *core, u32 status); 625extern int cx88_core_irq(struct cx88_core *core, u32 status);
@@ -738,3 +743,5 @@ int cx88_set_freq(struct cx88_core *core, const struct v4l2_frequency *f);
738int cx88_video_mux(struct cx88_core *core, unsigned int input); 743int cx88_video_mux(struct cx88_core *core, unsigned int input);
739void cx88_querycap(struct file *file, struct cx88_core *core, 744void cx88_querycap(struct file *file, struct cx88_core *core,
740 struct v4l2_capability *cap); 745 struct v4l2_capability *cap);
746
747#endif