Commit graph

16 commits

Author SHA1 Message Date
Hans Verkuil 34b92def75 [media] ov9740: avoid calling ov9740_res_roundup() twice
Simplify ov9740_s_fmt.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-14 22:32:26 -03:00
Bhumika Goyal 6713c88fd0 [media] media: i2c: soc_camera: constify v4l2_subdev_* structures
v4l2_subdev_{core/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle: (One of the scripts used)

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_video_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_video_ops i;

File sizes before and after the changes:
   text	   data	    bss	    dec	    hex	filename

   3459	    696	      0	   4155	   103b	/media/i2c/soc_camera/imx074.o
   3835	    320	      0	   4155	   103b	/media/i2c/soc_camera/imx074.o

   4749	   1048	      8	   5805	   16ad	/media/i2c/soc_camera/mt9m001.o
   5133	    672	      8	   5813	   16b5	/media/i2c/soc_camera/mt9m001.o

   5658	   1112	      8	   6778	   1a7a	/media/i2c/soc_camera/mt9t031.o
   6042	    728	      8	   6778	   1a7a	/media/i2c/soc_camera/mt9t031.o

   6726	    784	      0	   7510	   1d56	/media/i2c/soc_camera/mt9t112.o
   7110	    408	      0	   7518	   1d5e	/media/i2c/soc_camera/mt9t112.o

   6700	    960	     16	   7676	   1dfc	/media/i2c/soc_camera/mt9v022.o
   7084	    584	     16	   7684	   1e04	/media/i2c/soc_camera/mt9v022.o

   5569	   1576	      8	   7153	   1bf1	/media/i2c/soc_camera/ov2640.o
   5953	   1200	      8	   7161	   1bf9	/media/i2c/soc_camera/ov2640.o

   3018	   2736	      0	   5754	   167a	/media/i2c/soc_camera/ov5642.o
   3394	   2352	      0	   5746	   1672	/media/i2c/soc_camera/ov5642.o

   8348	   2104	      8	  10460	   28dc	/media/i2c/soc_camera/ov6650.o
   8716	   1728	      8	  10452	   28d4	/media/i2c/soc_camera/ov6650.o

   4165	    696	      8	   4869	   1305	/media/i2c/soc_camera/ov772x.o
   4549	    320	      8	   4877	   130d	/media/i2c/soc_camera/ov772x.o

   4033	    608	      8	   4649	   1229	/media/i2c/soc_camera/ov9640.o
   4417	    232	      8	   4657	   1231	/media/i2c/soc_camera/ov9640.o

   4983	    784	      8	   5775	   168f	/media/i2c/soc_camera/ov9740.o
   5367	    408	      8	   5783	   1697	/media/i2c/soc_camera/ov9740.o

   8578	   1312	      8	   9898	   26aa i2c/soc_camera/rj54n1cb0c.o
   8962	    936	      8	   9906	   26b2 i2c/soc_camera/rj54n1cb0c.o

   3886	    696	      0	   4582	   11e6	/media/i2c/soc_camera/tw9910.o
   4270	    320	      0	   4590	   11ee	/media/i2c/soc_camera/tw9910.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-23 14:43:49 -03:00
Mauro Carvalho Chehab 8f44c39251 [media] soc_camera: don't break long lines
Due to the 80-cols restrictions, and latter due to checkpatch
warnings, several strings were broken into multiple lines. This
is not considered a good practice anymore, as it makes harder
to grep for strings at the source code.

As we're right now fixing other drivers due to KERN_CONT, we need
to be able to identify what printk strings don't end with a "\n".
It is a way easier to detect those if we don't break long lines.

So, join those continuation lines.

The patch was generated via the script below, and manually
adjusted if needed.

</script>
use Text::Tabs;
while (<>) {
	if ($next ne "") {
		$c=$_;
		if ($c =~ /^\s+\"(.*)/) {
			$c2=$1;
			$next =~ s/\"\n$//;
			$n = expand($next);
			$funpos = index($n, '(');
			$pos = index($c2, '",');
			if ($funpos && $pos > 0) {
				$s1 = substr $c2, 0, $pos + 2;
				$s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2;
				$s2 =~ s/^\s+//;

				$s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne "");

				print unexpand("$next$s1\n");
				print unexpand("$s2\n") if ($s2 ne "");
			} else {
				print "$next$c2\n";
			}
			$next="";
			next;
		} else {
			print $next;
		}
		$next="";
	} else {
		if (m/\"$/) {
			if (!m/\\n\"$/) {
				$next=$_;
				next;
			}
		}
	}
	print $_;
}
</script>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-21 08:51:50 -02:00
Hans Verkuil 10d5509c8d [media] v4l2: remove g/s_crop from video ops
Replace all calls to g/s_crop by calls to the get/set_selection pad ops.

