Skip to content
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

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Add CS47L63 driver #3232

merged 2 commits into from
Oct 21, 2024

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented May 24, 2024

This adds:

  • package with repository from CirrusLogic github for audio chip drivers
  • driver that can configure CS47L63 for I2S usage

Currently only files for CS47L63 can be taken to build

Signed-off-by: Jerzy Kasenberg <[email protected]>
@kasjer kasjer force-pushed the kasjer/cs47l63 branch 2 times, most recently from f4f09a6 to 78ccc58 Compare May 24, 2024 13:11
* @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[]);
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments added

Comment on lines 596 to 597
int
cs47l63_asp1_config(struct cs47l63_dev *dev, uint32_t sample_freq, uint32_t slot_bits, uint32_t slots)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

Copy link
Contributor Author

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 = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

Copy link
Contributor Author

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 = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +477 to +478
int
cs47l63_config_fll1_from_bclk(struct cs47l63_dev *dev, uint32_t sample_freq, uint32_t slot_bits, uint32_t slots)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

Copy link
Contributor Author

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);
Copy link
Contributor

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);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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]>
@kasjer kasjer merged commit 587cad2 into apache:master Oct 21, 2024
19 checks passed
@kasjer kasjer deleted the kasjer/cs47l63 branch October 21, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants