aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx18
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-13 15:09:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-13 15:09:57 -0400
commit858655116bfc722837e3aec0909b8e9d08f96996 (patch)
treeef9171d51ffcd01e40d1131d62be32e5a7d371dc /drivers/media/pci/cx18
parent239dab4636f7f5f971ac39b5ca84254cff112cac (diff)
parent1b2c14b44adcb7836528640bfdc40bf7499d987d (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: "This series contain: - new i2c video drivers: ml86v7667 (video decoder), ths8200 (video encoder) - a new video driver for EasyCap cards based on Fushicai USBTV007 - Improved support for OF and embedded systems, with V4L2 async initialization and a better support for clocks - API cleanups on the ioctls used by the v4l2 debug tool - Lots of cleanups - As usual, several driver improvements and new cards additions - Revert two changesets that change the minimal symbol rate for stv0399, as request by Manu - Update MAINTAINERS and other files to point to my new e-mail" * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (378 commits) MAINTAINERS & ABI: Update to point to my new email [media] stb0899: restore minimal rate to 5Mbauds [media] exynos4-is: Correct colorspace handling at FIMC-LITE [media] exynos4-is: Set valid initial format on FIMC.n subdevs [media] exynos4-is: Set valid initial format on FIMC-IS-ISP subdev pads [media] exynos4-is: Fix format propagation on FIMC-IS-ISP subdev [media] exynos4-is: Set valid initial format at FIMC-LITE [media] exynos4-is: Fix format propagation on FIMC-LITE.n subdevs [media] MAINTAINERS: Update S5P/Exynos FIMC driver entry [media] Documentation: Update driver's directory in video4linux/fimc.txt [media] exynos4-is: Change fimc-is firmware file names [media] exynos4-is: Add support for Exynos5250 MIPI-CSIS [media] exynos4-is: Add Exynos5250 SoC support to fimc-lite driver [media] exynos4-is: Drop drvdata handling in fimc-lite for non-dt platforms [media] media: i2c: tvp514x: remove manual setting of subdev name [media] media: i2c: tvp7002: remove manual setting of subdev name [media] mem2mem: set missing v4l2_dev pointer [media] wl128x: add missing struct v4l2_device [media] tvp514x: Fix init seqeunce [media] saa7134: Fix sparse warnings by adding __user annotation ...
Diffstat (limited to 'drivers/media/pci/cx18')
-rw-r--r--drivers/media/pci/cx18/cx18-av-core.c36
-rw-r--r--drivers/media/pci/cx18/cx18-av-core.h1
-rw-r--r--drivers/media/pci/cx18/cx18-ioctl.c82
3 files changed, 11 insertions, 108 deletions
diff --git a/drivers/media/pci/cx18/cx18-av-core.c b/drivers/media/pci/cx18/cx18-av-core.c
index 38b1d64ffc27..c4890a430dc6 100644
--- a/drivers/media/pci/cx18/cx18-av-core.c
+++ b/drivers/media/pci/cx18/cx18-av-core.c
@@ -22,7 +22,6 @@
22 * 02110-1301, USA. 22 * 02110-1301, USA.
23 */ 23 */
24 24
25#include <media/v4l2-chip-ident.h>
26#include "cx18-driver.h" 25#include "cx18-driver.h"
27#include "cx18-io.h" 26#include "cx18-io.h"
28#include "cx18-cards.h" 27#include "cx18-cards.h"
@@ -1231,35 +1230,14 @@ static int cx18_av_log_status(struct v4l2_subdev *sd)
1231 return 0; 1230 return 0;
1232} 1231}
1233 1232
1234static inline int cx18_av_dbg_match(const struct v4l2_dbg_match *match)
1235{
1236 return match->type == V4L2_CHIP_MATCH_HOST && match->addr == 1;
1237}
1238
1239static int cx18_av_g_chip_ident(struct v4l2_subdev *sd,
1240 struct v4l2_dbg_chip_ident *chip)
1241{
1242 struct cx18_av_state *state = to_cx18_av_state(sd);
1243
1244 if (cx18_av_dbg_match(&chip->match)) {
1245 chip->ident = state->id;
1246 chip->revision = state->rev;
1247 }
1248 return 0;
1249}
1250
1251#ifdef CONFIG_VIDEO_ADV_DEBUG 1233#ifdef CONFIG_VIDEO_ADV_DEBUG
1252static int cx18_av_g_register(struct v4l2_subdev *sd, 1234static int cx18_av_g_register(struct v4l2_subdev *sd,
1253 struct v4l2_dbg_register *reg) 1235 struct v4l2_dbg_register *reg)
1254{ 1236{
1255 struct cx18 *cx = v4l2_get_subdevdata(sd); 1237 struct cx18 *cx = v4l2_get_subdevdata(sd);
1256 1238
1257 if (!cx18_av_dbg_match(&reg->match))
1258 return -EINVAL;
1259 if ((reg->reg & 0x3) != 0) 1239 if ((reg->reg & 0x3) != 0)
1260 return -EINVAL; 1240 return -EINVAL;
1261 if (!capable(CAP_SYS_ADMIN))
1262 return -EPERM;
1263 reg->size = 4; 1241 reg->size = 4;
1264 reg->val = cx18_av_read4(cx, reg->reg & 0x00000ffc); 1242 reg->val = cx18_av_read4(cx, reg->reg & 0x00000ffc);
1265 return 0; 1243 return 0;
@@ -1270,12 +1248,8 @@ static int cx18_av_s_register(struct v4l2_subdev *sd,
1270{ 1248{
1271 struct cx18 *cx = v4l2_get_subdevdata(sd); 1249 struct cx18 *cx = v4l2_get_subdevdata(sd);
1272 1250
1273 if (!cx18_av_dbg_match(&reg->match))
1274 return -EINVAL;
1275 if ((reg->reg & 0x3) != 0) 1251 if ((reg->reg & 0x3) != 0)
1276 return -EINVAL; 1252 return -EINVAL;
1277 if (!capable(CAP_SYS_ADMIN))
1278 return -EPERM;
1279 cx18_av_write4(cx, reg->reg & 0x00000ffc, reg->val); 1253 cx18_av_write4(cx, reg->reg & 0x00000ffc, reg->val);
1280 return 0; 1254 return 0;
1281} 1255}
@@ -1286,17 +1260,9 @@ static const struct v4l2_ctrl_ops cx18_av_ctrl_ops = {
1286}; 1260};
1287 1261
1288static const struct v4l2_subdev_core_ops cx18_av_general_ops = { 1262static const struct v4l2_subdev_core_ops cx18_av_general_ops = {
1289 .g_chip_ident = cx18_av_g_chip_ident,
1290 .log_status = cx18_av_log_status, 1263 .log_status = cx18_av_log_status,
1291 .load_fw = cx18_av_load_fw, 1264 .load_fw = cx18_av_load_fw,
1292 .reset = cx18_av_reset, 1265 .reset = cx18_av_reset,
1293 .g_ctrl = v4l2_subdev_g_ctrl,
1294 .s_ctrl = v4l2_subdev_s_ctrl,
1295 .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
1296 .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
1297 .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
1298 .queryctrl = v4l2_subdev_queryctrl,
1299 .querymenu = v4l2_subdev_querymenu,
1300 .s_std = cx18_av_s_std, 1266 .s_std = cx18_av_s_std,
1301#ifdef CONFIG_VIDEO_ADV_DEBUG 1267#ifdef CONFIG_VIDEO_ADV_DEBUG
1302 .g_register = cx18_av_g_register, 1268 .g_register = cx18_av_g_register,
@@ -1344,8 +1310,6 @@ int cx18_av_probe(struct cx18 *cx)
1344 int err; 1310 int err;
1345 1311
1346 state->rev = cx18_av_read4(cx, CXADEC_CHIP_CTRL) & 0xffff; 1312 state->rev = cx18_av_read4(cx, CXADEC_CHIP_CTRL) & 0xffff;
1347 state->id = ((state->rev >> 4) == CXADEC_CHIP_TYPE_MAKO)
1348 ? V4L2_IDENT_CX23418_843 : V4L2_IDENT_UNKNOWN;
1349 1313
1350 state->vid_input = CX18_AV_COMPOSITE7; 1314 state->vid_input = CX18_AV_COMPOSITE7;
1351 state->aud_input = CX18_AV_AUDIO8; 1315 state->aud_input = CX18_AV_AUDIO8;
diff --git a/drivers/media/pci/cx18/cx18-av-core.h b/drivers/media/pci/cx18/cx18-av-core.h
index e9c69d9c9e4a..4c559e86e340 100644
--- a/drivers/media/pci/cx18/cx18-av-core.h
+++ b/drivers/media/pci/cx18/cx18-av-core.h
@@ -104,7 +104,6 @@ struct cx18_av_state {
104 enum cx18_av_audio_input aud_input; 104 enum cx18_av_audio_input aud_input;
105 u32 audclk_freq; 105 u32 audclk_freq;
106 int audmode; 106 int audmode;
107 u32 id;
108 u32 rev; 107 u32 rev;
109 int is_initialized; 108 int is_initialized;
110 109
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
index aee7b6dacbfe..1110bcb14e2f 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -39,7 +39,6 @@
39#include "cx18-cards.h" 39#include "cx18-cards.h"
40#include "cx18-av-core.h" 40#include "cx18-av-core.h"
41#include <media/tveeprom.h> 41#include <media/tveeprom.h>
42#include <media/v4l2-chip-ident.h>
43 42
44u16 cx18_service2vbi(int type) 43u16 cx18_service2vbi(int type)
45{ 44{
@@ -362,73 +361,18 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
362 return 0; 361 return 0;
363} 362}
364 363
365static int cx18_g_chip_ident(struct file *file, void *fh,
366 struct v4l2_dbg_chip_ident *chip)
367{
368 struct cx18 *cx = fh2id(fh)->cx;
369 int err = 0;
370
371 chip->ident = V4L2_IDENT_NONE;
372 chip->revision = 0;
373 switch (chip->match.type) {
374 case V4L2_CHIP_MATCH_HOST:
375 switch (chip->match.addr) {
376 case 0:
377 chip->ident = V4L2_IDENT_CX23418;
378 chip->revision = cx18_read_reg(cx, 0xC72028);
379 break;
380 case 1:
381 /*
382 * The A/V decoder is always present, but in the rare
383 * case that the card doesn't have analog, we don't
384 * use it. We find it w/o using the cx->sd_av pointer
385 */
386 cx18_call_hw(cx, CX18_HW_418_AV,
387 core, g_chip_ident, chip);
388 break;
389 default:
390 /*
391 * Could return ident = V4L2_IDENT_UNKNOWN if we had
392 * other host chips at higher addresses, but we don't
393 */
394 err = -EINVAL; /* per V4L2 spec */
395 break;
396 }
397 break;
398 case V4L2_CHIP_MATCH_I2C_DRIVER:
399 /* If needed, returns V4L2_IDENT_AMBIGUOUS without extra work */
400 cx18_call_all(cx, core, g_chip_ident, chip);
401 break;
402 case V4L2_CHIP_MATCH_I2C_ADDR:
403 /*
404 * We could return V4L2_IDENT_UNKNOWN, but we don't do the work
405 * to look if a chip is at the address with no driver. That's a
406 * dangerous thing to do with EEPROMs anyway.
407 */
408 cx18_call_all(cx, core, g_chip_ident, chip);
409 break;
410 default:
411 err = -EINVAL;
412 break;
413 }
414 return err;
415}
416
417#ifdef CONFIG_VIDEO_ADV_DEBUG 364#ifdef CONFIG_VIDEO_ADV_DEBUG
418static int cx18_g_register(struct file *file, void *fh, 365static int cx18_g_register(struct file *file, void *fh,
419 struct v4l2_dbg_register *reg) 366 struct v4l2_dbg_register *reg)
420{ 367{
421 struct cx18 *cx = fh2id(fh)->cx; 368 struct cx18 *cx = fh2id(fh)->cx;
422 369
423 if (v4l2_chip_match_host(&reg->match)) { 370 if (reg->reg & 0x3)
424 if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) 371 return -EINVAL;
425 return -EINVAL; 372 if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE)
426 reg->size = 4; 373 return -EINVAL;
427 reg->val = cx18_read_enc(cx, reg->reg); 374 reg->size = 4;
428 return 0; 375 reg->val = cx18_read_enc(cx, reg->reg);
429 }
430 /* FIXME - errors shouldn't be ignored */
431 cx18_call_all(cx, core, g_register, reg);
432 return 0; 376 return 0;
433} 377}
434 378
@@ -437,14 +381,11 @@ static int cx18_s_register(struct file *file, void *fh,
437{ 381{
438 struct cx18 *cx = fh2id(fh)->cx; 382 struct cx18 *cx = fh2id(fh)->cx;
439 383
440 if (v4l2_chip_match_host(&reg->match)) { 384 if (reg->reg & 0x3)
441 if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE) 385 return -EINVAL;
442 return -EINVAL; 386 if (reg->reg >= CX18_MEM_OFFSET + CX18_MEM_SIZE)
443 cx18_write_enc(cx, reg->val, reg->reg); 387 return -EINVAL;
444 return 0; 388 cx18_write_enc(cx, reg->val, reg->reg);
445 }
446 /* FIXME - errors shouldn't be ignored */
447 cx18_call_all(cx, core, s_register, reg);
448 return 0; 389 return 0;
449} 390}
450#endif 391#endif
@@ -1162,7 +1103,6 @@ static const struct v4l2_ioctl_ops cx18_ioctl_ops = {
1162 .vidioc_try_fmt_vbi_cap = cx18_try_fmt_vbi_cap, 1103 .vidioc_try_fmt_vbi_cap = cx18_try_fmt_vbi_cap,
1163 .vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap, 1104 .vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap,
1164 .vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap, 1105 .vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap,
1165 .vidioc_g_chip_ident = cx18_g_chip_ident,
1166#ifdef CONFIG_VIDEO_ADV_DEBUG 1106#ifdef CONFIG_VIDEO_ADV_DEBUG
1167 .vidioc_g_register = cx18_g_register, 1107 .vidioc_g_register = cx18_g_register,
1168 .vidioc_s_register = cx18_s_register, 1108 .vidioc_s_register = cx18_s_register,