History log of /drivers/media/v4l2-core/v4l2-common.c
Revision Date Author Comments
3bacc10cd4a85bc70bc0b6c001d3bf995c7fe04c 15-Sep-2014 Maciej Matraszek <m.matraszek@samsung.com> [media] v4l2-common: fix overflow in v4l_bound_align_image()

Fix clamp_align() used in v4l_bound_align_image() to prevent overflow
when passed large value like UINT32_MAX.

In the current implementation:
clamp_align(UINT32_MAX, 8, 8192, 3)

returns 8, because in line:

x = (x + (1 << (align - 1))) & mask;

x overflows to (-1 + 4) & 0x7 = 3, while expected value is 8192.

v4l_bound_align_image() is heavily used in VIDIOC_S_FMT and
VIDIOC_SUBDEV_S_FMT ioctls handlers, and documentation of the latter
explicitly states that:

"The modified format should be as close as possible to the original
request."
-- http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-subdev-g-fmt.html

Thus one would expect, that passing UINT32_MAX as format width and
height will result in setting maximum possible resolution for the
device. Particularly, when the driver doesn't support
VIDIOC_ENUM_FRAMESIZES ioctl, which is common in the codebase.

Fixes changeset: b0d3159be9a3

Signed-off-by: Maciej Matraszek <m.matraszek@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
0ba2aeb6dab80920edd9cf5b93b1ea4d6913b8f3 16-Apr-2014 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-ctrls: increase internal min/max/step/def to 64 bit

While VIDIOC_QUERYCTRL is limited to 32 bit min/max/step/def values
for controls, the upcoming VIDIOC_QUERY_EXT_CTRL isn't. So increase
the internal representation to 64 bits in preparation.

Because of these changes the msi3101 driver has been modified slightly
to fix a formatting issue (%d becomes %lld), vivi had to be modified
as well to cope with the new 64-bit min/max values and the PIXEL_RATE
control in a few sensor drivers required proper min/max/def values.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
f9d32f25084ce7a27f966a0e71eae6ee0fe2f5ab 29-Sep-2013 Lars-Peter Clausen <lars@metafoo.de> media: core: Don't use i2c_client->driver

The 'driver' field of the i2c_client struct is redundant and is going to be
removed. The results of the expressions 'client->driver.driver->field' and
'client->dev.driver->field' are identical, so replace all occurrences of the
former with the later.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2576415846bcbad3c0a6885fc44f950837106364 29-Jul-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2: move dv-timings related code to v4l2-dv-timings.c

v4l2-common.c contained a bunch of dv-timings related functions.
Move that to the new v4l2-dv-timings.c which is a more appropriate
place for them.
There aren't many drivers that do HDTV, so it is a good idea to separate
common code related to that into a module of its own.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
668773b84604926519e2baf444f382f88d799d41 10-Jun-2013 Guennadi Liakhovetski <g.liakhovetski@gmx.de> [media] V4L2: add a device pointer to struct v4l2_subdev

It is often useful to have simple means to get from a subdevice to the
underlying physical device. This patch adds such a pointer to struct
v4l2_subdev and sets it accordingly in the I2C and SPI cases.

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>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
aee38734d2e2a908c4fd50918f28f19c088abfb9 26-May-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-common: remove unused v4l2_chip_match/ident_i2c_client functions

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6ec19898ed6990baa285b8c96a8b1a0d0366bc46 26-May-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2: remove obsolete v4l2_chip_match_host()

This function is no longer needed since it is now the responsibility of the
v4l2 core to check if the DBG_G/S_REGISTER and DBG_G_CHIP_INFO ioctls are
called for the bridge driver or not.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3eef25107cab65a1158b11ba373fb9b4fc25b4b8 03-Apr-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2: drop V4L2_CHIP_MATCH_SUBDEV_NAME

