diff options
author | Steven Toth <stoth@kernellabs.com> | 2010-07-31 15:08:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-21 05:55:08 -0400 |
commit | e48836b8bd7252b3a53eaa355c10322b3f5d236b (patch) | |
tree | 1707a6c612ea296f3fe2d94cf57ac3e5fbe157fd /drivers/media/video/saa7164/saa7164-api.c | |
parent | e8ce2f21665442a29a2b2d1b25197b05405a7216 (diff) |
[media] saa7164: add firmware debug message collection and procfs changes
Check for PROCFS and dynamically adjust code.
Cache some PCIe values in the device context.
Provide a mechanism to collect the debug messages
coming from the firmware.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164/saa7164-api.c')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-api.c | 83 |
1 files changed, 81 insertions, 2 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c index 814751deb21..01cf4ab13b0 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 | ||
27 | int 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 | |||
55 | int 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 | |||
27 | int saa7164_api_set_vbi_format(struct saa7164_port *port) | 82 | int 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 | ||