[media] media: au0828 audio mixer isn't connected to decoder
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>
This commit is contained in:
parent
aebb2b89bf
commit
9096cae181
@ -211,24 +211,51 @@ static void au0828_media_graph_notify(struct media_entity *new,
|
|||||||
#ifdef CONFIG_MEDIA_CONTROLLER
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
||||||
struct au0828_dev *dev = (struct au0828_dev *) notify_data;
|
struct au0828_dev *dev = (struct au0828_dev *) notify_data;
|
||||||
int ret;
|
int ret;
|
||||||
|
struct media_entity *entity, *mixer = NULL, *decoder = NULL;
|
||||||
|
|
||||||
if (!dev->decoder)
|
if (!new) {
|
||||||
return;
|
/*
|
||||||
|
* Called during au0828 probe time to connect
|
||||||
|
* entites that were created prior to registering
|
||||||
|
* the notify handler. Find mixer and decoder.
|
||||||
|
*/
|
||||||
|
media_device_for_each_entity(entity, dev->media_dev) {
|
||||||
|
if (entity->function == MEDIA_ENT_F_AUDIO_MIXER)
|
||||||
|
mixer = entity;
|
||||||
|
else if (entity->function == MEDIA_ENT_F_ATV_DECODER)
|
||||||
|
decoder = entity;
|
||||||
|
}
|
||||||
|
goto create_link;
|
||||||
|
}
|
||||||
|
|
||||||
switch (new->function) {
|
switch (new->function) {
|
||||||
case MEDIA_ENT_F_AUDIO_MIXER:
|
case MEDIA_ENT_F_AUDIO_MIXER:
|
||||||
ret = media_create_pad_link(dev->decoder,
|
mixer = new;
|
||||||
DEMOD_PAD_AUDIO_OUT,
|
if (dev->decoder)
|
||||||
new, 0,
|
decoder = dev->decoder;
|
||||||
MEDIA_LNK_FL_ENABLED);
|
break;
|
||||||
if (ret)
|
case MEDIA_ENT_F_ATV_DECODER:
|
||||||
dev_err(&dev->usbdev->dev,
|
/* In case, Mixer is added first, find mixer and create link */
|
||||||
"Mixer Pad Link Create Error: %d\n",
|
media_device_for_each_entity(entity, dev->media_dev) {
|
||||||
ret);
|
if (entity->function == MEDIA_ENT_F_AUDIO_MIXER)
|
||||||
|
mixer = entity;
|
||||||
|
}
|
||||||
|
decoder = new;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_link:
|
||||||
|
if (decoder && mixer) {
|
||||||
|
ret = media_create_pad_link(decoder,
|
||||||
|
DEMOD_PAD_AUDIO_OUT,
|
||||||
|
mixer, 0,
|
||||||
|
MEDIA_LNK_FL_ENABLED);
|
||||||
|
if (ret)
|
||||||
|
dev_err(&dev->usbdev->dev,
|
||||||
|
"Mixer Pad Link Create Error: %d\n", ret);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,6 +474,15 @@ static int au0828_media_device_register(struct au0828_dev *dev,
|
|||||||
"Media Device Register Error: %d\n", ret);
|
"Media Device Register Error: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Call au0828_media_graph_notify() to connect
|
||||||
|
* audio graph to our graph. In this case, audio
|
||||||
|
* driver registered the device and there is no
|
||||||
|
* entity_notify to be called when new entities
|
||||||
|
* are added. Invoke it now.
|
||||||
|
*/
|
||||||
|
au0828_media_graph_notify(NULL, (void *) dev);
|
||||||
}
|
}
|
||||||
/* register entity_notify callback */
|
/* register entity_notify callback */
|
||||||
dev->entity_notify.notify_data = (void *) dev;
|
dev->entity_notify.notify_data = (void *) dev;
|
||||||
|
Loading…
Reference in New Issue
Block a user