Commit Graph

400011 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 774cc4c289 [media] V4L2: add a v4l2-clk helper macro to produce an I2C device ID
To obtain a clock reference consumers supply their device object to the
V4L2 clock framework. The latter then uses the consumer device name to
find a matching clock. For that to work V4L2 clock providers have to
provide the same device name, when registering clocks. This patch adds
a helper macro to generate a suitable device name for I2C devices.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 04:33:02 -02:00
Guennadi Liakhovetski cf326dfebe [media] V4L2: add v4l2-clock helpers to register and unregister a fixed-rate clock
Many bridges and video host controllers supply fixed rate always on clocks
to their I2C devices. This patch adds two simple helpers to register and
unregister such a clock.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 04:31:30 -02:00
Guennadi Liakhovetski d3f884a709 [media] soc-camera: switch to using the new struct v4l2_subdev_platform_data
This prepares soc-camera to use struct v4l2_subdev_platform_data for its
subdevice-facing API, which would allow subdevice driver re-use.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 04:30:56 -02:00
Guennadi Liakhovetski b1cbab05d9 [media] V4L2: add a common V4L2 subdevice platform data type
This struct shall be used by subdevice drivers to pass per-subdevice data,
e.g. power supplies, to generic V4L2 methods, at the same time allowing
optional host-specific extensions via the host_priv pointer. To avoid
having to pass two pointers to those methods, add a pointer to this new
struct to struct v4l2_subdev.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 04:30:12 -02:00
Guennadi Liakhovetski 507fcd3da2 [media] imx074: fix error handling for failed async subdevice registration
If v4l2_async_register_subdev() fails, don't skip the clean up.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 04:28:58 -02:00
Guennadi Liakhovetski 1bfa6e0d1f [media] V4L2: (cosmetic) remove redundant use of unlikely()
BUG*() and WARN*() macros specify their conditions as unlikely, using
BUG_ON(unlikely(condition)) is redundant, remove it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 04:28:32 -02:00
Michael Opdenacker 1957f0d71c [media] s5p-mfc: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 16:51:50 -02:00
Prathyush K 76a4ddbd52 [media] s5p-mfc: call wake_up_dev if in suspend mode
If a frame is still decoding when system enters suspend mode, we wait
on the device queue for a interrupt condition. This sometimes leads to a
timeout because the device queue might not be woken up everytime.
Usually, the context queue gets woken up when that context's frame gets
decoded. This patch adds a condition to wake up the device queue along
with the context queue when the system is in suspend mode.
Since the device queue is now woken up, we don't have to check the
context's int_cond flag while waiting. Also, we can skip calling try_run
after waking up the device queue to ensure that we don't have to wait
for more than one frame to be processed.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 16:51:41 -02:00
Arun Kumar K d6950c4721 [media] s5p-mfc: Adjust the default values of some encoder params
The patch sets the default values of MAX_QP and GOP size encoder
parameters to some firmware recommended default values. This enables
the applications to get a better encoded output using the default
settings itself.

