Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1425415rdb; Sat, 23 Dec 2023 06:19:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGV3sIVMLTUUSJcA88A5ATdz2smFFn+G0Up2XxvgybvuKp6/ranxBYAekntCnczlQTxhA90 X-Received: by 2002:a05:6e02:156d:b0:35f:edfc:e24b with SMTP id k13-20020a056e02156d00b0035fedfce24bmr1169870ilu.118.1703341174674; Sat, 23 Dec 2023 06:19:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703341174; cv=none; d=google.com; s=arc-20160816; b=JxDGrp7R/FRpi+mqj8AyQJbDeIzlWigcCqXap4jBI7JqZhwTefhyLkPsmw++igNflK R1l0qUrgrAjKgHMjKH31A+DEWiyFyNR6S1AkJs8pj98eId0dCsnhMECCQccjUxJskZBy k1bSjtvbCwLOVjpYCGMX9RLcF3dg0Tlg0N1v94yvjf85XK9Wvs3AKH1fk77fP2LWf+sm R7VGtrYDh6XO9AeESnRtfu+JJ7REn7FreFq2ioOfTVzMB6xtktKVBxnPlSMrpwrsdQPL NGRLvh8XKSWVb2FPFUhjTDhU+NbzfgEY2UXNr23zLq3kfew4wCZGzOmJx2ZTiMBVCJnE d6Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=83VtYImUtbPprS2K355dwHQVBUydhmcdDS9Z8jHn5I8=; fh=oFz2tPYPknPX9EVKPNNu6ELMgBIge7XJxKVjFN8hBQ4=; b=xxXzJgFsXmugcUGrl/a+/JNE6qDGozJYFHSVxY8CDb+Td9SIJnS2T3zXXLfLm75GbS l6+cGA58vzHhnef6UFTgnscxukgg7+fUfc6U9yJ6vSAvWNpuq0HUWBvanCTMG2Lu9OXz 4f5zy9Z0WM8dIue8+VKHg7Qk1YoNSaTt89UJe8RqivXOSPwoOzZWp99+JCqOPi3exmCv mB4vwapuTuNx8G9KvHDZLy6dJX1KUjYdTdWy+yXilzo9tp+uMHKZTuLrm6LMqAtzA6K3 afEllo3Xkssqqt12IOs5E+ZQrVQ6q1zhRukgPeBWP4O93q8N3Oi7hsR3nEmzYuYALBv9 XY8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sZ/J7zce"; spf=pass (google.com: domain of linux-kernel+bounces-10449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ck1-20020a056a02090100b005ce054620cesi804887pgb.826.2023.12.23.06.19.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 06:19:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10449-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; dkim=pass header.i=@linaro.org header.s=google header.b="sZ/J7zce"; spf=pass (google.com: domain of linux-kernel+bounces-10449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 D37DC282E8F for ; Sat, 23 Dec 2023 14:19:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43F0BDF4F; Sat, 23 Dec 2023 14:19:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sZ/J7zce" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 E2D0BDDC4 for ; Sat, 23 Dec 2023 14:19:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a2699ee30d1so224711966b.2 for ; Sat, 23 Dec 2023 06:19:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703341163; x=1703945963; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=83VtYImUtbPprS2K355dwHQVBUydhmcdDS9Z8jHn5I8=; b=sZ/J7zcexRtLtOte5OLOCKZAZGmst2GbgqUKxLg3hjz8+4PkI75HyxuQDVxm0WYgkp y/n/crYcPo8oqBOW6HDyqjpR/EUpBSsmzbQWn53JjhEv9ZyX2TdGzBCTJGCt6aeR6Cfd 5zp2UdOGMnfz871XX8Bwk1HunSh07Xu2fHC0UErGc1Fpo65UQyanQ4YF2YwLZWFctT2/ WAK1iXITd+PMhn/G/yQK8cyzI36xLbF7NfpayInHvrF0ZgZEWApoOTvTmLJ/ld0PJVPu bBu6rYwY6LUADYtMECRDRWMpz56b4apDJnv5mnyHni1H259yFR9NKomeOqd0i5ScanhV L/Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703341163; x=1703945963; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=83VtYImUtbPprS2K355dwHQVBUydhmcdDS9Z8jHn5I8=; b=fTUPjRdzu+ioq75+UBCtzxU4E5g/NW+avL2EvmIwxkZFqAAqiw3/j9QTQorbjFA8O/ 8GzvEIIwzGYtwBNZ8Yx5B9oB0O1FRmGHaDh4pkit05QKi2wlpzZYJLETMIv5/bBrktNa 9vTXP2RUQNP8k3qF9i9+3CkJWl9zbwT/uHMdT7Siun/CZT+2WtQhBZq4norZUgL04rMP WsJMiog7YBRhQHMPp2lYX+ak05HSg0zxgj9J4wskgsNUzhZmgEXBWDScYaKRQua1aXKC ZXcPR8pw+0g2jd083JCLrv62EHIzzh5QyBi783k73UAmgvdzZD6si6cfgLWsJpHgPIVs 6jVA== X-Gm-Message-State: AOJu0YwTZ/NMmzNP/JaytIKkCf63hT62GoCghfZeoE6+bmDbObd3I1sR I9miFBggmi5x0QbK7+FLjmKd6BPe4KLvyA== X-Received: by 2002:a17:907:50a0:b0:a18:4b1b:9522 with SMTP id fv32-20020a17090750a000b00a184b1b9522mr1338999ejc.41.1703341163208; Sat, 23 Dec 2023 06:19:23 -0800 (PST) Received: from [192.168.0.22] ([78.10.206.178]) by smtp.gmail.com with ESMTPSA id ge21-20020a170907909500b00a18c2737203sm3100498ejb.109.2023.12.23.06.19.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Dec 2023 06:19:22 -0800 (PST) Message-ID: <2a44fe91-b4a5-4842-8abc-f30c532f14e0@linaro.org> Date: Sat, 23 Dec 2023 15:19:21 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/2] Add GPIO support for Realtek DHC(Digital Home Center) RTD SoCs. Content-Language: en-US To: Tzuyi Chang , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231222075812.6540-1-tychang@realtek.com> <20231222075812.6540-3-tychang@realtek.com> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296b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g3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <20231222075812.6540-3-tychang@realtek.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 22/12/2023 08:58, Tzuyi Chang wrote: > This driver enables configuration of GPIO direction, GPIO values, GPIO > debounce settings and handles GPIO interrupts. > > Signed-off-by: Tzuyi Chang > Reviewed-by: Linus Walleij > --- ... > +static int rtd_gpio_irq_set_type(struct irq_data *d, unsigned int type) > +{ > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); > + struct rtd_gpio *data = gpiochip_get_data(gc); > + irq_hw_number_t hwirq = irqd_to_hwirq(d); > + u32 mask = BIT(hwirq % 32); > + unsigned long flags; > + int dp_reg_offset; > + bool polarity; > + u32 val; > + > + dp_reg_offset = rtd_gpio_dp_offset(data, hwirq); > + > + switch (type & IRQ_TYPE_SENSE_MASK) { > + case IRQ_TYPE_EDGE_RISING: > + polarity = 1; > + break; > + > + case IRQ_TYPE_EDGE_FALLING: > + polarity = 0; > + break; > + > + case IRQ_TYPE_EDGE_BOTH: > + polarity = 1; > + break; > + > + default: > + return -EINVAL; > + } > + > + raw_spin_lock_irqsave(&data->lock, flags); Why are you using raw spinlock? This question applies to entire driver. > + > + val = readl_relaxed(data->base + dp_reg_offset); > + if (polarity) > + val |= mask; > + else > + val &= ~mask; > + writel_relaxed(val, data->base + dp_reg_offset); > + > + raw_spin_unlock_irqrestore(&data->lock, flags); > + > + return 0; > +} ... } > + > +module_init(rtd_gpio_init); > + > +static void __exit rtd_gpio_exit(void) > +{ > + platform_driver_unregister(&rtd_gpio_platform_driver); > +} > +module_exit(rtd_gpio_exit); Why not using module_platform_driver? Best regards, Krzysztof