media: ngene: use defines to identify the demod_type

Make it more clear which demod_type is used for which hardware by having
defines for the possible demod_type values. With that, change the
demod_type evaluation in tuner_attach_probe() to a switch-case instead
of an if() for each possible value.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Daniel Scheller 2018-02-25 07:31:31 -05:00 committed by Mauro Carvalho Chehab
parent 6795bf6264
commit 66a4c0c749
2 changed files with 10 additions and 4 deletions

View File

@ -123,10 +123,13 @@ static int tuner_attach_tda18271(struct ngene_channel *chan)
static int tuner_attach_probe(struct ngene_channel *chan)
{
if (chan->demod_type == 0)
switch (chan->demod_type) {
case DEMOD_TYPE_STV090X:
return tuner_attach_stv6110(chan);
if (chan->demod_type == 1)
case DEMOD_TYPE_DRXK:
return tuner_attach_tda18271(chan);
}
return -EINVAL;
}
@ -251,7 +254,7 @@ static int cineS2_probe(struct ngene_channel *chan)
i2c = &chan->dev->channel[1].i2c_adapter;
if (port_has_stv0900(i2c, chan->number)) {
chan->demod_type = 0;
chan->demod_type = DEMOD_TYPE_STV090X;
fe_conf = chan->dev->card_info->fe_config[chan->number];
/* demod found, attach it */
rc = demod_attach_stv0900(chan);
@ -280,7 +283,7 @@ static int cineS2_probe(struct ngene_channel *chan)
return -EIO;
}
} else if (port_has_drxk(i2c, chan->number^2)) {
chan->demod_type = 1;
chan->demod_type = DEMOD_TYPE_DRXK;
demod_attach_drxk(chan, i2c);
} else {
dev_err(pdev, "No demod found on chan %d\n", chan->number);

View File

@ -51,6 +51,9 @@
#define VIDEO_CAP_MPEG4 512
#endif
#define DEMOD_TYPE_STV090X 0
#define DEMOD_TYPE_DRXK 1
enum STREAM {
STREAM_VIDEOIN1 = 0, /* ITU656 or TS Input */
STREAM_VIDEOIN2,