boards: cxd56xx: Change pin initialization timing for camera
Change pin initialization timing for camera from board power on to camera device power on for the following purposes. - avoid unnecessary power consumption - Make the corresponding pins available for other uses when camera is not in use
This commit is contained in:
parent
229c7d30b6
commit
a25ac08774
@ -37,6 +37,8 @@
|
||||
#include <arch/chip/cisif.h>
|
||||
#include <nuttx/video/imgdata.h>
|
||||
#include "arm_internal.h"
|
||||
|
||||
#include "cxd56_pinconfig.h"
|
||||
#include "cxd56_clock.h"
|
||||
#include "hardware/cxd56_cisif.h"
|
||||
|
||||
@ -772,6 +774,8 @@ static int cxd56_cisif_init(void)
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
CXD56_PIN_CONFIGS(PINCONFS_IS);
|
||||
|
||||
/* enable CISIF clock */
|
||||
|
||||
cxd56_img_cisif_clock_enable();
|
||||
@ -825,6 +829,8 @@ static int cxd56_cisif_uninit(void)
|
||||
|
||||
cxd56_img_cisif_clock_disable();
|
||||
|
||||
CXD56_PIN_CONFIGS(PINCONFS_IS_GPIO);
|
||||
|
||||
g_state = STATE_STANDBY;
|
||||
return OK;
|
||||
}
|
||||
|
@ -65,5 +65,7 @@ int board_i2cdev_initialize(int port)
|
||||
cxd56_i2cbus_uninitialize(i2c);
|
||||
}
|
||||
|
||||
cxd56_i2cbus_uninitialize(i2c);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -58,12 +58,6 @@
|
||||
|
||||
#define POWER_CHECK_RETRY (10)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
struct i2c_master_s *i2c;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -160,10 +154,8 @@ void board_isx012_release_sleep(void)
|
||||
int isx012_register(struct i2c_master_s *i2c);
|
||||
int isx012_unregister(void);
|
||||
|
||||
int board_isx012_initialize(int i2c_bus_num)
|
||||
struct i2c_master_s *board_isx012_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
_info("Initializing ISX012...\n");
|
||||
|
||||
#ifdef IMAGER_ALERT
|
||||
@ -178,22 +170,10 @@ int board_isx012_initialize(int i2c_bus_num)
|
||||
|
||||
/* Initialize i2c device */
|
||||
|
||||
i2c = cxd56_i2cbus_initialize(i2c_bus_num);
|
||||
if (!i2c)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = isx012_initialize(i2c);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("Failed to initialize ISX012.\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
return cxd56_i2cbus_initialize(IMAGER_I2C);
|
||||
}
|
||||
|
||||
int board_isx012_uninitialize(void)
|
||||
int board_isx012_uninitialize(struct i2c_master_s *i2c)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/video/isx012.h>
|
||||
#include <nuttx/video/video.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@ -120,7 +121,7 @@ void board_isx012_release_sleep(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_isx012_initialize(int i2c_bus_num);
|
||||
struct i2c_master_s *board_isx012_initialize(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_isx012_uninitialize
|
||||
@ -130,7 +131,7 @@ int board_isx012_initialize(int i2c_bus_num);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_isx012_uninitialize(void);
|
||||
int board_isx012_uninitialize(struct i2c_master_s *i2c);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
|
@ -373,7 +373,7 @@ int cxd56_bringup(void)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_VIDEO_ISX012
|
||||
ret = board_isx012_initialize(IMAGER_I2C);
|
||||
ret = isx012_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to initialize ISX012 board. %d\n", errno);
|
||||
|
@ -1241,6 +1241,10 @@ static int isx012_init(void)
|
||||
FAR struct isx012_dev_s *priv = &g_isx012_private;
|
||||
int ret = 0;
|
||||
|
||||
priv->i2c = board_isx012_initialize();
|
||||
priv->i2c_addr = ISX012_I2C_SLV_ADDR;
|
||||
priv->i2c_freq = I2CFREQ_STANDARD;
|
||||
|
||||
ret = board_isx012_power_on();
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -1280,6 +1284,8 @@ static int isx012_uninit(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
board_isx012_uninitialize(priv->i2c);
|
||||
|
||||
priv->i2c_freq = I2CFREQ_STANDARD;
|
||||
priv->state = STATE_ISX012_POWEROFF;
|
||||
|
||||
@ -2877,16 +2883,10 @@ static int isx012_set_shd(FAR isx012_dev_t *priv)
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int isx012_initialize(FAR struct i2c_master_s *i2c)
|
||||
int isx012_initialize(void)
|
||||
{
|
||||
FAR struct isx012_dev_s *priv = &g_isx012_private;
|
||||
|
||||
/* Save i2c information */
|
||||
|
||||
priv->i2c = i2c;
|
||||
priv->i2c_addr = ISX012_I2C_SLV_ADDR;
|
||||
priv->i2c_freq = I2CFREQ_STANDARD;
|
||||
|
||||
/* Regiser image sensor operations variable */
|
||||
|
||||
imgsensor_register(&g_isx012_ops);
|
||||
|
@ -25,6 +25,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -49,7 +51,7 @@ extern "C"
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int isx012_initialize(FAR struct i2c_master_s *i2c);
|
||||
int isx012_initialize(void);
|
||||
int isx012_uninitialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
|
Loading…
x
Reference in New Issue
Block a user