[PATCH 02/15] media: microchip-isc: set SAM9X7 maximum resolution per SoC

From: Balakrishnan Sambath

Date: Wed Dec 02 2026 - 02:16:22 EST


SAM9X7 shares the XISC with SAMA7G5 but supports at most 2560x1920
(DS60001813C, section 50.2), where SAMA7G5 allows 3264x2464.

Take the limits from the matched compatible with
of_device_get_match_data() instead of of_machine_is_compatible(), which
only looks at the root node and is not how the device is identified.

Co-developed-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@xxxxxxxxxxxxx>
Signed-off-by: Balamanikandan Gunasundar <balamanikandan.gunasundar@xxxxxxxxxxxxx>
Signed-off-by: Balakrishnan Sambath <balakrishnan.s@xxxxxxxxxxxxx>
---
.../platform/microchip/microchip-sama7g5-isc.c | 29 ++++++++++++++++++----
1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index f5968e3b388d..6403d2d43864 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -35,6 +35,7 @@
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
@@ -53,8 +54,20 @@
#include "microchip-isc-regs.h"
#include "microchip-isc.h"

-#define ISC_SAMA7G5_MAX_SUPPORT_WIDTH 3264
-#define ISC_SAMA7G5_MAX_SUPPORT_HEIGHT 2464
+struct isc_xisc_data {
+ u32 max_width;
+ u32 max_height;
+};
+
+static const struct isc_xisc_data isc_sama7g5_data = {
+ .max_width = 3264,
+ .max_height = 2464,
+};
+
+static const struct isc_xisc_data isc_sam9x7_data = {
+ .max_width = 2560,
+ .max_height = 1920,
+};

#define ISC_SAMA7G5_PIPELINE \
(WB_ENABLE | CFA_ENABLE | CC_ENABLE | GAM_ENABLES | CSC_ENABLE | \
@@ -403,6 +416,7 @@ static int microchip_xisc_probe(struct platform_device *pdev)
struct isc_device *isc;
void __iomem *io_base;
struct isc_subdev_entity *subdev_entity;
+ const struct isc_xisc_data *data;
int irq;
int ret;
u32 ver;
@@ -450,8 +464,12 @@ static int microchip_xisc_probe(struct platform_device *pdev)
isc->gamma_table = isc_sama7g5_gamma_table;
isc->gamma_max = 0;

- isc->max_width = ISC_SAMA7G5_MAX_SUPPORT_WIDTH;
- isc->max_height = ISC_SAMA7G5_MAX_SUPPORT_HEIGHT;
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return dev_err_probe(dev, -ENODEV, "no match data\n");
+
+ isc->max_width = data->max_width;
+ isc->max_height = data->max_height;

isc->config_dpc = isc_sama7g5_config_dpc;
isc->config_csc = isc_sama7g5_config_csc;
@@ -626,7 +644,8 @@ static const struct dev_pm_ops microchip_xisc_dev_pm_ops = {

#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id microchip_xisc_of_match[] = {
- { .compatible = "microchip,sama7g5-isc" },
+ { .compatible = "microchip,sama7g5-isc", .data = &isc_sama7g5_data },
+ { .compatible = "microchip,sam9x7-isc", .data = &isc_sam9x7_data },
{ }
};
MODULE_DEVICE_TABLE(of, microchip_xisc_of_match);

--
2.34.1