Skip to content

Commit d1d228b

Browse files
Ensure we only set default rotation if explicitly set via parameter
1 parent 988a2cd commit d1d228b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

drivers/media/i2c/ov5693.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static const char * const ov5693_supply_names[] = {
132132

133133
#define OV5693_NUM_SUPPLIES ARRAY_SIZE(ov5693_supply_names)
134134

135-
static int sensor_default_rotation;
135+
static int sensor_default_rotation = -1;
136136

137137
struct ov5693_device {
138138
struct device *dev;
@@ -1129,9 +1129,13 @@ static int ov5693_init_controls(struct ov5693_device *ov5693)
11291129
OV5693_DIGITAL_GAIN_MAX,
11301130
OV5693_DIGITAL_GAIN_STEP,
11311131
OV5693_DIGITAL_GAIN_DEF);
1132-
/* Rotation */
1133-
ctrls->rotation = v4l2_ctrl_new_std(&ctrls->handler, ops,
1134-
V4L2_CID_CAMERA_SENSOR_ROTATION, 0, 270, 90, sensor_default_rotation);
1132+
1133+
/* Set rotation if explicitly set via param */
1134+
if (!(sensor_default_rotation % 90) && sensor_default_rotation <= 360) {
1135+
ctrls->rotation = v4l2_ctrl_new_std(&ctrls->handler, ops,
1136+
V4L2_CID_CAMERA_SENSOR_ROTATION, 0, 270, 90, sensor_default_rotation);
1137+
}
1138+
11351139
/* Flip */
11361140
ctrls->hflip = v4l2_ctrl_new_std(&ctrls->handler, ops,
11371141
V4L2_CID_HFLIP, 0, 1, 1, 0);

0 commit comments

Comments
 (0)