Commit d7cba043 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (9049): convert tuner drivers to use dvb_frontend->callback

parent ebb8d68a
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -447,8 +447,9 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
			else
			else
				arg = 0;
				arg = 0;
		}
		}
		if (priv->cfg->tuner_callback)
		if (fe->callback)
			priv->cfg->tuner_callback(priv->i2c_adap->algo_data,
			fe->callback(priv->i2c_adap->algo_data,
				     DVB_FRONTEND_COMPONENT_TUNER,
				     gp_func, arg);
				     gp_func, arg);
		buf[1] = high ? 0 : 1;
		buf[1] = high ? 0 : 1;
		if (priv->cfg->config == 2)
		if (priv->cfg->config == 2)
@@ -456,8 +457,9 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high,
		i2c_transfer(priv->i2c_adap, &msg, 1);
		i2c_transfer(priv->i2c_adap, &msg, 1);
		break;
		break;
	case 3: /* switch with GPIO of saa713x */
	case 3: /* switch with GPIO of saa713x */
		if (priv->cfg->tuner_callback)
		if (fe->callback)
			priv->cfg->tuner_callback(priv->i2c_adap->algo_data, 0, high);
			fe->callback(priv->i2c_adap->algo_data,
				     DVB_FRONTEND_COMPONENT_TUNER, 0, high);
		break;
		break;
	}
	}
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,6 @@ struct tda827x_config
	/* interface to tda829x driver */
	/* interface to tda829x driver */
	unsigned int config;
	unsigned int config;
	int 	     switch_addr;
	int 	     switch_addr;
	int (*tuner_callback) (void *dev, int command, int arg);


	void (*agcf)(struct dvb_frontend *fe);
	void (*agcf)(struct dvb_frontend *fe);
};
};
+1 −3
Original line number Original line Diff line number Diff line
@@ -672,10 +672,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
	priv->i2c_props.addr     = i2c_addr;
	priv->i2c_props.addr     = i2c_addr;
	priv->i2c_props.adap     = i2c_adap;
	priv->i2c_props.adap     = i2c_adap;
	priv->i2c_props.name     = "tda829x";
	priv->i2c_props.name     = "tda829x";
	if (cfg) {
	if (cfg)
		priv->cfg.config         = cfg->lna_cfg;
		priv->cfg.config         = cfg->lna_cfg;
		priv->cfg.tuner_callback = cfg->tuner_callback;
	}


	if (tda8290_probe(&priv->i2c_props) == 0) {
	if (tda8290_probe(&priv->i2c_props) == 0) {
		priv->ver = TDA8290;
		priv->ver = TDA8290;
+0 −1
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@


struct tda829x_config {
struct tda829x_config {
	unsigned int lna_cfg;
	unsigned int lna_cfg;
	int (*tuner_callback) (void *dev, int command, int arg);


	unsigned int probe_tuner:1;
	unsigned int probe_tuner:1;
#define TDA829X_PROBE_TUNER 0
#define TDA829X_PROBE_TUNER 0
+21 −20
Original line number Original line Diff line number Diff line
@@ -71,9 +71,6 @@ struct firmware_properties {
struct xc2028_data {
struct xc2028_data {
	struct list_head        hybrid_tuner_instance_list;
	struct list_head        hybrid_tuner_instance_list;
	struct tuner_i2c_props  i2c_props;
	struct tuner_i2c_props  i2c_props;
	int                     (*tuner_callback) (void *dev,
						   int command, int arg);
	void			*video_dev;
	__u32			frequency;
	__u32			frequency;


	struct firmware_description *firm;
	struct firmware_description *firm;
@@ -492,6 +489,23 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
	return i;
	return i;
}
}


static inline int do_tuner_callback(struct dvb_frontend *fe, int cmd, int arg)
{
	struct xc2028_data *priv = fe->tuner_priv;

	/* analog side (tuner-core) uses i2c_adap->algo_data.
	 * digital side is not guaranteed to have algo_data defined.
	 *
	 * digital side will always have fe->dvb defined.
	 * analog side (tuner-core) doesn't (yet) define fe->dvb.
	 */

	return (!fe->callback) ? -EINVAL :
		fe->callback(((fe->dvb) && (fe->dvb->priv)) ?
				fe->dvb->priv : priv->i2c_props.adap->algo_data,
			     DVB_FRONTEND_COMPONENT_TUNER, cmd, arg);
}

static int load_firmware(struct dvb_frontend *fe, unsigned int type,
static int load_firmware(struct dvb_frontend *fe, unsigned int type,
			 v4l2_std_id *id)
			 v4l2_std_id *id)
{
{
@@ -530,8 +544,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,


		if (!size) {
		if (!size) {
			/* Special callback command received */
			/* Special callback command received */
			rc = priv->tuner_callback(priv->video_dev,
			rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
						  XC2028_TUNER_RESET, 0);
			if (rc < 0) {
			if (rc < 0) {
				tuner_err("Error at RESET code %d\n",
				tuner_err("Error at RESET code %d\n",
					   (*p) & 0x7f);
					   (*p) & 0x7f);
@@ -542,8 +555,7 @@ static int load_firmware(struct dvb_frontend *fe, unsigned int type,
		if (size >= 0xff00) {
		if (size >= 0xff00) {
			switch (size) {
			switch (size) {
			case 0xff00:
			case 0xff00:
				rc = priv->tuner_callback(priv->video_dev,
				rc = do_tuner_callback(fe, XC2028_RESET_CLK, 0);
							XC2028_RESET_CLK, 0);
				if (rc < 0) {
				if (rc < 0) {
					tuner_err("Error at RESET code %d\n",
					tuner_err("Error at RESET code %d\n",
						  (*p) & 0x7f);
						  (*p) & 0x7f);
@@ -715,8 +727,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type,
	memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));
	memset(&priv->cur_fw, 0, sizeof(priv->cur_fw));


	/* Reset is needed before loading firmware */
	/* Reset is needed before loading firmware */
	rc = priv->tuner_callback(priv->video_dev,
	rc = do_tuner_callback(fe, XC2028_TUNER_RESET, 0);
				  XC2028_TUNER_RESET, 0);
	if (rc < 0)
	if (rc < 0)
		goto fail;
		goto fail;


@@ -933,7 +944,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
	   The reset CLK is needed only with tm6000.
	   The reset CLK is needed only with tm6000.
	   Driver should work fine even if this fails.
	   Driver should work fine even if this fails.
	 */
	 */
	priv->tuner_callback(priv->video_dev, XC2028_RESET_CLK, 1);
	do_tuner_callback(fe, XC2028_RESET_CLK, 1);


	msleep(10);
	msleep(10);


@@ -1177,20 +1188,10 @@ struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
		break;
		break;
	case 1:
	case 1:
		/* new tuner instance */
		/* new tuner instance */
		priv->tuner_callback = cfg->callback;
		priv->ctrl.max_len = 13;
		priv->ctrl.max_len = 13;


		mutex_init(&priv->lock);
		mutex_init(&priv->lock);


		/* analog side (tuner-core) uses i2c_adap->algo_data.
		 * digital side is not guaranteed to have algo_data defined.
		 *
		 * digital side will always have fe->dvb defined.
		 * analog side (tuner-core) doesn't (yet) define fe->dvb.
		 */
		priv->video_dev = ((fe->dvb) && (fe->dvb->priv)) ?
				   fe->dvb->priv : cfg->i2c_adap->algo_data;

		fe->tuner_priv = priv;
		fe->tuner_priv = priv;
		break;
		break;
	case 2:
	case 2:
Loading