aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/saa7164/saa7164-api.c83
-rw-r--r--drivers/media/video/saa7164/saa7164-core.c76
-rw-r--r--drivers/media/video/saa7164/saa7164-reg.h3
-rw-r--r--drivers/media/video/saa7164/saa7164-types.h12
-rw-r--r--drivers/media/video/saa7164/saa7164.h2
5 files changed, 173 insertions, 3 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c
index 814751deb218..01cf4ab13b0f 100644
--- a/drivers/media/video/saa7164/saa7164-api.c
+++ b/drivers/media/video/saa7164/saa7164-api.c
@@ -24,13 +24,69 @@
24 24
25#include "saa7164.h" 25#include "saa7164.h"
26 26
27int saa7164_api_collect_debug(struct saa7164_dev *dev, struct seq_file *m)
28{
29 tmComResDebugGetData_t d;
30 u8 more = 255;
31 int ret;
32
33 dprintk(DBGLVL_API, "%s()\n", __func__);
34
35 while (more--) {
36
37 memset(&d, 0, sizeof(d));
38
39 ret = saa7164_cmd_send(dev, 0, GET_CUR,
40 GET_DEBUG_DATA_CONTROL, sizeof(d), &d);
41 if (ret != SAA_OK) {
42 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
43 }
44
45 if (d.dwResult != SAA_OK)
46 break;
47
48 seq_printf(m, "%s", d.ucDebugData);
49
50 }
51
52 return 0;
53}
54
55int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level)
56{
57 tmComResDebugSetLevel_t lvl;
58 int ret;
59
60 dprintk(DBGLVL_API, "%s(level=%d)\n", __func__, level);
61
62 /* Retrieve current state */
63 ret = saa7164_cmd_send(dev, 0, GET_CUR,
64 SET_DEBUG_LEVEL_CONTROL, sizeof(lvl), &lvl);
65 if (ret != SAA_OK) {
66 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
67 }
68 dprintk(DBGLVL_API, "%s() Was %d\n", __func__, lvl.dwDebugLevel);
69
70 lvl.dwDebugLevel = level;
71
72 /* set new state */
73 ret = saa7164_cmd_send(dev, 0, SET_CUR,
74 SET_DEBUG_LEVEL_CONTROL, sizeof(lvl), &lvl);
75 if (ret != SAA_OK) {
76 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
77 }
78
79 return ret;
80}
81
27int saa7164_api_set_vbi_format(struct saa7164_port *port) 82int saa7164_api_set_vbi_format(struct saa7164_port *port)
28{ 83{
29 struct saa7164_dev *dev = port->dev; 84 struct saa7164_dev *dev = port->dev;
30 tmComResProbeCommit_t fmt, rsp; 85 tmComResProbeCommit_t fmt, rsp;
31 int ret; 86 int ret;
32 87
33 dprintk(DBGLVL_API, "%s(nr=%d)\n", __func__, port->nr); 88 dprintk(DBGLVL_API, "%s(nr=%d, unitid=0x%x)\n", __func__,
89 port->nr, port->hwcfg.unitid);
34 90
35 fmt.bmHint = 0; 91 fmt.bmHint = 0;
36 fmt.bFormatIndex = 1; 92 fmt.bFormatIndex = 1;
@@ -50,6 +106,8 @@ int saa7164_api_set_vbi_format(struct saa7164_port *port)
50 } else { 106 } else {
51 /* Compare requested vs received, should be same */ 107 /* Compare requested vs received, should be same */
52 if (memcmp(&fmt, &rsp, sizeof(rsp)) == 0) { 108 if (memcmp(&fmt, &rsp, sizeof(rsp)) == 0) {
109 dprintk(DBGLVL_API, "SET/PROBE Verified\n");
110
53 /* Ask the device to select the negotiated format */ 111 /* Ask the device to select the negotiated format */
54 ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid, 112 ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid,
55 SET_CUR, SAA_COMMIT_CONTROL, sizeof(fmt), &fmt); 113 SET_CUR, SAA_COMMIT_CONTROL, sizeof(fmt), &fmt);
@@ -63,9 +121,11 @@ int saa7164_api_set_vbi_format(struct saa7164_port *port)
63 printk(KERN_ERR "%s() GET commit error, ret = 0x%x\n", 121 printk(KERN_ERR "%s() GET commit error, ret = 0x%x\n",
64 __func__, ret); 122 __func__, ret);
65 123
66 if (memcmp(&fmt, &rsp, sizeof(rsp)) != 0) 124 if (memcmp(&fmt, &rsp, sizeof(rsp)) != 0) {
67 printk(KERN_ERR "%s() memcmp error, ret = 0x%x\n", 125 printk(KERN_ERR "%s() memcmp error, ret = 0x%x\n",
68 __func__, ret); 126 __func__, ret);
127 } else
128 dprintk(DBGLVL_API, "SET/COMMIT Verified\n");
69 129
70 dprintk(DBGLVL_API, "rsp.bmHint = 0x%x\n", rsp.bmHint); 130 dprintk(DBGLVL_API, "rsp.bmHint = 0x%x\n", rsp.bmHint);
71 dprintk(DBGLVL_API, "rsp.bFormatIndex = 0x%x\n", rsp.bFormatIndex); 131 dprintk(DBGLVL_API, "rsp.bFormatIndex = 0x%x\n", rsp.bFormatIndex);
@@ -723,6 +783,25 @@ int saa7164_api_configure_port_vbi(struct saa7164_dev *dev,
723 dprintk(DBGLVL_API, " EndLine = %d\n", fmt->EndLine); 783 dprintk(DBGLVL_API, " EndLine = %d\n", fmt->EndLine);
724 dprintk(DBGLVL_API, " FieldRate = %d\n", fmt->FieldRate); 784 dprintk(DBGLVL_API, " FieldRate = %d\n", fmt->FieldRate);
725 dprintk(DBGLVL_API, " bNumLines = %d\n", fmt->bNumLines); 785 dprintk(DBGLVL_API, " bNumLines = %d\n", fmt->bNumLines);
786
787 /* Cache the hardware configuration in the port */
788
789 port->bufcounter = port->hwcfg.BARLocation;
790 port->pitch = port->hwcfg.BARLocation + (2 * sizeof(u32));
791 port->bufsize = port->hwcfg.BARLocation + (3 * sizeof(u32));
792 port->bufoffset = port->hwcfg.BARLocation + (4 * sizeof(u32));
793 port->bufptr32l = port->hwcfg.BARLocation +
794 (4 * sizeof(u32)) +
795 (sizeof(u32) * port->hwcfg.buffercount) + sizeof(u32);
796 port->bufptr32h = port->hwcfg.BARLocation +
797 (4 * sizeof(u32)) +
798 (sizeof(u32) * port->hwcfg.buffercount);
799 port->bufptr64 = port->hwcfg.BARLocation +
800 (4 * sizeof(u32)) +
801 (sizeof(u32) * port->hwcfg.buffercount);
802 dprintk(DBGLVL_API, " = port->hwcfg.BARLocation = 0x%x\n",
803 port->hwcfg.BARLocation);
804
726 dprintk(DBGLVL_API, " = VS_FORMAT_VBI (becomes dev->en[%d])\n", 805 dprintk(DBGLVL_API, " = VS_FORMAT_VBI (becomes dev->en[%d])\n",
727 port->nr); 806 port->nr);
728 807
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index 7901bb1c739e..1071cc754b1c 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -30,6 +30,9 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <asm/div64.h> 31#include <asm/div64.h>
32 32
33#ifdef CONFIG_PROC_FS
34#include <linux/proc_fs.h>
35#endif
33#include "saa7164.h" 36#include "saa7164.h"
34 37
35MODULE_DESCRIPTION("Driver for NXP SAA7164 based TV cards"); 38MODULE_DESCRIPTION("Driver for NXP SAA7164 based TV cards");
@@ -49,6 +52,10 @@ unsigned int saa_debug;
49module_param_named(debug, saa_debug, int, 0644); 52module_param_named(debug, saa_debug, int, 0644);
50MODULE_PARM_DESC(debug, "enable debug messages"); 53MODULE_PARM_DESC(debug, "enable debug messages");
51 54
55unsigned int fw_debug = 2;
56module_param(fw_debug, int, 0644);
57MODULE_PARM_DESC(fw_debug, "Firware debug level def:2");
58
52unsigned int encoder_buffers = SAA7164_MAX_ENCODER_BUFFERS; 59unsigned int encoder_buffers = SAA7164_MAX_ENCODER_BUFFERS;
53module_param(encoder_buffers, int, 0644); 60module_param(encoder_buffers, int, 0644);
54MODULE_PARM_DESC(encoder_buffers, "Total buffers in read queue 16-512 def:64"); 61MODULE_PARM_DESC(encoder_buffers, "Total buffers in read queue 16-512 def:64");
@@ -1067,6 +1074,63 @@ static void saa7164_dev_unregister(struct saa7164_dev *dev)
1067 return; 1074 return;
1068} 1075}
1069 1076
1077#ifdef CONFIG_PROC_FS
1078static int saa7164_proc_show(struct seq_file *m, void *v)
1079{
1080 struct saa7164_dev *dev;
1081 tmComResBusInfo_t *b;
1082 struct list_head *list;
1083 int i, c;
1084
1085 if (saa7164_devcount == 0)
1086 return 0;
1087
1088 list_for_each(list, &saa7164_devlist) {
1089 dev = list_entry(list, struct saa7164_dev, devlist);
1090 seq_printf(m, "%s = %p\n", dev->name, dev);
1091
1092 if (dev->board != SAA7164_BOARD_UNKNOWN) {
1093 seq_printf(m, "Firmware messages ----->\n");
1094 saa7164_api_collect_debug(dev, m);
1095 seq_printf(m, "<---- Firmware messages\n");
1096 }
1097
1098 /* Lock the bus from any other access */
1099 b = &dev->bus;
1100 mutex_lock(&b->lock);
1101
1102
1103 mutex_unlock(&b->lock);
1104
1105 }
1106
1107 return 0;
1108}
1109
1110static int saa7164_proc_open(struct inode *inode, struct file *filp)
1111{
1112 return single_open(filp, saa7164_proc_show, NULL);
1113}
1114
1115static struct file_operations saa7164_proc_fops = {
1116 .open = saa7164_proc_open,
1117 .read = seq_read,
1118 .llseek = seq_lseek,
1119 .release = single_release,
1120};
1121
1122static int saa7164_proc_create(void)
1123{
1124 struct proc_dir_entry *pe;
1125
1126 pe = proc_create("saa7164", S_IRUGO, NULL, &saa7164_proc_fops);
1127 if (!pe)
1128 return -ENOMEM;
1129
1130 return 0;
1131}
1132#endif
1133
1070static int __devinit saa7164_initdev(struct pci_dev *pci_dev, 1134static int __devinit saa7164_initdev(struct pci_dev *pci_dev,
1071 const struct pci_device_id *pci_id) 1135 const struct pci_device_id *pci_id)
1072{ 1136{
@@ -1226,7 +1290,7 @@ static int __devinit saa7164_initdev(struct pci_dev *pci_dev,
1226 "vbi device\n", __func__); 1290 "vbi device\n", __func__);
1227 } 1291 }
1228 } 1292 }
1229 1293 saa7164_api_set_debug(dev, fw_debug);
1230 1294
1231 } /* != BOARD_UNKNOWN */ 1295 } /* != BOARD_UNKNOWN */
1232 else 1296 else
@@ -1255,6 +1319,9 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
1255{ 1319{
1256 struct saa7164_dev *dev = pci_get_drvdata(pci_dev); 1320 struct saa7164_dev *dev = pci_get_drvdata(pci_dev);
1257 1321
1322 if (dev->board != SAA7164_BOARD_UNKNOWN)
1323 saa7164_api_set_debug(dev, 0x00);
1324
1258 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ], 1325 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
1259 &dev->ports[ SAA7164_PORT_ENC1 ].irq_interval); 1326 &dev->ports[ SAA7164_PORT_ENC1 ].irq_interval);
1260 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ], 1327 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
@@ -1334,11 +1401,18 @@ static struct pci_driver saa7164_pci_driver = {
1334static int __init saa7164_init(void) 1401static int __init saa7164_init(void)
1335{ 1402{
1336 printk(KERN_INFO "saa7164 driver loaded\n"); 1403 printk(KERN_INFO "saa7164 driver loaded\n");
1404
1405#ifdef CONFIG_PROC_FS
1406 saa7164_proc_create();
1407#endif
1337 return pci_register_driver(&saa7164_pci_driver); 1408 return pci_register_driver(&saa7164_pci_driver);
1338} 1409}
1339 1410
1340static void __exit saa7164_fini(void) 1411static void __exit saa7164_fini(void)
1341{ 1412{
1413#ifdef CONFIG_PROC_FS
1414 remove_proc_entry("saa7164", NULL);
1415#endif
1342 pci_unregister_driver(&saa7164_pci_driver); 1416 pci_unregister_driver(&saa7164_pci_driver);
1343} 1417}
1344 1418
diff --git a/drivers/media/video/saa7164/saa7164-reg.h b/drivers/media/video/saa7164/saa7164-reg.h
index b950f41c5c5e..153da76e8575 100644
--- a/drivers/media/video/saa7164/saa7164-reg.h
+++ b/drivers/media/video/saa7164/saa7164-reg.h
@@ -213,3 +213,6 @@
213#define EU_AUDIO_FORMAT_CONTROL 0x0C 213#define EU_AUDIO_FORMAT_CONTROL 0x0C
214#define EU_AUDIO_BIT_RATE_CONTROL 0x0D 214#define EU_AUDIO_BIT_RATE_CONTROL 0x0D
215 215
216/* Firmware Debugging */
217#define SET_DEBUG_LEVEL_CONTROL 0x0B
218#define GET_DEBUG_DATA_CONTROL 0x0C
diff --git a/drivers/media/video/saa7164/saa7164-types.h b/drivers/media/video/saa7164/saa7164-types.h
index cb051d5d138c..3406a95d8fe9 100644
--- a/drivers/media/video/saa7164/saa7164-types.h
+++ b/drivers/media/video/saa7164/saa7164-types.h
@@ -434,3 +434,15 @@ typedef struct
434 u8 bFormatIndex; 434 u8 bFormatIndex;
435 u8 bFrameIndex; 435 u8 bFrameIndex;
436} __attribute__((packed)) tmComResProbeCommit_t; 436} __attribute__((packed)) tmComResProbeCommit_t;
437
438typedef struct
439{
440 u32 dwDebugLevel;
441} __attribute__((packed)) tmComResDebugSetLevel_t;
442
443typedef struct
444{
445 u32 dwResult;
446 u8 ucDebugData[256];
447} __attribute__((packed)) tmComResDebugGetData_t;
448
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 82ff561a29f7..e2de805c30c1 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -541,6 +541,8 @@ int saa7164_api_set_audio_std(struct saa7164_port *port);
541int saa7164_api_set_audio_detection(struct saa7164_port *port, int autodetect); 541int saa7164_api_set_audio_detection(struct saa7164_port *port, int autodetect);
542int saa7164_api_get_videomux(struct saa7164_port *port); 542int saa7164_api_get_videomux(struct saa7164_port *port);
543int saa7164_api_set_vbi_format(struct saa7164_port *port); 543int saa7164_api_set_vbi_format(struct saa7164_port *port);
544int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level);
545int saa7164_api_collect_debug(struct saa7164_dev *dev, struct seq_file *m);
544 546
545/* ----------------------------------------------------------- */ 547/* ----------------------------------------------------------- */
546/* saa7164-cards.c */ 548/* saa7164-cards.c */