aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/pvrusb2/pvrusb2-hdw.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2006-09-23 22:26:52 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-10-03 15:13:34 -0300
commit32ffa9ae03c529df4208b63b4b17c6d84141faa3 (patch)
tree55be825b8bb7d1dafdc2fe936d1e5df47d1a1fbe /drivers/media/video/pvrusb2/pvrusb2-hdw.c
parent59753950a67edf386413c7b18039b89de56b40fb (diff)
V4L/DVB (4662): Pvrusb2: Implement VIDIOC_INT_[G|S]_REGISTER
Implement VIDIOC_INT_SET_REGISTER and VIDIOC_INT_GET_REGISTER for the pvrusb2 driver. This is a debugging aid which will not be enabled unless CONFIG_VIDEO_ADV_DEBUG has been enabled. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 88604365777..11a327d167b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/videodev2.h>
+#include <media/v4l2-common.h>
#include <asm/semaphore.h>
#include "pvrusb2.h"
#include "pvrusb2-std.h"
@@ -3131,6 +3132,37 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
}
+int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
+ u32 chip_id,unsigned long reg_id,
+ int setFl,u32 *val_ptr)
+{
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+ struct list_head *item;
+ struct pvr2_i2c_client *cp;
+ struct v4l2_register req;
+ int stat;
+
+ req.i2c_id = chip_id;
+ req.reg = reg_id;
+ if (setFl) req.val = *val_ptr;
+ mutex_lock(&hdw->i2c_list_lock); do {
+ list_for_each(item,&hdw->i2c_clients) {
+ cp = list_entry(item,struct pvr2_i2c_client,list);
+ if (cp->client->driver->id != chip_id) continue;
+ stat = pvr2_i2c_client_cmd(
+ cp,(setFl ? VIDIOC_INT_S_REGISTER :
+ VIDIOC_INT_G_REGISTER),&req);
+ if (!setFl) *val_ptr = req.val;
+ return stat;
+ }
+ } while (0); mutex_unlock(&hdw->i2c_list_lock);
+ return -EINVAL;
+#else
+ return -ENOSYS;
+#endif
+}
+
+
/*
Stuff for Emacs to see, in order to encourage consistent editing style:
*** Local Variables: ***