Revert "media: uvcvideo: Use entity get_cur in uvc_ctrl_set"
This reverts commit db35ac122f
.
This commit is contained in:
parent
d8a23d1e51
commit
4ec03bf3d0
1 changed files with 37 additions and 46 deletions
|
@ -992,55 +992,35 @@ static s32 __uvc_ctrl_get_value(struct uvc_control_mapping *mapping,
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain,
|
|
||||||
struct uvc_control *ctrl)
|
|
||||||
{
|
|
||||||
u8 *data;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (ctrl->loaded)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
data = uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT);
|
|
||||||
|
|
||||||
if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) {
|
|
||||||
memset(data, 0, ctrl->info.size);
|
|
||||||
ctrl->loaded = 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctrl->entity->get_cur)
|
|
||||||
ret = ctrl->entity->get_cur(chain->dev, ctrl->entity,
|
|
||||||
ctrl->info.selector, data,
|
|
||||||
ctrl->info.size);
|
|
||||||
else
|
|
||||||
ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR,
|
|
||||||
ctrl->entity->id, chain->dev->intfnum,
|
|
||||||
ctrl->info.selector, data,
|
|
||||||
ctrl->info.size);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ctrl->loaded = 1;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __uvc_ctrl_get(struct uvc_video_chain *chain,
|
static int __uvc_ctrl_get(struct uvc_video_chain *chain,
|
||||||
struct uvc_control *ctrl,
|
struct uvc_control *ctrl, struct uvc_control_mapping *mapping,
|
||||||
struct uvc_control_mapping *mapping,
|
s32 *value)
|
||||||
s32 *value)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
|
if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0)
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
ret = __uvc_ctrl_load_cur(chain, ctrl);
|
if (!ctrl->loaded) {
|
||||||
if (ret < 0)
|
if (ctrl->entity->get_cur) {
|
||||||
return ret;
|
ret = ctrl->entity->get_cur(chain->dev,
|
||||||
|
ctrl->entity,
|
||||||
|
ctrl->info.selector,
|
||||||
|
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
|
||||||
|
ctrl->info.size);
|
||||||
|
} else {
|
||||||
|
ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR,
|
||||||
|
ctrl->entity->id,
|
||||||
|
chain->dev->intfnum,
|
||||||
|
ctrl->info.selector,
|
||||||
|
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
|
||||||
|
ctrl->info.size);
|
||||||
|
}
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ctrl->loaded = 1;
|
||||||
|
}
|
||||||
|
|
||||||
*value = __uvc_ctrl_get_value(mapping,
|
*value = __uvc_ctrl_get_value(mapping,
|
||||||
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
|
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
|
||||||
|
@ -1695,10 +1675,21 @@ int uvc_ctrl_set(struct uvc_fh *handle,
|
||||||
* needs to be loaded from the device to perform the read-modify-write
|
* needs to be loaded from the device to perform the read-modify-write
|
||||||
* operation.
|
* operation.
|
||||||
*/
|
*/
|
||||||
if ((ctrl->info.size * 8) != mapping->size) {
|
if (!ctrl->loaded && (ctrl->info.size * 8) != mapping->size) {
|
||||||
ret = __uvc_ctrl_load_cur(chain, ctrl);
|
if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) {
|
||||||
if (ret < 0)
|
memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
|
||||||
return ret;
|
0, ctrl->info.size);
|
||||||
|
} else {
|
||||||
|
ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR,
|
||||||
|
ctrl->entity->id, chain->dev->intfnum,
|
||||||
|
ctrl->info.selector,
|
||||||
|
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
|
||||||
|
ctrl->info.size);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctrl->loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backup the current value in case we need to rollback later. */
|
/* Backup the current value in case we need to rollback later. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue