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()
212 static void smsdvb_update_tx_params(struct smsdvb_client_t *client, in smsdvb_update_tx_params() argument
215 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_tx_params()
219 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_tx_params()
229 static void smsdvb_update_per_slices(struct smsdvb_client_t *client, in smsdvb_update_per_slices() argument
232 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_per_slices()
236 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_per_slices()
250 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_per_slices()
266 client->legacy_per = tmp; in smsdvb_update_per_slices()
269 static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client, in smsdvb_update_dvb_stats() argument
272 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_dvb_stats()
275 if (client->prt_dvb_stats) in smsdvb_update_dvb_stats()
276 client->prt_dvb_stats(client->debug_data, p); in smsdvb_update_dvb_stats()
278 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_dvb_stats()
282 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_dvb_stats()
305 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_dvb_stats()
318 client->legacy_ber = p->ber; in smsdvb_update_dvb_stats()
321 static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client, in smsdvb_update_isdbt_stats() argument
324 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_isdbt_stats()
329 if (client->prt_isdb_stats) in smsdvb_update_isdbt_stats()
330 client->prt_isdb_stats(client->debug_data, p); in smsdvb_update_isdbt_stats()
332 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_isdbt_stats()
371 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_isdbt_stats()
417 static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client, in smsdvb_update_isdbt_stats_ex() argument
420 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_isdbt_stats_ex()
425 if (client->prt_isdb_stats_ex) in smsdvb_update_isdbt_stats_ex()
426 client->prt_isdb_stats_ex(client->debug_data, p); in smsdvb_update_isdbt_stats_ex()
430 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_isdbt_stats_ex()
455 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_isdbt_stats_ex()
507 struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; in smsdvb_onresponse() local
511 struct dvb_frontend *fe = &client->frontend; in smsdvb_onresponse()
521 if (client->feed_users && client->has_tuned) in smsdvb_onresponse()
522 dvb_dmx_swfilter(&client->demux, p, in smsdvb_onresponse()
528 complete(&client->tune_done); in smsdvb_onresponse()
532 client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | in smsdvb_onresponse()
540 client->fe_status = 0; in smsdvb_onresponse()
546 smsdvb_update_tx_params(client, p); in smsdvb_onresponse()
552 smsdvb_update_per_slices(client, p); in smsdvb_onresponse()
558 switch (smscore_get_device_mode(client->coredev)) { in smsdvb_onresponse()
561 smsdvb_update_isdbt_stats(client, p); in smsdvb_onresponse()
565 smsdvb_update_dvb_stats(client, p + sizeof(u32)); in smsdvb_onresponse()
574 smsdvb_update_isdbt_stats_ex(client, p + sizeof(u32)); in smsdvb_onresponse()
580 smscore_putbuffer(client->coredev, cb); in smsdvb_onresponse()
583 if (client->fe_status & FE_HAS_LOCK) { in smsdvb_onresponse()
584 sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK); in smsdvb_onresponse()
585 if (client->last_per == c->block_error.stat[0].uvalue) in smsdvb_onresponse()
586 sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK); in smsdvb_onresponse()
588 sms_board_dvb3_event(client, DVB3_EVENT_UNC_ERR); in smsdvb_onresponse()
589 client->has_tuned = true; in smsdvb_onresponse()
592 client->has_tuned = false; in smsdvb_onresponse()
593 sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK); in smsdvb_onresponse()
595 complete(&client->stats_done); in smsdvb_onresponse()
601 static void smsdvb_media_device_unregister(struct smsdvb_client_t *client) in smsdvb_media_device_unregister() argument
604 struct smscore_device_t *coredev = client->coredev; in smsdvb_media_device_unregister()
615 static void smsdvb_unregister_client(struct smsdvb_client_t *client) in smsdvb_unregister_client() argument
619 list_del(&client->entry); in smsdvb_unregister_client()
621 smsdvb_debugfs_release(client); in smsdvb_unregister_client()
622 smscore_unregister_client(client->smsclient); in smsdvb_unregister_client()
623 dvb_unregister_frontend(&client->frontend); in smsdvb_unregister_client()
624 dvb_dmxdev_release(&client->dmxdev); in smsdvb_unregister_client()
625 dvb_dmx_release(&client->demux); in smsdvb_unregister_client()
626 smsdvb_media_device_unregister(client); in smsdvb_unregister_client()
627 dvb_unregister_adapter(&client->adapter); in smsdvb_unregister_client()
628 kfree(client); in smsdvb_unregister_client()
642 struct smsdvb_client_t *client = in smsdvb_start_feed() local
649 client->feed_users++; in smsdvb_start_feed()
658 return smsclient_sendrequest(client->smsclient, in smsdvb_start_feed()
664 struct smsdvb_client_t *client = in smsdvb_stop_feed() local
671 client->feed_users--; in smsdvb_stop_feed()
680 return smsclient_sendrequest(client->smsclient, in smsdvb_stop_feed()
684 static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, in smsdvb_sendrequest_and_wait() argument
690 rc = smsclient_sendrequest(client->smsclient, buffer, size); in smsdvb_sendrequest_and_wait()
699 static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) in smsdvb_send_statistics_request() argument
705 if (client->get_stats_jiffies && in smsdvb_send_statistics_request()
706 (!time_after(jiffies, client->get_stats_jiffies))) in smsdvb_send_statistics_request()
708 client->get_stats_jiffies = jiffies + msecs_to_jiffies(100); in smsdvb_send_statistics_request()
715 switch (smscore_get_device_mode(client->coredev)) { in smsdvb_send_statistics_request()
721 if (client->coredev->fw_version >= 0x800) in smsdvb_send_statistics_request()
730 rc = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_send_statistics_request()
731 &client->stats_done); in smsdvb_send_statistics_request()
736 static inline int led_feedback(struct smsdvb_client_t *client) in led_feedback() argument
738 if (!(client->fe_status & FE_HAS_LOCK)) in led_feedback()
739 return sms_board_led_feedback(client->coredev, SMS_LED_OFF); in led_feedback()
741 return sms_board_led_feedback(client->coredev, in led_feedback()
742 (client->legacy_ber == 0) ? in led_feedback()
749 struct smsdvb_client_t *client; in smsdvb_read_status() local
750 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_status()
752 rc = smsdvb_send_statistics_request(client); in smsdvb_read_status()
754 *stat = client->fe_status; in smsdvb_read_status()
756 led_feedback(client); in smsdvb_read_status()
764 struct smsdvb_client_t *client; in smsdvb_read_ber() local
766 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_ber()
768 rc = smsdvb_send_statistics_request(client); in smsdvb_read_ber()
770 *ber = client->legacy_ber; in smsdvb_read_ber()
772 led_feedback(client); in smsdvb_read_ber()
782 struct smsdvb_client_t *client; in smsdvb_read_signal_strength() local
784 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_signal_strength()
786 rc = smsdvb_send_statistics_request(client); in smsdvb_read_signal_strength()
795 led_feedback(client); in smsdvb_read_signal_strength()
804 struct smsdvb_client_t *client; in smsdvb_read_snr() local
806 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_snr()
808 rc = smsdvb_send_statistics_request(client); in smsdvb_read_snr()
813 led_feedback(client); in smsdvb_read_snr()
822 struct smsdvb_client_t *client; in smsdvb_read_ucblocks() local
824 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_ucblocks()
826 rc = smsdvb_send_statistics_request(client); in smsdvb_read_ucblocks()
830 led_feedback(client); in smsdvb_read_ucblocks()
849 struct smsdvb_client_t *client = in smsdvb_dvbt_set_frontend() local
859 client->fe_status = 0; in smsdvb_dvbt_set_frontend()
860 client->event_fe_state = -1; in smsdvb_dvbt_set_frontend()
861 client->event_unc_state = -1; in smsdvb_dvbt_set_frontend()
891 ret = sms_board_lna_control(client->coredev, 0); in smsdvb_dvbt_set_frontend()
896 ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_dvbt_set_frontend()
897 &client->tune_done); in smsdvb_dvbt_set_frontend()
905 sms_board_lna_control(client->coredev, 1); in smsdvb_dvbt_set_frontend()
908 return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_dvbt_set_frontend()
909 &client->tune_done); in smsdvb_dvbt_set_frontend()
915 struct smsdvb_client_t *client = in smsdvb_isdbt_set_frontend() local
917 int board_id = smscore_get_board_id(client->coredev); in smsdvb_isdbt_set_frontend()
962 ret = sms_board_lna_control(client->coredev, 0); in smsdvb_isdbt_set_frontend()
967 ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_isdbt_set_frontend()
968 &client->tune_done); in smsdvb_isdbt_set_frontend()
976 sms_board_lna_control(client->coredev, 1); in smsdvb_isdbt_set_frontend()
978 return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_isdbt_set_frontend()
979 &client->tune_done); in smsdvb_isdbt_set_frontend()
985 struct smsdvb_client_t *client = in smsdvb_set_frontend() local
987 struct smscore_device_t *coredev = client->coredev; in smsdvb_set_frontend()
993 client->has_tuned = false; in smsdvb_set_frontend()
1009 struct smsdvb_client_t *client = in smsdvb_init() local
1012 sms_board_power(client->coredev, 1); in smsdvb_init()
1014 sms_board_dvb3_event(client, DVB3_EVENT_INIT); in smsdvb_init()
1020 struct smsdvb_client_t *client = in smsdvb_sleep() local
1023 sms_board_led_feedback(client->coredev, SMS_LED_OFF); in smsdvb_sleep()
1024 sms_board_power(client->coredev, 0); in smsdvb_sleep()
1026 sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); in smsdvb_sleep()
1071 struct smsdvb_client_t *client; in smsdvb_hotplug() local
1077 client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); in smsdvb_hotplug()
1078 if (!client) in smsdvb_hotplug()
1082 rc = dvb_register_adapter(&client->adapter, in smsdvb_hotplug()
1090 dvb_register_media_controller(&client->adapter, coredev->media_dev); in smsdvb_hotplug()
1093 client->demux.dmx.capabilities = DMX_TS_FILTERING; in smsdvb_hotplug()
1094 client->demux.filternum = 32; /* todo: nova ??? */ in smsdvb_hotplug()
1095 client->demux.feednum = 32; in smsdvb_hotplug()
1096 client->demux.start_feed = smsdvb_start_feed; in smsdvb_hotplug()
1097 client->demux.stop_feed = smsdvb_stop_feed; in smsdvb_hotplug()
1099 rc = dvb_dmx_init(&client->demux); in smsdvb_hotplug()
1106 client->dmxdev.filternum = 32; in smsdvb_hotplug()
1107 client->dmxdev.demux = &client->demux.dmx; in smsdvb_hotplug()
1108 client->dmxdev.capabilities = 0; in smsdvb_hotplug()
1110 rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); in smsdvb_hotplug()
1117 memcpy(&client->frontend.ops, &smsdvb_fe_ops, in smsdvb_hotplug()
1123 client->frontend.ops.delsys[0] = SYS_DVBT; in smsdvb_hotplug()
1127 client->frontend.ops.delsys[0] = SYS_ISDBT; in smsdvb_hotplug()
1131 rc = dvb_register_frontend(&client->adapter, &client->frontend); in smsdvb_hotplug()
1141 params.context = client; in smsdvb_hotplug()
1143 rc = smscore_register_client(coredev, &params, &client->smsclient); in smsdvb_hotplug()
1149 client->coredev = coredev; in smsdvb_hotplug()
1151 init_completion(&client->tune_done); in smsdvb_hotplug()
1152 init_completion(&client->stats_done); in smsdvb_hotplug()
1156 list_add(&client->entry, &g_smsdvb_clients); in smsdvb_hotplug()
1160 client->event_fe_state = -1; in smsdvb_hotplug()
1161 client->event_unc_state = -1; in smsdvb_hotplug()
1162 sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG); in smsdvb_hotplug()
1166 if (smsdvb_debugfs_create(client) < 0) in smsdvb_hotplug()
1169 rc = dvb_create_media_graph(&client->adapter, true); in smsdvb_hotplug()
1179 dvb_unregister_frontend(&client->frontend); in smsdvb_hotplug()
1182 dvb_dmxdev_release(&client->dmxdev); in smsdvb_hotplug()
1185 dvb_dmx_release(&client->demux); in smsdvb_hotplug()
1188 smsdvb_media_device_unregister(client); in smsdvb_hotplug()
1189 dvb_unregister_adapter(&client->adapter); in smsdvb_hotplug()
1192 kfree(client); in smsdvb_hotplug()