Lines Matching refs:fdtv

230 static int avc_write(struct firedtv *fdtv)  in avc_write()  argument
234 fdtv->avc_reply_received = false; in avc_write()
238 debug_fcp(fdtv->avc_data, fdtv->avc_data_length); in avc_write()
240 err = fdtv_write(fdtv, FCP_COMMAND_REGISTER, in avc_write()
241 fdtv->avc_data, fdtv->avc_data_length); in avc_write()
243 dev_err(fdtv->device, "FCP command write failed\n"); in avc_write()
252 if (wait_event_timeout(fdtv->avc_wait, in avc_write()
253 fdtv->avc_reply_received, in avc_write()
257 dev_err(fdtv->device, "FCP response timed out\n"); in avc_write()
271 int avc_recv(struct firedtv *fdtv, void *data, size_t length) in avc_recv() argument
281 fdtv_handle_rc(fdtv, r->operand[4] << 8 | r->operand[5]); in avc_recv()
282 schedule_work(&fdtv->remote_ctrl_work); in avc_recv()
285 if (is_register_rc((void *)fdtv->avc_data)) in avc_recv()
289 dev_info(fdtv->device, in avc_recv()
295 if (fdtv->avc_reply_received) { in avc_recv()
296 dev_err(fdtv->device, "out-of-order AVC response, ignored\n"); in avc_recv()
300 memcpy(fdtv->avc_data, data, length); in avc_recv()
301 fdtv->avc_data_length = length; in avc_recv()
303 fdtv->avc_reply_received = true; in avc_recv()
304 wake_up(&fdtv->avc_wait); in avc_recv()
309 static int add_pid_filter(struct firedtv *fdtv, u8 *operand) in add_pid_filter() argument
314 if (test_bit(i, &fdtv->channel_active)) { in add_pid_filter()
317 operand[pos++] = (fdtv->channel_pid[i] >> 8) & 0x1f; in add_pid_filter()
318 operand[pos++] = fdtv->channel_pid[i] & 0xff; in add_pid_filter()
333 static int avc_tuner_tuneqpsk(struct firedtv *fdtv, in avc_tuner_tuneqpsk() argument
336 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_tuneqpsk()
343 if (fdtv->type == FIREDTV_DVB_S2) in avc_tuner_tuneqpsk()
368 if (fdtv->voltage == 0xff) in avc_tuner_tuneqpsk()
370 else if (fdtv->voltage == SEC_VOLTAGE_18) /* polarisation */ in avc_tuner_tuneqpsk()
375 if (fdtv->tone == 0xff) in avc_tuner_tuneqpsk()
377 else if (fdtv->tone == SEC_TONE_ON) /* band */ in avc_tuner_tuneqpsk()
382 if (fdtv->type == FIREDTV_DVB_S2) { in avc_tuner_tuneqpsk()
383 if (fdtv->fe.dtv_property_cache.delivery_system == SYS_DVBS2) { in avc_tuner_tuneqpsk()
384 switch (fdtv->fe.dtv_property_cache.modulation) { in avc_tuner_tuneqpsk()
390 switch (fdtv->fe.dtv_property_cache.rolloff) { in avc_tuner_tuneqpsk()
398 switch (fdtv->fe.dtv_property_cache.pilot) { in avc_tuner_tuneqpsk()
414 static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv, in avc_tuner_dsd_dvb_c() argument
417 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_dsd_dvb_c()
479 return 22 + add_pid_filter(fdtv, &c->operand[22]); in avc_tuner_dsd_dvb_c()
482 static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv, in avc_tuner_dsd_dvb_t() argument
485 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_dsd_dvb_t()
580 return 17 + add_pid_filter(fdtv, &c->operand[17]); in avc_tuner_dsd_dvb_t()
583 int avc_tuner_dsd(struct firedtv *fdtv, in avc_tuner_dsd() argument
586 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_dsd()
589 mutex_lock(&fdtv->avc_mutex); in avc_tuner_dsd()
592 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_tuner_dsd()
594 switch (fdtv->type) { in avc_tuner_dsd()
596 case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, p); break; in avc_tuner_dsd()
597 case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, p); break; in avc_tuner_dsd()
598 case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, p); break; in avc_tuner_dsd()
604 fdtv->avc_data_length = ALIGN(3 + pos, 4); in avc_tuner_dsd()
605 ret = avc_write(fdtv); in avc_tuner_dsd()
615 mutex_unlock(&fdtv->avc_mutex); in avc_tuner_dsd()
623 int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[]) in avc_tuner_set_pids() argument
625 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_set_pids()
631 mutex_lock(&fdtv->avc_mutex); in avc_tuner_set_pids()
634 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_tuner_set_pids()
656 fdtv->avc_data_length = ALIGN(3 + pos, 4); in avc_tuner_set_pids()
657 ret = avc_write(fdtv); in avc_tuner_set_pids()
661 mutex_unlock(&fdtv->avc_mutex); in avc_tuner_set_pids()
669 int avc_tuner_get_ts(struct firedtv *fdtv) in avc_tuner_get_ts() argument
671 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_get_ts()
674 mutex_lock(&fdtv->avc_mutex); in avc_tuner_get_ts()
677 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_tuner_get_ts()
680 sl = fdtv->type == FIREDTV_DVB_T ? 0x0c : 0x11; in avc_tuner_get_ts()
696 fdtv->avc_data_length = fdtv->type == FIREDTV_DVB_T ? 24 : 28; in avc_tuner_get_ts()
697 ret = avc_write(fdtv); in avc_tuner_get_ts()
701 mutex_unlock(&fdtv->avc_mutex); in avc_tuner_get_ts()
709 int avc_identify_subunit(struct firedtv *fdtv) in avc_identify_subunit() argument
711 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_identify_subunit()
712 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_identify_subunit()
715 mutex_lock(&fdtv->avc_mutex); in avc_identify_subunit()
718 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_identify_subunit()
730 fdtv->avc_data_length = 12; in avc_identify_subunit()
731 ret = avc_write(fdtv); in avc_identify_subunit()
738 dev_err(fdtv->device, "cannot read subunit identifier\n"); in avc_identify_subunit()
742 mutex_unlock(&fdtv->avc_mutex); in avc_identify_subunit()
749 int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat) in avc_tuner_status() argument
751 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_tuner_status()
752 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_tuner_status()
755 mutex_lock(&fdtv->avc_mutex); in avc_tuner_status()
758 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_tuner_status()
770 fdtv->avc_data_length = 12; in avc_tuner_status()
771 ret = avc_write(fdtv); in avc_tuner_status()
777 dev_err(fdtv->device, "cannot read tuner status\n"); in avc_tuner_status()
784 dev_err(fdtv->device, "got invalid tuner status\n"); in avc_tuner_status()
823 mutex_unlock(&fdtv->avc_mutex); in avc_tuner_status()
828 int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst, in avc_lnb_control() argument
832 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_lnb_control()
833 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_lnb_control()
836 mutex_lock(&fdtv->avc_mutex); in avc_lnb_control()
839 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_lnb_control()
860 fdtv->avc_data_length = ALIGN(3 + pos, 4); in avc_lnb_control()
861 ret = avc_write(fdtv); in avc_lnb_control()
866 dev_err(fdtv->device, "LNB control failed\n"); in avc_lnb_control()
870 mutex_unlock(&fdtv->avc_mutex); in avc_lnb_control()
875 int avc_register_remote_control(struct firedtv *fdtv) in avc_register_remote_control() argument
877 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_register_remote_control()
880 mutex_lock(&fdtv->avc_mutex); in avc_register_remote_control()
892 fdtv->avc_data_length = 8; in avc_register_remote_control()
893 ret = avc_write(fdtv); in avc_register_remote_control()
897 mutex_unlock(&fdtv->avc_mutex); in avc_register_remote_control()
904 struct firedtv *fdtv = in avc_remote_ctrl_work() local
908 avc_register_remote_control(fdtv); in avc_remote_ctrl_work()
912 int avc_tuner_host2ca(struct firedtv *fdtv)
914 struct avc_command_frame *c = (void *)fdtv->avc_data;
917 mutex_lock(&fdtv->avc_mutex);
920 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
931 fdtv->avc_data_length = 12;
932 ret = avc_write(fdtv);
936 mutex_unlock(&fdtv->avc_mutex);
967 int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info, in avc_ca_app_info() argument
970 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_app_info()
971 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_ca_app_info()
974 mutex_lock(&fdtv->avc_mutex); in avc_ca_app_info()
977 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_app_info()
988 fdtv->avc_data_length = 12; in avc_ca_app_info()
989 ret = avc_write(fdtv); in avc_ca_app_info()
1004 mutex_unlock(&fdtv->avc_mutex); in avc_ca_app_info()
1009 int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info, in avc_ca_info() argument
1012 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_info()
1013 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_ca_info()
1016 mutex_lock(&fdtv->avc_mutex); in avc_ca_info()
1019 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_info()
1030 fdtv->avc_data_length = 12; in avc_ca_info()
1031 ret = avc_write(fdtv); in avc_ca_info()
1055 mutex_unlock(&fdtv->avc_mutex); in avc_ca_info()
1060 int avc_ca_reset(struct firedtv *fdtv) in avc_ca_reset() argument
1062 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_reset()
1065 mutex_lock(&fdtv->avc_mutex); in avc_ca_reset()
1068 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_reset()
1081 fdtv->avc_data_length = 12; in avc_ca_reset()
1082 ret = avc_write(fdtv); in avc_ca_reset()
1086 mutex_unlock(&fdtv->avc_mutex); in avc_ca_reset()
1091 int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) in avc_ca_pmt() argument
1093 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_pmt()
1094 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_ca_pmt()
1107 mutex_lock(&fdtv->avc_mutex); in avc_ca_pmt()
1110 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_pmt()
1114 dev_info(fdtv->device, "forcing list_management to ONLY\n"); in avc_ca_pmt()
1156 dev_err(fdtv->device, in avc_ca_pmt()
1182 dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n", in avc_ca_pmt()
1211 fdtv->avc_data_length = ALIGN(3 + write_pos, 4); in avc_ca_pmt()
1212 ret = avc_write(fdtv); in avc_ca_pmt()
1217 dev_err(fdtv->device, in avc_ca_pmt()
1222 mutex_unlock(&fdtv->avc_mutex); in avc_ca_pmt()
1227 int avc_ca_get_time_date(struct firedtv *fdtv, int *interval) in avc_ca_get_time_date() argument
1229 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_get_time_date()
1230 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_ca_get_time_date()
1233 mutex_lock(&fdtv->avc_mutex); in avc_ca_get_time_date()
1236 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_get_time_date()
1247 fdtv->avc_data_length = 12; in avc_ca_get_time_date()
1248 ret = avc_write(fdtv); in avc_ca_get_time_date()
1256 mutex_unlock(&fdtv->avc_mutex); in avc_ca_get_time_date()
1261 int avc_ca_enter_menu(struct firedtv *fdtv) in avc_ca_enter_menu() argument
1263 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_enter_menu()
1266 mutex_lock(&fdtv->avc_mutex); in avc_ca_enter_menu()
1269 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_enter_menu()
1280 fdtv->avc_data_length = 12; in avc_ca_enter_menu()
1281 ret = avc_write(fdtv); in avc_ca_enter_menu()
1285 mutex_unlock(&fdtv->avc_mutex); in avc_ca_enter_menu()
1290 int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len) in avc_ca_get_mmi() argument
1292 struct avc_command_frame *c = (void *)fdtv->avc_data; in avc_ca_get_mmi()
1293 struct avc_response_frame *r = (void *)fdtv->avc_data; in avc_ca_get_mmi()
1296 mutex_lock(&fdtv->avc_mutex); in avc_ca_get_mmi()
1299 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; in avc_ca_get_mmi()
1310 fdtv->avc_data_length = 12; in avc_ca_get_mmi()
1311 ret = avc_write(fdtv); in avc_ca_get_mmi()
1320 mutex_unlock(&fdtv->avc_mutex); in avc_ca_get_mmi()
1327 static int cmp_read(struct firedtv *fdtv, u64 addr, __be32 *data) in cmp_read() argument
1331 ret = fdtv_read(fdtv, addr, data); in cmp_read()
1333 dev_err(fdtv->device, "CMP: read I/O error\n"); in cmp_read()
1338 static int cmp_lock(struct firedtv *fdtv, u64 addr, __be32 data[]) in cmp_lock() argument
1342 ret = fdtv_lock(fdtv, addr, data); in cmp_lock()
1344 dev_err(fdtv->device, "CMP: lock I/O error\n"); in cmp_lock()
1369 int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel) in cmp_establish_pp_connection() argument
1376 ret = cmp_read(fdtv, opcr_address, opcr); in cmp_establish_pp_connection()
1382 dev_err(fdtv->device, "CMP: output offline\n"); in cmp_establish_pp_connection()
1390 dev_err(fdtv->device, "CMP: cannot change channel\n"); in cmp_establish_pp_connection()
1393 dev_info(fdtv->device, "CMP: overlaying connection\n"); in cmp_establish_pp_connection()
1411 ret = cmp_lock(fdtv, opcr_address, opcr); in cmp_establish_pp_connection()
1429 void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel) in cmp_break_pp_connection() argument
1435 if (cmp_read(fdtv, opcr_address, opcr) < 0) in cmp_break_pp_connection()
1441 dev_err(fdtv->device, "CMP: no connection to break\n"); in cmp_break_pp_connection()
1451 if (cmp_lock(fdtv, opcr_address, opcr) < 0) in cmp_break_pp_connection()