drivers: i2s: i2s_ll_stm32: Handle single clock source
Modify the function "i2s_stm32_set_clock" to handle the case where pclk_len it is not greater then 1 and to ensure that the freq_in variable is correctly set in both cases. Signed-off-by: IBEN EL HADJ MESSAOUD Marwa <marwa.ibenelhadjmessaoud-ext@st.com>
This commit is contained in:
parent
630faa1592
commit
2353b9391b
1 changed files with 9 additions and 0 deletions
|
|
@ -139,12 +139,21 @@ static int i2s_stm32_set_clock(const struct device *dev,
|
|||
uint8_t i2s_div, i2s_odd;
|
||||
|
||||
if (cfg->pclk_len > 1) {
|
||||
/* Handle multiple clock sources */
|
||||
if (clock_control_get_rate(DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE),
|
||||
(clock_control_subsys_t)&cfg->pclken[1],
|
||||
&freq_in) < 0) {
|
||||
LOG_ERR("Failed call clock_control_get_rate(pclken[1])");
|
||||
return -EIO;
|
||||
}
|
||||
} else {
|
||||
/* Handle single clock source */
|
||||
if (clock_control_get_rate(DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE),
|
||||
(clock_control_subsys_t)&cfg->pclken[0],
|
||||
&freq_in) < 0) {
|
||||
LOG_ERR("Failed call clock_control_get_rate(pclken[0])");
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The ratio between input clock (I2SxClk) and output
|
||||
|
|
|
|||
Loading…
Reference in a new issue