Signed-off-by: Kiran AVND <avnd.kiran@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 16:51:27 -02:00
Fabio Estevam e94363440a [media] platform: Kconfig: Select SRAM for VIDEO_CODA
Running the coda driver without CONFIG_SRAM selected leads to the following
probe error:
coda 63ff4000.vpu: iram pool not available
coda: probe of 63ff4000.vpu failed with error -12
In order to avoid it, select CONFIG_SRAM inside VIDEO_CODA.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 16:51:08 -02:00
Philipp Zabel 867f1edbcc [media] coda: v4l2-compliance fix: zero pixel format priv field
If unused, the pixel format priv field has to be cleared by the driver
in try_fmt.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 16:50:50 -02:00
Philipp Zabel 64ba40accc [media] coda: v4l2-compliance fix: implement try_decoder_cmd
Implement try_decoder_cmd to let userspace determine available commands
and flags.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:26:54 -02:00
Philipp Zabel 5762559358 [media] coda: v4l2-compliance fix: overwrite invalid pixel formats with the current setting
This patch fixes the v4l2-compliance "TRY_FMT(G_FMT) != G_FMT" issue.
The driver now overwrites invalid formats with the current setting, using
coda_get_max_dimensions to find device specific max width/height.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:26:34 -02:00
Philipp Zabel 2e9e4f1182 [media] coda: prefix v4l2_ioctl_ops with coda_ instead of vidioc_
Moving the ioctl handler callbacks into the coda namespace helps
tremendously to make sense of backtraces.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[k.debski@samsung.com: fix whitespace error near coda_subscribe_event]
Signed-off-by: Kamil Debski <k.debski@samsung.com>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:25:59 -02:00
Philipp Zabel 5166028d48 [media] coda: use picture type returned from hardware
Instead of copying v4l2_buf.flags from the source buffer, set
the destination buffer flags as reported by the hardware codec.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:25:25 -02:00
Philipp Zabel 927933f7b4 [media] coda: move coda_product_name above vidioc_querycap
Use the product name (currently CodaDx6 or CODA7541)
to fill the v4l2_capabilities.name field.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:25:02 -02:00
Philipp Zabel 0fd84dc80b [media] coda: fix FMO value setting for CodaDx6
The register is only written on CodaDx6, so the temporary variable
to be written only needs to be initialized on CodaDx6. Also, drop
two no-op lines.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:24:31 -02:00
Philipp Zabel baf7021128 [media] coda: add compressed flag to format enumeration output
Correctly flag compressed formats in the ENUM_FMT ioctl output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:24:02 -02:00
Philipp Zabel eb107516ed [media] coda: only set buffered input queue for decoder
Allow device_run with no buffers queued after streamoff only when
the current instance is a decoder.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[k.debski@samsung.com: Add commit description]
Signed-off-by: Kamil Debski <k.debski@samsung.com>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:23:41 -02:00
Philipp Zabel 0cddc7e9a0 [media] coda: allow more than four instances on CODA7541
With the new firmware, there are not anymore four register sets,
but a single register set, which the driver has to conserve across
context switches. This allows to handle more than four instances
at the same time.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:23:10 -02:00
Shaik Ameer Basha 2ad5389b34 [media] v4l2-mem2mem: Don't schedule the context if abort job is called
When the current context is running,
1] If release is called, it waits until the job is finished.
2] As soon as the job is finished, v4l2_mem_ctx_release()tries to
   release the vb2 queues.
3] But if the current context can be scheduled in the v4l2_m2m_job_finish()
   it schedules the context and tries to call device_run().
4] As the release() and device_run() sequence can't be predicted sometimes
   device_run() may get empty vb2 buffers.

This patch adds the ABORT state to the job_flags. Once the job_abort() or
release() is called on the context, the same context will not be scheduled in
the v4l2_m2m_job_finish().

Signed-off-by: Shaik Ameer Basha <shaik.ameer@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:22:45 -02:00
Shaik Ameer Basha d9315160ed [media] exynos-gsc: Handle ctx job finish when aborted
When the current context is running,
1] If release() or streamoff() is called on the current context,
   it waits until the job is aborted or finished.
2] If the job is finished, driver will call the v4l2_m2m_job_finish().
3] If the job is aborted inside device_run callback, then driver
   has to inform the v4l2 mem2mem framework about the same by calling
   v4l2_m2m_job_finish() with VB2_BUF_STATE_ERROR.

The current code doesn't call v4l2_m2m_job_finish() in the case, where
the job is aborted from the device_run callback. This scenerio is
producing a hang as the other queued contexts are not getting scheduled.

By adding the ABORT state, driver can understand the current job
is aborted and not finished. By checking this flag, driver can call
v4l2_m2m_job_finish() with VB2_BUF_STATE_ERROR.

Signed-off-by: Shaik Ameer Basha <shaik.ameer@samsung.com>
Signed-off-by: Avnd Kiran <avnd.kiran@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:21:58 -02:00
Philipp Zabel 84e6809809 [media] v4l2-mem2mem: clear m2m queue ready counter in v4l2_m2m_streamoff
v4l2_m2m_streamoff drops the list of ready buffers but failed to reset the
num_rdy counter to zero. This would lead to v4l2_m2m_num_src/dst_bufs_ready
reporting wrong values after streamoff.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:20:48 -02:00
Philipp Zabel d7bb0ce888 [media] v4l2-mem2mem: fix context removal from job queue in v4l2_m2m_streamoff
Just clearing the m2m_ctx->queue list_head will leave the m2m_dev->job_queue
in a broken state and can cause scheduling of device_runs after streamoff was
called.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:20:38 -02:00
Jingoo Han ede7941385 [media] mem2mem_testdev: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:20:27 -02:00
Jingoo Han 825143d3bb [media] m2m-deinterlace: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:20:18 -02:00
Jingoo Han 4e3eff6190 [media] s5p-g2d: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:20:07 -02:00
Archit Taneja 585e6f010b [media] v4l: ti-vpe: Add de-interlacer support in VPE
Add support for the de-interlacer block in VPE. For de-interlacer to
work, we need to enable 2 more sets of VPE input ports which fetch data
from the 'last' and 'last to last' fields of the interlaced video. Apart
from that, we need to enable the Motion vector output and input ports,
and also allocate DMA buffers for them.

We need to make sure that two most recent fields in the source queue are
available and in the 'READY' state. Once a mem2mem context gets access
to the VPE HW(in device_run), it extracts the addresses of the 3
buffers, and provides it to the data descriptors for the 3 sets of input
ports((LUMA1, CHROMA1), (LUMA2, CHROMA2), and (LUMA3, CHROMA3))
respectively for the 3 consecutive fields. The motion vector and output
port descriptors are configured and the list is submitted to VPDMA.

Once the transaction is done, the v4l2 buffer corresponding to the
oldest field(the 3rd one) is changed to the state 'DONE', and the
buffers corresponding to 1st and 2nd fields become the 2nd and 3rd field
for the next de-interlace operation. This way, for each deinterlace
operation, we have the 3 most recent fields. After each transaction, we
also swap the motion vector buffers, the new input motion vector buffer
contains the resultant motion information of all the previous frames,
and the new output motion vector buffer will be used to hold the updated
motion vector to capture the motion changes in the next field. The
motion vector buffers are allocated using the DMA allocation API.

The de-interlacer is removed from bypass mode, it requires some extra
default configurations which are now added. The chrominance upsampler
coefficients are added for interlaced frames. Some VPDMA parameters like
frame start event and line mode are configured for the 2 extra sets of
input ports.

Signed-off-by: Archit Taneja <archit@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:19:38 -02:00
Archit Taneja 4571912743 [media] v4l: ti-vpe: Add VPE mem to mem driver
VPE is a block which consists of a single memory to memory path which
can perform chrominance up/down sampling, de-interlacing, scaling, and
color space conversion of raster or tiled YUV420 coplanar, YUV422
coplanar or YUV422 interleaved video formats.

We create a mem2mem driver based primarily on the mem2mem-testdev
example. The de-interlacer, scaler and color space converter are all
bypassed for now to keep the driver simple. Chroma up/down sampler
blocks are implemented, so conversion beteen different YUV formats is
possible.

Each mem2mem context allocates a buffer for VPE MMR values which it will
use when it gets access to the VPE HW via the mem2mem queue, it also
allocates a VPDMA descriptor list to which configuration and data
descriptors are added.

Based on the information received via v4l2 ioctls for the source and
destination queues, the driver configures the values for the MMRs, and
stores them in the buffer. There are also some VPDMA parameters like
frame start and line mode which needs to be configured, these are
configured by direct register writes via the VPDMA helper functions.

The driver's device_run() mem2mem op will add each descriptor based on
how the source and destination queues are set up for the given ctx, once
the list is prepared, it's submitted to VPDMA, these descriptors when
parsed by VPDMA will upload MMR registers, start DMA of video buffers on
the various input and output clients/ports.

When the list is parsed completely(and the DMAs on all the output ports
done), an interrupt is generated which we use to notify that the source
and destination buffers are done. The rest of the driver is quite
similar to other mem2mem drivers, we use the multiplane v4l2 ioctls as
the HW support coplanar formats.

Signed-off-by: Archit Taneja <archit@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:17:30 -02:00
Archit Taneja 213b8ee400 [media] v4l: ti-vpe: Add helpers for creating VPDMA descriptors
Create functions which the VPE driver can use to create a VPDMA
descriptor and add it to a VPDMA descriptor list. These functions take a
pointer to an existing list, and append the configuration/data/control
descriptor header to the list.

In the case of configuration descriptors, the creation of a payload
block may be required(the payloads can hold VPE MMR values, or scaler
coefficients). The allocation of the payload buffer and it's content is
left to the VPE driver. However, the VPDMA library provides helper
macros to create payload in the correct format.

Add debug functions to dump the descriptors in a way such that it's easy
to see the values of different fields in the descriptors.

Signed-off-by: Archit Taneja <archit@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:10:46 -02:00
Archit Taneja 9262e5a225 [media] v4l: ti-vpe: Create a vpdma helper library
The primary function of VPDMA is to move data between external memory
and internal processing modules(in our case, VPE) that source or sink
data. VPDMA is capable of buffering this data and then delivering the
data as demanded to the modules as programmed. The modules that source
or sink data are referred to as clients or ports. A channel is setup
inside the VPDMA to connect a specific memory buffer to a specific
client. The VPDMA centralizes the DMA control functions and buffering
required to allow all the clients to minimize the effect of long latency
times.

Add the following to the VPDMA helper:

- A data struct which describe VPDMA channels. For now, these channels
  are the ones used only by VPE, the list of channels will increase when
  VIP(Video Input Port) also uses the VPDMA library. This channel
  information will be used to populate fields required by data
  descriptors.

- Data structs which describe the different data types supported by
  VPDMA. This data type information will be used to populate fields
  required by data descriptors and used by the VPE driver to map a V4L2
  format to the corresponding VPDMA data type.

- Provide VPDMA register offset definitions, functions to read, write
  and modify VPDMA registers.

- Functions to create and submit a VPDMA list. A list is a group of
  descriptors that makes up a set of DMA transfers that need to be
  completed. Each descriptor will either perform a DMA transaction to
  fetch input buffers and write to output buffers(data descriptors), or
  configure the MMRs of sub blocks of VPE(configuration descriptors), or
  provide control information to VPDMA (control descriptors).

- Functions to allocate, map and unmap buffers needed for the descriptor
  list, payloads containing MMR values and scaler coefficients. These use
  the DMA mapping APIs to ensure exclusive access to VPDMA.

- Functions to enable VPDMA interrupts. VPDMA can trigger an interrupt
  on the VPE interrupt line when a descriptor list is parsed completely
  and the DMA transactions are completed. This requires masking the events
  in VPDMA registers and configuring some top level VPE interrupt
  registers.

- Enable some VPDMA specific parameters: frame start event(when to start
  DMA for a client) and line mode(whether each line fetched should be
  mirrored or not).

- Function to load firmware required by VPDMA. VPDMA requires a firmware
  for it's internal list manager. We add the required request_firmware
  apis to fetch this firmware from user space.

- Function to dump VPDMA registers.

- A function to initialize and create a VPDMA instance, this will be
  called by the VPE driver with it's platform device pointer, this
  function will take care of loading VPDMA firmware and returning a
  vpdma_data instance back to the VPE driver. The VIP driver will also
  call the same init function to initialize it's own VPDMA instance.

Signed-off-by: Archit Taneja <archit@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-28 15:08:44 -02:00
Wei Yongjun 23c4919c6f [media] marvell-ccic: drop free_irq for devm_request_irq allocated irq
irq allocated with devm_request_irq should not be freed using
free_irq, because doing so causes a dangling pointer, and a
subsequent double free.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 11:28:09 -03:00
Chen Gang 6c7e346974 [media] drivers: media: usb: b2c2: use usb_*_coherent() instead of pci_*_consistent() in flexcop-usb.c
Some architectures do not support PCI, but still support USB, so need
let our usb driver try to use usb_* instead of pci_* to support these
architectures, or can not pass compiling.
The related error (with allmodconfig for arc):
    CC [M]  drivers/media/usb/b2c2/flexcop-usb.o
  drivers/media/usb/b2c2/flexcop-usb.c: In function ‘flexcop_usb_transfer_exit’:
  drivers/media/usb/b2c2/flexcop-usb.c:393: error: implicit declaration of function ‘pci_free_consistent’
  drivers/media/usb/b2c2/flexcop-usb.c: In function ‘flexcop_usb_transfer_init’:
  drivers/media/usb/b2c2/flexcop-usb.c:410: error: implicit declaration of function ‘pci_alloc_consistent’

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 11:26:41 -03:00
Peter Senna Tschudin b5eee19617 [media] media: Change variable type to bool
The variable frame_ready is only assigned the values true and false.
Change its type to bool.
The simplified semantic patch that find this problem is as
follows (http://coccinelle.lip6.fr/):
@exists@
type T;
identifier b;
@@
- T
+ bool
  b = ...;
  ... when any
  b = \(true\|false\)

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 11:24:35 -03:00
Philipp Zabel dc77523c5d [media] videobuf2-core: call __setup_offsets only for mmap memory type
__setup_offsets fills the v4l2_planes' mem_offset fields, which is only valid
for V4L2_MEMORY_MMAP type buffers. For V4L2_MEMORY_DMABUF and _USERPTR buffers,
this incorrectly overwrites the fd and userptr fields.

Reported-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 10:53:21 -03:00
Chanho Min 8ca5d2d8e5 [media] uvcvideo: Fix data type for pan/tilt control
The pan/tilt absolute control value is signed value. If minimum value
is minus, It will be changed to plus by clamp_t() as commit 64ae9958a6.
([media] uvcvideo: Fix control value clamping for unsigned integer controls).
It leads to wrong setting of the control values. For example,
when min and max are -36000 and 36000, the setting value between of this range
is always 36000. So, its data type should be changed to signed.

Signed-off-by: Chanho Min <chanho.min@lge.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:55:29 -03:00
Hans Verkuil 60b3b4d2de [media] cx25821: fix sparse warnings
drivers/media/pci/cx25821/cx25821-cards.c:49:20: warning: symbol 'cx25821_bcount' was not declared. Should it be static?
drivers/media/pci/cx25821/cx25821-video-upstream.c:162:33: warning: incorrect type in assignment (different base types)
drivers/media/pci/cx25821/cx25821-video-upstream.c:163:33: warning: incorrect type in assignment (different base types)
drivers/media/pci/cx25821/cx25821-video-upstream.c:164:33: warning: incorrect type in assignment (different base types)
drivers/media/pci/cx25821/cx25821-video-upstream.c:165:33: warning: incorrect type in assignment (different base types)
drivers/media/pci/cx25821/cx25821-medusa-video.h:43:16: warning: symbol '_num_decoders' was not declared. Should it be static?
drivers/media/pci/cx25821/cx25821-medusa-video.h:44:16: warning: symbol '_num_cameras' was not declared. Should it be static?
drivers/media/pci/cx25821/cx25821-medusa-video.h:46:14: warning: symbol '_video_standard' was not declared. Should it be static?
drivers/media/pci/cx25821/cx25821-medusa-video.h:47:5: warning: symbol '_display_field_cnt' was not declared. Should it be static?
After analyzing the last four warnings carefully it became clear that these
variables were really completely unused. As a result of that the call to
medusa_set_decoderduration() is now dubious since the duration is always 0.
Without documentation, however, I can't tell what the right value is.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:16:46 -03:00
Laurent Pinchart c8d185ce33 [media] v4l2-fh: Include linux/videodev2.h for enum v4l2_priority definition
struct v4l2_fh has an enum v4l2_priority field. Make sure the enum
definition is available by including linux/videodev2.h.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:10:29 -03:00
Laurent Pinchart 4f1af2a33c [media] v4l2-fh: Include linux/fs.h for struct file definition
v4l2-fh.h dereferences struct file, the structure must thus be defined.
Pull in its definition by including linux/fs.h.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:10:11 -03:00
Sylwester Nawrocki 4eed9b3376 [media] v4l2-ctrls: Correct v4l2_ctrl_get_int_menu() function's return type
Remove the redundant 'const' qualifiers from the function
signature and from the qmenu_int arrays' declarations.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:09:55 -03:00
Michael Opdenacker b9e9f02a26 [media] winbond-cir: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Acked-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:09:14 -03:00
Michael Opdenacker a232728d1e [media] ir-rx51: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:09:02 -03:00
Michael Opdenacker 43917b2552 [media] ivtv: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:08:52 -03:00
Michael Opdenacker 7b5e71ad04 [media] zoran: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:08:41 -03:00
Michael Opdenacker 3e018fe440 [media] misc drivers: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:08:31 -03:00
Michael Opdenacker 9a373d17cc [media] cx18: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:08:08 -03:00
Michael Opdenacker 68b3869ee9 [media] saa7146: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:07:50 -03:00
Frank Schaefer 032f1ddf67 [media] em28xx: fix error path in em28xx_start_analog_streaming()
Increase the streaming_users count only if streaming start succeeds.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:07:36 -03:00
Frank Schaefer b68cafc5ae [media] em28xx: fix and unify the coding style of the GPIO register write sequences
Fix CodingStyle on the GPIO init tables.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:06:59 -03:00
Alexey Khoroshilov 256d013a9b [media] cx231xx: fix double free and leaks on failure path in cx231xx_usb_probe()
There are numerous issues in error handling code of cx231xx initialization.
Double free (when cx231xx_init_dev() calls kfree(dev) via cx231xx_release_resources()
and then cx231xx_usb_probe() does the same) and memory leaks
(e.g. usb_get_dev() before (ifnum != 1) check in cx231xx_usb_probe())
are just a few of them.
The patch fixes the issues in cx231xx_usb_probe() and cx231xx_init_dev()
by moving usb_get_dev(interface_to_usbdev(interface)) below in code and
implementing proper error handling.
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:05:28 -03:00