platform/x86: int3472: Use actual clock frequency for DSM method
PATCH v2 1/1 platform/x86: int3472: Use actual clock frequency for DSM method
The third argument (args[2]) to the _DSM method was hardcoded to 1, which corresponds to 19.2MHz. However, this argument should reflect the actual clock frequency from the sensor's ACPI data.
According to the DSM specification:
- 1 = 19.2MHz
- 3 = 24MHz
Read the frequency from clk->frequency and set the DSM argument accordingly, with 19.2MHz as the default for unsupported frequencies.
This ensures the sensor receives the correct clock frequency as specified in its ACPI configuration.
--- .../x86/intel/int3472/clk_and_regulator.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/int3472/clk_and_regulator.c +20 -1
@@ -19,23 +19,42 @@ static const guid_t img_clk_guid =GUID_INIT (0x82c0d13a ,0x78c5 ,0x4244 ,0x9b ,0xb1 ,0xeb ,0x8b ,0x53 ,0x9a ,0x8d ,0x11 ); +/* +* The PCH clock frequency argument to the _DSM method: +* PCH_CLK_FREQ_19M2 = 19.2MHz (default) +* PCH_CLK_FREQ_24M = 24MHz +*/ +#define PCH_CLK_FREQ_19M2 1 +#define PCH_CLK_FREQ_24M 3 +static void skl_int3472_enable_clk (struct int3472_clock *clk,int enable) {struct int3472_discrete_device *int3472 =to_int3472_device (clk);union acpi_object args[3 ];union acpi_object argv4; +u32 dsm_freq_arg;if (clk->ena_gpio) {gpiod_set_value_cansleep (clk->ena_gpio, enable);return ; } +switch (clk->frequency) { +case 24000000 : + dsm_freq_arg =PCH_CLK_FREQ_24M ; +break ; +case 19200000 : +default : + dsm_freq_arg =PCH_CLK_FREQ_19M2 ; +break ; + } + args[0 ].integer.type =ACPI_TYPE_INTEGER ; args[0 ].integer.value = clk->imgclk_index; args[1 ].integer.type =ACPI_TYPE_INTEGER ; args[1 ].integer.value = enable; args[2 ].integer.type =ACPI_TYPE_INTEGER ; - args[2 ].integer.value =1 ; + args[2 ].integer.value = dsm_freq_arg; argv4.type =ACPI_TYPE_PACKAGE ; argv4.package.count =3 ;
Signature · 1 line
2.43.0
Morning Hao, thanks for the patch
Quoted 8 lines · Hao Yao
The third argument (args[2]) to the
_DSMmethod was hardcoded to 1, which corresponds to 19.2MHz. However, this argument should reflect the actual clock frequency from the sensor's ACPI data.According to the DSM specification:
- 1 = 19.2MHz
- 3 = 24MHz
Quoted 7 lines
Read the frequency from
clk->frequencyand set the DSM argument accordingly, with 19.2MHz as the default for unsupported frequencies.This ensures the sensor receives the correct clock frequency as specified in its ACPI configuration.
Signed-off-by Hao Yao <[email protected]>
Quoted 52 lines
--- .../x86/intel/int3472/clk_and_regulator.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)drivers/platform/x86/intel/int3472/clk_and_regulator.c +20
-1@@ -19,23 +19,42 @@ static const guid_t img_clk_guid =GUID_INIT (0x82c0d13a ,0x78c5 ,0x4244 ,0x9b ,0xb1 ,0xeb ,0x8b ,0x53 ,0x9a ,0x8d ,0x11 ); +/* +* The PCH clock frequency argument to the _DSM method: +* PCH_CLK_FREQ_19M2 = 19.2MHz (default) +* PCH_CLK_FREQ_24M = 24MHz +*/ +#define PCH_CLK_FREQ_19M2 1 +#define PCH_CLK_FREQ_24M 3 +static void skl_int3472_enable_clk (struct int3472_clock *clk,int enable) {struct int3472_discrete_device *int3472 =to_int3472_device (clk);union acpi_object args[3 ];union acpi_object argv4; +u32 dsm_freq_arg;if (clk->ena_gpio) {gpiod_set_value_cansleep (clk->ena_gpio, enable);return ; } +switch (clk->frequency) { +case 24000000 : + dsm_freq_arg =PCH_CLK_FREQ_24M ; +break ; +case 19200000 : +default : + dsm_freq_arg =PCH_CLK_FREQ_19M2 ; +break ; + } + args[0 ].integer.type =ACPI_TYPE_INTEGER ; args[0 ].integer.value = clk->imgclk_index; args[1 ].integer.type =ACPI_TYPE_INTEGER ; args[1 ].integer.value = enable; args[2 ].integer.type =ACPI_TYPE_INTEGER ; - args[2 ].integer.value =1 ; + args[2 ].integer.value = dsm_freq_arg; argv4.type =ACPI_TYPE_PACKAGE ; argv4.package.count =3 ;
Hi,
Quoted 8 lines · Hao Yao
The third argument (args[2]) to the
_DSMmethod was hardcoded to 1, which corresponds to 19.2MHz. However, this argument should reflect the actual clock frequency from the sensor's ACPI data.According to the DSM specification:
- 1 = 19.2MHz
- 3 = 24MHz
Quoted 7 lines
Read the frequency from
clk->frequencyand set the DSM argument accordingly, with 19.2MHz as the default for unsupported frequencies.This ensures the sensor receives the correct clock frequency as specified in its ACPI configuration.
Signed-off-by Hao Yao <[email protected]>
Thanks patch looks good to me:
Regards,
Hans
Quoted 52 lines
--- .../x86/intel/int3472/clk_and_regulator.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)drivers/platform/x86/intel/int3472/clk_and_regulator.c +20
-1@@ -19,23 +19,42 @@ static const guid_t img_clk_guid =GUID_INIT (0x82c0d13a ,0x78c5 ,0x4244 ,0x9b ,0xb1 ,0xeb ,0x8b ,0x53 ,0x9a ,0x8d ,0x11 ); +/* +* The PCH clock frequency argument to the _DSM method: +* PCH_CLK_FREQ_19M2 = 19.2MHz (default) +* PCH_CLK_FREQ_24M = 24MHz +*/ +#define PCH_CLK_FREQ_19M2 1 +#define PCH_CLK_FREQ_24M 3 +static void skl_int3472_enable_clk (struct int3472_clock *clk,int enable) {struct int3472_discrete_device *int3472 =to_int3472_device (clk);union acpi_object args[3 ];union acpi_object argv4; +u32 dsm_freq_arg;if (clk->ena_gpio) {gpiod_set_value_cansleep (clk->ena_gpio, enable);return ; } +switch (clk->frequency) { +case 24000000 : + dsm_freq_arg =PCH_CLK_FREQ_24M ; +break ; +case 19200000 : +default : + dsm_freq_arg =PCH_CLK_FREQ_19M2 ; +break ; + } + args[0 ].integer.type =ACPI_TYPE_INTEGER ; args[0 ].integer.value = clk->imgclk_index; args[1 ].integer.type =ACPI_TYPE_INTEGER ; args[1 ].integer.value = enable; args[2 ].integer.type =ACPI_TYPE_INTEGER ; - args[2 ].integer.value =1 ; + args[2 ].integer.value = dsm_freq_arg; argv4.type =ACPI_TYPE_PACKAGE ; argv4.package.count =3 ;
Hi Hao,
Quoted 8 lines · Hao Yao
The third argument (args[2]) to the
_DSMmethod was hardcoded to 1, which corresponds to 19.2MHz. However, this argument should reflect the actual clock frequency from the sensor's ACPI data.According to the DSM specification:
- 1 = 19.2MHz
- 3 = 24MHz
Quoted 7 lines
Read the frequency from
clk->frequencyand set the DSM argument accordingly, with 19.2MHz as the default for unsupported frequencies.This ensures the sensor receives the correct clock frequency as specified in its ACPI configuration.
Signed-off-by Hao Yao <[email protected]>
Thanks for the update.
Signature · 3 lines
Kind regards, Sakari Ailus
Ilpo Järvinen
maintainerQuoted 8 lines · Hao Yao
The third argument (args[2]) to the
_DSMmethod was hardcoded to 1, which corresponds to 19.2MHz. However, this argument should reflect the actual clock frequency from the sensor's ACPI data.According to the DSM specification:
- 1 = 19.2MHz
- 3 = 24MHz
Quoted 7 lines
Read the frequency from
clk->frequencyand set the DSM argument accordingly, with 19.2MHz as the default for unsupported frequencies.This ensures the sensor receives the correct clock frequency as specified in its ACPI configuration.
Signed-off-by Hao Yao <[email protected]>
Should this have a Fixes tag?
Could you please also mention what you discovered about values 0 and 2 in the changelog as it seems useful information (I requested this in v1).
Quoted 53 lines
--- .../x86/intel/int3472/clk_and_regulator.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)drivers/platform/x86/intel/int3472/clk_and_regulator.c +20
-1@@ -19,23 +19,42 @@ static const guid_t img_clk_guid =GUID_INIT (0x82c0d13a ,0x78c5 ,0x4244 ,0x9b ,0xb1 ,0xeb ,0x8b ,0x53 ,0x9a ,0x8d ,0x11 ); +/* +* The PCH clock frequency argument to the _DSM method: +* PCH_CLK_FREQ_19M2 = 19.2MHz (default) +* PCH_CLK_FREQ_24M = 24MHz +*/ +#define PCH_CLK_FREQ_19M2 1 +#define PCH_CLK_FREQ_24M 3 +static void skl_int3472_enable_clk (struct int3472_clock *clk,int enable) {struct int3472_discrete_device *int3472 =to_int3472_device (clk);union acpi_object args[3 ];union acpi_object argv4; +u32 dsm_freq_arg;if (clk->ena_gpio) {gpiod_set_value_cansleep (clk->ena_gpio, enable);return ; } +switch (clk->frequency) { +case 24000000 : + dsm_freq_arg =PCH_CLK_FREQ_24M ; +break ; +case 19200000 : +default : + dsm_freq_arg =PCH_CLK_FREQ_19M2 ; +break ; + } + args[0 ].integer.type =ACPI_TYPE_INTEGER ; args[0 ].integer.value = clk->imgclk_index; args[1 ].integer.type =ACPI_TYPE_INTEGER ; args[1 ].integer.value = enable; args[2 ].integer.type =ACPI_TYPE_INTEGER ; - args[2 ].integer.value =1 ; + args[2 ].integer.value = dsm_freq_arg; argv4.type =ACPI_TYPE_PACKAGE ; argv4.package.count =3 ;
Signature · 1 line
i.
Hi,
Sorry for missing this mail,
Quoted 13 lines · Ilpo Järvinen
Quoted 11 lines · Hao Yao
The third argument (args[2]) to the
_DSMmethod was hardcoded to 1, which corresponds to 19.2MHz. However, this argument should reflect the actual clock frequency from the sensor's ACPI data.According to the DSM specification:
- 1 = 19.2MHz
- 3 = 24MHzRead the frequency from
clk->frequencyand set the DSM argument accordingly, with 19.2MHz as the default for unsupported frequencies.
Quoted 7 lines
Quoted 4 lines
This ensures the sensor receives the correct clock frequency as specified in its ACPI configuration.
Signed-off-by Hao Yao <[email protected]>Should this have a Fixes tag?
Quoted 3 lines
Could you please also mention what you discovered about values 0 and 2 in the changelog as it seems useful information (I requested this in v1).
When I send value 0 or 2, the clock doesn't change (checked by oscilloscope). I guess that values other than 1 and 3 is ignored currently, maybe reserved for future usage.
Best Regards,
Hao Yao
Quoted 55 lines
Quoted 53 lines
--- .../x86/intel/int3472/clk_and_regulator.c | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)drivers/platform/x86/intel/int3472/clk_and_regulator.c +20
-1@@ -19,23 +19,42 @@ static const guid_t img_clk_guid =GUID_INIT (0x82c0d13a ,0x78c5 ,0x4244 ,0x9b ,0xb1 ,0xeb ,0x8b ,0x53 ,0x9a ,0x8d ,0x11 ); +/* +* The PCH clock frequency argument to the _DSM method: +* PCH_CLK_FREQ_19M2 = 19.2MHz (default) +* PCH_CLK_FREQ_24M = 24MHz +*/ +#define PCH_CLK_FREQ_19M2 1 +#define PCH_CLK_FREQ_24M 3 +static void skl_int3472_enable_clk (struct int3472_clock *clk,int enable) {struct int3472_discrete_device *int3472 =to_int3472_device (clk);union acpi_object args[3 ];union acpi_object argv4; +u32 dsm_freq_arg;if (clk->ena_gpio) {gpiod_set_value_cansleep (clk->ena_gpio, enable);return ; } +switch (clk->frequency) { +case 24000000 : + dsm_freq_arg =PCH_CLK_FREQ_24M ; +break ; +case 19200000 : +default : + dsm_freq_arg =PCH_CLK_FREQ_19M2 ; +break ; + } + args[0 ].integer.type =ACPI_TYPE_INTEGER ; args[0 ].integer.value = clk->imgclk_index; args[1 ].integer.type =ACPI_TYPE_INTEGER ; args[1 ].integer.value = enable; args[2 ].integer.type =ACPI_TYPE_INTEGER ; - args[2 ].integer.value =1 ; + args[2 ].integer.value = dsm_freq_arg; argv4.type =ACPI_TYPE_PACKAGE ; argv4.package.count =3 ;
Hi Hao,
A data point from a second machine: a Surface Pro 9 (Alder Lake-P, IPU6, 8086:465d). Its infrared sensor is the same ST VD55G0 (SMO55F0) that Sergey reported on for the Surface Pro 11, with 24 MHz in its SSDB, and INT3472 enables its clock through the _DSM. Without your patch it shows the same symptom. With Sergey's vd55g0 driver at 396 MHz, every mode runs at 47.31 fps where the controls give 59.14, and at 600 MHz at 57.20 against 71.49. The driver this machine used before behaves the same way at both frequencies, so everything the sensor derives runs at four fifths.
With your v2 applied to the int3472 module and loaded from a cold boot, nothing changes. Sergey's driver still runs at 57.20 fps at 600 MHz where its controls give 71.49, and the previous driver still at 57.60. clk_summary reports INT3472:01-clk at 24000000, so the patch does pass 3 to the _DSM here; this firmware just does not seem to act on it. The other two cameras, whose SSDBs ask for 19.2 MHz, are unchanged (front 28.64 fps, rear 29.95 fps), so nothing regresses.
So on this machine the patch is harmless but does not fix the clock. I cannot tell from here whether the Alder Lake _DSM takes a different value for 24 MHz or only produces 19.2 MHz. If you know of a way to ask it, I can test it.
Fernando
Hi Fernando, Hao,
Quoted 3 lines · Fernando Rimoli
I cannot tell from here whether the Alder Lake
_DSMtakes a different value for 24 MHz or only produces 19.2 MHz. If you know of a way to ask it, I can test it.
The Surface Pro 9 DSDT in linux-surface/acpidumps (surface_pro_9_intel, a 2022 dump) suggests it takes 0. Its _DSM calls ICLK.CLKC with the enable, which goes into bit 1, and then ICLK.CLKF with Arg3[2], which does
CLKx = (CLKx & ~1) | Arg1
That is the Tiger Lake and Alder Lake layout in coreboot (src/soc/intel/alderlake/acpi/camera_clock_ctl.asl), where bit 0 is "0: 24MHz, 1: 19.2MHz". So 3 sets bit 0, which is 19.2 MHz, and bit 1, the enable. On disable, CLKC clears bit 1 and CLKF sets it again, so with v2 the clock would never be switched off either.
On the Surface Pro 11 (Lunar Lake), CLKF writes Arg1 & 3 to bits 1:0 and the enable is bit 2. That is the Meteor Lake layout, where 3 is "24 IMG" and 0 and 2 are 19.2 MHz from other sources. It fits both Hao's oscilloscope reading (0 and 2 do not change the clock) and 3 working on the Surface Pro 11.
Fernando, a run with 0 in place of 3 would tell, and your own DSDT whether it still matches the dump. If it gives 59.14 fps at 396 MHz, the value depends on the generation, and v3 would need to pick it per platform.
Sergey
Hi Sergey, Hao,
Quoted 2 lines · Sergey Lebedev
Fernando, a run with 0 in place of 3 would tell, and your own DSDT whether it still matches the dump.
It takes 0. The DSDT on this machine (BIOS 23.102.143, 11/25/2025) still matches the dump: the clock _DSM on ICL0, ICL1 and ICL2 calls ICLK.CLKC with Arg3[1] and then ICLK.CLKF with Arg3[2], and CLKF does
CLKx = (CLKx & ~1) | Arg1
with nothing masking Arg1, so 3 also sets the enable bit again on the way down, as you say.
I changed the int3472 discrete module to pass 0 when the SSDB asks for 24 MHz and 1 otherwise, so the two 19.2 MHz cameras get what they get today, and swapped it in at runtime (the _DSM runs on every clock prepare). With the previous driver at 600 MHz, the infrared sensor goes from 57.60 fps to 72.00 fps, which is 57.60 times five fourths, and back to 57.60 with the unmodified module loaded again. So 0 gives 24 MHz here, and 1 and 3 both give 19.2 MHz.
So the value depends on the generation: 3 where CLKF takes two bits, as on the Surface Pro 11, and 0 on Alder Lake, where coreboot's Tiger Lake and Alder Lake camera_clock_ctl.asl document bit 0 as "0: 24MHz, 1:
19.2MHz". v3 would need to pick it per platform. I can test it on the Surface Pro 9, and I will run your driver at 396 MHz with it then.
Fernando
Hi Hao,
Following up on my offer of 16 October: unless you would rather send it yourself, I will send v3 after 24 November, based on media-committers next, with you as the author.
Fernando's results change it a little. The value for 24 MHz depends on the generation, and coreboot's camera_clock_ctl.asl shows the same split:
Tiger Lake, Jasper Lake, Alder Lake one bit, 0 = 24 MHz, 1 = 19.2 MHz
Meteor Lake, Panther Lake, Nova Lake two bits, 3 = 24 MHz
The Surface Pro 11 (Lunar Lake) has the second layout, the Surface Pro 9 (Alder Lake) the first. On the first, 3 also sets the enable bit again when the clock is turned off. So v3 would pick the 24 MHz value by CPU generation and keep 1 for 19.2 MHz, which is right on both. It would also have the Fixes tag and your note on 0 and 2 that Ilpo asked for. If Intel's _DSM documentation says otherwise, I will follow it.
Sergey