aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-04-01 02:32:22 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 20:44:18 -0400
commit75b4c260fa93d99979a8b5bec5a621daff469398 (patch)
treea3f062f4a5e3a4d1f6231e253e6c9567448c640f /drivers
parent762decd3bfb58f190b7cc2e9cc186ba95cca3dcf (diff)
V4L/DVB (11364): tuner: remove i2c legacy code.
All drivers that use the tuner module now use v4l2_subdev, so we can remove the legacy code from this module. Note that TUNER_SET_CONFIG is still called by tuner-simple.c, so we have to handle it via a .command callback. There must be a better way to do this, but for now this will work. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/tuner-core.c72
1 files changed, 17 insertions, 55 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 72d41032742d..40bf980cd511 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 */
105static 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
115I2C_CLIENT_INSMOD;
116 104
117/* insmod options used at init time => read/only */ 105/* insmod options used at init time => read/only */
118static unsigned int addr; 106static unsigned int addr;
@@ -951,11 +939,6 @@ static int tuner_log_status(struct v4l2_subdev *sd)
951 return 0; 939 return 0;
952} 940}
953 941
954static 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
959static int tuner_suspend(struct i2c_client *c, pm_message_t state) 942static 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,6 +963,20 @@ static int tuner_resume(struct i2c_client *c)
980 return 0; 963 return 0;
981} 964}
982 965
966static 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
985static const struct v4l2_subdev_core_ops tuner_core_ops = { 982static const struct v4l2_subdev_core_ops tuner_core_ops = {
@@ -1167,39 +1164,6 @@ register_client:
1167 return 0; 1164 return 0;
1168} 1165}
1169 1166
1170static 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 1167
1204static int tuner_remove(struct i2c_client *client) 1168static int tuner_remove(struct i2c_client *client)
1205{ 1169{
@@ -1227,13 +1191,11 @@ MODULE_DEVICE_TABLE(i2c, tuner_id);
1227 1191
1228static struct v4l2_i2c_driver_data v4l2_i2c_data = { 1192static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1229 .name = "tuner", 1193 .name = "tuner",
1230 .driverid = I2C_DRIVERID_TUNER,
1231 .command = tuner_command,
1232 .probe = tuner_probe, 1194 .probe = tuner_probe,
1233 .remove = tuner_remove, 1195 .remove = tuner_remove,
1196 .command = tuner_command,
1234 .suspend = tuner_suspend, 1197 .suspend = tuner_suspend,
1235 .resume = tuner_resume, 1198 .resume = tuner_resume,
1236 .legacy_probe = tuner_legacy_probe,
1237 .id_table = tuner_id, 1199 .id_table = tuner_id,
1238}; 1200};
1239 1201