GitHub/LineageOS/android_kernel_motorola_exynos9610.git
8 years ago[media] media: au0828 create tuner to decoder link in disabled state
Shuah Khan [Thu, 11 Feb 2016 23:41:32 +0000 (21:41 -0200)]
[media] media: au0828 create tuner to decoder link in disabled state

Create tuner to demod pad link in disabled state to avoid disable step
when tuner resource is requested by dvb.

[mchehab@osg.samsung.com: fix a merge conflict]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: au0828 handle media_init and media_register window
Shuah Khan [Thu, 11 Feb 2016 23:41:31 +0000 (21:41 -0200)]
[media] media: au0828 handle media_init and media_register window

Media device initialization and registration steps are split. There is a
window between media device init and media device register during usb
probe.

au0828 bridge driver and snd-usb-audio could try to initialize the media
device, if they simply checked, whether the device has been registered.
They also need to check whether the device has been initialized.

Change the au0828-core to check if media device is already initialized
during initialization step and check if media device is already
registered during the registration step.

[mchehab@osg.samsung.com: fix a merge conflict]
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: au0828 change to use Managed Media Controller API
Shuah Khan [Thu, 11 Feb 2016 23:41:30 +0000 (21:41 -0200)]
[media] media: au0828 change to use Managed Media Controller API

Change au0828 to use Managed Media Controller API to share media device
and coordinate creating/deleting the shared media device with the
snd-usb-audio driver. The shared media device is created as device
resource of the parent usb device of the two drivers.

Populate media device model with USB Device product name instead of
au0828 device board name. This change is necessary because, if the media
device is registered by the snd-usb-audio driver first, and it doesn't
know the au0828 board name.

[mchehab@osg.samsung.com: Fix merge conflicts]

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
8 years ago[media] media: Change v4l-core to check if source is free
Shuah Khan [Thu, 11 Feb 2016 23:41:29 +0000 (21:41 -0200)]
[media] media: Change v4l-core to check if source is free

Change s_input, s_fmt, s_tuner, s_frequency, querystd, s_hw_freq_seek,
and vb2_core_streamon interfaces that alter the tuner configuration to
check if it is free, by calling v4l_enable_media_source().

If source isn't free, return -EBUSY.

v4l_disable_media_source() is called from v4l2_fh_exit() to release
tuner (source).

vb2_core_streamon() uses v4l_vb2q_enable_media_source().

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
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>