static int poseidon_read_status(struct dvb_frontend *fe, fe_status_t *stat) { struct poseidon *pd = fe->demodulator_priv; s32 ret = -1, cmd_status; struct tuner_dtv_sig_stat_s status = {}; if (in_hibernation(pd)) return -EBUSY; mutex_lock(&pd->lock); ret = send_get_req(pd, TUNER_STATUS, TLG_MODE_DVB_T, &status, &cmd_status, sizeof(status)); if (ret | cmd_status) { log("get tuner status error"); goto out; } if (debug_mode) log("P : %d, L %d, LB :%d", status.sig_present, status.sig_locked, status.sig_lock_busy); if (status.sig_lock_busy) { goto out; } else if (status.sig_present || status.sig_locked) { *stat |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | FE_HAS_VITERBI; } else { if (fw_delay_overflow(&pd->dvb_data)) *stat |= FE_TIMEDOUT; } out: mutex_unlock(&pd->lock); return ret; }
static int snd_pd_capture_trigger(struct snd_pcm_substream *substream, int cmd) { struct poseidon *p = snd_pcm_substream_chip(substream); struct poseidon_audio *pa = &p->audio; if (debug_mode) log("cmd %d, audio stat : %d\n", cmd, pa->capture_stream); switch (cmd) { case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_START: if (pa->capture_stream == STREAM_ON) return 0; pa->rcv_position = pa->copied_position = 0; pa->capture_stream = STREAM_ON; if (in_hibernation(p)) return 0; fire_audio_urb(p); return 0; case SNDRV_PCM_TRIGGER_SUSPEND: pa->capture_stream = STREAM_SUSPEND; return 0; case SNDRV_PCM_TRIGGER_STOP: pa->capture_stream = STREAM_OFF; return 0; default: return -EINVAL; } }
static int poseidon_set_fe(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) { s32 ret = 0, cmd_status = 0; s32 i, bandwidth = -1; struct poseidon *pd = fe->demodulator_priv; struct pd_dvb_adapter *pd_dvb = &pd->dvb_data; if (in_hibernation(pd)) return -EBUSY; mutex_lock(&pd->lock); for (i = 0; i < dvb_bandwidth_length; i++) if (fep->u.ofdm.bandwidth == dvb_bandwidth[i][1]) bandwidth = dvb_bandwidth[i][0]; if (check_scan_ok(fep->frequency, bandwidth, pd_dvb)) { ret = send_set_req(pd, TUNE_FREQ_SELECT, fep->frequency / 1000, &cmd_status); if (ret | cmd_status) { log("error line"); goto front_out; } ret = send_set_req(pd, DVBT_BANDW_SEL, bandwidth, &cmd_status); if (ret | cmd_status) { log("error line"); goto front_out; } ret = send_set_req(pd, TAKE_REQUEST, 0, &cmd_status); if (ret | cmd_status) { log("error line"); goto front_out; } /* save the context for future */ memcpy(&pd_dvb->fe_param, fep, sizeof(*fep)); pd_dvb->bandwidth = bandwidth; pd_dvb->prev_freq = fep->frequency; pd_dvb->last_jiffies = jiffies; } front_out: mutex_unlock(&pd->lock); return ret; }