Lines Matching full:client

64 static void sms_board_dvb3_event(struct smsdvb_client_t *client,  in sms_board_dvb3_event()  argument
67 struct smscore_device_t *coredev = client->coredev; in sms_board_dvb3_event()
82 if (client->event_fe_state != DVB3_EVENT_FE_LOCK) { in sms_board_dvb3_event()
83 client->event_fe_state = DVB3_EVENT_FE_LOCK; in sms_board_dvb3_event()
89 if (client->event_fe_state != DVB3_EVENT_FE_UNLOCK) { in sms_board_dvb3_event()
90 client->event_fe_state = DVB3_EVENT_FE_UNLOCK; in sms_board_dvb3_event()
96 if (client->event_unc_state != DVB3_EVENT_UNC_OK) { in sms_board_dvb3_event()
97 client->event_unc_state = DVB3_EVENT_UNC_OK; in sms_board_dvb3_event()
103 if (client->event_unc_state != DVB3_EVENT_UNC_ERR) { in sms_board_dvb3_event()
104 client->event_unc_state = DVB3_EVENT_UNC_ERR; in sms_board_dvb3_event()
118 struct smsdvb_client_t *client = in smsdvb_stats_not_ready() local
120 struct smscore_device_t *coredev = client->coredev; in smsdvb_stats_not_ready()
240 static void smsdvb_update_tx_params(struct smsdvb_client_t *client, in smsdvb_update_tx_params() argument
243 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_tx_params()
247 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_tx_params()
257 static void smsdvb_update_per_slices(struct smsdvb_client_t *client, in smsdvb_update_per_slices() argument
260 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_per_slices()
264 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_per_slices()
278 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_per_slices()
294 client->legacy_per = tmp; in smsdvb_update_per_slices()
297 static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client, in smsdvb_update_dvb_stats() argument
300 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_dvb_stats()
303 if (client->prt_dvb_stats) in smsdvb_update_dvb_stats()
304 client->prt_dvb_stats(client->debug_data, p); in smsdvb_update_dvb_stats()
306 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_dvb_stats()
310 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_dvb_stats()
333 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_dvb_stats()
346 client->legacy_ber = p->ber; in smsdvb_update_dvb_stats()
349 static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client, in smsdvb_update_isdbt_stats() argument
352 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_isdbt_stats()
357 if (client->prt_isdb_stats) in smsdvb_update_isdbt_stats()
358 client->prt_isdb_stats(client->debug_data, p); in smsdvb_update_isdbt_stats()
360 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_isdbt_stats()
399 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_isdbt_stats()
449 static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client, in smsdvb_update_isdbt_stats_ex() argument
452 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_isdbt_stats_ex()
457 if (client->prt_isdb_stats_ex) in smsdvb_update_isdbt_stats_ex()
458 client->prt_isdb_stats_ex(client->debug_data, p); in smsdvb_update_isdbt_stats_ex()
462 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_isdbt_stats_ex()
487 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_isdbt_stats_ex()
543 struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; in smsdvb_onresponse() local
547 struct dvb_frontend *fe = &client->frontend; in smsdvb_onresponse()
557 if (client->feed_users && client->has_tuned) in smsdvb_onresponse()
558 dvb_dmx_swfilter(&client->demux, p, in smsdvb_onresponse()
564 complete(&client->tune_done); in smsdvb_onresponse()
568 client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | in smsdvb_onresponse()
576 client->fe_status = 0; in smsdvb_onresponse()
582 smsdvb_update_tx_params(client, p); in smsdvb_onresponse()
588 smsdvb_update_per_slices(client, p); in smsdvb_onresponse()
594 switch (smscore_get_device_mode(client->coredev)) { in smsdvb_onresponse()
597 smsdvb_update_isdbt_stats(client, p); in smsdvb_onresponse()
601 smsdvb_update_dvb_stats(client, p + sizeof(u32)); in smsdvb_onresponse()
610 smsdvb_update_isdbt_stats_ex(client, p + sizeof(u32)); in smsdvb_onresponse()
616 smscore_putbuffer(client->coredev, cb); in smsdvb_onresponse()
619 if (client->fe_status & FE_HAS_LOCK) { in smsdvb_onresponse()
620 sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK); in smsdvb_onresponse()
621 if (client->last_per == c->block_error.stat[0].uvalue) in smsdvb_onresponse()
622 sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK); in smsdvb_onresponse()
624 sms_board_dvb3_event(client, DVB3_EVENT_UNC_ERR); in smsdvb_onresponse()
625 client->has_tuned = true; in smsdvb_onresponse()
628 client->has_tuned = false; in smsdvb_onresponse()
629 sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK); in smsdvb_onresponse()
631 complete(&client->stats_done); in smsdvb_onresponse()
637 static void smsdvb_media_device_unregister(struct smsdvb_client_t *client) in smsdvb_media_device_unregister() argument
640 struct smscore_device_t *coredev = client->coredev; in smsdvb_media_device_unregister()
651 static void smsdvb_unregister_client(struct smsdvb_client_t *client) in smsdvb_unregister_client() argument
655 list_del(&client->entry); in smsdvb_unregister_client()
657 smsdvb_debugfs_release(client); in smsdvb_unregister_client()
658 smscore_unregister_client(client->smsclient); in smsdvb_unregister_client()
659 dvb_unregister_frontend(&client->frontend); in smsdvb_unregister_client()
660 dvb_dmxdev_release(&client->dmxdev); in smsdvb_unregister_client()
661 dvb_dmx_release(&client->demux); in smsdvb_unregister_client()
662 smsdvb_media_device_unregister(client); in smsdvb_unregister_client()
663 dvb_unregister_adapter(&client->adapter); in smsdvb_unregister_client()
664 kfree(client); in smsdvb_unregister_client()
678 struct smsdvb_client_t *client = in smsdvb_start_feed() local
685 client->feed_users++; in smsdvb_start_feed()
694 return smsclient_sendrequest(client->smsclient, in smsdvb_start_feed()
700 struct smsdvb_client_t *client = in smsdvb_stop_feed() local
707 client->feed_users--; in smsdvb_stop_feed()
716 return smsclient_sendrequest(client->smsclient, in smsdvb_stop_feed()
720 static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, in smsdvb_sendrequest_and_wait() argument
726 rc = smsclient_sendrequest(client->smsclient, buffer, size); in smsdvb_sendrequest_and_wait()
735 static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) in smsdvb_send_statistics_request() argument
741 if (client->get_stats_jiffies && in smsdvb_send_statistics_request()
742 (!time_after(jiffies, client->get_stats_jiffies))) in smsdvb_send_statistics_request()
744 client->get_stats_jiffies = jiffies + msecs_to_jiffies(100); in smsdvb_send_statistics_request()
751 switch (smscore_get_device_mode(client->coredev)) { in smsdvb_send_statistics_request()
757 if (client->coredev->fw_version >= 0x800) in smsdvb_send_statistics_request()
766 rc = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_send_statistics_request()
767 &client->stats_done); in smsdvb_send_statistics_request()
772 static inline int led_feedback(struct smsdvb_client_t *client) in led_feedback() argument
774 if (!(client->fe_status & FE_HAS_LOCK)) in led_feedback()
775 return sms_board_led_feedback(client->coredev, SMS_LED_OFF); in led_feedback()
777 return sms_board_led_feedback(client->coredev, in led_feedback()
778 (client->legacy_ber == 0) ? in led_feedback()
785 struct smsdvb_client_t *client; in smsdvb_read_status() local
786 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_status()
788 rc = smsdvb_send_statistics_request(client); in smsdvb_read_status()
790 *stat = client->fe_status; in smsdvb_read_status()
792 led_feedback(client); in smsdvb_read_status()
800 struct smsdvb_client_t *client; in smsdvb_read_ber() local
802 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_ber()
804 rc = smsdvb_send_statistics_request(client); in smsdvb_read_ber()
806 *ber = client->legacy_ber; in smsdvb_read_ber()
808 led_feedback(client); in smsdvb_read_ber()
818 struct smsdvb_client_t *client; in smsdvb_read_signal_strength() local
820 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_signal_strength()
822 rc = smsdvb_send_statistics_request(client); in smsdvb_read_signal_strength()
831 led_feedback(client); in smsdvb_read_signal_strength()
840 struct smsdvb_client_t *client; in smsdvb_read_snr() local
842 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_snr()
844 rc = smsdvb_send_statistics_request(client); in smsdvb_read_snr()
849 led_feedback(client); in smsdvb_read_snr()
858 struct smsdvb_client_t *client; in smsdvb_read_ucblocks() local
860 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_ucblocks()
862 rc = smsdvb_send_statistics_request(client); in smsdvb_read_ucblocks()
866 led_feedback(client); in smsdvb_read_ucblocks()
885 struct smsdvb_client_t *client = in smsdvb_dvbt_set_frontend() local
895 client->fe_status = 0; in smsdvb_dvbt_set_frontend()
896 client->event_fe_state = -1; in smsdvb_dvbt_set_frontend()
897 client->event_unc_state = -1; in smsdvb_dvbt_set_frontend()
927 ret = sms_board_lna_control(client->coredev, 0); in smsdvb_dvbt_set_frontend()
932 ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_dvbt_set_frontend()
933 &client->tune_done); in smsdvb_dvbt_set_frontend()
941 sms_board_lna_control(client->coredev, 1); in smsdvb_dvbt_set_frontend()
944 return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_dvbt_set_frontend()
945 &client->tune_done); in smsdvb_dvbt_set_frontend()
951 struct smsdvb_client_t *client = in smsdvb_isdbt_set_frontend() local
953 int board_id = smscore_get_board_id(client->coredev); in smsdvb_isdbt_set_frontend()
998 ret = sms_board_lna_control(client->coredev, 0); in smsdvb_isdbt_set_frontend()
1003 ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_isdbt_set_frontend()
1004 &client->tune_done); in smsdvb_isdbt_set_frontend()
1012 sms_board_lna_control(client->coredev, 1); in smsdvb_isdbt_set_frontend()
1014 return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_isdbt_set_frontend()
1015 &client->tune_done); in smsdvb_isdbt_set_frontend()
1021 struct smsdvb_client_t *client = in smsdvb_set_frontend() local
1023 struct smscore_device_t *coredev = client->coredev; in smsdvb_set_frontend()
1029 client->has_tuned = false; in smsdvb_set_frontend()
1045 struct smsdvb_client_t *client = in smsdvb_init() local
1048 sms_board_power(client->coredev, 1); in smsdvb_init()
1050 sms_board_dvb3_event(client, DVB3_EVENT_INIT); in smsdvb_init()
1056 struct smsdvb_client_t *client = in smsdvb_sleep() local
1059 sms_board_led_feedback(client->coredev, SMS_LED_OFF); in smsdvb_sleep()
1060 sms_board_power(client->coredev, 0); in smsdvb_sleep()
1062 sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); in smsdvb_sleep()
1107 struct smsdvb_client_t *client; in smsdvb_hotplug() local
1113 client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); in smsdvb_hotplug()
1114 if (!client) in smsdvb_hotplug()
1118 rc = dvb_register_adapter(&client->adapter, in smsdvb_hotplug()
1126 dvb_register_media_controller(&client->adapter, coredev->media_dev); in smsdvb_hotplug()
1129 client->demux.dmx.capabilities = DMX_TS_FILTERING; in smsdvb_hotplug()
1130 client->demux.filternum = 32; /* todo: nova ??? */ in smsdvb_hotplug()
1131 client->demux.feednum = 32; in smsdvb_hotplug()
1132 client->demux.start_feed = smsdvb_start_feed; in smsdvb_hotplug()
1133 client->demux.stop_feed = smsdvb_stop_feed; in smsdvb_hotplug()
1135 rc = dvb_dmx_init(&client->demux); in smsdvb_hotplug()
1142 client->dmxdev.filternum = 32; in smsdvb_hotplug()
1143 client->dmxdev.demux = &client->demux.dmx; in smsdvb_hotplug()
1144 client->dmxdev.capabilities = 0; in smsdvb_hotplug()
1146 rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); in smsdvb_hotplug()
1153 memcpy(&client->frontend.ops, &smsdvb_fe_ops, in smsdvb_hotplug()
1159 client->frontend.ops.delsys[0] = SYS_DVBT; in smsdvb_hotplug()
1163 client->frontend.ops.delsys[0] = SYS_ISDBT; in smsdvb_hotplug()
1167 rc = dvb_register_frontend(&client->adapter, &client->frontend); in smsdvb_hotplug()
1177 params.context = client; in smsdvb_hotplug()
1179 rc = smscore_register_client(coredev, &params, &client->smsclient); in smsdvb_hotplug()
1185 client->coredev = coredev; in smsdvb_hotplug()
1187 init_completion(&client->tune_done); in smsdvb_hotplug()
1188 init_completion(&client->stats_done); in smsdvb_hotplug()
1192 list_add(&client->entry, &g_smsdvb_clients); in smsdvb_hotplug()
1196 client->event_fe_state = -1; in smsdvb_hotplug()
1197 client->event_unc_state = -1; in smsdvb_hotplug()
1198 sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG); in smsdvb_hotplug()
1202 if (smsdvb_debugfs_create(client) < 0) in smsdvb_hotplug()
1205 rc = dvb_create_media_graph(&client->adapter, true); in smsdvb_hotplug()
1216 list_del(&client->entry); in smsdvb_hotplug()
1219 smsdvb_debugfs_release(client); in smsdvb_hotplug()
1222 dvb_unregister_frontend(&client->frontend); in smsdvb_hotplug()
1225 dvb_dmxdev_release(&client->dmxdev); in smsdvb_hotplug()
1228 dvb_dmx_release(&client->demux); in smsdvb_hotplug()
1231 smsdvb_media_device_unregister(client); in smsdvb_hotplug()
1232 dvb_unregister_adapter(&client->adapter); in smsdvb_hotplug()
1235 kfree(client); in smsdvb_hotplug()