cascardo/linux.git
8 years ago[media] media: au0828 Use au8522_media_pads enum for pad defines
Shuah Khan [Thu, 11 Feb 2016 23:41:28 +0000 (21:41 -0200)]
[media] media: au0828 Use au8522_media_pads enum for pad defines

Change au0828-core to use au8522_media_pads enum defines
instead of hard-coding the pad values.

[mchehab@osg.samsung.com: patch rebased, as the code was
 moved to au0828-video.c. Also added AU8522_PAD_INPUT to the list
 of pad number replacements]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: au8522 change to create MC pad for ALSA Audio Out
Shuah Khan [Thu, 11 Feb 2016 23:41:27 +0000 (21:41 -0200)]
[media] media: au8522 change to create MC pad for ALSA Audio Out

Add new pad for ALSA Audio Out to au8522_media_pads.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Move au8522_media_pads enum to au8522.h from au8522_priv.h
Shuah Khan [Thu, 11 Feb 2016 23:41:26 +0000 (21:41 -0200)]
[media] media: Move au8522_media_pads enum to au8522.h from au8522_priv.h

Move the au8522_media_pads enum to au8522.h from au8522_priv.h to export
them. This will allow au0828-core to use these defines instead of
hard-coding them them.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: v4l-core add enable/disable source common interfaces
Shuah Khan [Thu, 11 Feb 2016 23:41:25 +0000 (21:41 -0200)]
[media] media: v4l-core add enable/disable source common interfaces

Add a new interfaces to be used by v4l-core to invoke enable
source and disable_source handlers in the media_device. The
enable_source helper function invokes the enable_source handler
to find media source entity connected to the entity and check
is it is available or busy. If source is available, link is
activated and pipeline is started. The disable_source helper
function invokes the disable_source handler to deactivate and
stop the pipeline.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Media Controller non-locking __media_entity_pipeline_start/stop()
Shuah Khan [Thu, 11 Feb 2016 23:41:24 +0000 (21:41 -0200)]
[media] media: Media Controller non-locking __media_entity_pipeline_start/stop()

Add non-locking __media_entity_pipeline_start/stop()
interfaces to be called from code paths that hold the
graph_mutex.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Media Controller export non locking __media_entity_setup_link()
Shuah Khan [Thu, 11 Feb 2016 23:41:23 +0000 (21:41 -0200)]
[media] media: Media Controller export non locking __media_entity_setup_link()

Export __media_entity_setup_link() to be used from code paths
that hold the graph_mutex.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Media Controller enable/disable source handler API
Shuah Khan [Thu, 11 Feb 2016 23:41:22 +0000 (21:41 -0200)]
[media] media: Media Controller enable/disable source handler API

Add new fields to struct media_device to add enable_source, and
disable_source handlers, and source_priv to stash driver private
data that is used to run these handlers. The enable_source handler
finds source entity for the passed in entity and checks if it is
available. When link is found, it activates it. Disable source
handler deactivates the link.

Bridge driver is expected to implement and set these handlers.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Media Controller register/unregister entity_notify API
Shuah Khan [Thu, 11 Feb 2016 23:41:21 +0000 (21:41 -0200)]
[media] media: Media Controller register/unregister entity_notify API

Add new interfaces to register and unregister entity_notify
hook to media device. These interfaces allow drivers to add
hooks to take appropriate actions when new entities get added
to a shared media device. For example, au0828 bridge driver
registers an entity_notify hook to create links as needed
between media graph nodes.

