From patchwork Thu May 25 21:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp55265vqr; Thu, 25 May 2023 14:29:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4g3B2xLxr5Ao3LOxxlOZWOadS9WNRGslepcj/Zesrd4fo2SdN/Cr3zHvUHa3UgSB3t5zKl X-Received: by 2002:a05:6a21:99a4:b0:10c:2cb7:29b1 with SMTP id ve36-20020a056a2199a400b0010c2cb729b1mr16088298pzb.51.1685050180873; Thu, 25 May 2023 14:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050180; cv=none; d=google.com; s=arc-20160816; b=ipq65DG1rJF3ykd8eALNsbzYxlfBUtGMwrBWRQgpXd3aFnKRxBd1dQiY+iLopL8Xdm Mchy8xFt4lbUVVd2XSoziIc5Aau6cvToz7G26YBANGLO+rzSURaSako4ApJ6aTOGs7na wRRrAmu3yzNG0cHs6tI8s6fjSKnorP+MoBn3si+ClYm57L4SOIyfv6e6BQ/rJK0hnYyX V4L5DgKaqYlgvAi5jtCfLJ/KQmPcbLgqDJxky4O9u37s11Obx1QFrG2yJ4B21xaulia2 hhItJXKzKAAaabqEWvHuAYkpnHl9Rjasy10aApbXewlQ+f9OvPgvCj/SENJTd/gAAaWU Ziyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=psNDpfw238rpeVPrUNUbQjD7cyckNWzhWHHZrSzHL8E=; b=wBim364XrXsnNBcsvyamm9FOJ0RcvRgcex2f9277AepVv6BLdfvVZqX+kehH25xR5H i7ETRdRPOgdJQXwLbuc+hYOkWO+MQHhtGi3YbZH3j19HrNd6BPBvavQ/sJ2NnBX0iknr GKSKTDSEsswet9FLhKbstTvF/u1LriUHAaFFj2LMD9wcay/wUeYVC3NzH75wrB4/Ont/ 8P5bWxdkQPLH9KgKj2NMlj9+wZdlzJevbv4r1sELHWKNY/KCGigKoAsPtsNxl08kHjf3 7aLAwiOfIafAjdIv4du9g6CQ4Xg4Sm0Bo1bFnxZvX1V5tcZ2qISORBqFOHKS1ZjQhnLC ysOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nuCe0J0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 85-20020a630158000000b0051ba2ec8320si1993214pgb.353.2023.05.25.14.29.04; Thu, 25 May 2023 14:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nuCe0J0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235295AbjEYV2G (ORCPT + 99 others); Thu, 25 May 2023 17:28:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233928AbjEYV2D (ORCPT ); Thu, 25 May 2023 17:28:03 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5C2819A; Thu, 25 May 2023 14:28:01 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 056FD6606E81; Thu, 25 May 2023 22:27:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050080; bh=jsynsw/ZbWVC0ttTQiwGX9l8Q++CdnsiAIG6M4Z8nRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nuCe0J0MsiSf6bFs8VW2iuq7HIenCb9alpkzMD4x6wwVGufdHwvXEYecDAZKz8B0n cVfiAtUDi5x31x6tTBlbUXL8pWVlQkWpPps14DllNKabi4Btrocm+jT1zJi7vKT8q1 XgqsgcAMMXAnodxWdcw9feelnBcLA2fh6SeWCczmgYBwulT9Ni8+Hcpf9Ct0uPqg8u 9bHzc0ALXZ3FqmR+hI8j2q0+ZAgmoAkXo39oz4YhCPb+eyoGnD49aBIc7gknRO+7A0 Edo1XSBUdkcST0SD6LkCKp10Wp1Y46oNd87xeahGmph1jHdJnmgn9tlC70k31VoMTj dAReny5cei1Qw== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , Simon Xue Subject: [PATCH v2 1/8] iio: adc: rockchip_saradc: Add callback functions Date: Fri, 26 May 2023 02:57:05 +0530 Message-Id: <20230525212712.255406-2-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903178360565337?= X-GMAIL-MSGID: =?utf-8?q?1766903178360565337?= From: Simon Xue Add start, read and power_down callback functions, which will help in adding new rockchip device support cleanly. Signed-off-by: Simon Xue Signed-off-by: Shreeya Patel --- Changes in v2 - Add a from address. - Create a separate patch for changes done in the code for old devices. drivers/iio/adc/rockchip_saradc.c | 64 +++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 79448c5ffc2a..21f9d92a6af4 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -38,10 +38,15 @@ #define SARADC_TIMEOUT msecs_to_jiffies(100) #define SARADC_MAX_CHANNELS 8 +struct rockchip_saradc; + struct rockchip_saradc_data { const struct iio_chan_spec *channels; int num_channels; unsigned long clk_rate; + void (*start)(struct rockchip_saradc *info, int chn); + int (*read)(struct rockchip_saradc *info); + void (*power_down)(struct rockchip_saradc *info); }; struct rockchip_saradc { @@ -60,27 +65,50 @@ struct rockchip_saradc { struct notifier_block nb; }; -static void rockchip_saradc_power_down(struct rockchip_saradc *info) +static void rockchip_saradc_reset_controller(struct reset_control *reset); + +static void rockchip_saradc_start_v1(struct rockchip_saradc *info, int chn) +{ + /* 8 clock periods as delay between power up and start cmd */ + writel_relaxed(8, info->regs + SARADC_DLY_PU_SOC); + /* Select the channel to be used and trigger conversion */ + writel(SARADC_CTRL_POWER_CTRL | (chn & SARADC_CTRL_CHN_MASK) | + SARADC_CTRL_IRQ_ENABLE, info->regs + SARADC_CTRL); +} + +static void rockchip_saradc_start(struct rockchip_saradc *info, int chn) +{ + info->data->start(info, chn); +} + +static int rockchip_saradc_read_v1(struct rockchip_saradc *info) +{ + return readl_relaxed(info->regs + SARADC_DATA); +} + +static int rockchip_saradc_read(struct rockchip_saradc *info) +{ + return info->data->read(info); +} + +static void rockchip_saradc_power_down_v1(struct rockchip_saradc *info) { - /* Clear irq & power down adc */ writel_relaxed(0, info->regs + SARADC_CTRL); } +static void rockchip_saradc_power_down(struct rockchip_saradc *info) +{ + if (info->data->power_down) + info->data->power_down(info); +} + static int rockchip_saradc_conversion(struct rockchip_saradc *info, struct iio_chan_spec const *chan) { reinit_completion(&info->completion); - /* 8 clock periods as delay between power up and start cmd */ - writel_relaxed(8, info->regs + SARADC_DLY_PU_SOC); - info->last_chan = chan; - - /* Select the channel to be used and trigger conversion */ - writel(SARADC_CTRL_POWER_CTRL - | (chan->channel & SARADC_CTRL_CHN_MASK) - | SARADC_CTRL_IRQ_ENABLE, - info->regs + SARADC_CTRL); + rockchip_saradc_start(info, chan->channel); if (!wait_for_completion_timeout(&info->completion, SARADC_TIMEOUT)) return -ETIMEDOUT; @@ -123,7 +151,7 @@ static irqreturn_t rockchip_saradc_isr(int irq, void *dev_id) struct rockchip_saradc *info = dev_id; /* Read value */ - info->last_val = readl_relaxed(info->regs + SARADC_DATA); + info->last_val = rockchip_saradc_read(info); info->last_val &= GENMASK(info->last_chan->scan_type.realbits - 1, 0); rockchip_saradc_power_down(info); @@ -163,6 +191,9 @@ static const struct rockchip_saradc_data saradc_data = { .channels = rockchip_saradc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_saradc_iio_channels), .clk_rate = 1000000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, }; static const struct iio_chan_spec rockchip_rk3066_tsadc_iio_channels[] = { @@ -174,6 +205,9 @@ static const struct rockchip_saradc_data rk3066_tsadc_data = { .channels = rockchip_rk3066_tsadc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_rk3066_tsadc_iio_channels), .clk_rate = 50000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, }; static const struct iio_chan_spec rockchip_rk3399_saradc_iio_channels[] = { @@ -189,6 +223,9 @@ static const struct rockchip_saradc_data rk3399_saradc_data = { .channels = rockchip_rk3399_saradc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_rk3399_saradc_iio_channels), .clk_rate = 1000000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, }; static const struct iio_chan_spec rockchip_rk3568_saradc_iio_channels[] = { @@ -206,6 +243,9 @@ static const struct rockchip_saradc_data rk3568_saradc_data = { .channels = rockchip_rk3568_saradc_iio_channels, .num_channels = ARRAY_SIZE(rockchip_rk3568_saradc_iio_channels), .clk_rate = 1000000, + .start = rockchip_saradc_start_v1, + .read = rockchip_saradc_read_v1, + .power_down = rockchip_saradc_power_down_v1, }; static const struct of_device_id rockchip_saradc_match[] = { From patchwork Thu May 25 21:27:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp55197vqr; Thu, 25 May 2023 14:29:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4G/4HI+EtReBrvPwsX7eWPrAPtKfwId2lZLS6eon/Pm2h6mRtD36PHI9wFrXxjNJy070L0 X-Received: by 2002:a05:6a20:7d8f:b0:10e:96a4:e31d with SMTP id v15-20020a056a207d8f00b0010e96a4e31dmr4634134pzj.22.1685050167692; Thu, 25 May 2023 14:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050167; cv=none; d=google.com; s=arc-20160816; b=MbvUdTWGLooqYFyGuZhv7txjcCwgORWpEhgwsis3tuFgPXRpozljN+j+UJ/I5ekcTj 7yTFUThKdvbMgaggkiBGM6otgWuMXYCJA0bMGlAyWuqfv5erul2FsavqbeWXLSw3EL2/ A/aemgFxscC2YSzdsQupTPXvPpXRl52E4mAfNwx4CAXRlqLE310Q+mAssXFIL305HEGw 2mEU6tIcQ7HLhTLIieDr5VMlaZvM30q9opxfKk/z57IPqNDYd1KkLe6uXRT3HX+VZ/xK 24/6/dnTBR/arHiZRsliqrSkZDp024rgxfE7cVNsQ3kE3BNmWsuoTDYZJNmRozPXB1VH L+nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p2U93T5wZtR9Dx27pDg09O735Z++XPIUFaWvG6ARy58=; b=ox1Qm4fCM5yfxYVUL/LH288Yk2Lhn6lbVmDjg/sf+6FJaEaXVkesEd4PLgFexjYnti TNino1gyoYda2HxcS8INq13Ka2cQl7Gn7f0hXTKMgklP5iQp8EV8GktQAcoFNjZjkPuL UPfu1KgcVs1DkRerEwh5quXenwfoZTt5tr7i6Cb55Obg70xSdQ7lxd1l5LDAIbF8uWUL TTKXS8WVWlRWejdurpdj7CXkWjdQxlfLA3c+p4yeqeau5ZcIMbKcZtNFztxI8WWGbRjY 4yHioI/V3lveP3iD1ZXiP4hMACuAIuXbL30KctyeEqDF+WtRkEONj7bVEXPFWa7FmUPt ERGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=F2JZbgpP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a63734f000000b0053ef2b7f245si186887pgn.621.2023.05.25.14.29.13; Thu, 25 May 2023 14:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=F2JZbgpP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240603AbjEYV2T (ORCPT + 99 others); Thu, 25 May 2023 17:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240106AbjEYV2L (ORCPT ); Thu, 25 May 2023 17:28:11 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDC81B4; Thu, 25 May 2023 14:28:07 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 1C9016601F54; Thu, 25 May 2023 22:28:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050086; bh=emZD6NcLmes+iVB0n2kG52Yzxt0u3x947T4LBkuC/yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2JZbgpPrBZQGllj9FVT0KUrhgTIPMlHBfUgL/7/OLQHLT3LLJQKpyN2wSARgRSgT R/V8LERTsy0virz6LpVvuDH3redoSVXs5uRv4yCKLJ9YVJc33QRZqRnAkLaEoNh/sk EMjKzIKgv69Q5eJv0t9sakGU5U/U/H4GimSll6d1XDdWBk1lxkVvbmw0dQK1a4x+kr Hi5KLDLW+T0uBJ9eJhTPPuR5t2/iWhcLj02yVsYbvMqMgI+QLwvGeILi75rHvrvuTq yczIinhIEG/AFQePtTSQypbFuvw5CMD1TQSGcBvywucDArHFIBBsSYzFM8Dd6f7O1n FjDX3pvIcCZHQ== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , Simon Xue Subject: [PATCH v2 2/8] iio: adc: rockchip_saradc: Add support for RK3588 Date: Fri, 26 May 2023 02:57:06 +0530 Message-Id: <20230525212712.255406-3-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903164389926002?= X-GMAIL-MSGID: =?utf-8?q?1766903164389926002?= From: Simon Xue Add new start and read functions to support rk3588 device. Also, add a device compatible string for the same. Signed-off-by: Simon Xue Signed-off-by: Shreeya Patel Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2 - Add a from address. - Create separate patches for adding new device support and changes to the old device code. - Make use of FIELD_PREP. drivers/iio/adc/rockchip_saradc.c | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 21f9d92a6af4..31637440be83 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -38,6 +38,22 @@ #define SARADC_TIMEOUT msecs_to_jiffies(100) #define SARADC_MAX_CHANNELS 8 +/* v2 registers */ +#define SARADC2_CONV_CON 0x0 +#define SARADC_T_PD_SOC 0x4 +#define SARADC_T_DAS_SOC 0xc +#define SARADC2_END_INT_EN 0x104 +#define SARADC2_ST_CON 0x108 +#define SARADC2_STATUS 0x10c +#define SARADC2_END_INT_ST 0x110 +#define SARADC2_DATA_BASE 0x120 + +#define SARADC2_EN_END_INT BIT(0) +#define SARADC2_START BIT(4) +#define SARADC2_SINGLE_MODE BIT(5) + +#define SARADC2_CONV_CHANNELS GENMASK(15, 0) + struct rockchip_saradc; struct rockchip_saradc_data { @@ -76,6 +92,25 @@ static void rockchip_saradc_start_v1(struct rockchip_saradc *info, int chn) SARADC_CTRL_IRQ_ENABLE, info->regs + SARADC_CTRL); } +static void rockchip_saradc_start_v2(struct rockchip_saradc *info, int chn) +{ + int val; + + if (info->reset) + rockchip_saradc_reset_controller(info->reset); + + writel_relaxed(0xc, info->regs + SARADC_T_DAS_SOC); + writel_relaxed(0x20, info->regs + SARADC_T_PD_SOC); + val = FIELD_PREP(SARADC2_EN_END_INT, 1); + val |= val << 16; + writel_relaxed(val, info->regs + SARADC2_END_INT_EN); + val = FIELD_PREP(SARADC2_START, 1) | + FIELD_PREP(SARADC2_SINGLE_MODE, 1) | + FIELD_PREP(SARADC2_CONV_CHANNELS, chn); + val |= val << 16; + writel(val, info->regs + SARADC2_CONV_CON); +} + static void rockchip_saradc_start(struct rockchip_saradc *info, int chn) { info->data->start(info, chn); @@ -86,6 +121,18 @@ static int rockchip_saradc_read_v1(struct rockchip_saradc *info) return readl_relaxed(info->regs + SARADC_DATA); } +static int rockchip_saradc_read_v2(struct rockchip_saradc *info) +{ + int offset; + + /* Clear irq */ + writel_relaxed(0x1, info->regs + SARADC2_END_INT_ST); + + offset = SARADC2_DATA_BASE + info->last_chan->channel * 0x4; + + return readl_relaxed(info->regs + offset); +} + static int rockchip_saradc_read(struct rockchip_saradc *info) { return info->data->read(info); @@ -248,6 +295,25 @@ static const struct rockchip_saradc_data rk3568_saradc_data = { .power_down = rockchip_saradc_power_down_v1, }; +static const struct iio_chan_spec rockchip_rk3588_saradc_iio_channels[] = { + SARADC_CHANNEL(0, "adc0", 12), + SARADC_CHANNEL(1, "adc1", 12), + SARADC_CHANNEL(2, "adc2", 12), + SARADC_CHANNEL(3, "adc3", 12), + SARADC_CHANNEL(4, "adc4", 12), + SARADC_CHANNEL(5, "adc5", 12), + SARADC_CHANNEL(6, "adc6", 12), + SARADC_CHANNEL(7, "adc7", 12), +}; + +static const struct rockchip_saradc_data rk3588_saradc_data = { + .channels = rockchip_rk3588_saradc_iio_channels, + .num_channels = ARRAY_SIZE(rockchip_rk3588_saradc_iio_channels), + .clk_rate = 1000000, + .start = rockchip_saradc_start_v2, + .read = rockchip_saradc_read_v2, +}; + static const struct of_device_id rockchip_saradc_match[] = { { .compatible = "rockchip,saradc", @@ -261,6 +327,9 @@ static const struct of_device_id rockchip_saradc_match[] = { }, { .compatible = "rockchip,rk3568-saradc", .data = &rk3568_saradc_data, + }, { + .compatible = "rockchip,rk3588-saradc", + .data = &rk3588_saradc_data, }, {}, }; From patchwork Thu May 25 21:27:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp59371vqr; Thu, 25 May 2023 14:37:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4M2Omlq2r4p4T1/YFKg+78Ue9/FJU4ipZlzUzF+BebdEryUH1kgMfj4GgMFxy/6dr4JiI7 X-Received: by 2002:a05:6a00:2382:b0:64d:1d84:aeb4 with SMTP id f2-20020a056a00238200b0064d1d84aeb4mr168362pfc.24.1685050653614; Thu, 25 May 2023 14:37:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050653; cv=none; d=google.com; s=arc-20160816; b=UOH4pyr4bZZl8KqpE5UHM/98c2fS8VQL07L/+Js65gGFqcgtDROQGwOjkeXG+7Rovz 7qHwd0xSSl4vZ3r4xpQmPCpkSW1AKzGm4V6EGgM0ayijbvYuG39CmOMwEzxvlMoHp7zV a/oVD+8pTB9TRYpAiLxt8Wdlq79xtrBlp4LcnxW6uo/g9devvbR3lvBwksH7/Dj9rTeD 5X/1jTHbgqJCtET7TATwsaQpxzyOq38LDyi4GT+s0Lw9Lt/nCOBmfxzVGlPmXEFLTmiD xGxh6mui9kZBxgO4U8goutm1hI3Wqk7LUrjnxAuBGpNTaPzmDj8kgH9d/hjv0hThWpf2 j2ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Zn6AJh5AVOiJOXFiew8MSQ2c79uI+xxGKI1g4HRs0JY=; b=JUwZeRVapPFmzeuEg5zijbF+w4IFICvhypE4WABpDiFO6ZeS0W8baV891Qs+VrMbvq KIFseMA7hlDMjqgCjdUrbQII1kiWitzOnOC33Oj1VzL6G0y/QtsXLHrNBaHOvvydVhL1 LMWqL5O1C6scOCvapJeRP+cNFX3nj5Fd2lNDt7jm1wi3qcxTx+f95vp0RqvYwjBZQVWu y73QTwObikWI72jdHsdlXgtsUryIbUXLzGRBQmQQ2I001ft3fHurj7a4tsG+qd05jw5R eXs32qFoZWxpTpIs73diyv/UGGYWixGt3i4qZzBNm83Bomc6eSR3n+qUzyWnROLanHqr 9Orw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LEKdNo3m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z62-20020a626541000000b0063b88f52220si2407647pfb.144.2023.05.25.14.37.19; Thu, 25 May 2023 14:37:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LEKdNo3m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233928AbjEYV2V (ORCPT + 99 others); Thu, 25 May 2023 17:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241377AbjEYV2R (ORCPT ); Thu, 25 May 2023 17:28:17 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17739E49; Thu, 25 May 2023 14:28:14 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 303346606E81; Thu, 25 May 2023 22:28:10 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050092; bh=dLuu0SEFNcIqh//QlQCte4G4opm+zXpvYd73IcKTf1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LEKdNo3mLOU+adE2Y7F/aUFFUhZfZ4UXAGvUd2GlJT0kQHuvss+mbsX/O/73C6y6E JabCu7NLEA/RPKe+5vEv5Wvs71PpxdKY0nFiXIfQu6kah/uk8fTlJiFmB8bipNl/SB Xq7EkfAvk7sSkvTZplkeRD0B1yH/9Xt0nVRSG6wEgTkP6xjF35MzQX8NZvFcFMBrVg JPBaude2yN99FKCnjjYqDbOd75/dZofAW4wHFtdUDLuQ2Te6V7D05pWlt8w+N0uqDy /ZEnRHCyETPZlASaBNmn6KKvvGOhkNBMYNShvT0TJ3udbjltyeEZKiwlJfRqVtSfBC iZI6NjMpv2bXA== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel Subject: [PATCH v2 3/8] iio: adc: rockchip_saradc: Make use of devm_clk_get_enabled Date: Fri, 26 May 2023 02:57:07 +0530 Message-Id: <20230525212712.255406-4-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903673861779171?= X-GMAIL-MSGID: =?utf-8?q?1766903673861779171?= Use devm_clk_get_enabled() to avoid manually disabling the clock. Signed-off-by: Shreeya Patel --- Changes in v2 - No need to enable the clocks earlier than the original code. Move the enablement of clocks at it's original position. drivers/iio/adc/rockchip_saradc.c | 73 ++++--------------------------- 1 file changed, 9 insertions(+), 64 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 31637440be83..41226b76a995 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -345,20 +345,6 @@ static void rockchip_saradc_reset_controller(struct reset_control *reset) reset_control_deassert(reset); } -static void rockchip_saradc_clk_disable(void *data) -{ - struct rockchip_saradc *info = data; - - clk_disable_unprepare(info->clk); -} - -static void rockchip_saradc_pclk_disable(void *data) -{ - struct rockchip_saradc *info = data; - - clk_disable_unprepare(info->pclk); -} - static void rockchip_saradc_regulator_disable(void *data) { struct rockchip_saradc *info = data; @@ -492,16 +478,6 @@ static int rockchip_saradc_probe(struct platform_device *pdev) return ret; } - info->pclk = devm_clk_get(&pdev->dev, "apb_pclk"); - if (IS_ERR(info->pclk)) - return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk), - "failed to get pclk\n"); - - info->clk = devm_clk_get(&pdev->dev, "saradc"); - if (IS_ERR(info->clk)) - return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), - "failed to get adc clock\n"); - info->vref = devm_regulator_get(&pdev->dev, "vref"); if (IS_ERR(info->vref)) return dev_err_probe(&pdev->dev, PTR_ERR(info->vref), @@ -539,31 +515,15 @@ static int rockchip_saradc_probe(struct platform_device *pdev) info->uv_vref = ret; - ret = clk_prepare_enable(info->pclk); - if (ret < 0) { - dev_err(&pdev->dev, "failed to enable pclk\n"); - return ret; - } - ret = devm_add_action_or_reset(&pdev->dev, - rockchip_saradc_pclk_disable, info); - if (ret) { - dev_err(&pdev->dev, "failed to register devm action, %d\n", - ret); - return ret; - } + info->pclk = devm_clk_get_enabled(&pdev->dev, "apb_pclk"); + if (IS_ERR(info->pclk)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk), + "failed to get pclk\n"); - ret = clk_prepare_enable(info->clk); - if (ret < 0) { - dev_err(&pdev->dev, "failed to enable converter clock\n"); - return ret; - } - ret = devm_add_action_or_reset(&pdev->dev, - rockchip_saradc_clk_disable, info); - if (ret) { - dev_err(&pdev->dev, "failed to register devm action, %d\n", - ret); - return ret; - } + info->clk = devm_clk_get_enabled(&pdev->dev, "saradc"); + if (IS_ERR(info->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), + "failed to get adc clock\n"); platform_set_drvdata(pdev, indio_dev); @@ -600,8 +560,6 @@ static int rockchip_saradc_suspend(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct rockchip_saradc *info = iio_priv(indio_dev); - clk_disable_unprepare(info->clk); - clk_disable_unprepare(info->pclk); regulator_disable(info->vref); return 0; @@ -611,21 +569,8 @@ static int rockchip_saradc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct rockchip_saradc *info = iio_priv(indio_dev); - int ret; - - ret = regulator_enable(info->vref); - if (ret) - return ret; - - ret = clk_prepare_enable(info->pclk); - if (ret) - return ret; - - ret = clk_prepare_enable(info->clk); - if (ret) - clk_disable_unprepare(info->pclk); - return ret; + return regulator_enable(info->vref); } static DEFINE_SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, From patchwork Thu May 25 21:27:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp55311vqr; Thu, 25 May 2023 14:29:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58crDUeAovEg1EIbaaqYCWkqJkEmu7g+VdYntCYyzbcvKUS4d4PrsofJnyjG2bjXMaiyz0 X-Received: by 2002:a17:903:1cf:b0:1a9:40d5:b0ae with SMTP id e15-20020a17090301cf00b001a940d5b0aemr99858plh.12.1685050187090; Thu, 25 May 2023 14:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050187; cv=none; d=google.com; s=arc-20160816; b=Oi73Xeb/ywWD6JpmvnJTD3Na1GtlZQkcW3gmOt9Cwjm376JdHV7TJx1oITF2qpBXy+ xqviuc3gL2c5+MQwPpvBmsU8j5yM28kyTZ2ml0YZKUk7jvDYgimV7HE0DDB8snqceoq9 jFxLvlhC/bP9tiXXCvnoy+NmjB/MwHWXOoVebrJbJjYVuSGUujcSweQvBj4v2hP7bKyI GmCgu7UvpzKADx4Y7meRInJXIqS91uWs4Cthy22fH/4dyqjUIQwg5aw1TcKQ0QanPjND jTMDIBZlA3ne5iN8TOitUQ0TQGGD08icBNguyq6qRaZ9pkEhizkU8T6oTFQFgCSIYusy pLJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q3aVBIb2UQThMWSJBc3+LBZO+xAU5esCX+XztnVfgbM=; b=XBVlJH9BRKd/Dtvh/q9V9I5yAzdEEeEiv1LJLYaxdv26HAXsA2zoWK2bCt+7geAv/B v6aaa+6rC1S4MdqeoX5KE+UHL4lXz3gNsoIBbrkDsQaSttAO8C5SeVaaXzS5DfxltG3Z Q2AJ1KrSuwHCNBMpct4KuLVVhSN8CvwWM+bBK6EOL3IFFuUPIFfoAdjKZldu8f1nzuGt pfoCrCU9PJlOwrXrTVlmzQM6ZIRokt4KJMViMF/JKOhwhzcaWXr7xsfXvChwX1Oe599h a7y1gdu9HXd1vRiljYIYejka9g/rc3425h0jbo9BJMx1sId93DsbCDaZ2R3XAZ6cm0aV fu/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UF0qvBDP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw9-20020a170903044900b001ae4a291a3asi2168450plb.24.2023.05.25.14.29.33; Thu, 25 May 2023 14:29:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UF0qvBDP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240778AbjEYV2f (ORCPT + 99 others); Thu, 25 May 2023 17:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbjEYV2c (ORCPT ); Thu, 25 May 2023 17:28:32 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C877E58; Thu, 25 May 2023 14:28:22 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6140C6601F54; Thu, 25 May 2023 22:28:17 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050101; bh=7hciE8XoQj7YqlZBospZkfZLJzFdMH510lvKyu7BdNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UF0qvBDPNvxoe16vml3vZK/8BatpX4/GsrtRd3QOH/jD1xufqG2yBD7FFWze7l1NK ngN34u7iM26d6UurhdFCBGS/KtTyUPFVGysd+qIlj9kZH4amPZuReUotzwENmWg08E TQNZAEBHslxP0Xo21v0FoLSiaZiEAUijpZsS+vreK/K1Zvsu6ZVMNvDYRUuUAAJjfJ k9X0Fu4yza4WvjOUY1QhqVanVn06opgwniw7kJ8XywWzzWEu5elkrm2dtrmouvnoNI H1d2Ko6fiLjHtcUOxuGxN0y0sdMFwjRlER9NWtj+fPgbz8F3Yh549tmEnWP6ZSTTZR rQ15X7TtjtufQ== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , AngeloGioacchino Del Regno Subject: [PATCH v2 4/8] iio: adc: rockchip_saradc: Use of_device_get_match_data Date: Fri, 26 May 2023 02:57:08 +0530 Message-Id: <20230525212712.255406-5-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903184781053477?= X-GMAIL-MSGID: =?utf-8?q?1766903184781053477?= Use of_device_get_match_data() to simplify the code. Signed-off-by: Shreeya Patel Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2 - Add a Reviewed-by tag. drivers/iio/adc/rockchip_saradc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 41226b76a995..1a5790264ec1 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -414,10 +414,10 @@ static void rockchip_saradc_regulator_unreg_notifier(void *data) static int rockchip_saradc_probe(struct platform_device *pdev) { + const struct rockchip_saradc_data *match_data; struct rockchip_saradc *info = NULL; struct device_node *np = pdev->dev.of_node; struct iio_dev *indio_dev = NULL; - const struct of_device_id *match; int ret; int irq; @@ -431,13 +431,13 @@ static int rockchip_saradc_probe(struct platform_device *pdev) } info = iio_priv(indio_dev); - match = of_match_device(rockchip_saradc_match, &pdev->dev); - if (!match) { + match_data = of_device_get_match_data(&pdev->dev); + if (!match_data) { dev_err(&pdev->dev, "failed to match device\n"); return -ENODEV; } - info->data = match->data; + info->data = match_data; /* Sanity check for possible later IP variants with more channels */ if (info->data->num_channels > SARADC_MAX_CHANNELS) { From patchwork Thu May 25 21:27:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp55387vqr; Thu, 25 May 2023 14:29:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mmeSUBoGLXbfnECvg3YjXYk9s3Vqpxp4ro66m4vn85O7JTC7uV8mNL1T3/BZR5Rzrodus X-Received: by 2002:a05:6a20:1446:b0:102:a593:a17c with SMTP id a6-20020a056a20144600b00102a593a17cmr5294734pzi.0.1685050197335; Thu, 25 May 2023 14:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050197; cv=none; d=google.com; s=arc-20160816; b=FumCemo00l31DqwDspC393bc5V/M8Fxda4B/w7vm36TRwWZ++Wv8mZQc5C+mrZ+ppJ U5fJ7fKjnOh7cq2zGL0NEHwo+6CXaZF2ipwExAI0+qqIvT0/s16XLP8vNM51N6Kpcw2J JPscnV1Cme6dW9D7o3KIpJcZ/HIE1AkkJKyXKEqiKhqO/OSCD9zGcAU3c2+RMwrR2USX YmADt245EFMx6czXlwzr+5/+BIgVuB2cnxOnIn7iMfQ4wY0zu8JWIV5WVmZJFuTLQEXJ M7cGBllUlMOx2AR6NhZV6BrIqbs5U2z67Knhp24X9fYBp+R/JmFbmaUoWTiWJTZiEpTq 40XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RYGVCG4VF2AqWh3ob9V7LxVJvIhcMW4ROj1t6ldL84s=; b=qTXNkM63FfGogUSjArb8YKAuomoeRy5o/+Q1aTWkwX6u0sJI+f/aw+ONRafRApRNts SstlI7MDPQv6o6nsNu4qZITYfxlnSKELNQXeSC9Jb57XvPtmHZ18zDfNQR/bzJQHCslO tVrO6p4Re67ZfxXffftSp2hv4KApJnTQ2emKuYSkcCcxfm/wFfgiRdoLut1gkcA8+28y EMpdtT4voFkybcKBV5ySlUinW4gtgDgoK+dXeZ57PkopUf3OiIzxWHb8cArZNZxP/tGT 7ACrmrxXnauJPwiJ4hIKTLzIUb8yohPXPnVCGNhWBtxpS1HOMBmRwKN7BbzUnQy5jCZH oMhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LUZxTVmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a633d02000000b0050f6925a400si2033242pga.589.2023.05.25.14.29.42; Thu, 25 May 2023 14:29:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LUZxTVmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241234AbjEYV2o (ORCPT + 99 others); Thu, 25 May 2023 17:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbjEYV2m (ORCPT ); Thu, 25 May 2023 17:28:42 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41255E66; Thu, 25 May 2023 14:28:28 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id DB18F6606E81; Thu, 25 May 2023 22:28:23 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050107; bh=j2qbhtUEhsYOgwB5yEuSREejgg5NYmlmpVBBc3uuqiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUZxTVmHdiID1uTSssQoOF+AGu9yXAC7WYp7yUjlGKRmfwNX4Zg6P2xW1uEQ9FEIM 0BqfDvFHJj1LfUySw8fmRQh6Hhm3neBnA7/m8QQ1woP/z1WfX2wOsjURNWl94FuiPZ vMQfDNeng/gK2OmVzgpOLjAWNzXMdKPndXMBMJ2NP9M+DCdk6AXvHuwlvLLVC8lXED 1PLba8uIjf5JeMFpF7kvPT6ekxCszbVajbYQYMSU1ksUmQplvtPPDVNwrdyN/qjtx5 0YrHrUq1yprxQwSSIEvQRTsadloOSmVBJ2q/D7eVIjucrotIBJx5x0yfdKeVEIyW/X xllO5CBBuKbYw== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , AngeloGioacchino Del Regno Subject: [PATCH v2 5/8] iio: adc: rockchip_saradc: Match alignment with open parenthesis Date: Fri, 26 May 2023 02:57:09 +0530 Message-Id: <20230525212712.255406-6-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903195849283427?= X-GMAIL-MSGID: =?utf-8?q?1766903195849283427?= Match alignment with open parenthesis for improving the code readability. Signed-off-by: Shreeya Patel Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2 - Add a Reviewed-by tag. drivers/iio/adc/rockchip_saradc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 1a5790264ec1..ede929d9bca0 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -150,7 +150,7 @@ static void rockchip_saradc_power_down(struct rockchip_saradc *info) } static int rockchip_saradc_conversion(struct rockchip_saradc *info, - struct iio_chan_spec const *chan) + struct iio_chan_spec const *chan) { reinit_completion(&info->completion); @@ -393,8 +393,7 @@ static irqreturn_t rockchip_saradc_trigger_handler(int irq, void *p) } static int rockchip_saradc_volt_notify(struct notifier_block *nb, - unsigned long event, - void *data) + unsigned long event, void *data) { struct rockchip_saradc *info = container_of(nb, struct rockchip_saradc, nb); From patchwork Thu May 25 21:27:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp61148vqr; Thu, 25 May 2023 14:41:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ762feLZfepYm4zXZqwXLXOFQDIoe6uxESsMlivzfNzBkFWeXLB+5/ySdkiqAajseB2Wpmu X-Received: by 2002:a17:902:7597:b0:1ae:62a6:fe61 with SMTP id j23-20020a170902759700b001ae62a6fe61mr50138pll.54.1685050901252; Thu, 25 May 2023 14:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050901; cv=none; d=google.com; s=arc-20160816; b=vuQntX3EXEZqFvLtn74U8lGevy7aVwWaYqw/Nk+mjKY09NuBKQIz/Ipicmswx1Ai0W n6q58igr/6ZoLDv5tki1jrbCewdx2h0odcQgSGNkyNdukLXwXB3Uf11Hp5helW31OC+w 6cwMR7bE8lYOy2JA2IEHSmmK8Kw+lHGndP5y4LEcNRzS4O2tWCaHPcYrI/4D8ab/IJRN cBfJpYpHs8ZCnCsjgr1AaJNp/1AoJbjsX8uWkRj0ryubGEoDj2efbjw+khi7RH2jFsKj o8SfAX3MCxvbRbAJGgtQ9RWW/EthIHwjst0WgDKV92XRxaUaHWPlQYlg9tovieMZsi1x i3Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=u3C6dVd4E6X2LT6tyMtw2Z5LV3nemhd8QsE4LAppoto=; b=w3dcnnwzWxCbaxPlWJZpVsXqrtT4yUiUr6xcashOPxUsKUJyyyC99jw8o3dJq1vpIK pkUzFB8SmNOi+eILbS1BVAaOuLN2mPgdpQ2neBrqQOjWg5UtRxP0YjcCV59lBdKB5Ltq b+plLfo10SyFmfKFJ1k/ij/Qcqzb3z89+66EMnzLe32+p614W9B+Lztr8PjGXLSTj274 eYIOZtp6pCgZgRuUPuztOGEty10YNVBvB3hKE+p642N7A1t/YqtM9t77vWZpJDcOaRTD 4EXFmbTqfzKdaFjCHu+rEmBFh35MSTDInk6C4PQ2Eqjg0RqcO6TtnlpFPIGvIsz31aaW lP4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XaWkB4Q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a170902ee5100b001a6c524c18asi2217656plo.40.2023.05.25.14.41.25; Thu, 25 May 2023 14:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XaWkB4Q6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241299AbjEYV3B (ORCPT + 99 others); Thu, 25 May 2023 17:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbjEYV24 (ORCPT ); Thu, 25 May 2023 17:28:56 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC428E7A; Thu, 25 May 2023 14:28:33 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 18DBE6606E83; Thu, 25 May 2023 22:28:28 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050112; bh=D27vPfnw18aPYNhUhk1W3Go5MIiPfMAWKC6N6Jt7LbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XaWkB4Q6bdKk5tFT+QmLTI/tXYZUPcC3yoopnZZhl5JMMbfcR4y+L2Kv1W7tNHA3i 1GwAVEJTyADTACD3rrAQhL6o5g4WO8s+JIOxNeIt9OTp8Rpldg/IUiWOjwR58F9C1l LameiIfIM7N8HczBy21QKHMRxkbRCJXET1j/WGsvKoD6hFymgsB8hA62ICzm0/BDtI SU2HGUszENEE/NOfysXujpv+Vma2yEKBn+GwS3kNQUsC7Gp2d3zGsp1NXvHxbm9RaR TOvfc2zHz06j13k4KpVwNM8b3mg2vrn7h2JwQkZ3/rEzdm8ipTCkz/rhm5Jmxt1jnX zfe33uZhIUIRA== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel Subject: [PATCH v2 6/8] iio: adc: rockchip_saradc: Use dev_err_probe Date: Fri, 26 May 2023 02:57:10 +0530 Message-Id: <20230525212712.255406-7-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903933598072575?= X-GMAIL-MSGID: =?utf-8?q?1766903933598072575?= Use dev_err_probe instead of dev_err in probe function, which simplifies code a little bit and prints the error code. Signed-off-by: Shreeya Patel --- Changes in v2 - No changes drivers/iio/adc/rockchip_saradc.c | 45 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index ede929d9bca0..54c1c2f018a9 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -424,25 +424,23 @@ static int rockchip_saradc_probe(struct platform_device *pdev) return -ENODEV; indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info)); - if (!indio_dev) { - dev_err(&pdev->dev, "failed allocating iio device\n"); - return -ENOMEM; - } + if (!indio_dev) + return dev_err_probe(&pdev->dev, -ENOMEM, + "failed allocating iio device\n"); + info = iio_priv(indio_dev); match_data = of_device_get_match_data(&pdev->dev); - if (!match_data) { - dev_err(&pdev->dev, "failed to match device\n"); - return -ENODEV; - } + if (!match_data) + return dev_err_probe(&pdev->dev, -ENODEV, + "failed to match device\n"); info->data = match_data; /* Sanity check for possible later IP variants with more channels */ - if (info->data->num_channels > SARADC_MAX_CHANNELS) { - dev_err(&pdev->dev, "max channels exceeded"); - return -EINVAL; - } + if (info->data->num_channels > SARADC_MAX_CHANNELS) + return dev_err_probe(&pdev->dev, -EINVAL, + "max channels exceeded"); info->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(info->regs)) @@ -490,23 +488,20 @@ static int rockchip_saradc_probe(struct platform_device *pdev) * This may become user-configurable in the future. */ ret = clk_set_rate(info->clk, info->data->clk_rate); - if (ret < 0) { - dev_err(&pdev->dev, "failed to set adc clk rate, %d\n", ret); - return ret; - } + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, + "failed to set adc clk rate\n"); ret = regulator_enable(info->vref); - if (ret < 0) { - dev_err(&pdev->dev, "failed to enable vref regulator\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(&pdev->dev, ret, + "failed to enable vref regulator\n"); + ret = devm_add_action_or_reset(&pdev->dev, rockchip_saradc_regulator_disable, info); - if (ret) { - dev_err(&pdev->dev, "failed to register devm action, %d\n", - ret); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, + "failed to register devm action\n"); ret = regulator_get_voltage(info->vref); if (ret < 0) From patchwork Thu May 25 21:27:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp62052vqr; Thu, 25 May 2023 14:43:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4sNQdY6QPsOdJkn5v8U69a+BGl65j1EYGihRXeh+8YY5yxZNi7JWnPkH+YVqZCqljSrE78 X-Received: by 2002:a05:6a20:4323:b0:100:ba96:e5e7 with SMTP id h35-20020a056a20432300b00100ba96e5e7mr5235528pzk.18.1685051025762; Thu, 25 May 2023 14:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685051025; cv=none; d=google.com; s=arc-20160816; b=E52xO4BGE8JNzw71cU/8DgGx9q3jvf/XofdThZeJBchLEJxC9I7kG3d0HIOfDSoq8B wb7PyMsz7yGvCBQlc/35D6IMpZjnrvelyjpxNJGXDKvEU/qak7pZtwHr9kr++KnRGFQ6 c1h0SfbUmJ+uNaVeDQSUZHG2WZ+EGAKPEpl09wTMNdENbp3kAL8rrN7mdr7IWRmB8i7f KIB/M0gBp/0ZXI3ta41Vy8EES56s/2tELrPrZ/IxoZK169M8psWssOaTMCka+nyOYnkk fNR8UFY9E6tuIjgGUT+nzZZuum3KWI6+bmpALmN2lNg/2nSGXPmXyUEtJoHd31f+1GTE PO/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UYjWEq3orMFhJrzT46VOCnB3tr+asGmyP3D+XNAeK+I=; b=GJM8icCfhI3O3hCuINOjZWAMGGVd5b4p88vvj78lM7uqROTCCj2+BOwQqLl2DJ0/21 5431tQyT+6jTELOVdS1GL5/X3iJNd65qIMZL5EKHJO1QYmAUiDNYGZZFm3pEmh4Wi6fd JNkRjX8dirbTYokSGLp/6oeLxmELw3+1r81yzUrq4dDpuYAgUhY6ZwCHUOa13/L7zzPi MHYQb+hAJK3kxEw5fr2Dg8NsbJn/S2VZykOOOnFvkQoPri0BBmbY7IaOuHhp2rt/6YWA 4l6hgEpmpSvdosUar+AvL5e44flA9EipBOy5sMQjSsQ9EeKZn25hjJTHsx9AvT/91wS2 eyWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aTpxDm1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020aa78bd2000000b00643970acd01si1590623pfd.319.2023.05.25.14.43.31; Thu, 25 May 2023 14:43:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=aTpxDm1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241380AbjEYV3X (ORCPT + 99 others); Thu, 25 May 2023 17:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbjEYV3V (ORCPT ); Thu, 25 May 2023 17:29:21 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE74E63; Thu, 25 May 2023 14:28:43 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id 8A22E6601F54; Thu, 25 May 2023 22:28:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050120; bh=++O4b/Q8RT0tumJ2kVSeNSDuZ1DIcVjmUFpZkUqRN3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aTpxDm1BBLXlvwmXlmwDb98jxiFzYJMLKkKyRkTpKMGbZIAWai2ybe0nSO4IolJBb gLEgW1GoZZoIhrPeJqMQR7ibC/Jcx+yPTUBGT0t2E4+pXyJbwAHV3pdJFceHi29R2e RhE+E7z0AJZTbxcXHo4z2NTzNrptOg+nW4XR6l/X1olsQR+B1UvV1D39o7YVgLZeJ8 0bAx4zQz5lC/Tv2UyWMfXl0DCGNjVMnsQFv3txaQCuLpgdH8jUEIj4FkE97a0d6798 k/cxl84DKfbXAmEw+jnxlSgvESmWYDbV5NzXyp3QkA41/QyATMBnTIo7hLpxP12cwG zWqVJpMCQTxog== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel Subject: [PATCH v2 7/8] arm64: dts: rockchip: Add DT node for ADC support in RK3588 Date: Fri, 26 May 2023 02:57:11 +0530 Message-Id: <20230525212712.255406-8-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766904064334412822?= X-GMAIL-MSGID: =?utf-8?q?1766904064334412822?= Add DT node for ADC support in RK3588. Signed-off-by: Shreeya Patel --- Changes in v2 - No changes. arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi index 5d010f34a7f7..9cfa7ba97461 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi @@ -1913,6 +1913,18 @@ dmac2: dma-controller@fed10000 { #dma-cells = <1>; }; + saradc: saradc@fec10000 { + compatible = "rockchip,rk3588-saradc"; + reg = <0x0 0xfec10000 0x0 0x10000>; + interrupts = ; + #io-channel-cells = <1>; + clocks = <&cru CLK_SARADC>, <&cru PCLK_SARADC>; + clock-names = "saradc", "apb_pclk"; + resets = <&cru SRST_P_SARADC>; + reset-names = "saradc-apb"; + status = "disabled"; + }; + system_sram2: sram@ff001000 { compatible = "mmio-sram"; reg = <0x0 0xff001000 0x0 0xef000>; From patchwork Thu May 25 21:27:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 99212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp56888vqr; Thu, 25 May 2023 14:32:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zWhdmdx96SIZfMIgSjXozPq9RBKHq35CypmjX7Yu30M27ki9gWl1KtOKJDyIBfclV37Wm X-Received: by 2002:a05:6a20:7493:b0:104:7a4c:6ca6 with SMTP id p19-20020a056a20749300b001047a4c6ca6mr23172444pzd.13.1685050360406; Thu, 25 May 2023 14:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685050360; cv=none; d=google.com; s=arc-20160816; b=OVVhFQPW/Knbwvs5MDDQkLhq0bLkq6NOOlbuLsTjhfjrScQU0fmQyANN+94fc/fQwf 3vuvJ/yWn7rzwr2HvgliuLH+ICGr0C6hM72m0xB6VDrhZ3JAts8cDyK6XXnEsOMsjAUz ZM4/DHVaB47v0qfIMhKL4J78SkbuebtcJ5fBvIDudk2cMFDyvsAZ7qRIHIH9OY2QdmG9 2giI4EXiwoM9ulzPx8vP9yOG5Mlt+I94EWlfhh5CXBGXoGA9k1SvR4tSiyHVUn7WGwxy pU+xF/zYI1XVPcv++v0fQXw0g9ZHI9AlcLzb9yU/tPE+nmtPYZLKy6FNsnzRU1PkYUML KtLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nV2avb5NTlcaREOckq2kW5C2eKdZv/MSEKqadYUOdbo=; b=feLW8+tsoWn8bNR/jg6ozy7PClnTVKGfrQ9yic+Y0DpCMqufxYXGmnbEeKl9Y7eidp W6UJHyE1MQugig+gc7yTqY5TaoDjXZ3PLzVqxCQrnTecf09wKYT2Bs6LqMqM1QHSUZy7 CqiyZrHmARL8fdCo/PJ1dvrVZV7NHn6QEBZF9bd0LDJOIXgWSm7Eerl7UdjL/vs5oEpJ DktO599k91k4oS8b4XqXq56O4z/nzCBE08Na9FYzVigDXOjmclnp9agB/vCW+qBvYXGG aghCOspqZTBWKKdxwbiwcO/2geEDlvrzRa8e+98r2Y0beiyTR3mCq/8jVOkodpXXUpgZ nCbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=lG4FikeQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a63734f000000b0053ef2b7f245si186887pgn.621.2023.05.25.14.32.25; Thu, 25 May 2023 14:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=lG4FikeQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241523AbjEYV3c (ORCPT + 99 others); Thu, 25 May 2023 17:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241424AbjEYV3b (ORCPT ); Thu, 25 May 2023 17:29:31 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BC36194; Thu, 25 May 2023 14:28:53 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2405:201:0:21ea:e49:10dd:40c0:e842]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: shreeya) by madras.collabora.co.uk (Postfix) with ESMTPSA id F32BB6606E82; Thu, 25 May 2023 22:28:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685050125; bh=AdgtOiujGdnJQQ340NQqbEudA96I7ryN0UWjDsdCfzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lG4FikeQH1NKS/9TgwgyENYkK2aokxl3DxPPZSCqCjLzFRFCna06SITyuIMxFG4tI AyzaapWk/rdI57Rgvow8WBnVNPrFXQ3rVisw4OV+FTJkATQCPK8CDVga6AIr9R9aQ0 Fc+bIBfRy4iszF6xfcxIKOcLcO58NQlR+sXyXT2sYlnMgeleiJvfMjqLsDZraJExF9 SkkK4w/dla7azOKCb4gxGNB1eOAZbeqPUGoJwxYJe89op4udgQoNrW2iJIVXMQt4b+ IpI7THxhIvspfJoEp/6Jqi3nfRSNWtvM8f0/EC2ksfnG1BtgpoJzyaBAQbyDJzE9x5 JykoNe3wXRykA== From: Shreeya Patel To: jic23@kernel.org, lars@metafoo.de, heiko@sntech.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, sebastian.reichel@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, gustavo.padovan@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , Krzysztof Kozlowski Subject: [PATCH v2 8/8] dt-bindings: iio: adc: Add rockchip,rk3588-saradc string Date: Fri, 26 May 2023 02:57:12 +0530 Message-Id: <20230525212712.255406-9-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230525212712.255406-1-shreeya.patel@collabora.com> References: <20230525212712.255406-1-shreeya.patel@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766903366715379175?= X-GMAIL-MSGID: =?utf-8?q?1766903366715379175?= Add rockchip,rk3588-saradc compatible string. Signed-off-by: Shreeya Patel Acked-by: Krzysztof Kozlowski --- Changes in v2 - Add an Acked-by tag. Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml index da50b529c157..11c27ea451c8 100644 --- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml @@ -21,6 +21,7 @@ properties: - rockchip,rk3308-saradc - rockchip,rk3328-saradc - rockchip,rk3568-saradc + - rockchip,rk3588-saradc - rockchip,rv1108-saradc - rockchip,rv1126-saradc - const: rockchip,rk3399-saradc