22 #include <linux/module.h>
23 #include <linux/slab.h>
58 static struct mutex g_smsdvb_clientslock;
112 sms_err(
"Unknown dvb3 api event");
167 pReceptionData->
SNR = p->
SNR;
168 pReceptionData->
BER = p->
BER;
198 for (i = 0; i < 3; i++) {
216 pReceptionData->
SNR = p->
SNR;
220 pReceptionData->
BER = 0;
222 for (i = 0; i < 3; i++) {
234 u32 *pMsgData = (
u32 *) phdr + 1;
236 bool is_status_update =
false;
252 sms_info(
"MSG_SMS_SIGNAL_DETECTED_IND");
253 client->
sms_stat_dvb.TransmissionData.IsDemodLocked =
true;
254 is_status_update =
true;
259 client->
sms_stat_dvb.TransmissionData.IsDemodLocked =
false;
260 is_status_update =
true;
264 sms_info(
"MSG_SMS_TRANSMISSION_IND");
276 is_status_update =
true;
286 SignalStatusData.
result = pMsgData[0];
287 SignalStatusData.snr = pMsgData[1];
288 SignalStatusData.inBandPower = (
s32) pMsgData[2];
289 SignalStatusData.tsPackets = pMsgData[3];
290 SignalStatusData.etsPackets = pMsgData[4];
291 SignalStatusData.constellation = pMsgData[5];
292 SignalStatusData.hpCode = pMsgData[6];
293 SignalStatusData.tpsSrvIndLP = pMsgData[7] & 0x03;
294 SignalStatusData.tpsSrvIndHP = pMsgData[8] & 0x03;
295 SignalStatusData.cellId = pMsgData[9] & 0xFFFF;
296 SignalStatusData.reason = pMsgData[10];
297 SignalStatusData.requestId = pMsgData[11];
301 pReceptionData->
SNR = pMsgData[1];
302 pReceptionData->
BER = pMsgData[13];
303 pReceptionData->
RSSI = pMsgData[14];
312 if ((SignalStatusData.tsPackets + SignalStatusData.etsPackets)
314 pReceptionData->
TS_PER = (SignalStatusData.etsPackets
315 * 100) / (SignalStatusData.tsPackets
316 + SignalStatusData.etsPackets);
318 pReceptionData->
TS_PER = 0;
324 pReceptionData->
MRC_SNR = pMsgData[20];
326 pReceptionData->
MRC_RSSI = pMsgData[22];
328 is_status_update =
true;
335 } *p = (
void *) (phdr + 1);
339 sms_info(
"MSG_SMS_GET_STATISTICS_RES");
341 is_status_update =
true;
346 smsdvb_update_isdbt_stats(pReceptionData, &p->isdbt);
349 smsdvb_update_dvb_stats(pReceptionData, &p->dvb.Stat);
352 pReceptionData->
SNR = 0;
353 pReceptionData->
BER = 0;
368 if (is_status_update) {
377 sms_board_dvb3_event(client,
406 static void smsdvb_onremove(
void *context)
425 PidMsg.xMsgHeader.msgDstId =
HIF_TASK;
426 PidMsg.xMsgHeader.msgFlags = 0;
428 PidMsg.xMsgHeader.msgLength =
sizeof(PidMsg);
429 PidMsg.msgData[0] = feed->
pid;
433 &PidMsg,
sizeof(PidMsg));
446 PidMsg.xMsgHeader.msgDstId =
HIF_TASK;
447 PidMsg.xMsgHeader.msgFlags = 0;
449 PidMsg.xMsgHeader.msgLength =
sizeof(PidMsg);
450 PidMsg.msgData[0] = feed->
pid;
454 &PidMsg,
sizeof(PidMsg));
473 static int smsdvb_send_statistics_request(
struct smsdvb_client_t *client)
481 rc = smsdvb_sendrequest_and_wait(client, &Msg,
sizeof(Msg),
503 rc = smsdvb_send_statistics_request(client);
507 led_feedback(client);
518 rc = smsdvb_send_statistics_request(client);
522 led_feedback(client);
527 static int smsdvb_read_signal_strength(
struct dvb_frontend *fe,
u16 *strength)
534 rc = smsdvb_send_statistics_request(client);
538 else if (client->
sms_stat_dvb.ReceptionData.InBandPwr > -29)
545 led_feedback(client);
556 rc = smsdvb_send_statistics_request(client);
560 led_feedback(client);
565 static int smsdvb_read_ucblocks(
struct dvb_frontend *fe,
u32 *ucblocks)
571 rc = smsdvb_send_statistics_request(client);
573 *ucblocks = client->
sms_stat_dvb.ReceptionData.ErrorTSPackets;
575 led_feedback(client);
580 static int smsdvb_get_tune_settings(
struct dvb_frontend *fe,
591 static int smsdvb_dvbt_set_frontend(
struct dvb_frontend *fe)
615 Msg.Data[2] = 12000000;
641 ret = smsdvb_sendrequest_and_wait(client, &Msg,
sizeof(Msg),
644 smsdvb_read_status(fe, &status);
653 return smsdvb_sendrequest_and_wait(client, &Msg,
sizeof(Msg),
657 static int smsdvb_isdbt_set_frontend(
struct dvb_frontend *fe)
710 Msg.Data[2] = 12000000;
713 sms_info(
"%s: freq %d segwidth %d segindex %d\n", __func__,
717 return smsdvb_sendrequest_and_wait(client, &Msg,
sizeof(Msg),
730 return smsdvb_dvbt_set_frontend(fe);
733 return smsdvb_isdbt_set_frontend(fe);
897 .name =
"Siano Mobile Digital MDTV Receiver",
898 .frequency_min = 44250000,
899 .frequency_max = 867250000,
900 .frequency_stepsize = 250000,
911 .release = smsdvb_release,
913 .set_frontend = smsdvb_set_frontend,
914 .get_frontend = smsdvb_get_frontend,
915 .get_tune_settings = smsdvb_get_tune_settings,
917 .read_status = smsdvb_read_status,
918 .read_ber = smsdvb_read_ber,
919 .read_signal_strength = smsdvb_read_signal_strength,
920 .read_snr = smsdvb_read_snr,
921 .read_ucblocks = smsdvb_read_ucblocks,
924 .sleep = smsdvb_sleep,
949 sms_err(
"dvb_register_adapter() failed %d", rc);
955 client->
demux.filternum = 32;
956 client->
demux.feednum = 32;
957 client->
demux.start_feed = smsdvb_start_feed;
958 client->
demux.stop_feed = smsdvb_stop_feed;
962 sms_err(
"dvb_dmx_init failed %d", rc);
967 client->
dmxdev.filternum = 32;
969 client->
dmxdev.capabilities = 0;
973 sms_err(
"dvb_dmxdev_init failed %d", rc);
994 sms_err(
"frontend registration failed %d", rc);
1000 params.onresponse_handler = smsdvb_onresponse;
1001 params.onremove_handler = smsdvb_onremove;
1006 sms_err(
"smscore_register_client() failed %d", rc);
1016 list_add(&client->
entry, &g_smsdvb_clients);
1046 static int __init smsdvb_module_init(
void)
1050 INIT_LIST_HEAD(&g_smsdvb_clients);
1060 static void __exit smsdvb_module_exit(
void)
1066 while (!list_empty(&g_smsdvb_clients))
1067 smsdvb_unregister_client(