Commit 3319e6f8 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: remove field tuner_addr from struct em28xx

The tuner address is only used by the v4l submodule and at tuner setup and
can be obtained from the board data directly (if specified).
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 6867bd5a
...@@ -2741,8 +2741,6 @@ static void em28xx_card_setup(struct em28xx *dev) ...@@ -2741,8 +2741,6 @@ static void em28xx_card_setup(struct em28xx *dev)
dev->board.name, dev->model); dev->board.name, dev->model);
dev->tuner_type = em28xx_boards[dev->model].tuner_type; dev->tuner_type = em28xx_boards[dev->model].tuner_type;
if (em28xx_boards[dev->model].tuner_addr)
dev->tuner_addr = em28xx_boards[dev->model].tuner_addr;
/* request some modules */ /* request some modules */
switch (dev->model) { switch (dev->model) {
......
...@@ -2219,16 +2219,13 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, ...@@ -2219,16 +2219,13 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
return vfd; return vfd;
} }
static void em28xx_tuner_setup(struct em28xx *dev) static void em28xx_tuner_setup(struct em28xx *dev, unsigned short tuner_addr)
{ {
struct em28xx_v4l2 *v4l2 = dev->v4l2; struct em28xx_v4l2 *v4l2 = dev->v4l2;
struct v4l2_device *v4l2_dev = &v4l2->v4l2_dev; struct v4l2_device *v4l2_dev = &v4l2->v4l2_dev;
struct tuner_setup tun_setup; struct tuner_setup tun_setup;
struct v4l2_frequency f; struct v4l2_frequency f;
if (dev->tuner_type == TUNER_ABSENT)
return;
memset(&tun_setup, 0, sizeof(tun_setup)); memset(&tun_setup, 0, sizeof(tun_setup));
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
...@@ -2244,7 +2241,7 @@ static void em28xx_tuner_setup(struct em28xx *dev) ...@@ -2244,7 +2241,7 @@ static void em28xx_tuner_setup(struct em28xx *dev)
if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) { if ((dev->tuner_type != TUNER_ABSENT) && (dev->tuner_type)) {
tun_setup.type = dev->tuner_type; tun_setup.type = dev->tuner_type;
tun_setup.addr = dev->tuner_addr; tun_setup.addr = tuner_addr;
v4l2_device_call_all(v4l2_dev, v4l2_device_call_all(v4l2_dev,
0, tuner, s_type_addr, &tun_setup); 0, tuner, s_type_addr, &tun_setup);
...@@ -2360,6 +2357,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) ...@@ -2360,6 +2357,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
/* Initialize tuner and camera */ /* Initialize tuner and camera */
if (dev->board.tuner_type != TUNER_ABSENT) { if (dev->board.tuner_type != TUNER_ABSENT) {
unsigned short tuner_addr = dev->board.tuner_addr;
int has_demod = (dev->board.tda9887_conf & TDA9887_PRESENT); int has_demod = (dev->board.tda9887_conf & TDA9887_PRESENT);
if (dev->board.radio.type) if (dev->board.radio.type)
...@@ -2371,7 +2369,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) ...@@ -2371,7 +2369,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
v4l2_i2c_new_subdev(&v4l2->v4l2_dev, v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
&dev->i2c_adap[dev->def_i2c_bus], "tuner", &dev->i2c_adap[dev->def_i2c_bus], "tuner",
0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
if (dev->tuner_addr == 0) { if (tuner_addr == 0) {
enum v4l2_i2c_tuner_type type = enum v4l2_i2c_tuner_type type =
has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
...@@ -2381,15 +2379,16 @@ static int em28xx_v4l2_init(struct em28xx *dev) ...@@ -2381,15 +2379,16 @@ static int em28xx_v4l2_init(struct em28xx *dev)
0, v4l2_i2c_tuner_addrs(type)); 0, v4l2_i2c_tuner_addrs(type));
if (sd) if (sd)
dev->tuner_addr = v4l2_i2c_subdev_addr(sd); tuner_addr = v4l2_i2c_subdev_addr(sd);
} else { } else {
v4l2_i2c_new_subdev(&v4l2->v4l2_dev, v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
&dev->i2c_adap[dev->def_i2c_bus], &dev->i2c_adap[dev->def_i2c_bus],
"tuner", dev->tuner_addr, NULL); "tuner", tuner_addr, NULL);
} }
em28xx_tuner_setup(dev, tuner_addr);
} }
em28xx_tuner_setup(dev);
if (dev->em28xx_sensor != EM28XX_NOSENSOR) if (dev->em28xx_sensor != EM28XX_NOSENSOR)
em28xx_init_camera(dev); em28xx_init_camera(dev);
......
...@@ -633,7 +633,6 @@ struct em28xx { ...@@ -633,7 +633,6 @@ struct em28xx {
struct em28xx_audio_mode audio_mode; struct em28xx_audio_mode audio_mode;
int tuner_type; /* type of the tuner */ int tuner_type; /* type of the tuner */
int tuner_addr; /* tuner address */
/* i2c i/o */ /* i2c i/o */
struct i2c_adapter i2c_adap[NUM_I2C_BUSES]; struct i2c_adapter i2c_adap[NUM_I2C_BUSES];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment