soundwire: Intel: support more then 1 sdw bus clock frequency
Bard Liao
maintainercover soundwire: Intel: support more then 1 sdw bus clock frequency
This series set frame shape and divider based on actual clk freq to support dynamic clock change. The revert the commit that limits Intel platform to use fixed clock frequency.
Bard Liao (2):
soundwire: cadence_master: set frame shape and divider based on actual
clk freq
Revert "soundwire: intel_auxdevice: start the bus at default
frequency"
drivers/soundwire/cadence_master.c | 22 +++++++++++++++++++--- drivers/soundwire/intel_auxdevice.c | 21 --------------------- 2 files changed, 19 insertions(+), 24 deletions(-)
Signature · 1 line
2.43.0
Bard Liao
maintainerPATCH 1/2 soundwire: cadence_master: set frame shape and divider based on actual clk freq
Frame shape and curr_dr_freq could be updated by sdw_compute_bus_params(). Peripherals will set curr_dr_freq as their frequency. Managers should do the same. Then update frame shape according to the actual bus frequency.
--- drivers/soundwire/cadence_master.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/soundwire/cadence_master.c +19 -3
@@ -1343,7 +1343,7 @@ static u32 cdns_set_initial_frame_shape(int n_rows, int n_cols)return val; } -static void cdns_init_clock_ctrl (struct sdw_cdns *cdns) +static int cdns_init_clock_ctrl (struct sdw_cdns *cdns) {struct sdw_bus *bus = &cdns->bus;struct sdw_master_prop *prop = &bus->prop;
@@ -1357,14 +1357,25 @@ static void cdns_init_clock_ctrl(struct sdw_cdns *cdns) prop->default_row, prop->default_col); +if (!prop->default_frame_rate || !prop->default_row) { +dev_err (cdns->dev,"Default frame_rate %d or row %d is invalid\n" , + prop->default_frame_rate, prop->default_row); +return -EINVAL ; + } +/* Set clock divider */ - divider = (prop->mclk_freq / prop->max_clk_freq) -1 ; + divider = (prop->mclk_freq *SDW_DOUBLE_RATE_FACTOR / + bus->params.curr_dr_freq) -1 ;cdns_updatel (cdns,CDNS_MCP_CLK_CTRL0 ,CDNS_MCP_CLK_MCLKD_MASK , divider);cdns_updatel (cdns,CDNS_MCP_CLK_CTRL1 ,CDNS_MCP_CLK_MCLKD_MASK , divider); +/* Set frame shape base on the actual bus frequency. */ + prop->default_col = bus->params.curr_dr_freq / + prop->default_frame_rate / prop->default_row; +/* * Frame shape changes after initialization have to be done * with the bank switch mechanism
@@ -1377,6 +1388,8 @@ static void cdns_init_clock_ctrl(struct sdw_cdns *cdns) ssp_interval = prop->default_frame_rate /SDW_CADENCE_GSYNC_HZ ;cdns_writel (cdns,CDNS_MCP_SSP_CTRL0 , ssp_interval);cdns_writel (cdns,CDNS_MCP_SSP_CTRL1 , ssp_interval); + +return 0 ; }/**
@@ -1410,9 +1423,12 @@ EXPORT_SYMBOL(sdw_cdns_soft_reset);*/ int sdw_cdns_init (struct sdw_cdns *cdns) { +int ret;u32 val; -cdns_init_clock_ctrl (cdns); + ret =cdns_init_clock_ctrl (cdns); +if (ret) +return ret;sdw_cdns_check_self_clearing_bits (cdns, __func__, false,0 );
Signature · 1 line
2.43.0
Bard Liao
maintainerPATCH 2/2 Revert "soundwire: intel_auxdevice: start the bus at default frequency"
In reply to Bard LiaoNow, we can support more than 1 soundwire bus clock frequency.
This reverts commit c326356188f1dc2d7a2c55b30dac6a8b76087bc6.
--- drivers/soundwire/intel_auxdevice.c | 21 --------------------- 1 file changed, 21 deletions(-)
drivers/soundwire/intel_auxdevice.c +0 -21
@@ -243,30 +243,9 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)static int intel_prop_read (struct sdw_bus *bus) { -struct sdw_master_prop *prop; -/* Initialize with default handler to read all DisCo properties */ sdw_master_read_prop (bus); -/* -* Only one bus frequency is supported so far, filter -* frequencies reported in the DSDT -*/ - prop = &bus->prop; -if (prop->clk_freq && prop->num_clk_freq >1 ) { -unsigned int default_bus_frequency; - - default_bus_frequency = - prop->default_frame_rate * - prop->default_row * - prop->default_col / -SDW_DOUBLE_RATE_FACTOR ; - - prop->num_clk_freq =1 ; - prop->clk_freq[0 ] = default_bus_frequency; - prop->max_clk_freq = default_bus_frequency; - } -/* read Intel-specific properties */ sdw_master_read_intel_prop (bus);
Signature · 1 line
2.43.0
Vinod Koul
maintainerRe: [PATCH 2/2] Revert "soundwire: intel_auxdevice: start the bus at default frequency"
Quoted 3 lines · Bard Liao
Now, we can support more than 1 soundwire bus clock frequency.
This reverts commit
c326356188f1dc2d7a2c55b30dac6a8b76087bc6.
Pls use full patch title and not just the sha
Quoted 45 lines
Signed-off-by Bard Liao <[email protected]>Reviewed-by Ranjani Sridharan <[email protected]>Reviewed-by Péter Ujfalusi <[email protected]>--- drivers/soundwire/intel_auxdevice.c | 21 --------------------- 1 file changed, 21 deletions(-)drivers/soundwire/intel_auxdevice.c +0
-21@@ -243,30 +243,9 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)static int intel_prop_read (struct sdw_bus *bus) { -struct sdw_master_prop *prop; -/* Initialize with default handler to read all DisCo properties */ sdw_master_read_prop (bus); -/* -* Only one bus frequency is supported so far, filter -* frequencies reported in the DSDT -*/ - prop = &bus->prop; -if (prop->clk_freq && prop->num_clk_freq >1 ) { -unsigned int default_bus_frequency; - - default_bus_frequency = - prop->default_frame_rate * - prop->default_row * - prop->default_col / -SDW_DOUBLE_RATE_FACTOR ; - - prop->num_clk_freq =1 ; - prop->clk_freq[0 ] = default_bus_frequency; - prop->max_clk_freq = default_bus_frequency; - } -/* read Intel-specific properties */ sdw_master_read_intel_prop (bus);Signature · 1 line
2.43.0
Signature · 1 line
~Vinod
Quoted 9 lines · Bard Liao
This series set frame shape and divider based on actual clk freq to support dynamic clock change. The revert the commit that limits Intel platform to use fixed clock frequency.
Bard Liao (2):
soundwire:cadence_master: set frame shape and divider based on actual
clk freq
Revert "soundwire:intel_auxdevice: start the bus at default
frequency"
Quoted 4 lines
drivers/soundwire/cadence_master.c | 22 +++++++++++++++++++--- drivers/soundwire/intel_auxdevice.c | 21 --------------------- 2 files changed, 19 insertions(+), 24 deletions(-)
Quoted 11 lines · Bard Liao
This series set frame shape and divider based on actual clk freq to support dynamic clock change. The revert the commit that limits Intel platform to use fixed clock frequency.
Bard Liao (2):
soundwire:cadence_master: set frame shape and divider based on actual
clk freq
Revert "soundwire:intel_auxdevice: start the bus at default
frequency"[...]
Applied, thanks!
[1/2] soundwire: cadence_master: set frame shape and divider based on actual clk freq
commit: e738d77f78b3ac085dfb51be414e93464abba7ec
[2/2] Revert "soundwire: intel_auxdevice: start the bus at default frequency"
commit: d38ea972da679f223ae1e761080e37dd8b582bacBest regards,
Signature · 1 line
~Vinod