aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/au0828 (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-07-08[media] vb2: replace void *alloc_ctxs by struct device *alloc_devsHans Verkuil2-2/+2
Make this a proper typed array. Drop the old allocate context code since that is no longer used. Note that the memops functions now get a struct device pointer instead of the struct device ** that was there initially (actually a void pointer to a struct containing only a struct device pointer). This code is now a lot cleaner. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-15[media] media-device: dynamically allocate struct media_devnodeMauro Carvalho Chehab1-2/+2
struct media_devnode is currently embedded at struct media_device. While this works fine during normal usage, it leads to a race condition during devnode unregister. the problem is that drivers assume that, after calling media_device_unregister(), the struct that contains media_device can be freed. This is not true, as it can't be freed until userspace closes all opened /dev/media devnodes. In other words, if the media devnode is still open, and media_device gets freed, any call to an ioctl will make the core to try to access struct media_device, with will cause an use-after-free and even GPF. Fix this by dynamically allocating the struct media_devnode and only freeing it when it is safe. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-05-09[media] media: au0828 fix au0828_v4l2_device_register() to not unlock and freeShuah Khan1-4/+0
au0828_v4l2_device_register() unlocks au0828_dev->lock and frees au0828 dev in error legs before return. au0828_usb_probe() does the same when au0828_v4l2_device_register() returns error. Fix au0828_v4l2_device_register() to not to unlock and free in its error legs. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-13[media] au0828: remove unused macroGuennadi Liakhovetski1-1/+0
An V4L2_CID_PRIVATE_SHARPNESS macro is defined in the au0828 driver, but never used. Remove it. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-04-06[media] au0828: Unregister notifiersMauro Carvalho Chehab1-12/+26
If au0828 gets removed, we need to remove the notifiers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-31[media] Revert "[media] media: au0828 change to use Managed Media Controller API"Mauro Carvalho Chehab1-1/+2
Extending the lifetime of the media_device struct is not handled well by the core, as it will erase some data from the struct, when media_device_cleanup() is called after unregistering it. While we have a fixup patch for it already, the usage of those new functions are needed only when we share data with other drivers. So, better to revert the changes. This reverts commit 182dde7c5d4c ("[media] media: au0828 change to use Managed Media Controller API") Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-31[media] au0828: Fix dev_state handlingMauro Carvalho Chehab4-39/+39
The au0828 dev_state is actually a bit mask. It should not be checking with "==" but, instead, with a logic and. There are some places where it was doing it wrong. Fix that by replacing the dev_state set/clear/test with the bitops. As reviewed by Shuah: "Looks good. Tested running bind/unbind au0828 loop for 1000 times. Didn't see any problems and the v4l2_querycap() problem has been fixed with this patch. After the above test, ran bind/unbind snd_usb_audio 1000 times. Didn't see any problems. Generated media graph and the graph looks good." Cc: stable@vger.kernel.org Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Tested-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-31[media] au0828: fix au0828_v4l2_close() dev_state race conditionShuah Khan1-1/+1
au0828_v4l2_close() check for dev_state == DEV_DISCONNECTED will fail to detect the device disconnected state correctly, if au0828_v4l2_open() runs to set the DEV_INITIALIZED bit. A loop test of bind/unbind found this bug by increasing the likelihood of au0828_v4l2_open() occurring while unbind is in progress. When au0828_v4l2_close() fails to detect that the device is in disconnect state, it attempts to power down the device and fails with the following general protection fault: [ 260.992962] Call Trace: [ 260.993008] [<ffffffffa0f80f0f>] ? xc5000_sleep+0x8f/0xd0 [xc5000] [ 260.993095] [<ffffffffa0f6803c>] ? fe_standby+0x3c/0x50 [tuner] [ 260.993186] [<ffffffffa0ef541c>] au0828_v4l2_close+0x53c/0x620 [au0828] [ 260.993298] [<ffffffffa0d08ec0>] v4l2_release+0xf0/0x210 [videodev] [ 260.993382] [<ffffffff81570f9c>] __fput+0x1fc/0x6c0 [ 260.993449] [<ffffffff815714ce>] ____fput+0xe/0x10 [ 260.993519] [<ffffffff8116eb83>] task_work_run+0x133/0x1f0 [ 260.993602] [<ffffffff810035d0>] exit_to_usermode_loop+0x140/0x170 [ 260.993681] [<ffffffff810061ca>] syscall_return_slowpath+0x16a/0x1a0 [ 260.993754] [<ffffffff82835fb3>] entry_SYSCALL_64_fastpath+0xa6/0xa8 Cc: stable@vger.kernel.org Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-31[media] media: au0828 fix to clear enable/disable/change source handlersShuah Khan1-0/+5
Fix to clear enable/disable/change source handlers in the media device when media device is unregistered in au0828_unregister_media_device(). When au0828 module is removed, snd-usb-audio shouldn't call the handlers. Clearing will ensure snd-usb-audio won't call them once au0828 is removed. [mchehab@osg.samsung.com: fix a compilation breakage] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-31[media] au0828: disable tuner links and cache tuner/decoderMauro Carvalho Chehab2-19/+27
For au0828_enable_source() to work, the tuner links should be disabled and the tuner/decoder should be cached at au0828 struct. While here, put dev->decoder cache together with dev->tuner, as it makes easier to drop both latter if/when we move the enable routines to the V4L2 core. Fixes: 9822f4173f84 ('[media] au0828: use v4l2_mc_create_media_graph()') Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-03-10media: au0828 disable tuner to demod link in au0828_media_device_register()Shuah Khan1-0/+26
Disable tuner to demod link in au0828_media_device_register(). This step should be done after dvb graph is created. [mchehab@osg.samsung.com: Solve conflictst to apply it upstream] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-05[media] hide unused functions for !MEDIA_CONTROLLERArnd Bergmann1-7/+2
Some functions in the au0828 driver are only used when CONFIG_MEDIA_CONTROLLER is enabled, and otherwise defined as empty functions: media/usb/au0828/au0828-core.c:208:13: error: 'au0828_media_graph_notify' defined but not used [-Werror=unused-function] media/usb/au0828/au0828-core.c:262:12: error: 'au0828_enable_source' defined but not used [-Werror=unused-function] media/usb/au0828/au0828-core.c:412:13: error: 'au0828_disable_source' defined but not used [-Werror=unused-function] This moves the #ifdef so the entire definitions are hidden in this case. [mchehab@osg.samsung.com: As pointed by Shuah Khan, a return 0 can be removed] Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] media: au0828 audio mixer isn't connected to decoderShuah Khan1-9/+45
When snd_usb_audio gets probed first, audio mixer doesn't get linked to the decoder. Change au0828_media_graph_notify() to handle the mixer entity getting registered before the decoder. Change au0828_media_device_register() to invoke au0828_media_graph_notify() to connect entites that were created prior to registering the notify handler. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Reported-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] media: au0828 enable the right media source when input changesShuah Khan1-1/+9
Change vidioc_s_input() to enable the media source for the newly selected input. v4l2-core enables source before calling au0828's vidioc_s_input() handler. Hence, when input selection changes, media source for the newly selected input needs to be enabled. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-03-03[media] media: au0828 set ctrl_input in au0828_s_input()Shuah Khan1-2/+8
dev->ctrl_input is set in vidioc_s_input() and doesn't get set in au0828_s_input(). As a result, dev->ctrl_input is left uninitialized until user space calls s_input. It works correctly because the default input value is 0 and which is what dev->ctrl_input gets initialized via kzalloc(). Change to set dev->ctrl_input in au0828_s_input(). Also optimize vidioc_s_input() to return if the new input value is same as the current. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] au0828: use v4l2_mc_create_media_graph()Mauro Carvalho Chehab1-98/+5
There's no reason to implement its own function to create the media graph. So, use the core one. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-03-03[media] au0828: use standard demod pads structMauro Carvalho Chehab2-5/+5
As we want au0828 to use the core function to create the MC graphs, use enum demod_pad_index instead of enum au8522_media_pads. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27[media] media: au0828 video change to use v4l_enable_media_source()Shuah Khan1-63/+39
Change au0828 to check if tuner is free or not before changing tuner configuration. vidioc_g_tuner(), and au0828_v4l2_close() now call v4l-core interface v4l_enable_media_source() before changing tuner configuration. Remove au0828_enable_analog_tuner() as it is no longer needed because v4l2-core implements common interfaces to check for media source availability. In addition, queue_setup() no longer needs the tuner availability check since v4l2-core does it. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27[media] media: au0828 add enable, disable source handlersShuah Khan3-0/+207
Add enable_source and disable_source handlers. The enable source handler is called from v4l2-core, dvb-core, and ALSA drivers to check if the shared media source is free. The disable source handler is called to release the shared media source. [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>
2016-02-27[media] media: au0828-core register entity_notify hookShuah Khan2-2/+44
Register entity_notify async hook to create links between existing bridge driver entities and a newly added non-bridge driver entities. For example, this handler creates link between V4L decoder entity and ALSA mixer entity. [mchehab@osg.samsung.com: fix merge conflicts and make au0828_media_graph_notify static to shut up a warning] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27[media] media: au0828 disable tuner to demod linkShuah Khan1-1/+19
Change au0828_create_media_graph() to find and disable tuner and demod link. This helps avoid an additional disable step when tuner is requested by video or audio. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-27[media] media: au0828 create tuner to decoder link in disabled stateShuah Khan1-2/+1
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>
2016-02-27[media] media: au0828 handle media_init and media_register windowShuah Khan1-4/+24
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>
2016-02-27[media] media: au0828 change to use Managed Media Controller APIShuah Khan1-7/+4
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>
2016-02-27[media] media: au0828 Use au8522_media_pads enum for pad definesShuah Khan1-4/+8
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>
2016-02-23[media] media_device: move allocation out of media_device_*_initMauro Carvalho Chehab1-4/+6
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>
2016-02-23[media] media-device: move PCI/USB helper functions from v4l2-mcMauro Carvalho Chehab1-2/+2
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>
2016-02-16[media] au0828: get rid of AU0828_VMUX_DEBUGMauro Carvalho Chehab2-10/+3
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>
2016-02-16[media] use v4l2_mc_usb_media_device_init() on most USB devicesMauro Carvalho Chehab1-15/+4
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>
2016-02-10[media] au0828: move V4L2-specific code to au0828-core.cMauro Carvalho Chehab3-152/+187
Instead of having lots of #ifdefs inside au0828-core due to V4L2, move the dependencies to au0828-video.c. That allows removing all those ifdefs, as au0828-video is only compiled if CONFIG_VIDEO_AU0828_V4L2. This fixes the following warnings reported by Kbuild test with a random config with au0828 enabled, but V4L2 is disabled. All warnings (new ones prefixed by >>): drivers/media/usb/au0828/au0828-core.c: In function 'au0828_usb_probe': >> drivers/media/usb/au0828/au0828-core.c:463:1: warning: label 'done' defined but not used [-Wunused-label] done: ^ drivers/media/usb/au0828/au0828-core.c: At top level: drivers/media/usb/au0828/au0828-core.c:250:12: warning: 'au0828_create_media_graph' defined but not used [-Wunused-function] static int au0828_create_media_graph(struct au0828_dev *dev) ^ Tested with a WinTV HVR 950Q (USB ID: 2040:7200) Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-10[media] au0828: only create V4L2 graph if V4L2 is registeredMauro Carvalho Chehab1-9/+15
It doesn't make sense to try to create the analog TV graph, if the device fails to register at V4L2, or if it doesn't have V4L2 support. Thanks to Shuah for pointing this issue. Reported-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] au0828: Refactoring for start_urb_transfer()Markus Elfring1-7/+5
This issue was detected by using the Coccinelle software. 1. Let us return directly if a buffer allocation failed. 2. Delete the jump label "err" then. 3. Drop the explicit initialisation for the variable "ret" at the beginning. 4. Return zero as a constant at the end. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] tuner.h: rename TUNER_PAD_IF_OUTPUT to TUNER_PAD_OUTPUTMauro Carvalho Chehab1-1/+1
The output of a tuner is not only IF frequencies. They may also output audio on some of its pins, and may even be a zero-IF tuner, with outputs a baseband. So, rename the PAD name to make it clearer and add a proper documentation about that at tuner.h. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvbdev: Add RF connector if neededMauro Carvalho Chehab1-1/+1
Several pure digital TV devices have a frontend with the tuner integrated on it. Add the RF connector when dvb_create_media_graph() is called on such devices. Tested with siano and dvb_usb_mxl111sf drivers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] usb: check media device errorsMauro Carvalho Chehab1-4/+12
There are now two new warnings: drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register': drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result] media_device_register(adap->dvb_adap.mdev); ^ drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register': drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result] media_device_register(adap->dvb_adap.mdev); ^ Those are because the drivers are not properly checking if the media device init and register were succeeded. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media-device: split media initialization and registrationJavier Martinez Canillas1-14/+15
The media device node is registered and so made visible to user-space before entities are registered and links created which means that the media graph obtained by user-space could be only partially enumerated if that happens too early before all the graph has been created. To avoid this race condition, split the media init and registration in separate functions and only register the media device node when all the pending subdevices have been registered, either explicitly by the driver or asynchronously using v4l2_async_register_subdev(). The media_device_register() had a check for drivers not filling dev and model fields but all drivers in mainline set them and not doing it will be a driver bug so change the function return to void and add a BUG_ON() for dev being NULL instead. Also, add a media_device_cleanup() function that will destroy the graph_mutex that is initialized in media_device_init(). [mchehab@osg.samsung.com: Fix compilation if !CONFIG_MEDIA_CONTROLLER and remove two warnings added by this changeset] Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media framework: rename pads init function to media_entity_pads_init()Mauro Carvalho Chehab1-3/+3
With the MC next gen rework, what's left for media_entity_init() is to just initialize the PADs. However, certain devices, like a FLASH led/light doesn't have any input or output PAD. So, there's no reason why calling media_entity_init() would be mandatory. Also, despite its name, what this function actually does is to initialize the PADs data. So, rename it to media_entity_pads_init() in order to reflect that. The media entity actual init happens during entity register, at media_device_register_entity(). We should move init of num_links and num_backlinks to it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] uapi/media.h: Rename entities types to functionsMauro Carvalho Chehab2-6/+6
Rename the userspace types from MEDIA_ENT_T_ to MEDIA_ENT_F_ and add the backward compatibility bits. The changes at the .c files was generated by the following coccinelle script: @@ @@ -MEDIA_ENT_T_UNKNOWN +MEDIA_ENT_F_UNKNOWN @@ @@ -MEDIA_ENT_T_DVB_BASE +MEDIA_ENT_F_DVB_BASE @@ @@ -MEDIA_ENT_T_V4L2_BASE +MEDIA_ENT_F_V4L2_BASE @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_BASE +MEDIA_ENT_F_V4L2_SUBDEV_BASE @@ @@ -MEDIA_ENT_T_CONNECTOR_BASE +MEDIA_ENT_F_CONNECTOR_BASE @@ @@ -MEDIA_ENT_T_V4L2_VIDEO +MEDIA_ENT_F_IO_V4L @@ @@ -MEDIA_ENT_T_V4L2_VBI +MEDIA_ENT_F_IO_VBI @@ @@ -MEDIA_ENT_T_V4L2_SWRADIO +MEDIA_ENT_F_IO_SWRADIO @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN +MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN @@ @@ -MEDIA_ENT_T_CONN_RF +MEDIA_ENT_F_CONN_RF @@ @@ -MEDIA_ENT_T_CONN_SVIDEO +MEDIA_ENT_F_CONN_SVIDEO @@ @@ -MEDIA_ENT_T_CONN_COMPOSITE +MEDIA_ENT_F_CONN_COMPOSITE @@ @@ -MEDIA_ENT_T_CONN_TEST +MEDIA_ENT_F_CONN_TEST @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_SENSOR +MEDIA_ENT_F_CAM_SENSOR @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_FLASH +MEDIA_ENT_F_FLASH @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_LENS +MEDIA_ENT_F_LENS @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_DECODER +MEDIA_ENT_F_ATV_DECODER @@ @@ -MEDIA_ENT_T_V4L2_SUBDEV_TUNER +MEDIA_ENT_F_TUNER @@ @@ -MEDIA_ENT_T_DVB_DEMOD +MEDIA_ENT_F_DTV_DEMOD @@ @@ -MEDIA_ENT_T_DVB_DEMUX +MEDIA_ENT_F_TS_DEMUX @@ @@ -MEDIA_ENT_T_DVB_TSOUT +MEDIA_ENT_F_IO_DTV @@ @@ -MEDIA_ENT_T_DVB_CA +MEDIA_ENT_F_DTV_CA @@ @@ -MEDIA_ENT_T_DVB_NET_DECAP +MEDIA_ENT_F_DTV_NET_DECAP Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media-entity.h: rename entity.type to entity.functionMauro Carvalho Chehab2-5/+5
Entities should have one or more functions. Calling it as a type proofed to not be correct, as an entity could eventually have more than one type. So, rename the field as function. Please notice that this patch doesn't extend support for multiple function entities. Such change will happen when we have real case drivers using it. No functional changes. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] au0828: enforce check for graph creationMauro Carvalho Chehab1-19/+39
If the graph creation fails, don't register the device. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] dvb core: must check dvb_create_media_graph()Mauro Carvalho Chehab1-3/+5
If media controller is enabled and mdev is filled, it should ensure that the media graph will be properly initialized. Enforce that. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] au0828: Create connector linksMauro Carvalho Chehab1-0/+26
Now that connectors are entities, we need to represent the connector links. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] au0828: add support for the connectorsMauro Carvalho Chehab3-12/+82
Depending on the input, an au0828 may have a different number of connectors. add entities to represent them. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] au0828: postpone call to au0828_unregister_media_device()Mauro Carvalho Chehab1-2/+4
The DVB core needs to unregister the media device. So, we can't call au0828_unregister_media_device() before calling au0828_dvb_unregister(), otherwise the DVB MC free code (that will be implemented on the next patch) will fail. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] tuner-core: add an input padMauro Carvalho Chehab1-1/+4
Tuners actually have at least one connector on its input. Add a PAD to connect it. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: convert links from array to listMauro Carvalho Chehab2-12/+8
The entire logic that represent graph links were developed on a time where there were no needs to dynamic remove links. So, although links are created/removed one by one via some functions, they're stored as an array inside the entity struct. As the array may grow, there's a logic inside the code that checks if the amount of space is not enough to store the needed links. If it isn't the core uses krealloc() to change the size of the link, with is bad, as it leaves the memory fragmented. So, convert links into a list. Also, currently, both source and sink entities need the link at the graph traversal logic inside media_entity. So there's a logic duplicating all links. That makes it to spend twice the memory needed. This is not a big deal for today's usage, where the number of links are not big. Yet, if during the MC workshop discussions, it was said that IIO graphs could have up to 4,000 entities. So, we may want to remove the duplication on some future. The problem is that it would require a separate linked list to store the backlinks inside the entity, or to use a more complex algorithm to do graph backlink traversal, with is something that the current graph traversal inside the core can't cope with. So, let's postpone a such change if/when it is actually needed. It should also be noticed that the media_link structure uses 44 bytes on 32-bit architectures and 84 bytes on 64-bit architecture. It will thus be allocated out of the 64-bytes and 96-bytes pools respectively. That's a 12.5% memory waste on 64-bit architectures and 31.25% on 32-bit architecture. A linked list is less efficient than an array in this case, but this could later be optimized if we can get rid of the reverse links (with would reduce memory allocation by 50%). Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: rename the function that create pad linksMauro Carvalho Chehab1-3/+3
With the new API, a link can be either between two PADs or between an interface and an entity. So, we need to use a better name for the function that create links between two pads. So, rename the such function to media_create_pad_link(). No functional changes. This patch was created via this shell script: for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] au0828: Fix the logic that enables the analog demoder linkMauro Carvalho Chehab1-2/+2
This logic was broken on the original patch, likely due to a cut-and-paste mistake. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] media: get rid of unused "extra_links" param on media_entity_init()Mauro Carvalho Chehab1-2/+2
Currently, media_entity_init() creates an array with the links, allocated at init time. It provides a parameter (extra_links) that would allocate more links than the current needs, but this is not used by any driver. As we want to be able to do dynamic link allocation/removal, we'll need to change the implementation of the links. So, before doing that, let's first remove that extra unused parameter, in order to cleanup the interface first. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11[media] au0828: Cache the decoder info at au0828 dev structureMauro Carvalho Chehab3-14/+10
Instead of seeking for the decoder every time analog stream is started, cache it. This simplifies the code a little bit. Requested-by: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>