* [PATCH] soundwire: intel_auxdevice: add kernel parameter for mclk divider
@ 2024-08-06 8:38 Bard Liao
2024-08-18 7:23 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Bard Liao @ 2024-08-06 8:38 UTC (permalink / raw)
To: linux-sound, vkoul
Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
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.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/intel_auxdevice.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index dff49c5ce5b3..e372195b07b3 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -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",
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] soundwire: intel_auxdevice: add kernel parameter for mclk divider
2024-08-06 8:38 [PATCH] soundwire: intel_auxdevice: add kernel parameter for mclk divider Bard Liao
@ 2024-08-18 7:23 ` Vinod Koul
2024-08-19 8:13 ` Liao, Bard
0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2024-08-18 7:23 UTC (permalink / raw)
To: Bard Liao; +Cc: linux-sound, linux-kernel, pierre-louis.bossart, bard.liao
On 06-08-24, 16:38, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>
> 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.
I think this should be documented in kernel-parameters.txt?
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
> drivers/soundwire/intel_auxdevice.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
> index dff49c5ce5b3..e372195b07b3 100644
> --- a/drivers/soundwire/intel_auxdevice.c
> +++ b/drivers/soundwire/intel_auxdevice.c
> @@ -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",
> --
> 2.43.0
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread* RE: [PATCH] soundwire: intel_auxdevice: add kernel parameter for mclk divider
2024-08-18 7:23 ` Vinod Koul
@ 2024-08-19 8:13 ` Liao, Bard
2024-10-03 8:00 ` Vinod Koul
0 siblings, 1 reply; 4+ messages in thread
From: Liao, Bard @ 2024-08-19 8:13 UTC (permalink / raw)
To: Vinod Koul, Bard Liao
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
pierre-louis.bossart@linux.intel.com
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: Sunday, August 18, 2024 3:24 PM
> To: Bard Liao <yung-chuan.liao@linux.intel.com>
> Cc: linux-sound@vger.kernel.org; linux-kernel@vger.kernel.org; pierre-
> louis.bossart@linux.intel.com; Liao, Bard <bard.liao@intel.com>
> Subject: Re: [PATCH] soundwire: intel_auxdevice: add kernel parameter for
> mclk divider
>
> On 06-08-24, 16:38, Bard Liao wrote:
> > From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> >
> > 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.
>
> 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?
>
> >
> > Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> > ---
> > drivers/soundwire/intel_auxdevice.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/soundwire/intel_auxdevice.c
> b/drivers/soundwire/intel_auxdevice.c
> > index dff49c5ce5b3..e372195b07b3 100644
> > --- a/drivers/soundwire/intel_auxdevice.c
> > +++ b/drivers/soundwire/intel_auxdevice.c
> > @@ -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",
> > --
> > 2.43.0
>
> --
> ~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] soundwire: intel_auxdevice: add kernel parameter for mclk divider
2024-08-19 8:13 ` Liao, Bard
@ 2024-10-03 8:00 ` Vinod Koul
0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2024-10-03 8:00 UTC (permalink / raw)
To: Liao, Bard
Cc: Bard Liao, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org,
pierre-louis.bossart@linux.intel.com
On 19-08-24, 08:13, Liao, Bard wrote:
>
>
> > -----Original Message-----
> > From: Vinod Koul <vkoul@kernel.org>
> > Sent: Sunday, August 18, 2024 3:24 PM
> > To: Bard Liao <yung-chuan.liao@linux.intel.com>
> > Cc: linux-sound@vger.kernel.org; linux-kernel@vger.kernel.org; pierre-
> > louis.bossart@linux.intel.com; Liao, Bard <bard.liao@intel.com>
> > Subject: Re: [PATCH] soundwire: intel_auxdevice: add kernel parameter for
> > mclk divider
> >
> > On 06-08-24, 16:38, Bard Liao wrote:
> > > From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > >
> > > 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.
> >
> > 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 :-)
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-03 8:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06 8:38 [PATCH] soundwire: intel_auxdevice: add kernel parameter for mclk divider Bard Liao
2024-08-18 7:23 ` Vinod Koul
2024-08-19 8:13 ` Liao, Bard
2024-10-03 8:00 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox