Add a very basic driver for the CS2100-CP Fractional-N Multipler chip.

This commit is contained in:
Gregory Nutt
2015-04-02 13:00:10 -06:00
parent 06866bb2c5
commit e78e762dd6
7 changed files with 964 additions and 3 deletions
+1 -1
View File
@@ -3832,7 +3832,7 @@ void lpwork_restorepriority(uint8_t reqprio);
</p>
<p>
<code>boardctl()</code> is <i>non-standard</i> OS interface to alleviate the problem.
It basically circumvents the normal device driver <code>ioctl()</code> interlace and allows the application to perform direction IOCTL-like calls to the board-specific logic.
It basically circumvents the normal device driver <code>ioctl()</code> interlace and allows the application to perform direct IOCTL-like calls to the board-specific logic.
It is especially useful for setting up board operational and test configurations.
</p>
<p>
+15
View File
@@ -716,6 +716,21 @@ WM8904 Audio Codec
PD26 TD DACDAT Digital audio input (headphone)
---- ------------ ------- ----------------------------------
CP2100-CP Fractional-N Clock Multiplier
--------------------------------------
SAMV71 Interface CP2100-CP Interface
---- ------------ ------- ----------------------------------
PIO Usage Pin Function
---- ------------ ------- ----------------------------------
PA3 TWD0 SDA I2C control interface, data line
PA4 TWCK0 SCLK I2C control interface, clock line
PD21 TIOA11 CLK_IN PLL input
- - XTI/XTO 12.0MHz crystal
PA22 RK CLK_OUT PLL output
- - AUX_OUT N/C
---- ------------ ------- ----------------------------------
maXTouch Xplained Pro
=====================
+20
View File
@@ -3,6 +3,8 @@
# see misc/tools/kconfig-language.txt.
#
menu "Timer Driver Support"
menuconfig TIMER
bool "Timer Support"
default n
@@ -132,3 +134,21 @@ config WATCHDOG_DEVPATH
default "/dev/watchdog0"
endif # WATCHDOG
config TIMERS_CS2100CP
bool "CS2100-CP Fraction-N Clock Multiplier"
depends on I2C
select I2C_TRANSFER
if TIMERS_CS2100CP
config CS2100CP_DEBUG
bool "Enable CS2100-CP Debug Features"
depends on DEBUG
config CS2100CP_REGDEBUG
bool "Enable CS2100-CP Register Debug"
depends on DEBUG
endif # TIMERS_CS2100CP
endmenu # Timer Driver Support
+6
View File
@@ -57,6 +57,12 @@ ifeq ($(CONFIG_RTC_DRIVER),y)
TMRVPATH = :timers
endif
ifeq ($(CONFIG_TIMERS_CS2100CP),y)
CSRCS += cs2100-cp.c
TMRDEPPATH = --dep-path timers
TMRVPATH = :timers
endif
# Include timer build support (if any were selected)
DEPPATH += $(TMRDEPPATH)
+836
View File
File diff suppressed because it is too large Load Diff
+85 -1
View File
@@ -45,9 +45,29 @@
#include <stdint.h>
#include <nuttx/i2c.h>
#ifdef CONFIG_TIMERS_CS2100CP
/********************************************************************************************
* Pre-processor Definitions
********************************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_I2C
# error I2C driver support is required (CONFIG_I2C)
#else
# ifndef CONFIG_I2C_TRANSFER
# error I2C transfer method is required (CONFIG_I2C_TRANSFER)
# endif
#endif
#ifndef CONFIG_TIMERS_CS2100CP_CLKINBW
# define CONFIG_TIMERS_CS2100CP_CLKINBW 16
#endif
#ifndef CONFIG_DEBUG
# undef CONFIG_CS2100CP_DEBUG
# undef CONFIG_CS2100CP_REGDEBUG
#endif
/* Register Addresses ***********************************************************************/
@@ -77,7 +97,7 @@
#define CS2100_DEVCTL_CLKOUTDIS (1 << 0) /* Bit 0: CLK_OUT disable */
#define CS2100_DEVCTL_AUXOUTDIS (1 << 1) /* Bit 1: AUX_OUT disable */
#define CS2100_DEVCTL_UNLOCK (1 << 31) /* Bit 31: Unlock PLL */
#define CS2100_DEVCTL_UNLOCK (1 << 7) /* Bit 7: Unlock PLL */
/* Device Configuration 1 */
@@ -141,6 +161,17 @@
* Public Types
********************************************************************************************/
struct cs2100_config_s
{
FAR struct i2c_dev_s *i2c; /* Instance of an I2C interface */
uint32_t refclk; /* RefClk/XTAL frequency */
uint32_t clkin; /* Frequency CLK_IN provided to the CS2100-CP */
uint32_t clkout; /* Desired CLK_OUT frequency */
uint8_t i2caddr; /* CP2100-CP I2C address */
uint8_t loopbw; /* Minimum loop bandwidth: 1-128 */
bool xtal; /* false: Refclck, true: Crystal on XTI/XTO */
};
/********************************************************************************************
* Public Data
********************************************************************************************/
@@ -157,9 +188,62 @@ extern "C"
* Public Function Prototypes
********************************************************************************************/
struct i2c_dev_s; /* Forward reference */
/********************************************************************************************
* Name: cs2100_enable
*
* Description:
* Enable CS2100 CLK_OUT using the provide parameters
*
* Input Parameters:
* config - CS2100-CP configuration
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
********************************************************************************************/
int cs2100_enable(FAR const struct cs2100_config_s *config);
/********************************************************************************************
* Name: cs2100_disable
*
* Description:
* Disable CS2100 CLK_OUT
*
* Input Parameters:
* config - CS2100-CP configuration (Needed only for I2C access: i2c and i2caddr)
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
********************************************************************************************/
int cs2100_disable(FAR const struct cs2100_config_s *config);
/********************************************************************************************
* Name: cs2100_dump
*
* Description:
* Dump CS2100-CP registers to the SysLog
*
* Input Parameters:
* config - CS2100-CP configuration (Needed only for I2C access: i2c and i2caddr)
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
********************************************************************************************/
#ifdef CONFIG_CS2100CP_DEBUG
int cs2100_dump(FAR const struct cs2100_config_s *config);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_TIMERS_CS2100CP */
#endif /* __INCLUDE_NUTTX_TIMERS_CS2100_CP_H */
+1 -1
View File
@@ -147,7 +147,7 @@ struct boardioc_graphics_s
*
* boardctl() is non-standard OS interface to alleviate the problem. It
* basically circumvents the normal device driver ioctl interlace and allows
* the application to perform direction IOCTL-like calls to the board-specific
* the application to perform direct IOCTL-like calls to the board-specific
* logic. It is especially useful for setting up board operational and
* test configurations.
*