1
0
Fork 0
Commit Graph

34 Commits (4dc1360203c442826ed6306d7f73b10eb7cec9ee)

Author SHA1 Message Date
Kieran Bingham e671499303 media: i2c: Convert to new i2c device probe()
The I2C core framework provides a simplified probe framework from commit
b8a1a4cd5a ("i2c: Provide a temporary .probe_new() call-back type").

These drivers do not utilise the i2c_device_id table in the probe, so we
can easily convert them to utilise the simplified i2c driver
registration.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-08-13 11:54:04 -03:00
Hans Verkuil 2dbcb6fb96 media: media/i2c: don't return ENOTTY if SUBDEV_API is not set
If CONFIG_VIDEO_V4L2_SUBDEV_API is not set, then it is still possible
to call set_fmt for V4L2_SUBDEV_FORMAT_TRY, the result is just not
stored. So return 0 instead of -ENOTTY.

Calling get_fmt with V4L2_SUBDEV_FORMAT_TRY should return -EINVAL
instead of -ENOTTY, after all the get_fmt functionality is still
present, just not supported for TRY.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-23 11:47:09 -04:00
Linus Torvalds ed63b9c873 media updates for v5.3-rc1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+QmuaPwR3wnBdVwACF8+vY7k4RUFAl0kcloACgkQCF8+vY7k
 4RU0Mg//c0BK1VjPfh45k3HxDvvoQnaTlQjo1ApvEBa64TR10/JxXi9U+QuhY1H1
 QEOjJJrLe3OdWrcBwFT5s15cBdRKn6jB8s67FgN7CFA8IzG4xBjOovOP4MXYXztz
 TjNlkLwWkkwiQ4C99HInSsmI36ZbnEI3PloJXMrEBnsXQIazjRzMeJ3DKZggSSkN
 jhedASDgnHgSun0rCFh0mN8k2kiMUZ/XxVIqiCuWT1AzyycoHp+HXm9YilnxD7q0
 43X6v4HtxrfJMQWQ8z3Pxb4McHc1j3L8S7Mgu9oSf7oJb12grsDxokytUCnmhFz8
 gvNgx3D2OTQk2nrQlxcfgrbqMs2KXLkXIiqg/dZ35hpNfXIOxiOx77zqqIsg2WHr
 j4qaDcw+TNQU1eUIm0dIcPFi82EMOjAUqHRrvsg94EbBQ1dUniE4GCkCHFU+2TLz
 YIaWXv/WmavrWTydsoIKqbBBOR9OY9+PDjkxgHsSVPSZ9sAskcPQ5MJdkatoZcu/
 glZJD8HEe/w1vi1Ob3ZsXU7KzNWAhIkWvtEWsxAuFGzr8uNfwmzM2a5giNLIV94b
 W+ZYhQT363uliVSOPFRjqqkVliC/HmV2lcNVzlVymWgeKhRj8fI5JqrDhpLz0XD+
 9Rn90mweCzCSw7/fj/keP9mEnMce4XdkkDB/Pyf+dIMiLMOczoU=
 =ABgl
 -----END PGP SIGNATURE-----

Merge tag 'media/v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:

 - new Atmel microship ISC driver

 - coda has gained support for mpeg2 and mpeg4

 - cxusb gained support for analog TV

 - rockchip staging driver was split into two separate staging drivers

 - added a new staging driver for Allegro DVT video IP core

 - added a new staging driver for Amlogic Meson video decoder

 - lots of improvements and cleanups

* tag 'media/v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (398 commits)
  media: allegro: use new v4l2_m2m_ioctl_try_encoder_cmd funcs
  media: doc-rst: Fix typos
  media: radio-raremono: change devm_k*alloc to k*alloc
  media: stv0297: fix frequency range limit
  media: rc: Prefer KEY_NUMERIC_* for number buttons on remotes
  media: dvb_frontend: split dvb_frontend_handle_ioctl function
  media: mceusb: disable "nonsensical irdata" messages
  media: rc: remove redundant dev_err message
  media: cec-notifier: add new notifier functions
  media: cec: add struct cec_connector_info support
  media: cec-notifier: rename variables, check kstrdup and n->conn_name
  media: MAINTAINERS: Add maintainers for Media Controller
  media: staging: media: tegra-vde: Defer dmabuf's unmapping
  media: staging: media: tegra-vde: Add IOMMU support
  media: hdpvr: fix locking and a missing msleep
  media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom()
  media: atmel: atmel-isc: fix i386 build error
  media: v4l2-ctrl: Move compound control initialization
  media: hantro: Use vb2_get_buffer
  media: pci: cx88: Change the type of 'missed' to u64
  ...
