-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CS47L63 driver #3232
Add CS47L63 driver #3232
Conversation
Currently only files for CS47L63 can be taken to build Signed-off-by: Jerzy Kasenberg <[email protected]>
f4f09a6
to
78ccc58
Compare
* @param regs - zero terminated array of registers to write | ||
* @return 0 on success, non-zero on failure | ||
*/ | ||
uint32_t cs47l63_write_regs(struct cs47l63_dev *dev, const struct reg_val_pair regs[]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could return int (few others too) to be consistent with other functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is consistent with functions provided by CirrusLogic that can be seen in cs47l63.h
/*
* Writes the contents of a single register/memory address
*
* @param [in] driver Pointer to the driver state
* @param [in] addr Address of the register to be written
* @param [in] val Value to be written to the register
*
* @return
* - CS47L63_STATUS_FAIL if:
* - Control port activity fails
* - otherwise, returns CS47L63_STATUS_OK
*
*/
uint32_t cs47l63_write_reg(cs47l63_t *driver, uint32_t addr, uint32_t val);
*/ | ||
uint32_t cs47l63_reg_write(struct cs47l63_dev *dev, uint32_t reg, uint32_t val); | ||
|
||
int cs47l63_create_dev(struct cs47l63_dev *dev, const char *name, const struct cs47l63_create_cfg *cfg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: this one is missing comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments added
int | ||
cs47l63_asp1_config(struct cs47l63_dev *dev, uint32_t sample_freq, uint32_t slot_bits, uint32_t slots) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
.syscfg_regs_total = CS47L63_SYSCFG_REGS_TOTAL * 0, | ||
}; | ||
|
||
struct cs47l63_create_cfg cs47l63_0_cfg = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
#if MYNEWT_VAL(CS47L63_0) | ||
cs47l63_config_t cs47l63_0_config = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
int | ||
cs47l63_config_fll1_from_bclk(struct cs47l63_dev *dev, uint32_t sample_freq, uint32_t slot_bits, uint32_t slots) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
assert(0); | ||
return -1; | ||
} | ||
CS47L63_LOG_INFO("ASP1 LRCLK=%d BCLK=%d\n", sample_freq, bclk_freq_for_asp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CS47L63_LOG_INFO("ASP1 LRCLK=%d BCLK=%d\n", sample_freq, bclk);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
78ccc58
to
f6ca19c
Compare
f6ca19c
to
4130d61
Compare
For now driver allows to configure CS47L63 so it can receive I2S data stream on ASP1 pins. Basic functions for volume control and mute on OUT1 pin are provided. Signed-off-by: Jerzy Kasenberg <[email protected]>
4130d61
to
4bbbd2c
Compare
This adds: