Skip to content

Commit 2b62f1f

Browse files
Niklas Söderlundjfvogel
authored andcommitted
media: adv7180: Disable test-pattern control on adv7180
[ Upstream commit a980bc5f56b0292336e408f657f79e574e8067c0 ] The register that enables selecting a test-pattern to be outputted in free-run mode (FREE_RUN_PAT_SEL[2:0]) is only available on adv7280 based devices, not the adv7180 based ones. Add a flag to mark devices that are capable of generating test-patterns, and those that are not. And only register the control on supported devices. Signed-off-by: Niklas Söderlund <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit bb8fb041cba26793200d006231fab765ee63ed64) Signed-off-by: Jack Vogel <[email protected]>
1 parent 57c63ec commit 2b62f1f

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

drivers/media/i2c/adv7180.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ struct adv7180_state;
195195
#define ADV7180_FLAG_V2 BIT(1)
196196
#define ADV7180_FLAG_MIPI_CSI2 BIT(2)
197197
#define ADV7180_FLAG_I2P BIT(3)
198+
#define ADV7180_FLAG_TEST_PATTERN BIT(4)
198199

199200
struct adv7180_chip_info {
200201
unsigned int flags;
@@ -682,11 +683,15 @@ static int adv7180_init_controls(struct adv7180_state *state)
682683
ADV7180_HUE_MAX, 1, ADV7180_HUE_DEF);
683684
v4l2_ctrl_new_custom(&state->ctrl_hdl, &adv7180_ctrl_fast_switch, NULL);
684685

685-
v4l2_ctrl_new_std_menu_items(&state->ctrl_hdl, &adv7180_ctrl_ops,
686-
V4L2_CID_TEST_PATTERN,
687-
ARRAY_SIZE(test_pattern_menu) - 1,
688-
0, ARRAY_SIZE(test_pattern_menu) - 1,
689-
test_pattern_menu);
686+
if (state->chip_info->flags & ADV7180_FLAG_TEST_PATTERN) {
687+
v4l2_ctrl_new_std_menu_items(&state->ctrl_hdl,
688+
&adv7180_ctrl_ops,
689+
V4L2_CID_TEST_PATTERN,
690+
ARRAY_SIZE(test_pattern_menu) - 1,
691+
0,
692+
ARRAY_SIZE(test_pattern_menu) - 1,
693+
test_pattern_menu);
694+
}
690695

691696
state->sd.ctrl_handler = &state->ctrl_hdl;
692697
if (state->ctrl_hdl.error) {
@@ -1221,7 +1226,7 @@ static const struct adv7180_chip_info adv7182_info = {
12211226
};
12221227

12231228
static const struct adv7180_chip_info adv7280_info = {
1224-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_I2P,
1229+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_I2P | ADV7180_FLAG_TEST_PATTERN,
12251230
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
12261231
BIT(ADV7182_INPUT_CVBS_AIN2) |
12271232
BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1235,7 +1240,8 @@ static const struct adv7180_chip_info adv7280_info = {
12351240
};
12361241

12371242
static const struct adv7180_chip_info adv7280_m_info = {
1238-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 | ADV7180_FLAG_I2P,
1243+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 | ADV7180_FLAG_I2P |
1244+
ADV7180_FLAG_TEST_PATTERN,
12391245
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
12401246
BIT(ADV7182_INPUT_CVBS_AIN2) |
12411247
BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1256,7 +1262,8 @@ static const struct adv7180_chip_info adv7280_m_info = {
12561262
};
12571263

12581264
static const struct adv7180_chip_info adv7281_info = {
1259-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2,
1265+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 |
1266+
ADV7180_FLAG_TEST_PATTERN,
12601267
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
12611268
BIT(ADV7182_INPUT_CVBS_AIN2) |
12621269
BIT(ADV7182_INPUT_CVBS_AIN7) |
@@ -1271,7 +1278,8 @@ static const struct adv7180_chip_info adv7281_info = {
12711278
};
12721279

12731280
static const struct adv7180_chip_info adv7281_m_info = {
1274-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2,
1281+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 |
1282+
ADV7180_FLAG_TEST_PATTERN,
12751283
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
12761284
BIT(ADV7182_INPUT_CVBS_AIN2) |
12771285
BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1291,7 +1299,8 @@ static const struct adv7180_chip_info adv7281_m_info = {
12911299
};
12921300

12931301
static const struct adv7180_chip_info adv7281_ma_info = {
1294-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2,
1302+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 |
1303+
ADV7180_FLAG_TEST_PATTERN,
12951304
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
12961305
BIT(ADV7182_INPUT_CVBS_AIN2) |
12971306
BIT(ADV7182_INPUT_CVBS_AIN3) |
@@ -1316,7 +1325,7 @@ static const struct adv7180_chip_info adv7281_ma_info = {
13161325
};
13171326

13181327
static const struct adv7180_chip_info adv7282_info = {
1319-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_I2P,
1328+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_I2P | ADV7180_FLAG_TEST_PATTERN,
13201329
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
13211330
BIT(ADV7182_INPUT_CVBS_AIN2) |
13221331
BIT(ADV7182_INPUT_CVBS_AIN7) |
@@ -1331,7 +1340,8 @@ static const struct adv7180_chip_info adv7282_info = {
13311340
};
13321341

13331342
static const struct adv7180_chip_info adv7282_m_info = {
1334-
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 | ADV7180_FLAG_I2P,
1343+
.flags = ADV7180_FLAG_V2 | ADV7180_FLAG_MIPI_CSI2 | ADV7180_FLAG_I2P |
1344+
ADV7180_FLAG_TEST_PATTERN,
13351345
.valid_input_mask = BIT(ADV7182_INPUT_CVBS_AIN1) |
13361346
BIT(ADV7182_INPUT_CVBS_AIN2) |
13371347
BIT(ADV7182_INPUT_CVBS_AIN3) |

0 commit comments

Comments
 (0)