Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4902bb39 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab
Browse files

[media] af9033: support for it913x tuners



Add support for tuners integrated to the IT9135 and IT9137.

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 88b38bef
Loading
Loading
Loading
Loading
+21 −13
Original line number Original line Diff line number Diff line
@@ -223,6 +223,7 @@ static int af9033_init(struct dvb_frontend *fe)
		{ 0x80f986, state->ts_mode_parallel, 0x01 },
		{ 0x80f986, state->ts_mode_parallel, 0x01 },
		{ 0x00d827, 0x00, 0xff },
		{ 0x00d827, 0x00, 0xff },
		{ 0x00d829, 0x00, 0xff },
		{ 0x00d829, 0x00, 0xff },
		{ 0x800045, state->cfg.adc_multiplier, 0xff },
	};
	};


	/* program clock control */
	/* program clock control */
@@ -322,6 +323,14 @@ static int af9033_init(struct dvb_frontend *fe)
		len = ARRAY_SIZE(tuner_init_fc0012);
		len = ARRAY_SIZE(tuner_init_fc0012);
		init = tuner_init_fc0012;
		init = tuner_init_fc0012;
		break;
		break;
	case AF9033_TUNER_IT9135_38:
	case AF9033_TUNER_IT9135_51:
	case AF9033_TUNER_IT9135_52:
	case AF9033_TUNER_IT9135_60:
	case AF9033_TUNER_IT9135_61:
	case AF9033_TUNER_IT9135_62:
		len = 0;
		break;
	default:
	default:
		dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
		dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
				__func__, state->cfg.tuner);
				__func__, state->cfg.tuner);
@@ -498,12 +507,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
		if (spec_inv == -1)
		if (spec_inv == -1)
			freq_cw = 0x800000 - freq_cw;
			freq_cw = 0x800000 - freq_cw;


		/* get adc multiplies */
		if (state->cfg.adc_multiplier == AF9033_ADC_MULTIPLIER_2X)
		ret = af9033_rd_reg(state, 0x800045, &tmp);
		if (ret < 0)
			goto err;

		if (tmp == 1)
			freq_cw /= 2;
			freq_cw /= 2;


		buf[0] = (freq_cw >>  0) & 0xff;
		buf[0] = (freq_cw >>  0) & 0xff;
@@ -933,6 +937,9 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
			"OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
			"OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
			buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
			buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);



	/* FIXME: Do not abuse adc_multiplier for detecting IT9135 */
	if (state->cfg.adc_multiplier != AF9033_ADC_MULTIPLIER_2X) {
		/* sleep */
		/* sleep */
		ret = af9033_wr_reg(state, 0x80004c, 1);
		ret = af9033_wr_reg(state, 0x80004c, 1);
		if (ret < 0)
		if (ret < 0)
@@ -941,6 +948,7 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
		ret = af9033_wr_reg(state, 0x800000, 0);
		ret = af9033_wr_reg(state, 0x800000, 0);
		if (ret < 0)
		if (ret < 0)
			goto err;
			goto err;
	}


	/* configure internal TS mode */
	/* configure internal TS mode */
	switch (state->cfg.ts_mode) {
	switch (state->cfg.ts_mode) {
+15 −0
Original line number Original line Diff line number Diff line
@@ -35,6 +35,13 @@ struct af9033_config {
	 */
	 */
	u32 clock;
	u32 clock;


	/*
	 * ADC multiplier
	 */
#define AF9033_ADC_MULTIPLIER_1X   0
#define AF9033_ADC_MULTIPLIER_2X   1
	u8 adc_multiplier;

	/*
	/*
	 * tuner
	 * tuner
	 */
	 */
@@ -44,6 +51,14 @@ struct af9033_config {
#define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
#define AF9033_TUNER_MXL5007T    0xa0 /* MaxLinear MxL5007T */
#define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
#define AF9033_TUNER_TDA18218    0xa1 /* NXP TDA 18218HN */
#define AF9033_TUNER_FC2580      0x32 /* FCI FC2580 */
#define AF9033_TUNER_FC2580      0x32 /* FCI FC2580 */
/* 50-5f Omega */
#define AF9033_TUNER_IT9135_38   0x38 /* Omega */
#define AF9033_TUNER_IT9135_51   0x51 /* Omega LNA config 1 */
#define AF9033_TUNER_IT9135_52   0x52 /* Omega LNA config 2 */
/* 60-6f Omega v2 */
#define AF9033_TUNER_IT9135_60   0x60 /* Omega v2 */
#define AF9033_TUNER_IT9135_61   0x61 /* Omega v2 LNA config 1 */
#define AF9033_TUNER_IT9135_62   0x62 /* Omega v2 LNA config 2 */
	u8 tuner;
	u8 tuner;


	/*
	/*