Commit b8fb123f authored by Alessandro Rubini's avatar Alessandro Rubini

kernel/spi: export a vcxo-set function (no technical change)

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent b6d6652a
......@@ -202,6 +202,7 @@ struct fd_dev {
int temp; /* temperature: scaled by 4 bits */
int temp_ready; /* temperature: measurement ready flag */
int verbose;
int current_vcxo_dac;
uint32_t tdc_attrs[FD_ATTR_TDC__LAST - FD_ATTR_DEV__LAST];
uint16_t mcp_iodir, mcp_olat;
struct fd_sw_fifo sw_fifo;
......@@ -314,6 +315,7 @@ static inline void __check_output(int x)
/* Functions exported by spi.c */
extern int fd_spi_xfer(struct fd_dev *fd, int ss, int num_bits,
uint32_t in, uint32_t *out);
extern int fd_spi_set_vcxo(struct fd_dev *fd, int vcxo_dac);
extern int fd_spi_init(struct fd_dev *fd);
extern void fd_spi_exit(struct fd_dev *fd);
......
......@@ -43,12 +43,19 @@ int fd_spi_xfer(struct fd_dev *fd, int ss, int num_bits,
return 0;
}
int fd_spi_set_vcxo(struct fd_dev *fd, int vcxo_dac)
{
vcxo_dac &= 0xffff;
fd_spi_xfer(fd, FD_CS_DAC, 24, vcxo_dac, NULL);
fd->current_vcxo_dac = vcxo_dac;
return vcxo_dac;
}
int fd_spi_init(struct fd_dev *fd)
{
/* write default to DAC for VCXO */
fd_spi_xfer(fd, FD_CS_DAC, 24, fd->calib.vcxo_default_tune & 0xffff,
NULL);
fd_spi_set_vcxo(fd, fd->calib.vcxo_default_tune);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment