[media] siano: add support for LNA on ISDB-T
authorMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 7 Mar 2013 19:34:53 +0000 (16:34 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Mar 2013 10:44:05 +0000 (07:44 -0300)
The very same code also exists for DVB-T. Add it for ISDB-T.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/common/siano/smsdvb.c

index 4900aa9e8b7a02d73228a6d82f909e77c7e3f0cd..864f53e7ca63887a0fb3f489dcce98b1ac1fe8a0 100644 (file)
@@ -655,7 +655,7 @@ static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
        int board_id = smscore_get_board_id(client->coredev);
        struct sms_board *board = sms_get_board(board_id);
        enum sms_device_type_st type = board->type;
-
+       int ret;
        struct {
                struct SmsMsgHdr_ST     Msg;
                u32             Data[4];
@@ -695,6 +695,23 @@ static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
                 c->frequency, c->isdbt_sb_segment_count,
                 c->isdbt_sb_segment_idx);
 
+       /* Disable LNA, if any. An error is returned if no LNA is present */
+       ret = sms_board_lna_control(client->coredev, 0);
+       if (ret == 0) {
+               fe_status_t status;
+
+               /* tune with LNA off at first */
+               ret = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
+                                                 &client->tune_done);
+
+               smsdvb_read_status(fe, &status);
+
+               if (status & FE_HAS_LOCK)
+                       return ret;
+
+               /* previous tune didn't lock - enable LNA and tune again */
+               sms_board_lna_control(client->coredev, 1);
+       }
        return smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
                                           &client->tune_done);
 }