[mchehab@osg.samsung.com: simple comments should be /* and not /**]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Add ALSA Media Controller function entities
Shuah Khan [Thu, 11 Feb 2016 23:41:20 +0000 (21:41 -0200)]
[media] media: Add ALSA Media Controller function entities

Add ALSA Media Controller capture, playback, and mixer
function entity defines.

[mchehab@osg.samsung.com: fix a trivial merge conflict and start
 MEDIA_ENT_AUDIO_F from 3000]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] Docbook: media-types.xml: Add Audio Function Entities
Shuah Khan [Thu, 11 Feb 2016 23:41:19 +0000 (21:41 -0200)]
[media] Docbook: media-types.xml: Add Audio Function Entities

Add Audio Function Entities

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] uapi/media.h: Declare interface types for ALSA
Shuah Khan [Thu, 11 Feb 2016 23:41:18 +0000 (21:41 -0200)]
[media] uapi/media.h: Declare interface types for ALSA

Declare the interface types to be used on alsa for
the new G_TOPOLOGY ioctl.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] Docbook: media-types.xml: Add ALSA Media Controller Intf types
Shuah Khan [Thu, 11 Feb 2016 23:41:17 +0000 (21:41 -0200)]
[media] Docbook: media-types.xml: Add ALSA Media Controller Intf types

Add ALSA Media Controller Intf types

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tc358743: use - instead of non-ascii wide-dash character
Hans Verkuil [Sat, 20 Feb 2016 08:48:23 +0000 (06:48 -0200)]
[media] tc358743: use - instead of non-ascii wide-dash character

smatch complains about non-ascii characters. It turns out that a wide-dash character
was used instead of the more common '-' character.

Replace those dashes with -.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] ttpci: cleanup a bogus smatch warning
Mauro Carvalho Chehab [Mon, 22 Feb 2016 17:22:04 +0000 (14:22 -0300)]
[media] ttpci: cleanup a bogus smatch warning

Cleanup this bogus smatch warning:
drivers/media/pci/ttpci/budget.c:635 frontend_init() warn: missing break? reassigning 'budget->dvb_frontend'

And document the fall through logic at the switch().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] av7110: remove a bogus smatch warning
Mauro Carvalho Chehab [Mon, 22 Feb 2016 17:14:41 +0000 (14:14 -0300)]
[media] av7110: remove a bogus smatch warning

Remove this bogus smatch warning:
drivers/media/pci/ttpci/av7110.c:2211 frontend_init() warn: missing break? reassigning 'av7110->fe'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] drxj: set_param_parameters array is too short
Mauro Carvalho Chehab [Mon, 22 Feb 2016 16:40:14 +0000 (13:40 -0300)]
[media] drxj: set_param_parameters array is too short

Fixes this smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:4151 drxj_dap_scu_atomic_read_write_block() error: buffer overflow 'set_param_parameters' 15 <= 17

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dib9000: read16/write16 could return an error code
Mauro Carvalho Chehab [Mon, 22 Feb 2016 16:43:57 +0000 (13:43 -0300)]
[media] dib9000: read16/write16 could return an error code

Both dib9000_read16_attr and dib9000_write16_attr can return an
error code. However, they currently return an u16. This produces the
following warnings on smatch:

drivers/media/dvb-frontends/dib9000.c:262 dib9000_read16_attr() warn: signedness bug returning '(-121)'
drivers/media/dvb-frontends/dib9000.c:321 dib9000_write16_attr() warn: signedness bug returning '(-22)'
drivers/media/dvb-frontends/dib9000.c:353 dib9000_write16_attr() warn: signedness bug returning '(-121)'

Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] ivtv: steal could be NULL
Mauro Carvalho Chehab [Mon, 22 Feb 2016 16:27:20 +0000 (13:27 -0300)]
[media] ivtv: steal could be NULL

ivtv_flush_queues() calls ivtv_queue_move() with steal == NULL.
However, part of the code assumes that steal could be not null, as
pointed by smatch:
drivers/media/pci/ivtv/ivtv-queue.c:145 ivtv_queue_move() error: we previously assumed 'steal' could be null (see line 138)

This has the potential of causing an OOPS when the queue is
flushed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] stv0900: avoid going past array
Mauro Carvalho Chehab [Mon, 22 Feb 2016 16:12:00 +0000 (13:12 -0300)]
[media] stv0900: avoid going past array

Fix the following smatch warnings:
drivers/media/dvb-frontends/stv0900_core.c:1183 stv0900_get_optim_carr_loop() error: buffer overflow 'cllas2' 11 <= 13
drivers/media/dvb-frontends/stv0900_core.c:1185 stv0900_get_optim_carr_loop() error: buffer overflow 'cllas2' 11 <= 13
drivers/media/dvb-frontends/stv0900_core.c:1187 stv0900_get_optim_carr_loop() error: buffer overflow 'cllas2' 11 <= 13
drivers/media/dvb-frontends/stv0900_core.c:1189 stv0900_get_optim_carr_loop() error: buffer overflow 'cllas2' 11 <= 13
drivers/media/dvb-frontends/stv0900_core.c:1191 stv0900_get_optim_carr_loop() error: buffer overflow 'cllas2' 11 <= 13

Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] pvrusb2: don't go past buf array
Mauro Carvalho Chehab [Mon, 22 Feb 2016 16:22:35 +0000 (13:22 -0300)]
[media] pvrusb2: don't go past buf array

That fixes the following smatch warning:
drivers/media/usb/pvrusb2/pvrusb2-hdw.c:4909 pvr2_hdw_state_log_state() error: buffer overflow 'buf' 256 <= 4294967294

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] pvrusb2-io: no need to check if sp is not NULL
Mauro Carvalho Chehab [Mon, 22 Feb 2016 16:02:36 +0000 (13:02 -0300)]
[media] pvrusb2-io: no need to check if sp is not NULL

The buffer_complete() routine assumes that sp is not NULL,
otherwise it will fail completely. Btw, this is also
assumed at pvr2_buffer_queue(), with is the routine that
setups the URB handling.

So, remove the bogus for the callback at buffer_complete.

This fix this smatch warning:
drivers/media/usb/pvrusb2/pvrusb2-io.c:476 buffer_complete() warn: variable dereferenced before check 'sp' (see line 472)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media_device: move allocation out of media_device_*_init
Mauro Carvalho Chehab [Mon, 22 Feb 2016 15:10:49 +0000 (12:10 -0300)]
[media] media_device: move allocation out of media_device_*_init

Right now, media_device_pci_init and media_device_usb_init does
media_device allocation internaly. That preents its usage when
the media_device struct is embedded on some other structure.

Move memory allocation outside it, to make it more generic.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media-device: move PCI/USB helper functions from v4l2-mc
Mauro Carvalho Chehab [Mon, 22 Feb 2016 14:42:04 +0000 (11:42 -0300)]
[media] media-device: move PCI/USB helper functions from v4l2-mc

Those ancillary functions could be called even when compiled
without V4L2 support, as warned by ktest build robot:

All errors (new ones prefixed by >>):

>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb/dvb-usb.ko] undefined!
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb-v2/dvb_usb_v2.ko] undefined!
>> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/au0828/au0828.ko] undefined!

Also, there's nothing there that are specific to V4L2. So, move
those ancillary functions to MC core.

No functional changes. Just function rename.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: ti-vpe: cal: Fix warning: variable dereference before being checked
Benoit Parrot [Fri, 19 Feb 2016 20:00:30 +0000 (18:00 -0200)]
[media] media: ti-vpe: cal: Fix warning: variable dereference before being checked

As reported ctx->sensor is being dereferenced before being checked
in cal_get_external_info(). That being the case it was also checked
twice in multiple other location where v4l2_subdev_call is already
checking it so no need to explicitly check it again.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: ti-vpe: cal: Fix unreachable code in enum_frame_interval
Benoit Parrot [Fri, 19 Feb 2016 19:24:45 +0000 (17:24 -0200)]
[media] media: ti-vpe: cal: Fix unreachable code in enum_frame_interval

As reported, the current cal_enum_frameintervals() is confusing
and does not have the intended behavior.
Fix this by re-implementing to properly propagate the enum_frame_interval
request to the subdevice.

[mchehab@osg.samsung.com: remove a now bogus "ret = 0" statement]
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] dib0090: do the right thing if rf_ramp is NULL
Mauro Carvalho Chehab [Mon, 22 Feb 2016 14:12:41 +0000 (11:12 -0300)]
[media] dib0090: do the right thing if rf_ramp is NULL

As warned by smatch:
drivers/media/dvb-frontends/dib0090.c:1118 dib0090_pwm_gain_reset() error: we previously assumed 'state->rf_ramp' could be null (see line 1086)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] saa7134: fix detection of external decoders
Mauro Carvalho Chehab [Fri, 19 Feb 2016 17:03:54 +0000 (15:03 -0200)]
[media] saa7134: fix detection of external decoders

As warned by smatch:
drivers/media/pci/saa7134/saa7134-core.c:840 saa7134_create_entities() info: ignoring unreachable code.
drivers/media/pci/saa7134/saa7134-core.c:843 saa7134_create_entities() warn: curly braces intended?

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tvp5150: don't go past decoder->input_ent array
Mauro Carvalho Chehab [Fri, 19 Feb 2016 17:02:30 +0000 (15:02 -0200)]
[media] tvp5150: don't go past decoder->input_ent array

drivers/media/i2c/tvp5150.c:1394 tvp5150_parse_dt() warn: buffer overflow 'decoder->input_ent' 3 <= 3

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-mc: fix hardware version for PCI devices
Mauro Carvalho Chehab [Fri, 19 Feb 2016 14:28:19 +0000 (12:28 -0200)]
[media] v4l2-mc: fix hardware version for PCI devices

It should be a bitwise or, and not a logical one. Also, add
parenthesis, to make sure it will be applied in the right order.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] xc4000: shut up a bogus smatch message
Mauro Carvalho Chehab [Fri, 19 Feb 2016 14:22:30 +0000 (12:22 -0200)]
[media] xc4000: shut up a bogus smatch message

smatch complains about:
drivers/media/tuners/xc4000.c:1511 xc4000_get_signal() warn: '~value << 3' 524280 can't fit into 65535 'value'

Remove the bogus complain.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Use all bits of an enumeration
Sakari Ailus [Wed, 27 Jan 2016 14:47:54 +0000 (12:47 -0200)]
[media] media: Use all bits of an enumeration

The allocation takes place in longs. Assign the size of the enum
accordingly.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] vsp1_drm.h: add missing prototypes
Mauro Carvalho Chehab [Fri, 19 Feb 2016 12:02:53 +0000 (10:02 -0200)]
[media] vsp1_drm.h: add missing prototypes

drivers/media/platform/vsp1/vsp1_drm.c:47:5: warning: no previous prototype for 'vsp1_du_init' [-Wmissing-prototypes]
 int vsp1_du_init(struct device *dev)
     ^
drivers/media/platform/vsp1/vsp1_drm.c:76:5: warning: no previous prototype for 'vsp1_du_setup_lif' [-Wmissing-prototypes]
 int vsp1_du_setup_lif(struct device *dev, unsigned int width,
     ^
drivers/media/platform/vsp1/vsp1_drm.c:221:6: warning: no previous prototype for 'vsp1_du_atomic_begin' [-Wmissing-prototypes]
 void vsp1_du_atomic_begin(struct device *dev)
      ^
drivers/media/platform/vsp1/vsp1_drm.c:273:5: warning: no previous prototype for 'vsp1_du_atomic_update' [-Wmissing-prototypes]
 int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
     ^
drivers/media/platform/vsp1/vsp1_drm.c:451:6: warning: no previous prototype for 'vsp1_du_atomic_flush' [-Wmissing-prototypes]
 void vsp1_du_atomic_flush(struct device *dev)
      ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Configure device based on IP version
Laurent Pinchart [Sat, 5 Dec 2015 22:17:10 +0000 (20:17 -0200)]
[media] v4l: vsp1: Configure device based on IP version

The IP version number carries enough information to identify the exact
device instance features. Drop the related DT properties and use the IP
version instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add display list support
Takashi Saito [Mon, 7 Sep 2015 04:40:25 +0000 (01:40 -0300)]
[media] v4l: vsp1: Add display list support

Display lists contain lists of registers and associated values to be
applied atomically by the hardware. They lower the pressure on interrupt
processing delays when reprogramming the device as settings can be
prepared well in advance and queued to the hardware without waiting for
the end of the current frame.

Display list support is currently limited to the DRM pipeline.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add support for the R-Car Gen3 VSP2
Laurent Pinchart [Mon, 7 Sep 2015 11:05:39 +0000 (08:05 -0300)]
[media] v4l: vsp1: Add support for the R-Car Gen3 VSP2

Add DT compatible strings for the VSP2 instances found in the R-Car Gen3
SoCs and support them in the vsp1 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Implement atomic update for the DRM driver
Laurent Pinchart [Thu, 10 Sep 2015 12:28:39 +0000 (09:28 -0300)]
[media] v4l: vsp1: Implement atomic update for the DRM driver

Add two API functions named vsp1_du_atomic_begin() and
vsp1_du_atomic_flush() to signal the start and end of an atomic update.
The vsp1_du_setup_rpf() function is renamed to vsp1_du_atomic_update()
for consistency.

With this new API, the driver will reprogram all modified inputs
atomically before restarting the video stream.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline
Laurent Pinchart [Thu, 10 Sep 2015 18:56:29 +0000 (15:56 -0300)]
[media] v4l: vsp1: Disconnect unused RPFs from the DRM pipeline

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add VSP+DU support
Laurent Pinchart [Sun, 2 Aug 2015 21:37:01 +0000 (18:37 -0300)]
[media] v4l: vsp1: Add VSP+DU support

Implement internal control of the VSP pipeline to be used by the DU
DRM/KMS driver when using the VSP as an internal composer handled
through DRM/KMS only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Don't validate links when the userspace API is disabled
Laurent Pinchart [Wed, 5 Aug 2015 20:14:41 +0000 (17:14 -0300)]
[media] v4l: vsp1: Don't validate links when the userspace API is disabled

As the pipeline is configured internally by the driver when the
userspace API is disabled its configuration can be trusted and link
validation isn't needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers
Laurent Pinchart [Wed, 5 Aug 2015 19:57:35 +0000 (16:57 -0300)]
[media] v4l: vsp1: Set the alpha value manually in RPF and WPF s_stream handlers

The RPF and WPF alpha values are set through V4L2 controls and applied
when starting the video stream by a call to v4l2_ctrl_handler_setup().
As that function uses the control handler mutex it can't be called in
interrupt context, where the VSP+DU pipeline handler might need to
reconfigure the pipeline.

Set the alpha value manually in the RPF and WPF s_stream handler to
ensure that the hardware is properly configured even when controlled
without the userspace API. If the userspace API is enabled protect that
with the control lock to avoid race conditions with userspace.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make pipeline inputs array index by RPF index
Laurent Pinchart [Wed, 5 Aug 2015 19:40:31 +0000 (16:40 -0300)]
[media] v4l: vsp1: Make pipeline inputs array index by RPF index

The pipeline inputs array stores pointers to all RPFs contained in the
pipeline. It's currently indexed contiguously by adding RPFs in the
order they are found during graph walk. This can't easily support
dynamic addition and removal of RPFs while streaming, which will be
required for combined VSP+DU support.

Make the array indexed by RPF index instead and skip NULL elements when
iterating over RPFs.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make the userspace API optional
Laurent Pinchart [Tue, 28 Jul 2015 19:16:05 +0000 (16:16 -0300)]
[media] v4l: vsp1: Make the userspace API optional

The R-Car Gen3 SoCs include VSP instances dedicated to the DU that will
be controlled entirely by the rcar-du-drm driver through the KMS API. To
support that use case make the userspace V4L2 API optional.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move format info to vsp1_pipe.c
Laurent Pinchart [Mon, 3 Aug 2015 13:21:49 +0000 (10:21 -0300)]
[media] v4l: vsp1: Move format info to vsp1_pipe.c

Format information and the related helper function are not specific to
the V4L2 API, move them from vsp1_video.c to vsp1_pipe.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make the BRU optional
Laurent Pinchart [Fri, 14 Aug 2015 16:53:45 +0000 (13:53 -0300)]
[media] v4l: vsp1: Make the BRU optional

Not all VSP instances have a BRU on R-Car Gen3, make it optional. Set
the feature unconditionally for now, this will be fixed when adding Gen3
support.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make number of BRU inputs configurable
Laurent Pinchart [Mon, 3 Aug 2015 12:46:26 +0000 (09:46 -0300)]
[media] v4l: vsp1: Make number of BRU inputs configurable

The R-Car Gen3 family has 5-inputs BRUs, support them by making the
number of BRU inputs configurable.

As the driver assumes that the number of BRU inputs is equal to the
number of RPFs, replace the BRU_MAX_INPUTS macro with VSP1_MAX_RPF to
make the assumption apparent.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move entity route setup function to vsp1_entity.c
Laurent Pinchart [Sun, 2 Aug 2015 21:58:31 +0000 (18:58 -0300)]
[media] v4l: vsp1: Move entity route setup function to vsp1_entity.c

The function will be used by the DU code, move it out of vsp1_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Remove unused module read functions
Laurent Pinchart [Wed, 9 Sep 2015 14:32:06 +0000 (11:32 -0300)]
[media] v4l: vsp1: Remove unused module read functions

Several module read functions are not used, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream
Laurent Pinchart [Wed, 9 Sep 2015 14:38:56 +0000 (11:38 -0300)]
[media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream

Commit 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity
controllable during streaming") refactored the stream start code and
removed the SRU CTRL0 register write by mistake. Add it back.

Fixes: 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity controllable during streaming")

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register bit name
Laurent Pinchart [Thu, 10 Sep 2015 07:55:46 +0000 (04:55 -0300)]
[media] v4l: vsp1: Fix typo in VI6_DISP_IRQ_STA_DST register bit name

Rename the VI6_DISP_IRQ_STA_DSE register bit to VI6_DISP_IRQ_STA_DST to
fix a typo and match the datasheet.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Document the vsp1_pipeline structure
Laurent Pinchart [Sun, 2 Aug 2015 21:24:55 +0000 (18:24 -0300)]
[media] v4l: vsp1: Document the vsp1_pipeline structure

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Extract link creation to separate function
Laurent Pinchart [Sun, 2 Aug 2015 21:21:12 +0000 (18:21 -0300)]
[media] v4l: vsp1: Extract link creation to separate function

Link creation will be handled differently for the DU pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Reuse local variable instead of recomputing it
Laurent Pinchart [Sun, 2 Aug 2015 20:43:36 +0000 (17:43 -0300)]
[media] v4l: vsp1: Reuse local variable instead of recomputing it

No need to waste CPU cycles when the value we need is already available.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Extract pipeline initialization code into a function
Laurent Pinchart [Sun, 2 Aug 2015 20:32:13 +0000 (17:32 -0300)]
[media] v4l: vsp1: Extract pipeline initialization code into a function

The code will be reused outside of vsp1_video.c.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix
Laurent Pinchart [Sun, 2 Aug 2015 20:29:03 +0000 (17:29 -0300)]
[media] v4l: vsp1: Rename video pipeline functions to use vsp1_video prefix

Those functions are specific to video nodes, rename them for
consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Split pipeline management code from vsp1_video.c
Laurent Pinchart [Sun, 2 Aug 2015 17:15:23 +0000 (14:15 -0300)]
[media] v4l: vsp1: Split pipeline management code from vsp1_video.c

The code will be used to control the vsp1 driver from the DU driver
without using video nodes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video
Laurent Pinchart [Sun, 2 Aug 2015 19:37:11 +0000 (16:37 -0300)]
[media] v4l: vsp1: Decouple pipeline end of frame processing from vsp1_video

To make the pipeline structure and operations usable without video
devices the frame end processing must be decoupled from struct
vsp1_video. Implement this by calling the video frame end function
indirectly through a function pointer in struct vsp1_pipeline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Remove struct vsp1_pipeline num_video field
Laurent Pinchart [Sun, 2 Aug 2015 20:17:15 +0000 (17:17 -0300)]
[media] v4l: vsp1: Remove struct vsp1_pipeline num_video field

The field is always equal to the num_inputs field plus one, remove the
duplicate.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf
Laurent Pinchart [Sun, 2 Aug 2015 17:58:43 +0000 (14:58 -0300)]
[media] v4l: vsp1: Move vsp1_video pointer from vsp1_entity to vsp1_rwpf

Only RPFs and WPFs can be associated with video nodes, don't waste
memory by storing the video pointer in all entities.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Support VSP1 instances without any UDS
Laurent Pinchart [Tue, 28 Jul 2015 19:13:27 +0000 (16:13 -0300)]
[media] v4l: vsp1: Support VSP1 instances without any UDS

Not all VSP1 instances include a UDS. Make the renesas,#uds DT property
optional and accept a number of UDS equal to 0 as valid.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Make rwpf operations independent of video device
Laurent Pinchart [Tue, 28 Jul 2015 19:04:47 +0000 (16:04 -0300)]
[media] v4l: vsp1: Make rwpf operations independent of video device

The rwpf queue operation doesn't queue a buffer but sets the memory
address for the next run. Rename it to set_memory and pass it a new
structure independent of the video buffer than only contains memory
information.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move video device out of struct vsp1_rwpf
Laurent Pinchart [Tue, 28 Jul 2015 18:46:00 +0000 (15:46 -0300)]
[media] v4l: vsp1: Move video device out of struct vsp1_rwpf

To make the video device nodes optional we need to decouple the [rw]pf
instances from the video devices. Move video devices out of struct
vsp1_rwpf and instantiate them dynamically in the core driver code.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer
Laurent Pinchart [Tue, 28 Jul 2015 17:17:07 +0000 (14:17 -0300)]
[media] v4l: vsp1: Rename vsp1_video_buffer to vsp1_vb2_buffer

The structure represent a vsp1 videobuf2 buffer, name it accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Move video operations to vsp1_rwpf
Laurent Pinchart [Tue, 28 Jul 2015 17:05:56 +0000 (14:05 -0300)]
[media] v4l: vsp1: Move video operations to vsp1_rwpf

This removes the dependency of vsp1_rpf and vsp1_wpf on vsp1_video,
making it possible to reuse the operations without a V4L2 video device
node.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Store the memory format in struct vsp1_rwpf
Laurent Pinchart [Tue, 28 Jul 2015 17:00:43 +0000 (14:00 -0300)]
[media] v4l: vsp1: Store the memory format in struct vsp1_rwpf

Move the format from struct vsp1_video to struct vsp1_rwpf to prepare
for VSPD KMS support that will not instantiate V4L2 video device nodes.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Change the type of the rwpf field in struct vsp1_video
Laurent Pinchart [Tue, 28 Jul 2015 16:54:03 +0000 (13:54 -0300)]
[media] v4l: vsp1: Change the type of the rwpf field in struct vsp1_video

The rwpf field contains a pointer to the rpf or wpf associated with the
video node. Instead of storing it as a vsp1_entity, store the
corresponding vsp1_rwpf pointer to allow accessing the vsp1_rwpf fields
directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Group all link creation code in a single file
Laurent Pinchart [Sun, 31 Jan 2016 13:34:28 +0000 (11:34 -0200)]
[media] v4l: vsp1: Group all link creation code in a single file

There's no need to spread the code across multiple source files.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: vsp1: Add tri-planar memory formats support
Laurent Pinchart [Thu, 12 Nov 2015 00:04:24 +0000 (22:04 -0200)]
[media] v4l: vsp1: Add tri-planar memory formats support

Tri-planar memory formats store the Y, U and V components in separate
planes. The VSP hardware supports them, the driver now does too.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: Add YUV 4:2:2 and YUV 4:4:4 tri-planar non-contiguous formats
Laurent Pinchart [Thu, 12 Nov 2015 00:02:00 +0000 (22:02 -0200)]
[media] v4l: Add YUV 4:2:2 and YUV 4:4:4 tri-planar non-contiguous formats

The formats use three planes through the multiplanar API, allowing for
non-contiguous planes in memory.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: ti-vpe: cal: Fix syntax check warnings
Benoit Parrot [Mon, 15 Feb 2016 20:01:42 +0000 (18:01 -0200)]
[media] media: ti-vpe: cal: Fix syntax check warnings

Fix the following sparse warnings:

ti-vpe/cal.c:387:26: warning: incorrect type in return expression (different address spaces)
ti-vpe/cal.c:459:26: warning: incorrect type in return expression (different address spaces)
ti-vpe/cal.c:503:27: warning: incorrect type in argument 6 (different address spaces)
ti-vpe/cal.c:509:47: warning: incorrect type in argument 6 (different address spaces)
ti-vpe/cal.c:518:47: warning: incorrect type in argument 6 (different address spaces)
ti-vpe/cal.c:526:31: warning: incorrect type in argument 6 (different address spaces)
ti-vpe/cal.c:1807:24: warning: Using plain integer as NULL pointer
ti-vpe/cal.c:1844:16: warning: Using plain integer as NULL pointer

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] s5p-mfc: add the support of V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
Wu-Cheng Li [Tue, 19 Jan 2016 07:07:10 +0000 (05:07 -0200)]
[media] s5p-mfc: add the support of V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME

There is a new control V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME to
force an encoder key frame. It is the same as requesting
V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME.

Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l: add V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
Wu-Cheng Li [Tue, 19 Jan 2016 07:07:09 +0000 (05:07 -0200)]
[media] v4l: add V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME

Some drivers also need a control like
V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE to force an encoder
key frame. Add a general V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME
so the new drivers and applications can use it.

Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] saa7134: Fix bytesperline not being set correctly for planar formats
Hans de Goede [Sun, 14 Feb 2016 19:51:37 +0000 (17:51 -0200)]
[media] saa7134: Fix bytesperline not being set correctly for planar formats

bytesperline should be the bytesperline for the first plane for planar
formats, not that of all planes combined.

This fixes a crash in xawtv caused by the wrong bpl.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1305389
Reported-and-tested-by: Stas Sergeev <stsp@list.ru>
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: ti-vpe: add dependency of HAS_DMA
Sudip Mukherjee [Fri, 12 Feb 2016 10:53:28 +0000 (08:53 -0200)]
[media] media: ti-vpe: add dependency of HAS_DMA

The build of m32r allmodconfig fails with the error:
 drivers/media/v4l2-core/videobuf2-dma-contig.c:492:28: error: implicit
declaration of function 'dma_get_cache_alignment'

The build of videobuf2-dma-contig.c depends on HAS_DMA and it is
correctly mentioned in the Kconfig but the symbol VIDEO_TI_CAL also
selects VIDEOBUF2_DMA_CONTIG, so it is trying to compile
videobuf2-dma-contig.c even though HAS_DMA is not defined.

Fixes: 343e89a792a5 ("[media] media: ti-vpe: Add CAL v4l2 camera capture driver")

Cc: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] timblogiw: move to staging in preparation for removal
Hans Verkuil [Wed, 10 Feb 2016 07:40:56 +0000 (05:40 -0200)]
[media] timblogiw: move to staging in preparation for removal

The Timberdale FPGA video driver has not seen any real development
since 2011 (and very little before that).

One of the problems with the timblogiw driver is that it uses videobuf
instead of the newer vb2 framework. The long term goal is to either
convert or remove any driver still using videobuf. Since none of the
core v4l developers has the hardware, we cannot convert it ourselves.

As far as I can tell it was only used in an Intel demo board in 2009
using Meego:

http://www.chinait.com/intelcontent/intelprc/admin/PDFFile/20106411545.pdf

which has since been superseded.

Moving this driver to staging is the first step towards removal. After 2 or
3 kernel cycles it will be removed altogether unless someone steps up to
clean up this driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Richard Röjfors <richard@puffinpack.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect
Hans Verkuil [Wed, 10 Feb 2016 11:32:25 +0000 (09:32 -0200)]
[media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect

The V4L2_CID_TX_EDID_PRESENT control reports if an EDID is present.
The adv7511 however still reported the EDID present after disconnecting
the HDMI cable. Fix the logic regarding this control. And when the EDID
is disconnected also call ADV7511_EDID_DETECT to notify the bridge driver.
This was also missing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org> # for v3.12 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] usb/cpia2_core: clean up a min_t() cast
Dan Carpenter [Tue, 9 Feb 2016 11:14:12 +0000 (09:14 -0200)]
[media] usb/cpia2_core: clean up a min_t() cast

It makes sense to make the min_t() cast unsigned here since we don't
really want negative sizes.  Making it signed causes a static checker
warning in Smatch.  Smatch knows "fw->size - i" is positive but it
doesn't know that fw->size is less than INT_MAX so in theory casting it
to int might lead to a negative.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] pvrusb2: correctly handling failed thread run
Insu Yun [Thu, 4 Feb 2016 23:09:23 +0000 (21:09 -0200)]
[media] pvrusb2: correctly handling failed thread run

Since kthread_run returns -ENOMEM if failed,
it needs to be checked whether it is error, not whether it is null.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-async: Don't fail if registered_async isn't implemented
Javier Martinez Canillas [Tue, 16 Feb 2016 20:03:21 +0000 (18:03 -0200)]
[media] v4l2-async: Don't fail if registered_async isn't implemented

After sub-dev registration in v4l2_async_test_notify(), the v4l2-async
core calls the registered_async callback but if a sub-dev driver does
not implement it, v4l2_subdev_call() will return a -ENOIOCTLCMD which
should not be considered an error.

Reported-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Benoit Parrot <bparrot@ti.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] siano: use generic function to create MC device
Mauro Carvalho Chehab [Tue, 16 Feb 2016 10:07:43 +0000 (08:07 -0200)]
[media] siano: use generic function to create MC device

Currently, it is initializing the driver name using the wrong
name ("usb"). Use the generic function, as its logic works
best, and avoids repeating the very same code everywhere.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] smsusb: don't sleep while atomic
Mauro Carvalho Chehab [Tue, 16 Feb 2016 09:22:27 +0000 (07:22 -0200)]
[media] smsusb: don't sleep while atomic

smscore_getbuffer() calls internally wait_event(), with can sleep.
As smsusb_onresponse() is called on interrupt context, this causes
the following warning:

BUG: sleeping function called from invalid context at drivers/media/common/siano/smscoreapi.c:1653
in_atomic(): 1, irqs_disabled(): 1, pid: 11084, name: systemd-udevd
INFO: lockdep is turned off.
irq event stamp: 0
hardirqs last  enabled at (0): [<          (null)>]           (null)
hardirqs last disabled at (0): [<ffffffff811480f7>] copy_process.part.7+0x10e7/0x56d0
softirqs last  enabled at (0): [<ffffffff81148193>] copy_process.part.7+0x1183/0x56d0
softirqs last disabled at (0): [<          (null)>]           (null)
CPU: 2 PID: 11084 Comm: systemd-udevd Tainted: G    B   W       4.5.0-rc3+ #47
Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
 0000000000000000 ffff8803c6907a80 ffffffff81933901 ffff8802bd916000
 ffff8802bd9165c8 ffff8803c6907aa8 ffffffff811c6af5 ffff8802bd916000
 ffffffffa0ce9b60 0000000000000675 ffff8803c6907ae8 ffffffff811c6ce5
Call Trace:
 <IRQ>  [<ffffffff81933901>] dump_stack+0x85/0xc4
 [<ffffffff811c6af5>] ___might_sleep+0x245/0x3a0
 [<ffffffff811c6ce5>] __might_sleep+0x95/0x1a0
 [<ffffffffa0ce020a>] ? list_add_locked+0xca/0x140 [smsmdtv]
 [<ffffffffa0ce3b8d>] smscore_getbuffer+0x7d/0x120 [smsmdtv]
 [<ffffffff8123819d>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffffa0ce3b10>] ? smscore_sendrequest_and_wait.isra.5+0x120/0x120 [smsmdtv]
 [<ffffffffa0ce020a>] ? list_add_locked+0xca/0x140 [smsmdtv]
 [<ffffffffa0ce13ca>] ? smscore_putbuffer+0x3a/0x40 [smsmdtv]
 [<ffffffffa0d107bc>] smsusb_submit_urb+0x2ec/0x4f0 [smsusb]
 [<ffffffffa0d10e36>] smsusb_onresponse+0x476/0x720 [smsusb]

Let's add a work queue to handle the bottom half, preventing this
problem.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] siano: firmware buffer is too small
Mauro Carvalho Chehab [Mon, 15 Feb 2016 15:56:26 +0000 (13:56 -0200)]
[media] siano: firmware buffer is too small

As pointed by KASAN:

BUG: KASAN: slab-out-of-bounds in memcpy+0x1d/0x40 at addr ffff880000038d8c
Read of size 128 by task systemd-udevd/2536
page:ffffea0000000800 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0xffff8000004000(head)
page dumped because: kasan: bad access detected
CPU: 1 PID: 2536 Comm: systemd-udevd Not tainted 4.5.0-rc3+ #47
Hardware name:                  /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015
  ffff880000038d8c ffff8803b0f1f1e8 ffffffff81933901 0000000000000080
  ffff8803b0f1f280 ffff8803b0f1f270 ffffffff815602c5 ffffffff8284cf93
  ffffffff822ddc00 0000000000000282 0000000000000001 ffff88009c7c6000
Call Trace:
  [<ffffffff81933901>] dump_stack+0x85/0xc4
  [<ffffffff815602c5>] kasan_report_error+0x525/0x550
  [<ffffffff815606e9>] kasan_report+0x39/0x40
  [<ffffffff8155f84d>] memcpy+0x1d/0x40
  [<ffffffffa120cb90>] smscore_set_device_mode+0xee0/0x2560 [smsmdtv]

Such error happens at the memcpy code below:

0x4bc0 is in smscore_set_device_mode (drivers/media/common/siano/smscoreapi.c:975).
970       sizeof(u32) + payload_size));
971
972 data_msg->mem_addr = mem_address;
973 memcpy(data_msg->payload, payload, payload_size);
974
975 rc = smscore_sendrequest_and_wait(coredev, data_msg,
976 data_msg->x_msg_header.msg_length,
977 &coredev->data_download_done);
978
979 payload += payload_size;

The problem is that the Siano driver uses a header to store the firmware,
with requires a few more bytes than allocated.

Tested with:
PCTV 77e (2013:0257)
Hauppauge WinTV MiniStick (2040:5510)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years agoMerge branch 'fixes' into patchwork
Mauro Carvalho Chehab [Tue, 16 Feb 2016 11:20:45 +0000 (09:20 -0200)]
Merge branch 'fixes' into patchwork

Some macros were changed/removed at the material for v4.5. We need
to sync with those changes here, in order to avoid troubles.

* v4l_for_linus:
  [media] media.h: get rid of MEDIA_ENT_F_CONN_TEST
  [media] [for,v4.5] media.h: increase the spacing between function ranges
  [media] media: i2c/adp1653: probe: fix erroneous return value
  [media] media: davinci_vpfe: fix missing unlock on error in vpfe_prepare_pipeline()

8 years ago[media] media.h: get rid of MEDIA_ENT_F_CONN_TEST
Mauro Carvalho Chehab [Fri, 12 Feb 2016 17:44:31 +0000 (15:44 -0200)]
[media] media.h: get rid of MEDIA_ENT_F_CONN_TEST

Defining it as a connector was a bad idea. Remove it while it is
not too late.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media.h: get rid of MEDIA_ENT_F_CONN_TEST
Mauro Carvalho Chehab [Fri, 12 Feb 2016 17:44:31 +0000 (15:44 -0200)]
[media] media.h: get rid of MEDIA_ENT_F_CONN_TEST

Defining it as a connector was a bad idea. Remove it while it is
not too late.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] [for,v4.5] media.h: increase the spacing between function ranges
Hans Verkuil [Thu, 11 Feb 2016 14:28:55 +0000 (12:28 -0200)]
[media] [for,v4.5] media.h: increase the spacing between function ranges

Each function range is quite narrow and especially for connectors this
will pose a problem. Increase the function ranges while we still can and
move the connector range to the end so that range is practically limitless.

[mchehab@osg.samsung.com: Rebased to apply at Linus tree]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tvp5150: replace MEDIA_ENT_F_CONN_TEST by a control
Mauro Carvalho Chehab [Fri, 12 Feb 2016 17:42:02 +0000 (15:42 -0200)]
[media] tvp5150: replace MEDIA_ENT_F_CONN_TEST by a control

MEDIA_ENT_F_CONN_TEST is not really a connector, it is actually
a signal generator. Also, as other drivers use the
V4L2_CID_TEST_PATTERN control for signal generators, let's change
the driver accordingly.

Tested with Terratec Grabster AV350.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx: get rid of CX231XX_VMUX_DEBUG
Mauro Carvalho Chehab [Fri, 12 Feb 2016 11:17:14 +0000 (09:17 -0200)]
[media] cx231xx: get rid of CX231XX_VMUX_DEBUG

This macro is not used inside the driver. get rid of it.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] au0828: get rid of AU0828_VMUX_DEBUG
Mauro Carvalho Chehab [Fri, 12 Feb 2016 11:15:41 +0000 (09:15 -0200)]
[media] au0828: get rid of AU0828_VMUX_DEBUG

This is not used on the driver. remove it.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-mc: remove the unused sensor var
Mauro Carvalho Chehab [Fri, 12 Feb 2016 10:07:59 +0000 (08:07 -0200)]
[media] v4l2-mc: remove the unused sensor var

This fixes this warning:

v4l2-mc.c: In function 'v4l2_mc_create_media_graph':
v4l2-mc.c:60:69: warning: variable 'sensor' set but not used [-Wunused-but-set-variable]

We could solve it the other way: don't do the second loop for
webcams. However, that would fail if a chip would have two sensors
plugged. This is not the current case, but it doesn't hurt to be
future-safe here, specially since this code runs only once during
device probe. So, performance is not an issue here.

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx: create connectors at the media graph
Mauro Carvalho Chehab [Fri, 12 Feb 2016 00:39:52 +0000 (22:39 -0200)]
[media] cx231xx: create connectors at the media graph

We need to add connectors to the cx231xx graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx, em28xx: pass media_device to si2157
Mauro Carvalho Chehab [Fri, 12 Feb 2016 00:18:36 +0000 (22:18 -0200)]
[media] cx231xx, em28xx: pass media_device to si2157

As si2157 doesn't use the subdev, but has instead a binding
logic that doesn't have any core framework, we need to manually
pass the media_device struct via platform data on every place
it is called.

This fixes support for HVR-955Q when MC is enabled.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] si2157: register as a tuner entity
Mauro Carvalho Chehab [Thu, 11 Feb 2016 20:06:36 +0000 (18:06 -0200)]
[media] si2157: register as a tuner entity

As this tuner doesn't use the usual subdev interface, we need
to register it manually.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] cx231xx: use v4l2 core function to create the MC graph
Mauro Carvalho Chehab [Thu, 11 Feb 2016 19:31:48 +0000 (17:31 -0200)]
[media] cx231xx: use v4l2 core function to create the MC graph

Instead of having its own routine, use the one defined at the
core, as it is generic enough to handle the cx231xx usecases.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] em28xx-dvb: create RF connector on DVB-only mode
Mauro Carvalho Chehab [Thu, 11 Feb 2016 19:17:30 +0000 (17:17 -0200)]
[media] em28xx-dvb: create RF connector on DVB-only mode

When in analog mode, the RF connector will be created by
em28xx-video. However, when the device is in digital mode only,
the RF connector is not shown. In this case, let the DVB
core to create it for us.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] use v4l2_mc_usb_media_device_init() on most USB devices
Mauro Carvalho Chehab [Thu, 11 Feb 2016 17:35:07 +0000 (15:35 -0200)]
[media] use v4l2_mc_usb_media_device_init() on most USB devices

Except for the usbuvc driver (with has an embedded media_device
struct on it), the other drivers have a pointer to media_device.

On those drivers, replace their own implementation for the core
one. That warrants that those subdev drivers will fill the
media_device info the same way.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] allow overriding the driver name
Mauro Carvalho Chehab [Thu, 11 Feb 2016 16:24:23 +0000 (14:24 -0200)]
[media] allow overriding the driver name

On USB drivers, the dev struct is usually filled with the USB
device. That would mean that the name of the driver specified
by media_device.dev.driver.name would be "usb", instead of the
name of the actual driver that created the media entity.

Add an optional field at the internal struct to allow drivers
to override the driver name.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] rc-core: don't lock device at rc_register_device()
Mauro Carvalho Chehab [Thu, 11 Feb 2016 12:33:31 +0000 (10:33 -0200)]
[media] rc-core: don't lock device at rc_register_device()

The mutex lock at rc_register_device() was added by commit 08aeb7c9a42a
("[media] rc: add locking to fix register/show race").

It is meant to avoid race issues when trying to open a sysfs file while
the RC register didn't complete.

Adding a lock there causes troubles, as detected by the Kernel lock
debug instrumentation at the Kernel:

    ======================================================
    [ INFO: possible circular locking dependency detected ]
    4.5.0-rc3+ #46 Not tainted
    -------------------------------------------------------
    systemd-udevd/2681 is trying to acquire lock:
     (s_active#171){++++.+}, at: [<ffffffff8171a115>] kernfs_remove_by_name_ns+0x45/0xa0

    but task is already holding lock:
     (&dev->lock){+.+.+.}, at: [<ffffffffa0724def>] rc_register_device+0xb2f/0x1450 [rc_core]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&dev->lock){+.+.+.}:
           [<ffffffff8124817d>] lock_acquire+0x13d/0x320
           [<ffffffff822de966>] mutex_lock_nested+0xb6/0x860
           [<ffffffffa0721f2b>] show_protocols+0x3b/0x3f0 [rc_core]
           [<ffffffff81cdaba5>] dev_attr_show+0x45/0xc0
           [<ffffffff8171f1b3>] sysfs_kf_seq_show+0x203/0x3c0
           [<ffffffff8171a6a1>] kernfs_seq_show+0x121/0x1b0
           [<ffffffff81617c71>] seq_read+0x2f1/0x1160
           [<ffffffff8171c911>] kernfs_fop_read+0x321/0x460
           [<ffffffff815abc20>] __vfs_read+0xe0/0x3d0
           [<ffffffff815ae90e>] vfs_read+0xde/0x2d0
           [<ffffffff815b1d01>] SyS_read+0x111/0x230
           [<ffffffff822e8636>] entry_SYSCALL_64_fastpath+0x16/0x76

    -> #0 (s_active#171){++++.+}:
           [<ffffffff81244f24>] __lock_acquire+0x4304/0x5990
           [<ffffffff8124817d>] lock_acquire+0x13d/0x320
           [<ffffffff81717d3a>] __kernfs_remove+0x58a/0x810
           [<ffffffff8171a115>] kernfs_remove_by_name_ns+0x45/0xa0
           [<ffffffff81721592>] remove_files.isra.0+0x72/0x190
           [<ffffffff8172174b>] sysfs_remove_group+0x9b/0x150
           [<ffffffff81721854>] sysfs_remove_groups+0x54/0xa0
           [<ffffffff81cd97d0>] device_remove_attrs+0xb0/0x140
           [<ffffffff81cdb27c>] device_del+0x38c/0x6b0
           [<ffffffffa0724b8b>] rc_register_device+0x8cb/0x1450 [rc_core]
           [<ffffffffa1326a7b>] dvb_usb_remote_init+0x66b/0x14d0 [dvb_usb]
           [<ffffffffa1321c81>] dvb_usb_device_init+0xf21/0x1860 [dvb_usb]
           [<ffffffffa13517dc>] dib0700_probe+0x14c/0x410 [dvb_usb_dib0700]
           [<ffffffff81dbb1dd>] usb_probe_interface+0x45d/0x940
           [<ffffffff81ce7e7a>] driver_probe_device+0x21a/0xc30
           [<ffffffff81ce89b1>] __driver_attach+0x121/0x160
           [<ffffffff81ce21bf>] bus_for_each_dev+0x11f/0x1a0
           [<ffffffff81ce6cdd>] driver_attach+0x3d/0x50
           [<ffffffff81ce5df9>] bus_add_driver+0x4c9/0x770
           [<ffffffff81cea39c>] driver_register+0x18c/0x3b0
           [<ffffffff81db6e98>] usb_register_driver+0x1f8/0x440
           [<ffffffffa074001e>] dib0700_driver_init+0x1e/0x1000 [dvb_usb_dib0700]
           [<ffffffff810021b1>] do_one_initcall+0x141/0x300
           [<ffffffff8144d8eb>] do_init_module+0x1d0/0x5ad
           [<ffffffff812f27b6>] load_module+0x6666/0x9ba0
           [<ffffffff812f5fe8>] SyS_finit_module+0x108/0x130
           [<ffffffff822e8636>] entry_SYSCALL_64_fastpath+0x16/0x76

    other info that might help us debug this:

     Possible unsafe locking scenario:

           CPU0                    CPU1
           ----                    ----
      lock(&dev->lock);
                                   lock(s_active#171);
                                   lock(&dev->lock);
      lock(s_active#171);

     *** DEADLOCK ***

    3 locks held by systemd-udevd/2681:
     #0:  (&dev->mutex){......}, at: [<ffffffff81ce8933>] __driver_attach+0xa3/0x160
     #1:  (&dev->mutex){......}, at: [<ffffffff81ce8941>] __driver_attach+0xb1/0x160
     #2:  (&dev->lock){+.+.+.}, at: [<ffffffffa0724def>] rc_register_device+0xb2f/0x1450 [rc_core]

In this specific case, some error happened during device init,
causing IR to be disabled.

Let's fix it by adding a var that will tell when the device is
initialized. Any calls before that will return a -EINVAL.

That should prevent the race issues.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-mc: add a routine to create USB media_device
Mauro Carvalho Chehab [Thu, 11 Feb 2016 17:21:46 +0000 (15:21 -0200)]
[media] v4l2-mc: add a routine to create USB media_device

Instead of copying exactly the same code on all USB devices,
add an ancillary routine that will create and fill the
struct media_device with the values imported from the USB
device.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] v4l2-mc.h: prevent it for being included twice
Mauro Carvalho Chehab [Fri, 12 Feb 2016 09:35:44 +0000 (07:35 -0200)]
[media] v4l2-mc.h: prevent it for being included twice

Don't let it be included twice, to avoid compiler issues.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] tvp5150: add HW input connectors support
Javier Martinez Canillas [Fri, 5 Feb 2016 19:09:58 +0000 (17:09 -0200)]
[media] tvp5150: add HW input connectors support

The tvp5150 decoder has different input connectors. The actual list of
HW inputs depends on the device version but all have at least these 3:

1) Composite0
2) Composite1
3) S-Video

and some variants have a 4th possible input connector:

4) Signal generator

The driver currently uses the .s_routing callback to switch the input
connector but since these are separate HW blocks, it's better to use
media entities to represent the input connectors and their source pads
linked with the decoder's sink pad.

This allows user-space to use the MEDIA_IOC_SETUP_LINK ioctl to choose
the input connector. For example using the media-ctl user-space tool:

$ media-ctl -r -l '"Composite0":0->"tvp5150 1-005c":0[1]'

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>