Blame view
include/media/soc_camera_platform.h
1.73 KB
073afdd79 V4L/DVB (9245): v... |
1 2 3 4 5 6 7 8 9 |
/* * Generic Platform Camera Driver Header * * Copyright (C) 2008 Magnus Damm * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ |
326c98620 V4L/DVB (8343): s... |
10 11 12 13 |
#ifndef __SOC_CAMERA_H__ #define __SOC_CAMERA_H__ #include <linux/videodev2.h> |
c41debafc V4L/DVB (12504): ... |
14 |
#include <media/soc_camera.h> |
84c760a5d [media] V4L: soc_... |
15 |
#include <media/v4l2-mediabus.h> |
326c98620 V4L/DVB (8343): s... |
16 |
|
bc1937b41 V4L/DVB (12505): ... |
17 |
struct device; |
326c98620 V4L/DVB (8343): s... |
18 |
struct soc_camera_platform_info { |
40e2e0927 V4L/DVB (12506): ... |
19 |
const char *format_name; |
326c98620 V4L/DVB (8343): s... |
20 |
unsigned long format_depth; |
760697bec V4L/DVB (13659): ... |
21 |
struct v4l2_mbus_framefmt format; |
84c760a5d [media] V4L: soc_... |
22 23 |
unsigned long mbus_param; enum v4l2_mbus_type mbus_type; |
7dfff9536 [media] V4L: soc-... |
24 |
struct soc_camera_device *icd; |
326c98620 V4L/DVB (8343): s... |
25 26 |
int (*set_capture)(struct soc_camera_platform_info *info, int enable); }; |
ec0c8d555 [media] V4L: soc_... |
27 28 29 30 |
static inline void soc_camera_platform_release(struct platform_device **pdev) { *pdev = NULL; } |
7dfff9536 [media] V4L: soc-... |
31 |
static inline int soc_camera_platform_add(struct soc_camera_device *icd, |
ec0c8d555 [media] V4L: soc_... |
32 33 34 35 36 37 38 |
struct platform_device **pdev, struct soc_camera_link *plink, void (*release)(struct device *dev), int id) { struct soc_camera_platform_info *info = plink->priv; int ret; |
7dfff9536 [media] V4L: soc-... |
39 |
if (icd->link != plink) |
ec0c8d555 [media] V4L: soc_... |
40 41 42 43 44 45 46 47 |
return -ENODEV; if (*pdev) return -EBUSY; *pdev = platform_device_alloc("soc_camera_platform", id); if (!*pdev) return -ENOMEM; |
7dfff9536 [media] V4L: soc-... |
48 |
info->icd = icd; |
ec0c8d555 [media] V4L: soc_... |
49 50 51 52 53 54 55 56 |
(*pdev)->dev.platform_data = info; (*pdev)->dev.release = release; ret = platform_device_add(*pdev); if (ret < 0) { platform_device_put(*pdev); *pdev = NULL; |
7dfff9536 [media] V4L: soc-... |
57 |
info->icd = NULL; |
ec0c8d555 [media] V4L: soc_... |
58 59 60 61 |
} return ret; } |
7dfff9536 [media] V4L: soc-... |
62 |
static inline void soc_camera_platform_del(const struct soc_camera_device *icd, |
ec0c8d555 [media] V4L: soc_... |
63 64 65 |
struct platform_device *pdev, const struct soc_camera_link *plink) { |
7dfff9536 [media] V4L: soc-... |
66 |
if (icd->link != plink || !pdev) |
ec0c8d555 [media] V4L: soc_... |
67 68 69 70 |
return; platform_device_unregister(pdev); } |
326c98620 V4L/DVB (8343): s... |
71 |
#endif /* __SOC_CAMERA_H__ */ |