[PATCH 0/4] media: vidtv: add media controller support

STALE2057d

Revision v1 of 2 in this series.

9 messages, 3 authors, 2021-01-26 · open the first message on its own page

[PATCH 0/4] media: vidtv: add media controller support

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Date: 2021-01-05 13:10:53

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

This series adds media controller support for vidtv so that we can
support this driver at the test-media script in v4l-utils.

I based my implementation on vim2m's.

Daniel W. S. Almeida (4):
  media: vidtv: Add media controller support
  media: vidtv: reinstate sysfs bind attrs
  media: vidtv: use a simpler name in platform_{device|driver}
  media: vidtv: print message when driver is removed

 .../media/test-drivers/vidtv/vidtv_bridge.c   | 32 +++++++++++++++++--
 .../media/test-drivers/vidtv/vidtv_bridge.h   |  7 ++++
 2 files changed, 36 insertions(+), 3 deletions(-)

-- 
2.30.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

[PATCH 1/4] media: vidtv: Add media controller support

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Date: 2021-01-05 13:10:53

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

Add media controller support when CONFIG_MEDIA_CONTROLLER_DVB is set
so that, in the future, a test sequence in v4l-utils can be written
without having to know which /dev/fooX device should be used.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
---
 .../media/test-drivers/vidtv/vidtv_bridge.c   | 26 +++++++++++++++++++
 .../media/test-drivers/vidtv/vidtv_bridge.h   |  6 +++++
 2 files changed, 32 insertions(+)
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index fc64d0c8492a..4424f9585f86 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -17,6 +17,8 @@
 #include <linux/time.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
+#include <media/dvbdev.h>
+#include <media/media-device.h>
 
 #include "vidtv_bridge.h"
 #include "vidtv_common.h"
@@ -501,9 +503,28 @@ static int vidtv_bridge_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dvb);
 
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+	dvb->mdev.dev = &pdev->dev;
+
+	strscpy(dvb->mdev.model, "vidtv", sizeof(dvb->mdev.model));
+	strscpy(dvb->mdev.bus_info, "platform:vidtv", sizeof(dvb->mdev.bus_info));
+
+	media_device_init(&dvb->mdev);
+	ret = media_device_register(&dvb->mdev);
+	if (ret) {
+		dev_err(dvb->mdev.dev,
+			"media device register failed (err=%d)\n", ret);
+		goto err_media_device_register;
+	}
+
+	dvb_register_media_controller(&dvb->adapter, &dvb->mdev);
+#endif //CONFIG_MEDIA_CONTROLLER_DVB
+
 	dev_info(&pdev->dev, "Successfully initialized vidtv!\n");
 	return ret;
 
+err_media_device_register:
+	media_device_cleanup(&dvb->mdev);
 err_dvb:
 	kfree(dvb);
 	return ret;
