Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1332447
| From | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 18/22] media: au0828-core register entity_notify hook |
| Date | 2016-02-12 00:50 +0100 |
| Message-ID | <r199M-7jD-35@gated-at.bofh.it> (permalink) |
| References | <r199L-7jD-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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@osg.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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/22] Sharing media resources across ALSA and au0828 drivers Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 02/22] uapi/media.h: Declare interface types for ALSA Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
Re: [PATCH v3 02/22] uapi/media.h: Declare interface types for ALSA Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-02-17 13:30 +0100
[PATCH v3 18/22] media: au0828-core register entity_notify hook Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 16/22] media: au0828 create tuner to decoder link in disabled state Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 03/22] [media] Docbook: media-types.xml: Add Audio Function Entities Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
Re: [PATCH v3 03/22] [media] Docbook: media-types.xml: Add Audio Function Entities Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-02-17 13:30 +0100
[PATCH v3 05/22] media: Media Controller register/unregister entity_notify API Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 21/22] media: au0828 video change to use v4l_enable_media_source() Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 20/22] media: dvb-frontend invoke enable/disable_source handlers Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 01/22] [media] Docbook: media-types.xml: Add ALSA Media Controller Intf types Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
Re: [PATCH v3 01/22] [media] Docbook: media-types.xml: Add ALSA Media Controller Intf types Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-02-17 13:30 +0100
Re: [PATCH v3 01/22] [media] Docbook: media-types.xml: Add ALSA Media Controller Intf types Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-17 16:00 +0100
[PATCH v3 22/22] sound/usb: Use Media Controller API to share media resources Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 00:50 +0100
[PATCH v3 12/22] media: au0828 Use au8522_media_pads enum for pad defines Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 01:00 +0100
[PATCH v3 06/22] media: Media Controller enable/disable source handler API Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 01:00 +0100
[PATCH v3 09/22] media: v4l-core add enable/disable source common interfaces Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 01:00 +0100
[PATCH v3 08/22] media: Media Controller non-locking __media_entity_pipeline_start/stop() Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 01:00 +0100
[PATCH v3 11/22] media: au8522 change to create MC pad for ALSA Audio Out Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 01:00 +0100
[PATCH v3 07/22] media: Media Controller export non locking __media_entity_setup_link() Shuah Khan <shuahkh@osg.samsung.com> - 2016-02-12 01:00 +0100
csiph-web