aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorPratap Nirujogi <[email protected]>2024-05-08 02:49:46 +0000
committerAlex Deucher <[email protected]>2024-06-27 21:34:40 +0000
commit0253d718a070ba109046299847fe8f3cf7568c3c (patch)
tree59781cc8358791f36d7cd7c6e71db36e99e5b9e7 /drivers/gpu/drm/amd/amdgpu
parentdrm/amdgpu: fix Kconfig for ISP v2 (diff)
downloadkernel-0253d718a070ba109046299847fe8f3cf7568c3c.tar.gz
kernel-0253d718a070ba109046299847fe8f3cf7568c3c.zip
drm/amd/amdgpu: Map ISP interrupts as generic IRQs
Map ISP IH interrupts to Linux generic IRQ for ISP driver to handle the interrupts using MFD IORESOURCE_IRQ resource. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Pratap Nirujogi <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c31
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ih_v6_1.c6
4 files changed, 37 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 013ff373e067..19ce4da285e8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -466,7 +466,8 @@ void amdgpu_irq_dispatch(struct amdgpu_device *adev,
} else if (src_id >= AMDGPU_MAX_IRQ_SRC_ID) {
DRM_DEBUG("Invalid src_id in IV: %d\n", src_id);
- } else if ((client_id == AMDGPU_IRQ_CLIENTID_LEGACY) &&
+ } else if (((client_id == AMDGPU_IRQ_CLIENTID_LEGACY) ||
+ (client_id == SOC15_IH_CLIENTID_ISP)) &&
adev->irq.virq[src_id]) {
generic_handle_domain_irq(adev->irq.domain, src_id);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
index 25e88661ac60..52e53d2b8748 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c
@@ -31,6 +31,8 @@
#include "amdgpu.h"
#include "amdgpu_isp.h"
+#include "ivsrcid/isp/irqsrcs_isp_4_1.h"
+
#define mmDAGB0_WRCLI5_V4_1 0x6811C
#define mmDAGB0_WRCLI9_V4_1 0x6812C
#define mmDAGB0_WRCLI10_V4_1 0x68130
@@ -38,6 +40,17 @@
#define mmDAGB0_WRCLI19_V4_1 0x68154
#define mmDAGB0_WRCLI20_V4_1 0x68158
+static const unsigned int isp_int_srcid[MAX_ISP_INT_SRC] = {
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT9,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT10,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT11,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT12,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT13,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT14,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT15,
+ ISP_4_1__SRCID__ISP_RINGBUFFER_WPT16
+};
+
static int isp_sw_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -69,11 +82,12 @@ static int isp_sw_fini(void *handle)
*/
static int isp_hw_init(void *handle)
{
- int r;
- u64 isp_base;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
const struct amdgpu_ip_block *ip_block =
amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_ISP);
+ u64 isp_base;
+ int int_idx;
+ int r;
if (!ip_block)
return -EINVAL;
@@ -90,7 +104,7 @@ static int isp_hw_init(void *handle)
goto failure;
}
- adev->isp.isp_res = kcalloc(1, sizeof(struct resource), GFP_KERNEL);
+ adev->isp.isp_res = kcalloc(9, sizeof(struct resource), GFP_KERNEL);
if (!adev->isp.isp_res) {
r = -ENOMEM;
DRM_ERROR("%s: isp mfd res alloc failed\n", __func__);
@@ -114,8 +128,17 @@ static int isp_hw_init(void *handle)
adev->isp.isp_res[0].start = isp_base;
adev->isp.isp_res[0].end = isp_base + ISP_REGS_OFFSET_END;
+ for (int_idx = 0; int_idx < MAX_ISP_INT_SRC; int_idx++) {
+ adev->isp.isp_res[int_idx + 1].name = "isp_irq";
+ adev->isp.isp_res[int_idx + 1].flags = IORESOURCE_IRQ;
+ adev->isp.isp_res[int_idx + 1].start =
+ amdgpu_irq_create_mapping(adev, isp_int_srcid[int_idx]);
+ adev->isp.isp_res[int_idx + 1].end =
+ adev->isp.isp_res[int_idx + 1].start;
+ }
+
adev->isp.isp_cell[0].name = "amd_isp_capture";
- adev->isp.isp_cell[0].num_resources = 1;
+ adev->isp.isp_cell[0].num_resources = 9;
adev->isp.isp_cell[0].resources = &adev->isp.isp_res[0];
adev->isp.isp_cell[0].platform_data = adev->isp.isp_pdata;
adev->isp.isp_cell[0].pdata_size = sizeof(struct isp_platform_data);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index a11ec0543b93..764d70beb9e9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
@@ -30,6 +30,8 @@
#define ISP_REGS_OFFSET_END 0x629A4
+#define MAX_ISP_INT_SRC 8
+
struct isp_platform_data {
void *adev;
u32 asic_type;
diff --git a/drivers/gpu/drm/amd/amdgpu/ih_v6_1.c b/drivers/gpu/drm/amd/amdgpu/ih_v6_1.c
index 0fbf5fa7b0f8..2e0469feca1e 100644
--- a/drivers/gpu/drm/amd/amdgpu/ih_v6_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/ih_v6_1.c
@@ -535,6 +535,12 @@ static void ih_v6_1_set_self_irq_funcs(struct amdgpu_device *adev)
static int ih_v6_1_early_init(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+ int ret;
+
+ ret = amdgpu_irq_add_domain(adev);
+ if (ret) {
+ return ret;
+ }
ih_v6_1_set_interrupt_funcs(adev);
ih_v6_1_set_self_irq_funcs(adev);