soundwire: intel_auxdevice: add kernel parameter for mclk divider
Bard Liao
maintainerPATCH 1/1 soundwire: intel_auxdevice: add kernel parameter for mclk divider
From: Pierre-Louis Bossart <[email protected]>
Add a kernel parameter to work-around discrepancies between hardware and platform firmware, it's not unusual to see e.g. 38.4MHz listed in _DSD properties as the SoundWire clock source, but the hardware may be based on a 19.2 MHz mclk source.
--- drivers/soundwire/intel_auxdevice.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/soundwire/intel_auxdevice.c +10 -2
@@ -41,6 +41,10 @@ static int md_flags;module_param_named (sdw_md_flags, md_flags, int,0444 );MODULE_PARM_DESC (sdw_md_flags,"SoundWire Intel Master device flags (0x0 all off)" ); +static int mclk_divider; +module_param_named (sdw_mclk_divider, mclk_divider, int,0444 ); +MODULE_PARM_DESC (sdw_mclk_divider,"SoundWire Intel mclk divider" ); +struct wake_capable_part {const u16 mfg_id;const u16 part_id;
@@ -142,8 +146,12 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)"intel-sdw-ip-clock" , &prop->mclk_freq); -/* the values reported by BIOS are the 2x clock, not the bus clock */ - prop->mclk_freq /=2 ; +if (mclk_divider) +/* use kernel parameter for BIOS or board work-arounds */ + prop->mclk_freq /= mclk_divider; +else +/* the values reported by BIOS are the 2x clock, not the bus clock */ + prop->mclk_freq /=2 ; fwnode_property_read_u32(link, "intel-quirk-mask",
Signature · 1 line
2.43.0
Vinod Koul
maintainerQuoted 6 lines · Bard Liao
From: Pierre-Louis Bossart <[email protected]>
Add a kernel parameter to work-around discrepancies between hardware and platform firmware, it's not unusual to see e.g. 38.4MHz listed in
_DSDproperties as the SoundWire clock source, but the hardware may be based on a 19.2 MHz mclk source.
I think this should be documented in kernel-parameters.txt?
Quoted 39 lines
Signed-off-by Pierre-Louis Bossart <[email protected]>Signed-off-by Bard Liao <[email protected]>--- drivers/soundwire/intel_auxdevice.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/soundwire/intel_auxdevice.c +10
-2@@ -41,6 +41,10 @@ static int md_flags;module_param_named (sdw_md_flags, md_flags, int,0444 );MODULE_PARM_DESC (sdw_md_flags,"SoundWire Intel Master device flags (0x0 all off)" ); +static int mclk_divider; +module_param_named (sdw_mclk_divider, mclk_divider, int,0444 ); +MODULE_PARM_DESC (sdw_mclk_divider,"SoundWire Intel mclk divider" ); +struct wake_capable_part {const u16 mfg_id;const u16 part_id;@@ -142,8 +146,12 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)"intel-sdw-ip-clock" , &prop->mclk_freq); -/* the values reported by BIOS are the 2x clock, not the bus clock */ - prop->mclk_freq /=2 ; +if (mclk_divider) +/* use kernel parameter for BIOS or board work-arounds */ + prop->mclk_freq /= mclk_divider; +else +/* the values reported by BIOS are the 2x clock, not the bus clock */ + prop->mclk_freq /=2 ; fwnode_property_read_u32(link, "intel-quirk-mask",Signature · 1 line
2.43.0
Signature · 1 line
~Vinod
Quoted 12 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Sunday, August 18, 2024 3:24 PM
To: Bard Liao <[email protected]>
Cc: [email protected]; [email protected]; pierre- [email protected]; Liao, Bard <[email protected]>
Subject: Re: [PATCH] soundwire:intel_auxdevice: add kernel parameter for mclk dividerOn 06-08-24, 16:38, Bard Liao wrote:
Quoted 8 lines
Quoted 6 lines
From: Pierre-Louis Bossart <[email protected]>
Add a kernel parameter to work-around discrepancies between hardware and platform firmware, it's not unusual to see e.g. 38.4MHz listed in
_DSDproperties as the SoundWire clock source, but the hardware may be based on a 19.2 MHz mclk source.I think this should be documented in kernel-parameters.txt?
The parameter is only needed when a BIOS provides a MCLK rate which does not match the actual rate. It is not a normal case and it happens rarely. Is it really necessary to be documented in kernel-parameters.txt?
Quoted 47 lines
Review
Quoted 9 lines
Signed-off-by Pierre-Louis Bossart <[email protected]>Signed-off-by Bard Liao <[email protected]>--- drivers/soundwire/intel_auxdevice.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/soundwire/intel_auxdevice.cdrivers/soundwire/intel_auxdevice.c static int md_flags; · line 42
Quoted 6 lines
index
dff49c5ce5b3..e372195b07b3100644drivers/soundwire/intel_auxdevice.c +0
-0@@ -41,6 +41,10 @@ static int md_flags;module_param_named (sdw_md_flags, md_flags, int,0444 ); MODULE_PARM_DESC(sdw_md_flags, "SoundWire Intel Master device flags(
0x0all off)");drivers/soundwire/intel_auxdevice.c static int sdw_master_read_intel_prop(struct
Quoted 9 lines
drivers/soundwire/intel_auxdevice.c +4
-0+static int mclk_divider; +module_param_named (sdw_mclk_divider, mclk_divider, int,0444 ); +MODULE_PARM_DESC (sdw_mclk_divider,"SoundWire Intel mclk divider" ); +struct wake_capable_part {const u16 mfg_id;const u16 part_id;@@ -142,8 +146,12 @@ static int sdw_master_read_intel_prop(struct
sdw_bus*bus)drivers/soundwire/intel_auxdevice.c static int sdw_master_read_intel_prop(struct sdw_bus *bus)
Quoted 10 lines
drivers/soundwire/intel_auxdevice.c +5
-2"intel-sdw-ip-clock" , &prop->mclk_freq); -/* the values reported by BIOS are the 2x clock, not the bus clock */ - prop->mclk_freq /=2 ; +if (mclk_divider) +/* use kernel parameter for BIOS or board work-arounds */ + prop->mclk_freq /= mclk_divider; +else +/* the values reported by BIOS are the 2x clock, not the bus clock */
Quoted 6 lines
drivers/soundwire/intel_auxdevice.c +1
-1+ prop->mclk_freq /=2 ; fwnode_property_read_u32(link, "intel-quirk-mask", --2.43.0
--
~Vinod
Vinod Koul
maintainerQuoted 19 lines · Bard
Quoted 19 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Sunday, August 18, 2024 3:24 PM
To: Bard Liao <[email protected]>
Cc: [email protected]; [email protected]; pierre- [email protected]; Liao, Bard <[email protected]>
Subject: Re: [PATCH] soundwire:intel_auxdevice: add kernel parameter for mclk dividerQuoted 6 lines · Bard Liao
From: Pierre-Louis Bossart <[email protected]>
Add a kernel parameter to work-around discrepancies between hardware and platform firmware, it's not unusual to see e.g. 38.4MHz listed in
_DSDproperties as the SoundWire clock source, but the hardware may be based on a 19.2 MHz mclk source.
Quoted 5 lines
Quoted 1 line
I think this should be documented in kernel-parameters.txt?
The parameter is only needed when a BIOS provides a MCLK rate which does not match the actual rate. It is not a normal case and it happens rarely. Is it really necessary to be documented in kernel-parameters.txt?
Yes I think so, all of the parameters are supposed to be documented :-)
Signature · 1 line
~Vinod