After using the new VIDIOC_DBG_G_CHIP_NAME ioctl I realized that the matching
by name possibility is useless. Just drop it and rename MATCH_SUBDEV_IDX to
just MATCH_SUBDEV.
The v4l2-dbg utility is much better placed to match by name by just enumerating
all bridge and subdev devices until chip_name.name matches.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
79b0c6400517456935f84f8d46c8bb0cf73f1813 18-Mar-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2: add new VIDIOC_DBG_G_CHIP_NAME ioctl

Simplify the debugging ioctls by creating the VIDIOC_DBG_G_CHIP_NAME ioctl.
This will eventually replace VIDIOC_DBG_G_CHIP_IDENT. Chip matching is done
by the name or index of subdevices or an index to a bridge chip. Most of this
can all be done automatically, so most drivers just need to provide get/set
register ops.
In particular, it is now possible to get/set subdev registers without
requiring assistance of the bridge driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9d5f4839cc098f15a48f7063d39805ddfe84565c 06-Mar-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-common: remove obsolete check for ' at the end of a driver name

During the transition to sub-devices several years ago non-subdev drivers
had a ' at the end of their driver name to tell them apart from already
converted drivers. This check was a left-over from that time and can be
removed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2d80647b6ebd2db6ef1df5e4e3319afd8867580c 15-Feb-2013 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-common: remove obsolete v4l_fill_dv_preset_info

It's no longer used, so it can now be removed.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ffe4db06fdd294a3326e2f1009863825c0f6401c 19-Jan-2013 Peter Senna Tschudin <peter.senna@gmail.com> [media] [V2,24/24] v4l2-core/v4l2-common.c: use IS_ENABLED() macro

replace:
#if defined(CONFIG_MEDIA_TUNER_TEA5761) || \
defined(CONFIG_MEDIA_TUNER_TEA5761_MODULE)
with:
#if IS_ENABLED(CONFIG_MEDIA_TUNER_TEA5761)
This change was made for: CONFIG_MEDIA_TUNER_TEA5761
Also replaced:
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
with:
#if IS_ENABLED(CONFIG_I2C)

Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
abd23295648a9e3ae72a806e70a510d3dcd8b374 15-Sep-2012 Sakari Ailus <sakari.ailus@iki.fi> [media] v4l: Helper function for obtaining timestamps

v4l2_get_timestamp() produces a monotonic timestamp but unlike
ktime_get_ts(), it uses struct timeval instead of struct timespec, saving
the drivers the conversion job when getting timestamps for v4l2_buffer's
timestamp field.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
685a39bd1a05dba17cb7ba18ab74364ad51bc527 27-Oct-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] v4l2-common: h_bp var is unused at v4l2_detect_gtf()

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
07ca418891187f97464309a0eedc266cabd948c7 17-Sep-2012 Alan Cox <alan@linux.intel.com> [media] v4l2: spi modalias is an array

We want to check the contents not the array itself versus NULL

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c61bd6a0e2a92009f3879457eeec75b5ad102303 10-Aug-2012 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-common: add CVT and GTF detection functions

These two helper functions detect whether the analog video timings detected
by the video receiver match the VESA CVT or GTF standards.

They basically do the inverse of the CVT and GTF modeline calculations.

This patch also adds a helper function that will determine the aspect ratio
based on the provided EDID values. This aspect ratio can be given to the GTF
helper function.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
c2a667fa2b40ccb7d21a99ffae53610699a3102c 10-Aug-2012 Hans Verkuil <hans.verkuil@cisco.com> [media] v4l2-common: add v4l_match_dv_timings

Add the v4l_match_dv_timings function that can be used to compare two
v4l2_dv_timings structs.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
5bc3cb743bbab408792c1b4ef31adf6268aa4b7e 14-Jun-2012 Mauro Carvalho Chehab <mchehab@redhat.com> [media] v4l: move v4l2 core into a separate directory

Currently, the v4l2 core is mixed together with other non-core drivers.
Move them into a separate directory.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>