V4L/DVB (11154): pvrusb2: Split i2c module handling from i2c adapter
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / media / video / pvrusb2 / pvrusb2-i2c-chips-v4l2.c
blob8f32c2edb49aca11d3ef5f5efb64b6d19dee8959
1 /*
4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
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
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <linux/kernel.h>
22 #include "pvrusb2-i2c-track.h"
23 #include "pvrusb2-hdw-internal.h"
24 #include "pvrusb2-debug.h"
25 #include "pvrusb2-i2c-cmd-v4l2.h"
26 #include "pvrusb2-audio.h"
27 #include "pvrusb2-tuner.h"
28 #include "pvrusb2-video-v4l.h"
29 #include "pvrusb2-cx2584x-v4l.h"
30 #include "pvrusb2-wm8775.h"
32 #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
34 #define OP_INIT 0 /* MUST come first so it is run first */
35 #define OP_STANDARD 1
36 #define OP_AUDIOMODE 2
37 #define OP_BCSH 3
38 #define OP_VOLUME 4
39 #define OP_FREQ 5
40 #define OP_AUDIORATE 6
41 #define OP_CROP 7
42 #define OP_SIZE 8
43 #define OP_LOG 9
45 static const struct pvr2_i2c_op * const ops[] = {
46 [OP_INIT] = &pvr2_i2c_op_v4l2_init,
47 [OP_STANDARD] = &pvr2_i2c_op_v4l2_standard,
48 [OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode,
49 [OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh,
50 [OP_VOLUME] = &pvr2_i2c_op_v4l2_volume,
51 [OP_FREQ] = &pvr2_i2c_op_v4l2_frequency,
52 [OP_CROP] = &pvr2_i2c_op_v4l2_crop,
53 [OP_SIZE] = &pvr2_i2c_op_v4l2_size,
54 [OP_LOG] = &pvr2_i2c_op_v4l2_log,
57 void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
59 int id;
60 id = cp->client->driver->id;
61 cp->ctl_mask = ((1 << OP_INIT) |
62 (1 << OP_STANDARD) |
63 (1 << OP_AUDIOMODE) |
64 (1 << OP_BCSH) |
65 (1 << OP_VOLUME) |
66 (1 << OP_FREQ) |
67 (1 << OP_CROP) |
68 (1 << OP_SIZE) |
69 (1 << OP_LOG));
70 cp->status_poll = pvr2_v4l2_cmd_status_poll;
72 if (id == I2C_DRIVERID_MSP3400) {
73 if (pvr2_i2c_msp3400_setup(hdw,cp)) {
74 return;
77 if (id == I2C_DRIVERID_TUNER) {
78 if (pvr2_i2c_tuner_setup(hdw,cp)) {
79 return;
82 if (id == I2C_DRIVERID_CX25840) {
83 if (pvr2_i2c_cx2584x_v4l_setup(hdw,cp)) {
84 return;
87 if (id == I2C_DRIVERID_WM8775) {
88 if (pvr2_i2c_wm8775_setup(hdw,cp)) {
89 return;
92 if (id == I2C_DRIVERID_SAA711X) {
93 if (pvr2_i2c_decoder_v4l_setup(hdw,cp)) {
94 return;
100 const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx)
102 if (idx >= ARRAY_SIZE(ops))
103 return NULL;
104 return ops[idx];
109 Stuff for Emacs to see, in order to encourage consistent editing style:
110 *** Local Variables: ***
111 *** mode: c ***
112 *** fill-column: 75 ***
113 *** tab-width: 8 ***
114 *** c-basic-offset: 8 ***
115 *** End: ***