* [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner
@ 2012-12-09 19:56 Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 02/17] af9035: support for Fitipower FC0012 tuner devices Antti Palosaari
` (15 more replies)
0 siblings, 16 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033.c | 4 +++
drivers/media/dvb-frontends/af9033.h | 1 +
drivers/media/dvb-frontends/af9033_priv.h | 43 +++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+)
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index 464ad87..27638a9 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -318,6 +318,10 @@ static int af9033_init(struct dvb_frontend *fe)
len = ARRAY_SIZE(tuner_init_fc2580);
init = tuner_init_fc2580;
break;
+ case AF9033_TUNER_FC0012:
+ len = ARRAY_SIZE(tuner_init_fc0012);
+ init = tuner_init_fc0012;
+ break;
default:
dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
__func__, state->cfg.tuner);
diff --git a/drivers/media/dvb-frontends/af9033.h b/drivers/media/dvb-frontends/af9033.h
index bfa4313..82bd8c1 100644
--- a/drivers/media/dvb-frontends/af9033.h
+++ b/drivers/media/dvb-frontends/af9033.h
@@ -40,6 +40,7 @@ struct af9033_config {
*/
#define AF9033_TUNER_TUA9001 0x27 /* Infineon TUA 9001 */
#define AF9033_TUNER_FC0011 0x28 /* Fitipower FC0011 */
+#define AF9033_TUNER_FC0012 0x2e /* Fitipower FC0012 */
#define AF9033_TUNER_MXL5007T 0xa0 /* MaxLinear MxL5007T */
#define AF9033_TUNER_TDA18218 0xa1 /* NXP TDA 18218HN */
#define AF9033_TUNER_FC2580 0x32 /* FCI FC2580 */
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
index 34dddcd..288cd45 100644
--- a/drivers/media/dvb-frontends/af9033_priv.h
+++ b/drivers/media/dvb-frontends/af9033_priv.h
@@ -397,6 +397,49 @@ static const struct reg_val tuner_init_fc0011[] = {
{ 0x80F1E6, 0x00 },
};
+/* Fitipower FC0012 tuner init
+ AF9033_TUNER_FC0012 = 0x2e */
+static const struct reg_val tuner_init_fc0012[] = {
+ { 0x800046, 0x2e },
+ { 0x800057, 0x00 },
+ { 0x800058, 0x01 },
+ { 0x800059, 0x01 },
+ { 0x80005f, 0x00 },
+ { 0x800060, 0x00 },
+ { 0x80006d, 0x00 },
+ { 0x800071, 0x05 },
+ { 0x800072, 0x02 },
+ { 0x800074, 0x01 },
+ { 0x800075, 0x03 },
+ { 0x800076, 0x02 },
+ { 0x800077, 0x01 },
+ { 0x800078, 0x00 },
+ { 0x800079, 0x00 },
+ { 0x80007a, 0x90 },
+ { 0x80007b, 0x90 },
+ { 0x800093, 0x00 },
+ { 0x800094, 0x01 },
+ { 0x800095, 0x02 },
+ { 0x800096, 0x01 },
+ { 0x800098, 0x0a },
+ { 0x80009b, 0x05 },
+ { 0x80009c, 0x80 },
+ { 0x8000b3, 0x00 },
+ { 0x8000c5, 0x01 },
+ { 0x8000c6, 0x00 },
+ { 0x8000c9, 0x5d },
+ { 0x80f007, 0x00 },
+ { 0x80f01f, 0xa0 },
+ { 0x80f020, 0x00 },
+ { 0x80f029, 0x82 },
+ { 0x80f02a, 0x00 },
+ { 0x80f047, 0x00 },
+ { 0x80f054, 0x00 },
+ { 0x80f055, 0x00 },
+ { 0x80f077, 0x01 },
+ { 0x80f1e6, 0x00 },
+};
+
/* MaxLinear MxL5007T tuner init
AF9033_TUNER_MXL5007T = 0xa0 */
static const struct reg_val tuner_init_mxl5007t[] = {
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 02/17] af9035: support for Fitipower FC0012 tuner devices
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 03/17] af9035: dual mode support Antti Palosaari
` (14 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/usb/dvb-usb-v2/af9035.c | 26 ++++++++++++++++++++++++++
drivers/media/usb/dvb-usb-v2/af9035.h | 1 +
2 files changed, 27 insertions(+)
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 61ae7f9..c1ec18c 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -514,6 +514,7 @@ static int af9035_read_config(struct dvb_usb_device *d)
case AF9033_TUNER_MXL5007T:
case AF9033_TUNER_TDA18218:
case AF9033_TUNER_FC2580:
+ case AF9033_TUNER_FC0012:
state->af9033_config[i].spec_inv = 1;
break;
default:
@@ -907,6 +908,31 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
fe = dvb_attach(fc2580_attach, adap->fe[0],
&d->i2c_adap, &af9035_fc2580_config);
break;
+ case AF9033_TUNER_FC0012:
+ /*
+ * AF9035 gpiot2 = FC0012 enable
+ * XXX: there seems to be something on gpioh8 too, but on my
+ * my test I didn't find any difference.
+ */
+
+ /* configure gpiot2 as output and high */
+ ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+
+ usleep_range(10000, 50000);
+
+ fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, 0x63,
+ 1, FC_XTAL_36_MHZ);
+ break;
default:
fe = NULL;
}
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
index 75ef1ec..f509d35 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -26,6 +26,7 @@
#include "af9033.h"
#include "tua9001.h"
#include "fc0011.h"
+#include "fc0012.h"
#include "mxl5007t.h"
#include "tda18218.h"
#include "fc2580.h"
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 03/17] af9035: dual mode support
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 02/17] af9035: support for Fitipower FC0012 tuner devices Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` =?y?q?=5BPATCH=20RFC=2004/17=5D=20af9035=3A=20dual=20mode=20related=20changes?= Antti Palosaari
` (13 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Jose Alberto Reguero, Antti Palosaari
From: Jose Alberto Reguero <jareguero@telefonica.net>
Adds initial support for af9035 dual mode designs.
Signed-off-by: Jose Alberto Reguero <jareguero@telefonica.net>
[crope@iki.fi: fix merge conflict]
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033.c | 12 +++
drivers/media/usb/dvb-usb-v2/af9035.c | 155 +++++++++++++++++++++++-----------
drivers/media/usb/dvb-usb-v2/af9035.h | 3 +
3 files changed, 123 insertions(+), 47 deletions(-)
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index 27638a9..745d2fa 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -335,6 +335,18 @@ static int af9033_init(struct dvb_frontend *fe)
goto err;
}
+ if (state->cfg.ts_mode == AF9033_TS_MODE_SERIAL) {
+ ret = af9033_wr_reg_mask(state, 0x00d91c, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+ ret = af9033_wr_reg_mask(state, 0x00d917, 0x00, 0x01);
+ if (ret < 0)
+ goto err;
+ ret = af9033_wr_reg_mask(state, 0x00d916, 0x00, 0x01);
+ if (ret < 0)
+ goto err;
+ }
+
state->bandwidth_hz = 0; /* force to program all parameters */
return 0;
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index c1ec18c..15625eb 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -209,10 +209,14 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
if (msg[0].len > 40 || msg[1].len > 40) {
/* TODO: correct limits > 40 */
ret = -EOPNOTSUPP;
- } else if (msg[0].addr == state->af9033_config[0].i2c_addr) {
+ } else if ((msg[0].addr == state->af9033_config[0].i2c_addr) ||
+ (msg[0].addr == state->af9033_config[1].i2c_addr)) {
/* integrated demod */
u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 |
msg[0].buf[2];
+ if (state->af9033_config[1].i2c_addr &&
+ (msg[0].addr == state->af9033_config[1].i2c_addr))
+ reg |= 0x100000;
ret = af9035_rd_regs(d, reg, &msg[1].buf[0],
msg[1].len);
} else {
@@ -220,8 +224,9 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
u8 buf[5 + msg[0].len];
struct usb_req req = { CMD_I2C_RD, 0, sizeof(buf),
buf, msg[1].len, msg[1].buf };
+ req.mbox |= ((msg[0].addr & 0x80) >> 3);
buf[0] = msg[1].len;
- buf[1] = msg[0].addr << 1;
+ buf[1] = (u8)(msg[0].addr << 1);
buf[2] = 0x00; /* reg addr len */
buf[3] = 0x00; /* reg addr MSB */
buf[4] = 0x00; /* reg addr LSB */
@@ -232,10 +237,14 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
if (msg[0].len > 40) {
/* TODO: correct limits > 40 */
ret = -EOPNOTSUPP;
- } else if (msg[0].addr == state->af9033_config[0].i2c_addr) {
+ } else if ((msg[0].addr == state->af9033_config[0].i2c_addr) ||
+ (msg[0].addr == state->af9033_config[1].i2c_addr)) {
/* integrated demod */
u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 |
msg[0].buf[2];
+ if (state->af9033_config[1].i2c_addr &&
+ (msg[0].addr == state->af9033_config[1].i2c_addr))
+ reg |= 0x100000;
ret = af9035_wr_regs(d, reg, &msg[0].buf[3],
msg[0].len - 3);
} else {
@@ -243,8 +252,9 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
u8 buf[5 + msg[0].len];
struct usb_req req = { CMD_I2C_WR, 0, sizeof(buf), buf,
0, NULL };
+ req.mbox |= ((msg[0].addr & 0x80) >> 3);
buf[0] = msg[0].len;
- buf[1] = msg[0].addr << 1;
+ buf[1] = (u8)(msg[0].addr << 1);
buf[2] = 0x00; /* reg addr len */
buf[3] = 0x00; /* reg addr MSB */
buf[4] = 0x00; /* reg addr LSB */
@@ -283,9 +293,30 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
int ret;
u8 wbuf[1] = { 1 };
u8 rbuf[4];
+ u8 tmp;
struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf,
sizeof(rbuf), rbuf };
+ /* check if there is dual tuners */
+ ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
+ if (ret < 0)
+ goto err;
+
+ if (tmp) {
+ /* read 2nd demodulator I2C address */
+ ret = af9035_rd_reg(d, EEPROM_2WIREADDR, &tmp);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg(d, 0x00417f, tmp);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg(d, 0x00d81a, 1);
+ if (ret < 0)
+ goto err;
+ }
+
ret = af9035_ctrl_msg(d, &req);
if (ret < 0)
goto err;
@@ -498,6 +529,15 @@ static int af9035_read_config(struct dvb_usb_device *d)
dev_dbg(&d->udev->dev, "%s: dual mode=%d\n",
__func__, state->dual_mode);
+ if (state->dual_mode) {
+ /* read 2nd demodulator I2C address */
+ ret = af9035_rd_reg(d, EEPROM_2WIREADDR, &tmp);
+ if (ret < 0)
+ goto err;
+ state->af9033_config[1].i2c_addr = tmp;
+ pr_debug("%s: 2nd demod I2C addr:%02x\n", __func__, tmp);
+ }
+
for (i = 0; i < state->dual_mode + 1; i++) {
/* tuner */
ret = af9035_rd_reg(d, EEPROM_1_TUNER_ID + eeprom_shift, &tmp);
@@ -731,6 +771,12 @@ static int af9035_frontend_callback(void *adapter_priv, int component,
return 0;
}
+static int af9035_get_adapter_count(struct dvb_usb_device *d)
+{
+ struct state *state = d_to_priv(d);
+ return state->dual_mode + 1;
+}
+
static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
{
struct state *state = adap_to_priv(adap);
@@ -786,13 +832,22 @@ static const struct fc0011_config af9035_fc0011_config = {
.i2c_address = 0x60,
};
-static struct mxl5007t_config af9035_mxl5007t_config = {
- .xtal_freq_hz = MxL_XTAL_24_MHZ,
- .if_freq_hz = MxL_IF_4_57_MHZ,
- .invert_if = 0,
- .loop_thru_enable = 0,
- .clk_out_enable = 0,
- .clk_out_amp = MxL_CLKOUT_AMP_0_94V,
+static struct mxl5007t_config af9035_mxl5007t_config[] = {
+ {
+ .xtal_freq_hz = MxL_XTAL_24_MHZ,
+ .if_freq_hz = MxL_IF_4_57_MHZ,
+ .invert_if = 0,
+ .loop_thru_enable = 0,
+ .clk_out_enable = 0,
+ .clk_out_amp = MxL_CLKOUT_AMP_0_94V,
+ }, {
+ .xtal_freq_hz = MxL_XTAL_24_MHZ,
+ .if_freq_hz = MxL_IF_4_57_MHZ,
+ .invert_if = 0,
+ .loop_thru_enable = 1,
+ .clk_out_enable = 1,
+ .clk_out_amp = MxL_CLKOUT_AMP_0_94V,
+ }
};
static struct tda18218_config af9035_tda18218_config = {
@@ -843,46 +898,52 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
&d->i2c_adap, &af9035_fc0011_config);
break;
case AF9033_TUNER_MXL5007T:
- ret = af9035_wr_reg(d, 0x00d8e0, 1);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8e1, 1);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8df, 0);
- if (ret < 0)
- goto err;
+ state->tuner_address[adap->id] = 0x60;
+ /* hack, use b[7] to carry used I2C-bus */
+ state->tuner_address[adap->id] |= (adap->id << 7);
+ if (adap->id == 0) {
+ ret = af9035_wr_reg(d, 0x00d8e0, 1);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8e1, 1);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8df, 0);
+ if (ret < 0)
+ goto err;
- msleep(30);
+ msleep(30);
- ret = af9035_wr_reg(d, 0x00d8df, 1);
- if (ret < 0)
- goto err;
+ ret = af9035_wr_reg(d, 0x00d8df, 1);
+ if (ret < 0)
+ goto err;
- msleep(300);
+ msleep(300);
- ret = af9035_wr_reg(d, 0x00d8c0, 1);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8c1, 1);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8bf, 0);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8b4, 1);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8b5, 1);
- if (ret < 0)
- goto err;
- ret = af9035_wr_reg(d, 0x00d8b3, 1);
- if (ret < 0)
- goto err;
+ ret = af9035_wr_reg(d, 0x00d8c0, 1);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8c1, 1);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8bf, 0);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8b4, 1);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8b5, 1);
+ if (ret < 0)
+ goto err;
+ ret = af9035_wr_reg(d, 0x00d8b3, 1);
+ if (ret < 0)
+ goto err;
+ }
/* attach tuner */
fe = dvb_attach(mxl5007t_attach, adap->fe[0],
- &d->i2c_adap, 0x60, &af9035_mxl5007t_config);
+ &d->i2c_adap, state->tuner_address[adap->id],
+ &af9035_mxl5007t_config[adap->id]);
break;
case AF9033_TUNER_TDA18218:
/* attach tuner */
@@ -971,8 +1032,8 @@ static int af9035_init(struct dvb_usb_device *d)
{ 0x00dd8a, (frame_size >> 0) & 0xff, 0xff},
{ 0x00dd8b, (frame_size >> 8) & 0xff, 0xff},
{ 0x00dd0d, packet_size, 0xff },
- { 0x80f9a3, 0x00, 0x01 },
- { 0x80f9cd, 0x00, 0x01 },
+ { 0x80f9a3, state->dual_mode, 0x01 },
+ { 0x80f9cd, state->dual_mode, 0x01 },
{ 0x80f99d, 0x00, 0x01 },
{ 0x80f9a4, 0x00, 0x01 },
};
@@ -1094,7 +1155,7 @@ static const struct dvb_usb_device_properties af9035_props = {
.init = af9035_init,
.get_rc_config = af9035_get_rc_config,
- .num_adapters = 1,
+ .get_adapter_count = af9035_get_adapter_count,
.adapter = {
{
.stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
index f509d35..e26e04d 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -56,6 +56,8 @@ struct state {
bool dual_mode;
struct af9033_config af9033_config[2];
+
+ u8 tuner_address[2];
};
u32 clock_lut[] = {
@@ -92,6 +94,7 @@ u32 clock_lut_it9135[] = {
/* EEPROM locations */
#define EEPROM_IR_MODE 0x430d
#define EEPROM_DUAL_MODE 0x4326
+#define EEPROM_2WIREADDR 0x4327
#define EEPROM_IR_TYPE 0x4329
#define EEPROM_1_IFFREQ_L 0x432d
#define EEPROM_1_IFFREQ_H 0x432e
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* =?y?q?=5BPATCH=20RFC=2004/17=5D=20af9035=3A=20dual=20mode=20related=20changes?=
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 02/17] af9035: support for Fitipower FC0012 tuner devices Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 03/17] af9035: dual mode support Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 05/17] fc0012: use struct for driver config Antti Palosaari
` (12 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 10098 bytes --]
Various small changes and fixes releated to dual mode.
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033.c | 2 +
drivers/media/usb/dvb-usb-v2/af9035.c | 140 +++++++++++++++++++++++-----------
drivers/media/usb/dvb-usb-v2/af9035.h | 5 +-
3 files changed, 99 insertions(+), 48 deletions(-)
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c
index 745d2fa..c9cad98 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -339,9 +339,11 @@ static int af9033_init(struct dvb_frontend *fe)
ret = af9033_wr_reg_mask(state, 0x00d91c, 0x01, 0x01);
if (ret < 0)
goto err;
+
ret = af9033_wr_reg_mask(state, 0x00d917, 0x00, 0x01);
if (ret < 0)
goto err;
+
ret = af9033_wr_reg_mask(state, 0x00d916, 0x00, 0x01);
if (ret < 0)
goto err;
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 15625eb..d1beb7f 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -211,12 +211,13 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
ret = -EOPNOTSUPP;
} else if ((msg[0].addr == state->af9033_config[0].i2c_addr) ||
(msg[0].addr == state->af9033_config[1].i2c_addr)) {
- /* integrated demod */
+ /* demod access via firmware interface */
u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 |
msg[0].buf[2];
- if (state->af9033_config[1].i2c_addr &&
- (msg[0].addr == state->af9033_config[1].i2c_addr))
+
+ if (msg[0].addr == state->af9033_config[1].i2c_addr)
reg |= 0x100000;
+
ret = af9035_rd_regs(d, reg, &msg[1].buf[0],
msg[1].len);
} else {
@@ -226,7 +227,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
buf, msg[1].len, msg[1].buf };
req.mbox |= ((msg[0].addr & 0x80) >> 3);
buf[0] = msg[1].len;
- buf[1] = (u8)(msg[0].addr << 1);
+ buf[1] = msg[0].addr << 1;
buf[2] = 0x00; /* reg addr len */
buf[3] = 0x00; /* reg addr MSB */
buf[4] = 0x00; /* reg addr LSB */
@@ -239,12 +240,13 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
ret = -EOPNOTSUPP;
} else if ((msg[0].addr == state->af9033_config[0].i2c_addr) ||
(msg[0].addr == state->af9033_config[1].i2c_addr)) {
- /* integrated demod */
+ /* demod access via firmware interface */
u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 |
msg[0].buf[2];
- if (state->af9033_config[1].i2c_addr &&
- (msg[0].addr == state->af9033_config[1].i2c_addr))
+
+ if (msg[0].addr == state->af9033_config[1].i2c_addr)
reg |= 0x100000;
+
ret = af9035_wr_regs(d, reg, &msg[0].buf[3],
msg[0].len - 3);
} else {
@@ -254,7 +256,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap,
0, NULL };
req.mbox |= ((msg[0].addr & 0x80) >> 3);
buf[0] = msg[0].len;
- buf[1] = (u8)(msg[0].addr << 1);
+ buf[1] = msg[0].addr << 1;
buf[2] = 0x00; /* reg addr len */
buf[3] = 0x00; /* reg addr MSB */
buf[4] = 0x00; /* reg addr LSB */
@@ -293,30 +295,9 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
int ret;
u8 wbuf[1] = { 1 };
u8 rbuf[4];
- u8 tmp;
struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf,
sizeof(rbuf), rbuf };
- /* check if there is dual tuners */
- ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
- if (ret < 0)
- goto err;
-
- if (tmp) {
- /* read 2nd demodulator I2C address */
- ret = af9035_rd_reg(d, EEPROM_2WIREADDR, &tmp);
- if (ret < 0)
- goto err;
-
- ret = af9035_wr_reg(d, 0x00417f, tmp);
- if (ret < 0)
- goto err;
-
- ret = af9035_wr_reg(d, 0x00d81a, 1);
- if (ret < 0)
- goto err;
- }
-
ret = af9035_ctrl_msg(d, &req);
if (ret < 0)
goto err;
@@ -344,12 +325,57 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
struct usb_req req = { 0, 0, 0, NULL, 0, NULL };
struct usb_req req_fw_dl = { CMD_FW_DL, 0, 0, wbuf, 0, NULL };
struct usb_req req_fw_ver = { CMD_FW_QUERYINFO, 0, 1, wbuf, 4, rbuf } ;
- u8 hdr_core;
+ u8 hdr_core, tmp;
u16 hdr_addr, hdr_data_len, hdr_checksum;
#define MAX_DATA 58
#define HDR_SIZE 7
/*
+ * In case of dual tuner configuration we need to do some extra
+ * initialization in order to download firmware to slave demod too,
+ * which is done by master demod.
+ * Master feeds also clock and controls power via GPIO.
+ */
+ ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
+ if (ret < 0)
+ goto err;
+
+ if (tmp) {
+ /* configure gpioh1, reset & power slave demod */
+ ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg_mask(d, 0x00d8b1, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg_mask(d, 0x00d8af, 0x00, 0x01);
+ if (ret < 0)
+ goto err;
+
+ usleep_range(10000, 50000);
+
+ ret = af9035_wr_reg_mask(d, 0x00d8af, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+
+ /* tell the slave I2C address */
+ ret = af9035_rd_reg(d, EEPROM_2ND_DEMOD_ADDR, &tmp);
+ if (ret < 0)
+ goto err;
+
+ ret = af9035_wr_reg(d, 0x00417f, tmp);
+ if (ret < 0)
+ goto err;
+
+ /* enable clock out */
+ ret = af9035_wr_reg_mask(d, 0x00d81a, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+ }
+
+ /*
* Thanks to Daniel Glöckner <daniel-gl@gmx.net> about that info!
*
* byte 0: MCS 51 core
@@ -520,22 +546,27 @@ static int af9035_read_config(struct dvb_usb_device *d)
u8 tmp;
u16 tmp16;
+ /* demod I2C "address" */
+ state->af9033_config[0].i2c_addr = 0x38;
+
/* check if there is dual tuners */
ret = af9035_rd_reg(d, EEPROM_DUAL_MODE, &tmp);
if (ret < 0)
goto err;
state->dual_mode = tmp;
- dev_dbg(&d->udev->dev, "%s: dual mode=%d\n",
- __func__, state->dual_mode);
+ dev_dbg(&d->udev->dev, "%s: dual mode=%d\n", __func__,
+ state->dual_mode);
if (state->dual_mode) {
/* read 2nd demodulator I2C address */
- ret = af9035_rd_reg(d, EEPROM_2WIREADDR, &tmp);
+ ret = af9035_rd_reg(d, EEPROM_2ND_DEMOD_ADDR, &tmp);
if (ret < 0)
goto err;
+
state->af9033_config[1].i2c_addr = tmp;
- pr_debug("%s: 2nd demod I2C addr:%02x\n", __func__, tmp);
+ dev_dbg(&d->udev->dev, "%s: 2nd demod I2C addr=%02x\n",
+ __func__, tmp);
}
for (i = 0; i < state->dual_mode + 1; i++) {
@@ -563,6 +594,16 @@ static int af9035_read_config(struct dvb_usb_device *d)
KBUILD_MODNAME, tmp);
}
+ /* disable dual mode if driver does not support it */
+ if (i == 1)
+ switch (tmp) {
+ default:
+ state->dual_mode = false;
+ dev_info(&d->udev->dev, "%s: driver does not " \
+ "support 2nd tuner and will " \
+ "disable it", KBUILD_MODNAME);
+ }
+
/* tuner IF frequency */
ret = af9035_rd_reg(d, EEPROM_1_IFFREQ_L + eeprom_shift, &tmp);
if (ret < 0)
@@ -798,15 +839,14 @@ static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
if (ret < 0)
goto err;
- ret = af9035_wr_reg(d, 0x00d81a,
- state->dual_mode);
+ ret = af9035_wr_reg(d, 0x00d81a, state->dual_mode);
if (ret < 0)
goto err;
}
/* attach demodulator */
- adap->fe[0] = dvb_attach(af9033_attach,
- &state->af9033_config[adap->id], &d->i2c_adap);
+ adap->fe[0] = dvb_attach(af9033_attach, &state->af9033_config[adap->id],
+ &d->i2c_adap);
if (adap->fe[0] == NULL) {
ret = -ENODEV;
goto err;
@@ -866,6 +906,11 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
struct dvb_usb_device *d = adap_to_d(adap);
int ret;
struct dvb_frontend *fe;
+ u8 tuner_addr;
+ /*
+ * XXX: Hack used in that function: we abuse unused I2C address bit [7]
+ * to carry info about used I2C bus for dual tuner configuration.
+ */
switch (state->af9033_config[adap->id].tuner) {
case AF9033_TUNER_TUA9001:
@@ -898,16 +943,15 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
&d->i2c_adap, &af9035_fc0011_config);
break;
case AF9033_TUNER_MXL5007T:
- state->tuner_address[adap->id] = 0x60;
- /* hack, use b[7] to carry used I2C-bus */
- state->tuner_address[adap->id] |= (adap->id << 7);
if (adap->id == 0) {
ret = af9035_wr_reg(d, 0x00d8e0, 1);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8e1, 1);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8df, 0);
if (ret < 0)
goto err;
@@ -923,27 +967,35 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
ret = af9035_wr_reg(d, 0x00d8c0, 1);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8c1, 1);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8bf, 0);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8b4, 1);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8b5, 1);
if (ret < 0)
goto err;
+
ret = af9035_wr_reg(d, 0x00d8b3, 1);
if (ret < 0)
goto err;
+
+ tuner_addr = 0x60;
+ } else {
+ tuner_addr = 0x60 | 0x80; /* I2C bus hack */
}
/* attach tuner */
- fe = dvb_attach(mxl5007t_attach, adap->fe[0],
- &d->i2c_adap, state->tuner_address[adap->id],
- &af9035_mxl5007t_config[adap->id]);
+ fe = dvb_attach(mxl5007t_attach, adap->fe[0], &d->i2c_adap,
+ tuner_addr, &af9035_mxl5007t_config[adap->id]);
break;
case AF9033_TUNER_TDA18218:
/* attach tuner */
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
index e26e04d..29f3eec 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -54,10 +54,7 @@ struct usb_req {
struct state {
u8 seq; /* packet sequence number */
bool dual_mode;
-
struct af9033_config af9033_config[2];
-
- u8 tuner_address[2];
};
u32 clock_lut[] = {
@@ -94,7 +91,7 @@ u32 clock_lut_it9135[] = {
/* EEPROM locations */
#define EEPROM_IR_MODE 0x430d
#define EEPROM_DUAL_MODE 0x4326
-#define EEPROM_2WIREADDR 0x4327
+#define EEPROM_2ND_DEMOD_ADDR 0x4327
#define EEPROM_IR_TYPE 0x4329
#define EEPROM_1_IFFREQ_L 0x432d
#define EEPROM_1_IFFREQ_H 0x432e
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 05/17] fc0012: use struct for driver config
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (2 preceding siblings ...)
2012-12-09 19:56 ` =?y?q?=5BPATCH=20RFC=2004/17=5D=20af9035=3A=20dual=20mode=20related=20changes?= Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2013-01-01 21:54 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 06/17] fc0012: add RF loop through Antti Palosaari
` (11 subsequent siblings)
15 siblings, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
I need even more configuration options and overloading dvb_attach()
for all those sounds quite stupid. Due to that switch struct and make
room for new options.
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012.c | 9 ++++-----
drivers/media/tuners/fc0012.h | 20 ++++++++++++++++----
drivers/media/usb/dvb-usb-v2/af9035.c | 10 ++++++++--
drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 7 ++++++-
4 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 308135a..5ede0c0 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -436,8 +436,7 @@ static const struct dvb_tuner_ops fc0012_tuner_ops = {
};
struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
- struct i2c_adapter *i2c, u8 i2c_address, int dual_master,
- enum fc001x_xtal_freq xtal_freq)
+ struct i2c_adapter *i2c, const struct fc0012_config *cfg)
{
struct fc0012_priv *priv = NULL;
@@ -446,9 +445,9 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
return NULL;
priv->i2c = i2c;
- priv->dual_master = dual_master;
- priv->addr = i2c_address;
- priv->xtal_freq = xtal_freq;
+ priv->dual_master = cfg->dual_master;
+ priv->addr = cfg->i2c_address;
+ priv->xtal_freq = cfg->xtal_freq;
info("Fitipower FC0012 successfully attached.");
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
index 4dbd5ef..41946f8 100644
--- a/drivers/media/tuners/fc0012.h
+++ b/drivers/media/tuners/fc0012.h
@@ -24,17 +24,29 @@
#include "dvb_frontend.h"
#include "fc001x-common.h"
+struct fc0012_config {
+ /*
+ * I2C address
+ */
+ u8 i2c_address;
+
+ /*
+ * clock
+ */
+ enum fc001x_xtal_freq xtal_freq;
+
+ int dual_master;
+};
+
#if defined(CONFIG_MEDIA_TUNER_FC0012) || \
(defined(CONFIG_MEDIA_TUNER_FC0012_MODULE) && defined(MODULE))
extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
- u8 i2c_address, int dual_master,
- enum fc001x_xtal_freq xtal_freq);
+ const struct fc0012_config *cfg);
#else
static inline struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
- u8 i2c_address, int dual_master,
- enum fc001x_xtal_freq xtal_freq)
+ const struct fc0012_config *cfg)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index d1beb7f..6cf9ad5 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -900,6 +900,12 @@ static const struct fc2580_config af9035_fc2580_config = {
.clock = 16384000,
};
+static const struct fc0012_config af9035_fc0012_config = {
+ .i2c_address = 0x63,
+ .xtal_freq = FC_XTAL_36_MHZ,
+ .dual_master = 1,
+};
+
static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
{
struct state *state = adap_to_priv(adap);
@@ -1043,8 +1049,8 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
usleep_range(10000, 50000);
- fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, 0x63,
- 1, FC_XTAL_36_MHZ);
+ fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap,
+ &af9035_fc0012_config);
break;
default:
fe = NULL;
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index a4c302d..eddda69 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -835,6 +835,11 @@ static struct tua9001_config rtl2832u_tua9001_config = {
.i2c_addr = 0x60,
};
+static const struct fc0012_config rtl2832u_fc0012_config = {
+ .i2c_address = 0x63, /* 0xc6 >> 1 */
+ .xtal_freq = FC_XTAL_28_8_MHZ,
+};
+
static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
{
int ret;
@@ -847,7 +852,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
switch (priv->tuner) {
case TUNER_RTL2832_FC0012:
fe = dvb_attach(fc0012_attach, adap->fe[0],
- &d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
+ &d->i2c_adap, &rtl2832u_fc0012_config);
/* since fc0012 includs reading the signal strength delegate
* that to the tuner driver */
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 06/17] fc0012: add RF loop through
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (3 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 05/17] fc0012: use struct for driver config Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 07/17] fc0012: enable clock output on attach() Antti Palosaari
` (10 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012-priv.h | 1 +
drivers/media/tuners/fc0012.c | 7 +++++++
drivers/media/tuners/fc0012.h | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/drivers/media/tuners/fc0012-priv.h b/drivers/media/tuners/fc0012-priv.h
index 4577c91..1195ee9 100644
--- a/drivers/media/tuners/fc0012-priv.h
+++ b/drivers/media/tuners/fc0012-priv.h
@@ -32,6 +32,7 @@
struct fc0012_priv {
struct i2c_adapter *i2c;
+ const struct fc0012_config *cfg;
u8 addr;
u8 dual_master;
u8 xtal_freq;
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 5ede0c0..636f951 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -101,6 +101,9 @@ static int fc0012_init(struct dvb_frontend *fe)
if (priv->dual_master)
reg[0x0c] |= 0x02;
+ if (priv->cfg->loop_through)
+ reg[0x09] |= 0x01;
+
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */
@@ -445,6 +448,7 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
return NULL;
priv->i2c = i2c;
+ priv->cfg = cfg;
priv->dual_master = cfg->dual_master;
priv->addr = cfg->i2c_address;
priv->xtal_freq = cfg->xtal_freq;
@@ -453,6 +457,9 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
fe->tuner_priv = priv;
+ if (priv->cfg->loop_through)
+ fc0012_writereg(priv, 0x09, 0x6f);
+
memcpy(&fe->ops.tuner_ops, &fc0012_tuner_ops,
sizeof(struct dvb_tuner_ops));
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
index 41946f8..891d66d 100644
--- a/drivers/media/tuners/fc0012.h
+++ b/drivers/media/tuners/fc0012.h
@@ -36,6 +36,11 @@ struct fc0012_config {
enum fc001x_xtal_freq xtal_freq;
int dual_master;
+
+ /*
+ * RF loop-through
+ */
+ bool loop_through;
};
#if defined(CONFIG_MEDIA_TUNER_FC0012) || \
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 07/17] fc0012: enable clock output on attach()
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (4 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 06/17] fc0012: add RF loop through Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 08/17] af9035: add support for fc0012 dual tuner configuration Antti Palosaari
` (9 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
We need feed clock to slave demodulator at the very beginning
in case of dual tuner configuration.
I am not sure if that configuration changes clock output divider
or enable clock output itself...
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012.c | 7 +++++++
drivers/media/tuners/fc0012.h | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 636f951..1a52b76 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -460,6 +460,13 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
if (priv->cfg->loop_through)
fc0012_writereg(priv, 0x09, 0x6f);
+ /*
+ * TODO: Clock out en or div?
+ * For dual tuner configuration clearing bit [0] is required.
+ */
+ if (priv->cfg->clock_out)
+ fc0012_writereg(priv, 0x0b, 0x82);
+
memcpy(&fe->ops.tuner_ops, &fc0012_tuner_ops,
sizeof(struct dvb_tuner_ops));
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
index 891d66d..83a98e7 100644
--- a/drivers/media/tuners/fc0012.h
+++ b/drivers/media/tuners/fc0012.h
@@ -41,6 +41,11 @@ struct fc0012_config {
* RF loop-through
*/
bool loop_through;
+
+ /*
+ * clock output
+ */
+ bool clock_out;
};
#if defined(CONFIG_MEDIA_TUNER_FC0012) || \
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 08/17] af9035: add support for fc0012 dual tuner configuration
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (5 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 07/17] fc0012: enable clock output on attach() Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 09/17] fc0012: use config directly from the config struct Antti Palosaari
` (8 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
That adds support for AF9035 dual devices having FC0012 tuners.
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/usb/dvb-usb-v2/af9035.c | 56 +++++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 15 deletions(-)
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 6cf9ad5..1c7fe5a 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -597,6 +597,8 @@ static int af9035_read_config(struct dvb_usb_device *d)
/* disable dual mode if driver does not support it */
if (i == 1)
switch (tmp) {
+ case AF9033_TUNER_FC0012:
+ break;
default:
state->dual_mode = false;
dev_info(&d->udev->dev, "%s: driver does not " \
@@ -900,10 +902,18 @@ static const struct fc2580_config af9035_fc2580_config = {
.clock = 16384000,
};
-static const struct fc0012_config af9035_fc0012_config = {
- .i2c_address = 0x63,
- .xtal_freq = FC_XTAL_36_MHZ,
- .dual_master = 1,
+static const struct fc0012_config af9035_fc0012_config[] = {
+ {
+ .i2c_address = 0x63,
+ .xtal_freq = FC_XTAL_36_MHZ,
+ .dual_master = 1,
+ .loop_through = true,
+ .clock_out = true,
+ }, {
+ .i2c_address = 0x63 | 0x80, /* I2C bus select hack */
+ .xtal_freq = FC_XTAL_36_MHZ,
+ .dual_master = 1,
+ }
};
static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
@@ -912,6 +922,7 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
struct dvb_usb_device *d = adap_to_d(adap);
int ret;
struct dvb_frontend *fe;
+ struct i2c_msg msg[1];
u8 tuner_addr;
/*
* XXX: Hack used in that function: we abuse unused I2C address bit [7]
@@ -1034,23 +1045,38 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
* my test I didn't find any difference.
*/
- /* configure gpiot2 as output and high */
- ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01);
- if (ret < 0)
- goto err;
+ if (adap->id == 0) {
+ /* configure gpiot2 as output and high */
+ ret = af9035_wr_reg_mask(d, 0xd8eb, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
- ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01);
- if (ret < 0)
- goto err;
+ ret = af9035_wr_reg_mask(d, 0xd8ec, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
- ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01);
- if (ret < 0)
- goto err;
+ ret = af9035_wr_reg_mask(d, 0xd8ed, 0x01, 0x01);
+ if (ret < 0)
+ goto err;
+ } else {
+ /*
+ * FIXME: That belongs for the FC0012 driver.
+ * Write 02 to FC0012 master tuner register 0d directly
+ * in order to make slave tuner working.
+ */
+ msg[0].addr = 0x63;
+ msg[0].flags = 0;
+ msg[0].len = 2;
+ msg[0].buf = "\x0d\x02";
+ ret = i2c_transfer(&d->i2c_adap, msg, 1);
+ if (ret < 0)
+ goto err;
+ }
usleep_range(10000, 50000);
fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap,
- &af9035_fc0012_config);
+ &af9035_fc0012_config[adap->id]);
break;
default:
fe = NULL;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 09/17] fc0012: use config directly from the config struct
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (6 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 08/17] af9035: add support for fc0012 dual tuner configuration Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 10/17] fc0012: rework attach() to check chip id and I/O errors Antti Palosaari
` (7 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
No need to copy config to the driver state. Those are coming from
the const struct and could be used directly.
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012-priv.h | 3 ---
drivers/media/tuners/fc0012.c | 17 ++++++++---------
drivers/media/tuners/fc0012.h | 2 +-
drivers/media/usb/dvb-usb-v2/af9035.c | 4 ++--
4 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/media/tuners/fc0012-priv.h b/drivers/media/tuners/fc0012-priv.h
index 1195ee9..3b98bf9 100644
--- a/drivers/media/tuners/fc0012-priv.h
+++ b/drivers/media/tuners/fc0012-priv.h
@@ -33,9 +33,6 @@
struct fc0012_priv {
struct i2c_adapter *i2c;
const struct fc0012_config *cfg;
- u8 addr;
- u8 dual_master;
- u8 xtal_freq;
u32 frequency;
u32 bandwidth;
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 1a52b76..01f5e40 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -25,7 +25,7 @@ static int fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val)
{
u8 buf[2] = {reg, val};
struct i2c_msg msg = {
- .addr = priv->addr, .flags = 0, .buf = buf, .len = 2
+ .addr = priv->cfg->i2c_address, .flags = 0, .buf = buf, .len = 2
};
if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
@@ -38,8 +38,10 @@ static int fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val)
static int fc0012_readreg(struct fc0012_priv *priv, u8 reg, u8 *val)
{
struct i2c_msg msg[2] = {
- { .addr = priv->addr, .flags = 0, .buf = ®, .len = 1 },
- { .addr = priv->addr, .flags = I2C_M_RD, .buf = val, .len = 1 },
+ { .addr = priv->cfg->i2c_address, .flags = 0,
+ .buf = ®, .len = 1 },
+ { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD,
+ .buf = val, .len = 1 },
};
if (i2c_transfer(priv->i2c, msg, 2) != 2) {
@@ -88,7 +90,7 @@ static int fc0012_init(struct dvb_frontend *fe)
0x04, /* reg. 0x15: Enable LNA COMPS */
};
- switch (priv->xtal_freq) {
+ switch (priv->cfg->xtal_freq) {
case FC_XTAL_27_MHZ:
case FC_XTAL_28_8_MHZ:
reg[0x07] |= 0x20;
@@ -98,7 +100,7 @@ static int fc0012_init(struct dvb_frontend *fe)
break;
}
- if (priv->dual_master)
+ if (priv->cfg->dual_master)
reg[0x0c] |= 0x02;
if (priv->cfg->loop_through)
@@ -147,7 +149,7 @@ static int fc0012_set_params(struct dvb_frontend *fe)
goto exit;
}
- switch (priv->xtal_freq) {
+ switch (priv->cfg->xtal_freq) {
case FC_XTAL_27_MHZ:
xtal_freq_khz_2 = 27000 / 2;
break;
@@ -449,9 +451,6 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
priv->i2c = i2c;
priv->cfg = cfg;
- priv->dual_master = cfg->dual_master;
- priv->addr = cfg->i2c_address;
- priv->xtal_freq = cfg->xtal_freq;
info("Fitipower FC0012 successfully attached.");
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
index 83a98e7..3fb53b8 100644
--- a/drivers/media/tuners/fc0012.h
+++ b/drivers/media/tuners/fc0012.h
@@ -35,7 +35,7 @@ struct fc0012_config {
*/
enum fc001x_xtal_freq xtal_freq;
- int dual_master;
+ bool dual_master;
/*
* RF loop-through
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 1c7fe5a..68e0e804 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -906,13 +906,13 @@ static const struct fc0012_config af9035_fc0012_config[] = {
{
.i2c_address = 0x63,
.xtal_freq = FC_XTAL_36_MHZ,
- .dual_master = 1,
+ .dual_master = true,
.loop_through = true,
.clock_out = true,
}, {
.i2c_address = 0x63 | 0x80, /* I2C bus select hack */
.xtal_freq = FC_XTAL_36_MHZ,
- .dual_master = 1,
+ .dual_master = true,
}
};
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 10/17] fc0012: rework attach() to check chip id and I/O errors
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (7 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 09/17] fc0012: use config directly from the config struct Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 11/17] fc0012: use Kernel dev_foo() logging Antti Palosaari
` (6 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012.c | 59 +++++++++++++++++++++++++++++++++++--------
1 file changed, 49 insertions(+), 10 deletions(-)
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 01f5e40..feb1594 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -443,32 +443,71 @@ static const struct dvb_tuner_ops fc0012_tuner_ops = {
struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, const struct fc0012_config *cfg)
{
- struct fc0012_priv *priv = NULL;
+ struct fc0012_priv *priv;
+ int ret;
+ u8 chip_id;
+
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
priv = kzalloc(sizeof(struct fc0012_priv), GFP_KERNEL);
- if (priv == NULL)
- return NULL;
+ if (!priv) {
+ ret = -ENOMEM;
+ dev_err(&i2c->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME);
+ goto err;
+ }
- priv->i2c = i2c;
priv->cfg = cfg;
+ priv->i2c = i2c;
- info("Fitipower FC0012 successfully attached.");
+ /* check if the tuner is there */
+ ret = fc0012_readreg(priv, 0x00, &chip_id);
+ if (ret < 0)
+ goto err;
- fe->tuner_priv = priv;
+ dev_dbg(&i2c->dev, "%s: chip_id=%02x\n", __func__, chip_id);
- if (priv->cfg->loop_through)
- fc0012_writereg(priv, 0x09, 0x6f);
+ switch (chip_id) {
+ case 0xa1:
+ break;
+ default:
+ ret = -ENODEV;
+ goto err;
+ }
+
+ dev_info(&i2c->dev, "%s: Fitipower FC0012 successfully identified\n",
+ KBUILD_MODNAME);
+
+ if (priv->cfg->loop_through) {
+ ret = fc0012_writereg(priv, 0x09, 0x6f);
+ if (ret < 0)
+ goto err;
+ }
/*
* TODO: Clock out en or div?
* For dual tuner configuration clearing bit [0] is required.
*/
- if (priv->cfg->clock_out)
- fc0012_writereg(priv, 0x0b, 0x82);
+ if (priv->cfg->clock_out) {
+ ret = fc0012_writereg(priv, 0x0b, 0x82);
+ if (ret < 0)
+ goto err;
+ }
+ fe->tuner_priv = priv;
memcpy(&fe->ops.tuner_ops, &fc0012_tuner_ops,
sizeof(struct dvb_tuner_ops));
+err:
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 0);
+
+ if (ret) {
+ dev_dbg(&i2c->dev, "%s: failed: %d\n", __func__, ret);
+ kfree(priv);
+ return NULL;
+ }
+
return fe;
}
EXPORT_SYMBOL(fc0012_attach);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 11/17] fc0012: use Kernel dev_foo() logging
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (8 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 10/17] fc0012: rework attach() to check chip id and I/O errors Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 12/17] fc0012: remove unused callback and correct one comment Antti Palosaari
` (5 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012-priv.h | 9 ---------
drivers/media/tuners/fc0012.c | 20 ++++++++++++++------
drivers/media/tuners/fc0012.h | 2 +-
3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/media/tuners/fc0012-priv.h b/drivers/media/tuners/fc0012-priv.h
index 3b98bf9..1a86ce1 100644
--- a/drivers/media/tuners/fc0012-priv.h
+++ b/drivers/media/tuners/fc0012-priv.h
@@ -21,15 +21,6 @@
#ifndef _FC0012_PRIV_H_
#define _FC0012_PRIV_H_
-#define LOG_PREFIX "fc0012"
-
-#undef err
-#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
-#undef info
-#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
-#undef warn
-#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
-
struct fc0012_priv {
struct i2c_adapter *i2c;
const struct fc0012_config *cfg;
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index feb1594..4491f06 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -29,7 +29,9 @@ static int fc0012_writereg(struct fc0012_priv *priv, u8 reg, u8 val)
};
if (i2c_transfer(priv->i2c, &msg, 1) != 1) {
- err("I2C write reg failed, reg: %02x, val: %02x", reg, val);
+ dev_err(&priv->i2c->dev,
+ "%s: I2C write reg failed, reg: %02x, val: %02x\n",
+ KBUILD_MODNAME, reg, val);
return -EREMOTEIO;
}
return 0;
@@ -45,7 +47,9 @@ static int fc0012_readreg(struct fc0012_priv *priv, u8 reg, u8 *val)
};
if (i2c_transfer(priv->i2c, msg, 2) != 2) {
- err("I2C read reg failed, reg: %02x", reg);
+ dev_err(&priv->i2c->dev,
+ "%s: I2C read reg failed, reg: %02x\n",
+ KBUILD_MODNAME, reg);
return -EREMOTEIO;
}
return 0;
@@ -119,7 +123,8 @@ static int fc0012_init(struct dvb_frontend *fe)
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
if (ret)
- err("fc0012_writereg failed: %d", ret);
+ dev_err(&priv->i2c->dev, "%s: fc0012_writereg failed: %d\n",
+ KBUILD_MODNAME, ret);
return ret;
}
@@ -261,7 +266,8 @@ static int fc0012_set_params(struct dvb_frontend *fe)
break;
}
} else {
- err("%s: modulation type not supported!", __func__);
+ dev_err(&priv->i2c->dev, "%s: modulation type not supported!\n",
+ KBUILD_MODNAME);
return -EINVAL;
}
@@ -323,7 +329,8 @@ exit:
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
if (ret)
- warn("%s: failed: %d", __func__, ret);
+ dev_warn(&priv->i2c->dev, "%s: %s failed: %d\n",
+ KBUILD_MODNAME, __func__, ret);
return ret;
}
@@ -413,7 +420,8 @@ err:
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
exit:
if (ret)
- warn("%s: failed: %d", __func__, ret);
+ dev_warn(&priv->i2c->dev, "%s: %s failed: %d\n",
+ KBUILD_MODNAME, __func__, ret);
return ret;
}
diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
index 3fb53b8..54508fc 100644
--- a/drivers/media/tuners/fc0012.h
+++ b/drivers/media/tuners/fc0012.h
@@ -58,7 +58,7 @@ static inline struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c,
const struct fc0012_config *cfg)
{
- printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
+ pr_warn("%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 12/17] fc0012: remove unused callback and correct one comment
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (9 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 11/17] fc0012: use Kernel dev_foo() logging Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 13/17] af9033: update demod init sequence Antti Palosaari
` (4 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari, Hans-Frieder Vogt
There is no need to keep dummy sleep() callback implementation as
DVB-core checks existence of it before calls callback. Due to that
we can remove it.
FC0012 is based of direct-conversion receiver architecture
(aka Zero-IF) where is no IF used. Due to that IF is always 0 Hz.
Fix comment to point that.
Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/tuners/fc0012.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index 4491f06..f4d0e79 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -129,12 +129,6 @@ static int fc0012_init(struct dvb_frontend *fe)
return ret;
}
-static int fc0012_sleep(struct dvb_frontend *fe)
-{
- /* nothing to do here */
- return 0;
-}
-
static int fc0012_set_params(struct dvb_frontend *fe)
{
struct fc0012_priv *priv = fe->tuner_priv;
@@ -343,8 +337,7 @@ static int fc0012_get_frequency(struct dvb_frontend *fe, u32 *frequency)
static int fc0012_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
{
- /* CHECK: always ? */
- *frequency = 0;
+ *frequency = 0; /* Zero-IF */
return 0;
}
@@ -437,7 +430,6 @@ static const struct dvb_tuner_ops fc0012_tuner_ops = {
.release = fc0012_release,
.init = fc0012_init,
- .sleep = fc0012_sleep,
.set_params = fc0012_set_params,
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 13/17] af9033: update demod init sequence
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (10 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 12/17] fc0012: remove unused callback and correct one comment Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 14/17] af9033: update tua9001 " Antti Palosaari
` (3 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033_priv.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
index 288cd45..d96d128 100644
--- a/drivers/media/dvb-frontends/af9033_priv.h
+++ b/drivers/media/dvb-frontends/af9033_priv.h
@@ -199,10 +199,9 @@ static const struct reg_val ofsm_init[] = {
{ 0x8000a6, 0x01 },
{ 0x8000a9, 0x00 },
{ 0x8000aa, 0x01 },
- { 0x8000ab, 0x01 },
{ 0x8000b0, 0x01 },
- { 0x8000c0, 0x05 },
- { 0x8000c4, 0x19 },
+ { 0x8000c4, 0x05 },
+ { 0x8000c8, 0x19 },
{ 0x80f000, 0x0f },
{ 0x80f016, 0x10 },
{ 0x80f017, 0x04 },
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 14/17] af9033: update tua9001 init sequence
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (11 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 13/17] af9033: update demod init sequence Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 15/17] af9033: update fc0011 " Antti Palosaari
` (2 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033_priv.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
index d96d128..e0be040 100644
--- a/drivers/media/dvb-frontends/af9033_priv.h
+++ b/drivers/media/dvb-frontends/af9033_priv.h
@@ -321,8 +321,9 @@ static const struct reg_val tuner_init_tua9001[] = {
{ 0x80009b, 0x05 },
{ 0x80009c, 0x80 },
{ 0x8000b3, 0x00 },
- { 0x8000c1, 0x01 },
- { 0x8000c2, 0x00 },
+ { 0x8000c5, 0x01 },
+ { 0x8000c6, 0x00 },
+ { 0x8000c9, 0x5d },
{ 0x80f007, 0x00 },
{ 0x80f01f, 0x82 },
{ 0x80f020, 0x00 },
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 15/17] af9033: update fc0011 init sequence
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (12 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 14/17] af9033: update tua9001 " Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 16/17] af9033: update fc2580 " Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 17/17] af9035: print warning when firmware is bad Antti Palosaari
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033_priv.h | 72 +++++++++++++++----------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
index e0be040..1fb84a2 100644
--- a/drivers/media/dvb-frontends/af9033_priv.h
+++ b/drivers/media/dvb-frontends/af9033_priv.h
@@ -339,14 +339,14 @@ static const struct reg_val tuner_init_tua9001[] = {
/* Fitipower fc0011 tuner init
AF9033_TUNER_FC0011 = 0x28 */
static const struct reg_val tuner_init_fc0011[] = {
- { 0x800046, AF9033_TUNER_FC0011 },
+ { 0x800046, 0x28 },
{ 0x800057, 0x00 },
{ 0x800058, 0x01 },
{ 0x80005f, 0x00 },
{ 0x800060, 0x00 },
{ 0x800068, 0xa5 },
{ 0x80006e, 0x01 },
- { 0x800071, 0x0A },
+ { 0x800071, 0x0a },
{ 0x800072, 0x02 },
{ 0x800074, 0x01 },
{ 0x800079, 0x01 },
@@ -354,7 +354,7 @@ static const struct reg_val tuner_init_fc0011[] = {
{ 0x800094, 0x00 },
{ 0x800095, 0x00 },
{ 0x800096, 0x00 },
- { 0x80009b, 0x2D },
+ { 0x80009b, 0x2d },
{ 0x80009c, 0x60 },
{ 0x80009d, 0x23 },
{ 0x8000a4, 0x50 },
@@ -362,39 +362,39 @@ static const struct reg_val tuner_init_fc0011[] = {
{ 0x8000b3, 0x01 },
{ 0x8000b7, 0x88 },
{ 0x8000b8, 0xa6 },
- { 0x8000c3, 0x01 },
- { 0x8000c4, 0x01 },
- { 0x8000c7, 0x69 },
- { 0x80F007, 0x00 },
- { 0x80F00A, 0x1B },
- { 0x80F00B, 0x1B },
- { 0x80F00C, 0x1B },
- { 0x80F00D, 0x1B },
- { 0x80F00E, 0xFF },
- { 0x80F00F, 0x01 },
- { 0x80F010, 0x00 },
- { 0x80F011, 0x02 },
- { 0x80F012, 0xFF },
- { 0x80F013, 0x01 },
- { 0x80F014, 0x00 },
- { 0x80F015, 0x02 },
- { 0x80F01B, 0xEF },
- { 0x80F01C, 0x01 },
- { 0x80F01D, 0x0f },
- { 0x80F01E, 0x02 },
- { 0x80F01F, 0x6E },
- { 0x80F020, 0x00 },
- { 0x80F025, 0xDE },
- { 0x80F026, 0x00 },
- { 0x80F027, 0x0A },
- { 0x80F028, 0x03 },
- { 0x80F029, 0x6E },
- { 0x80F02A, 0x00 },
- { 0x80F047, 0x00 },
- { 0x80F054, 0x00 },
- { 0x80F055, 0x00 },
- { 0x80F077, 0x01 },
- { 0x80F1E6, 0x00 },
+ { 0x8000c5, 0x01 },
+ { 0x8000c6, 0x01 },
+ { 0x8000c9, 0x69 },
+ { 0x80f007, 0x00 },
+ { 0x80f00a, 0x1b },
+ { 0x80f00b, 0x1b },
+ { 0x80f00c, 0x1b },
+ { 0x80f00d, 0x1b },
+ { 0x80f00e, 0xff },
+ { 0x80f00f, 0x01 },
+ { 0x80f010, 0x00 },
+ { 0x80f011, 0x02 },
+ { 0x80f012, 0xff },
+ { 0x80f013, 0x01 },
+ { 0x80f014, 0x00 },
+ { 0x80f015, 0x02 },
+ { 0x80f01b, 0xef },
+ { 0x80f01c, 0x01 },
+ { 0x80f01d, 0x0f },
+ { 0x80f01e, 0x02 },
+ { 0x80f01f, 0x6e },
+ { 0x80f020, 0x00 },
+ { 0x80f025, 0xde },
+ { 0x80f026, 0x00 },
+ { 0x80f027, 0x0a },
+ { 0x80f028, 0x03 },
+ { 0x80f029, 0x6e },
+ { 0x80f02a, 0x00 },
+ { 0x80f047, 0x00 },
+ { 0x80f054, 0x00 },
+ { 0x80f055, 0x00 },
+ { 0x80f077, 0x01 },
+ { 0x80f1e6, 0x00 },
};
/* Fitipower FC0012 tuner init
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 16/17] af9033: update fc2580 init sequence
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (13 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 15/17] af9033: update fc0011 " Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 17/17] af9035: print warning when firmware is bad Antti Palosaari
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/dvb-frontends/af9033_priv.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h
index 1fb84a2..e9bd782 100644
--- a/drivers/media/dvb-frontends/af9033_priv.h
+++ b/drivers/media/dvb-frontends/af9033_priv.h
@@ -525,11 +525,12 @@ static const struct reg_val tuner_init_fc2580[] = {
{ 0x800095, 0x00 },
{ 0x800096, 0x05 },
{ 0x8000b3, 0x01 },
- { 0x8000c3, 0x01 },
- { 0x8000c4, 0x00 },
+ { 0x8000c5, 0x01 },
+ { 0x8000c6, 0x00 },
+ { 0x8000d1, 0x01 },
{ 0x80f007, 0x00 },
{ 0x80f00c, 0x19 },
- { 0x80f00d, 0x1A },
+ { 0x80f00d, 0x1a },
{ 0x80f00e, 0x00 },
{ 0x80f00f, 0x02 },
{ 0x80f010, 0x00 },
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 17/17] af9035: print warning when firmware is bad
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
` (14 preceding siblings ...)
2012-12-09 19:56 ` [PATCH RFC 16/17] af9033: update fc2580 " Antti Palosaari
@ 2012-12-09 19:56 ` Antti Palosaari
15 siblings, 0 replies; 19+ messages in thread
From: Antti Palosaari @ 2012-12-09 19:56 UTC (permalink / raw)
To: linux-media; +Cc: Antti Palosaari
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
drivers/media/usb/dvb-usb-v2/af9035.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 68e0e804..ea37b5c 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -437,6 +437,10 @@ static int af9035_download_firmware(struct dvb_usb_device *d,
__func__, fw->size - i);
}
+ /* print warn if firmware is bad, continue and see what happens */
+ if (i)
+ dev_warn(&d->udev->dev, "%s: bad firmware\n", KBUILD_MODNAME);
+
/* firmware loaded, request boot */
req.cmd = CMD_FW_BOOT;
ret = af9035_ctrl_msg(d, &req);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RFC 05/17] fc0012: use struct for driver config
2012-12-09 19:56 ` [PATCH RFC 05/17] fc0012: use struct for driver config Antti Palosaari
@ 2013-01-01 21:54 ` Antti Palosaari
2013-01-02 21:40 ` Hans-Frieder Vogt
0 siblings, 1 reply; 19+ messages in thread
From: Antti Palosaari @ 2013-01-01 21:54 UTC (permalink / raw)
To: Hans-Frieder Vogt; +Cc: linux-media
Hans-Frieder,
Care to ack fc0012 related changes from that patch serie?
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035
6cfc01f fc0012: remove unused callback and correct one comment
2e9fffb fc0012: use Kernel dev_foo() logging
909d2c0 fc0012: rework attach() to check chip id and I/O errors
4a6831e fc0012: use config directly from the config struct
52728ff fc0012: enable clock output on attach()
b6262d2 fc0012: add RF loop through
cb5bd3d fc0012: use struct for driver config
I will pull request these in next days anyway.
regards
Antti
On 12/09/2012 09:56 PM, Antti Palosaari wrote:
> I need even more configuration options and overloading dvb_attach()
> for all those sounds quite stupid. Due to that switch struct and make
> room for new options.
>
> Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
> drivers/media/tuners/fc0012.c | 9 ++++-----
> drivers/media/tuners/fc0012.h | 20 ++++++++++++++++----
> drivers/media/usb/dvb-usb-v2/af9035.c | 10 ++++++++--
> drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 7 ++++++-
> 4 files changed, 34 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
> index 308135a..5ede0c0 100644
> --- a/drivers/media/tuners/fc0012.c
> +++ b/drivers/media/tuners/fc0012.c
> @@ -436,8 +436,7 @@ static const struct dvb_tuner_ops fc0012_tuner_ops = {
> };
>
> struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> - struct i2c_adapter *i2c, u8 i2c_address, int dual_master,
> - enum fc001x_xtal_freq xtal_freq)
> + struct i2c_adapter *i2c, const struct fc0012_config *cfg)
> {
> struct fc0012_priv *priv = NULL;
>
> @@ -446,9 +445,9 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> return NULL;
>
> priv->i2c = i2c;
> - priv->dual_master = dual_master;
> - priv->addr = i2c_address;
> - priv->xtal_freq = xtal_freq;
> + priv->dual_master = cfg->dual_master;
> + priv->addr = cfg->i2c_address;
> + priv->xtal_freq = cfg->xtal_freq;
>
> info("Fitipower FC0012 successfully attached.");
>
> diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h
> index 4dbd5ef..41946f8 100644
> --- a/drivers/media/tuners/fc0012.h
> +++ b/drivers/media/tuners/fc0012.h
> @@ -24,17 +24,29 @@
> #include "dvb_frontend.h"
> #include "fc001x-common.h"
>
> +struct fc0012_config {
> + /*
> + * I2C address
> + */
> + u8 i2c_address;
> +
> + /*
> + * clock
> + */
> + enum fc001x_xtal_freq xtal_freq;
> +
> + int dual_master;
> +};
> +
> #if defined(CONFIG_MEDIA_TUNER_FC0012) || \
> (defined(CONFIG_MEDIA_TUNER_FC0012_MODULE) && defined(MODULE))
> extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> struct i2c_adapter *i2c,
> - u8 i2c_address, int dual_master,
> - enum fc001x_xtal_freq xtal_freq);
> + const struct fc0012_config *cfg);
> #else
> static inline struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> struct i2c_adapter *i2c,
> - u8 i2c_address, int dual_master,
> - enum fc001x_xtal_freq xtal_freq)
> + const struct fc0012_config *cfg)
> {
> printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
> return NULL;
> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
> index d1beb7f..6cf9ad5 100644
> --- a/drivers/media/usb/dvb-usb-v2/af9035.c
> +++ b/drivers/media/usb/dvb-usb-v2/af9035.c
> @@ -900,6 +900,12 @@ static const struct fc2580_config af9035_fc2580_config = {
> .clock = 16384000,
> };
>
> +static const struct fc0012_config af9035_fc0012_config = {
> + .i2c_address = 0x63,
> + .xtal_freq = FC_XTAL_36_MHZ,
> + .dual_master = 1,
> +};
> +
> static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
> {
> struct state *state = adap_to_priv(adap);
> @@ -1043,8 +1049,8 @@ static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
>
> usleep_range(10000, 50000);
>
> - fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, 0x63,
> - 1, FC_XTAL_36_MHZ);
> + fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap,
> + &af9035_fc0012_config);
> break;
> default:
> fe = NULL;
> diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> index a4c302d..eddda69 100644
> --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> @@ -835,6 +835,11 @@ static struct tua9001_config rtl2832u_tua9001_config = {
> .i2c_addr = 0x60,
> };
>
> +static const struct fc0012_config rtl2832u_fc0012_config = {
> + .i2c_address = 0x63, /* 0xc6 >> 1 */
> + .xtal_freq = FC_XTAL_28_8_MHZ,
> +};
> +
> static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
> {
> int ret;
> @@ -847,7 +852,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
> switch (priv->tuner) {
> case TUNER_RTL2832_FC0012:
> fe = dvb_attach(fc0012_attach, adap->fe[0],
> - &d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
> + &d->i2c_adap, &rtl2832u_fc0012_config);
>
> /* since fc0012 includs reading the signal strength delegate
> * that to the tuner driver */
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH RFC 05/17] fc0012: use struct for driver config
2013-01-01 21:54 ` Antti Palosaari
@ 2013-01-02 21:40 ` Hans-Frieder Vogt
0 siblings, 0 replies; 19+ messages in thread
From: Hans-Frieder Vogt @ 2013-01-02 21:40 UTC (permalink / raw)
To: Antti Palosaari; +Cc: linux-media
Hello Antti,
sorry that I didn't react earlier. Your patch series look very good to me. I
am happy to aknowledge it.
Acked-by: Hans-Frieder Vogt <hfvogt@gmx.net>
Am Dienstag, 1. Januar 2013 schrieb Antti Palosaari:
> Hans-Frieder,
> Care to ack fc0012 related changes from that patch serie?
>
> http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/af9035
>
> 6cfc01f fc0012: remove unused callback and correct one comment
> 2e9fffb fc0012: use Kernel dev_foo() logging
> 909d2c0 fc0012: rework attach() to check chip id and I/O errors
> 4a6831e fc0012: use config directly from the config struct
> 52728ff fc0012: enable clock output on attach()
> b6262d2 fc0012: add RF loop through
> cb5bd3d fc0012: use struct for driver config
>
> I will pull request these in next days anyway.
>
> regards
> Antti
>
> On 12/09/2012 09:56 PM, Antti Palosaari wrote:
> > I need even more configuration options and overloading dvb_attach()
> > for all those sounds quite stupid. Due to that switch struct and make
> > room for new options.
> >
> > Cc: Hans-Frieder Vogt <hfvogt@gmx.net>
> > Signed-off-by: Antti Palosaari <crope@iki.fi>
> > ---
> >
> > drivers/media/tuners/fc0012.c | 9 ++++-----
> > drivers/media/tuners/fc0012.h | 20 ++++++++++++++++----
> > drivers/media/usb/dvb-usb-v2/af9035.c | 10 ++++++++--
> > drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 7 ++++++-
> > 4 files changed, 34 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/media/tuners/fc0012.c
> > b/drivers/media/tuners/fc0012.c index 308135a..5ede0c0 100644
> > --- a/drivers/media/tuners/fc0012.c
> > +++ b/drivers/media/tuners/fc0012.c
> > @@ -436,8 +436,7 @@ static const struct dvb_tuner_ops fc0012_tuner_ops =
> > {
> >
> > };
> >
> > struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> >
> > - struct i2c_adapter *i2c, u8 i2c_address, int dual_master,
> > - enum fc001x_xtal_freq xtal_freq)
> > + struct i2c_adapter *i2c, const struct fc0012_config *cfg)
> >
> > {
> >
> > struct fc0012_priv *priv = NULL;
> >
> > @@ -446,9 +445,9 @@ struct dvb_frontend *fc0012_attach(struct
> > dvb_frontend *fe,
> >
> > return NULL;
> >
> > priv->i2c = i2c;
> >
> > - priv->dual_master = dual_master;
> > - priv->addr = i2c_address;
> > - priv->xtal_freq = xtal_freq;
> > + priv->dual_master = cfg->dual_master;
> > + priv->addr = cfg->i2c_address;
> > + priv->xtal_freq = cfg->xtal_freq;
> >
> > info("Fitipower FC0012 successfully attached.");
> >
> > diff --git a/drivers/media/tuners/fc0012.h
> > b/drivers/media/tuners/fc0012.h index 4dbd5ef..41946f8 100644
> > --- a/drivers/media/tuners/fc0012.h
> > +++ b/drivers/media/tuners/fc0012.h
> > @@ -24,17 +24,29 @@
> >
> > #include "dvb_frontend.h"
> > #include "fc001x-common.h"
> >
> > +struct fc0012_config {
> > + /*
> > + * I2C address
> > + */
> > + u8 i2c_address;
> > +
> > + /*
> > + * clock
> > + */
> > + enum fc001x_xtal_freq xtal_freq;
> > +
> > + int dual_master;
> > +};
> > +
> >
> > #if defined(CONFIG_MEDIA_TUNER_FC0012) || \
> >
> > (defined(CONFIG_MEDIA_TUNER_FC0012_MODULE) && defined(MODULE))
> >
> > extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe,
> >
> > struct i2c_adapter *i2c,
> >
> > - u8 i2c_address, int dual_master,
> > - enum fc001x_xtal_freq xtal_freq);
> > + const struct fc0012_config *cfg);
> >
> > #else
> > static inline struct dvb_frontend *fc0012_attach(struct dvb_frontend
> > *fe,
> >
> > struct i2c_adapter *i2c,
> >
> > - u8 i2c_address, int dual_master,
> > - enum fc001x_xtal_freq xtal_freq)
> > + const struct fc0012_config *cfg)
> >
> > {
> >
> > printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
> > return NULL;
> >
> > diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c
> > b/drivers/media/usb/dvb-usb-v2/af9035.c index d1beb7f..6cf9ad5 100644
> > --- a/drivers/media/usb/dvb-usb-v2/af9035.c
> > +++ b/drivers/media/usb/dvb-usb-v2/af9035.c
> > @@ -900,6 +900,12 @@ static const struct fc2580_config
> > af9035_fc2580_config = {
> >
> > .clock = 16384000,
> >
> > };
> >
> > +static const struct fc0012_config af9035_fc0012_config = {
> > + .i2c_address = 0x63,
> > + .xtal_freq = FC_XTAL_36_MHZ,
> > + .dual_master = 1,
> > +};
> > +
> >
> > static int af9035_tuner_attach(struct dvb_usb_adapter *adap)
> > {
> >
> > struct state *state = adap_to_priv(adap);
> >
> > @@ -1043,8 +1049,8 @@ static int af9035_tuner_attach(struct
> > dvb_usb_adapter *adap)
> >
> > usleep_range(10000, 50000);
> >
> > - fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, 0x63,
> > - 1, FC_XTAL_36_MHZ);
> > + fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap,
> > + &af9035_fc0012_config);
> >
> > break;
> >
> > default:
> > fe = NULL;
> >
> > diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> > b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index a4c302d..eddda69 100644
> > --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> > +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
> > @@ -835,6 +835,11 @@ static struct tua9001_config rtl2832u_tua9001_config
> > = {
> >
> > .i2c_addr = 0x60,
> >
> > };
> >
> > +static const struct fc0012_config rtl2832u_fc0012_config = {
> > + .i2c_address = 0x63, /* 0xc6 >> 1 */
> > + .xtal_freq = FC_XTAL_28_8_MHZ,
> > +};
> > +
> >
> > static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
> > {
> >
> > int ret;
> >
> > @@ -847,7 +852,7 @@ static int rtl2832u_tuner_attach(struct
> > dvb_usb_adapter *adap)
> >
> > switch (priv->tuner) {
> >
> > case TUNER_RTL2832_FC0012:
> > fe = dvb_attach(fc0012_attach, adap->fe[0],
> >
> > - &d->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
> > + &d->i2c_adap, &rtl2832u_fc0012_config);
> >
> > /* since fc0012 includs reading the signal strength delegate
> >
> > * that to the tuner driver */
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2013-01-02 21:40 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-09 19:56 [PATCH RFC 01/17] af9033: add support for Fitipower FC0012 tuner Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 02/17] af9035: support for Fitipower FC0012 tuner devices Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 03/17] af9035: dual mode support Antti Palosaari
2012-12-09 19:56 ` =?y?q?=5BPATCH=20RFC=2004/17=5D=20af9035=3A=20dual=20mode=20related=20changes?= Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 05/17] fc0012: use struct for driver config Antti Palosaari
2013-01-01 21:54 ` Antti Palosaari
2013-01-02 21:40 ` Hans-Frieder Vogt
2012-12-09 19:56 ` [PATCH RFC 06/17] fc0012: add RF loop through Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 07/17] fc0012: enable clock output on attach() Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 08/17] af9035: add support for fc0012 dual tuner configuration Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 09/17] fc0012: use config directly from the config struct Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 10/17] fc0012: rework attach() to check chip id and I/O errors Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 11/17] fc0012: use Kernel dev_foo() logging Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 12/17] fc0012: remove unused callback and correct one comment Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 13/17] af9033: update demod init sequence Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 14/17] af9033: update tua9001 " Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 15/17] af9033: update fc0011 " Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 16/17] af9033: update fc2580 " Antti Palosaari
2012-12-09 19:56 ` [PATCH RFC 17/17] af9035: print warning when firmware is bad Antti Palosaari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).