diff options
Diffstat (limited to 'drivers/media/video/tuner-core.c')
-rw-r--r-- | drivers/media/video/tuner-core.c | 81 |
1 files changed, 21 insertions, 60 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 72d41032742d..78c377a399cb 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -15,12 +15,12 @@ | |||
15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/videodev.h> | 18 | #include <linux/videodev2.h> |
19 | #include <media/tuner.h> | 19 | #include <media/tuner.h> |
20 | #include <media/tuner-types.h> | 20 | #include <media/tuner-types.h> |
21 | #include <media/v4l2-device.h> | 21 | #include <media/v4l2-device.h> |
22 | #include <media/v4l2-ioctl.h> | 22 | #include <media/v4l2-ioctl.h> |
23 | #include <media/v4l2-i2c-drv-legacy.h> | 23 | #include <media/v4l2-i2c-drv.h> |
24 | #include "mt20xx.h" | 24 | #include "mt20xx.h" |
25 | #include "tda8290.h" | 25 | #include "tda8290.h" |
26 | #include "tea5761.h" | 26 | #include "tea5761.h" |
@@ -101,18 +101,6 @@ static inline struct tuner *to_tuner(struct v4l2_subdev *sd) | |||
101 | return container_of(sd, struct tuner, sd); | 101 | return container_of(sd, struct tuner, sd); |
102 | } | 102 | } |
103 | 103 | ||
104 | /* standard i2c insmod options */ | ||
105 | static unsigned short normal_i2c[] = { | ||
106 | #if defined(CONFIG_MEDIA_TUNER_TEA5761) || (defined(CONFIG_MEDIA_TUNER_TEA5761_MODULE) && defined(MODULE)) | ||
107 | 0x10, | ||
108 | #endif | ||
109 | 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ | ||
110 | 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | ||
111 | 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, | ||
112 | I2C_CLIENT_END | ||
113 | }; | ||
114 | |||
115 | I2C_CLIENT_INSMOD; | ||
116 | 104 | ||
117 | /* insmod options used at init time => read/only */ | 105 | /* insmod options used at init time => read/only */ |
118 | static unsigned int addr; | 106 | static unsigned int addr; |
@@ -785,7 +773,7 @@ static int tuner_s_radio(struct v4l2_subdev *sd) | |||
785 | return 0; | 773 | return 0; |
786 | } | 774 | } |
787 | 775 | ||
788 | static int tuner_s_standby(struct v4l2_subdev *sd, u32 standby) | 776 | static int tuner_s_standby(struct v4l2_subdev *sd) |
789 | { | 777 | { |
790 | struct tuner *t = to_tuner(sd); | 778 | struct tuner *t = to_tuner(sd); |
791 | struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; | 779 | struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; |
@@ -951,11 +939,6 @@ static int tuner_log_status(struct v4l2_subdev *sd) | |||
951 | return 0; | 939 | return 0; |
952 | } | 940 | } |
953 | 941 | ||
954 | static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg) | ||
955 | { | ||
956 | return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg); | ||
957 | } | ||
958 | |||
959 | static int tuner_suspend(struct i2c_client *c, pm_message_t state) | 942 | static int tuner_suspend(struct i2c_client *c, pm_message_t state) |
960 | { | 943 | { |
961 | struct tuner *t = to_tuner(i2c_get_clientdata(c)); | 944 | struct tuner *t = to_tuner(i2c_get_clientdata(c)); |
@@ -980,15 +963,28 @@ static int tuner_resume(struct i2c_client *c) | |||
980 | return 0; | 963 | return 0; |
981 | } | 964 | } |
982 | 965 | ||
966 | static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg) | ||
967 | { | ||
968 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | ||
969 | |||
970 | /* TUNER_SET_CONFIG is still called by tuner-simple.c, so we have | ||
971 | to handle it here. | ||
972 | There must be a better way of doing this... */ | ||
973 | switch (cmd) { | ||
974 | case TUNER_SET_CONFIG: | ||
975 | return tuner_s_config(sd, arg); | ||
976 | } | ||
977 | return -ENOIOCTLCMD; | ||
978 | } | ||
979 | |||
983 | /* ----------------------------------------------------------------------- */ | 980 | /* ----------------------------------------------------------------------- */ |
984 | 981 | ||
985 | static const struct v4l2_subdev_core_ops tuner_core_ops = { | 982 | static const struct v4l2_subdev_core_ops tuner_core_ops = { |
986 | .log_status = tuner_log_status, | 983 | .log_status = tuner_log_status, |
987 | .s_standby = tuner_s_standby, | 984 | .s_std = tuner_s_std, |
988 | }; | 985 | }; |
989 | 986 | ||
990 | static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = { | 987 | static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = { |
991 | .s_std = tuner_s_std, | ||
992 | .s_radio = tuner_s_radio, | 988 | .s_radio = tuner_s_radio, |
993 | .g_tuner = tuner_g_tuner, | 989 | .g_tuner = tuner_g_tuner, |
994 | .s_tuner = tuner_s_tuner, | 990 | .s_tuner = tuner_s_tuner, |
@@ -996,6 +992,7 @@ static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = { | |||
996 | .g_frequency = tuner_g_frequency, | 992 | .g_frequency = tuner_g_frequency, |
997 | .s_type_addr = tuner_s_type_addr, | 993 | .s_type_addr = tuner_s_type_addr, |
998 | .s_config = tuner_s_config, | 994 | .s_config = tuner_s_config, |
995 | .s_standby = tuner_s_standby, | ||
999 | }; | 996 | }; |
1000 | 997 | ||
1001 | static const struct v4l2_subdev_ops tuner_ops = { | 998 | static const struct v4l2_subdev_ops tuner_ops = { |
@@ -1023,7 +1020,7 @@ static void tuner_lookup(struct i2c_adapter *adap, | |||
1023 | int mode_mask; | 1020 | int mode_mask; |
1024 | 1021 | ||
1025 | if (pos->i2c->adapter != adap || | 1022 | if (pos->i2c->adapter != adap || |
1026 | pos->i2c->driver->id != I2C_DRIVERID_TUNER) | 1023 | strcmp(pos->i2c->driver->driver.name, "tuner")) |
1027 | continue; | 1024 | continue; |
1028 | 1025 | ||
1029 | mode_mask = pos->mode_mask & ~T_STANDBY; | 1026 | mode_mask = pos->mode_mask & ~T_STANDBY; |
@@ -1167,40 +1164,6 @@ register_client: | |||
1167 | return 0; | 1164 | return 0; |
1168 | } | 1165 | } |
1169 | 1166 | ||
1170 | static int tuner_legacy_probe(struct i2c_adapter *adap) | ||
1171 | { | ||
1172 | if (0 != addr) { | ||
1173 | normal_i2c[0] = addr; | ||
1174 | normal_i2c[1] = I2C_CLIENT_END; | ||
1175 | } | ||
1176 | |||
1177 | if ((adap->class & I2C_CLASS_TV_ANALOG) == 0) | ||
1178 | return 0; | ||
1179 | |||
1180 | /* HACK: Ignore 0x6b and 0x6f on cx88 boards. | ||
1181 | * FusionHDTV5 RT Gold has an ir receiver at 0x6b | ||
1182 | * and an RTC at 0x6f which can get corrupted if probed. | ||
1183 | */ | ||
1184 | if ((adap->id == I2C_HW_B_CX2388x) || | ||
1185 | (adap->id == I2C_HW_B_CX23885)) { | ||
1186 | unsigned int i = 0; | ||
1187 | |||
1188 | while (i < I2C_CLIENT_MAX_OPTS && ignore[i] != I2C_CLIENT_END) | ||
1189 | i += 2; | ||
1190 | if (i + 4 < I2C_CLIENT_MAX_OPTS) { | ||
1191 | ignore[i+0] = adap->nr; | ||
1192 | ignore[i+1] = 0x6b; | ||
1193 | ignore[i+2] = adap->nr; | ||
1194 | ignore[i+3] = 0x6f; | ||
1195 | ignore[i+4] = I2C_CLIENT_END; | ||
1196 | } else | ||
1197 | printk(KERN_WARNING "tuner: " | ||
1198 | "too many options specified " | ||
1199 | "in i2c probe ignore list!\n"); | ||
1200 | } | ||
1201 | return 1; | ||
1202 | } | ||
1203 | |||
1204 | static int tuner_remove(struct i2c_client *client) | 1167 | static int tuner_remove(struct i2c_client *client) |
1205 | { | 1168 | { |
1206 | struct tuner *t = to_tuner(i2c_get_clientdata(client)); | 1169 | struct tuner *t = to_tuner(i2c_get_clientdata(client)); |
@@ -1227,13 +1190,11 @@ MODULE_DEVICE_TABLE(i2c, tuner_id); | |||
1227 | 1190 | ||
1228 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1191 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1229 | .name = "tuner", | 1192 | .name = "tuner", |
1230 | .driverid = I2C_DRIVERID_TUNER, | ||
1231 | .command = tuner_command, | ||
1232 | .probe = tuner_probe, | 1193 | .probe = tuner_probe, |
1233 | .remove = tuner_remove, | 1194 | .remove = tuner_remove, |
1195 | .command = tuner_command, | ||
1234 | .suspend = tuner_suspend, | 1196 | .suspend = tuner_suspend, |
1235 | .resume = tuner_resume, | 1197 | .resume = tuner_resume, |
1236 | .legacy_probe = tuner_legacy_probe, | ||
1237 | .id_table = tuner_id, | 1198 | .id_table = tuner_id, |
1238 | }; | 1199 | }; |
1239 | 1200 | ||