diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-03-29 17:00:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:19 -0400 |
commit | b74c0aac357e5c71ee6de98b9887fe478bc73cf4 (patch) | |
tree | 5a3eb7c3c420ac2dd9701f9813984e309c35ac8a | |
parent | 647da444951bc11c0d9c4680abf71e2520d8eae5 (diff) |
V4L/DVB (11366): v4l: remove obsolete header and source
v4l2-subdev.c and v4l2-i2c-drv-legacy.h were used to support the old i2c
API. All v4l drivers are now converted to v4l2_subdev, so these two files
can be removed.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/Makefile | 2 | ||||
-rw-r--r-- | drivers/media/video/v4l2-subdev.c | 128 | ||||
-rw-r--r-- | include/media/v4l2-i2c-drv-legacy.h | 152 |
3 files changed, 1 insertions, 281 deletions
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 7c0bd6e78312..3f1a0350a569 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -10,7 +10,7 @@ stkwebcam-objs := stk-webcam.o stk-sensor.o | |||
10 | 10 | ||
11 | omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o | 11 | omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o |
12 | 12 | ||
13 | videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-subdev.o | 13 | videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o |
14 | 14 | ||
15 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o | 15 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o |
16 | ifeq ($(CONFIG_COMPAT),y) | 16 | ifeq ($(CONFIG_COMPAT),y) |
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c deleted file mode 100644 index dc881671d536..000000000000 --- a/drivers/media/video/v4l2-subdev.c +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | /* | ||
2 | V4L2 sub-device support. | ||
3 | |||
4 | Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <linux/ioctl.h> | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/videodev2.h> | ||
25 | #include <media/v4l2-subdev.h> | ||
26 | |||
27 | int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg) | ||
28 | { | ||
29 | switch (cmd) { | ||
30 | case VIDIOC_QUERYCTRL: | ||
31 | return v4l2_subdev_call(sd, core, queryctrl, arg); | ||
32 | case VIDIOC_G_CTRL: | ||
33 | return v4l2_subdev_call(sd, core, g_ctrl, arg); | ||
34 | case VIDIOC_S_CTRL: | ||
35 | return v4l2_subdev_call(sd, core, s_ctrl, arg); | ||
36 | case VIDIOC_G_EXT_CTRLS: | ||
37 | return v4l2_subdev_call(sd, core, g_ext_ctrls, arg); | ||
38 | case VIDIOC_S_EXT_CTRLS: | ||
39 | return v4l2_subdev_call(sd, core, s_ext_ctrls, arg); | ||
40 | case VIDIOC_TRY_EXT_CTRLS: | ||
41 | return v4l2_subdev_call(sd, core, try_ext_ctrls, arg); | ||
42 | case VIDIOC_QUERYMENU: | ||
43 | return v4l2_subdev_call(sd, core, querymenu, arg); | ||
44 | case VIDIOC_LOG_STATUS: | ||
45 | return v4l2_subdev_call(sd, core, log_status); | ||
46 | case VIDIOC_DBG_G_CHIP_IDENT: | ||
47 | return v4l2_subdev_call(sd, core, g_chip_ident, arg); | ||
48 | case VIDIOC_INT_S_STANDBY: | ||
49 | return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0); | ||
50 | case VIDIOC_INT_RESET: | ||
51 | return v4l2_subdev_call(sd, core, reset, arg ? (*(u32 *)arg) : 0); | ||
52 | case VIDIOC_INT_S_GPIO: | ||
53 | return v4l2_subdev_call(sd, core, s_gpio, arg ? (*(u32 *)arg) : 0); | ||
54 | case VIDIOC_INT_INIT: | ||
55 | return v4l2_subdev_call(sd, core, init, arg ? (*(u32 *)arg) : 0); | ||
56 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
57 | case VIDIOC_DBG_G_REGISTER: | ||
58 | return v4l2_subdev_call(sd, core, g_register, arg); | ||
59 | case VIDIOC_DBG_S_REGISTER: | ||
60 | return v4l2_subdev_call(sd, core, s_register, arg); | ||
61 | #endif | ||
62 | |||
63 | case VIDIOC_INT_S_TUNER_MODE: | ||
64 | return v4l2_subdev_call(sd, tuner, s_mode, *(enum v4l2_tuner_type *)arg); | ||
65 | case AUDC_SET_RADIO: | ||
66 | return v4l2_subdev_call(sd, tuner, s_radio); | ||
67 | case VIDIOC_S_TUNER: | ||
68 | return v4l2_subdev_call(sd, tuner, s_tuner, arg); | ||
69 | case VIDIOC_G_TUNER: | ||
70 | return v4l2_subdev_call(sd, tuner, g_tuner, arg); | ||
71 | case VIDIOC_S_STD: | ||
72 | return v4l2_subdev_call(sd, tuner, s_std, *(v4l2_std_id *)arg); | ||
73 | case VIDIOC_S_FREQUENCY: | ||
74 | return v4l2_subdev_call(sd, tuner, s_frequency, arg); | ||
75 | case VIDIOC_G_FREQUENCY: | ||
76 | return v4l2_subdev_call(sd, tuner, g_frequency, arg); | ||
77 | case TUNER_SET_TYPE_ADDR: | ||
78 | return v4l2_subdev_call(sd, tuner, s_type_addr, arg); | ||
79 | case TUNER_SET_CONFIG: | ||
80 | return v4l2_subdev_call(sd, tuner, s_config, arg); | ||
81 | |||
82 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | ||
83 | return v4l2_subdev_call(sd, audio, s_clock_freq, *(u32 *)arg); | ||
84 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
85 | return v4l2_subdev_call(sd, audio, s_routing, arg); | ||
86 | case VIDIOC_INT_I2S_CLOCK_FREQ: | ||
87 | return v4l2_subdev_call(sd, audio, s_i2s_clock_freq, *(u32 *)arg); | ||
88 | |||
89 | case VIDIOC_INT_S_VIDEO_ROUTING: | ||
90 | return v4l2_subdev_call(sd, video, s_routing, arg); | ||
91 | case VIDIOC_INT_S_CRYSTAL_FREQ: | ||
92 | return v4l2_subdev_call(sd, video, s_crystal_freq, arg); | ||
93 | case VIDIOC_INT_DECODE_VBI_LINE: | ||
94 | return v4l2_subdev_call(sd, video, decode_vbi_line, arg); | ||
95 | case VIDIOC_INT_S_VBI_DATA: | ||
96 | return v4l2_subdev_call(sd, video, s_vbi_data, arg); | ||
97 | case VIDIOC_INT_G_VBI_DATA: | ||
98 | return v4l2_subdev_call(sd, video, g_vbi_data, arg); | ||
99 | case VIDIOC_G_SLICED_VBI_CAP: | ||
100 | return v4l2_subdev_call(sd, video, g_sliced_vbi_cap, arg); | ||
101 | case VIDIOC_ENUM_FMT: | ||
102 | return v4l2_subdev_call(sd, video, enum_fmt, arg); | ||
103 | case VIDIOC_TRY_FMT: | ||
104 | return v4l2_subdev_call(sd, video, try_fmt, arg); | ||
105 | case VIDIOC_S_FMT: | ||
106 | return v4l2_subdev_call(sd, video, s_fmt, arg); | ||
107 | case VIDIOC_G_FMT: | ||
108 | return v4l2_subdev_call(sd, video, g_fmt, arg); | ||
109 | case VIDIOC_INT_S_STD_OUTPUT: | ||
110 | return v4l2_subdev_call(sd, video, s_std_output, *(v4l2_std_id *)arg); | ||
111 | case VIDIOC_QUERYSTD: | ||
112 | return v4l2_subdev_call(sd, video, querystd, arg); | ||
113 | case VIDIOC_INT_G_INPUT_STATUS: | ||
114 | return v4l2_subdev_call(sd, video, g_input_status, arg); | ||
115 | case VIDIOC_STREAMON: | ||
116 | return v4l2_subdev_call(sd, video, s_stream, 1); | ||
117 | case VIDIOC_STREAMOFF: | ||
118 | return v4l2_subdev_call(sd, video, s_stream, 0); | ||
119 | case VIDIOC_S_PARM: | ||
120 | return v4l2_subdev_call(sd, video, s_parm, arg); | ||
121 | case VIDIOC_G_PARM: | ||
122 | return v4l2_subdev_call(sd, video, g_parm, arg); | ||
123 | |||
124 | default: | ||
125 | return v4l2_subdev_call(sd, core, ioctl, cmd, arg); | ||
126 | } | ||
127 | } | ||
128 | EXPORT_SYMBOL_GPL(v4l2_subdev_command); | ||
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h deleted file mode 100644 index e65dd9d84e8b..000000000000 --- a/include/media/v4l2-i2c-drv-legacy.h +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | /* | ||
2 | * v4l2-i2c-drv-legacy.h - contains I2C handling code that's identical | ||
3 | * for all V4L2 I2C drivers. Use this header if the | ||
4 | * I2C driver is used by both legacy drivers and | ||
5 | * drivers converted to the bus-based I2C API. | ||
6 | * | ||
7 | * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | /* NOTE: the full version of this header is in the v4l-dvb repository | ||
25 | * and allows v4l i2c drivers to be compiled on older kernels as well. | ||
26 | * The version of this header as it appears in the kernel is a stripped | ||
27 | * version (without all the backwards compatibility stuff) and so it | ||
28 | * looks a bit odd. | ||
29 | * | ||
30 | * If you look at the full version then you will understand the reason | ||
31 | * for introducing this header since you really don't want to have all | ||
32 | * the tricky backwards compatibility code in each and every i2c driver. | ||
33 | */ | ||
34 | |||
35 | struct v4l2_i2c_driver_data { | ||
36 | const char * const name; | ||
37 | int driverid; | ||
38 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); | ||
39 | int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); | ||
40 | int (*remove)(struct i2c_client *client); | ||
41 | int (*suspend)(struct i2c_client *client, pm_message_t state); | ||
42 | int (*resume)(struct i2c_client *client); | ||
43 | int (*legacy_probe)(struct i2c_adapter *adapter); | ||
44 | int legacy_class; | ||
45 | const struct i2c_device_id *id_table; | ||
46 | }; | ||
47 | |||
48 | static struct v4l2_i2c_driver_data v4l2_i2c_data; | ||
49 | static const struct i2c_client_address_data addr_data; | ||
50 | static struct i2c_driver v4l2_i2c_driver_legacy; | ||
51 | static char v4l2_i2c_drv_name_legacy[32]; | ||
52 | |||
53 | static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind) | ||
54 | { | ||
55 | return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver_legacy, | ||
56 | v4l2_i2c_drv_name_legacy, v4l2_i2c_data.probe); | ||
57 | } | ||
58 | |||
59 | static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter) | ||
60 | { | ||
61 | if (v4l2_i2c_data.legacy_probe) { | ||
62 | if (v4l2_i2c_data.legacy_probe(adapter)) | ||
63 | return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy); | ||
64 | return 0; | ||
65 | } | ||
66 | if (adapter->class & v4l2_i2c_data.legacy_class) | ||
67 | return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy); | ||
68 | return 0; | ||
69 | } | ||
70 | |||
71 | static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client) | ||
72 | { | ||
73 | int err; | ||
74 | |||
75 | if (v4l2_i2c_data.remove) | ||
76 | v4l2_i2c_data.remove(client); | ||
77 | |||
78 | err = i2c_detach_client(client); | ||
79 | if (err) | ||
80 | return err; | ||
81 | kfree(client); | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state) | ||
86 | { | ||
87 | return v4l2_i2c_data.suspend ? v4l2_i2c_data.suspend(client, state) : 0; | ||
88 | } | ||
89 | |||
90 | static int v4l2_i2c_drv_resume_helper(struct i2c_client *client) | ||
91 | { | ||
92 | return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0; | ||
93 | } | ||
94 | |||
95 | /* ----------------------------------------------------------------------- */ | ||
96 | |||
97 | /* i2c implementation */ | ||
98 | static struct i2c_driver v4l2_i2c_driver_legacy = { | ||
99 | .driver = { | ||
100 | .owner = THIS_MODULE, | ||
101 | }, | ||
102 | .attach_adapter = v4l2_i2c_drv_probe_legacy, | ||
103 | .detach_client = v4l2_i2c_drv_detach_legacy, | ||
104 | .suspend = v4l2_i2c_drv_suspend_helper, | ||
105 | .resume = v4l2_i2c_drv_resume_helper, | ||
106 | }; | ||
107 | |||
108 | /* ----------------------------------------------------------------------- */ | ||
109 | |||
110 | /* i2c implementation */ | ||
111 | static struct i2c_driver v4l2_i2c_driver = { | ||
112 | .suspend = v4l2_i2c_drv_suspend_helper, | ||
113 | .resume = v4l2_i2c_drv_resume_helper, | ||
114 | }; | ||
115 | |||
116 | static int __init v4l2_i2c_drv_init(void) | ||
117 | { | ||
118 | int err; | ||
119 | |||
120 | strlcpy(v4l2_i2c_drv_name_legacy, v4l2_i2c_data.name, sizeof(v4l2_i2c_drv_name_legacy)); | ||
121 | strlcat(v4l2_i2c_drv_name_legacy, "'", sizeof(v4l2_i2c_drv_name_legacy)); | ||
122 | |||
123 | if (v4l2_i2c_data.legacy_class == 0) | ||
124 | v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG; | ||
125 | |||
126 | v4l2_i2c_driver_legacy.driver.name = v4l2_i2c_drv_name_legacy; | ||
127 | v4l2_i2c_driver_legacy.id = v4l2_i2c_data.driverid; | ||
128 | v4l2_i2c_driver_legacy.command = v4l2_i2c_data.command; | ||
129 | err = i2c_add_driver(&v4l2_i2c_driver_legacy); | ||
130 | |||
131 | if (err) | ||
132 | return err; | ||
133 | v4l2_i2c_driver.driver.name = v4l2_i2c_data.name; | ||
134 | v4l2_i2c_driver.id = v4l2_i2c_data.driverid; | ||
135 | v4l2_i2c_driver.command = v4l2_i2c_data.command; | ||
136 | v4l2_i2c_driver.probe = v4l2_i2c_data.probe; | ||
137 | v4l2_i2c_driver.remove = v4l2_i2c_data.remove; | ||
138 | v4l2_i2c_driver.id_table = v4l2_i2c_data.id_table; | ||
139 | err = i2c_add_driver(&v4l2_i2c_driver); | ||
140 | if (err) | ||
141 | i2c_del_driver(&v4l2_i2c_driver_legacy); | ||
142 | return err; | ||
143 | } | ||
144 | |||
145 | static void __exit v4l2_i2c_drv_cleanup(void) | ||
146 | { | ||
147 | i2c_del_driver(&v4l2_i2c_driver_legacy); | ||
148 | i2c_del_driver(&v4l2_i2c_driver); | ||
149 | } | ||
150 | |||
151 | module_init(v4l2_i2c_drv_init); | ||
152 | module_exit(v4l2_i2c_drv_cleanup); | ||