Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
linux-next
Commits
cf305b0c
Commit
cf305b0c
authored
Oct 03, 2021
by
Dorota Czaplejewicz
Browse files
Implement get_selection
parent
0cae26b2
Pipeline
#71636
passed with stage
in 65 minutes and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
drivers/media/i2c/s5k3l6xx.c
View file @
cf305b0c
...
...
@@ -885,12 +885,51 @@ static int s5k3l6xx_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_confi
enum
selection_rect
{
R_CIS
,
R_CROP_SINK
,
R_COMPOSE
,
R_CROP_SOURCE
,
R_INVALID
};
static
const
struct
v4l2_subdev_pad_ops
s5k3l6xx_cis_pad_ops
=
{
.
enum_mbus_code
=
s5k3l6xx_enum_mbus_code
,
.
enum_frame_size
=
s5k3l6xx_enum_frame_size
,
.
get_fmt
=
s5k3l6xx_get_fmt
,
.
set_fmt
=
s5k3l6xx_set_fmt
,
};
static
struct
v4l2_rect
get_crop
(
const
struct
s5k3l6xx_frame
*
fmt
)
{
struct
v4l2_rect
ret
=
{
.
top
=
0
,
.
left
=
0
,
.
width
=
fmt
->
width
,
.
height
=
fmt
->
height
,
};
return
ret
;
}
static
int
s5k3l6xx_get_selection
(
struct
v4l2_subdev
*
sd
,
struct
v4l2_subdev_pad_config
*
cfg
,
struct
v4l2_subdev_selection
*
sel
)
{
struct
s5k3l6xx
*
state
=
to_s5k3l6xx
(
sd
);
// FIXME: does crop rectangle affect vblank/hblank?
// If no, then it can be independent of mode (frame format).
switch
(
sel
->
target
)
{
case
V4L2_SEL_TGT_CROP
:
case
V4L2_SEL_TGT_CROP_DEFAULT
:
mutex_lock
(
&
state
->
lock
);
switch
(
sel
->
which
)
{
case
V4L2_SUBDEV_FORMAT_TRY
:
v4l2_subdev_get_try_crop
(
sd
,
cfg
,
sel
->
pad
);
break
;
case
V4L2_SUBDEV_FORMAT_ACTIVE
:
sel
->
r
=
get_crop
(
state
->
frame_fmt
);
break
;
}
mutex_unlock
(
&
state
->
lock
);
return
0
;
case
V4L2_SEL_TGT_CROP_BOUNDS
:
case
V4L2_SEL_TGT_NATIVE_SIZE
:
sel
->
r
.
top
=
0
;
sel
->
r
.
left
=
0
;
sel
->
r
.
width
=
S5K3L6XX_CIS_WIDTH
;
sel
->
r
.
height
=
S5K3L6XX_CIS_HEIGHT
;
return
0
;
default:
return
-
EINVAL
;
}
}
static
const
struct
v4l2_subdev_pad_ops
s5k3l6xx_pad_ops
=
{
.
enum_mbus_code
=
s5k3l6xx_enum_mbus_code
,
...
...
@@ -900,6 +939,8 @@ static const struct v4l2_subdev_pad_ops s5k3l6xx_pad_ops = {
// instead seems to call enum_fmt, which does enum_mbus_code here.
.
get_fmt
=
s5k3l6xx_get_fmt
,
.
set_fmt
=
s5k3l6xx_set_fmt
,
.
get_selection
=
s5k3l6xx_get_selection
,
// TODO: add set_selection
};
static
const
struct
v4l2_subdev_video_ops
s5k3l6xx_video_ops
=
{
...
...
@@ -1083,10 +1124,6 @@ static int s5k3l6xx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
return
0
;
}
static
const
struct
v4l2_subdev_ops
s5k5baf_cis_subdev_ops
=
{
.
pad
=
&
s5k3l6xx_cis_pad_ops
,
};
static
const
struct
v4l2_subdev_internal_ops
s5k5baf_cis_subdev_internal_ops
=
{
.
open
=
s5k3l6xx_open
,
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment