Path: blob/master/include/media/soc_camera_platform.h
10817 views
/*1* Generic Platform Camera Driver Header2*3* Copyright (C) 2008 Magnus Damm4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/910#ifndef __SOC_CAMERA_H__11#define __SOC_CAMERA_H__1213#include <linux/videodev2.h>14#include <media/soc_camera.h>1516struct device;1718struct soc_camera_platform_info {19const char *format_name;20unsigned long format_depth;21struct v4l2_mbus_framefmt format;22unsigned long bus_param;23struct device *dev;24int (*set_capture)(struct soc_camera_platform_info *info, int enable);25};2627static inline void soc_camera_platform_release(struct platform_device **pdev)28{29*pdev = NULL;30}3132static inline int soc_camera_platform_add(const struct soc_camera_link *icl,33struct device *dev,34struct platform_device **pdev,35struct soc_camera_link *plink,36void (*release)(struct device *dev),37int id)38{39struct soc_camera_platform_info *info = plink->priv;40int ret;4142if (icl != plink)43return -ENODEV;4445if (*pdev)46return -EBUSY;4748*pdev = platform_device_alloc("soc_camera_platform", id);49if (!*pdev)50return -ENOMEM;5152info->dev = dev;5354(*pdev)->dev.platform_data = info;55(*pdev)->dev.release = release;5657ret = platform_device_add(*pdev);58if (ret < 0) {59platform_device_put(*pdev);60*pdev = NULL;61info->dev = NULL;62}6364return ret;65}6667static inline void soc_camera_platform_del(const struct soc_camera_link *icl,68struct platform_device *pdev,69const struct soc_camera_link *plink)70{71if (icl != plink || !pdev)72return;7374platform_device_unregister(pdev);75}7677#endif /* __SOC_CAMERA_H__ */787980