Release 4.7 drivers/media/platform/soc_camera/soc_camera_platform.c
/*
* Generic Platform Camera Driver
*
* Copyright (C) 2008 Magnus Damm
* Based on mt9m001 driver,
* Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
*
* 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.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/videodev2.h>
#include <media/v4l2-subdev.h>
#include <media/soc_camera.h>
#include <linux/platform_data/media/soc_camera_platform.h>
struct soc_camera_platform_priv {
struct v4l2_subdev subdev;
};
static struct soc_camera_platform_priv *get_priv(struct platform_device *pdev)
{
struct v4l2_subdev *subdev = platform_get_drvdata(pdev);
return container_of(subdev, struct soc_camera_platform_priv, subdev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
guennadi liakhovetski | guennadi liakhovetski | 34 | 100.00% | 1 | 100.00% |
| Total | 34 | 100.00% | 1 | 100.00% |
static int soc_camera_platform_s_stream(struct v4l2_subdev *sd, int enable)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
return p->set_capture(p, enable);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
magnus damm | magnus damm | 26 | 76.47% | 1 | 50.00% |
guennadi liakhovetski | guennadi liakhovetski | 8 | 23.53% | 1 | 50.00% |
| Total | 34 | 100.00% | 2 | 100.00% |
static int soc_camera_platform_fill_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *format)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
struct v4l2_mbus_framefmt *mf = &format->format;
mf->width = p->format.width;
mf->height = p->format.height;
mf->code = p->format.code;
mf->colorspace = p->format.colorspace;
mf->field = p->format.field;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
magnus damm | magnus damm | 38 | 40.43% | 1 | 16.67% |
guennadi liakhovetski | guennadi liakhovetski | 28 | 29.79% | 3 | 50.00% |
hans verkuil | hans verkuil | 17 | 18.09% | 1 | 16.67% |
kuninori morimoto | kuninori morimoto | 11 | 11.70% | 1 | 16.67% |
| Total | 94 | 100.00% | 6 | 100.00% |
static int soc_camera_platform_s_power(struct v4l2_subdev *sd, int on)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
return soc_camera_set_power(p->icd->control, &p->icd->sdesc->subdev_desc, NULL, on);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
laurent pinchart | laurent pinchart | 41 | 87.23% | 1 | 33.33% |
guennadi liakhovetski | guennadi liakhovetski | 6 | 12.77% | 2 | 66.67% |
| Total | 47 | 100.00% | 3 | 100.00% |
static struct v4l2_subdev_core_ops platform_subdev_core_ops = {
.s_power = soc_camera_platform_s_power,
};
static int soc_camera_platform_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_mbus_code_enum *code)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
if (code->pad || code->index)
return -EINVAL;
code->code = p->format.code;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
guennadi liakhovetski | guennadi liakhovetski | 30 | 51.72% | 2 | 50.00% |
hans verkuil | hans verkuil | 15 | 25.86% | 1 | 25.00% |
magnus damm | magnus damm | 13 | 22.41% | 1 | 25.00% |
| Total | 58 | 100.00% | 4 | 100.00% |
static int soc_camera_platform_g_crop(struct v4l2_subdev *sd,
struct v4l2_crop *a)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
a->c.left = 0;
a->c.top = 0;
a->c.width = p->format.width;
a->c.height = p->format.height;
a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kuninori morimoto | kuninori morimoto | 75 | 100.00% | 1 | 100.00% |
| Total | 75 | 100.00% | 1 | 100.00% |
static int soc_camera_platform_cropcap(struct v4l2_subdev *sd,
struct v4l2_cropcap *a)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
a->bounds.left = 0;
a->bounds.top = 0;
a->bounds.width = p->format.width;
a->bounds.height = p->format.height;
a->defrect = a->bounds;
a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
a->pixelaspect.numerator = 1;
a->pixelaspect.denominator = 1;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
kuninori morimoto | kuninori morimoto | 99 | 100.00% | 1 | 100.00% |
| Total | 99 | 100.00% | 1 | 100.00% |
static int soc_camera_platform_g_mbus_config(struct v4l2_subdev *sd,
struct v4l2_mbus_config *cfg)
{
struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
cfg->flags = p->mbus_param;
cfg->type = p->mbus_type;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
guennadi liakhovetski | guennadi liakhovetski | 45 | 100.00% | 1 | 100.00% |
| Total | 45 | 100.00% | 1 | 100.00% |
static struct v4l2_subdev_video_ops platform_subdev_video_ops = {
.s_stream = soc_camera_platform_s_stream,
.cropcap = soc_camera_platform_cropcap,
.g_crop = soc_camera_platform_g_crop,
.g_mbus_config = soc_camera_platform_g_mbus_config,
};
static const struct v4l2_subdev_pad_ops platform_subdev_pad_ops = {
.enum_mbus_code = soc_camera_platform_enum_mbus_code,
.get_fmt = soc_camera_platform_fill_fmt,
.set_fmt = soc_camera_platform_fill_fmt,
};
static struct v4l2_subdev_ops platform_subdev_ops = {
.core = &platform_subdev_core_ops,
.video = &platform_subdev_video_ops,
.pad = &platform_subdev_pad_ops,
};
static int soc_camera_platform_probe(struct platform_device *pdev)
{
struct soc_camera_host *ici;
struct soc_camera_platform_priv *priv;
struct soc_camera_platform_info *p = pdev->dev.platform_data;
struct soc_camera_device *icd;
if (!p)
return -EINVAL;
if (!p->icd) {
dev_err(&pdev->dev,
"Platform has not set soc_camera_device pointer!\n");
return -EINVAL;
}
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
icd = p->icd;
/* soc-camera convention: control's drvdata points to the subdev */
platform_set_drvdata(pdev, &priv->subdev);
/* Set the control device reference */
icd->control = &pdev->dev;
ici = to_soc_camera_host(icd->parent);
v4l2_subdev_init(&priv->subdev, &platform_subdev_ops);
v4l2_set_subdevdata(&priv->subdev, p);
strncpy(priv->subdev.name, dev_name(&pdev->dev), V4L2_SUBDEV_NAME_SIZE);
return v4l2_device_register_subdev(&ici->v4l2_dev, &priv->subdev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
guennadi liakhovetski | guennadi liakhovetski | 117 | 62.90% | 5 | 71.43% |
magnus damm | magnus damm | 68 | 36.56% | 1 | 14.29% |
sachin kamat | sachin kamat | 1 | 0.54% | 1 | 14.29% |
| Total | 186 | 100.00% | 7 | 100.00% |
static int soc_camera_platform_remove(struct platform_device *pdev)
{
struct soc_camera_platform_priv *priv = get_priv(pdev);
struct soc_camera_platform_info *p = v4l2_get_subdevdata(&priv->subdev);
p->icd->control = NULL;
v4l2_device_unregister_subdev(&priv->subdev);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
guennadi liakhovetski | guennadi liakhovetski | 30 | 56.60% | 3 | 75.00% |
magnus damm | magnus damm | 23 | 43.40% | 1 | 25.00% |
| Total | 53 | 100.00% | 4 | 100.00% |
static struct platform_driver soc_camera_platform_driver = {
.driver = {
.name = "soc_camera_platform",
},
.probe = soc_camera_platform_probe,
.remove = soc_camera_platform_remove,
};
module_platform_driver(soc_camera_platform_driver);
MODULE_DESCRIPTION("SoC Camera Platform driver");
MODULE_AUTHOR("Magnus Damm");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:soc_camera_platform");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
guennadi liakhovetski | guennadi liakhovetski | 340 | 37.74% | 12 | 60.00% |
magnus damm | magnus damm | 253 | 28.08% | 1 | 5.00% |
kuninori morimoto | kuninori morimoto | 195 | 21.64% | 1 | 5.00% |
hans verkuil | hans verkuil | 61 | 6.77% | 2 | 10.00% |
laurent pinchart | laurent pinchart | 48 | 5.33% | 1 | 5.00% |
axel lin | axel lin | 2 | 0.22% | 1 | 5.00% |
mauro carvalho chehab | mauro carvalho chehab | 1 | 0.11% | 1 | 5.00% |
sachin kamat | sachin kamat | 1 | 0.11% | 1 | 5.00% |
| Total | 901 | 100.00% | 20 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.