diff mbox series

[v1] platform/x86: amd: Add ISP platform info

Message ID 20250303050102.2298520-1-pratap.nirujogi@amd.com (mailing list archive)
State New
Headers show
Series [v1] platform/x86: amd: Add ISP platform info | expand

Commit Message

Nirujogi, Pratap March 3, 2025, 5 a.m. UTC
Add ov05c i2c boardinfo and GPIO pin info for AMD ISP platform.

Details of the resources added:

- Added i2c bus number for AMD ISP platform is 99.
- Added GPIO 85 to allow ISP driver to enable and disable ISP access.
- Added GPIO 0 to allow sensor driver to enable and disable sensor module.

Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
---
 drivers/platform/x86/amd/Kconfig   | 11 ++++++
 drivers/platform/x86/amd/Makefile  |  1 +
 drivers/platform/x86/amd/amd_isp.c | 63 ++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+)
 create mode 100644 drivers/platform/x86/amd/amd_isp.c

Comments

Krzysztof Kozlowski March 3, 2025, 7:12 a.m. UTC | #1
On 03/03/2025 06:00, Pratap Nirujogi wrote:
> Add ov05c i2c boardinfo and GPIO pin info for AMD ISP platform.
> 
> Details of the resources added:
> 
> - Added i2c bus number for AMD ISP platform is 99.
> - Added GPIO 85 to allow ISP driver to enable and disable ISP access.
> - Added GPIO 0 to allow sensor driver to enable and disable sensor module.
> 
> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>


Didn't you already sent v1? And receive comments?

> ---

Where is the changelog? What happened in this patch comparing to v1?


Best regards,
Krzysztof
Nirujogi, Pratap March 3, 2025, 5:04 p.m. UTC | #2
[AMD Official Use Only - AMD Internal Distribution Only]

Hi Krzysztof,

I should have called this patch v2 (instead of v1), sorry for the confusion caused, will take care of it in my next submissions.

Here is the changelog for v2:

- Adding ov05c acpi hw id check to ensure platform/x86 amd-isp driver runs on the intended AMD platform.
- Updated the copyright header and license used.
- Addressed few other comments from Mario related to module dependencies and naming.

I'm currently reviewing the feedback from Hans on v1 and will follow up to any feedback as a v3 with changelog appended under the cutlist.

Thanks for your review and guidance,
Pratap


-----Original Message-----
From: Krzysztof Kozlowski <krzk@kernel.org>
Sent: Monday, March 3, 2025 2:13 AM
To: Nirujogi, Pratap <Pratap.Nirujogi@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; hdegoede@redhat.com; ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org; linux-kernel@vger.kernel.org; Chan, Benjamin (Koon Pan) <Benjamin.Chan@amd.com>
Subject: Re: [PATCH v1] platform/x86: amd: Add ISP platform info

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On 03/03/2025 06:00, Pratap Nirujogi wrote:
> Add ov05c i2c boardinfo and GPIO pin info for AMD ISP platform.
>
> Details of the resources added:
>
> - Added i2c bus number for AMD ISP platform is 99.
> - Added GPIO 85 to allow ISP driver to enable and disable ISP access.
> - Added GPIO 0 to allow sensor driver to enable and disable sensor module.
>
> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>


Didn't you already sent v1? And receive comments?

> ---

Where is the changelog? What happened in this patch comparing to v1?


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kconfig
index c3e086ea64fc..0341270d70a6 100644
--- a/drivers/platform/x86/amd/Kconfig
+++ b/drivers/platform/x86/amd/Kconfig
@@ -32,3 +32,14 @@  config AMD_WBRF
 
 	  This mechanism will only be activated on platforms that advertise a
 	  need for it.
+
+config AMD_ISP_PLATFORM
+	bool "AMD platform with ISP4 that supports Camera sensor device"
+	depends on I2C && X86_64 && PINCTRL_AMDISP && AMD_ISP4
+	help
+	  For AMD platform that support Image signal processor generation 4, it
+	  is necessary to add platform specific camera sensor module board info
+	  which includes the sensor driver device id and the i2c address.
+
+	  If you have a AMD platform that support ISP4 and with a sensor
+	  connected to it, say Y here
diff --git a/drivers/platform/x86/amd/Makefile b/drivers/platform/x86/amd/Makefile
index 56f62fc9c97b..0d89e2d4f7e6 100644
--- a/drivers/platform/x86/amd/Makefile
+++ b/drivers/platform/x86/amd/Makefile
@@ -10,3 +10,4 @@  obj-$(CONFIG_AMD_PMC)		+= pmc/
 obj-$(CONFIG_AMD_HSMP)		+= hsmp/
 obj-$(CONFIG_AMD_PMF)		+= pmf/
 obj-$(CONFIG_AMD_WBRF)		+= wbrf.o
+obj-$(CONFIG_AMD_ISP_PLATFORM)	+= amd_isp.o
diff --git a/drivers/platform/x86/amd/amd_isp.c b/drivers/platform/x86/amd/amd_isp.c
new file mode 100644
index 000000000000..cb0faab4b9c3
--- /dev/null
+++ b/drivers/platform/x86/amd/amd_isp.c
@@ -0,0 +1,63 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * AMD x86 platform driver for AMD HW platforms using ISP4
+ *
+ * Copyright 2025 Advanced Micro Devices, Inc.
+ */
+
+#include <linux/acpi.h>
+#include <linux/gpio/machine.h>
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/kernel.h>
+
+#define AMDISP_I2C_BUS		99
+
+#define AMDISP_ACPI_CAM_HID     "OMNI5C10"
+
+static struct gpiod_lookup_table isp_gpio_table = {
+	.dev_id = "amd_isp_capture",
+	.table = {
+		GPIO_LOOKUP("AMDI0030:00", 85, "enable_isp", GPIO_ACTIVE_HIGH),
+		{ }
+	},
+};
+
+static struct gpiod_lookup_table isp_sensor_gpio_table = {
+	.dev_id = "ov05c",
+	.table = {
+		GPIO_LOOKUP("amdisp-pinctrl", 0, "sensor0_enable", GPIO_ACTIVE_HIGH),
+		{ }
+	},
+};
+
+static struct i2c_board_info sensor_info = {
+	.dev_name = "ov05c",
+	I2C_BOARD_INFO("ov05c", 0x10),
+};
+
+static int __init amd_isp_init(void)
+{
+	int ret;
+
+	/* check for valid platform before configuring isp4 board resources */
+	if (!acpi_dev_found(AMDISP_ACPI_CAM_HID))
+		return -ENODEV;
+
+	gpiod_add_lookup_table(&isp_gpio_table);
+	gpiod_add_lookup_table(&isp_sensor_gpio_table);
+
+	ret = i2c_register_board_info(AMDISP_I2C_BUS, &sensor_info, 1);
+	if (ret)
+		pr_err("%s: cannot register i2c board devices:%s",
+		       __func__, sensor_info.dev_name);
+
+	return ret;
+}
+
+module_init(amd_isp_init);
+
+MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
+MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
+MODULE_DESCRIPTION("AMD ISP4 Platform parameters");
+MODULE_LICENSE("GPL v2");