linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [RFC] dib8000: return an error if the TMCC is not locked
@ 2012-01-17 18:45 Mauro Carvalho Chehab
  2012-01-18 12:49 ` Patrick Boettcher
  0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2012-01-17 18:45 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Patrick Boettcher

On ISDB-T, a few carriers are reserved for TMCC decoding
(1 to 20 carriers, depending on the mode). Those carriers
use the DBPSK modulation, and contain the information about
each of the three layers of carriers (modulation, partial
reception, inner code, interleaving, and number of segments).

If the TMCC carrier was not locked and decoded, no information
would be provided by get_frontend(). So, instead of returning
false values, return -EAGAIN.

Another alternative for this patch would be to add a flag to
fe_status (FE_HAS_GET_FRONTEND?), to indicate that the ISDB-T
TMCC carriers (and DVB-T TPS?), required for get_frontend
to work, are locked.

Comments?

Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/media/dvb/frontends/dib8000.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/frontends/dib8000.c b/drivers/media/dvb/frontends/dib8000.c
index 9ca34f4..c566be2 100644
--- a/drivers/media/dvb/frontends/dib8000.c
+++ b/drivers/media/dvb/frontends/dib8000.c
@@ -2813,7 +2813,7 @@ EXPORT_SYMBOL(dib8000_set_tune_state);
 static int dib8000_get_frontend(struct dvb_frontend *fe)
 {
 	struct dib8000_state *state = fe->demodulator_priv;
-	u16 i, val = 0;
+	u16 i, val = 0, lock;
 	fe_status_t stat;
 	u8 index_frontend, sub_index_frontend;
 
@@ -2840,7 +2840,7 @@ static int dib8000_get_frontend(struct dvb_frontend *fe)
 					}
 				}
 			}
-			return 0;
+			goto ret;
 		}
 	}
 
@@ -2953,6 +2953,17 @@ static int dib8000_get_frontend(struct dvb_frontend *fe)
 			state->fe[index_frontend]->dtv_property_cache.layer[i].modulation = fe->dtv_property_cache.layer[i].modulation;
 		}
 	}
+
+ret:
+	if (state->revision != 0x8090)
+		lock = dib8000_read_word(state, 568);
+	else
+		lock = dib8000_read_word(state, 570);
+
+	/* Check if the TMCC decoder is locked */
+	if ((lock & 0x1e) != 0x1e)
+		return -EAGAIN;
+
 	return 0;
 }
 
-- 
1.7.8


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-19 11:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17 18:45 [PATCH] [RFC] dib8000: return an error if the TMCC is not locked Mauro Carvalho Chehab
2012-01-18 12:49 ` Patrick Boettcher
2012-01-18 13:40   ` Mauro Carvalho Chehab
2012-01-18 13:50     ` Patrick Boettcher
2012-01-18 17:51       ` [PATCH 1/2] dvb: frontend API: Add a flag to indicate that get_frontend() can be called Mauro Carvalho Chehab
2012-01-18 17:51         ` [PATCH 2/2] [media] dvb_frontend: Require FE_HAS_PARAMETERS for get_frontend() Mauro Carvalho Chehab
2012-01-19 10:07           ` Patrick Boettcher
2012-01-19 11:17             ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).