diff options
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/siano/smscoreapi.h | 6 | ||||
-rw-r--r-- | drivers/media/common/siano/smsdvb-main.c | 20 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h index 9c9063cd3208..efe4ab090aec 100644 --- a/drivers/media/common/siano/smscoreapi.h +++ b/drivers/media/common/siano/smscoreapi.h @@ -31,6 +31,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <linux/wait.h> #include <linux/timer.h> +#include <media/media-device.h> + #include <asm/page.h> #include "smsir.h" @@ -215,6 +217,10 @@ struct smscore_device_t { bool is_usb_device; int led_state; + +#if defined(CONFIG_MEDIA_CONTROLLER_DVB) + struct media_device *media_dev; +#endif }; /* GPIO definitions for antenna frequency domain control (SMS8021) */ diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c index 85151efdd94c..042515915e20 100644 --- a/drivers/media/common/siano/smsdvb-main.c +++ b/drivers/media/common/siano/smsdvb-main.c @@ -613,6 +613,19 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) return 0; } +static void smsdvb_media_device_unregister(struct smsdvb_client_t *client) +{ + struct smscore_device_t *coredev = client->coredev; + +#ifdef CONFIG_MEDIA_CONTROLLER_DVB + if (!coredev->media_dev) + return; + media_device_unregister(coredev->media_dev); + kfree(coredev->media_dev); + coredev->media_dev = NULL; +#endif +} + static void smsdvb_unregister_client(struct smsdvb_client_t *client) { /* must be called under clientslock */ @@ -624,6 +637,7 @@ static void smsdvb_unregister_client(struct smsdvb_client_t *client) dvb_unregister_frontend(&client->frontend); dvb_dmxdev_release(&client->dmxdev); dvb_dmx_release(&client->demux); + smsdvb_media_device_unregister(client); dvb_unregister_adapter(&client->adapter); kfree(client); } @@ -1096,6 +1110,9 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, sms_err("dvb_register_adapter() failed %d", rc); goto adapter_error; } +#ifdef CONFIG_MEDIA_CONTROLLER_DVB + client->adapter.mdev = coredev->media_dev; +#endif /* init dvb demux */ client->demux.dmx.capabilities = DMX_TS_FILTERING; @@ -1175,6 +1192,8 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, if (smsdvb_debugfs_create(client) < 0) sms_info("failed to create debugfs node"); + dvb_create_media_graph(coredev->media_dev); + return 0; client_error: @@ -1187,6 +1206,7 @@ dmxdev_error: dvb_dmx_release(&client->demux); dvbdmx_error: + smsdvb_media_device_unregister(client); dvb_unregister_adapter(&client->adapter); adapter_error: |