2019-07-09 09:47:22 -07:00
Wolfram Sang e64de2082d media: i2c: ov2640: simplify getting the adapter of a client
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-06-24 11:16:14 -04:00
Thomas Gleixner d2912cb15b treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
Based on 2 normalized pattern(s):

  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

  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 #

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4122 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Enrico Weigelt <info@metux.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-19 17:09:55 +02:00
Akinobu Mita adbd2969af media: ov2640: fix initial try format
Set initial try format with default configuration instead of current one.

Fixes: 8d3b307a15 ("media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY")

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-01-25 11:02:04 -02:00
Akinobu Mita bd0405f929 media: ov2640: set all mbus format field when G_FMT and S_FMT ioctls
This driver doesn't set all members of mbus format field when the
VIDIOC_SUBDEV_{S,G}_FMT ioctls are called.

This is detected by v4l2-compliance.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-01-16 12:45:51 -05:00
Akinobu Mita 8d3b307a15 media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize
V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE
is specified.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-01-16 12:45:20 -05:00
Akinobu Mita b0a7d0e1c0 media: ov2640: set default window and format code at probe time
Set default window and format code at probe time instead of always checking
if they have not been set yet when VIDIOC_SUBDEV_G_FMT ioctl is called.

This change simplifies the next patch (make VIDIOC_SUBDEV_G_FMT ioctl work
with V4L2_SUBDEV_FORMAT_TRY).

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-01-16 12:44:29 -05:00
Akinobu Mita c65455160a media: ov2640: support log_status ioctl and event interface
This adds log_status ioctl and event interface for ov2640's v4l2 controls.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-23 04:46:20 -05:00
Akinobu Mita 6210500691 media: ov2640: add V4L2_CID_TEST_PATTERN control
The ov2640 has the test pattern generator features.  This makes use of
it through V4L2_CID_TEST_PATTERN control.

[Sakari Ailus: Use "Eight Vertical Colour Bars" as the second manu entry]

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-11-23 04:45:49 -05:00
Sakari Ailus af8e15620e media: v4l: Remove support for crop default target in subdev drivers
The V4L2 sub-device API does not support the crop default target. A number
of drivers apparently still did support this, likely as it was needed by
the SoC camera framework. Drop support for the default crop rectaingle in
sub-device drivers, and use the bounds rectangle in SoC camera instead.

Reported-by: Helmut Grohne <h.grohne@intenta.de>
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-03 11:58:24 -04:00
Akinobu Mita deb9eec696 media: ov2640: make s_ctrl() work in power-down mode
The s_ctrl() operation can be called when the device is placed into
power down mode.  Then, applying controls to H/W should be postponed at
this time.  Instead the controls will be restored when the streaming is
started.

Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-17 06:22:08 -04:00
Akinobu Mita 2aae393955 media: ov2640: make set_fmt() work in power-down mode
The set_fmt() subdev pad operation for this driver currently does not
only do the driver internal format selection but also do the actual
register setup.

This doesn't work if the device power control via GPIO lines is enabled.
Because the set_fmt() can be called when the device is placed into power
down mode.

First of all, this fix adds flag to keep track of whether the device starts
streaming or not.  Then, the set_fmt() postpones applying the actual
register setup at this time.  Instead the setup will be applied when the
streaming is started.

Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-17 06:22:08 -04:00
Sakari Ailus 3580112b6d media: entity: Add a nop variant of media_entity_cleanup
Add nop variant of media_entity_cleanup. This allows calling
media_entity_cleanup whether or not Media controller is enabled,
simplifying driver code.

Also drop #ifdefs on a few drivers around media_entity_cleanup().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-01-23 08:12:01 -05:00
Akinobu Mita 6b725eb682 media: ov2640: don't clear V4L2_SUBDEV_FL_IS_I2C
The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the
subdev->flags.  But this driver overwrites subdev->flags immediately after
calling v4l2_i2c_subdev_init().  So V4L2_SUBDEV_FL_IS_I2C is not set after
all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Side note: According to the comment in v4l2_device_unregister(), this is
problematic only if the device is platform bus device.  Device tree or
ACPI based devices are not affected.

Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-10-31 12:08:34 -04:00
Colin Ian King 91c158dd26 [media] ov2640: make array reset_seq static, reduces object code size
Don't populate the array reset_seq on the stack, instead make it
static.  Makes the object code smaller by over 50 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  11737	   6000	     64	  17801	   4589	drivers/media/i2c/ov2640.o

After:
   text	   data	    bss	    dec	    hex	filename
  11582	   6096	     64	  17742	   454e	drivers/media/i2c/ov2640.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-10-04 17:21:28 -03:00
Markus Elfring 19fab6fe67 [media] i2c: Improve a size determination
Replace the specification of a data structure by pointer dereferences
as the parameter for the operator "sizeof" to make size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

[mchehab@s-opensource.com: merged similar patches]
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-10-04 17:15:39 -03:00
Markus Elfring 0fd5843589 [media] i2c: Delete an error messages for failed memory allocation
Omit extra messages for memory allocation failures.

This issue was detected by using the Coccinelle software.

[mchehab@s-opensource.com: merged similar patches]
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-10-04 17:15:22 -03:00
Fabio Estevam c3d1478024 [media] ov2640: Check the return value from clk_prepare_enable()
clk_prepare_enable() may fail, so we should better check its return value
and propagate it in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-10-04 17:08:09 -03:00
Fabio Estevam 877f1af154 [media] ov2640: Propagate the real error on devm_clk_get() failure
devm_clk_get() may return different error codes other than -EPROBE_DEFER,
so it is better to return the real error code instead.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-10-04 17:07:42 -03:00
Mauro Carvalho Chehab 3622d3e77e [media] ov2640: print error if devm_*_optional*() fails
devm_gpiod_get_optional() can return -ENOSYS if GPIOLIB is
disabled, causing probe to fail. Warn the user if this
happens.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-25 07:08:21 -03:00
Frank Schaefer d72b196f96 [media] ov2640: add support for MEDIA_BUS_FMT_YVYU8_2X8 and MEDIA_BUS_FMT_VYUY8_2X8
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 09:01:43 -03:00
Frank Schaefer 7f140fc206 [media] ov2640: fix vflip control
Enabling vflip currently causes wrong colors.
It seems that (at least with the current sensor setup) REG04_VFLIP_IMG only
changes the vertical readout direction.
Because pixels are arranged RGRG... in odd lines and GBGB... in even lines,
either a one line shift or even/odd line swap is required, too, but
apparently this doesn't happen.

I finally figured out that this can be done manually by setting
REG04_VREF_EN.
Looking at hflip, it turns out that bit REG04_HREF_EN is set there
permanetly, but according to my tests has no effect on the pixel readout
order.
So my conclusion is that the current documentation of sensor register 0x04
is wrong (has changed after preliminary datasheet version 2.2).

I'm pretty sure that automatic vertical line shift/switch can be enabled,
too, but until anyone finds ot how this works, we have to stick with manual
switching.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 09:01:09 -03:00
Frank Schaefer 38eeb491cf [media] ov2640: fix duplicate width+height returning from ov2640_select_win()
ov2640_select_win() returns height and width values as part of struct
ov2640_win_size, so there is no point in modifying the passed height and
width parameters, too.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 08:58:41 -03:00
Frank Schaefer 2f7711b2ad [media] ov2640: add missing write to size change preamble
HSIZE and VSIZE bits 0 to 2 and HSIZE bit 11 are encoded in DSP register
SIZEL.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 08:55:38 -03:00
Frank Schaefer 06dd8f7791 [media] ov2640: add information about DSP register 0xc7
According to ov2640 software application notes, there are two Automatic
White Balance (AWB) modes, which are selected by DSP register 0xc7:

1) Simple AWB: assumes the average color is gray
   + independent from lens
   - doesn't work well if captured area contains unbalanced colors
     (e.g. large blue background)

2) Advanced AWB: uses color temperature information
   + more accurate, works with all image contents
   - lens specific, requires calibration

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 08:55:07 -03:00
Frank Schaefer d81638eadd [media] ov2640: improve banding filter register definitions/documentation
- add missing initialisation of sensor register COM25 (2 MSBs of banding
  filter AEC values)
- add macros for setting the banding filter AEC values
- add definitions for sensor register 0x5a, which is documented in
  Omnivisions software application notes

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 08:54:35 -03:00
Frank Schaefer 534dca983e [media] ov2640: fix init sequence alignment
While we are at it, remove a misleading comment (copy/paste mistake)

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 08:53:36 -03:00
Mauro Carvalho Chehab a463ea990d [media] ov2640: make GPIOLIB an optional dependency
As warned by kbuild test robot:
	warning: (VIDEO_EM28XX_V4L2) selects VIDEO_OV2640 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_V4L2 && I2C && GPIOLIB && MEDIA_CAMERA_SUPPORT)

The em28xx driver can use ov2640, but it doesn't depend
(or use) the GPIOLIB in order to power off/on the sensor.

So, as we want to allow both usages with and without
GPIOLIB, make its dependency optional.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-19 08:49:15 -03:00
Hans Verkuil aa23c0533c [media] ov2640: avoid calling ov2640_select_win() twice
Simplify ov2640_set_params and ov2640_set_fmt.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-14 22:32:56 -03:00
Hans Verkuil ff0e9c1d6d [media] ov2640: add MC support
The MC support is needed by the em28xx driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-10 14:26:50 -03:00
Hans Verkuil 46796cfcd3 [media] ov2640: use standard clk and enable it
Convert v4l2_clk to normal clk and enable the clock.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-10 13:42:28 -03:00
Hans Verkuil 34aa88790b [media] ov2640: convert from soc-camera to a standard subdev sensor driver
Convert ov2640 to a standard subdev driver. The soc-camera driver no longer
uses this driver, so it can safely be converted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-10 13:38:17 -03:00