brcm2708: rename target to bcm27xx
[openwrt/staging/wigyori.git] / target / linux / bcm27xx / patches-4.19 / 950-0682-staging-bcm2835-codec-Add-role-to-device-name.patch
1 From ca613ed735fc52e68189d2ad0880f1007b931d78 Mon Sep 17 00:00:00 2001
2 From: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 Date: Wed, 20 Mar 2019 11:55:43 +0000
4 Subject: [PATCH] staging: bcm2835-codec: Add role to device name
5
6 Three entities are created, Decode, Encode and ISP but all of the video
7 nodes use the same video name string "bcm2835-codec" which makes it
8 difficult to identify each role.
9
10 Append the role-name to the video name to facilitate identifying a
11 specific instance from userspace.
12
13 The Card-Type is also extended with the role name to support identifying
14 the device context from within QUERY_CAP operations.
15
16 Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
17 ---
18 .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c | 8 +++++---
19 1 file changed, 5 insertions(+), 3 deletions(-)
20
21 --- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
22 +++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
23 @@ -947,8 +947,10 @@ static void device_run(void *priv)
24 static int vidioc_querycap(struct file *file, void *priv,
25 struct v4l2_capability *cap)
26 {
27 + struct bcm2835_codec_dev *dev = video_drvdata(file);
28 +
29 strncpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver) - 1);
30 - strncpy(cap->card, MEM2MEM_NAME, sizeof(cap->card) - 1);
31 + strncpy(cap->card, dev->vfd.name, sizeof(cap->card) - 1);
32 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
33 MEM2MEM_NAME);
34 return 0;
35 @@ -2657,8 +2659,8 @@ static int bcm2835_codec_create(struct p
36 }
37
38 video_set_drvdata(vfd, dev);
39 - snprintf(vfd->name, sizeof(vfd->name), "%s",
40 - bcm2835_codec_videodev.name);
41 + snprintf(vfd->name, sizeof(vfd->name), "%s-%s",
42 + bcm2835_codec_videodev.name, roles[role]);
43 v4l2_info(&dev->v4l2_dev, "Device registered as /dev/video%d\n",
44 vfd->num);
45