Skip to content

Commit

Permalink
V4L/DVB (12269): af9013: auto-detect parameters in case of garbage gi…
Browse files Browse the repository at this point in the history
…ven 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: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Jul 24, 2009
1 parent 2795493 commit a2f5a81
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions drivers/media/dvb/frontends/af9013.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
u8 i, buf[3] = {0, 0, 0};
*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) {
case TRANSMISSION_MODE_AUTO:
*auto_mode = 1;
Expand All @@ -536,7 +540,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[0] |= (1 << 0);
break;
default:
return -EINVAL;
deb_info("%s: invalid transmission_mode\n", __func__);
*auto_mode = 1;
}

switch (params->guard_interval) {
Expand All @@ -554,7 +559,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[0] |= (3 << 2);
break;
default:
return -EINVAL;
deb_info("%s: invalid guard_interval\n", __func__);
*auto_mode = 1;
}

switch (params->hierarchy_information) {
Expand All @@ -572,7 +578,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[0] |= (3 << 4);
break;
default:
return -EINVAL;
deb_info("%s: invalid hierarchy_information\n", __func__);
*auto_mode = 1;
};

switch (params->constellation) {
Expand All @@ -587,7 +594,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[1] |= (2 << 6);
break;
default:
return -EINVAL;
deb_info("%s: invalid constellation\n", __func__);
*auto_mode = 1;
}

/* Use HP. How and which case we can switch to LP? */
Expand All @@ -611,7 +619,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[2] |= (4 << 0);
break;
default:
return -EINVAL;
deb_info("%s: invalid code_rate_HP\n", __func__);
*auto_mode = 1;
}

switch (params->code_rate_LP) {
Expand All @@ -638,7 +647,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
if (params->hierarchy_information == HIERARCHY_AUTO)
break;
default:
return -EINVAL;
deb_info("%s: invalid code_rate_LP\n", __func__);
*auto_mode = 1;
}

switch (params->bandwidth) {
Expand All @@ -651,7 +661,8 @@ static int af9013_set_ofdm_params(struct af9013_state *state,
buf[1] |= (2 << 2);
break;
default:
return -EINVAL;
deb_info("%s: invalid bandwidth\n", __func__);
buf[1] |= (2 << 2); /* cannot auto-detect BW, try 8 MHz */
}

/* program */
Expand Down

0 comments on commit a2f5a81

Please sign in to comment.