cregit-Linux how code gets into the kernel

Release 4.11 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

PersonTokensPropCommitsCommitProp
Guennadi Liakhovetski34100.00%1100.00%
Total34100.00%1100.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

PersonTokensPropCommitsCommitProp
Magnus Damm2676.47%150.00%
Guennadi Liakhovetski823.53%150.00%
Total34100.00%2100.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

PersonTokensPropCommitsCommitProp
Magnus Damm3840.43%116.67%
Guennadi Liakhovetski2829.79%350.00%
Hans Verkuil1718.09%116.67%
Kuninori Morimoto1111.70%116.67%
Total94100.00%6100.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

PersonTokensPropCommitsCommitProp
Laurent Pinchart4187.23%133.33%
Guennadi Liakhovetski612.77%266.67%
Total47100.00%3100.00%

static const 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

PersonTokensPropCommitsCommitProp
Guennadi Liakhovetski3051.72%250.00%
Hans Verkuil1525.86%125.00%
Magnus Damm1322.41%125.00%
Total58100.00%4100.00%


static int soc_camera_platform_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) { struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) return -EINVAL; switch (sel->target) { case V4L2_SEL_TGT_CROP_BOUNDS: case V4L2_SEL_TGT_CROP_DEFAULT: case V4L2_SEL_TGT_CROP: sel->r.left = 0; sel->r.top = 0; sel->r.width = p->format.width; sel->r.height = p->format.height; return 0; default: return -EINVAL; } }

Contributors

PersonTokensPropCommitsCommitProp
Kuninori Morimoto6156.48%150.00%
Hans Verkuil4743.52%150.00%
Total108100.00%2100.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

PersonTokensPropCommitsCommitProp
Guennadi Liakhovetski45100.00%1100.00%
Total45100.00%1100.00%

static const struct v4l2_subdev_video_ops platform_subdev_video_ops = { .s_stream = soc_camera_platform_s_stream, .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_selection = soc_camera_platform_get_selection, .get_fmt = soc_camera_platform_fill_fmt, .set_fmt = soc_camera_platform_fill_fmt, }; static const 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

PersonTokensPropCommitsCommitProp
Guennadi Liakhovetski11762.90%571.43%
Magnus Damm6836.56%114.29%
Sachin Kamat10.54%114.29%
Total186100.00%7100.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

PersonTokensPropCommitsCommitProp
Guennadi Liakhovetski3056.60%375.00%
Magnus Damm2343.40%125.00%
Total53100.00%4100.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

PersonTokensPropCommitsCommitProp
Guennadi Liakhovetski34040.82%1254.55%
Magnus Damm25330.37%14.55%
Hans Verkuil11313.57%313.64%
Kuninori Morimoto728.64%14.55%
Laurent Pinchart485.76%14.55%
Bhumika Goyal30.36%14.55%
Axel Lin20.24%14.55%
Mauro Carvalho Chehab10.12%14.55%
Sachin Kamat10.12%14.55%
Total833100.00%22100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.