diff options
Diffstat (limited to 'drivers/media/video/upd64031a.c')
-rw-r--r-- | drivers/media/video/upd64031a.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index 0eee82ba52bc..b3b5fd536dc3 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -163,26 +163,18 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void * | |||
163 | 163 | ||
164 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 164 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
165 | case VIDIOC_DBG_G_REGISTER: | 165 | case VIDIOC_DBG_G_REGISTER: |
166 | { | ||
167 | struct v4l2_register *reg = arg; | ||
168 | |||
169 | if (reg->i2c_id != I2C_DRIVERID_UPD64031A) | ||
170 | return -EINVAL; | ||
171 | reg->val = upd64031a_read(client, reg->reg & 0xff); | ||
172 | break; | ||
173 | } | ||
174 | |||
175 | case VIDIOC_DBG_S_REGISTER: | 166 | case VIDIOC_DBG_S_REGISTER: |
176 | { | 167 | { |
177 | struct v4l2_register *reg = arg; | 168 | struct v4l2_register *reg = arg; |
178 | u8 addr = reg->reg & 0xff; | ||
179 | u8 val = reg->val & 0xff; | ||
180 | 169 | ||
181 | if (reg->i2c_id != I2C_DRIVERID_UPD64031A) | 170 | if (reg->i2c_id != I2C_DRIVERID_UPD64031A) |
182 | return -EINVAL; | 171 | return -EINVAL; |
183 | if (!capable(CAP_SYS_ADMIN)) | 172 | if (!capable(CAP_SYS_ADMIN)) |
184 | return -EPERM; | 173 | return -EPERM; |
185 | upd64031a_write(client, addr, val); | 174 | if (cmd == VIDIOC_DBG_G_REGISTER) |
175 | reg->val = upd64031a_read(client, reg->reg & 0xff); | ||
176 | else | ||
177 | upd64031a_write(client, reg->reg & 0xff, reg->val & 0xff); | ||
186 | break; | 178 | break; |
187 | } | 179 | } |
188 | #endif | 180 | #endif |