Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219371
b: refs/heads/master
c: 58acca1
h: refs/heads/master
i:
  219369: c4d70f6
  219367: 675be9a
v: v3
  • Loading branch information
Steven Toth authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent 40c0371 commit c070270
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66e1d37884eb43214292ed433fcffb72692c4838
refs/heads/master: 58acca1056434dbbbcb3f1aacd759f1039a3169d
42 changes: 38 additions & 4 deletions trunk/drivers/media/video/saa7164/saa7164-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,38 @@ static void saa7164_histogram_reset(struct saa7164_histogram *hg, char *name)

/* 200 - 2000ms x 100ms */
for (i = 0; i < 15; i++) {
hg->counter1[48 + i].val = 200 + (i * 100);
hg->counter1[48 + i].val = 200 + (i * 200);
}

/* Catch all massive value (1hr) */
/* Catch all massive value (2secs) */
hg->counter1[55].val = 2000;

/* Catch all massive value (4secs) */
hg->counter1[56].val = 4000;

/* Catch all massive value (8secs) */
hg->counter1[57].val = 8000;

/* Catch all massive value (15secs) */
hg->counter1[58].val = 15000;

/* Catch all massive value (30secs) */
hg->counter1[59].val = 30000;

/* Catch all massive value (60secs) */
hg->counter1[60].val = 60000;

/* Catch all massive value (5mins) */
hg->counter1[61].val = 300000;

/* Catch all massive value (15mins) */
hg->counter1[62].val = 900000;

/* Catch all massive values (1hr) */
hg->counter1[63].val = 3600000;
}

static void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val)
void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val)
{
int i;
for (i = 0; i < 64; i++ ) {
Expand All @@ -168,7 +192,7 @@ static void saa7164_histogram_print(struct saa7164_port *port,
u32 entries = 0;
int i;

printk(KERN_ERR "Histogram named %s\n", hg->name);
printk(KERN_ERR "Histogram named %s (ms, count, last_update_jiffy)\n", hg->name);
for (i = 0; i < 64; i++ ) {
if (hg->counter1[i].count == 0)
continue;
Expand Down Expand Up @@ -285,6 +309,8 @@ static void saa7164_work_enchandler(struct work_struct *w)
saa7164_histogram_print(port, &port->irq_interval);
saa7164_histogram_print(port, &port->svc_interval);
saa7164_histogram_print(port, &port->irq_svc_interval);
saa7164_histogram_print(port, &port->read_interval);
saa7164_histogram_print(port, &port->poll_interval);
print_histogram = 64 + port->nr;
}
}
Expand Down Expand Up @@ -731,6 +757,10 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
saa7164_histogram_reset(&port->svc_interval, "deferred intervals");
saa7164_histogram_reset(&port->irq_svc_interval,
"irq to deferred intervals");
saa7164_histogram_reset(&port->read_interval,
"encoder read() intervals");
saa7164_histogram_reset(&port->poll_interval,
"encoder poll() intervals");

return 0;
}
Expand Down Expand Up @@ -1016,6 +1046,10 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
&dev->ports[ SAA7164_PORT_ENC1 ].svc_interval);
saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
&dev->ports[ SAA7164_PORT_ENC1 ].irq_svc_interval);
saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
&dev->ports[ SAA7164_PORT_ENC1 ].read_interval);
saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
&dev->ports[ SAA7164_PORT_ENC1 ].poll_interval);

saa7164_shutdown(dev);

Expand Down
16 changes: 16 additions & 0 deletions trunk/drivers/media/video/saa7164/saa7164-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,14 @@ static ssize_t fops_read(struct file *file, char __user *buffer,
int rem, cnt;
u8 *p;

port->last_read_msecs_diff = port->last_read_msecs;
port->last_read_msecs = jiffies_to_msecs(jiffies);
port->last_read_msecs_diff = port->last_read_msecs -
port->last_read_msecs_diff;

saa7164_histogram_update(&port->read_interval,
port->last_read_msecs_diff);

if (*pos)
return -ESPIPE;

Expand Down Expand Up @@ -1114,6 +1122,14 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
struct saa7164_user_buffer *ubuf;
unsigned int mask = 0;

port->last_poll_msecs_diff = port->last_poll_msecs;
port->last_poll_msecs = jiffies_to_msecs(jiffies);
port->last_poll_msecs_diff = port->last_poll_msecs -
port->last_poll_msecs_diff;

saa7164_histogram_update(&port->poll_interval,
port->last_poll_msecs_diff);

if (!video_is_registered(port->v4l_device)) {
return -EIO;
}
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/media/video/saa7164/saa7164.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,14 @@ struct saa7164_port {
u32 last_irq_wp, last_svc_wp;
u32 last_irq_rp, last_svc_rp;
u64 last_irq_svc_msecs_diff;
u64 last_read_msecs, last_read_msecs_diff;
u64 last_poll_msecs, last_poll_msecs_diff;

struct saa7164_histogram irq_interval;
struct saa7164_histogram svc_interval;
struct saa7164_histogram irq_svc_interval;
struct saa7164_histogram read_interval;
struct saa7164_histogram poll_interval;

/* --- DVB Transport Specific --- */
struct saa7164_dvb dvb;
Expand Down Expand Up @@ -441,6 +445,7 @@ void saa7164_dumpregs(struct saa7164_dev *dev, u32 addr);
void saa7164_dumphex16(struct saa7164_dev *dev, u8 *buf, int len);
void saa7164_getfirmwarestatus(struct saa7164_dev *dev);
u32 saa7164_getcurrentfirmwareversion(struct saa7164_dev *dev);
void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val);

/* ----------------------------------------------------------- */
/* saa7164-fw.c */
Expand Down

0 comments on commit c070270

Please sign in to comment.