aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2010-07-31 15:18:35 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 05:55:14 -0400
commit1247ff5c0acb0fb50b076e390bb770acc95d1d7e (patch)
tree8b59af2d7df57c5675de0d103b22a667c1a951c8 /drivers
parent0b62ceb03545099f0ab43a787cef5307b34b2fe4 (diff)
[media] saa7164: monitor the RISC cpu load via a thread
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/saa7164/saa7164-api.c25
-rw-r--r--drivers/media/video/saa7164/saa7164-core.c10
-rw-r--r--drivers/media/video/saa7164/saa7164-reg.h1
-rw-r--r--drivers/media/video/saa7164/saa7164-types.h12
-rw-r--r--drivers/media/video/saa7164/saa7164.h2
5 files changed, 50 insertions, 0 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c
index cf8337dd7bdf..0a2fdcde2f96 100644
--- a/drivers/media/video/saa7164/saa7164-api.c
+++ b/drivers/media/video/saa7164/saa7164-api.c
@@ -24,6 +24,31 @@
24 24
25#include "saa7164.h" 25#include "saa7164.h"
26 26
27int saa7164_api_get_load_info(struct saa7164_dev *dev, tmFwInfoStruct_t *i)
28{
29 int ret, debug;
30
31 if (!(debug & DBGLVL_CPU))
32 return 0;
33
34 dprintk(DBGLVL_API, "%s()\n", __func__);
35
36 i->deviceinst = 0;
37 i->devicespec = 0;
38 i->mode = 0;
39 i->status = 0;
40
41 ret = saa7164_cmd_send(dev, 0, GET_CUR,
42 GET_FW_STATUS_CONTROL, sizeof(tmFwInfoStruct_t), i);
43 if (ret != SAA_OK) {
44 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
45 }
46
47 printk(KERN_INFO "saa7164[%d]-CPU: %d percent", dev->nr, i->CPULoad);
48
49 return ret;
50}
51
27int saa7164_api_collect_debug(struct saa7164_dev *dev) 52int saa7164_api_collect_debug(struct saa7164_dev *dev)
28{ 53{
29 tmComResDebugGetData_t d; 54 tmComResDebugGetData_t d;
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index db4b39cb72ac..5913ed75cb90 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -1191,6 +1191,8 @@ static int saa7164_proc_create(void)
1191static int saa7164_thread_function(void *data) 1191static int saa7164_thread_function(void *data)
1192{ 1192{
1193 struct saa7164_dev *dev = data; 1193 struct saa7164_dev *dev = data;
1194 tmFwInfoStruct_t fwinfo;
1195 u64 last_poll_time = 0;
1194 1196
1195 dprintk(DBGLVL_THR, "thread started\n"); 1197 dprintk(DBGLVL_THR, "thread started\n");
1196 1198
@@ -1205,8 +1207,16 @@ static int saa7164_thread_function(void *data)
1205 dprintk(DBGLVL_THR, "thread running\n"); 1207 dprintk(DBGLVL_THR, "thread running\n");
1206 1208
1207 /* Dump the firmware debug message to console */ 1209 /* Dump the firmware debug message to console */
1210 /* Polling this costs us 1-2% of the arm CPU */
1211 /* convert this into a respnde to interrupt 0x7a */
1208 saa7164_api_collect_debug(dev); 1212 saa7164_api_collect_debug(dev);
1209 1213
1214 /* Monitor CPU load every 1 second */
1215 if ((last_poll_time + 1000 /* ms */) < jiffies_to_msecs(jiffies)) {
1216 saa7164_api_get_load_info(dev, &fwinfo);
1217 last_poll_time = jiffies_to_msecs(jiffies);
1218 }
1219
1210 } 1220 }
1211 1221
1212 dprintk(DBGLVL_THR, "thread exiting\n"); 1222 dprintk(DBGLVL_THR, "thread exiting\n");
diff --git a/drivers/media/video/saa7164/saa7164-reg.h b/drivers/media/video/saa7164/saa7164-reg.h
index 153da76e8575..2bbf81583d33 100644
--- a/drivers/media/video/saa7164/saa7164-reg.h
+++ b/drivers/media/video/saa7164/saa7164-reg.h
@@ -60,6 +60,7 @@
60#define GET_STRING_CONTROL 0x03 60#define GET_STRING_CONTROL 0x03
61#define GET_LANGUAGE_CONTROL 0x05 61#define GET_LANGUAGE_CONTROL 0x05
62#define SET_POWER_CONTROL 0x07 62#define SET_POWER_CONTROL 0x07
63#define GET_FW_STATUS_CONTROL 0x08
63#define GET_FW_VERSION_CONTROL 0x09 64#define GET_FW_VERSION_CONTROL 0x09
64#define SET_DEBUG_LEVEL_CONTROL 0x0B 65#define SET_DEBUG_LEVEL_CONTROL 0x0B
65#define GET_DEBUG_DATA_CONTROL 0x0C 66#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 ea245ba563b7..e66c29d6ead3 100644
--- a/drivers/media/video/saa7164/saa7164-types.h
+++ b/drivers/media/video/saa7164/saa7164-types.h
@@ -446,3 +446,15 @@ typedef struct
446 u8 ucDebugData[256]; 446 u8 ucDebugData[256];
447} __attribute__((packed)) tmComResDebugGetData_t; 447} __attribute__((packed)) tmComResDebugGetData_t;
448 448
449typedef struct
450{
451 u32 status;
452 u32 mode;
453 u32 devicespec;
454 u32 deviceinst;
455 u32 CPULoad;
456 u32 RemainHeap;
457 u32 CPUClock;
458 u32 RAMSpeed;
459} __attribute__((packed)) tmFwInfoStruct_t;
460
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 88b9b91bf4f5..329564452e27 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -112,6 +112,7 @@
112#define DBGLVL_ENC 1024 112#define DBGLVL_ENC 1024
113#define DBGLVL_VBI 2048 113#define DBGLVL_VBI 2048
114#define DBGLVL_THR 4096 114#define DBGLVL_THR 4096
115#define DBGLVL_CPU 8192
115 116
116#define SAA7164_NORMS ( V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443 ) 117#define SAA7164_NORMS ( V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443 )
117 118
@@ -551,6 +552,7 @@ int saa7164_api_get_videomux(struct saa7164_port *port);
551int saa7164_api_set_vbi_format(struct saa7164_port *port); 552int saa7164_api_set_vbi_format(struct saa7164_port *port);
552int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level); 553int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level);
553int saa7164_api_collect_debug(struct saa7164_dev *dev); 554int saa7164_api_collect_debug(struct saa7164_dev *dev);
555int saa7164_api_get_load_info(struct saa7164_dev *dev, tmFwInfoStruct_t *i);
554 556
555/* ----------------------------------------------------------- */ 557/* ----------------------------------------------------------- */
556/* saa7164-cards.c */ 558/* saa7164-cards.c */