summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-01-18 23:37:59 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2009-01-18 23:37:59 +0100
commitb3bd2b4c24de403f1baa56ec2ec452e7f8f9b463 (patch)
treedddad7790c226fe9edd7f8d5ab95e25df4c07954 /linux/drivers/media/video/saa7134
parent4d16d13d22862fd3a698ca766f03362ec6bd56ff (diff)
downloadmediapointer-dvb-s2-b3bd2b4c24de403f1baa56ec2ec452e7f8f9b463.tar.gz
mediapointer-dvb-s2-b3bd2b4c24de403f1baa56ec2ec452e7f8f9b463.tar.bz2
v4l2-common: added v4l2_i2c_tuner_addrs()
From: Hans Verkuil <hverkuil@xs4all.nl> Add v4l2_i2c_tuner_addrs() to obtain the various I2C tuner addresses. This will be used in several drivers, so make this a common function as we do not want to have these I2C addresses all over the place. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-core.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c
index a6d643062..1ba80210e 100644
--- a/linux/drivers/media/video/saa7134/saa7134-core.c
+++ b/linux/drivers/media/video/saa7134/saa7134-core.c
@@ -1041,35 +1041,25 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
/* initialize hardware #2 */
if (TUNER_ABSENT != dev->tuner_type) {
- if (dev->radio_type != UNSET) {
- v4l2_i2c_new_subdev(&dev->i2c_adap, "tuner", "tuner",
- dev->radio_addr);
- }
- if (dev->tda9887_conf & TDA9887_PRESENT) {
- unsigned short addrs[] = { 0x42, 0x43, 0x4a, 0x4b,
- I2C_CLIENT_END };
+ int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
- v4l2_i2c_new_probed_subdev(&dev->i2c_adap,
- "tuner", "tuner", addrs);
- }
- if (dev->tuner_addr != ADDR_UNSET) {
+ /* Note: radio tuner address is always filled in,
+ so we do not need to probe for a radio tuner device. */
+ if (dev->radio_type != UNSET)
v4l2_i2c_new_subdev(&dev->i2c_adap,
- "tuner", "tuner", dev->tuner_addr);
+ "tuner", "tuner", dev->radio_addr);
+ if (has_demod)
+ v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
+ "tuner", v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
+ if (dev->tuner_addr == ADDR_UNSET) {
+ enum v4l2_i2c_tuner_type type =
+ has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
+
+ v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "tuner",
+ "tuner", v4l2_i2c_tuner_addrs(type));
} else {
- unsigned short addrs[] = {
- 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- I2C_CLIENT_END
- };
-
- if (dev->tda9887_conf & TDA9887_PRESENT) {
- v4l2_i2c_new_probed_subdev(&dev->i2c_adap,
- "tuner", "tuner", addrs + 4);
- } else {
- v4l2_i2c_new_probed_subdev(&dev->i2c_adap,
- "tuner", "tuner", addrs);
- }
+ v4l2_i2c_new_subdev(&dev->i2c_adap,
+ "tuner", "tuner", dev->tuner_addr);
}
}
saa7134_board_init2(dev);