Пример #1
0
static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
{
	struct dvb_usb_device *d = fe_to_d(fe);
	struct dvb_usb_adapter *adap = fe_to_adap(fe);
	int ret;
	u8 val;

	dev_dbg(&d->udev->dev, "%s: fe=%d onoff=%d\n", __func__, fe->id, onoff);

	/* control internal demod ADC */
	if (fe->id == 0 && onoff)
		val = 0x48; /* enable ADC */
	else
		val = 0x00; /* disable ADC */

	ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, val, 0x48);
	if (ret)
		goto err;

	/* bypass slave demod TS through master demod */
	if (fe->id == 1 && onoff) {
		ret = rtl2832_enable_external_ts_if(adap->fe[0]);
		if (ret)
			goto err;
	}

	return 0;
err:
	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
	return ret;
}
Пример #2
0
static int lme2510_streaming_ctrl(struct dvb_frontend *fe, int onoff)
{
	struct dvb_usb_adapter *adap = fe_to_adap(fe);
	struct dvb_usb_device *d = adap_to_d(adap);
	struct lme2510_state *st = adap_to_priv(adap);
	static u8 clear_reg_3[] = LME_ALL_PIDS;
	static u8 rbuf[1];
	int ret = 0, rlen = sizeof(rbuf);

	deb_info(1, "STM  (%02x)", onoff);

	/* Streaming is started by FE_HAS_LOCK */
	if (onoff == 1)
		st->stream_on = 1;
	else {
		deb_info(1, "STM Steam Off");
		/* mutex is here only to avoid collision with I2C */
		mutex_lock(&d->i2c_mutex);

		ret = lme2510_usb_talk(d, clear_reg_3,
				sizeof(clear_reg_3), rbuf, rlen);
		st->stream_on = 0;
		st->i2c_talk_onoff = 1;

		mutex_unlock(&d->i2c_mutex);
	}

	return (ret < 0) ? -ENODEV : 0;
}
Пример #3
0
static int af9015_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
                                    struct usb_data_stream_properties *stream)
{
    struct dvb_usb_device *d = fe_to_d(fe);
    dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, fe_to_adap(fe)->id);

    if (d->udev->speed == USB_SPEED_FULL)
        stream->u.bulk.buffersize = TS_USB11_FRAME_SIZE;

    return 0;
}
Пример #4
0
/* override tuner callbacks for resource locking */
static int af9015_tuner_sleep(struct dvb_frontend *fe)
{
    int ret;
    struct af9015_state *state = fe_to_priv(fe);

    if (mutex_lock_interruptible(&state->fe_mutex))
        return -EAGAIN;

    ret = state->tuner_sleep[fe_to_adap(fe)->id](fe);

    mutex_unlock(&state->fe_mutex);

    return ret;
}
Пример #5
0
/* override demod callbacks for resource locking */
static int af9015_af9013_read_status(struct dvb_frontend *fe,
                                     enum fe_status *status)
{
    int ret;
    struct af9015_state *state = fe_to_priv(fe);

    if (mutex_lock_interruptible(&state->fe_mutex))
        return -EAGAIN;

    ret = state->read_status[fe_to_adap(fe)->id](fe, status);

    mutex_unlock(&state->fe_mutex);

    return ret;
}
Пример #6
0
static int dm04_rs2000_set_ts_param(struct dvb_frontend *fe,
	int caller)
{
	struct dvb_usb_adapter *adap = fe_to_adap(fe);
	struct dvb_usb_device *d = adap_to_d(adap);
	struct lme2510_state *st = d->priv;

	mutex_lock(&d->i2c_mutex);
	if ((st->i2c_talk_onoff == 1) && (st->stream_on & 1)) {
		st->i2c_talk_onoff = 0;
		lme2510_stream_restart(d);
	}
	mutex_unlock(&d->i2c_mutex);

	return 0;
}
Пример #7
0
static int dm04_read_status(struct dvb_frontend *fe, enum fe_status *status)
{
	struct dvb_usb_device *d = fe_to_d(fe);
	struct lme2510_state *st = d->priv;
	int ret = 0;

	if (st->i2c_talk_onoff) {
		if (st->fe_read_status) {
			ret = st->fe_read_status(fe, status);
			if (ret < 0)
				return ret;
		}

		st->lock_status = *status;

		if (*status & FE_HAS_LOCK && st->stream_on) {
			mutex_lock(&d->i2c_mutex);

			st->i2c_talk_onoff = 0;
			ret = lme2510_stream_restart(d);

			mutex_unlock(&d->i2c_mutex);
		}

		return ret;
	}

	/* Timeout of interrupt reached on RS2000 */
	if (st->tuner_config == TUNER_RS2000 &&
	    time_after(jiffies, st->int_urb_due))
		st->lock_status &= ~FE_HAS_LOCK;

	*status = st->lock_status;

	if (!(*status & FE_HAS_LOCK)) {
		struct dvb_usb_adapter *adap = fe_to_adap(fe);

		st->i2c_talk_onoff = 1;

		lme2510_update_stats(adap);
	}

	return ret;
}
Пример #8
0
static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
		struct usb_data_stream_properties *stream)
{
	struct dvb_usb_adapter *adap = fe_to_adap(fe);
	struct dvb_usb_device *d = adap_to_d(adap);

	if (adap == NULL)
		return 0;
	/* Turn PID filter on the fly by module option */
	if (pid_filter == 2) {
		adap->pid_filtering  = 1;
		adap->max_feed_count = 15;
	}

	if (!(le16_to_cpu(d->udev->descriptor.idProduct)
		== 0x1122))
		stream->endpoint = 0x8;

	return 0;
}