summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-12-23 11:28:46 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 15:10:25 -0300
commitcf4fab720c66b15a6cf3abeb5a38acb841efedf4 (patch)
tree0d21a266e25cd9c579ec70a2022497309ed3408f /drivers/media/dvb/siano
parent67ae1d26bd9291280874b49b9f388722682fe58f (diff)
V4L/DVB (13842): smsdvb: Convert it to use DVB API v5 (S2API)
Based on a patch originally written by Michael Krufky <mkrufky@linuxtv.org> for a preliminar S2API spec. The patch were ported to the S2API and had the ISDB-T API additions to honor the auto mode, while keep allowing manual tuning. Tested with both the original dvb-apps and the new dvb-apps-isdbt scan, that uses a different channel.conf and uses S2API with ISDB-T extensions. Thanks-to: Michael Krufky <mkrufky@linuxtv.org> for his first version Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/siano')
-rw-r--r--drivers/media/dvb/siano/smsdvb.c86
1 files changed, 54 insertions, 32 deletions
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c
index 6b85b4872f5..3b786de2271 100644
--- a/drivers/media/dvb/siano/smsdvb.c
+++ b/drivers/media/dvb/siano/smsdvb.c
@@ -478,8 +478,9 @@ static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
}
static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *fep)
+ struct dvb_frontend_parameters *p)
{
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct smsdvb_client_t *client =
container_of(fe, struct smsdvb_client_t, frontend);
@@ -499,18 +500,26 @@ static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe,
Msg.Msg.msgFlags = 0;
Msg.Msg.msgType = MSG_SMS_RF_TUNE_REQ;
Msg.Msg.msgLength = sizeof(Msg);
- Msg.Data[0] = fep->frequency;
+ Msg.Data[0] = c->frequency;
Msg.Data[2] = 12000000;
- sms_debug("freq %d band %d",
- fep->frequency, fep->u.ofdm.bandwidth);
+ sms_info("%s: freq %d band %d", __func__, c->frequency,
+ c->bandwidth_hz);
- switch (fep->u.ofdm.bandwidth) {
- case BANDWIDTH_8_MHZ: Msg.Data[1] = BW_8_MHZ; break;
- case BANDWIDTH_7_MHZ: Msg.Data[1] = BW_7_MHZ; break;
- case BANDWIDTH_6_MHZ: Msg.Data[1] = BW_6_MHZ; break;
- case BANDWIDTH_AUTO: return -EOPNOTSUPP;
- default: return -EINVAL;
+ switch (c->bandwidth_hz / 1000) {
+ case 8:
+ Msg.Data[1] = BW_8_MHZ;
+ break;
+ case 7:
+ Msg.Data[1] = BW_7_MHZ;
+ break;
+ case 6:
+ Msg.Data[1] = BW_6_MHZ;
+ break;
+ case 0:
+ return -EOPNOTSUPP;
+ default:
+ return -EINVAL;
}
/* Disable LNA, if any. An error is returned if no LNA is present */
ret = sms_board_lna_control(client->coredev, 0);
@@ -535,9 +544,9 @@ static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe,
}
static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *fep,
- u32 SegmentNumber)
+ struct dvb_frontend_parameters *p)
{
+ struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct smsdvb_client_t *client =
container_of(fe, struct smsdvb_client_t, frontend);
@@ -551,29 +560,48 @@ static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe,
Msg.Msg.msgFlags = 0;
Msg.Msg.msgType = MSG_SMS_ISDBT_TUNE_REQ;
Msg.Msg.msgLength = sizeof(Msg);
- Msg.Data[0] = fep->frequency;
- Msg.Data[2] = 12000000;
- Msg.Data[3] = SegmentNumber;
- sms_debug("freq %d band %d seg %d\n",
- fep->frequency, fep->u.ofdm.bandwidth, SegmentNumber);
+ if (c->isdbt_sb_segment_idx == -1)
+ c->isdbt_sb_segment_idx = 0;
- switch (fep->u.ofdm.bandwidth) {
- case BANDWIDTH_8_MHZ:
+ switch (c->isdbt_sb_segment_count) {
+ case 3:
Msg.Data[1] = BW_ISDBT_3SEG;
break;
- case BANDWIDTH_7_MHZ:
- Msg.Data[1] = BW_ISDBT_3SEG;
- break;
- case BANDWIDTH_6_MHZ:
+ case 1:
Msg.Data[1] = BW_ISDBT_1SEG;
break;
- case BANDWIDTH_AUTO:
- return -EOPNOTSUPP;
+ case 0: /* AUTO */
+ switch (c->bandwidth_hz / 1000) {
+ case 8:
+ case 7:
+ c->isdbt_sb_segment_count = 3;
+ Msg.Data[1] = BW_ISDBT_3SEG;
+ break;
+ case 6:
+ c->isdbt_sb_segment_count = 1;
+ Msg.Data[1] = BW_ISDBT_1SEG;
+ break;
+ default: /* Assumes 6 MHZ bw */
+ c->isdbt_sb_segment_count = 1;
+ c->bandwidth_hz = 6000;
+ Msg.Data[1] = BW_ISDBT_1SEG;
+ break;
+ }
+ break;
default:
+ sms_info("Segment count %d not supported", c->isdbt_sb_segment_count);
return -EINVAL;
}
+ Msg.Data[0] = c->frequency;
+ Msg.Data[2] = 12000000;
+ Msg.Data[3] = c->isdbt_sb_segment_idx;
+
+ sms_info("%s: freq %d segwidth %d segindex %d\n", __func__,
+ c->frequency, c->isdbt_sb_segment_count,
+ c->isdbt_sb_segment_idx);
+
return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
&client->tune_done);
}
@@ -591,13 +619,7 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
return smsdvb_dvbt_set_frontend(fe, fep);
case DEVICE_MODE_ISDBT:
case DEVICE_MODE_ISDBT_BDA:
- {
- u32 segmentnum;
- /* XXX: hack - use 4 lower bits in frequency for segment num */
- segmentnum = fep->frequency & 0x0000000f;
- fep->frequency &= ~0x0000000f;
- return smsdvb_isdbt_set_frontend(fe, fep, segmentnum);
- }
+ return smsdvb_isdbt_set_frontend(fe, fep);
default:
return -EINVAL;
}