bsp: cvitek: add support for RTCSYS_SARADC
Cvitek adc dirver only supports one adc controller now, but the other adc controller RTCSYS_SARADC is missing. Signed-off-by: Shicheng Chu <1468559561@qq.com> Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
This commit is contained in:
parent
4633200e98
commit
dc95efe17c
|
@ -68,10 +68,18 @@ struct cvi_adc_dev
|
||||||
|
|
||||||
static struct cvi_adc_dev adc_dev_config[] =
|
static struct cvi_adc_dev adc_dev_config[] =
|
||||||
{
|
{
|
||||||
|
#ifdef BSP_USING_ADC_ACTIVE
|
||||||
{
|
{
|
||||||
.name = "adc1",
|
.name = "adc1",
|
||||||
.base = SARADC_BASE
|
.base = SARADC_BASE
|
||||||
},
|
},
|
||||||
|
#endif /* BSP_USING_ADC_ACTIVE */
|
||||||
|
#ifdef BSP_USING_ADC_NODIE
|
||||||
|
{
|
||||||
|
.name = "adc2",
|
||||||
|
.base = RTC_ADC_BASE
|
||||||
|
},
|
||||||
|
#endif /* BSP_USING_ADC_NODIE */
|
||||||
};
|
};
|
||||||
|
|
||||||
static rt_err_t _adc_enabled(struct rt_adc_device *device, rt_int8_t channel, rt_bool_t enabled)
|
static rt_err_t _adc_enabled(struct rt_adc_device *device, rt_int8_t channel, rt_bool_t enabled)
|
||||||
|
@ -151,8 +159,6 @@ static const struct rt_adc_ops _adc_ops =
|
||||||
* cv180xb supports
|
* cv180xb supports
|
||||||
* - adc1 & adc2 for active domain
|
* - adc1 & adc2 for active domain
|
||||||
* - adc3 for no-die domain
|
* - adc3 for no-die domain
|
||||||
*
|
|
||||||
* FIXME: currnet adc driver only support adc1 in active domain
|
|
||||||
*/
|
*/
|
||||||
#ifdef BSP_USING_ADC_ACTIVE
|
#ifdef BSP_USING_ADC_ACTIVE
|
||||||
static const char *pinname_whitelist_adc1_active[] = {
|
static const char *pinname_whitelist_adc1_active[] = {
|
||||||
|
@ -169,12 +175,15 @@ static const char *pinname_whitelist_adc3_active[] = {
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC_NODIE
|
#ifdef BSP_USING_ADC_NODIE
|
||||||
static const char *pinname_whitelist_adc1_nodie[] = {
|
static const char *pinname_whitelist_adc1_nodie[] = {
|
||||||
|
"PWR_GPIO2",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static const char *pinname_whitelist_adc2_nodie[] = {
|
static const char *pinname_whitelist_adc2_nodie[] = {
|
||||||
|
"PWR_GPIO1",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static const char *pinname_whitelist_adc3_nodie[] = {
|
static const char *pinname_whitelist_adc3_nodie[] = {
|
||||||
|
"PWR_VBAT_DET",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -185,8 +194,6 @@ static const char *pinname_whitelist_adc3_nodie[] = {
|
||||||
* sg2002 supports
|
* sg2002 supports
|
||||||
* - adc1 for active domain
|
* - adc1 for active domain
|
||||||
* - adc1/adc2/adc3 for no-die domain
|
* - adc1/adc2/adc3 for no-die domain
|
||||||
*
|
|
||||||
* FIXME: currnet adc driver only support adc1 in active domain
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC_ACTIVE
|
#ifdef BSP_USING_ADC_ACTIVE
|
||||||
|
@ -204,12 +211,15 @@ static const char *pinname_whitelist_adc3_active[] = {
|
||||||
|
|
||||||
#ifdef BSP_USING_ADC_NODIE
|
#ifdef BSP_USING_ADC_NODIE
|
||||||
static const char *pinname_whitelist_adc1_nodie[] = {
|
static const char *pinname_whitelist_adc1_nodie[] = {
|
||||||
|
"PWR_GPIO2",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static const char *pinname_whitelist_adc2_nodie[] = {
|
static const char *pinname_whitelist_adc2_nodie[] = {
|
||||||
|
"PWR_GPIO1",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
static const char *pinname_whitelist_adc3_nodie[] = {
|
static const char *pinname_whitelist_adc3_nodie[] = {
|
||||||
|
"PWR_VBAT_DET",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "mmio.h"
|
#include "mmio.h"
|
||||||
|
|
||||||
#define SARADC_BASE 0x030F0000
|
#define SARADC_BASE 0x030F0000
|
||||||
|
#define RTC_ADC_BASE 0x0502C000
|
||||||
#define SARADC_CH_MAX 3
|
#define SARADC_CH_MAX 3
|
||||||
|
|
||||||
#define SARADC_CTRL_OFFSET 0x04
|
#define SARADC_CTRL_OFFSET 0x04
|
||||||
|
|
Loading…
Reference in New Issue