mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Merged in alinjerpelea/nuttx (pull request #915)
arch: arm: cxd56xx: I2C, SPISD, Charger and Gauge
* arch: arm: cxd56xx: add I2C character driver
for testing purposes, we use the CXD56_I2C_DRIVER to register the
/dev/i2c[] character devices.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: use I2C character driver
We should use the CXD56_I2C_DRIVER to register the /dev/i2c[]
character devices.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* arch: arm: cxd56xx: add battery gauge driver
add battery gauge driver for cxd56xx chip
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* arch: arm: cxd56xx: add charger driver
add charger driver for cxd56xx chip
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* arch:arm: cxd56xx: add SPI SDCard configuration
Add SPI SDCARD functionality configuration
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable gauge driver
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* configs: spresense: enable charger driver
enable charger driver on spresense board
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
committed by
Gregory Nutt
parent
aa7a6825d0
commit
bfda93d66b
@@ -48,6 +48,8 @@
|
||||
#include "cxd56_clock.h"
|
||||
#include "cxd56_power.h"
|
||||
#include "cxd56_flash.h"
|
||||
#include "cxd56_gauge.h"
|
||||
#include "cxd56_charger.h"
|
||||
#include "cxd56_gs2200m.h"
|
||||
#include "cxd56_i2cdev.h"
|
||||
#include "cxd56_bmi160.h"
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/include/cxd56_charger.h
|
||||
*
|
||||
* Copyright 2018 Sony Semiconductor Solutions Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARD_COMMON_INCLUDE_CXD56_CHARGER_H
|
||||
#define __BOARD_COMMON_INCLUDE_CXD56_CHARGER_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_charger_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize battery charger driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_charger_initialize(FAR const char *devpath);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_charger_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize battery charger driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_charger_uninitialize(FAR const char *devpath);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARD_COMMON_INCLUDE_CXD56_CHARGER_H */
|
||||
@@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/include/cxd56_gauge.h
|
||||
*
|
||||
* Copyright 2018 Sony Semiconductor Solutions Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARD_COMMON_INCLUDE_CXD56_GAUGE_H
|
||||
#define __BOARD_COMMON_INCLUDE_CXD56_GAUGE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_gauge_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize battery gauge driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_gauge_initialize(FAR const char *devpath);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_gauge_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize battery gauge driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_gauge_uninitialize(FAR const char *devpath);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARD_COMMON_INCLUDE_CXD56_GAUGE_H */
|
||||
@@ -73,7 +73,7 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SYSTEM_I2CTOOL
|
||||
#ifdef CONFIG_CXD56_I2C_DRIVER
|
||||
int board_i2cdev_initialize(int bus);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -84,6 +84,14 @@ ifeq ($(CONFIG_CXD56_SDIO),y)
|
||||
CSRCS += cxd56_sdcard.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CXD56_GAUGE),y)
|
||||
CSRCS += cxd56_gauge.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CXD56_CHARGER),y)
|
||||
CSRCS += cxd56_charger.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBMSC),y)
|
||||
CSRCS += cxd56_usbmsc.c
|
||||
endif
|
||||
@@ -100,7 +108,7 @@ ifeq ($(CONFIG_SENSORS_BMI160_I2C),y)
|
||||
CSRCS += cxd56_bmi160_i2c.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SYSTEM_I2CTOOL),y)
|
||||
ifeq ($(CONFIG_CXD56_I2C_DRIVER),y)
|
||||
CSRCS += cxd56_i2cdev.c
|
||||
endif
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ int cxd56_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_I2CTOOL
|
||||
#ifdef CONFIG_CXD56_I2C_DRIVER
|
||||
#ifdef CONFIG_CXD56_I2C0
|
||||
ret = board_i2cdev_initialize(0);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/src/cxd56_charger.c
|
||||
*
|
||||
* Copyright 2018 Sony Semiconductor Solutions Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "cxd56_charger.h"
|
||||
|
||||
#if defined(CONFIG_CXD56_CHARGER)
|
||||
|
||||
static int g_chargerinitialized = 0;
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_charger_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register battery charger driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_charger_initialize(FAR const char *devpath, FAR int16_t *gaugemeter)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!g_chargerinitialized)
|
||||
{
|
||||
ret = cxd56_charger_initialize(devpath);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to initialize charger.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
g_chargerinitialized = 1;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_charger_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize and unregister battery charger driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_charger_uninitialize(FAR const char *devpath)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (g_chargerinitialized)
|
||||
{
|
||||
ret = cxd56_charger_uninitialize(devpath);
|
||||
if (ret)
|
||||
{
|
||||
_err("ERROR: Failed to finalize charger.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
g_chargerinitialized = 0;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
/****************************************************************************
|
||||
* configs/spresense/src/cxd56_gauge.c
|
||||
*
|
||||
* Copyright 2018 Sony Semiconductor Solutions Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name of Sony Semiconductor Solutions Corporation nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "cxd56_gauge.h"
|
||||
|
||||
#if defined(CONFIG_CXD56_GAUGE)
|
||||
|
||||
static int g_gaugeinitialized = 0;
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_gauge_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register battery gauge driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_gauge_initialize(FAR const char *devpath, FAR int16_t *gaugemeter)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!g_gaugeinitialized)
|
||||
{
|
||||
ret = cxd56_gauge_initialize(devpath);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to initialize gauge.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
g_gaugeinitialized = 1;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_gauge_uninitialize
|
||||
*
|
||||
* Description:
|
||||
* Uninitialize and unregister battery gauge driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_gauge_uninitialize(FAR const char *devpath)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (g_gaugeinitialized)
|
||||
{
|
||||
ret = cxd56_gauge_uninitialize(devpath);
|
||||
if (ret)
|
||||
{
|
||||
_err("ERROR: Failed to finalize gauge.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
g_gaugeinitialized = 0;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -45,8 +45,6 @@
|
||||
|
||||
#include "cxd56_i2c.h"
|
||||
|
||||
#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_I2C_DRIVER)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_i2cdev_initialize
|
||||
*
|
||||
@@ -79,5 +77,3 @@ int board_i2cdev_initialize(int port)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user