Lines Matching refs:fdtv

230 static int avc_write(struct firedtv *fdtv)
234 fdtv->avc_reply_received = false;
238 debug_fcp(fdtv->avc_data, fdtv->avc_data_length);
240 err = fdtv_write(fdtv, FCP_COMMAND_REGISTER,
241 fdtv->avc_data, fdtv->avc_data_length);
243 dev_err(fdtv->device, "FCP command write failed\n");
252 if (wait_event_timeout(fdtv->avc_wait,
253 fdtv->avc_reply_received,
257 dev_err(fdtv->device, "FCP response timed out\n");
271 int avc_recv(struct firedtv *fdtv, void *data, size_t length)
281 fdtv_handle_rc(fdtv, r->operand[4] << 8 | r->operand[5]);
282 schedule_work(&fdtv->remote_ctrl_work);
285 if (is_register_rc((void *)fdtv->avc_data))
289 dev_info(fdtv->device,
295 if (fdtv->avc_reply_received) {
296 dev_err(fdtv->device, "out-of-order AVC response, ignored\n");
300 memcpy(fdtv->avc_data, data, length);
301 fdtv->avc_data_length = length;
303 fdtv->avc_reply_received = true;
304 wake_up(&fdtv->avc_wait);
309 static int add_pid_filter(struct firedtv *fdtv, u8 *operand)
314 if (test_bit(i, &fdtv->channel_active)) {
317 operand[pos++] = (fdtv->channel_pid[i] >> 8) & 0x1f;
318 operand[pos++] = fdtv->channel_pid[i] & 0xff;
333 static int avc_tuner_tuneqpsk(struct firedtv *fdtv,
336 struct avc_command_frame *c = (void *)fdtv->avc_data;
343 if (fdtv->type == FIREDTV_DVB_S2)
368 if (fdtv->voltage == 0xff)
370 else if (fdtv->voltage == SEC_VOLTAGE_18) /* polarisation */
375 if (fdtv->tone == 0xff)
377 else if (fdtv->tone == SEC_TONE_ON) /* band */
382 if (fdtv->type == FIREDTV_DVB_S2) {
383 if (fdtv->fe.dtv_property_cache.delivery_system == SYS_DVBS2) {
384 switch (fdtv->fe.dtv_property_cache.modulation) {
390 switch (fdtv->fe.dtv_property_cache.rolloff) {
398 switch (fdtv->fe.dtv_property_cache.pilot) {
414 static int avc_tuner_dsd_dvb_c(struct firedtv *fdtv,
417 struct avc_command_frame *c = (void *)fdtv->avc_data;
479 return 22 + add_pid_filter(fdtv, &c->operand[22]);
482 static int avc_tuner_dsd_dvb_t(struct firedtv *fdtv,
485 struct avc_command_frame *c = (void *)fdtv->avc_data;
580 return 17 + add_pid_filter(fdtv, &c->operand[17]);
583 int avc_tuner_dsd(struct firedtv *fdtv,
586 struct avc_command_frame *c = (void *)fdtv->avc_data;
589 mutex_lock(&fdtv->avc_mutex);
592 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
594 switch (fdtv->type) {
596 case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, p); break;
597 case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, p); break;
598 case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, p); break;
605 fdtv->avc_data_length = ALIGN(3 + pos, 4);
606 ret = avc_write(fdtv);
617 mutex_unlock(&fdtv->avc_mutex);
625 int avc_tuner_set_pids(struct firedtv *fdtv, unsigned char pidc, u16 pid[])
627 struct avc_command_frame *c = (void *)fdtv->avc_data;
633 mutex_lock(&fdtv->avc_mutex);
636 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
658 fdtv->avc_data_length = ALIGN(3 + pos, 4);
659 ret = avc_write(fdtv);
663 mutex_unlock(&fdtv->avc_mutex);
671 int avc_tuner_get_ts(struct firedtv *fdtv)
673 struct avc_command_frame *c = (void *)fdtv->avc_data;
676 mutex_lock(&fdtv->avc_mutex);
679 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
682 sl = fdtv->type == FIREDTV_DVB_T ? 0x0c : 0x11;
698 fdtv->avc_data_length = fdtv->type == FIREDTV_DVB_T ? 24 : 28;
699 ret = avc_write(fdtv);
703 mutex_unlock(&fdtv->avc_mutex);
711 int avc_identify_subunit(struct firedtv *fdtv)
713 struct avc_command_frame *c = (void *)fdtv->avc_data;
714 struct avc_response_frame *r = (void *)fdtv->avc_data;
717 mutex_lock(&fdtv->avc_mutex);
720 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
732 fdtv->avc_data_length = 12;
733 ret = avc_write(fdtv);
740 dev_err(fdtv->device, "cannot read subunit identifier\n");
744 mutex_unlock(&fdtv->avc_mutex);
751 int avc_tuner_status(struct firedtv *fdtv, struct firedtv_tuner_status *stat)
753 struct avc_command_frame *c = (void *)fdtv->avc_data;
754 struct avc_response_frame *r = (void *)fdtv->avc_data;
757 mutex_lock(&fdtv->avc_mutex);
760 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
772 fdtv->avc_data_length = 12;
773 ret = avc_write(fdtv);
779 dev_err(fdtv->device, "cannot read tuner status\n");
786 dev_err(fdtv->device, "got invalid tuner status\n");
825 mutex_unlock(&fdtv->avc_mutex);
830 int avc_lnb_control(struct firedtv *fdtv, char voltage, char burst,
834 struct avc_command_frame *c = (void *)fdtv->avc_data;
835 struct avc_response_frame *r = (void *)fdtv->avc_data;
838 mutex_lock(&fdtv->avc_mutex);
841 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
862 fdtv->avc_data_length = ALIGN(3 + pos, 4);
863 ret = avc_write(fdtv);
868 dev_err(fdtv->device, "LNB control failed\n");
872 mutex_unlock(&fdtv->avc_mutex);
877 int avc_register_remote_control(struct firedtv *fdtv)
879 struct avc_command_frame *c = (void *)fdtv->avc_data;
882 mutex_lock(&fdtv->avc_mutex);
894 fdtv->avc_data_length = 8;
895 ret = avc_write(fdtv);
899 mutex_unlock(&fdtv->avc_mutex);
906 struct firedtv *fdtv =
910 avc_register_remote_control(fdtv);
914 int avc_tuner_host2ca(struct firedtv *fdtv)
916 struct avc_command_frame *c = (void *)fdtv->avc_data;
919 mutex_lock(&fdtv->avc_mutex);
922 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
933 fdtv->avc_data_length = 12;
934 ret = avc_write(fdtv);
938 mutex_unlock(&fdtv->avc_mutex);
969 int avc_ca_app_info(struct firedtv *fdtv, unsigned char *app_info,
972 struct avc_command_frame *c = (void *)fdtv->avc_data;
973 struct avc_response_frame *r = (void *)fdtv->avc_data;
976 mutex_lock(&fdtv->avc_mutex);
979 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
990 fdtv->avc_data_length = 12;
991 ret = avc_write(fdtv);
1006 mutex_unlock(&fdtv->avc_mutex);
1011 int avc_ca_info(struct firedtv *fdtv, unsigned char *app_info,
1014 struct avc_command_frame *c = (void *)fdtv->avc_data;
1015 struct avc_response_frame *r = (void *)fdtv->avc_data;
1018 mutex_lock(&fdtv->avc_mutex);
1021 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1032 fdtv->avc_data_length = 12;
1033 ret = avc_write(fdtv);
1057 mutex_unlock(&fdtv->avc_mutex);
1062 int avc_ca_reset(struct firedtv *fdtv)
1064 struct avc_command_frame *c = (void *)fdtv->avc_data;
1067 mutex_lock(&fdtv->avc_mutex);
1070 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1083 fdtv->avc_data_length = 12;
1084 ret = avc_write(fdtv);
1088 mutex_unlock(&fdtv->avc_mutex);
1093 int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
1095 struct avc_command_frame *c = (void *)fdtv->avc_data;
1096 struct avc_response_frame *r = (void *)fdtv->avc_data;
1109 mutex_lock(&fdtv->avc_mutex);
1112 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1116 dev_info(fdtv->device, "forcing list_management to ONLY\n");
1158 dev_err(fdtv->device,
1192 dev_err(fdtv->device, "invalid pmt_cmd_id %d at stream level\n",
1221 fdtv->avc_data_length = ALIGN(3 + write_pos, 4);
1222 ret = avc_write(fdtv);
1227 dev_err(fdtv->device,
1232 mutex_unlock(&fdtv->avc_mutex);
1237 int avc_ca_get_time_date(struct firedtv *fdtv, int *interval)
1239 struct avc_command_frame *c = (void *)fdtv->avc_data;
1240 struct avc_response_frame *r = (void *)fdtv->avc_data;
1243 mutex_lock(&fdtv->avc_mutex);
1246 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1257 fdtv->avc_data_length = 12;
1258 ret = avc_write(fdtv);
1266 mutex_unlock(&fdtv->avc_mutex);
1271 int avc_ca_enter_menu(struct firedtv *fdtv)
1273 struct avc_command_frame *c = (void *)fdtv->avc_data;
1276 mutex_lock(&fdtv->avc_mutex);
1279 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1290 fdtv->avc_data_length = 12;
1291 ret = avc_write(fdtv);
1295 mutex_unlock(&fdtv->avc_mutex);
1300 int avc_ca_get_mmi(struct firedtv *fdtv, char *mmi_object, unsigned int *len)
1302 struct avc_command_frame *c = (void *)fdtv->avc_data;
1303 struct avc_response_frame *r = (void *)fdtv->avc_data;
1306 mutex_lock(&fdtv->avc_mutex);
1309 c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit;
1320 fdtv->avc_data_length = 12;
1321 ret = avc_write(fdtv);
1330 mutex_unlock(&fdtv->avc_mutex);
1337 static int cmp_read(struct firedtv *fdtv, u64 addr, __be32 *data)
1341 ret = fdtv_read(fdtv, addr, data);
1343 dev_err(fdtv->device, "CMP: read I/O error\n");
1348 static int cmp_lock(struct firedtv *fdtv, u64 addr, __be32 data[])
1352 ret = fdtv_lock(fdtv, addr, data);
1354 dev_err(fdtv->device, "CMP: lock I/O error\n");
1379 int cmp_establish_pp_connection(struct firedtv *fdtv, int plug, int channel)
1386 ret = cmp_read(fdtv, opcr_address, opcr);
1392 dev_err(fdtv->device, "CMP: output offline\n");
1400 dev_err(fdtv->device, "CMP: cannot change channel\n");
1403 dev_info(fdtv->device, "CMP: overlaying connection\n");
1421 ret = cmp_lock(fdtv, opcr_address, opcr);
1439 void cmp_break_pp_connection(struct firedtv *fdtv, int plug, int channel)
1445 if (cmp_read(fdtv, opcr_address, opcr) < 0)
1451 dev_err(fdtv->device, "CMP: no connection to break\n");
1461 if (cmp_lock(fdtv, opcr_address, opcr) < 0)
1469 * fdtv->backend->dealloc_resources(fdtv, channel, bw);