drivers: adc: siwx91x: ADC clock initialization for siwx91x

Clock driver changes required for initializing the ADC clock
for the siwx91x driver

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
This commit is contained in:
Sai Santhosh Malae 2025-05-19 20:49:56 +05:30 committed by Benjamin Cabé
commit 6d5e217262
2 changed files with 14 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include "rsi_rom_clks.h"
#include "rsi_sysrtc.h"
#include "rsi_pll.h"
#include "rsi_adc.h"
#include "clock_update.h"
#include "sl_si91x_clock_manager.h"
@ -103,6 +104,9 @@ static int siwx91x_clock_on(const struct device *dev, clock_control_subsys_t sys
ULPCLK->ULP_I2S_CLK_GEN_REG_b.ULP_I2S_MASTER_SLAVE_MODE_b = 1;
RSI_ULPSS_PeripheralEnable(ULPCLK, ULP_I2S_CLK, ENABLE_STATIC_CLK);
break;
case SIWX91X_ADC_CLK:
RSI_ADC_PowerControl(ADC_POWER_ON);
break;
default:
return -EINVAL;
}
@ -138,6 +142,9 @@ static int siwx91x_clock_off(const struct device *dev, clock_control_subsys_t sy
case SIWX91X_CLK_STATIC_ULP_I2S:
RSI_ULPSS_PeripheralDisable(ULPCLK, ULP_I2S_CLK);
break;
case SIWX91X_ADC_CLK:
RSI_ADC_PowerControl(ADC_POWER_OFF);
break;
case SIWX91X_CLK_ULP_UART:
case SIWX91X_CLK_I2C0:
case SIWX91X_CLK_I2C1:
@ -185,6 +192,9 @@ static int siwx91x_clock_get_rate(const struct device *dev, clock_control_subsys
static int siwx91x_clock_set_rate(const struct device *dev, clock_control_subsys_t sys,
clock_control_subsys_rate_t rate)
{
ARG_UNUSED(dev);
int div_numerator = FIELD_GET(0xFFFF0000, *(uint32_t *)rate);
int div_denominator = FIELD_GET(0x0000FFFF, *(uint32_t *)rate);
uintptr_t clockid = (uintptr_t)sys;
ULP_I2S_CLK_SELECT_T ref_clk;
uint32_t freq;
@ -203,6 +213,9 @@ static int siwx91x_clock_set_rate(const struct device *dev, clock_control_subsys
return -EIO;
}
return 0;
case SIWX91X_ADC_CLK:
RSI_ADC_ClkDivfactor(AUX_ADC_DAC_COMP, div_numerator, div_denominator);
return 0;
default:
/* For now, no other driver need clock rate */
return -EINVAL;

View file

@ -21,5 +21,6 @@
#define SIWX91X_CLK_STATIC_I2S0 14
#define SIWX91X_CLK_ULP_I2S 15
#define SIWX91X_CLK_STATIC_ULP_I2S 16
#define SIWX91X_ADC_CLK 17
#endif