summaryrefslogtreecommitdiff
path: root/drivers/media/usb/au0828
diff options
context:
space:
mode:
authorShuah Khan <shuahkh@osg.samsung.com>2016-02-11 21:41:34 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-27 09:15:34 -0300
commitf90c5d79e5156e523a6bd560b7da76e842992229 (patch)
tree546cced57cdd616d1a37c6c5f0143951a6248323 /drivers/media/usb/au0828
parentb176965176abe4ef560c2e9c14332031bcf37254 (diff)
[media] media: au0828-core register entity_notify hook
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>
Diffstat (limited to 'drivers/media/usb/au0828')
-rw-r--r--drivers/media/usb/au0828/au0828-core.c45
-rw-r--r--drivers/media/usb/au0828/au0828.h1
2 files changed, 44 insertions, 2 deletions
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index cafe57f37e3d..4ec7c573b5f1 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -20,6 +20,7 @@
*/
#include "au0828.h"
+#include "au8522.h"
#include <linux/module.h>
#include <linux/slab.h>
@@ -204,14 +205,43 @@ static int au0828_media_device_init(struct au0828_dev *dev,
return 0;
}
+static void au0828_media_graph_notify(struct media_entity *new,
+ void *notify_data)
+{
+#ifdef CONFIG_MEDIA_CONTROLLER
+ struct au0828_dev *dev = (struct au0828_dev *) notify_data;
+ int ret;
+
+ if (!dev->decoder)
+ return;
+
+ switch (new->function) {
+ case MEDIA_ENT_F_AUDIO_MIXER:
+ ret = media_create_pad_link(dev->decoder,
+ AU8522_PAD_AUDIO_OUT,
+ new, 0,
+ MEDIA_LNK_FL_ENABLED);
+ if (ret)
+ dev_err(&dev->usbdev->dev,
+ "Mixer Pad Link Create Error: %d\n",
+ ret);
+ break;
+ default:
+ break;
+ }
+#endif
+}
+
static int au0828_media_device_register(struct au0828_dev *dev,
struct usb_device *udev)
{
#ifdef CONFIG_MEDIA_CONTROLLER
int ret;
- if (dev->media_dev &&
- !media_devnode_is_registered(&dev->media_dev->devnode)) {
+ if (!dev->media_dev)
+ return 0;
+
+ if (!media_devnode_is_registered(&dev->media_dev->devnode)) {
/* register media device */
ret = media_device_register(dev->media_dev);
@@ -221,6 +251,17 @@ static int au0828_media_device_register(struct au0828_dev *dev,
return ret;
}
}
+ /* register entity_notify callback */
+ dev->entity_notify.notify_data = (void *) dev;
+ dev->entity_notify.notify = (void *) au0828_media_graph_notify;
+ ret = media_device_register_entity_notify(dev->media_dev,
+ &dev->entity_notify);
+ if (ret) {
+ dev_err(&udev->dev,
+ "Media Device register entity_notify Error: %d\n",
+ ret);
+ return ret;
+ }
#endif
return 0;
}
diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h
index 23f869cf11da..c2801b2a545d 100644
--- a/drivers/media/usb/au0828/au0828.h
+++ b/drivers/media/usb/au0828/au0828.h
@@ -282,6 +282,7 @@ struct au0828_dev {
struct media_entity *decoder;
struct media_entity input_ent[AU0828_MAX_INPUT];
struct media_pad input_pad[AU0828_MAX_INPUT];
+ struct media_entity_notify entity_notify;
#endif
};