Commit a2f5a811 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

V4L/DVB (12269): af9013: auto-detect parameters in case of garbage given by app

Request demodulator auto-detect transmission parameters in case of
garbage parameters provided by application for compatibility.
That's needed at least for MPlayer compatibility currently.

Thanks to Jelle de Jong for reporting issue and providing SSH access to
Devin for debugging.

Thanks to Devin Heitmueller for hard debug work he did to find that bug.

Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Jelle de Jong <jelledejong@powercraft.nl>
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 27954930
...@@ -527,6 +527,10 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -527,6 +527,10 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
u8 i, buf[3] = {0, 0, 0}; u8 i, buf[3] = {0, 0, 0};
*auto_mode = 0; /* set if parameters are requested to auto set */ *auto_mode = 0; /* set if parameters are requested to auto set */
/* Try auto-detect transmission parameters in case of AUTO requested or
garbage parameters given by application for compatibility.
MPlayer seems to provide garbage parameters currently. */
switch (params->transmission_mode) { switch (params->transmission_mode) {
case TRANSMISSION_MODE_AUTO: case TRANSMISSION_MODE_AUTO:
*auto_mode = 1; *auto_mode = 1;
...@@ -536,7 +540,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -536,7 +540,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[0] |= (1 << 0); buf[0] |= (1 << 0);
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid transmission_mode\n", __func__);
*auto_mode = 1;
} }
switch (params->guard_interval) { switch (params->guard_interval) {
...@@ -554,7 +559,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -554,7 +559,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[0] |= (3 << 2); buf[0] |= (3 << 2);
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid guard_interval\n", __func__);
*auto_mode = 1;
} }
switch (params->hierarchy_information) { switch (params->hierarchy_information) {
...@@ -572,7 +578,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -572,7 +578,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[0] |= (3 << 4); buf[0] |= (3 << 4);
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid hierarchy_information\n", __func__);
*auto_mode = 1;
}; };
switch (params->constellation) { switch (params->constellation) {
...@@ -587,7 +594,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -587,7 +594,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[1] |= (2 << 6); buf[1] |= (2 << 6);
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid constellation\n", __func__);
*auto_mode = 1;
} }
/* Use HP. How and which case we can switch to LP? */ /* Use HP. How and which case we can switch to LP? */
...@@ -611,7 +619,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -611,7 +619,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[2] |= (4 << 0); buf[2] |= (4 << 0);
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid code_rate_HP\n", __func__);
*auto_mode = 1;
} }
switch (params->code_rate_LP) { switch (params->code_rate_LP) {
...@@ -638,7 +647,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -638,7 +647,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
if (params->hierarchy_information == HIERARCHY_AUTO) if (params->hierarchy_information == HIERARCHY_AUTO)
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid code_rate_LP\n", __func__);
*auto_mode = 1;
} }
switch (params->bandwidth) { switch (params->bandwidth) {
...@@ -651,7 +661,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state, ...@@ -651,7 +661,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[1] |= (2 << 2); buf[1] |= (2 << 2);
break; break;
default: default:
return -EINVAL; deb_info("%s: invalid bandwidth\n", __func__);
buf[1] |= (2 << 2); /* cannot auto-detect BW, try 8 MHz */
} }
/* program */ /* program */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment