platform/kernel/linux-rpi.git
6 years agomedia: dvb rst: identify the documentation gap at the API
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:53:11 +0000 (08:53 -0400)]
media: dvb rst: identify the documentation gap at the API

Now that DVB spec is almost in sync, document what's missing.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb CA docs: place undocumented data together with ioctls
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:45:28 +0000 (08:45 -0400)]
media: dvb CA docs: place undocumented data together with ioctls

Right now, the same undocumented structs are on two places:
at ca_data_types.rst and together with their ioctls.

Move them to just one place and use the standard way to
represent them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-get-descr-info.rst: document this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:39:43 +0000 (08:39 -0400)]
media: ca-get-descr-info.rst: document this ioctl

Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-get-slot-info.rst: document this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:32:56 +0000 (08:32 -0400)]
media: ca-get-slot-info.rst: document this ioctl

Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-get-cap.rst: document this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:07:46 +0000 (08:07 -0400)]
media: ca-get-cap.rst: document this ioctl

Instead of a generic boilerplate, fill it with relevant
information about this ioctl.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca-reset.rst: add some description to this ioctl
Mauro Carvalho Chehab [Fri, 1 Sep 2017 11:59:59 +0000 (07:59 -0400)]
media: ca-reset.rst: add some description to this ioctl

While we don't have any documentation for it, based on what's
there at Kaffeine and VDR, it seems that this command should
be issued before start using CA. So, document it as such.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dst_ca: return a proper error code from CA errors
Mauro Carvalho Chehab [Fri, 1 Sep 2017 12:21:04 +0000 (08:21 -0400)]
media: dst_ca: return a proper error code from CA errors

Right now, on several places, the driver is returning a
"-1" error to userspace, instead of a proper error code.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca.h: document most CA data types
Mauro Carvalho Chehab [Fri, 1 Sep 2017 11:48:02 +0000 (07:48 -0400)]
media: ca.h: document most CA data types

For most of the stuff there, documenting is easy, as the
header file contains information.

Yet, I was unable to document two data structs:
ca_msg and ca_descr

As those two structs are used by a few drivers, keep them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca.h: get rid of CA_SET_PID
Mauro Carvalho Chehab [Fri, 1 Sep 2017 11:41:49 +0000 (07:41 -0400)]
media: ca.h: get rid of CA_SET_PID

This ioctl seems to be some attempt to support a feature
at the bt8xx dst_ca driver. Yet, as said there, it
"needs more work". Right now, the code there is just
a boilerplate.

At the end of the day, no driver uses this ioctl, nor it is
documented anywhere (except for "needs more work").

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: net.rst: Fix the level of a section of the net chapter
Mauro Carvalho Chehab [Thu, 31 Aug 2017 23:34:02 +0000 (19:34 -0400)]
media: net.rst: Fix the level of a section of the net chapter

Due to a mistake, the DVB net chapter was actually broken
into two different chapters. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: add kernel-doc markups and use it at Documentation/
Mauro Carvalho Chehab [Thu, 31 Aug 2017 16:28:52 +0000 (12:28 -0400)]
media: dmx.h: add kernel-doc markups and use it at Documentation/

The demux documentation is pretty poor nowadays: most of the
structs and enums aren't documented at all.

Add proper kernel-doc markups for them and use it.

Now, the demux API data structures are fully documented :-)

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of GET_DMX_EVENT
Mauro Carvalho Chehab [Thu, 31 Aug 2017 23:09:06 +0000 (19:09 -0400)]
media: dmx.h: get rid of GET_DMX_EVENT

This seems to be a pure fictional API :-)

It only exists at the DVB book, with no code implemeting it.

So, just get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of DMX_SET_SOURCE
Mauro Carvalho Chehab [Thu, 31 Aug 2017 18:21:43 +0000 (14:21 -0400)]
media: dmx.h: get rid of DMX_SET_SOURCE

No driver uses this ioctl, nor it is documented anywhere.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of DMX_GET_CAPS
Mauro Carvalho Chehab [Thu, 31 Aug 2017 18:11:34 +0000 (14:11 -0400)]
media: dmx.h: get rid of DMX_GET_CAPS

There's no driver currently using it; it is also not
documented about what it would be supposed to do.

So, get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: get rid of unused DMX_KERNEL_CLIENT
Mauro Carvalho Chehab [Thu, 31 Aug 2017 16:52:45 +0000 (12:52 -0400)]
media: dmx.h: get rid of unused DMX_KERNEL_CLIENT

There's a flag defined for Digital TV demux that is not used
anywhere, called DMX_KERNEL_CLIENT. Get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: fe_property_parameters.rst: better document bandwidth
Mauro Carvalho Chehab [Thu, 31 Aug 2017 11:17:21 +0000 (07:17 -0400)]
media: fe_property_parameters.rst: better document bandwidth

Use a table to document the supported bandwidths. That makes
it clearer to readers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: fe_property_parameters.rst: better define properties usage
Mauro Carvalho Chehab [Thu, 31 Aug 2017 11:16:17 +0000 (07:16 -0400)]
media: fe_property_parameters.rst: better define properties usage

Several frontend properties are specific to a subset of the
delivery systems. Make it clearer when describing each
property.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb frontend docs: use kernel-doc documentation
Mauro Carvalho Chehab [Wed, 30 Aug 2017 17:45:20 +0000 (13:45 -0400)]
media: dvb frontend docs: use kernel-doc documentation

Now that frontend.h contains most documentation for the frontend,
remove the duplicated information from Documentation/ and use the
kernel-doc auto-generated one instead.

That should simplify maintainership of DVB frontend uAPI, as most
of the documentation will stick with the header file.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/frontend.h: document the uAPI file
Mauro Carvalho Chehab [Wed, 30 Aug 2017 12:12:38 +0000 (08:12 -0400)]
media: dvb/frontend.h: document the uAPI file

Most of the stuff at the Digital TV frontend header file
are documented only at the Documentation. However, a few
kernel-doc markups are there, several of them with parsing
issues.

Add the missing documentation, copying definitions from the
Documentation when it applies, fixing some bugs.

Please notice that DVBv3 stuff that were deprecated weren't
commented by purpose. Instead, they were clearly tagged as
such.

This patch prepares to move part of the documentation from
Documentation/ to kernel-doc comments.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/frontend.h: move out a private internal structure
Mauro Carvalho Chehab [Wed, 30 Aug 2017 11:55:47 +0000 (07:55 -0400)]
media: dvb/frontend.h: move out a private internal structure

struct dtv_cmds_h is just an ancillary struct used by the
dvb_frontend.c to internally store frontend commands.

It doesn't belong to the userspace header, nor it is used anywhere,
except inside the DVB core. So, remove it from the header.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: adjust the notices about optional hardware
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:25:20 +0000 (05:25 -0400)]
media: dvb/intro: adjust the notices about optional hardware

Both CA and decoders are optional. Also, the presence or
absence has nothing to do on being a PCI card or not.

Nowadays, most hardware leaves the decoders to either the
GPU or to some ISP inside the SoC, instead of implementing
it inside the Digital TV part of the device.

So, change the wording to reflect the hardware changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: update the history part of the document
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:20:45 +0000 (05:20 -0400)]
media: dvb/intro: update the history part of the document

Convergence doesn't exist anymore. The community itself maintains
the spec. Update accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: update references for TV standards
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:19:25 +0000 (05:19 -0400)]
media: dvb/intro: update references for TV standards

The references there are only for DVB. Add missing references for
ATSC and ISDB standards.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro: use the term Digital TV to refer to the system
Mauro Carvalho Chehab [Wed, 30 Aug 2017 09:15:40 +0000 (05:15 -0400)]
media: dvb/intro: use the term Digital TV to refer to the system

On several places at the introduction, a digital TV board and its
kernel support is called as DVB. The reason is simple: by the
time the document was written, there were no other digital TV
standards :-)

Modernize the specs by referring to them as Digital TV.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dmx.h: split typedefs from structs
Mauro Carvalho Chehab [Fri, 1 Sep 2017 10:09:14 +0000 (06:09 -0400)]
media: dmx.h: split typedefs from structs

Using typedefs inside the Kernel is against CodingStyle, and
there's no good usage here.

Just like we did at frontend.h, at commit 0df289a209e0
("[media] dvb: Get rid of typedev usage for enums"), let's keep
those typedefs only to provide userspace backward compatibility.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ca.h: split typedefs from structs
Mauro Carvalho Chehab [Fri, 1 Sep 2017 09:43:39 +0000 (05:43 -0400)]
media: ca.h: split typedefs from structs

Using typedefs inside the Kernel is against CodingStyle, and
there's no good usage here.

