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@xxxxxxx> --- 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 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@xxxxxxx>"); +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@xxxxxxx>"); +MODULE_DESCRIPTION("AMD ISP4 Platform parameters"); +MODULE_LICENSE("GPL v2"); -- 2.43.0