From: Hans de Goede <hdegoede@redhat.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Andy Shevchenko" <andy@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
Dan Scally <djrscally@gmail.com>,
Alan Stern <stern@rowland.harvard.edu>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hao Yao <hao.yao@intel.com>, Bingbu Cao <bingbu.cao@intel.com>,
Duane <duanek@chorus.net>,
platform-driver-x86@vger.kernel.org, linux-media@vger.kernel.org
Subject: [PATCH v4 8/9] platform/x86: int3472: Add handshake pin support
Date: Thu, 17 Apr 2025 13:13:36 +0200 [thread overview]
Message-ID: <20250417111337.38142-9-hdegoede@redhat.com> (raw)
In-Reply-To: <20250417111337.38142-1-hdegoede@redhat.com>
New Intel Meteor Lake based laptops with IPU6 cameras have a new type 0x12
pin defined in the INT3472 sensor companion device which describes
the sensor's GPIOs.
This pin is primarily used on designs with a Lattice FPGA chip which is
capable of running the sensor independently of the main CPU for features
like presence detection. This pin needs to be driven high to make the FPGA
run the power-on sequence of the sensor. After driving the pin high,
the FPGA "firmware" needs 25ms to complete the power-on sequence.
Add support for this modelling the handshake pin as a GPIO driven "dvdd"
regulator with a 25 ms enable time. This model was chosen because:
1. Sensor chips don't have a handshake pin, so we need to abstract this
in some way which does not require modification to the sensor drivers,
sensor drivers using the bulk-regulator API to get avdd + vddio + dvdd
is normal. So this will work to get the right value set to the handshake
pin without requiring sensor driver modifications.
2. Sensors typically wait only a small time for the sensor to power-on
after de-asserting reset. Not the 25ms the Lattice chip requires.
Using the regulator framework's enable_time allows hiding the need for
this delay from the sensor drivers.
Link: https://lore.kernel.org/platform-driver-x86/59f672c3-6d87-4ec7-9b7f-f44fe2cce934@redhat.com/
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2341731
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v4:
- Use unique error messages for power-enable vs handshake
skl_int3472_register_regulator() failures
- Drop setting of constraints.enable_time. enable_time already gets set
in struct regulator_desc (missed left-over from an older patch version)
Changes in v3:
- Small commitmsg improvements
---
drivers/platform/x86/intel/int3472/common.h | 1 +
drivers/platform/x86/intel/int3472/discrete.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel/int3472/common.h b/drivers/platform/x86/intel/int3472/common.h
index e88a22a6f81b..56fb91dcc130 100644
--- a/drivers/platform/x86/intel/int3472/common.h
+++ b/drivers/platform/x86/intel/int3472/common.h
@@ -22,6 +22,7 @@
#define INT3472_GPIO_TYPE_POWER_ENABLE 0x0b
#define INT3472_GPIO_TYPE_CLK_ENABLE 0x0c
#define INT3472_GPIO_TYPE_PRIVACY_LED 0x0d
+#define INT3472_GPIO_TYPE_HANDSHAKE 0x12
#define INT3472_PDEV_MAX_NAME_LEN 23
#define INT3472_MAX_SENSOR_GPIOS 3
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index a2db4fae0e6d..bcc7bb122a56 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -191,6 +191,10 @@ static void int3472_get_con_id_and_polarity(struct acpi_device *adev, u8 *type,
*con_id = "avdd";
*gpio_flags = GPIO_ACTIVE_HIGH;
break;
+ case INT3472_GPIO_TYPE_HANDSHAKE:
+ *con_id = "dvdd";
+ *gpio_flags = GPIO_ACTIVE_HIGH;
+ break;
default:
*con_id = "unknown";
*gpio_flags = GPIO_ACTIVE_HIGH;
@@ -290,6 +294,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
case INT3472_GPIO_TYPE_CLK_ENABLE:
case INT3472_GPIO_TYPE_PRIVACY_LED:
case INT3472_GPIO_TYPE_POWER_ENABLE:
+ case INT3472_GPIO_TYPE_HANDSHAKE:
gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, con_id, gpio_flags);
if (IS_ERR(gpio)) {
ret = PTR_ERR(gpio);
@@ -316,7 +321,16 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
con_id,
int3472->quirks.avdd_second_sensor);
if (ret)
- err_msg = "Failed to map regulator to sensor\n";
+ err_msg = "Failed to map power-enable to sensor\n";
+
+ break;
+ case INT3472_GPIO_TYPE_HANDSHAKE:
+ /* Setups using a handshake pin need 25 ms enable delay */
+ ret = skl_int3472_register_regulator(int3472, gpio,
+ 25 * USEC_PER_MSEC,
+ con_id, NULL);
+ if (ret)
+ err_msg = "Failed to map handshake to sensor\n";
break;
default: /* Never reached */
--
2.49.0
next prev parent reply other threads:[~2025-04-17 11:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 11:13 [PATCH v4 0/9] platform/x86: int3472: Add handshake pin support Hans de Goede
2025-04-17 11:13 ` [PATCH v4 1/9] platform/x86: int3472: Add skl_int3472_register_clock() helper Hans de Goede
2025-04-17 12:59 ` Ilpo Järvinen
2025-04-17 11:13 ` [PATCH v4 2/9] platform/x86: int3472: Stop setting a supply-name for GPIO regulators Hans de Goede
2025-04-17 11:13 ` [PATCH v4 3/9] platform/x86: int3472: Drop unused gpio field from struct int3472_gpio_regulator Hans de Goede
2025-04-17 11:13 ` [PATCH v4 4/9] platform/x86: int3472: Rework AVDD second sensor quirk handling Hans de Goede
2025-04-17 11:13 ` [PATCH v4 5/9] platform/x86: int3472: Make regulator supply name configurable Hans de Goede
2025-04-17 16:25 ` Andy Shevchenko
2025-04-23 13:58 ` Ilpo Järvinen
2025-04-23 15:38 ` Andy Shevchenko
2025-04-24 14:06 ` Ilpo Järvinen
2025-04-25 9:06 ` Hans de Goede
2025-04-17 11:13 ` [PATCH v4 6/9] platform/x86: int3472: Avoid GPIO regulator spikes Hans de Goede
2025-04-17 11:13 ` [PATCH v4 7/9] platform/x86: int3472: Prepare for registering more than 1 GPIO regulator Hans de Goede
2025-04-17 11:13 ` Hans de Goede [this message]
2025-04-17 11:13 ` [PATCH v4 9/9] platform/x86: int3472: Debug log when remapping pins Hans de Goede
2025-04-18 15:47 ` [PATCH v4 0/9] platform/x86: int3472: Add handshake pin support David Heidelberg
2025-04-23 9:46 ` 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=20250417111337.38142-9-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@kernel.org \
--cc=bingbu.cao@intel.com \
--cc=djrscally@gmail.com \
--cc=duanek@chorus.net \
--cc=hao.yao@intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-media@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stern@rowland.harvard.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox