V4L/DVB (13841): smsdvb: Make stats to work

Siano series of patches seemed to cause a regression on reporting DTV
statistics. Due to that, signal indication weren't received, preventing
applications like scan to work.

Tested with ISDB-T signals and got the same scan result as with a
dib0700/dib8000 device.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2009-12-23 10:07:16 -03:00
parent dcb0c53331
commit 67ae1d26bd
2 changed files with 71 additions and 6 deletions

View File

@ -212,6 +212,8 @@ struct smscore_device_t {
#define MSG_SMS_DAB_CHANNEL 607
#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
#define MSG_SMS_GET_PID_FILTER_LIST_RES 609
#define MSG_SMS_GET_STATISTICS_RES 616
#define MSG_SMS_GET_STATISTICS_REQ 615
#define MSG_SMS_HO_PER_SLICES_IND 630
#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
@ -340,7 +342,7 @@ struct SmsFirmware_ST {
/* Statistics information returned as response for
* SmsHostApiGetStatistics_Req */
struct SMSHOSTLIB_STATISTICS_S {
u32 Reserved; /* Reserved */
u8 Reserved[5]; /* Reserved */
/* Common parameters */
u32 IsRfLocked; /* 0 - not locked, 1 - locked */

View File

@ -218,6 +218,39 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
is_status_update = true;
break;
}
case MSG_SMS_GET_STATISTICS_RES: {
struct SMSHOSTLIB_STATISTICS_S *p =
(struct SMSHOSTLIB_STATISTICS_S *)(phdr + 1);
struct RECEPTION_STATISTICS_S *pReceptionData =
&client->sms_stat_dvb.ReceptionData;
sms_info("MSG_SMS_GET_STATISTICS_RES");
is_status_update = true;
pReceptionData->IsDemodLocked = p->IsDemodLocked;
if (!pReceptionData->IsDemodLocked) {
pReceptionData->SNR = 0;
pReceptionData->BER = 0;
pReceptionData->BERErrorCount = 0;
pReceptionData->InBandPwr = 0;
pReceptionData->ErrorTSPackets = 0;
complete(&client->tune_done);
break;
}
pReceptionData->SNR = p->SNR;
pReceptionData->BER = p->BER;
pReceptionData->BERErrorCount = p->BERErrorCount;
pReceptionData->InBandPwr = p->InBandPwr;
pReceptionData->ErrorTSPackets = p->ErrorTSPackets;
complete(&client->tune_done);
break;
}
default:
sms_info("Unhandled message %d", phdr->msgType);
}
smscore_putbuffer(client->coredev, cb);
@ -326,6 +359,20 @@ static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client,
0 : -ETIME;
}
static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
{
int rc;
struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ,
DVBT_BDA_CONTROL_MSG_ID,
HIF_TASK,
sizeof(struct SmsMsgHdr_ST), 0 };
rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
&client->tune_done);
return rc;
}
static inline int led_feedback(struct smsdvb_client_t *client)
{
if (client->fe_status & FE_HAS_LOCK)
@ -338,33 +385,43 @@ static inline int led_feedback(struct smsdvb_client_t *client)
static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);
rc = smsdvb_send_statistics_request(client);
*stat = client->fe_status;
led_feedback(client);
return 0;
return rc;
}
static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);
rc = smsdvb_send_statistics_request(client);
*ber = client->sms_stat_dvb.ReceptionData.BER;
led_feedback(client);
return 0;
return rc;
}
static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);
rc = smsdvb_send_statistics_request(client);
if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95)
*strength = 0;
else if (client->sms_stat_dvb.ReceptionData.InBandPwr > -29)
@ -376,31 +433,37 @@ static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
led_feedback(client);
return 0;
return rc;
}
static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);
rc = smsdvb_send_statistics_request(client);
*snr = client->sms_stat_dvb.ReceptionData.SNR;
led_feedback(client);
return 0;
return rc;
}
static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);
rc = smsdvb_send_statistics_request(client);
*ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets;
led_feedback(client);
return 0;
return rc;
}
static int smsdvb_get_tune_settings(struct dvb_frontend *fe,