All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Sergey Lebedev <lsa.uz@pm.me>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: "Hao Yao" <hao.yao@intel.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Bingbu Cao" <bingbu.cao@amd.com>,
	"Fernando Rimoli" <fernandorimoli11@gmail.com>,
	platform-driver-x86@vger.kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] platform/x86: int3472: Use actual clock frequency for DSM method
Date: Wed, 25 Nov 2026 12:16:08 +0100	[thread overview]
Message-ID: <84ecba76-5fe7-4bb2-b18f-efc7cda2247c@kernel.org> (raw)
In-Reply-To: <20261125090921.46652-1-lsa.uz@pm.me>

Hi,

On 25-Nov-26 10:09, Sergey Lebedev wrote:
> From: Hao Yao <hao.yao@intel.com>
> 
> The third argument (args[2]) to the _DSM method was hardcoded to 1,
> which selects 19.2MHz. A sensor whose SSDB asks for 24MHz therefore
> runs from 19.2MHz, and everything it derives from its clock runs at
> four fifths of the expected rate.
> 
> Pass the frequency from the SSDB instead, with 19.2MHz as the default.
> 1 selects 19.2MHz everywhere, but the value for 24MHz depends on the
> platform. Where the frequency field is one bit wide (Tiger Lake, Jasper
> Lake, Alder Lake, Raptor Lake) it is 0, and 3 would also set the clock's
> enable bit again when the clock is turned off. From Meteor Lake on the
> field is two bits wide and it is 3; 0 and 2 leave the clock unchanged
> there, as measured with an oscilloscope.
> 
> Fixes: e4543de8b6ff ("platform/x86: int3472: Evaluate device's _DSM method to control imaging clock")
> Signed-off-by: Hao Yao <hao.yao@intel.com>
> [Sergey: pick the 24MHz value per platform]
> Signed-off-by: Sergey Lebedev <lsa.uz@pm.me>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans



> ---
> v3, sent by me as offered in the v2 thread, with Hao as the author:
> - The 24MHz value is chosen per platform. On a Surface Pro 9 (Alder
>   Lake) Fernando Rimoli measured that 3 gives 19.2MHz and 0 gives 24MHz
>   [1]. coreboot's camera_clock_ctl.asl has a one-bit frequency field for
>   Tiger Lake, Jasper Lake and Alder Lake (which covers Raptor Lake) and
>   a two-bit one for Meteor Lake, Panther Lake and Nova Lake.
> - The Fixes: tag and the note on 0 and 2 that Ilpo asked for.
> - v2's Reviewed-by and Acked-by tags dropped, since the code changed.
> 
> Tested on a Surface Pro 11 (Lunar Lake), with the module built from
> Ubuntu's 7.0 source, where this file is the same as in media-committers
> next. The VD55G0, whose SSDB asks for 24MHz, streams at 59.14 fps as
> its controls give, against 47.29 fps without the patch. The two 19.2MHz
> sensors are unchanged. The Alder Lake branch has not run as posted.
> 
> v2: https://lore.kernel.org/all/20251208035122.2147678-1-hao.yao@intel.com/
> [1] https://lore.kernel.org/all/20261026111012.33347-1-fernandorimoli11@gmail.com/
> 
> Tool use, per Documentation/process/generated-content.rst (Assisted-by
> tags in commits were dropped in 7.4-rc1):
> 
> * My contributions to this series were prepared with Claude Code
>   (claude-opus-5-5); work by others in it is their own.
> * This replaces any Assisted-by tags in earlier versions.
> 
>  .../x86/intel/int3472/clk_and_regulator.c     | 39 ++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> index 9e052b164a1..47dc23c5184 100644
> --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> @@ -10,6 +10,9 @@
>  #include <linux/regulator/driver.h>
>  #include <linux/slab.h>
>  
> +#include <asm/cpu_device_id.h>
> +#include <asm/intel-family.h>
> +
>  /*
>   * 82c0d13a-78c5-4244-9bb1-eb8b539a8d11
>   * This _DSM GUID allows controlling the sensor clk when it is not controlled
> @@ -19,6 +22,40 @@ static const guid_t img_clk_guid =
>  	GUID_INIT(0x82c0d13a, 0x78c5, 0x4244,
>  		  0x9b, 0xb1, 0xeb, 0x8b, 0x53, 0x9a, 0x8d, 0x11);
>  
> +/*
> + * The third argument to the _DSM method selects the clock frequency. 1 is
> + * 19.2MHz everywhere. 24MHz is 0 where the frequency field is one bit wide
> + * (Tiger Lake, Jasper Lake, Alder Lake, Raptor Lake) and 3 where it is two
> + * bits wide (Meteor Lake and later).
> + */
> +#define INT3472_DSM_CLK_FREQ_19M2	1
> +#define INT3472_DSM_CLK_FREQ_24M	3
> +#define INT3472_DSM_CLK_FREQ_24M_1BIT	0
> +
> +static const struct x86_cpu_id int3472_dsm_clk_freq_1bit_ids[] = {
> +	X86_MATCH_VFM(INTEL_TIGERLAKE_L, NULL),
> +	X86_MATCH_VFM(INTEL_TIGERLAKE, NULL),
> +	X86_MATCH_VFM(INTEL_ATOM_TREMONT_L, NULL),
> +	X86_MATCH_VFM(INTEL_ALDERLAKE, NULL),
> +	X86_MATCH_VFM(INTEL_ALDERLAKE_L, NULL),
> +	X86_MATCH_VFM(INTEL_ATOM_GRACEMONT, NULL),
> +	X86_MATCH_VFM(INTEL_RAPTORLAKE, NULL),
> +	X86_MATCH_VFM(INTEL_RAPTORLAKE_P, NULL),
> +	X86_MATCH_VFM(INTEL_RAPTORLAKE_S, NULL),
> +	{}
> +};
> +
> +static u32 skl_int3472_dsm_clk_freq(struct int3472_clock *clk)
> +{
> +	if (clk->frequency != 24000000)
> +		return INT3472_DSM_CLK_FREQ_19M2;
> +
> +	if (x86_match_cpu(int3472_dsm_clk_freq_1bit_ids))
> +		return INT3472_DSM_CLK_FREQ_24M_1BIT;
> +
> +	return INT3472_DSM_CLK_FREQ_24M;
> +}
> +
>  static void skl_int3472_enable_clk(struct int3472_clock *clk, int enable)
>  {
>  	struct int3472_discrete_device *int3472 = to_int3472_device(clk);
> @@ -35,7 +72,7 @@ static void skl_int3472_enable_clk(struct int3472_clock *clk, int enable)
>  	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 = skl_int3472_dsm_clk_freq(clk);
>  
>  	argv4.type = ACPI_TYPE_PACKAGE;
>  	argv4.package.count = 3;


  reply	other threads:[~2026-11-25 11:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  9:09 [PATCH v3] platform/x86: int3472: Use actual clock frequency for DSM method Sergey Lebedev
2026-11-25 11:16 ` Hans de Goede [this message]
2026-11-25 12:05   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84ecba76-5fe7-4bb2-b18f-efc7cda2247c@kernel.org \
    --to=hansg@kernel.org \
    --cc=bingbu.cao@amd.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=fernandorimoli11@gmail.com \
    --cc=hao.yao@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lsa.uz@pm.me \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.