@@ -516,6 +537,11 @@ static int vidtv_bridge_remove(struct platform_device *pdev)
 
 	dvb = platform_get_drvdata(pdev);
 
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+	media_device_unregister(&dvb->mdev);
+	media_device_cleanup(&dvb->mdev);
+#endif //CONFIG_MEDIA_CONTROLLER_DVB
+
 	mutex_destroy(&dvb->feed_lock);
 
 	for (i = 0; i < NUM_FE; ++i) {
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.h b/drivers/media/test-drivers/vidtv/vidtv_bridge.h
index 2528adaee27d..d42899a31295 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.h
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.h
@@ -24,6 +24,7 @@
 #include <media/dmxdev.h>
 #include <media/dvb_demux.h>
 #include <media/dvb_frontend.h>
+#include <media/media-device.h>
 
 #include "vidtv_mux.h"
 
@@ -42,6 +43,7 @@
  * @feed_lock: Protects access to the start/stop stream logic/data.
  * @streaming: Whether we are streaming now.
  * @mux: The abstraction responsible for delivering MPEG TS packets to the bridge.
+ * @mdev: The media_device struct for media controller support.
  */
 struct vidtv_dvb {
 	struct platform_device *pdev;
@@ -60,6 +62,10 @@ struct vidtv_dvb {
 	bool streaming;
 
 	struct vidtv_mux *mux;
+
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+	struct media_device mdev;
+#endif //CONFIG_MEDIA_CONTROLLER_DVB
 };
 
 #endif // VIDTV_BRIDG_H
-- 
2.30.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

[PATCH 2/4] media: vidtv: reinstate sysfs bind attrs

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Date: 2021-01-05 13:10:53

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

Reinstate sysfs bind attrs so that vidtv can be bound and unbound
via sysfs. This is useful for automated regression testing in
userspace.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
---
 drivers/media/test-drivers/vidtv/vidtv_bridge.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index 4424f9585f86..4ccaa0f00639 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -569,7 +569,6 @@ static struct platform_device vidtv_bridge_dev = {
 static struct platform_driver vidtv_bridge_driver = {
 	.driver = {
 		.name                = "vidtv_bridge",
-		.suppress_bind_attrs = true,
 	},
 	.probe    = vidtv_bridge_probe,
 	.remove   = vidtv_bridge_remove,
-- 
2.30.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

[PATCH 3/4] media: vidtv: use a simpler name in platform_{device|driver}

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Date: 2021-01-05 13:11:21

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

Change from "vidtv_bridge" to simply "vidtv" so that vidtv looks
more similar to the other media virtual drivers in /sys/bus/platform.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
---
 drivers/media/test-drivers/vidtv/vidtv_bridge.c | 4 ++--
 drivers/media/test-drivers/vidtv/vidtv_bridge.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index 4ccaa0f00639..11ee87399375 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -562,13 +562,13 @@ static void vidtv_bridge_dev_release(struct device *dev)
 }
 
 static struct platform_device vidtv_bridge_dev = {
-	.name		= "vidtv_bridge",
+	.name		= VIDTV_PDEV_NAME,
 	.dev.release	= vidtv_bridge_dev_release,
 };
 
 static struct platform_driver vidtv_bridge_driver = {
 	.driver = {
-		.name                = "vidtv_bridge",
+		.name = VIDTV_PDEV_NAME,
 	},
 	.probe    = vidtv_bridge_probe,
 	.remove   = vidtv_bridge_remove,
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.h b/drivers/media/test-drivers/vidtv/vidtv_bridge.h
index d42899a31295..101a26a4415f 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.h
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.h
@@ -16,6 +16,7 @@
  * For now, only one frontend is supported. See vidtv_start_streaming()
  */
 #define NUM_FE 1
+#define VIDTV_PDEV_NAME "vidtv"
 
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
-- 
2.30.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

[PATCH 4/4] media: vidtv: print message when driver is removed

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Date: 2021-01-05 13:11:21

From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

Print a message when the driver is removed so that we get some
visual confirmation when unbinding vidtv.

Signed-off-by: Daniel W. S. Almeida <dwlsalmeida@gmail.com>
---
 drivers/media/test-drivers/vidtv/vidtv_bridge.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index 11ee87399375..09cec77490c3 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -553,6 +553,7 @@ static int vidtv_bridge_remove(struct platform_device *pdev)
 	dvb_dmxdev_release(&dvb->dmx_dev);
 	dvb_dmx_release(&dvb->demux);
 	dvb_unregister_adapter(&dvb->adapter);
+	dev_info(&pdev->dev, "Successfully removed vidtv\n");
 
 	return 0;
 }
-- 
2.30.0

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

Re: [PATCH 1/4] media: vidtv: Add media controller support

From: kernel test robot <hidden>
Date: 2021-01-05 15:40:05

Hi "Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.11-rc2 next-20210104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Daniel-W-S-Almeida/media-vidtv-add-media-controller-support/20210105-211434
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-s022-20210105 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-208-g46a52ca4-dirty
        # https://github.com/0day-ci/linux/commit/c06a13465ff899cdd2a6badae988b0f8f157f382
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-W-S-Almeida/media-vidtv-add-media-controller-support/20210105-211434
        git checkout c06a13465ff899cdd2a6badae988b0f8f157f382
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All errors (new ones prefixed by >>):

   drivers/media/test-drivers/vidtv/vidtv_bridge.c: In function 'vidtv_bridge_probe':
quoted
drivers/media/test-drivers/vidtv/vidtv_bridge.c:527:29: error: 'struct vidtv_dvb' has no member named 'mdev'; did you mean 'pdev'?
     527 |  media_device_cleanup(&dvb->mdev);
         |                             ^~~~
         |                             pdev
   drivers/media/test-drivers/vidtv/vidtv_bridge.c:526:1: warning: label 'err_media_device_register' defined but not used [-Wunused-label]
     526 | err_media_device_register:
         | ^~~~~~~~~~~~~~~~~~~~~~~~~


vim +527 drivers/media/test-drivers/vidtv/vidtv_bridge.c

   522	
   523		dev_info(&pdev->dev, "Successfully initialized vidtv!\n");
   524		return ret;
   525	
   526	err_media_device_register:
 > 527		media_device_cleanup(&dvb->mdev);
   528	err_dvb:
   529		kfree(dvb);
   530		return ret;
   531	}
   532	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Re: [PATCH 1/4] media: vidtv: Add media controller support

From: kernel test robot <hidden>
Date: 2021-01-05 16:46:41

Hi "Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.11-rc2 next-20210104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Daniel-W-S-Almeida/media-vidtv-add-media-controller-support/20210105-211434
base:   git://linuxtv.org/media_tree.git master
config: arm-randconfig-r021-20210105 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/c06a13465ff899cdd2a6badae988b0f8f157f382
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-W-S-Almeida/media-vidtv-add-media-controller-support/20210105-211434
        git checkout c06a13465ff899cdd2a6badae988b0f8f157f382
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All errors (new ones prefixed by >>):
quoted
drivers/media/test-drivers/vidtv/vidtv_bridge.c:527:2: error: implicit declaration of function 'media_device_cleanup' [-Werror,-Wimplicit-function-declaration]
           media_device_cleanup(&dvb->mdev);
           ^
   drivers/media/test-drivers/vidtv/vidtv_bridge.c:527:2: note: did you mean 'media_device_pci_init'?
   include/media/media-device.h:468:20: note: 'media_device_pci_init' declared here
   static inline void media_device_pci_init(struct media_device *mdev,
                      ^
   drivers/media/test-drivers/vidtv/vidtv_bridge.c:527:29: error: no member named 'mdev' in 'struct vidtv_dvb'; did you mean 'pdev'?
           media_device_cleanup(&dvb->mdev);
                                      ^~~~
                                      pdev
   drivers/media/test-drivers/vidtv/vidtv_bridge.h:49:26: note: 'pdev' declared here
           struct platform_device *pdev;
                                   ^
   2 errors generated.


vim +/media_device_cleanup +527 drivers/media/test-drivers/vidtv/vidtv_bridge.c

   522	
   523		dev_info(&pdev->dev, "Successfully initialized vidtv!\n");
   524		return ret;
   525	
   526	err_media_device_register:
 > 527		media_device_cleanup(&dvb->mdev);
   528	err_dvb:
   529		kfree(dvb);
   530		return ret;
   531	}
   532	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Re: [PATCH 1/4] media: vidtv: Add media controller support

From: kernel test robot <hidden>
Date: 2021-01-05 16:50:24

Hi "Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.11-rc2 next-20210104]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Daniel-W-S-Almeida/media-vidtv-add-media-controller-support/20210105-211434
base:   git://linuxtv.org/media_tree.git master
config: h8300-randconfig-r014-20210105 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c06a13465ff899cdd2a6badae988b0f8f157f382
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-W-S-Almeida/media-vidtv-add-media-controller-support/20210105-211434
        git checkout c06a13465ff899cdd2a6badae988b0f8f157f382
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>

All errors (new ones prefixed by >>):

   drivers/media/test-drivers/vidtv/vidtv_bridge.c: In function 'vidtv_bridge_probe':
quoted
drivers/media/test-drivers/vidtv/vidtv_bridge.c:527:2: error: implicit declaration of function 'media_device_cleanup'; did you mean 'media_entity_cleanup'? [-Werror=implicit-function-declaration]
     527 |  media_device_cleanup(&dvb->mdev);
         |  ^~~~~~~~~~~~~~~~~~~~
         |  media_entity_cleanup
   drivers/media/test-drivers/vidtv/vidtv_bridge.c:527:29: error: 'struct vidtv_dvb' has no member named 'mdev'; did you mean 'pdev'?
     527 |  media_device_cleanup(&dvb->mdev);
         |                             ^~~~
         |                             pdev
   drivers/media/test-drivers/vidtv/vidtv_bridge.c:526:1: warning: label 'err_media_device_register' defined but not used [-Wunused-label]
     526 | err_media_device_register:
         | ^~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +527 drivers/media/test-drivers/vidtv/vidtv_bridge.c

   522	
   523		dev_info(&pdev->dev, "Successfully initialized vidtv!\n");
   524		return ret;
   525	
   526	err_media_device_register:
 > 527		media_device_cleanup(&dvb->mdev);
   528	err_dvb:
   529		kfree(dvb);
   530		return ret;
   531	}
   532	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Re: [PATCH 0/4] media: vidtv: add media controller support

From: Hans Verkuil <hidden>
Date: 2021-01-26 21:03:11

On 05/01/2021 14:09, Daniel W. S. Almeida wrote:
From: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>

This series adds media controller support for vidtv so that we can
support this driver at the test-media script in v4l-utils.

I based my implementation on vim2m's.

Daniel W. S. Almeida (4):
  media: vidtv: Add media controller support
  media: vidtv: reinstate sysfs bind attrs
  media: vidtv: use a simpler name in platform_{device|driver}
  media: vidtv: print message when driver is removed

 .../media/test-drivers/vidtv/vidtv_bridge.c   | 32 +++++++++++++++++--
 .../media/test-drivers/vidtv/vidtv_bridge.h   |  7 ++++
 2 files changed, 36 insertions(+), 3 deletions(-)
For this series:

Acked-by: Hans Verkuil <redacted>

Mauro, it would be very nice to merge this. It will make it possible
to add vidtv to the test-media script for regression testing.

Regards,

	Hans
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help