diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 32 |
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 88604365777c..11a327d167be 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
26 | #include <linux/videodev2.h> | 26 | #include <linux/videodev2.h> |
27 | #include <media/v4l2-common.h> | ||
27 | #include <asm/semaphore.h> | 28 | #include <asm/semaphore.h> |
28 | #include "pvrusb2.h" | 29 | #include "pvrusb2.h" |
29 | #include "pvrusb2-std.h" | 30 | #include "pvrusb2-std.h" |
@@ -3131,6 +3132,37 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) | |||
3131 | } | 3132 | } |
3132 | 3133 | ||
3133 | 3134 | ||
3135 | int pvr2_hdw_register_access(struct pvr2_hdw *hdw, | ||
3136 | u32 chip_id,unsigned long reg_id, | ||
3137 | int setFl,u32 *val_ptr) | ||
3138 | { | ||
3139 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
3140 | struct list_head *item; | ||
3141 | struct pvr2_i2c_client *cp; | ||
3142 | struct v4l2_register req; | ||
3143 | int stat; | ||
3144 | |||
3145 | req.i2c_id = chip_id; | ||
3146 | req.reg = reg_id; | ||
3147 | if (setFl) req.val = *val_ptr; | ||
3148 | mutex_lock(&hdw->i2c_list_lock); do { | ||
3149 | list_for_each(item,&hdw->i2c_clients) { | ||
3150 | cp = list_entry(item,struct pvr2_i2c_client,list); | ||
3151 | if (cp->client->driver->id != chip_id) continue; | ||
3152 | stat = pvr2_i2c_client_cmd( | ||
3153 | cp,(setFl ? VIDIOC_INT_S_REGISTER : | ||
3154 | VIDIOC_INT_G_REGISTER),&req); | ||
3155 | if (!setFl) *val_ptr = req.val; | ||
3156 | return stat; | ||
3157 | } | ||
3158 | } while (0); mutex_unlock(&hdw->i2c_list_lock); | ||
3159 | return -EINVAL; | ||
3160 | #else | ||
3161 | return -ENOSYS; | ||
3162 | #endif | ||
3163 | } | ||
3164 | |||
3165 | |||
3134 | /* | 3166 | /* |
3135 | Stuff for Emacs to see, in order to encourage consistent editing style: | 3167 | Stuff for Emacs to see, in order to encourage consistent editing style: |
3136 | *** Local Variables: *** | 3168 | *** Local Variables: *** |