Skip to content

Commit 988a2cd

Browse files
Set default sensor rotation via parameter
1 parent b9db6e4 commit 988a2cd

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

drivers/media/i2c/ov5693.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ 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;
136+
135137
struct ov5693_device {
136138
struct device *dev;
137139
struct regmap *regmap;
@@ -352,11 +354,6 @@ static const u8 ov5693_test_pattern_bits[] = {
352354
OV5693_TEST_PATTERN_ROLLING,
353355
};
354356

355-
enum ov5693_model_id {
356-
OV5693_INT33BE = 0,
357-
OV5693_OVTI,
358-
};
359-
360357
/* V4L2 Controls Functions */
361358

362359
static int ov5693_flip_vert_configure(struct ov5693_device *ov5693,
@@ -1132,10 +1129,9 @@ static int ov5693_init_controls(struct ov5693_device *ov5693)
11321129
OV5693_DIGITAL_GAIN_MAX,
11331130
OV5693_DIGITAL_GAIN_STEP,
11341131
OV5693_DIGITAL_GAIN_DEF);
1135-
11361132
/* Rotation */
11371133
ctrls->rotation = v4l2_ctrl_new_std(&ctrls->handler, ops,
1138-
V4L2_CID_CAMERA_SENSOR_ROTATION, 0, 270, 90, 0);
1134+
V4L2_CID_CAMERA_SENSOR_ROTATION, 0, 270, 90, sensor_default_rotation);
11391135
/* Flip */
11401136
ctrls->hflip = v4l2_ctrl_new_std(&ctrls->handler, ops,
11411137
V4L2_CID_HFLIP, 0, 1, 1, 0);
@@ -1277,7 +1273,6 @@ static int ov5693_check_hwcfg(struct ov5693_device *ov5693)
12771273
static int ov5693_probe(struct i2c_client *client)
12781274
{
12791275
struct ov5693_device *ov5693;
1280-
uintptr_t variant;
12811276
u32 xvclk_rate;
12821277
int ret = 0;
12831278

@@ -1331,16 +1326,6 @@ static int ov5693_probe(struct i2c_client *client)
13311326
if (ret)
13321327
return ret;
13331328

1334-
variant = (uintptr_t)device_get_match_data(ov5693->dev);
1335-
switch (variant) {
1336-
case OV5693_OVTI:
1337-
dev_info(ov5693->dev, "Applying specific OVTI5693 initialization\n");
1338-
v4l2_ctrl_s_ctrl(ov5693->ctrls.rotation, 180);
1339-
break;
1340-
default:
1341-
break;
1342-
}
1343-
13441329
ret = media_entity_pads_init(&ov5693->sd.entity, 1, &ov5693->pad);
13451330
if (ret)
13461331
goto err_ctrl_handler_free;
@@ -1415,8 +1400,8 @@ static const struct dev_pm_ops ov5693_pm_ops = {
14151400
};
14161401

14171402
static const struct acpi_device_id ov5693_acpi_match[] = {
1418-
{"INT33BE", OV5693_INT33BE},
1419-
{"OVTI5693", OV5693_OVTI},
1403+
{"INT33BE"},
1404+
{"OVTI5693"},
14201405
{},
14211406
};
14221407
MODULE_DEVICE_TABLE(acpi, ov5693_acpi_match);
@@ -1438,6 +1423,8 @@ static struct i2c_driver ov5693_driver = {
14381423
.remove = ov5693_remove,
14391424
};
14401425
module_i2c_driver(ov5693_driver);
1426+
module_param(sensor_default_rotation, int, 0644);
1427+
MODULE_PARM_DESC(sensor_default_rotation, "Sensor default rotation in degrees (0, 90, 180, 270)");
14411428

14421429
MODULE_DESCRIPTION("A low-level driver for OmniVision 5693 sensors");
14431430
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)