summaryrefslogtreecommitdiff
path: root/drivers/media/usb/siano
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-01-07 08:03:03 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-26 08:46:48 -0300
commit46b1e21fe50f9f58ceaffc10c5aea50366cf7af5 (patch)
treee4e79232b86fcb568af931fb571d048a7085f23d /drivers/media/usb/siano
parent7e4f23d53d0f5b9934302324a2d736d1c07c2d2b (diff)
[media] siano: add support for the media controller at USB driver
Adding support for the media controller for a pure DVB device is simple: just create a struct media_device and add it to the dvb adapter. After creating all DVB devices, we need to call the DVB core, for it to create the media graph. More work is needed for pure DVB tuners, but this is hidden at the Siano driver, just like several others non-hybrid devices. So, this is streight forward. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/siano')
-rw-r--r--drivers/media/usb/siano/smsusb.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index 94e10b10b66e..4b6db7557e33 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -346,6 +346,42 @@ static void smsusb_term_device(struct usb_interface *intf)
usb_set_intfdata(intf, NULL);
}
+static void siano_media_device_register(struct smsusb_device_t *dev)
+{
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+ struct media_device *mdev;
+ struct usb_device *udev = dev->udev;
+ int board_id = smscore_get_board_id(dev->coredev);
+ struct sms_board *board = sms_get_board(board_id);
+ int ret;
+
+ mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+ if (!mdev)
+ return;
+
+ mdev->dev = &udev->dev;
+ strlcpy(mdev->model, board->name, sizeof(mdev->model));
+ if (udev->serial)
+ strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial));
+ strcpy(mdev->bus_info, udev->devpath);
+ mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
+ mdev->driver_version = LINUX_VERSION_CODE;
+
+ ret = media_device_register(mdev);
+ if (ret) {
+ sms_err("Couldn't create a media device. Error: %d\n",
+ ret);
+ kfree(mdev);
+ return;
+ }
+
+ dev->coredev->media_dev = mdev;
+
+ sms_info("media controller created");
+
+#endif
+}
+
static int smsusb_init_device(struct usb_interface *intf, int board_id)
{
struct smsdevice_params_t params;
@@ -439,6 +475,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
}
sms_info("device 0x%p created", dev);
+ siano_media_device_register(dev);
return rc;
}