You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/06/14 23:10:59 UTC
[incubator-nuttx] 02/02: boards: arm: cxd56: initilize the video
stream driver from the board
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit c6c0214f9a0e29fe563060069979d0cebf474d95
Author: Alin Jerpelea <al...@sony.com>
AuthorDate: Thu Jun 11 16:03:33 2020 +0200
boards: arm: cxd56: initilize the video stream driver from the board
The video stream driver must be intialized from the board to comply with NuttX
NOTE:
Please remove the initalization from any camera example
Signed-off-by: Alin Jerpelea <al...@sony.com>
---
boards/arm/cxd56xx/spresense/src/cxd56_bringup.c | 15 +++++++++++++--
drivers/video/video.c | 5 +++--
include/nuttx/video/video.h | 5 ++---
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c b/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
index 019d2f6..2b87f38 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c
@@ -203,6 +203,9 @@ int cxd56_bringup(void)
{
struct pm_cpu_wakelock_s wlock;
int ret;
+#ifdef CONFIG_VIDEO_ISX012
+ FAR const struct video_devops_s *devops;
+#endif
ret = nsh_cpucom_initialize();
if (ret < 0)
@@ -359,14 +362,22 @@ int cxd56_bringup(void)
_err("ERROR: Failed to initialize ISX012 board. %d\n", errno);
}
- g_video_devops = isx012_initialize();
- if (g_video_devops == NULL)
+ devops = isx012_initialize();
+ if (devops == NULL)
{
_err("ERROR: Failed to populate ISX012 devops. %d\n", errno);
ret = ERROR;
}
#endif /* CONFIG_VIDEO_ISX012 */
+#ifdef CONFIG_VIDEO_STREAM
+ ret = video_initialize("/dev/video", devops);
+ if (ret < 0)
+ {
+ _err("ERROR: Failed to initialize video stream driver. \n");
+ }
+#endif
+
/* In order to prevent Hi-Z from being input to the SD Card controller,
* Initialize SDIO pins to GPIO low output with internal pull-down.
*/
diff --git a/drivers/video/video.c b/drivers/video/video.c
index 922c64c..506d7ac 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -222,7 +222,7 @@ static int video_s_ext_ctrls(FAR struct video_mng_s *priv,
* Public Data
****************************************************************************/
-FAR const struct video_devops_s *g_video_devops;
+static const struct video_devops_s *g_video_devops;
/****************************************************************************
* Private Data
@@ -1495,7 +1495,8 @@ static int video_unregister(FAR video_mng_t *v_mgr)
* Public Functions
****************************************************************************/
-int video_initialize(FAR const char *devpath)
+int video_initialize(FAR const char *devpath,
+ FAR const struct video_devops_s *devops)
{
if (is_initialized)
{
diff --git a/include/nuttx/video/video.h b/include/nuttx/video/video.h
index f403281..b83c04f 100644
--- a/include/nuttx/video/video.h
+++ b/include/nuttx/video/video.h
@@ -625,8 +625,6 @@ struct v4l2_ext_controls
* Public Data
****************************************************************************/
-extern FAR const struct video_devops_s *g_video_devops;
-
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -639,7 +637,8 @@ extern FAR const struct video_devops_s *g_video_devops;
* negative value is returned.
*/
-int video_initialize(FAR const char *devpath);
+int video_initialize(FAR const char *devpath,
+ FAR const struct video_devops_s *devops);
/* Uninitialize video driver.
*