kvm tools, setup: Create private directory
[linux-2.6/next.git] / include / media / soc_camera_platform.h
blob6d7a4fd00fc064a42f77b3e0caba5fb66c3f1f40
1 /*
2 * Generic Platform Camera Driver Header
4 * Copyright (C) 2008 Magnus Damm
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #ifndef __SOC_CAMERA_H__
12 #define __SOC_CAMERA_H__
14 #include <linux/videodev2.h>
15 #include <media/soc_camera.h>
17 struct device;
19 struct soc_camera_platform_info {
20 const char *format_name;
21 unsigned long format_depth;
22 struct v4l2_mbus_framefmt format;
23 unsigned long bus_param;
24 struct device *dev;
25 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
28 static inline void soc_camera_platform_release(struct platform_device **pdev)
30 *pdev = NULL;
33 static inline int soc_camera_platform_add(const struct soc_camera_link *icl,
34 struct device *dev,
35 struct platform_device **pdev,
36 struct soc_camera_link *plink,
37 void (*release)(struct device *dev),
38 int id)
40 struct soc_camera_platform_info *info = plink->priv;
41 int ret;
43 if (icl != plink)
44 return -ENODEV;
46 if (*pdev)
47 return -EBUSY;
49 *pdev = platform_device_alloc("soc_camera_platform", id);
50 if (!*pdev)
51 return -ENOMEM;
53 info->dev = dev;
55 (*pdev)->dev.platform_data = info;
56 (*pdev)->dev.release = release;
58 ret = platform_device_add(*pdev);
59 if (ret < 0) {
60 platform_device_put(*pdev);
61 *pdev = NULL;
62 info->dev = NULL;
65 return ret;
68 static inline void soc_camera_platform_del(const struct soc_camera_link *icl,
69 struct platform_device *pdev,
70 const struct soc_camera_link *plink)
72 if (icl != plink || !pdev)
73 return;
75 platform_device_unregister(pdev);
78 #endif /* __SOC_CAMERA_H__ */