Lines Matching refs:client

75 static void sms_board_dvb3_event(struct smsdvb_client_t *client,  in sms_board_dvb3_event()  argument
78 struct smscore_device_t *coredev = client->coredev; in sms_board_dvb3_event()
93 if (client->event_fe_state != DVB3_EVENT_FE_LOCK) { in sms_board_dvb3_event()
94 client->event_fe_state = DVB3_EVENT_FE_LOCK; in sms_board_dvb3_event()
100 if (client->event_fe_state != DVB3_EVENT_FE_UNLOCK) { in sms_board_dvb3_event()
101 client->event_fe_state = DVB3_EVENT_FE_UNLOCK; in sms_board_dvb3_event()
107 if (client->event_unc_state != DVB3_EVENT_UNC_OK) { in sms_board_dvb3_event()
108 client->event_unc_state = DVB3_EVENT_UNC_OK; in sms_board_dvb3_event()
114 if (client->event_unc_state != DVB3_EVENT_UNC_ERR) { in sms_board_dvb3_event()
115 client->event_unc_state = DVB3_EVENT_UNC_ERR; in sms_board_dvb3_event()
129 struct smsdvb_client_t *client = in smsdvb_stats_not_ready() local
131 struct smscore_device_t *coredev = client->coredev; in smsdvb_stats_not_ready()
223 static void smsdvb_update_tx_params(struct smsdvb_client_t *client, in smsdvb_update_tx_params() argument
226 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_tx_params()
230 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_tx_params()
240 static void smsdvb_update_per_slices(struct smsdvb_client_t *client, in smsdvb_update_per_slices() argument
243 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_per_slices()
247 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_per_slices()
261 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_per_slices()
277 client->legacy_per = tmp; in smsdvb_update_per_slices()
280 static void smsdvb_update_dvb_stats(struct smsdvb_client_t *client, in smsdvb_update_dvb_stats() argument
283 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_dvb_stats()
286 if (client->prt_dvb_stats) in smsdvb_update_dvb_stats()
287 client->prt_dvb_stats(client->debug_data, p); in smsdvb_update_dvb_stats()
289 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_dvb_stats()
293 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_dvb_stats()
316 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_dvb_stats()
329 client->legacy_ber = p->ber; in smsdvb_update_dvb_stats()
332 static void smsdvb_update_isdbt_stats(struct smsdvb_client_t *client, in smsdvb_update_isdbt_stats() argument
335 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_isdbt_stats()
340 if (client->prt_isdb_stats) in smsdvb_update_isdbt_stats()
341 client->prt_isdb_stats(client->debug_data, p); in smsdvb_update_isdbt_stats()
343 client->fe_status = sms_to_status(p->is_demod_locked, p->is_rf_locked); in smsdvb_update_isdbt_stats()
382 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_isdbt_stats()
428 static void smsdvb_update_isdbt_stats_ex(struct smsdvb_client_t *client, in smsdvb_update_isdbt_stats_ex() argument
431 struct dvb_frontend *fe = &client->frontend; in smsdvb_update_isdbt_stats_ex()
436 if (client->prt_isdb_stats_ex) in smsdvb_update_isdbt_stats_ex()
437 client->prt_isdb_stats_ex(client->debug_data, p); in smsdvb_update_isdbt_stats_ex()
441 client->fe_status = sms_to_status(p->is_demod_locked, 0); in smsdvb_update_isdbt_stats_ex()
466 client->last_per = c->block_error.stat[0].uvalue; in smsdvb_update_isdbt_stats_ex()
518 struct smsdvb_client_t *client = (struct smsdvb_client_t *) context; in smsdvb_onresponse() local
522 struct dvb_frontend *fe = &client->frontend; in smsdvb_onresponse()
532 if (client->feed_users && client->has_tuned) in smsdvb_onresponse()
533 dvb_dmx_swfilter(&client->demux, p, in smsdvb_onresponse()
539 complete(&client->tune_done); in smsdvb_onresponse()
543 client->fe_status = FE_HAS_SIGNAL | FE_HAS_CARRIER | in smsdvb_onresponse()
551 client->fe_status = 0; in smsdvb_onresponse()
557 smsdvb_update_tx_params(client, p); in smsdvb_onresponse()
563 smsdvb_update_per_slices(client, p); in smsdvb_onresponse()
569 switch (smscore_get_device_mode(client->coredev)) { in smsdvb_onresponse()
572 smsdvb_update_isdbt_stats(client, p); in smsdvb_onresponse()
576 smsdvb_update_dvb_stats(client, p + sizeof(u32)); in smsdvb_onresponse()
585 smsdvb_update_isdbt_stats_ex(client, p + sizeof(u32)); in smsdvb_onresponse()
591 smscore_putbuffer(client->coredev, cb); in smsdvb_onresponse()
594 if (client->fe_status & FE_HAS_LOCK) { in smsdvb_onresponse()
595 sms_board_dvb3_event(client, DVB3_EVENT_FE_LOCK); in smsdvb_onresponse()
596 if (client->last_per == c->block_error.stat[0].uvalue) in smsdvb_onresponse()
597 sms_board_dvb3_event(client, DVB3_EVENT_UNC_OK); in smsdvb_onresponse()
599 sms_board_dvb3_event(client, DVB3_EVENT_UNC_ERR); in smsdvb_onresponse()
600 client->has_tuned = true; in smsdvb_onresponse()
603 client->has_tuned = false; in smsdvb_onresponse()
604 sms_board_dvb3_event(client, DVB3_EVENT_FE_UNLOCK); in smsdvb_onresponse()
606 complete(&client->stats_done); in smsdvb_onresponse()
612 static void smsdvb_media_device_unregister(struct smsdvb_client_t *client) in smsdvb_media_device_unregister() argument
615 struct smscore_device_t *coredev = client->coredev; in smsdvb_media_device_unregister()
625 static void smsdvb_unregister_client(struct smsdvb_client_t *client) in smsdvb_unregister_client() argument
629 list_del(&client->entry); in smsdvb_unregister_client()
631 smsdvb_debugfs_release(client); in smsdvb_unregister_client()
632 smscore_unregister_client(client->smsclient); in smsdvb_unregister_client()
633 dvb_unregister_frontend(&client->frontend); in smsdvb_unregister_client()
634 dvb_dmxdev_release(&client->dmxdev); in smsdvb_unregister_client()
635 dvb_dmx_release(&client->demux); in smsdvb_unregister_client()
636 smsdvb_media_device_unregister(client); in smsdvb_unregister_client()
637 dvb_unregister_adapter(&client->adapter); in smsdvb_unregister_client()
638 kfree(client); in smsdvb_unregister_client()
652 struct smsdvb_client_t *client = in smsdvb_start_feed() local
659 client->feed_users++; in smsdvb_start_feed()
668 return smsclient_sendrequest(client->smsclient, in smsdvb_start_feed()
674 struct smsdvb_client_t *client = in smsdvb_stop_feed() local
681 client->feed_users--; in smsdvb_stop_feed()
690 return smsclient_sendrequest(client->smsclient, in smsdvb_stop_feed()
694 static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client, in smsdvb_sendrequest_and_wait() argument
700 rc = smsclient_sendrequest(client->smsclient, buffer, size); in smsdvb_sendrequest_and_wait()
709 static int smsdvb_send_statistics_request(struct smsdvb_client_t *client) in smsdvb_send_statistics_request() argument
715 if (client->get_stats_jiffies && in smsdvb_send_statistics_request()
716 (!time_after(jiffies, client->get_stats_jiffies))) in smsdvb_send_statistics_request()
718 client->get_stats_jiffies = jiffies + msecs_to_jiffies(100); in smsdvb_send_statistics_request()
725 switch (smscore_get_device_mode(client->coredev)) { in smsdvb_send_statistics_request()
731 if (client->coredev->fw_version >= 0x800) in smsdvb_send_statistics_request()
740 rc = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_send_statistics_request()
741 &client->stats_done); in smsdvb_send_statistics_request()
746 static inline int led_feedback(struct smsdvb_client_t *client) in led_feedback() argument
748 if (!(client->fe_status & FE_HAS_LOCK)) in led_feedback()
749 return sms_board_led_feedback(client->coredev, SMS_LED_OFF); in led_feedback()
751 return sms_board_led_feedback(client->coredev, in led_feedback()
752 (client->legacy_ber == 0) ? in led_feedback()
759 struct smsdvb_client_t *client; in smsdvb_read_status() local
760 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_status()
762 rc = smsdvb_send_statistics_request(client); in smsdvb_read_status()
764 *stat = client->fe_status; in smsdvb_read_status()
766 led_feedback(client); in smsdvb_read_status()
774 struct smsdvb_client_t *client; in smsdvb_read_ber() local
776 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_ber()
778 rc = smsdvb_send_statistics_request(client); in smsdvb_read_ber()
780 *ber = client->legacy_ber; in smsdvb_read_ber()
782 led_feedback(client); in smsdvb_read_ber()
792 struct smsdvb_client_t *client; in smsdvb_read_signal_strength() local
794 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_signal_strength()
796 rc = smsdvb_send_statistics_request(client); in smsdvb_read_signal_strength()
805 led_feedback(client); in smsdvb_read_signal_strength()
814 struct smsdvb_client_t *client; in smsdvb_read_snr() local
816 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_snr()
818 rc = smsdvb_send_statistics_request(client); in smsdvb_read_snr()
823 led_feedback(client); in smsdvb_read_snr()
832 struct smsdvb_client_t *client; in smsdvb_read_ucblocks() local
834 client = container_of(fe, struct smsdvb_client_t, frontend); in smsdvb_read_ucblocks()
836 rc = smsdvb_send_statistics_request(client); in smsdvb_read_ucblocks()
840 led_feedback(client); in smsdvb_read_ucblocks()
859 struct smsdvb_client_t *client = in smsdvb_dvbt_set_frontend() local
869 client->fe_status = 0; in smsdvb_dvbt_set_frontend()
870 client->event_fe_state = -1; in smsdvb_dvbt_set_frontend()
871 client->event_unc_state = -1; in smsdvb_dvbt_set_frontend()
901 ret = sms_board_lna_control(client->coredev, 0); in smsdvb_dvbt_set_frontend()
906 ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_dvbt_set_frontend()
907 &client->tune_done); in smsdvb_dvbt_set_frontend()
915 sms_board_lna_control(client->coredev, 1); in smsdvb_dvbt_set_frontend()
918 return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_dvbt_set_frontend()
919 &client->tune_done); in smsdvb_dvbt_set_frontend()
925 struct smsdvb_client_t *client = in smsdvb_isdbt_set_frontend() local
927 int board_id = smscore_get_board_id(client->coredev); in smsdvb_isdbt_set_frontend()
972 ret = sms_board_lna_control(client->coredev, 0); in smsdvb_isdbt_set_frontend()
977 ret = smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_isdbt_set_frontend()
978 &client->tune_done); in smsdvb_isdbt_set_frontend()
986 sms_board_lna_control(client->coredev, 1); in smsdvb_isdbt_set_frontend()
988 return smsdvb_sendrequest_and_wait(client, &msg, sizeof(msg), in smsdvb_isdbt_set_frontend()
989 &client->tune_done); in smsdvb_isdbt_set_frontend()
995 struct smsdvb_client_t *client = in smsdvb_set_frontend() local
997 struct smscore_device_t *coredev = client->coredev; in smsdvb_set_frontend()
1003 client->has_tuned = false; in smsdvb_set_frontend()
1025 struct smsdvb_client_t *client = in smsdvb_init() local
1028 sms_board_power(client->coredev, 1); in smsdvb_init()
1030 sms_board_dvb3_event(client, DVB3_EVENT_INIT); in smsdvb_init()
1036 struct smsdvb_client_t *client = in smsdvb_sleep() local
1039 sms_board_led_feedback(client->coredev, SMS_LED_OFF); in smsdvb_sleep()
1040 sms_board_power(client->coredev, 0); in smsdvb_sleep()
1042 sms_board_dvb3_event(client, DVB3_EVENT_SLEEP); in smsdvb_sleep()
1088 struct smsdvb_client_t *client; in smsdvb_hotplug() local
1094 client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); in smsdvb_hotplug()
1095 if (!client) in smsdvb_hotplug()
1099 rc = dvb_register_adapter(&client->adapter, in smsdvb_hotplug()
1107 dvb_register_media_controller(&client->adapter, coredev->media_dev); in smsdvb_hotplug()
1110 client->demux.dmx.capabilities = DMX_TS_FILTERING; in smsdvb_hotplug()
1111 client->demux.filternum = 32; /* todo: nova ??? */ in smsdvb_hotplug()
1112 client->demux.feednum = 32; in smsdvb_hotplug()
1113 client->demux.start_feed = smsdvb_start_feed; in smsdvb_hotplug()
1114 client->demux.stop_feed = smsdvb_stop_feed; in smsdvb_hotplug()
1116 rc = dvb_dmx_init(&client->demux); in smsdvb_hotplug()
1123 client->dmxdev.filternum = 32; in smsdvb_hotplug()
1124 client->dmxdev.demux = &client->demux.dmx; in smsdvb_hotplug()
1125 client->dmxdev.capabilities = 0; in smsdvb_hotplug()
1127 rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter); in smsdvb_hotplug()
1134 memcpy(&client->frontend.ops, &smsdvb_fe_ops, in smsdvb_hotplug()
1140 client->frontend.ops.delsys[0] = SYS_DVBT; in smsdvb_hotplug()
1144 client->frontend.ops.delsys[0] = SYS_ISDBT; in smsdvb_hotplug()
1148 rc = dvb_register_frontend(&client->adapter, &client->frontend); in smsdvb_hotplug()
1158 params.context = client; in smsdvb_hotplug()
1160 rc = smscore_register_client(coredev, &params, &client->smsclient); in smsdvb_hotplug()
1166 client->coredev = coredev; in smsdvb_hotplug()
1168 init_completion(&client->tune_done); in smsdvb_hotplug()
1169 init_completion(&client->stats_done); in smsdvb_hotplug()
1173 list_add(&client->entry, &g_smsdvb_clients); in smsdvb_hotplug()
1177 client->event_fe_state = -1; in smsdvb_hotplug()
1178 client->event_unc_state = -1; in smsdvb_hotplug()
1179 sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG); in smsdvb_hotplug()
1183 if (smsdvb_debugfs_create(client) < 0) in smsdvb_hotplug()
1186 dvb_create_media_graph(&client->adapter); in smsdvb_hotplug()
1192 dvb_unregister_frontend(&client->frontend); in smsdvb_hotplug()
1195 dvb_dmxdev_release(&client->dmxdev); in smsdvb_hotplug()
1198 dvb_dmx_release(&client->demux); in smsdvb_hotplug()
1201 smsdvb_media_device_unregister(client); in smsdvb_hotplug()
1202 dvb_unregister_adapter(&client->adapter); in smsdvb_hotplug()
1205 kfree(client); in smsdvb_hotplug()