diff options
-rw-r--r-- | drivers/media/video/Kconfig | 9 | ||||
-rw-r--r-- | drivers/media/video/Makefile | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/Kconfig | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-cards.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-cards.h | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-i2c.c | 2 | ||||
-rw-r--r-- | drivers/media/video/vp27smpx.c | 211 | ||||
-rw-r--r-- | include/linux/i2c-id.h | 1 | ||||
-rw-r--r-- | include/media/v4l2-chip-ident.h | 3 |
10 files changed, 236 insertions, 3 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 675c8574403e..0e1d2ccc4e81 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -148,6 +148,15 @@ config VIDEO_WM8739 | |||
148 | To compile this driver as a module, choose M here: the | 148 | To compile this driver as a module, choose M here: the |
149 | module will be called wm8739. | 149 | module will be called wm8739. |
150 | 150 | ||
151 | config VIDEO_VP27SMPX | ||
152 | tristate "Panasonic VP27s internal MPX" | ||
153 | depends on VIDEO_V4L2 && I2C && EXPERIMENTAL | ||
154 | ---help--- | ||
155 | Support for the internal MPX of the Panasonic VP27s tuner. | ||
156 | |||
157 | To compile this driver as a module, choose M here: the | ||
158 | module will be called vp27smpx. | ||
159 | |||
151 | comment "Video decoders" | 160 | comment "Video decoders" |
152 | 161 | ||
153 | config VIDEO_BT819 | 162 | config VIDEO_BT819 |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index c5286bfba447..113e525f6dab 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -73,6 +73,7 @@ obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o | |||
73 | obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o | 73 | obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o |
74 | obj-$(CONFIG_VIDEO_WM8775) += wm8775.o | 74 | obj-$(CONFIG_VIDEO_WM8775) += wm8775.o |
75 | obj-$(CONFIG_VIDEO_WM8739) += wm8739.o | 75 | obj-$(CONFIG_VIDEO_WM8739) += wm8739.o |
76 | obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o | ||
76 | obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/ | 77 | obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/ |
77 | obj-$(CONFIG_VIDEO_CPIA2) += cpia2/ | 78 | obj-$(CONFIG_VIDEO_CPIA2) += cpia2/ |
78 | obj-$(CONFIG_VIDEO_MXB) += mxb.o | 79 | obj-$(CONFIG_VIDEO_MXB) += mxb.o |
diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig index 399f231abb96..5efacb332114 100644 --- a/drivers/media/video/ivtv/Kconfig +++ b/drivers/media/video/ivtv/Kconfig | |||
@@ -14,6 +14,7 @@ config VIDEO_IVTV | |||
14 | select VIDEO_CS53L32A | 14 | select VIDEO_CS53L32A |
15 | select VIDEO_WM8775 | 15 | select VIDEO_WM8775 |
16 | select VIDEO_WM8739 | 16 | select VIDEO_WM8739 |
17 | select VIDEO_VP27SMPX | ||
17 | select VIDEO_UPD64031A | 18 | select VIDEO_UPD64031A |
18 | select VIDEO_UPD64083 | 19 | select VIDEO_UPD64083 |
19 | ---help--- | 20 | ---help--- |
diff --git a/drivers/media/video/ivtv/ivtv-cards.c b/drivers/media/video/ivtv/ivtv-cards.c index baab14b40e87..e51d7cc35b1c 100644 --- a/drivers/media/video/ivtv/ivtv-cards.c +++ b/drivers/media/video/ivtv/ivtv-cards.c | |||
@@ -616,7 +616,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx = { | |||
616 | .hw_video = IVTV_HW_SAA7115 | IVTV_HW_UPD64031A | IVTV_HW_UPD6408X, | 616 | .hw_video = IVTV_HW_SAA7115 | IVTV_HW_UPD64031A | IVTV_HW_UPD6408X, |
617 | .hw_audio = IVTV_HW_GPIO, | 617 | .hw_audio = IVTV_HW_GPIO, |
618 | .hw_audio_ctrl = IVTV_HW_WM8739, | 618 | .hw_audio_ctrl = IVTV_HW_WM8739, |
619 | .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TVAUDIO | | 619 | .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_VP27SMPX | |
620 | IVTV_HW_TUNER | IVTV_HW_WM8739 | | 620 | IVTV_HW_TUNER | IVTV_HW_WM8739 | |
621 | IVTV_HW_UPD64031A | IVTV_HW_UPD6408X, | 621 | IVTV_HW_UPD64031A | IVTV_HW_UPD6408X, |
622 | .video_inputs = { | 622 | .video_inputs = { |
@@ -654,7 +654,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx2e = { | |||
654 | .hw_audio = IVTV_HW_GPIO, | 654 | .hw_audio = IVTV_HW_GPIO, |
655 | .hw_audio_ctrl = IVTV_HW_WM8739, | 655 | .hw_audio_ctrl = IVTV_HW_WM8739, |
656 | .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TUNER | | 656 | .hw_all = IVTV_HW_GPIO | IVTV_HW_SAA7115 | IVTV_HW_TUNER | |
657 | IVTV_HW_TVAUDIO | IVTV_HW_WM8739, | 657 | IVTV_HW_VP27SMPX | IVTV_HW_WM8739, |
658 | .video_inputs = { | 658 | .video_inputs = { |
659 | { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE4 }, | 659 | { IVTV_CARD_INPUT_VID_TUNER, 0, IVTV_SAA71XX_COMPOSITE4 }, |
660 | { IVTV_CARD_INPUT_SVIDEO1, 1, IVTV_SAA71XX_SVIDEO0 }, | 660 | { IVTV_CARD_INPUT_SVIDEO1, 1, IVTV_SAA71XX_SVIDEO0 }, |
diff --git a/drivers/media/video/ivtv/ivtv-cards.h b/drivers/media/video/ivtv/ivtv-cards.h index 91e9e90c14a5..3191920f4c6b 100644 --- a/drivers/media/video/ivtv/ivtv-cards.h +++ b/drivers/media/video/ivtv/ivtv-cards.h | |||
@@ -33,7 +33,8 @@ | |||
33 | #define IVTV_HW_UPD6408X (1 << 11) | 33 | #define IVTV_HW_UPD6408X (1 << 11) |
34 | #define IVTV_HW_SAA717X (1 << 12) | 34 | #define IVTV_HW_SAA717X (1 << 12) |
35 | #define IVTV_HW_WM8739 (1 << 13) | 35 | #define IVTV_HW_WM8739 (1 << 13) |
36 | #define IVTV_HW_GPIO (1 << 14) | 36 | #define IVTV_HW_VP27SMPX (1 << 14) |
37 | #define IVTV_HW_GPIO (1 << 15) | ||
37 | 38 | ||
38 | #define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114) | 39 | #define IVTV_HW_SAA711X (IVTV_HW_SAA7115 | IVTV_HW_SAA7114) |
39 | 40 | ||
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index cf52111a2dcc..f8ef267e56b2 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -854,6 +854,10 @@ static void ivtv_load_and_init_modules(struct ivtv *itv) | |||
854 | if (hw & IVTV_HW_MSP34XX) | 854 | if (hw & IVTV_HW_MSP34XX) |
855 | ivtv_request_module(itv, "msp3400"); | 855 | ivtv_request_module(itv, "msp3400"); |
856 | #endif | 856 | #endif |
857 | #ifndef CONFIG_VIDEO_VP27SMPX | ||
858 | if (hw & IVTV_HW_VP27SMPX) | ||
859 | ivtv_request_module(itv, "vp27smpx"); | ||
860 | #endif | ||
857 | if (hw & IVTV_HW_TVAUDIO) | 861 | if (hw & IVTV_HW_TVAUDIO) |
858 | ivtv_request_module(itv, "tvaudio"); | 862 | ivtv_request_module(itv, "tvaudio"); |
859 | #ifndef CONFIG_VIDEO_WM8775 | 863 | #ifndef CONFIG_VIDEO_WM8775 |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index b3557435456d..5e12ebc2a9de 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -109,6 +109,7 @@ static const u8 hw_driverids[] = { | |||
109 | I2C_DRIVERID_UPD64083, | 109 | I2C_DRIVERID_UPD64083, |
110 | I2C_DRIVERID_SAA717X, | 110 | I2C_DRIVERID_SAA717X, |
111 | I2C_DRIVERID_WM8739, | 111 | I2C_DRIVERID_WM8739, |
112 | I2C_DRIVERID_VP27SMPX, | ||
112 | 0 /* IVTV_HW_GPIO dummy driver ID */ | 113 | 0 /* IVTV_HW_GPIO dummy driver ID */ |
113 | }; | 114 | }; |
114 | 115 | ||
@@ -128,6 +129,7 @@ static const char * const hw_drivernames[] = { | |||
128 | "upd64083", | 129 | "upd64083", |
129 | "saa717x", | 130 | "saa717x", |
130 | "wm8739", | 131 | "wm8739", |
132 | "vp27smpx", | ||
131 | "gpio", | 133 | "gpio", |
132 | }; | 134 | }; |
133 | 135 | ||
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c new file mode 100644 index 000000000000..9aa526bd2c84 --- /dev/null +++ b/drivers/media/video/vp27smpx.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * vp27smpx - driver version 0.0.1 | ||
3 | * | ||
4 | * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> | ||
5 | * | ||
6 | * Special thanks to Kazz for the i2c data. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/types.h> | ||
25 | #include <linux/ioctl.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | #include <linux/i2c.h> | ||
28 | #include <linux/i2c-id.h> | ||
29 | #include <linux/videodev.h> | ||
30 | #include <media/v4l2-common.h> | ||
31 | #include <media/v4l2-chip-ident.h> | ||
32 | |||
33 | MODULE_DESCRIPTION("vp27smpx driver"); | ||
34 | MODULE_AUTHOR("Hans Verkuil"); | ||
35 | MODULE_LICENSE("GPL"); | ||
36 | |||
37 | static unsigned short normal_i2c[] = { 0xb6 >> 1, I2C_CLIENT_END }; | ||
38 | |||
39 | |||
40 | I2C_CLIENT_INSMOD; | ||
41 | |||
42 | /* ----------------------------------------------------------------------- */ | ||
43 | |||
44 | struct vp27smpx_state { | ||
45 | int radio; | ||
46 | u32 audmode; | ||
47 | }; | ||
48 | |||
49 | static void vp27smpx_set_audmode(struct i2c_client *client, u32 audmode) | ||
50 | { | ||
51 | struct vp27smpx_state *state = i2c_get_clientdata(client); | ||
52 | u8 data[3] = { 0x00, 0x00, 0x04 }; | ||
53 | |||
54 | switch (audmode) { | ||
55 | case V4L2_TUNER_MODE_MONO: | ||
56 | case V4L2_TUNER_MODE_LANG1: | ||
57 | break; | ||
58 | case V4L2_TUNER_MODE_STEREO: | ||
59 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
60 | data[1] = 0x01; | ||
61 | break; | ||
62 | case V4L2_TUNER_MODE_LANG2: | ||
63 | data[1] = 0x02; | ||
64 | break; | ||
65 | } | ||
66 | |||
67 | if (i2c_master_send(client, data, sizeof(data)) != sizeof(data)) { | ||
68 | v4l_err(client, "%s: I/O error setting audmode\n", client->name); | ||
69 | } | ||
70 | else { | ||
71 | state->audmode = audmode; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | static int vp27smpx_command(struct i2c_client *client, unsigned int cmd, | ||
76 | void *arg) | ||
77 | { | ||
78 | struct vp27smpx_state *state = i2c_get_clientdata(client); | ||
79 | struct v4l2_tuner *vt = arg; | ||
80 | |||
81 | switch (cmd) { | ||
82 | case AUDC_SET_RADIO: | ||
83 | state->radio = 1; | ||
84 | break; | ||
85 | |||
86 | case VIDIOC_S_STD: | ||
87 | state->radio = 0; | ||
88 | break; | ||
89 | |||
90 | case VIDIOC_S_TUNER: | ||
91 | if (!state->radio) | ||
92 | vp27smpx_set_audmode(client, vt->audmode); | ||
93 | break; | ||
94 | |||
95 | case VIDIOC_G_TUNER: | ||
96 | if (state->radio) | ||
97 | break; | ||
98 | vt->audmode = state->audmode; | ||
99 | vt->capability = V4L2_TUNER_CAP_STEREO | | ||
100 | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; | ||
101 | vt->rxsubchans = V4L2_TUNER_SUB_MONO; | ||
102 | break; | ||
103 | |||
104 | case VIDIOC_G_CHIP_IDENT: | ||
105 | return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_VP27SMPX, 0); | ||
106 | |||
107 | case VIDIOC_LOG_STATUS: | ||
108 | v4l_info(client, "Audio Mode: %u%s\n", state->audmode, | ||
109 | state->radio ? " (Radio)" : ""); | ||
110 | break; | ||
111 | |||
112 | default: | ||
113 | return -EINVAL; | ||
114 | } | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | /* ----------------------------------------------------------------------- */ | ||
119 | |||
120 | /* i2c implementation */ | ||
121 | |||
122 | /* | ||
123 | * Generic i2c probe | ||
124 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | ||
125 | */ | ||
126 | |||
127 | static struct i2c_driver i2c_driver; | ||
128 | |||
129 | static int vp27smpx_attach(struct i2c_adapter *adapter, int address, int kind) | ||
130 | { | ||
131 | struct i2c_client *client; | ||
132 | struct vp27smpx_state *state; | ||
133 | |||
134 | /* Check if the adapter supports the needed features */ | ||
135 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
136 | return 0; | ||
137 | |||
138 | client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
139 | if (client == 0) | ||
140 | return -ENOMEM; | ||
141 | |||
142 | client->addr = address; | ||
143 | client->adapter = adapter; | ||
144 | client->driver = &i2c_driver; | ||
145 | snprintf(client->name, sizeof(client->name) - 1, "vp27smpx"); | ||
146 | |||
147 | v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name); | ||
148 | |||
149 | state = kzalloc(sizeof(struct vp27smpx_state), GFP_KERNEL); | ||
150 | if (state == NULL) { | ||
151 | kfree(client); | ||
152 | return -ENOMEM; | ||
153 | } | ||
154 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
155 | i2c_set_clientdata(client, state); | ||
156 | |||
157 | /* initialize vp27smpx */ | ||
158 | vp27smpx_set_audmode(client, state->audmode); | ||
159 | i2c_attach_client(client); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static int vp27smpx_probe(struct i2c_adapter *adapter) | ||
165 | { | ||
166 | if (adapter->class & I2C_CLASS_TV_ANALOG) | ||
167 | return i2c_probe(adapter, &addr_data, vp27smpx_attach); | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static int vp27smpx_detach(struct i2c_client *client) | ||
172 | { | ||
173 | struct vp27smpx_state *state = i2c_get_clientdata(client); | ||
174 | int err; | ||
175 | |||
176 | err = i2c_detach_client(client); | ||
177 | if (err) { | ||
178 | return err; | ||
179 | } | ||
180 | kfree(state); | ||
181 | kfree(client); | ||
182 | |||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | /* ----------------------------------------------------------------------- */ | ||
187 | |||
188 | /* i2c implementation */ | ||
189 | static struct i2c_driver i2c_driver = { | ||
190 | .driver = { | ||
191 | .name = "vp27smpx", | ||
192 | }, | ||
193 | .id = I2C_DRIVERID_VP27SMPX, | ||
194 | .attach_adapter = vp27smpx_probe, | ||
195 | .detach_client = vp27smpx_detach, | ||
196 | .command = vp27smpx_command, | ||
197 | }; | ||
198 | |||
199 | |||
200 | static int __init vp27smpx_init_module(void) | ||
201 | { | ||
202 | return i2c_add_driver(&i2c_driver); | ||
203 | } | ||
204 | |||
205 | static void __exit vp27smpx_cleanup_module(void) | ||
206 | { | ||
207 | i2c_del_driver(&i2c_driver); | ||
208 | } | ||
209 | |||
210 | module_init(vp27smpx_init_module); | ||
211 | module_exit(vp27smpx_cleanup_module); | ||
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index b69014865714..4891e03ad23a 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -119,6 +119,7 @@ | |||
119 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ | 119 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ |
120 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ | 120 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ |
121 | #define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ | 121 | #define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ |
122 | #define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ | ||
122 | 123 | ||
123 | #define I2C_DRIVERID_I2CDEV 900 | 124 | #define I2C_DRIVERID_I2CDEV 900 |
124 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ | 125 | #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 09d16c4f00f7..8ae42c41dd08 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -65,6 +65,9 @@ enum { | |||
65 | V4L2_IDENT_CX23415 = 415, | 65 | V4L2_IDENT_CX23415 = 415, |
66 | V4L2_IDENT_CX23416 = 416, | 66 | V4L2_IDENT_CX23416 = 416, |
67 | 67 | ||
68 | /* module vp27smpx: just ident 2700 */ | ||
69 | V4L2_IDENT_VP27SMPX = 2700, | ||
70 | |||
68 | /* module wm8739: just ident 8739 */ | 71 | /* module wm8739: just ident 8739 */ |
69 | V4L2_IDENT_WM8739 = 8739, | 72 | V4L2_IDENT_WM8739 = 8739, |
70 | 73 | ||