~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/media/video/imx074.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
#include <linux/delay.h>
14
14
#include <linux/i2c.h>
 
15
#include <linux/v4l2-mediabus.h>
15
16
#include <linux/slab.h>
16
17
#include <linux/videodev2.h>
 
18
#include <linux/module.h>
17
19
 
18
20
#include <media/soc_camera.h>
19
 
#include <media/soc_mediabus.h>
20
21
#include <media/v4l2-subdev.h>
21
22
#include <media/v4l2-chip-ident.h>
22
23
 
267
268
        return 0;
268
269
}
269
270
 
 
271
static int imx074_g_mbus_config(struct v4l2_subdev *sd,
 
272
                                struct v4l2_mbus_config *cfg)
 
273
{
 
274
        cfg->type = V4L2_MBUS_CSI2;
 
275
        cfg->flags = V4L2_MBUS_CSI2_2_LANE |
 
276
                V4L2_MBUS_CSI2_CHANNEL_0 |
 
277
                V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
 
278
 
 
279
        return 0;
 
280
}
 
281
 
270
282
static struct v4l2_subdev_video_ops imx074_subdev_video_ops = {
271
283
        .s_stream       = imx074_s_stream,
272
284
        .s_mbus_fmt     = imx074_s_fmt,
275
287
        .enum_mbus_fmt  = imx074_enum_fmt,
276
288
        .g_crop         = imx074_g_crop,
277
289
        .cropcap        = imx074_cropcap,
 
290
        .g_mbus_config  = imx074_g_mbus_config,
278
291
};
279
292
 
280
293
static struct v4l2_subdev_core_ops imx074_subdev_core_ops = {
286
299
        .video  = &imx074_subdev_video_ops,
287
300
};
288
301
 
289
 
/*
290
 
 * We have to provide soc-camera operations, but we don't have anything to say
291
 
 * there. The MIPI CSI2 driver will provide .query_bus_param and .set_bus_param
292
 
 */
293
 
static unsigned long imx074_query_bus_param(struct soc_camera_device *icd)
294
 
{
295
 
        return 0;
296
 
}
297
 
 
298
 
static int imx074_set_bus_param(struct soc_camera_device *icd,
299
 
                                 unsigned long flags)
300
 
{
301
 
        return -EINVAL;
302
 
}
303
 
 
304
 
static struct soc_camera_ops imx074_ops = {
305
 
        .query_bus_param        = imx074_query_bus_param,
306
 
        .set_bus_param          = imx074_set_bus_param,
307
 
};
308
 
 
309
 
static int imx074_video_probe(struct soc_camera_device *icd,
310
 
                              struct i2c_client *client)
 
302
static int imx074_video_probe(struct i2c_client *client)
311
303
{
312
304
        int ret;
313
305
        u16 id;
417
409
                        const struct i2c_device_id *did)
418
410
{
419
411
        struct imx074 *priv;
420
 
        struct soc_camera_device *icd = client->dev.platform_data;
421
412
        struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
422
 
        struct soc_camera_link *icl;
 
413
        struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
423
414
        int ret;
424
415
 
425
 
        if (!icd) {
426
 
                dev_err(&client->dev, "IMX074: missing soc-camera data!\n");
427
 
                return -EINVAL;
428
 
        }
429
 
 
430
 
        icl = to_soc_camera_link(icd);
431
416
        if (!icl) {
432
417
                dev_err(&client->dev, "IMX074: missing platform data!\n");
433
418
                return -EINVAL;
445
430
 
446
431
        v4l2_i2c_subdev_init(&priv->subdev, client, &imx074_subdev_ops);
447
432
 
448
 
        icd->ops        = &imx074_ops;
449
433
        priv->fmt       = &imx074_colour_fmts[0];
450
434
 
451
 
        ret = imx074_video_probe(icd, client);
 
435
        ret = imx074_video_probe(client);
452
436
        if (ret < 0) {
453
 
                icd->ops = NULL;
454
437
                kfree(priv);
455
438
                return ret;
456
439
        }
461
444
static int imx074_remove(struct i2c_client *client)
462
445
{
463
446
        struct imx074 *priv = to_imx074(client);
464
 
        struct soc_camera_device *icd = client->dev.platform_data;
465
 
        struct soc_camera_link *icl = to_soc_camera_link(icd);
 
447
        struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
466
448
 
467
 
        icd->ops = NULL;
468
449
        if (icl->free_bus)
469
450
                icl->free_bus(icl);
470
451
        kfree(priv);