aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/siano/smsdvb.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2009-12-22 19:08:49 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:25 -0500
commit6b26fcea513095cd8a86cb376ad5a9df2fa8fe14 (patch)
treec228a35f3ebd66d4b8dd09a81d04cbf32d6ca2e8 /drivers/media/dvb/siano/smsdvb.c
parentc245c75c41b9693bcbd6c95e25af324188b4dce1 (diff)
V4L/DVB (13839): smsdvb: add ISDB-T as DVB-T tuning support hack
Activate ISDB-T mode using module option default_mode=6. hack: use 4 lower bits in frequency for segment number [mchehab@redhat.com: fix merge conflicts and CodingStyle] Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/siano/smsdvb.c')
-rw-r--r--drivers/media/dvb/siano/smsdvb.c81
1 files changed, 72 insertions, 9 deletions
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c
index 68bf9fbd8fed..ca952eb8d56b 100644
--- a/drivers/media/dvb/siano/smsdvb.c
+++ b/drivers/media/dvb/siano/smsdvb.c
@@ -134,6 +134,7 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
134 break; 134 break;
135 135
136 case MSG_SMS_RF_TUNE_RES: 136 case MSG_SMS_RF_TUNE_RES:
137 case MSG_SMS_ISDBT_TUNE_RES:
137 complete(&client->tune_done); 138 complete(&client->tune_done);
138 break; 139 break;
139 140
@@ -413,8 +414,8 @@ static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
413 return 0; 414 return 0;
414} 415}
415 416
416static int smsdvb_set_frontend(struct dvb_frontend *fe, 417static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe,
417 struct dvb_frontend_parameters *fep) 418 struct dvb_frontend_parameters *fep)
418{ 419{
419 struct smsdvb_client_t *client = 420 struct smsdvb_client_t *client =
420 container_of(fe, struct smsdvb_client_t, frontend); 421 container_of(fe, struct smsdvb_client_t, frontend);
@@ -470,6 +471,75 @@ static int smsdvb_set_frontend(struct dvb_frontend *fe,
470 &client->tune_done); 471 &client->tune_done);
471} 472}
472 473
474static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe,
475 struct dvb_frontend_parameters *fep,
476 u32 SegmentNumber)
477{
478 struct smsdvb_client_t *client =
479 container_of(fe, struct smsdvb_client_t, frontend);
480
481 struct {
482 struct SmsMsgHdr_ST Msg;
483 u32 Data[4];
484 } Msg;
485
486 Msg.Msg.msgSrcId = DVBT_BDA_CONTROL_MSG_ID;
487 Msg.Msg.msgDstId = HIF_TASK;
488 Msg.Msg.msgFlags = 0;
489 Msg.Msg.msgType = MSG_SMS_ISDBT_TUNE_REQ;
490 Msg.Msg.msgLength = sizeof(Msg);
491 Msg.Data[0] = fep->frequency;
492 Msg.Data[2] = 12000000;
493 Msg.Data[3] = SegmentNumber;
494
495 sms_debug("freq %d band %d seg %d\n",
496 fep->frequency, fep->u.ofdm.bandwidth, SegmentNumber);
497
498 switch (fep->u.ofdm.bandwidth) {
499 case BANDWIDTH_8_MHZ:
500 Msg.Data[1] = BW_ISDBT_3SEG;
501 break;
502 case BANDWIDTH_7_MHZ:
503 Msg.Data[1] = BW_ISDBT_3SEG;
504 break;
505 case BANDWIDTH_6_MHZ:
506 Msg.Data[1] = BW_ISDBT_1SEG;
507 break;
508 case BANDWIDTH_AUTO:
509 return -EOPNOTSUPP;
510 default:
511 return -EINVAL;
512 }
513
514 return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
515 &client->tune_done);
516}
517
518static int smsdvb_set_frontend(struct dvb_frontend *fe,
519 struct dvb_frontend_parameters *fep)
520{
521 struct smsdvb_client_t *client =
522 container_of(fe, struct smsdvb_client_t, frontend);
523 struct smscore_device_t *coredev = client->coredev;
524
525 switch (smscore_get_device_mode(coredev)) {
526 case DEVICE_MODE_DVBT:
527 case DEVICE_MODE_DVBT_BDA:
528 return smsdvb_dvbt_set_frontend(fe, fep);
529 case DEVICE_MODE_ISDBT:
530 case DEVICE_MODE_ISDBT_BDA:
531 {
532 u32 segmentnum;
533 /* XXX: hack - use 4 lower bits in frequency for segment num */
534 segmentnum = fep->frequency & 0x0000000f;
535 fep->frequency &= ~0x0000000f;
536 return smsdvb_isdbt_set_frontend(fe, fep, segmentnum);
537 }
538 default:
539 return -EINVAL;
540 }
541}
542
473static int smsdvb_get_frontend(struct dvb_frontend *fe, 543static int smsdvb_get_frontend(struct dvb_frontend *fe,
474 struct dvb_frontend_parameters *fep) 544 struct dvb_frontend_parameters *fep)
475{ 545{
@@ -557,13 +627,6 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
557 /* device removal handled by onremove callback */ 627 /* device removal handled by onremove callback */
558 if (!arrival) 628 if (!arrival)
559 return 0; 629 return 0;
560
561 if (smscore_get_device_mode(coredev) != DEVICE_MODE_DVBT_BDA) {
562 sms_err("SMS Device mode is not set for "
563 "DVB operation.");
564 return 0;
565 }
566
567 client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); 630 client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL);
568 if (!client) { 631 if (!client) {
569 sms_err("kmalloc() failed"); 632 sms_err("kmalloc() failed");