diff options
author | Michael Krufky <mkrufky@kernellabs.com> | 2009-10-23 01:47:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:40:55 -0500 |
commit | 1724c8fa7eb33d68898e060a08a8e6a88348b62f (patch) | |
tree | 456e6ca8cd0c9e6b004f01391b13d28d1337f5bb /drivers/media/common | |
parent | e29cd96715ab8b9315fb50096df4677a23d7d6a7 (diff) |
V4L/DVB (13214): tda18271: allow for i2c buses that cant send 16 bytes at once
There is already an option for sending 16 byte chunks rather that writing
39 bytes all at once during the tuner's initialization. Some i2c buses
can't send 16 bytes at once, so create an option for sending 8 byte chunks.
Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/tda18271-common.c | 16 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271-fe.c | 3 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271-priv.h | 2 | ||||
-rw-r--r-- | drivers/media/common/tuners/tda18271.h | 12 |
4 files changed, 26 insertions, 7 deletions
diff --git a/drivers/media/common/tuners/tda18271-common.c b/drivers/media/common/tuners/tda18271-common.c index 155c93eb75da..e1f678281a58 100644 --- a/drivers/media/common/tuners/tda18271-common.c +++ b/drivers/media/common/tuners/tda18271-common.c | |||
@@ -326,12 +326,24 @@ int tda18271_init_regs(struct dvb_frontend *fe) | |||
326 | regs[R_EB22] = 0x48; | 326 | regs[R_EB22] = 0x48; |
327 | regs[R_EB23] = 0xb0; | 327 | regs[R_EB23] = 0xb0; |
328 | 328 | ||
329 | if (priv->small_i2c) { | 329 | switch (priv->small_i2c) { |
330 | case TDA18271_08_BYTE_CHUNK_INIT: | ||
331 | tda18271_write_regs(fe, 0x00, 0x08); | ||
332 | tda18271_write_regs(fe, 0x08, 0x08); | ||
333 | tda18271_write_regs(fe, 0x10, 0x08); | ||
334 | tda18271_write_regs(fe, 0x18, 0x08); | ||
335 | tda18271_write_regs(fe, 0x20, 0x07); | ||
336 | break; | ||
337 | case TDA18271_16_BYTE_CHUNK_INIT: | ||
330 | tda18271_write_regs(fe, 0x00, 0x10); | 338 | tda18271_write_regs(fe, 0x00, 0x10); |
331 | tda18271_write_regs(fe, 0x10, 0x10); | 339 | tda18271_write_regs(fe, 0x10, 0x10); |
332 | tda18271_write_regs(fe, 0x20, 0x07); | 340 | tda18271_write_regs(fe, 0x20, 0x07); |
333 | } else | 341 | break; |
342 | case TDA18271_39_BYTE_CHUNK_INIT: | ||
343 | default: | ||
334 | tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS); | 344 | tda18271_write_regs(fe, 0x00, TDA18271_NUM_REGS); |
345 | break; | ||
346 | } | ||
335 | 347 | ||
336 | /* setup agc1 gain */ | 348 | /* setup agc1 gain */ |
337 | regs[R_EB17] = 0x00; | 349 | regs[R_EB17] = 0x00; |
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index e0fd9f5d5944..eb7724158861 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -1224,7 +1224,8 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | |||
1224 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; | 1224 | priv->gate = (cfg) ? cfg->gate : TDA18271_GATE_AUTO; |
1225 | priv->role = (cfg) ? cfg->role : TDA18271_MASTER; | 1225 | priv->role = (cfg) ? cfg->role : TDA18271_MASTER; |
1226 | priv->config = (cfg) ? cfg->config : 0; | 1226 | priv->config = (cfg) ? cfg->config : 0; |
1227 | priv->small_i2c = (cfg) ? cfg->small_i2c : 0; | 1227 | priv->small_i2c = (cfg) ? |
1228 | cfg->small_i2c : TDA18271_39_BYTE_CHUNK_INIT; | ||
1228 | priv->output_opt = (cfg) ? | 1229 | priv->output_opt = (cfg) ? |
1229 | cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON; | 1230 | cfg->output_opt : TDA18271_OUTPUT_LT_XT_ON; |
1230 | 1231 | ||
diff --git a/drivers/media/common/tuners/tda18271-priv.h b/drivers/media/common/tuners/tda18271-priv.h index 7047680cdbd1..9589ab0576d2 100644 --- a/drivers/media/common/tuners/tda18271-priv.h +++ b/drivers/media/common/tuners/tda18271-priv.h | |||
@@ -109,10 +109,10 @@ struct tda18271_priv { | |||
109 | enum tda18271_i2c_gate gate; | 109 | enum tda18271_i2c_gate gate; |
110 | enum tda18271_ver id; | 110 | enum tda18271_ver id; |
111 | enum tda18271_output_options output_opt; | 111 | enum tda18271_output_options output_opt; |
112 | enum tda18271_small_i2c small_i2c; | ||
112 | 113 | ||
113 | unsigned int config; /* interface to saa713x / tda829x */ | 114 | unsigned int config; /* interface to saa713x / tda829x */ |
114 | unsigned int cal_initialized:1; | 115 | unsigned int cal_initialized:1; |
115 | unsigned int small_i2c:1; | ||
116 | 116 | ||
117 | u8 tm_rfcal; | 117 | u8 tm_rfcal; |
118 | 118 | ||
diff --git a/drivers/media/common/tuners/tda18271.h b/drivers/media/common/tuners/tda18271.h index 323f2912128d..d7fcc36dc6e6 100644 --- a/drivers/media/common/tuners/tda18271.h +++ b/drivers/media/common/tuners/tda18271.h | |||
@@ -78,6 +78,12 @@ enum tda18271_output_options { | |||
78 | TDA18271_OUTPUT_XT_OFF = 2, | 78 | TDA18271_OUTPUT_XT_OFF = 2, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | enum tda18271_small_i2c { | ||
82 | TDA18271_39_BYTE_CHUNK_INIT = 0, | ||
83 | TDA18271_16_BYTE_CHUNK_INIT = 1, | ||
84 | TDA18271_08_BYTE_CHUNK_INIT = 2, | ||
85 | }; | ||
86 | |||
81 | struct tda18271_config { | 87 | struct tda18271_config { |
82 | /* override default if freq / std settings (optional) */ | 88 | /* override default if freq / std settings (optional) */ |
83 | struct tda18271_std_map *std_map; | 89 | struct tda18271_std_map *std_map; |
@@ -91,12 +97,12 @@ struct tda18271_config { | |||
91 | /* output options that can be disabled */ | 97 | /* output options that can be disabled */ |
92 | enum tda18271_output_options output_opt; | 98 | enum tda18271_output_options output_opt; |
93 | 99 | ||
100 | /* some i2c providers cant write all 39 registers at once */ | ||
101 | enum tda18271_small_i2c small_i2c; | ||
102 | |||
94 | /* force rf tracking filter calibration on startup */ | 103 | /* force rf tracking filter calibration on startup */ |
95 | unsigned int rf_cal_on_startup:1; | 104 | unsigned int rf_cal_on_startup:1; |
96 | 105 | ||
97 | /* some i2c providers cant write all 39 registers at once */ | ||
98 | unsigned int small_i2c:1; | ||
99 | |||
100 | /* interface to saa713x / tda829x */ | 106 | /* interface to saa713x / tda829x */ |
101 | unsigned int config; | 107 | unsigned int config; |
102 | }; | 108 | }; |