diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-23 08:07:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:25 -0500 |
commit | 67ae1d26bd9291280874b49b9f388722682fe58f (patch) | |
tree | 17bee13813c79045f4675b48f8520115db2dac94 | |
parent | dcb0c53331c0cfcac52d0921d3e3d06fdb2c417a (diff) |
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>
-rw-r--r-- | drivers/media/dvb/siano/smscoreapi.h | 4 | ||||
-rw-r--r-- | drivers/media/dvb/siano/smsdvb.c | 73 |
2 files changed, 71 insertions, 6 deletions
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h index eec18aaf551..7393e2b5265 100644 --- a/drivers/media/dvb/siano/smscoreapi.h +++ b/drivers/media/dvb/siano/smscoreapi.h | |||
@@ -212,6 +212,8 @@ struct smscore_device_t { | |||
212 | #define MSG_SMS_DAB_CHANNEL 607 | 212 | #define MSG_SMS_DAB_CHANNEL 607 |
213 | #define MSG_SMS_GET_PID_FILTER_LIST_REQ 608 | 213 | #define MSG_SMS_GET_PID_FILTER_LIST_REQ 608 |
214 | #define MSG_SMS_GET_PID_FILTER_LIST_RES 609 | 214 | #define MSG_SMS_GET_PID_FILTER_LIST_RES 609 |
215 | #define MSG_SMS_GET_STATISTICS_RES 616 | ||
216 | #define MSG_SMS_GET_STATISTICS_REQ 615 | ||
215 | #define MSG_SMS_HO_PER_SLICES_IND 630 | 217 | #define MSG_SMS_HO_PER_SLICES_IND 630 |
216 | #define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651 | 218 | #define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651 |
217 | #define MSG_SMS_SET_ANTENNA_CONFIG_RES 652 | 219 | #define MSG_SMS_SET_ANTENNA_CONFIG_RES 652 |
@@ -340,7 +342,7 @@ struct SmsFirmware_ST { | |||
340 | /* Statistics information returned as response for | 342 | /* Statistics information returned as response for |
341 | * SmsHostApiGetStatistics_Req */ | 343 | * SmsHostApiGetStatistics_Req */ |
342 | struct SMSHOSTLIB_STATISTICS_S { | 344 | struct SMSHOSTLIB_STATISTICS_S { |
343 | u32 Reserved; /* Reserved */ | 345 | u8 Reserved[5]; /* Reserved */ |
344 | 346 | ||
345 | /* Common parameters */ | 347 | /* Common parameters */ |
346 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ | 348 | u32 IsRfLocked; /* 0 - not locked, 1 - locked */ |
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c index ca952eb8d56..6b85b4872f5 100644 --- a/drivers/media/dvb/siano/smsdvb.c +++ b/drivers/media/dvb/siano/smsdvb.c | |||
@@ -218,6 +218,39 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) | |||
218 | is_status_update = true; | 218 | is_status_update = true; |
219 | break; | 219 | break; |
220 | } | 220 | } |
221 | case MSG_SMS_GET_STATISTICS_RES: { | ||
222 | struct SMSHOSTLIB_STATISTICS_S *p = | ||
223 | (struct SMSHOSTLIB_STATISTICS_S *)(phdr + 1); | ||
224 | struct RECEPTION_STATISTICS_S *pReceptionData = | ||
225 | &client->sms_stat_dvb.ReceptionData; | ||
226 | |||
227 | sms_info("MSG_SMS_GET_STATISTICS_RES"); | ||
228 | |||
229 | is_status_update = true; | ||
230 | pReceptionData->IsDemodLocked = p->IsDemodLocked; | ||
231 | if (!pReceptionData->IsDemodLocked) { | ||
232 | pReceptionData->SNR = 0; | ||
233 | pReceptionData->BER = 0; | ||
234 | pReceptionData->BERErrorCount = 0; | ||
235 | pReceptionData->InBandPwr = 0; | ||
236 | pReceptionData->ErrorTSPackets = 0; | ||
237 | |||
238 | complete(&client->tune_done); | ||
239 | break; | ||
240 | } | ||
241 | |||
242 | pReceptionData->SNR = p->SNR; | ||
243 | pReceptionData->BER = p->BER; | ||
244 | pReceptionData->BERErrorCount = p->BERErrorCount; | ||
245 | pReceptionData->InBandPwr = p->InBandPwr; | ||
246 | pReceptionData->ErrorTSPackets = p->ErrorTSPackets; | ||
247 | |||
248 | complete(&client->tune_done); | ||
249 | break; | ||
250 | } | ||
251 | default: | ||
252 | sms_info("Unhandled message %d", phdr->msgType); | ||
253 | |||
221 | } | 254 | } |
222 | smscore_putbuffer(client->coredev, cb); | 255 | smscore_putbuffer(client->coredev, cb); |
223 | 256 | ||
@@ -326,6 +359,20 @@ static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, | |||
326 | 0 : -ETIME; | 359 | 0 : -ETIME; |
327 | } | 360 | } |
328 | 361 | ||
362 | static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) | ||
363 | { | ||
364 | int rc; | ||
365 | struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ, | ||
366 | DVBT_BDA_CONTROL_MSG_ID, | ||
367 | HIF_TASK, | ||
368 | sizeof(struct SmsMsgHdr_ST), 0 }; | ||
369 | |||
370 | rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg), | ||
371 | &client->tune_done); | ||
372 | |||
373 | return rc; | ||
374 | } | ||
375 | |||
329 | static inline int led_feedback(struct smsdvb_client_t *client) | 376 | static inline int led_feedback(struct smsdvb_client_t *client) |
330 | { | 377 | { |
331 | if (client->fe_status & FE_HAS_LOCK) | 378 | if (client->fe_status & FE_HAS_LOCK) |
@@ -338,33 +385,43 @@ static inline int led_feedback(struct smsdvb_client_t *client) | |||
338 | 385 | ||
339 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) | 386 | static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat) |
340 | { | 387 | { |
388 | int rc; | ||
341 | struct smsdvb_client_t *client; | 389 | struct smsdvb_client_t *client; |
342 | client = container_of(fe, struct smsdvb_client_t, frontend); | 390 | client = container_of(fe, struct smsdvb_client_t, frontend); |
343 | 391 | ||
392 | rc = smsdvb_send_statistics_request(client); | ||
393 | |||
344 | *stat = client->fe_status; | 394 | *stat = client->fe_status; |
345 | 395 | ||
346 | led_feedback(client); | 396 | led_feedback(client); |
347 | 397 | ||
348 | return 0; | 398 | return rc; |
349 | } | 399 | } |
350 | 400 | ||
351 | static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) | 401 | static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) |
352 | { | 402 | { |
403 | int rc; | ||
353 | struct smsdvb_client_t *client; | 404 | struct smsdvb_client_t *client; |
354 | client = container_of(fe, struct smsdvb_client_t, frontend); | 405 | client = container_of(fe, struct smsdvb_client_t, frontend); |
355 | 406 | ||
407 | rc = smsdvb_send_statistics_request(client); | ||
408 | |||
356 | *ber = client->sms_stat_dvb.ReceptionData.BER; | 409 | *ber = client->sms_stat_dvb.ReceptionData.BER; |
357 | 410 | ||
358 | led_feedback(client); | 411 | led_feedback(client); |
359 | 412 | ||
360 | return 0; | 413 | return rc; |
361 | } | 414 | } |
362 | 415 | ||
363 | static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | 416 | static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) |
364 | { | 417 | { |
418 | int rc; | ||
419 | |||
365 | struct smsdvb_client_t *client; | 420 | struct smsdvb_client_t *client; |
366 | client = container_of(fe, struct smsdvb_client_t, frontend); | 421 | client = container_of(fe, struct smsdvb_client_t, frontend); |
367 | 422 | ||
423 | rc = smsdvb_send_statistics_request(client); | ||
424 | |||
368 | if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95) | 425 | if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95) |
369 | *strength = 0; | 426 | *strength = 0; |
370 | else if (client->sms_stat_dvb.ReceptionData.InBandPwr > -29) | 427 | 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) | |||
376 | 433 | ||
377 | led_feedback(client); | 434 | led_feedback(client); |
378 | 435 | ||
379 | return 0; | 436 | return rc; |
380 | } | 437 | } |
381 | 438 | ||
382 | static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) | 439 | static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) |
383 | { | 440 | { |
441 | int rc; | ||
384 | struct smsdvb_client_t *client; | 442 | struct smsdvb_client_t *client; |
385 | client = container_of(fe, struct smsdvb_client_t, frontend); | 443 | client = container_of(fe, struct smsdvb_client_t, frontend); |
386 | 444 | ||
445 | rc = smsdvb_send_statistics_request(client); | ||
446 | |||
387 | *snr = client->sms_stat_dvb.ReceptionData.SNR; | 447 | *snr = client->sms_stat_dvb.ReceptionData.SNR; |
388 | 448 | ||
389 | led_feedback(client); | 449 | led_feedback(client); |
390 | 450 | ||
391 | return 0; | 451 | return rc; |
392 | } | 452 | } |
393 | 453 | ||
394 | static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | 454 | static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) |
395 | { | 455 | { |
456 | int rc; | ||
396 | struct smsdvb_client_t *client; | 457 | struct smsdvb_client_t *client; |
397 | client = container_of(fe, struct smsdvb_client_t, frontend); | 458 | client = container_of(fe, struct smsdvb_client_t, frontend); |
398 | 459 | ||
460 | rc = smsdvb_send_statistics_request(client); | ||
461 | |||
399 | *ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets; | 462 | *ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets; |
400 | 463 | ||
401 | led_feedback(client); | 464 | led_feedback(client); |
402 | 465 | ||
403 | return 0; | 466 | return rc; |
404 | } | 467 | } |
405 | 468 | ||
406 | static int smsdvb_get_tune_settings(struct dvb_frontend *fe, | 469 | static int smsdvb_get_tune_settings(struct dvb_frontend *fe, |