Just like we did at frontend.h, at commit 0df289a209e0 ("[media] dvb:
Get rid of typedev usage for enums"), let's keep those typedefs only
to provide userspace backward compatibility.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: serial_ir: fix tx timing calculation on 32-bit
Sean Young [Wed, 23 Aug 2017 15:06:04 +0000 (11:06 -0400)]
media: serial_ir: fix tx timing calculation on 32-bit

Move the calculation to where it is needed, so the result doesn't
need to be stored in the device struct.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: gpio-ir-tx: use ktime accessor functions
Sean Young [Fri, 25 Aug 2017 14:45:47 +0000 (10:45 -0400)]
media: rc: gpio-ir-tx: use ktime accessor functions

Prefer using accessor functions so we are not dependent on the ktime_t
type.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: rc: use ktime accessor functions
Jasmin Jessich [Fri, 25 Aug 2017 09:59:41 +0000 (05:59 -0400)]
media: rc: use ktime accessor functions

Prefer using accessor functions so we are not dependent on the ktime_t
type.

Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: max2175: Propagate the real error on devm_clk_get() failure
Fabio Estevam [Sun, 27 Aug 2017 16:30:35 +0000 (12:30 -0400)]
media: max2175: Propagate the real error on devm_clk_get() failure

When devm_clk_get() fails we should return the real error code
instead of always returning -ENODEV.

This allows defer probe to happen in the case the clock provider has
not been enabled by the time max2175 driver gets probed.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Explicitly list Hauppauge model numbers of HVR-4400 and HVR-5500
Matthias Schwarzott [Sun, 27 Aug 2017 12:26:07 +0000 (08:26 -0400)]
media: cx23885: Explicitly list Hauppauge model numbers of HVR-4400 and HVR-5500

Add two new model numbers to suppress this message in kernel log:
  cx23885: cx23885[0]: warning: unknown hauppauge model #121029

Add these model numbers:
* Model 121019 - WinTV-HVR4400
* Model 121029 - WinTV-HVR5500

For WinTV-HVR4400 the documentation and my hardware differ:

Documentation says it supports DVB-S/S2 and DVB-T,
but my hardware also supports DVB-C.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: i2c: adv748x: Export I2C device table entries as module aliases
Javier Martinez Canillas [Wed, 9 Aug 2017 09:37:30 +0000 (05:37 -0400)]
media: i2c: adv748x: Export I2C device table entries as module aliases

The I2C core always reports a MODALIAS of the form i2c:<foo> even if the
device was registered via OF, and the driver is only exporting the OF ID
table entries as module aliases.

So if the driver is built as module, autoload won't work since udev/kmod
won't be able to match the registered OF device with its driver module.

Before this patch:

$ modinfo drivers/media/i2c/adv748x/adv748x.ko | grep alias
alias:          of:N*T*Cadi,adv7482C*
alias:          of:N*T*Cadi,adv7482
alias:          of:N*T*Cadi,adv7481C*
alias:          of:N*T*Cadi,adv7481

After this patch:

modinfo drivers/media/i2c/adv748x/adv748x.ko | grep alias
alias:          of:N*T*Cadi,adv7482C*
alias:          of:N*T*Cadi,adv7482
alias:          of:N*T*Cadi,adv7481C*
alias:          of:N*T*Cadi,adv7481
alias:          i2c:adv7482
alias:          i2c:adv7481

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging/imx: always select VIDEOBUF2_DMA_CONTIG
Arnd Bergmann [Mon, 7 Aug 2017 10:49:18 +0000 (06:49 -0400)]
media: staging/imx: always select VIDEOBUF2_DMA_CONTIG

I ran into a rare build error during randconfig testing:

drivers/staging/media/imx/imx-media-capture.o: In function `capture_stop_streaming':
imx-media-capture.c:(.text+0x224): undefined reference to `vb2_buffer_done'
drivers/staging/media/imx/imx-media-capture.o: In function `imx_media_capture_device_register':
imx-media-capture.c:(.text+0xe60): undefined reference to `vb2_queue_init'
imx-media-capture.c:(.text+0xfa0): undefined reference to `vb2_dma_contig_memops'

While VIDEOBUF2_DMA_CONTIG was already selected by the camera driver,
it wasn't necessarily there with just the base driver enabled.
This moves the 'select' statement to the top-level option to make
sure it's always available.

Fixes: 64b5a49df486 ("[media] media: imx: Add Capture Device Interface")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dw2102: make dvb_usb_device_description structures const
Bhumika Goyal [Thu, 3 Aug 2017 10:00:32 +0000 (06:00 -0400)]
media: dw2102: make dvb_usb_device_description structures const

dvb_usb_device_description structures are only used during a copy
operation. Therefore, declare them as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mn88473: reset stream ID reg if no PLP given
Olli Salonen [Sun, 30 Jul 2017 12:34:49 +0000 (08:34 -0400)]
media: mn88473: reset stream ID reg if no PLP given

If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the PLP register. Set PLP to 0 instead.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mn88472: reset stream ID reg if no PLP given
Olli Salonen [Sun, 30 Jul 2017 12:34:48 +0000 (08:34 -0400)]
media: mn88472: reset stream ID reg if no PLP given

If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the PLP register. Set PLP to 0 instead.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb_frontend: initialize variable s with FE_NONE instead of 0
Colin Ian King [Fri, 21 Jul 2017 16:01:00 +0000 (12:01 -0400)]
media: dvb_frontend: initialize variable s with FE_NONE instead of 0

GIT_AUTHOR_NAME=Colin King
GIT_AUTHOR_EMAIL=colin.king@canonical.com

In a previous commit, we added FE_NONE as an unknown fe_status.
Initialize variable s to FE_NONE instead of the more opaque value 0.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: docs-next: update the fe_status documentation for FE_NONE
Colin Ian King [Fri, 21 Jul 2017 16:12:38 +0000 (12:12 -0400)]
media: docs-next: update the fe_status documentation for FE_NONE

Recently added FE_NONE to the enum fe_status, so update the
documentation accordingly.

[mchehab@s-opensource.com: change description to actually
 reflect what FE_NONE means: no lock of any kind]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb_frontend: ensure that inital front end status initialized
Colin Ian King [Thu, 20 Jul 2017 22:12:07 +0000 (18:12 -0400)]
media: dvb_frontend: ensure that inital front end status initialized

The fe_status variable s is not initialized meaning it can have any
random garbage status.  This could be problematic if fe->ops.tune is
false as s is not updated by the call to fe->ops.tune() and a
subsequent check on the change status will using a garbage value.
Fix this by adding FE_NONE to the enum fe_status and initializing
s to this.

Detected by CoverityScan, CID#112887 ("Uninitialized scalar variable")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbproperty.rst: minor editorial changes
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:14 +0000 (06:07 -0400)]
media: dvbproperty.rst: minor editorial changes

Do some minor editorial changes to make this chapter visually
better, and the example a little bit clearer.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvbproperty.rst: improve notes about legacy frontend calls
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:13 +0000 (06:07 -0400)]
media: dvbproperty.rst: improve notes about legacy frontend calls

The description of the DVBv5 API was written a long time ago,
where the API was still new, and there were not apps using it.

Now that the API is stable and used by new applications, clarify
that DVBv3 calls should not be used and why.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.rst: mention MMT at the documentation
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:12 +0000 (06:07 -0400)]
media: frontend.rst: mention MMT at the documentation

The ATSC 3.0 uses MPEG Media Transport, with is not currently
supported. Yet, we'll need to implement it sooner or later.
So, mention about it at the specs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.rst: convert SEC note into footnote
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:11 +0000 (06:07 -0400)]
media: frontend.rst: convert SEC note into footnote

The description of what SEC means fits well as a footnote.
That makes the need of saying that SEC is only for Satellite
when it was mentioned, as the footnote already says that.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: frontend.rst: fix supported delivery systems
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:10 +0000 (06:07 -0400)]
media: frontend.rst: fix supported delivery systems

The introduction for the frontend chapter is not quite
correct:
  - it tells that it supports only three types of
    delivery systems, in opposite to three *groups*;
  - It adds ISDB-C to the list of supported systems,
    but, this is not true.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb/intro.rst: Use verbatim font where needed
Mauro Carvalho Chehab [Sat, 26 Aug 2017 10:07:09 +0000 (06:07 -0400)]
media: dvb/intro.rst: Use verbatim font where needed

The device numbering for DVB uses "M" and "N" as vars for the
number of the device, but sometimes this is printed using normal
font instead of verbatim.

While here, remove an extra space after quotation marks.

This is a minor cleanup with no changes at the text.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbvision: Improve a size determination in usbvision_alloc()
Markus Elfring [Sat, 26 Aug 2017 20:22:13 +0000 (16:22 -0400)]
media: usbvision: Improve a size determination in usbvision_alloc()

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbvision: Adjust eight checks for null pointers
Markus Elfring [Sat, 26 Aug 2017 20:16:52 +0000 (16:16 -0400)]
media: usbvision: Adjust eight checks for null pointers

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbvision: Delete an error message for a failed memory allocation in usbvision...
Markus Elfring [Sat, 26 Aug 2017 20:06:05 +0000 (16:06 -0400)]
media: usbvision: Delete an error message for a failed memory allocation in usbvision_probe()

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: Staging: media: radio-bcm2048: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 11:32:53 +0000 (07:32 -0400)]
media: Staging: media: radio-bcm2048: make video_device const

Make this const as it is only used in a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: radio: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 08:43:43 +0000 (04:43 -0400)]
media: radio: make video_device const

Make these const as they are only used in a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dib8000: remove some bogus dead code
Dan Carpenter [Sat, 26 Aug 2017 06:18:41 +0000 (02:18 -0400)]
media: dib8000: remove some bogus dead code

This function is broken.  It sets the wrong front_end to NULL.  But it's
not used, so let's just delete it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dib9000: delete some unused broken code
Dan Carpenter [Sat, 26 Aug 2017 06:18:16 +0000 (02:18 -0400)]
media: dib9000: delete some unused broken code

The dib9000_remove_slave_frontend() function isn't used.

I was reviewing it because my static checker claims it writes one
element beyond the end of the array.  That's a false positive.  What it
actually does is, if there are two or more front ends, then it prints a
debug message to say that it removed the first one, stored in
state->fe[1], and then it "removes" (scare quotes on purpose) the second
one, stored in state->fe[2].  Deleting a front end from the middle is
not really supported and breaks code like dib9000_release() which
assumes the first NULL front end marks the end of the list.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: omap4iss: make v4l2_file_operations const
Bhumika Goyal [Sat, 26 Aug 2017 06:15:53 +0000 (02:15 -0400)]
media: staging: omap4iss: make v4l2_file_operations const

Make this const as it is only stored in a const field of a
video_device structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usbtv: make v4l2_file_operations const
Bhumika Goyal [Sat, 26 Aug 2017 06:13:46 +0000 (02:13 -0400)]
media: usbtv: make v4l2_file_operations const

Make this const as it is only stored in a const field of a
video_device structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx18: make v4l2_file_operations const
Bhumika Goyal [Sat, 26 Aug 2017 06:02:08 +0000 (02:02 -0400)]
media: cx18: make v4l2_file_operations const

Make this const as it is only stored in a const field of a
video_device structure.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: usb: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 13:11:30 +0000 (09:11 -0400)]
media: usb: make video_device const

Make these const as they are only used during a copy operation.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: pci: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 13:08:11 +0000 (09:08 -0400)]
media: pci: make video_device const

Make these const as they are either used during a copy operation or
passed to a const argument of the function cx88_vdev_init.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: platform: make video_device const
Bhumika Goyal [Sat, 26 Aug 2017 12:57:26 +0000 (08:57 -0400)]
media: platform: make video_device const

Make these const as they are only used during a copy operation.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
@@
static struct video_device s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier match.s;
expression list[3] es;
position ref.p;
@@
cx88_vdev_init(es,&s@p,...)

@good2@
position ref.p;
identifier match.s,f,c;
expression e;
@@
(
e = s@p
|
e = s@p.f
|
c(...,s@p.f,...)
|
c(...,s@p,...)
)

@bad depends on  !good1 && !good2@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct video_device s;

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: au0828: fix RC_CORE dependency
Arnd Bergmann [Thu, 24 Aug 2017 22:22:28 +0000 (18:22 -0400)]
media: au0828: fix RC_CORE dependency

When RC_CORE is a loadable module, and au0828 is built-in including
the RC support, we get a link error:

drivers/media/usb/au0828/au0828-input.o: In function `au0828_get_key_au8522':
au0828-input.c:(.text+0x474): undefined reference to `ir_raw_event_store'
drivers/media/usb/au0828/au0828-input.o: In function `au0828_rc_register':
au0828-input.c:(.text+0x7c8): undefined reference to `rc_allocate_device'
au0828-input.c:(.text+0x8f8): undefined reference to `rc_register_device'

This adds an additional dependency, similar to the one for em28xx,
to ensure the broken configuration is never used.

Fixes: 2fcfd317f66c ("[media] au0828: add support for IR on HVR-950Q")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dib0090: fix duplicated code for different branches
Gustavo A. R. Silva [Fri, 18 Aug 2017 01:23:44 +0000 (21:23 -0400)]
media: dib0090: fix duplicated code for different branches

Refactor code in order to avoid identical code for different branches.

This issue was detected with the help of Coccinelle.

Addresses-Coverity-ID: 1226795

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mx2_emmaprp: Check for platform_get_irq() error
Fabio Estevam [Thu, 17 Aug 2017 21:12:05 +0000 (17:12 -0400)]
media: mx2_emmaprp: Check for platform_get_irq() error

platform_get_irq() 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: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: docs-rst: media: Document broken frame handling in stream stop for CSI-2
Sakari Ailus [Wed, 16 Aug 2017 12:20:18 +0000 (08:20 -0400)]
media: docs-rst: media: Document broken frame handling in stream stop for CSI-2

Some CSI-2 transmitters will finish an ongoing frame whereas others will
not. Document that receiver drivers should not assume a particular
behaviour but to work in both cases.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0367: remove QAM_AUTO from ddb_fe_ops
Daniel Scheller [Mon, 14 Aug 2017 17:39:37 +0000 (13:39 -0400)]
media: dvb-frontends/stv0367: remove QAM_AUTO from ddb_fe_ops

Since the cab_* codepath doesn't recognize QAM_AUTO, don't announce that
it is supported when it really isn't. Fixes ie. w_scan from
unconditionally using QAM_AUTO on DVB-C scans.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: imx: use setup_timer
Cihangir Akturk [Sun, 13 Aug 2017 18:39:38 +0000 (14:39 -0400)]
media: imx: use setup_timer

Use setup_timer function instead of initializing timer with the
function and data fields.

Generated by: scripts/coccinelle/api/setup_timer.cocci.

Signed-off-by: Cihangir Akturk <cakturk@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: mxl111sf: Fix potential null pointer dereference
Eugeniu Rosca [Sun, 13 Aug 2017 10:06:29 +0000 (06:06 -0400)]
media: mxl111sf: Fix potential null pointer dereference

Reviewing the delta between cppcheck output of v4.9.39 and v4.9.40
stable updates, I stumbled on the new warning:

mxl111sf.c:80: (warning) Possible null pointer dereference: rbuf

Since copying state->rcvbuf into rbuf is not needed in the 'write-only'
scenario (i.e. calling mxl111sf_ctrl_msg() from mxl111sf_i2c_send_data()
or from mxl111sf_write_reg()), bypass memcpy() in this case.

Fixes: d90b336f3f65 ("[media] mxl111sf: Fix driver to use heap allocate buffers for USB messages")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: au0828: fix unbalanced lock/unlock in au0828_usb_probe
Gustavo A. R. Silva [Sat, 12 Aug 2017 17:30:59 +0000 (13:30 -0400)]
media: au0828: fix unbalanced lock/unlock in au0828_usb_probe

Call mutex_unlock and free dev on failure.

Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-usb: Add memory free on error path in dw2102_probe()
Anton Vasilyev [Thu, 10 Aug 2017 15:27:44 +0000 (11:27 -0400)]
media: dvb-usb: Add memory free on error path in dw2102_probe()

If dw2102_probe() fails on dvb_usb_device_init(), then memleak occurs.

The patch adds deallocation to the error path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Reviewed-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0910: change minsymrate to 100Ksyms/s
Daniel Scheller [Wed, 23 Aug 2017 16:10:02 +0000 (12:10 -0400)]
media: dvb-frontends/stv0910: change minsymrate to 100Ksyms/s

The demodulator supports symbol rates as low as 100Ksyms/s - the demod
setup in start() already handles such low symbol rates and reviewers
of stv0910 equipped cards even found and tested transponders with
SRs in that range. So, announce this in the fe_ops.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Cc: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging/cxd2099: Add module parameter for buffer mode
Daniel Scheller [Wed, 23 Aug 2017 16:10:01 +0000 (12:10 -0400)]
media: staging/cxd2099: Add module parameter for buffer mode

The buffer mode of the cxd2099 driver requires more work regarding error
handling and thus can cause issues in some cases, so disable it by default
and make that mode of operation controllable by users via a module
parameter (ie. 'modprobe cxd2099 buffermode=1' enables current behaviour).

The upstream codebase also has the buffer mode disabled by default, so
we should match this (but users still can test things out using the
modparm).

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge: fix sparse warnings
Daniel Scheller [Wed, 23 Aug 2017 16:10:00 +0000 (12:10 -0400)]
media: ddbridge: fix sparse warnings

Fix several

  drivers/media/pci/ddbridge/ddbridge-core.c: warning: symbol ... was not declared. Should it be static?
  drivers/media/pci/ddbridge/ddbridge-core.c: warning: Using plain integer as NULL pointer
  drivers/media/pci/ddbridge/ddbridge-io.h: warning: cast removes address space of expression
  drivers/media/pci/ddbridge/ddbridge-io.h: warning: incorrect type in argument 1 (different address spaces)

at multiple places.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: ddbridge: fix teardown/deregistration order in ddb_input_detach()
Daniel Scheller [Wed, 23 Aug 2017 16:09:59 +0000 (12:09 -0400)]
media: ddbridge: fix teardown/deregistration order in ddb_input_detach()

Brought to attention by Matthias Schwarzott <zzam@gentoo.org> by fixing
possible use-after-free faults in some demod drivers:

In ddb_input_detach(), the i2c_client is unregistered and removed before
dvb frontends are unregistered and detached. While no use-after-free issue
was observed so far, there is another issue with this:

dvb->attached keeps track of the state of the input/output registration,
and the i2c_client unregistration takes place only if everything was
successful (dvb->attached == 0x31). If for some reason an error occurred
during the frontend setup, that value stays at 0x20. In the following
error handling and cleanup, ddb_input_detach() will skip down to that
state, leaving the i2c_client registered, causing refcount issues.

Fix this by moving the i2c_client deregistration down to case 0x20.

Cc: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dvb-frontends/stv0910: release lock on gate_ctrl() failure
Daniel Scheller [Wed, 23 Aug 2017 16:09:58 +0000 (12:09 -0400)]
media: dvb-frontends/stv0910: release lock on gate_ctrl() failure

Whenever write_reg() fails to open/close the demod's I2C gate, release the
lock to avoid deadlocking situations. If I2c gate open failed, there's no
need to hold a lock, and if close fails, the mutex_unlock() at the end of
the function is never reached, leaving the mutex_lock in locked state,
which in turn will cause potential for deadlocks. Thus, release the lock
on failure.

While we're touching gate_ctrl(), add some explanation about the need for
locking and the shared I2C bus/gate.

Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx231xx: fix use-after-free when unregistering the i2c_client for the dvb...
Matthias Schwarzott [Wed, 2 Aug 2017 16:46:00 +0000 (12:46 -0400)]
media: cx231xx: fix use-after-free when unregistering the i2c_client for the dvb demod

Calling i2c_unregister_device for a demod driver destroys the frontend object.
Later it is accessed by calling dvb_unregister_frontend and
dvb_frontend_detach.

In some cases this leads to a general protection fault with this
callstack:

  dvb_unregister_frontend+0x25/0x50 [dvb_core]
  dvb_fini+0xdb/0x160 [cx231xx_dvb]
  cx231xx_unregister_extension+0x3d/0xb0 [cx231xx]
  cx231xx_dvb_unregister+0x10/0x809 [cx231xx_dvb]
  SyS_delete_module+0x18a/0x240
  ? exit_to_usermode_loop+0x7b/0x80
  entry_SYSCALL_64_fastpath+0x17/0x98

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: cx23885: Fix use-after-free when unregistering the i2c_client for the dvb...
Matthias Schwarzott [Wed, 2 Aug 2017 16:45:59 +0000 (12:45 -0400)]
media: cx23885: Fix use-after-free when unregistering the i2c_client for the dvb demod

Unregistering the i2c_client of the demod driver destroys the frontend
object.
Calling vb2_dvb_unregister_bus later accesses the frontend (and with the
refcount_t) conversion the refcount_t code complains:

kernel: ------------[ cut here ]------------
kernel: WARNING: CPU: 0 PID: 7883 at lib/refcount.c:128 refcount_sub_and_test+0x70/0x80
kernel: refcount_t: underflow; use-after-free.
kernel: Modules linked in: bluetooth si2165(O) a8293(O) tda10071(O) tea5767(O) tuner(O) cx23885(O-) tda18271(O) videobuf2_dvb(O) videobuf2_dma_sg(O) m88ds3103(O) tveeprom(O) cx2341x(O) v4l2_common(O) dvb_core(O) rc_core(O) videobuf2_memops(O) videobuf2_v4l2(O) ums_realtek videobuf2_core(O) uas videodev(O) media(O) rtl8192cu i2c_mux usb_storage rtl_usb rtl8192c_common rtlwifi snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core x86_pkg_temp_thermal kvm_intel kvm irqbypass
kernel: CPU: 0 PID: 7883 Comm: rmmod Tainted: G        W  O    4.11.3-gentoo #3
kernel: Hardware name: MEDION E2050 2391/H81H3-EM2, BIOS H81EM2W08.308 08/25/2014
kernel: Call Trace:
kernel:  dump_stack+0x4d/0x66
kernel:  __warn+0xc6/0xe0
kernel:  warn_slowpath_fmt+0x46/0x50
kernel:  ? kobject_put+0x2f/0x60
kernel:  refcount_sub_and_test+0x70/0x80
kernel:  refcount_dec_and_test+0x11/0x20
kernel:  dvb_unregister_frontend+0x42/0x60 [dvb_core]
kernel:  vb2_dvb_dealloc_frontends+0x9e/0x100 [videobuf2_dvb]
kernel:  vb2_dvb_unregister_bus+0xd/0x20 [videobuf2_dvb]
kernel:  cx23885_dvb_unregister+0xc3/0x110 [cx23885]
kernel:  cx23885_dev_unregister+0xea/0x150 [cx23885]
kernel:  cx23885_finidev+0x4f/0x70 [cx23885]
kernel:  pci_device_remove+0x34/0xb0
kernel:  device_release_driver_internal+0x150/0x200
kernel:  driver_detach+0x33/0x70
kernel:  bus_remove_driver+0x47/0xa0
kernel:  driver_unregister+0x27/0x50
kernel:  pci_unregister_driver+0x34/0x90
kernel:  cx23885_fini+0x10/0x12 [cx23885]
kernel:  SyS_delete_module+0x166/0x220
kernel:  ? exit_to_usermode_loop+0x7b/0x80
kernel:  entry_SYSCALL_64_fastpath+0x17/0x98
kernel: RIP: 0033:0x7f5901680b07
kernel: RSP: 002b:00007ffdf6cdb028 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
kernel: RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f5901680b07
kernel: RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000000001500258
kernel: RBP: 00000000015001f0 R08: 0000000000000000 R09: 1999999999999999
kernel: R10: 0000000000000884 R11: 0000000000000206 R12: 00007ffdf6cda010
kernel: R13: 0000000000000000 R14: 00000000015001f0 R15: 00000000014ff010
kernel: ---[ end trace c3a4659b89086061 ]---

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: fix bounds checking in mt9m114_s_exposure_selection()
Dan Carpenter [Thu, 10 Aug 2017 12:23:34 +0000 (08:23 -0400)]
media: staging: atomisp: fix bounds checking in mt9m114_s_exposure_selection()

These clamp_t() calls are no-ops because we don't save the results.  It
leads to an array out of bounds bug.

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: media: atomisp: ap1302: Remove FSF postal address
Harold Gomez [Thu, 10 Aug 2017 08:28:24 +0000 (04:28 -0400)]
media: staging: media: atomisp: ap1302: Remove FSF postal address

Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already includes
a copy of the GPL.

remove the unnecessary paragraph

Signed-off-by: Harold Gomez <haroldgmz11@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: atomisp: imx: remove dead code
Arnd Bergmann [Mon, 7 Aug 2017 10:51:47 +0000 (06:51 -0400)]
media: staging: atomisp: imx: remove dead code

Making some functions 'static' has uncovered a few functions that
have no caller, through the gcc warnings:

atomisp/i2c/imx/imx.c:1111:12: error: 'imx_t_focus_vcm' defined but not used [-Werror=unused-function]
atomisp/i2c/imx/imx.c:1103:12: error: 'imx_vcm_init' defined but not used [-Werror=unused-function]
atomisp/i2c/imx/imx.c:1095:12: error: 'imx_vcm_power_down' defined but not used [-Werror=unused-function]
atomisp/i2c/imx/imx.c:1087:12: error: 'imx_vcm_power_up' defined but not used [-Werror=unused-function]

All four of these can be removed. Since they call indirect functions,
I also looked at how those are used in turn:

- The power_up/power_down callbacks are called from other functions
  and are still needed.

- The t_focus_vcm callbacks pointers are completely unused and can
  be removed in both imx and ov8858. Some of the handlers are called
  directly and can now be marked static, the others are dummy
  implemntations that we can remove.

- vcm_init is unused in imx, but dw9718_vcm_init is used in ov8858,
  but is not used in imx, so that one needs to stay around. The callback
  pointers in imx can be removed.

Fixes: 9a5a6911aa3f ("staging: imx: fix non-static declarations")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: arm: dts: omap3: N9/N950: Add AS3645A camera flash
Sakari Ailus [Sun, 3 May 2015 21:14:28 +0000 (17:14 -0400)]
media: arm: dts: omap3: N9/N950: Add AS3645A camera flash

Add the as3645a flash controller to the DT source.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: leds: as3645a: Add LED flash class driver
Sakari Ailus [Sun, 26 Apr 2015 21:56:54 +0000 (17:56 -0400)]
media: leds: as3645a: Add LED flash class driver

Add a LED flash class driver for the as3654a flash controller. A V4L2 flash
driver for it already exists (drivers/media/i2c/as3645a.c), and this driver
is based on that.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: dt: bindings: Document DT bindings for Analog devices as3645a
Sakari Ailus [Sat, 6 Jun 2015 11:10:59 +0000 (07:10 -0400)]
media: dt: bindings: Document DT bindings for Analog devices as3645a

Document DT bindings for Analog Devices as3645a flash LED controller which
also supports an indicator LED.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-flash-led-class: Document v4l2_flash_init() references
Sakari Ailus [Wed, 19 Jul 2017 22:38:36 +0000 (18:38 -0400)]
media: v4l2-flash-led-class: Document v4l2_flash_init() references

The v4l2_flash_init() keeps a reference to the ops struct but not to the
config struct (nor anything it contains). Document this.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: v4l2-flash-led-class: Create separate sub-devices for indicators
Sakari Ailus [Tue, 18 Jul 2017 13:26:59 +0000 (09:26 -0400)]
media: v4l2-flash-led-class: Create separate sub-devices for indicators

The V4L2 flash interface allows controlling multiple LEDs through a single
sub-devices if, and only if, these LEDs are of different types. This
approach scales badly for flash controllers that drive multiple flash LEDs
or for LED specific associations. Essentially, the original assumption of a
LED driver chip that drives a single flash LED and an indicator LED is no
longer valid.

Address the matter by registering one sub-device per LED.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> (for greybus/light)
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: staging: greybus: light: fix memory leak in v4l2 register
Rui Miguel Silva [Wed, 2 Aug 2017 16:52:57 +0000 (12:52 -0400)]
media: staging: greybus: light: fix memory leak in v4l2 register

We are allocating memory for the v4l2 flash configuration structure and
leak it in the normal path. Just use the stack for this as we do not
use it outside of this function.

Also use IS_ERR() instead of IS_ERR_OR_NULL() to check return value from
v4l2_flash_init() for it never returns NULL.

Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")

Reported-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
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@s-opensource.com>
6 years agomedia: uapi book: Fix a few Sphinx warnings
Mauro Carvalho Chehab [Sun, 27 Aug 2017 00:16:51 +0000 (20:16 -0400)]
media: uapi book: Fix a few Sphinx warnings

Solve the following issues:

Documentation/media/uapi/v4l/dev-sliced-vbi.rst:208: ERROR: Content block expected for the "raw" directive; none found.
Documentation/media/uapi/v4l/dev-sliced-vbi.rst:216: ERROR: Content block expected for the "raw" directive; none found.
Documentation/media/uapi/v4l/pixfmt-packed-rgb.rst:645: ERROR: Content block expected for the "raw" directive; none found.

Fixes: 70b074df4ed1 ("media: fix pdf build with Spinx 1.6")
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: smiapp: check memory allocation failure
Christophe JAILLET [Thu, 24 Aug 2017 05:58:39 +0000 (01:58 -0400)]
media: smiapp: check memory allocation failure

Check memory allocation failure and return -ENOMEM in such a case.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: omap3isp: fix uninitialized variable use
Arnd Bergmann [Wed, 23 Aug 2017 13:30:19 +0000 (09:30 -0400)]
media: omap3isp: fix uninitialized variable use

A debug printk statement was copied incorrectly into the new
csi1 parser code and causes a warning there:

drivers/media/platform/omap3isp/isp.c: In function 'isp_probe':
include/linux/dynamic_debug.h:134:3: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since there is only one lane, the index is never set. This
changes the debug print to always print a zero instead,
keeping the original format of the message.

Fixes: 9211434bad30 ("media: omap3isp: Parse CSI1 configuration from the device tree")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: fix pdf build with Spinx 1.6
Mauro Carvalho Chehab [Sat, 26 Aug 2017 09:28:26 +0000 (05:28 -0400)]
media: fix pdf build with Spinx 1.6

Sphinx 1.6 generates some LaTeX code before each table,
starting its own environment before calling tabulary,
apparently to improve table layout.

The problem is that such environment is incompatible with
adjustbox. While, in thesis, it should be possible to override
it or to redefine tabulary, I was unable to produce such patch.

Also, that would likely break on some future Sphinx version.

So, instead, let's just change the font size on bigger tables,
in order for them to fit into the page size. That is not as
good as adjustbox, and require some manual work, but it should
be less sensitive to Sphinx changes.

While here, adjust a few other tables whose text is exceeding
the cell boundaries.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: qcom: don't go past the array
Mauro Carvalho Chehab [Sat, 26 Aug 2017 19:34:37 +0000 (15:34 -0400)]
media: qcom: don't go past the array

As reported by smatch:

drivers/media/platform/qcom/camss-8x16/camss-vfe.c:1136 vfe_release_wm() error: buffer overflow 'vfe->wm_output_map' 7 <= 7

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: qcom: mark long long consts as such
Mauro Carvalho Chehab [Sat, 26 Aug 2017 19:33:25 +0000 (15:33 -0400)]
media: qcom: mark long long consts as such

Fix those warnings when building on i386:

drivers/media/platform/qcom/camss-8x16/camss-csiphy.c:333:22: warning: constant 1000000000000 is so big it is long long
drivers/media/platform/qcom/camss-8x16/camss-csiphy.c:339:32: warning: constant 1000000000000 is so big it is long long

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: Add abbreviations explanation
Todor Tomov [Fri, 18 Aug 2017 08:16:34 +0000 (04:16 -0400)]
media: camss: Add abbreviations explanation

Add abbreviations explanation at the top header blocks in source files.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: doc: media/v4l-drivers/qcom_camss: Add abbreviations explanation
Todor Tomov [Fri, 18 Aug 2017 08:16:33 +0000 (04:16 -0400)]
media: doc: media/v4l-drivers/qcom_camss: Add abbreviations explanation

Add explanations for VFE's PIX and RDI interfaces.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: doc: media/v4l-drivers: Qualcomm Camera Subsystem - Media graph
Todor Tomov [Tue, 8 Aug 2017 13:30:18 +0000 (09:30 -0400)]
media: doc: media/v4l-drivers: Qualcomm Camera Subsystem - Media graph

Update the Qualcomm Camera Subsystem driver document with a media
controller pipeline graph diagram.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: Use optimal clock frequency rates
Todor Tomov [Tue, 8 Aug 2017 13:30:17 +0000 (09:30 -0400)]
media: camss: Use optimal clock frequency rates

Use standard V4L2 control to get pixel clock rate from a sensor
linked in the media controller pipeline. Then calculate clock
rates on CSIPHY, CSID and VFE to use the lowest possible.

If the currnet pixel clock rate of the sensor cannot be read then
use the highest possible. This case covers also the CSID test
generator usage.

If VFE is already powered on by another pipeline, check that the
current VFE clock rate is high enough for the new pipeline.
If not return busy error code as VFE clock rate cannot be changed
while VFE is running.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: doc: media/v4l-drivers: Qualcomm Camera Subsystem - Scale and crop
Todor Tomov [Tue, 8 Aug 2017 13:30:16 +0000 (09:30 -0400)]
media: doc: media/v4l-drivers: Qualcomm Camera Subsystem - Scale and crop

Update the Qualcomm Camera Subsystem driver document for VFE scale
and crop modules support.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: vfe: Configure crop module in VFE
Todor Tomov [Tue, 8 Aug 2017 13:30:15 +0000 (09:30 -0400)]
media: camss: vfe: Configure crop module in VFE

Add crop module configuration support to be able to apply cropping.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: vfe: Add interface for cropping
Todor Tomov [Tue, 8 Aug 2017 13:30:14 +0000 (09:30 -0400)]
media: camss: vfe: Add interface for cropping

Extend selection ioctls to handle cropping configuration.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: vfe: Configure scaler module in VFE
Todor Tomov [Tue, 8 Aug 2017 13:30:13 +0000 (09:30 -0400)]
media: camss: vfe: Configure scaler module in VFE

Add scaler module configuration support to be able to apply scaling.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: vfe: Add interface for scaling
Todor Tomov [Tue, 8 Aug 2017 13:30:12 +0000 (09:30 -0400)]
media: camss: vfe: Add interface for scaling

Add compose selection ioctls to handle scaling configuration.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: camss: vfe: Support for frame padding
Todor Tomov [Tue, 8 Aug 2017 13:30:11 +0000 (09:30 -0400)]
media: camss: vfe: Support for frame padding

Add support for horizontal and vertical frame padding.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
6 years agomedia: doc: media/v4l-drivers: Qualcomm Camera Subsystem - PIX Interface
Todor Tomov [Tue, 8 Aug 2017 13:30:10 +0000 (09:30 -0400)]
media: doc: media/v4l-drivers: Qualcomm Camera Subsystem - PIX Interface

Update Qualcomm Camera Subsystem driver document for the PIX interface
and format conversion support.

Signed-off-by: Todor Tomov <todor.tomov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>