[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <8f8e50e0310ece0990038b87d794c4bb378d3acd.1455233155.git.shuahkh@osg.samsung.com>
Date: Thu, 11 Feb 2016 16:41:34 -0700
From: Shuah Khan <shuahkh@....samsung.com>
To: mchehab@....samsung.com, tiwai@...e.com, clemens@...isch.de,
hans.verkuil@...co.com, laurent.pinchart@...asonboard.com,
sakari.ailus@...ux.intel.com, javier@....samsung.com
Cc: Shuah Khan <shuahkh@....samsung.com>, pawel@...iak.com,
m.szyprowski@...sung.com, kyungmin.park@...sung.com,
perex@...ex.cz, arnd@...db.de, dan.carpenter@...cle.com,
tvboxspy@...il.com, crope@....fi, ruchandani.tina@...il.com,
corbet@....net, chehabrafael@...il.com, k.kozlowski@...sung.com,
stefanr@...6.in-berlin.de, inki.dae@...sung.com,
jh1009.sung@...sung.com, elfring@...rs.sourceforge.net,
prabhakar.csengg@...il.com, sw0312.kim@...sung.com,
p.zabel@...gutronix.de, ricardo.ribalda@...il.com,
labbott@...oraproject.org, pierre-louis.bossart@...ux.intel.com,
ricard.wanderlof@...s.com, julian@...st.de, takamichiho@...il.com,
dominic.sacre@....de, misterpib@...il.com, daniel@...que.org,
gtmkramer@...all.nl, normalperson@...t.net, joe@...po.co.uk,
linuxbugs@...tgam.net, johan@...ud.se, klock.android@...il.com,
nenggun.kim@...sung.com, j.anaszewski@...sung.com,
geliangtang@....com, albert@...tsing.nl,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
alsa-devel@...a-project.org
Subject: [PATCH v3 18/22] 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.
Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
drivers/media/usb/au0828/au0828-core.c | 43 ++++++++++++++++++++++++++++++++--
drivers/media/usb/au0828/au0828.h | 1 +
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index 92d22ed..4c90f28 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -347,14 +347,42 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
return 0;
}
+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);
@@ -364,6 +392,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 8276072..54379ec 100644
--- a/drivers/media/usb/au0828/au0828.h
+++ b/drivers/media/usb/au0828/au0828.h
@@ -283,6 +283,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
};
--
2.5.0
Powered by blists - more mailing lists