Remove the old g/s_crop video ops since they are now no longer used.

The cropcap video op is now only used to pass pixelaspect information,
and is only needed if the pixelaspect is not 1:1.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-24 09:46:09 -03:00
Hans Verkuil 717fd5b490 [media] v4l2: replace try_mbus_fmt by set_fmt
The try_mbus_fmt video op is a duplicate of the pad op. Replace all uses
in sub-devices by the set_fmt() pad op.

Since try_mbus_fmt and s_mbus_fmt both map to the set_fmt pad op (but
with a different 'which' argument), this patch will replace both
try_mbus_fmt and s_mbus_fmt by set_fmt.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 08:48:49 -03:00
Hans Verkuil ebcff5fce6 [media] v4l2: replace enum_mbus_fmt by enum_mbus_code
Replace all calls to the enum_mbus_fmt video op by the pad
enum_mbus_code op and remove the duplicate video op.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kamil Debski <k.debski@samsung.com>
Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 08:33:45 -03:00
Boris BREZILLON f5fe58fd76 [media] i2c: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've
moved media bus definitions to include/uapi/linux/media-bus-format.h and
prefixed values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT.

Replace all references to the old definitions in i2c drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:52:48 -02:00
Mauro Carvalho Chehab cdde1a9bae [media] ov9740: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:18 -03:00
Guennadi Liakhovetski 9aea470b39 [media] soc-camera: switch I2C subdevice drivers to use v4l2-clk
Instead of centrally enabling and disabling subdevice master clocks in
soc-camera core, let subdevice drivers do that themselves, using the
V4L2 clock API and soc-camera convenience wrappers.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-21 16:32:36 -03:00
Hans Verkuil 6be89daa03 [media] soc_camera sensors: remove g_chip_ident op
This is no longer needed since the core now handles this through DBG_G_CHIP_INFO.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-17 08:50:21 -03:00
Hans Verkuil 977ba3b1b7 [media] v4l2: add const to argument of write-only s_register ioctl
This ioctl is defined as IOW, so pass the argument as const.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-24 08:47:01 -03:00
Guennadi Liakhovetski 70e176a5a9 [media] soc-camera: use devm_kzalloc in subdevice drivers
I2C drivers can use devm_kzalloc() too in their .probe() methods. Doing so
simplifies their clean up paths.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:45:31 -02:00
Guennadi Liakhovetski 25a3481100 [media] soc-camera: split struct soc_camera_link into host and subdevice parts
struct soc_camera_link currently contains fields, used both by sensor and
bridge drivers. To make subdevice driver re-use simpler, split it into a
host and a subdevice parts.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-05 01:38:02 -02:00
Laurent Pinchart 4bbc6d52e6 [media] soc-camera: Push probe-time power management to drivers
Several client drivers access the hardware at probe time, for instance
to read the probe chip ID. Such chips need to be powered up when being
probed.

soc-camera handles this by powering chips up in the soc-camera probe
implementation. However, this will break with non soc-camera hosts that
don't perform the same operations.

Fix the problem by pushing the power up/down from the soc-camera core
down to individual drivers on a needs basis.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-15 17:04:42 -03:00
Laurent Pinchart 4ec10bacd6 [media] soc-camera: Add and use soc_camera_power_[on|off]() helper functions
Instead of forcing all soc-camera drivers to go through the mid-layer to
handle power management, create soc_camera_power_[on|off]() functions
that can be called from the subdev .s_power() operation to manage
regulators and platform-specific power handling. This allows non
soc-camera hosts to use soc-camera-aware clients.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[g.liakhovetski@gmx.de: fix compile breakage]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-15 17:03:29 -03:00
Mauro Carvalho Chehab 2a2d1cf465 [media] move soc_camera i2c drivers into its own dir
Move all soc_camera i2c drivers into drivers/media/i2c/soc_camera/.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-15 16:42:46 -03:00
Renamed from drivers/media/video/ov9740.c (Browse further)