mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
media: i2c: sensor adapter fixed get_selection error
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com> Change-Id: I97601673c032e9e83af305010063806aaa6db355
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2022 Rockchip Electronics Co., Ltd.
|
* Copyright (C) 2022 Rockchip Electronics Co., Ltd.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
//#define DEBUG
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
@@ -976,19 +976,25 @@ static int sensor_get_selection(struct v4l2_subdev *sd,
|
|||||||
{
|
{
|
||||||
struct sensor *sensor = to_sensor(sd);
|
struct sensor *sensor = to_sensor(sd);
|
||||||
|
|
||||||
if (sel->target == V4L2_SEL_TGT_CROP_BOUNDS &&
|
if (sel->target == V4L2_SEL_TGT_CROP_BOUNDS) {
|
||||||
sensor->crop.is_enable &&
|
if (sensor->crop.is_enable &&
|
||||||
(sensor->crop.left + sensor->crop.width) <= sensor->cur_mode->width &&
|
(sensor->crop.left + sensor->crop.width) <= sensor->cur_mode->width &&
|
||||||
(sensor->crop.top + sensor->crop.height) <= sensor->cur_mode->height) {
|
(sensor->crop.top + sensor->crop.height) <= sensor->cur_mode->height) {
|
||||||
sel->r.left = sensor->crop.left;
|
sel->r.left = sensor->crop.left;
|
||||||
sel->r.width = sensor->crop.width;
|
sel->r.width = sensor->crop.width;
|
||||||
sel->r.top = sensor->crop.top;
|
sel->r.top = sensor->crop.top;
|
||||||
sel->r.height = sensor->crop.height;
|
sel->r.height = sensor->crop.height;
|
||||||
dev_info(&sensor->client->dev,
|
dev_dbg(&sensor->client->dev,
|
||||||
"%s left %d, width %d, top %d, height %d\n",
|
"%s left %d, width %d, top %d, height %d\n",
|
||||||
__func__,
|
__func__,
|
||||||
sensor->crop.left, sensor->crop.width,
|
sensor->crop.left, sensor->crop.width,
|
||||||
sensor->crop.top, sensor->crop.height);
|
sensor->crop.top, sensor->crop.height);
|
||||||
|
} else {
|
||||||
|
sel->r.left = 0;
|
||||||
|
sel->r.width = 0;
|
||||||
|
sel->r.top = sensor->cur_mode->width;
|
||||||
|
sel->r.height = sensor->cur_mode->height;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dev_err(&sensor->client->dev,
|
dev_err(&sensor->client->dev,
|
||||||
|
|||||||
Reference in New Issue
Block a user