X86 platform drivers
 help / color / mirror / Atom feed
From: Pratap Nirujogi <pratap.nirujogi@amd.com>
To: <hdegoede@redhat.com>, <ilpo.jarvinen@linux.intel.com>
Cc: <platform-driver-x86@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <benjamin.chan@amd.com>,
	Pratap Nirujogi <pratap.nirujogi@amd.com>
Subject: [PATCH] platform/x86: amd: Add ISP platform info
Date: Fri, 28 Feb 2025 12:02:36 -0500	[thread overview]
Message-ID: <20250228170238.3484860-1-pratap.nirujogi@amd.com> (raw)

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 | 72 ++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+)
 create mode 100644 drivers/platform/x86/amd/amd_isp.c

diff --git a/drivers/platform/x86/amd/Kconfig b/drivers/platform/x86/amd/Kconfig
index c3e086ea64fc..4b373edd750d 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 && 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..751f209e9509
--- /dev/null
+++ b/drivers/platform/x86/amd/amd_isp.c
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2025 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/kernel.h>
+#include <linux/gpio/machine.h>
+
+#define AMDISP_I2C_BUS		99
+
+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;
+
+	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;
+}
+
+arch_initcall(amd_isp_init);
+
+MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
+MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
+MODULE_DESCRIPTION("AMD ISP Platform parameters");
+MODULE_LICENSE("GPL and additional rights");
-- 
2.43.0


             reply	other threads:[~2025-02-28 17:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 17:02 Pratap Nirujogi [this message]
2025-02-28 18:01 ` [PATCH] platform/x86: amd: Add ISP platform info Mario Limonciello
2025-03-03  5:13   ` Nirujogi, Pratap
2025-03-01 14:02 ` Krzysztof Kozlowski
2025-03-03  5:17   ` Nirujogi, Pratap
2025-03-03  7:13     ` Krzysztof Kozlowski
2025-03-03 13:41 ` Hans de Goede
2025-03-03 23:14   ` Nirujogi, Pratap
2025-03-03 23:56     ` Armin Wolf
2025-03-04 17:44       ` Nirujogi, Pratap
2025-03-05  1:11         ` Armin Wolf
2025-03-05 15:26     ` Hans de Goede
2025-03-05 15:42       ` Mario Limonciello
2025-03-06 14:52         ` Hans de Goede
2025-03-27 22:25       ` Nirujogi, Pratap

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=20250228170238.3484860-1-pratap.nirujogi@amd.com \
    --to=pratap.nirujogi@amd.com \
    --cc=benjamin.chan@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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