diff mbox series

[v4,4/6] irqchip: Introduce RTD1319D support using the Realtek common interrupt controller driver

Message ID 20231228060825.1380439-5-james.tai@realtek.com
State New
Headers show
Series Initial support for the Realtek interrupt controller | expand

Commit Message

James Tai Dec. 28, 2023, 6:08 a.m. UTC
Add support for the RTD1319D platform.

Signed-off-by: James Tai <james.tai@realtek.com>
---
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Marc Zyngier <maz@kernel.org>
CC: linux-kernel@vger.kernel.org

v3 to v4 change:
- Replaced the 'core_initcall' with 'module_init'
- Removed redundant header files
- Moved the function of suspend and resume to common code
- Improved the description of config

v2 to v3 change:
- Unchanged

v1 to v2 change:
- Resolved kernel test robot build warnings
- Replaced magic number with macro
- Fixed code style issues

 drivers/irqchip/Kconfig                |  10 ++
 drivers/irqchip/Makefile               |   1 +
 drivers/irqchip/irq-realtek-rtd1319d.c | 196 +++++++++++++++++++++++++
 3 files changed, 207 insertions(+)
 create mode 100644 drivers/irqchip/irq-realtek-rtd1319d.c

Comments

kernel test robot Jan. 9, 2024, 4:45 a.m. UTC | #1
Hi James,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on robh/for-next linus/master v6.7 next-20240108]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/James-Tai/dt-bindings-interrupt-controller-Add-support-for-Realtek-DHC-SoCs/20231228-141213
base:   tip/irq/core
patch link:    https://lore.kernel.org/r/20231228060825.1380439-5-james.tai%40realtek.com
patch subject: [PATCH v4 4/6] irqchip: Introduce RTD1319D support using the Realtek common interrupt controller driver
config: s390-randconfig-r113-20240109 (https://download.01.org/0day-ci/archive/20240109/202401091218.1mO2PJxw-lkp@intel.com/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0)
reproduce: (https://download.01.org/0day-ci/archive/20240109/202401091218.1mO2PJxw-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401091218.1mO2PJxw-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/irqchip/irq-realtek-intc-common.c:8:
   In file included from include/linux/irqchip.h:17:
   In file included from include/linux/of_irq.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:78:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
         |                                                           ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
     102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
         |                                                      ^
   In file included from drivers/irqchip/irq-realtek-intc-common.c:8:
   In file included from include/linux/irqchip.h:17:
   In file included from include/linux/of_irq.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:78:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
         |                                                           ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   In file included from drivers/irqchip/irq-realtek-intc-common.c:8:
   In file included from include/linux/irqchip.h:17:
   In file included from include/linux/of_irq.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:78:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     692 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     700 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     708 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     717 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     726 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     735 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
>> drivers/irqchip/irq-realtek-intc-common.c:204:3: error: call to undeclared function 'iounmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     204 |                 iounmap(data->base);
         |                 ^
   arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
      29 | #define iounmap iounmap
         |                 ^
   drivers/irqchip/irq-realtek-intc-common.c:204:3: note: did you mean 'vunmap'?
   arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
      29 | #define iounmap iounmap
         |                 ^
   include/linux/vmalloc.h:167:13: note: 'vunmap' declared here
     167 | extern void vunmap(const void *addr);
         |             ^
   12 warnings and 1 error generated.


vim +/iounmap +204 drivers/irqchip/irq-realtek-intc-common.c

59fe9dce1f284e James Tai 2023-12-28  161  
59fe9dce1f284e James Tai 2023-12-28  162  int realtek_intc_probe(struct platform_device *pdev, const struct realtek_intc_info *info)
59fe9dce1f284e James Tai 2023-12-28  163  {
59fe9dce1f284e James Tai 2023-12-28  164  	struct realtek_intc_data *data;
59fe9dce1f284e James Tai 2023-12-28  165  	struct device *dev = &pdev->dev;
59fe9dce1f284e James Tai 2023-12-28  166  	struct device_node *node = dev->of_node;
59fe9dce1f284e James Tai 2023-12-28  167  	int ret, i;
59fe9dce1f284e James Tai 2023-12-28  168  
59fe9dce1f284e James Tai 2023-12-28  169  	data = devm_kzalloc(dev, struct_size(data, subset_data, info->subset_num), GFP_KERNEL);
59fe9dce1f284e James Tai 2023-12-28  170  	if (!data)
59fe9dce1f284e James Tai 2023-12-28  171  		return -ENOMEM;
59fe9dce1f284e James Tai 2023-12-28  172  
59fe9dce1f284e James Tai 2023-12-28  173  	data->base = of_iomap(node, 0);
59fe9dce1f284e James Tai 2023-12-28  174  	if (!data->base)
59fe9dce1f284e James Tai 2023-12-28  175  		goto iomap_cleanup;
59fe9dce1f284e James Tai 2023-12-28  176  
59fe9dce1f284e James Tai 2023-12-28  177  	data->info = info;
59fe9dce1f284e James Tai 2023-12-28  178  
59fe9dce1f284e James Tai 2023-12-28  179  	raw_spin_lock_init(&data->lock);
59fe9dce1f284e James Tai 2023-12-28  180  
59fe9dce1f284e James Tai 2023-12-28  181  	data->domain = irq_domain_add_linear(node, 32, &realtek_intc_domain_ops, data);
59fe9dce1f284e James Tai 2023-12-28  182  	if (!data->domain)
59fe9dce1f284e James Tai 2023-12-28  183  		goto iomap_cleanup;
59fe9dce1f284e James Tai 2023-12-28  184  
59fe9dce1f284e James Tai 2023-12-28  185  	data->subset_data_num = info->subset_num;
59fe9dce1f284e James Tai 2023-12-28  186  	for (i = 0; i < info->subset_num; i++) {
59fe9dce1f284e James Tai 2023-12-28  187  		ret = realtek_intc_subset(node, data, i);
59fe9dce1f284e James Tai 2023-12-28  188  		if (ret <= 0) {
59fe9dce1f284e James Tai 2023-12-28  189  			dev_err(dev, "failed to init subset %d: %d", i, ret);
59fe9dce1f284e James Tai 2023-12-28  190  			goto irq_domain_cleanup;
59fe9dce1f284e James Tai 2023-12-28  191  		}
59fe9dce1f284e James Tai 2023-12-28  192  	}
59fe9dce1f284e James Tai 2023-12-28  193  
59fe9dce1f284e James Tai 2023-12-28  194  	platform_set_drvdata(pdev, data);
59fe9dce1f284e James Tai 2023-12-28  195  
59fe9dce1f284e James Tai 2023-12-28  196  	return 0;
59fe9dce1f284e James Tai 2023-12-28  197  
59fe9dce1f284e James Tai 2023-12-28  198  irq_domain_cleanup:
59fe9dce1f284e James Tai 2023-12-28  199  	if (data->domain)
59fe9dce1f284e James Tai 2023-12-28  200  		irq_domain_remove(data->domain);
59fe9dce1f284e James Tai 2023-12-28  201  
59fe9dce1f284e James Tai 2023-12-28  202  iomap_cleanup:
59fe9dce1f284e James Tai 2023-12-28  203  	if (data->base)
59fe9dce1f284e James Tai 2023-12-28 @204  		iounmap(data->base);
59fe9dce1f284e James Tai 2023-12-28  205  
59fe9dce1f284e James Tai 2023-12-28  206  	return -ENOMEM;
59fe9dce1f284e James Tai 2023-12-28  207  }
59fe9dce1f284e James Tai 2023-12-28  208  EXPORT_SYMBOL_GPL(realtek_intc_probe);
59fe9dce1f284e James Tai 2023-12-28  209
diff mbox series

Patch

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index b17006ff38c4..e34312ef7cd4 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -232,6 +232,16 @@  config REALTEK_RTD1319_INTC
 
 	  If unsure, say N.
 
+config REALTEK_RTD1319D_INTC
+	tristate "Realtek RTD1319D interrupt controller"
+	select REALTEK_DHC_INTC
+	help
+	  Enable support for the Realtek RTD1319D SoC Interrupt Controller.
+	  Each Realtek DHC SoC has two sets of interrupt controllers, each
+	  capable of handling up to 32 interrupts.
+
+	  If unsure, say N.
+
 config RENESAS_INTC_IRQPIN
 	bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST
 	select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 6a2650b0a924..c8adaed4c1b2 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -49,6 +49,7 @@  obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RDA_INTC)			+= irq-rda-intc.o
 obj-$(CONFIG_REALTEK_DHC_INTC)		+= irq-realtek-intc-common.o
 obj-$(CONFIG_REALTEK_RTD1319_INTC)	+= irq-realtek-rtd1319.o
+obj-$(CONFIG_REALTEK_RTD1319D_INTC)	+= irq-realtek-rtd1319d.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_RENESAS_RZA1_IRQC)		+= irq-renesas-rza1.o
diff --git a/drivers/irqchip/irq-realtek-rtd1319d.c b/drivers/irqchip/irq-realtek-rtd1319d.c
new file mode 100644
index 000000000000..8a18adeedc67
--- /dev/null
+++ b/drivers/irqchip/irq-realtek-rtd1319d.c
@@ -0,0 +1,196 @@ 
+// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
+/*
+ * Realtek RTD1319D interrupt controller driver
+ *
+ * Copyright (c) 2023 Realtek Semiconductor Corporation
+ */
+
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#include "irq-realtek-intc-common.h"
+
+#define ISO_NMI_WDT_MASK     0x08008090
+#define ISO_NORMAL_MASK      0xf7ff7f6e
+#define MISC_NORMAL_MASK     0xffe0ded6
+#define MISC_UART1_MASK      0x00000028
+#define MISC_UART2_MASK      0x00002100
+
+#define ISO_ISR_EN_OFFSET    0x40
+#define ISO_ISR_OFFSET       0
+#define ISO_ISR_UMSK_OFFSET  0x4
+#define MISC_ISR_EN_OFFSET   0x80
+#define MISC_ISR_OFFSET      0xc
+#define MISC_ISR_UMSK_OFFSET 0x8
+
+enum rtd1319d_iso_isr_bits {
+	RTD1319D_ISO_ISR_TC3_SHIFT	   = 1,
+	RTD1319D_ISO_ISR_UR0_SHIFT	   = 2,
+	RTD1319D_ISO_ISR_LSADC0_SHIFT	   = 3,
+	RTD1319D_ISO_ISR_WDOG1_NMI_SHIFT   = 4,
+	RTD1319D_ISO_ISR_IRDA_SHIFT	   = 5,
+	RTD1319D_ISO_ISR_SPI1_SHIFT	   = 6,
+	RTD1319D_ISO_ISR_WDOG2_NMI_SHIFT   = 7,
+	RTD1319D_ISO_ISR_I2C0_SHIFT	   = 8,
+	RTD1319D_ISO_ISR_TC4_SHIFT	   = 9,
+	RTD1319D_ISO_ISR_TC7_SHIFT	   = 10,
+	RTD1319D_ISO_ISR_I2C1_SHIFT	   = 11,
+	RTD1319D_ISO_ISR_HIFI_WAKEUP_SHIFT = 14,
+	RTD1319D_ISO_ISR_WDOG4_NMI_SHIFT   = 15,
+	RTD1319D_ISO_ISR_TC8_SHIFT	   = 16,
+	RTD1319D_ISO_ISR_VFD_SHIFT	   = 17,
+	RTD1319D_ISO_ISR_VTC_SHIFT	   = 18,
+	RTD1319D_ISO_ISR_GPIOA_SHIFT	   = 19,
+	RTD1319D_ISO_ISR_GPIODA_SHIFT	   = 20,
+	RTD1319D_ISO_ISR_ISO_MISC_SHIFT	   = 21,
+	RTD1319D_ISO_ISR_CBUS_SHIFT	   = 22,
+	RTD1319D_ISO_ISR_ETN_SHIFT	   = 23,
+	RTD1319D_ISO_ISR_USB_HOST_SHIFT	   = 24,
+	RTD1319D_ISO_ISR_USB_U3_DRD_SHIFT  = 25,
+	RTD1319D_ISO_ISR_USB_U2_DRD_SHIFT  = 26,
+	RTD1319D_ISO_ISR_WDOG3_NMI_SHIFT   = 27,
+	RTD1319D_ISO_ISR_PORB_HV_CEN_SHIFT = 28,
+	RTD1319D_ISO_ISR_PORB_DV_CEN_SHIFT = 29,
+	RTD1319D_ISO_ISR_PORB_AV_CEN_SHIFT = 30,
+	RTD1319D_ISO_ISR_I2C1_REQ_SHIFT	   = 31,
+};
+
+static const u32 rtd1319d_iso_isr_to_scpu_int_en_mask[32] = {
+	[RTD1319D_ISO_ISR_SPI1_SHIFT]	     = BIT(1),
+	[RTD1319D_ISO_ISR_UR0_SHIFT]	     = BIT(2),
+	[RTD1319D_ISO_ISR_LSADC0_SHIFT]	     = BIT(3),
+	[RTD1319D_ISO_ISR_IRDA_SHIFT]	     = BIT(5),
+	[RTD1319D_ISO_ISR_I2C0_SHIFT]	     = BIT(8),
+	[RTD1319D_ISO_ISR_I2C1_SHIFT]	     = BIT(11),
+	[RTD1319D_ISO_ISR_VFD_SHIFT]	     = BIT(17),
+	[RTD1319D_ISO_ISR_GPIOA_SHIFT]	     = BIT(19),
+	[RTD1319D_ISO_ISR_GPIODA_SHIFT]	     = BIT(20),
+	[RTD1319D_ISO_ISR_PORB_HV_CEN_SHIFT] = BIT(28),
+	[RTD1319D_ISO_ISR_PORB_DV_CEN_SHIFT] = BIT(29),
+	[RTD1319D_ISO_ISR_PORB_AV_CEN_SHIFT] = BIT(30),
+	[RTD1319D_ISO_ISR_I2C1_REQ_SHIFT]    = BIT(31),
+	[RTD1319D_ISO_ISR_WDOG1_NMI_SHIFT]   = IRQ_ALWAYS_ENABLED,
+	[RTD1319D_ISO_ISR_WDOG2_NMI_SHIFT]   = IRQ_ALWAYS_ENABLED,
+	[RTD1319D_ISO_ISR_WDOG3_NMI_SHIFT]   = IRQ_ALWAYS_ENABLED,
+	[RTD1319D_ISO_ISR_WDOG4_NMI_SHIFT]   = IRQ_ALWAYS_ENABLED,
+};
+
+enum rtd1319d_misc_isr_bits {
+	RTD1319D_ISR_UR1_SHIFT	      = 3,
+	RTD1319D_ISR_TC5_SHIFT	      = 4,
+	RTD1319D_ISR_UR1_TO_SHIFT     = 5,
+	RTD1319D_ISR_TC0_SHIFT	      = 6,
+	RTD1319D_ISR_TC1_SHIFT	      = 7,
+	RTD1319D_ISR_UR2_SHIFT	      = 8,
+	RTD1319D_ISR_UR2_TO_SHIFT     = 13,
+	RTD1319D_ISR_I2C5_SHIFT	      = 14,
+	RTD1319D_ISR_I2C4_SHIFT	      = 15,
+	RTD1319D_ISR_DRTC_HSEC_SHIFT  = 16,
+	RTD1319D_ISR_DRTC_MIN_SHIFT   = 17,
+	RTD1319D_ISR_DRTC_HOUR_SHIFT  = 18,
+	RTD1319D_ISR_DRTC_DATE_SHIFT  = 19,
+	RTD1319D_ISR_DRTC_ALARM_SHIFT = 20,
+	RTD1319D_ISR_I2C3_SHIFT	      = 23,
+	RTD1319D_ISR_SC0_SHIFT	      = 24,
+	RTD1319D_ISR_SC1_SHIFT	      = 25,
+	RTD1319D_ISR_SPI_SHIFT	      = 27,
+	RTD1319D_ISR_FAN_SHIFT	      = 29,
+};
+
+static const u32 rtd1319d_misc_isr_to_scpu_int_en_mask[32] = {
+	[RTD1319D_ISR_UR1_SHIFT]	= BIT(3),
+	[RTD1319D_ISR_UR1_TO_SHIFT]	= BIT(5),
+	[RTD1319D_ISR_UR2_TO_SHIFT]	= BIT(6),
+	[RTD1319D_ISR_UR2_SHIFT]	= BIT(7),
+	[RTD1319D_ISR_I2C5_SHIFT]	= BIT(14),
+	[RTD1319D_ISR_I2C4_SHIFT]	= BIT(15),
+	[RTD1319D_ISR_DRTC_HSEC_SHIFT]	= BIT(16),
+	[RTD1319D_ISR_DRTC_MIN_SHIFT]	= BIT(17),
+	[RTD1319D_ISR_DRTC_HOUR_SHIFT]	= BIT(18),
+	[RTD1319D_ISR_DRTC_DATE_SHIFT]	= BIT(19),
+	[RTD1319D_ISR_DRTC_ALARM_SHIFT] = BIT(20),
+	[RTD1319D_ISR_SC0_SHIFT]	= BIT(24),
+	[RTD1319D_ISR_SC1_SHIFT]	= BIT(25),
+	[RTD1319D_ISR_SPI_SHIFT]	= BIT(27),
+	[RTD1319D_ISR_I2C3_SHIFT]	= BIT(28),
+	[RTD1319D_ISR_FAN_SHIFT]	= BIT(29),
+};
+
+static struct realtek_intc_mask rtd1319d_intc_iso_cfgs[] = {
+	{ ISO_NORMAL_MASK, },
+	{ ISO_NMI_WDT_MASK, },
+};
+
+static const struct realtek_intc_info rtd1319d_intc_iso_info = {
+	.isr_offset		 = ISO_ISR_OFFSET,
+	.scpu_int_en_offset	 = ISO_ISR_EN_OFFSET,
+	.isr_to_scpu_int_en_mask = rtd1319d_iso_isr_to_scpu_int_en_mask,
+	.subset_mask		 = rtd1319d_intc_iso_cfgs,
+	.subset_num		 = ARRAY_SIZE(rtd1319d_intc_iso_cfgs),
+};
+
+static struct realtek_intc_mask rtd1319d_intc_misc_cfgs[] = {
+	{ MISC_NORMAL_MASK, },
+	{ MISC_UART1_MASK, },
+	{ MISC_UART2_MASK, },
+};
+
+static const struct realtek_intc_info rtd1319d_intc_misc_info = {
+	.isr_offset		 = MISC_ISR_OFFSET,
+	.scpu_int_en_offset	 = MISC_ISR_EN_OFFSET,
+	.isr_to_scpu_int_en_mask = rtd1319d_misc_isr_to_scpu_int_en_mask,
+	.subset_mask		 = rtd1319d_intc_misc_cfgs,
+	.subset_num		 = ARRAY_SIZE(rtd1319d_intc_misc_cfgs),
+};
+
+static const struct of_device_id realtek_intc_rtd1319d_dt_matches[] = {
+	{
+		.compatible = "realtek,rtd1319d-intc-iso",
+		.data = &rtd1319d_intc_iso_info,
+	}, {
+		.compatible = "realtek,rtd1319d-intc-misc",
+		.data = &rtd1319d_intc_misc_info,
+	},
+	{ /* sentinel */ }
+};
+
+static const struct dev_pm_ops realtek_intc_rtd1319d_pm_ops = {
+	.suspend_noirq = realtek_intc_suspend,
+	.resume_noirq  = realtek_intc_resume,
+};
+
+static int rtd1319d_intc_probe(struct platform_device *pdev)
+{
+	const struct realtek_intc_info *info;
+
+	info = of_device_get_match_data(&pdev->dev);
+	if (!info)
+		return -EINVAL;
+
+	return realtek_intc_probe(pdev, info);
+}
+
+static struct platform_driver realtek_intc_rtd1319d_driver = {
+	.probe = rtd1319d_intc_probe,
+	.driver = {
+		.name = "realtek_intc_rtd1319d",
+		.of_match_table = realtek_intc_rtd1319d_dt_matches,
+		.suppress_bind_attrs = true,
+		.pm = &realtek_intc_rtd1319d_pm_ops,
+	},
+};
+
+static int __init realtek_intc_rtd1319d_init(void)
+{
+	return platform_driver_register(&realtek_intc_rtd1319d_driver);
+}
+module_init(realtek_intc_rtd1319d_init);
+
+static void __exit realtek_intc_rtd1319d_exit(void)
+{
+	platform_driver_unregister(&realtek_intc_rtd1319d_driver);
+}
+module_exit(realtek_intc_rtd1319d_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Realtek RTD1319D Interrupt Controller Driver");