Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp643061rdb; Thu, 21 Dec 2023 23:58:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjyjl6a3PKYib0i37VRS9Sc642yZrzSaJR99fgm2236ML6AxIXY0YxUDdD4Tnuj5r2Yxcs X-Received: by 2002:a17:902:e746:b0:1d0:a9fa:58eb with SMTP id p6-20020a170902e74600b001d0a9fa58ebmr644538plf.122.1703231935154; Thu, 21 Dec 2023 23:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703231935; cv=none; d=google.com; s=arc-20160816; b=pQsLEGO0iKIkwtaIm095FpDQHEROmTQkZSimU4BW4XnTxw+gt15y6CvHg6ULuIchDC 55yw4qQo1XmeRViZrTo9sfGC0vMYw99KXORMPpeBNgPZ5D57J1Q9QOJ+FZQbzuda8ZP1 JgIzpvyebcNUYvo8WaguWLHMjshQXFwmf+W8jm0v3DhUHpHiVPDf1VyPXluvjUfm/GE7 STACq6Q1q8UJHT7hTEV4eveQwMMk2PICLc48lnvn5yYuhfdOoNZLyH8ZE+BgXxNwChL0 81KYoPXWhxWuyV92TvEvaju87C481FSQLqA9ZKqYPNnwAw39oA2o8Ep+24OIcc0XQ1de fldQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=74z8R0GYRzWZpOzy1OuxErfK7kycbJx86pGUD4u2Xjo=; fh=4x4CVoEVJ/qmUij6PguRWMnP5yWSWHxwDunzVsvJyrM=; b=ASA8HMui06CLawdvqTIMf1DxolH02QKNgaLA1/poDI8/zVGUoqcyrtzKAvut7POX2e cleNxvczbh0t6Yl0FkeV2vpJR/lhjGLzWQW6Ck3yq5bqtrbuJwZyEsFXeE19me+Ta8oG q4N2ZD8t54uJ8GkmCTMboeMJ0aj530XrsVA068you8NL4VlJKFfJl2S1A9ZnPbpyDCQA fJkb7BQYxldDtjFVvnr/YHhjyLcgeLKfhsRCI4POaP2ujzaRKVBjVzq6frUdMv9c1RQj +9YzJMKwnCY5CUJWspDBB7QigvfNyUZJrhSBntjQYxpsmFTirZojJL7VGtJzELSUqi3P PtWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-9467-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9467-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n4-20020a170902e54400b001d34a9f57a5si2840315plf.314.2023.12.21.23.58.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 23:58:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9467-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-9467-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9467-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CE786286B04 for ; Fri, 22 Dec 2023 07:58:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EB6CC15E; Fri, 22 Dec 2023 07:58:42 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D24439468; Fri, 22 Dec 2023 07:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 3BM7wODs91988916, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 3BM7wODs91988916 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Dec 2023 15:58:24 +0800 Received: from RTEXDAG01.realtek.com.tw (172.21.6.100) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Fri, 22 Dec 2023 15:58:24 +0800 Received: from RTEXH36506.realtek.com.tw (172.21.6.27) by RTEXDAG01.realtek.com.tw (172.21.6.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 22 Dec 2023 15:58:24 +0800 Received: from localhost.localdomain (172.21.252.101) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server id 15.1.2507.17 via Frontend Transport; Fri, 22 Dec 2023 15:58:24 +0800 From: Tzuyi Chang To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , TY Chang Subject: [PATCH v4 0/2] Add gpio driver support for Realtek DHC SoCs Date: Fri, 22 Dec 2023 15:58:10 +0800 Message-ID: <20231222075812.6540-1-tychang@realtek.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-KSE-ServerInfo: RTEXDAG01.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback These patches add the bindings and the gpio driver for Realtek DHC(Digital Home Center) RTD SoCs, including RTD1295, RTD1395, RTD1619, RTD1319, RTD1619B, RTD1319D and RTD1315E. Change log: v3->v4: 1. Arrange the compatible list in alphanumerical order. 2. Remove the size check for the offset array. 3. Add the debounce callback. 4. Conducted a review of the critical section, employing raw_spinlock_t for locking purposes. 5. Add gpiochip_enable_irq/gpiochip_disable_irq to fulfill the immutability requirements. 6. Use irqd_to_hwirq to get hwirq. v2->v3: 1. Remove generic compatible and use SoC-specific compatible instead. 2. Add the missing descriptions for the rtd_gpio_info structure members. 3. Assign gpio_chip fwnode. v1->v2: 1. Add description for DHC RTD SoCs in the bindings. 2. Revise the compatible names in the bindings. 3. Transitioned from OF API to platform_device API. 4. Use u8 for the offset array within the rtd_gpio_info structure. 5. Record the size of each array within the rtd_gpio_info structure and implement checks to prevent out-of-bounds access. 6. Use GPIOLIB_IRQCHIP helpers to register interrupts. 7. Use dynamic allocation for GPIO base. Tzuyi Chang (2): dt-bindings: gpio: realtek: Add realtek,rtd-gpio Add GPIO support for Realtek DHC(Digital Home Center) RTD SoCs. .../bindings/gpio/realtek,rtd-gpio.yaml | 69 ++ drivers/gpio/Kconfig | 9 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-rtd.c | 616 ++++++++++++++++++ 4 files changed, 695 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/realtek,rtd-gpio.yaml create mode 100644 drivers/gpio/gpio-rtd.c -- 2.43.0