From patchwork Sat Jun 3 18:53:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1802739vqr; Sat, 3 Jun 2023 11:59:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5bJPHPrK7oXrzPE/+w4nEGvYt2xj8s328kPHNTO5Q0VmTJ2RbG/j6rQZN80eEDLIsXLO7M X-Received: by 2002:a92:d246:0:b0:33d:5c7a:25b7 with SMTP id v6-20020a92d246000000b0033d5c7a25b7mr4302619ilg.0.1685818746701; Sat, 03 Jun 2023 11:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685818746; cv=none; d=google.com; s=arc-20160816; b=AdlRIRi+EjA1H+EZticMrX/pRAe9X6DjT2CgeL58SgSgjx45gknOFNoSKW4An5ZWLN XzmTeSyEl027sjEeDHU9E7eRr5DnMFXDqWiu0FEn5mW1nUl7RsSimamg32vmHWhpGeLX f+1pZRqJxrYilC3wndpP9Gz/ryhQxUhPnkc+jW6/nqVZg2zBLV5pxbAX+t/M7zPAQkmp taMx4gapc7cqmjLSSXL3GMtFthw+ozowXy3VO4iL9mwoO1WHbz5US7Prg85pcdl3xvjn 47PrAA0RXt/cvCfzbiM13hb8eGpFy0BGGOZcu10Gp344ePrGox+RywlttF0S+NrRj6Jg dZ1w== 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=1Mwr9wLspN3/knbofc7pL+ZbEqiWpyI3ZLhsWtnQRqQ=; b=fa+IkoiZj5jp18LiB7BbCetnTJlv1z6hSU/JGxnPY81gLhapSH6NzFIWgFEogpqAfl Xp4KquQUSCkoLPnCktRenS2JvtB7SHmsZdW3m1kiO7XDBQpajF7MpeiTDGbfWQX0VPmU 3odBFz3Phy8vFXsq/a49S2DOmTmVn2e3XzOoiXbjjP11lVjqvoeE8mYWiUsGMKstVD2x 2ZVFj1PF4xNvrHYgw1k67CV2mmSXAFKcaRVb9WsrPsikVDUxD4EvEkRUagpz0kvEUYhF 0Q1d7CMCyXO6/yzlxAl2aMDtB7THKTdpQTpbdJvg0JedG+t8TADMQejLzqZEwSLoKKlS EZwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hS44CBZD; 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 z11-20020a6552cb000000b0053b28418dfdsi2920534pgp.193.2023.06.03.11.58.54; Sat, 03 Jun 2023 11:59:06 -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=hS44CBZD; 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 S229724AbjFCSyc (ORCPT + 99 others); Sat, 3 Jun 2023 14:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjFCSyb (ORCPT ); Sat, 3 Jun 2023 14:54:31 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67EBB198; Sat, 3 Jun 2023 11:54:29 -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 36CE96603050; Sat, 3 Jun 2023 19:54:24 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818467; bh=s0knw9g56xErdj6HY2ztw8nwc0RbT2i6V9fQmN13s8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hS44CBZD9HbmnAspm0slwe7dyCmm5DqVNWXlXmT0Sh27q/fXwSOaxf7LDE4eLFKJO RfW6Tl0q5zPvA/zsPEbbJfDE01sFwUuSRszGXZu53l7HaQGNwgytLohXd+bQGzFx+5 URtyNScJElrhlWa1HdD6lbJJ6JMZun1zA42Q/wiGgjS4eoFAtat5T+fuCjXnHf+Tur 4Ax/3lpDZfDiBYvwgZ+11p2BSDu5/s5upoUOOLYsu3hE+MSmJ2FDshgiknBJUdCFdn ZJpZC4OxIENHIk9dydvxWXQbfX7gswEFxZcVI4uyh8M3zDMXZPl8Aax46M/WG+E4HE 2Nq2B6X6k3wiw== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , Simon Xue Subject: [PATCH v3 1/8] iio: adc: rockchip_saradc: Add callback functions Date: Sun, 4 Jun 2023 00:23:33 +0530 Message-Id: <20230603185340.13838-2-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767709078256380162?= X-GMAIL-MSGID: =?utf-8?q?1767709078256380162?= 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 v3 - no change 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 Sat Jun 3 18:53:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1802688vqr; Sat, 3 Jun 2023 11:58:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5tEB7j7GcbMCdybFMUim+4/TlstruOawtce9FDIqKY27hFIHowH9qwp7dZ4avxuAXBiXGR X-Received: by 2002:a9d:764c:0:b0:6af:a078:e61 with SMTP id o12-20020a9d764c000000b006afa0780e61mr6241369otl.23.1685818734632; Sat, 03 Jun 2023 11:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685818734; cv=none; d=google.com; s=arc-20160816; b=1I6Yxerznj7/pWz030/KNrSwIfYZrHYogvPUNSmHiNRrne5FZP/QO5ecGhQme//8Cg g8BcHzxpi2D+w96J+U8iOJ0AKB4RIl6q/piI8J2uqERrAnZ15TUbEXjVVwGfrpQn6VGk xmoc/lyzk2p4zravM3fyFlu3nMtmtEFE4k1AGY0IrqEQ+fc39KOWtdh51uPBxwwlbQlN fGumUL42r1iCt40L8pUXrYOvfm1y6E5Cf7gedcbrUVeerPoAUzPFXI+aWObHAXiY6YOo VQPTKnZGR3CoNgsCvigUhjMwpDJD+wCnbHwJ746CvO8yl7y60JWWFnNbOjQWEvtSUx/i Bknw== 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=0m5Q9wq1xh1d2cr7Mz7rzZYXlh/dKLhy51yOXyXwSEQ=; b=QXYwJ32kQc4z4Qw8Lqlu4EhpDP+7v9rjds8fLJQcz7LPqzVm7R/exXKo19HemxJjsz uWmQoGt0rs7a5kYl3zUmkxDSIhQBUicaZhbElbJ27utquaFy1A/Kd8oX7CIM39x3LN2N Vtsq+tAdgD5y0K+QKHzVcnb3s5JCkY+hvQufJvQ9xHHCX1v9feH6Uu1kjgYW/gtKbVN8 SRZRwIHv+v7enux8h6ce2Qtb86Njt9nZ7sopTdsNoTQBAn5dQmBiC9ZnkbvxXfwk73Ru N67huV15LbETdJ1AwXlKuV6QTo8ak3R0K4DseO8Lm29I10L/5RE7aXSbU03UWx5W4uq4 E3ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=mpZaRIyl; 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 h2-20020a170902f54200b001addf547a59si3025853plf.0.2023.06.03.11.58.42; Sat, 03 Jun 2023 11:58:54 -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=mpZaRIyl; 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 S229475AbjFCSyk (ORCPT + 99 others); Sat, 3 Jun 2023 14:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229711AbjFCSyh (ORCPT ); Sat, 3 Jun 2023 14:54:37 -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 8E9C81A8; Sat, 3 Jun 2023 11:54:35 -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 1E84D6603147; Sat, 3 Jun 2023 19:54:29 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818474; bh=5qal4yReBLe0r8IINy7OGXm+hpHMLxOtRFTpvqe4d8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mpZaRIylG+JEVf4lXivK3l3Y2PgZQLThn9aewLTwnggkUKqVX2+/ms9MAn+EXm87G 1jcUNMeBXCmRO+HJoH41W67jPPrth3d1aTY3gNbuOF2pm5k6UmHlMfSnfi/UaHU244 nof49j+6GwwhuYH4tpD8jtMqRxaYVvDldSNraj+/JbMQZwgDi06f1PcFCpltxMZhie fGDXXGRw3IqX4UakQB3cG4Z6IghptSHb4Yl8H5O85k8gyex3P3QFaqNkvRkaidyFMG qWWoHq5t8D6FBvBeox5xLifhulAkkdOWM4Duc8kwQzpebMLMzCeb1Er+/LdU2Q8yPJ 5QWAQRIOVuJIg== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , Simon Xue , AngeloGioacchino Del Regno Subject: [PATCH v3 2/8] iio: adc: rockchip_saradc: Add support for RK3588 Date: Sun, 4 Jun 2023 00:23:34 +0530 Message-Id: <20230603185340.13838-3-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767709065201857932?= X-GMAIL-MSGID: =?utf-8?q?1767709065201857932?= 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 v3 - Add bitfield.h header file. - Add a Reviewed-by tag. 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 | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 21f9d92a6af4..312286ec91dc 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -4,6 +4,7 @@ * Copyright (C) 2014 ROCKCHIP, Inc. */ +#include #include #include #include @@ -38,6 +39,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 +93,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 +122,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 +296,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 +328,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 Sat Jun 3 18:53:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1801860vqr; Sat, 3 Jun 2023 11:55:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66ZaBPR2jZ1qU3bphE4OVhX8yF7YhRm/QX+4AIEHrWNCM7e2+vCND2hA8n2yVizKTv2T8p X-Received: by 2002:a17:90a:5d03:b0:253:4f8f:52fb with SMTP id s3-20020a17090a5d0300b002534f8f52fbmr3942044pji.10.1685818550413; Sat, 03 Jun 2023 11:55:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685818550; cv=none; d=google.com; s=arc-20160816; b=sw6T9tGyxCtQpu+aR/eYFEIWzc00dEiEo/5FlxczE/GFczfbQrDp1gxOQ6gDGaz+1+ phEcCJO2mE6xycaFZeF76xEsqh4FJH6KgRf7CrN4WGjrJeSlqgTaV7pxN2wpckfaXtl0 6t8DInjwv+3pYnyFnF9mzXl+BvzVo/poaI4sSCjyZbw5zuuhqSvgdxbiSrmi1BJyWO0h PquZu4fwtPhf/b7lcGA90CtsaeWOfJcjtt5oHHmL5BLdRt4xoPSSsuO3Y/To+36kSJEr /oP0AMt0WTTQADY2hMsto26QJ5vaDbrpVcJ8FQn2qkGX7iW7dnN4fXOgj0zUvA6pJRbv cHOw== 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=SNp8JoG8hxNmfLyjp2Nn18sSaF3jKO00GQzsttA6Vh8=; b=OWN/zUD8fgFTnrV+AWp45GTiwL9KUGc4+00OxeZOAnnaTIa+DLdLycWFsxCh9SW62Q p2drV9P/JuZ4PH4DW3TzWzVbNCLZ/qF3zU0o5hnL8bei6ofYMY1if85xPUZRJSV3vg5+ 2eRfo5/0mWh9rILziclS/9gMcCHU+RufsR+JXMPohbiQhBNjux1Fssdz8f6AsQIf+u8S wdn/f06SquZzqxCj5Y0dtsuMqC/0c5RcYReMfwOYy0ORgqvgKNq3hOBEk/1LXpIv0FPJ nt76lYcNcu5szsdwcXlPxHgDedrdpgeifxOuUKWxuzj4PotPtvl65FQ01xULEACGcc5q UB4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JNQThkng; 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 me1-20020a17090b17c100b00256ba93c131si3268441pjb.4.2023.06.03.11.55.37; Sat, 03 Jun 2023 11:55:50 -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=JNQThkng; 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 S229445AbjFCSyt (ORCPT + 99 others); Sat, 3 Jun 2023 14:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbjFCSyp (ORCPT ); Sat, 3 Jun 2023 14:54:45 -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 08A8F197; Sat, 3 Jun 2023 11:54:40 -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 8C15766031BB; Sat, 3 Jun 2023 19:54:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818479; bh=3LQsZ14e2cVfHZN107KymnzFhYRU0E11A9f45uJB4io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JNQThkngO8TEScja0x+PQ1s5ANOp1fLarmN/MuzK+NSb75MwFkKNmnGuvlHSnXeLh q2eC2f/EwWMhxNlxkFxmHAiKvm5E0xC34bSQ6tbqWo7ua0FHHbbK+NKwuakSATjY5B kHnSZO3DSF1TQ7ZxbNOhCWRU2bAtvXwZT63AThAK/XtV1KkxnvbyY39aQi0sP4wE/Z S+078He6GqEcg+isBGtt5Mj/+4Tjdm1nVSo+dwDmBkNkr61ogWA9HHBzgBlCaubtG1 8UHKzF/6a3tSetMJc4acVKEyVs6XLdWj+imYjSK4mAX+aaLY8mFTHnQmAzAvWrvqBM OLVPtmQP9G5yw== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel Subject: [PATCH v3 3/8] iio: adc: rockchip_saradc: Make use of devm_clk_get_enabled Date: Sun, 4 Jun 2023 00:23:35 +0530 Message-Id: <20230603185340.13838-4-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767708872360904032?= X-GMAIL-MSGID: =?utf-8?q?1767708872360904032?= Use devm_clk_get_enabled() to avoid manually disabling the clock. Signed-off-by: Shreeya Patel --- Changes in v3 - Do not remove clock enabling and disabling from the suspend and resume functions respectively. 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 | 56 +++++-------------------------- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 312286ec91dc..ac424ea50787 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -346,20 +346,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; @@ -493,16 +479,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), @@ -540,31 +516,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); From patchwork Sat Jun 3 18:53:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1810215vqr; Sat, 3 Jun 2023 12:17:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7tDqdAvudTIMO1iv11X1zRMEOHgXjJUZ4llZxAmcuHh4HV0cugdc3vaB8gzpomMfJYLU1e X-Received: by 2002:a17:902:e84d:b0:1b0:3ab6:5140 with SMTP id t13-20020a170902e84d00b001b03ab65140mr3591092plg.4.1685819840251; Sat, 03 Jun 2023 12:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685819840; cv=none; d=google.com; s=arc-20160816; b=VU+b0mlYJbxhAEMqQgHygo0MYZEtbnpGbH98inYOHzxSdd0zmWcxRJKJoQpOhZBG0C wdOH1Efq7Bqmlvzytn0f1Hr+S0AKkdLdjVyu0V6z/uYR2nZmnEl4u+1HmuODwQaZUb0x 9tQIqeuLy8NkaWE6qAfoLbvjjTuRCvOzHWUfHz2ndAEPBNI8Qvi6NJ+mLpzFe4Dnc/vw p6XOCnk9jpdFHanjrNaGtCudju1rwjUul2j9+QAqrbNkgHla5a1wxgtvrywVI/bQQQqm GXyVWg6lvWVNGpQR99/quQhYQ6HEcXruGg0xvJtgn0Gx226DOoLYZDKDALmmw/bZbRG2 KjSg== 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=jZ3VuXi3xgyZmz5xmMdGqrMRZ2L93IMNhehQp9wD2iY=; b=Fny68p/dcANJ5oC4NXevQUZB8MSPP0vYCR8gJ23phnRIDp7XbJyUZzPHBKzFnpZnGb TAA7QrHES7+NQcMId/3Z72Plc2sbzdycee3ijG59idnU029E9dTntzOwTGDqvGbxD7Fi TAW3+QAvPyz0d8NtQ8BEgDHlxigz4q+a7PriQIBdisnKAZ8uw1h4YDGQ6khWjLvWhyEa mJD1YXJlgIf2butq96CZ/YGRM+Z350x1kRL3A9yteYIbX/Ahvt1ywspaygXU4+AvxIFj zJSP3YPT3i7HxEGG3PAw0ldwRMwWDjC0QT/n5lyTh/x/DVV0HYRXYACn8WeDZmL6UjuQ cqmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DHHO5had; 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 u2-20020a17090341c200b001b11168bdddsi3046249ple.520.2023.06.03.12.17.08; Sat, 03 Jun 2023 12:17:20 -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=DHHO5had; 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 S229752AbjFCSy5 (ORCPT + 99 others); Sat, 3 Jun 2023 14:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjFCSyw (ORCPT ); Sat, 3 Jun 2023 14:54:52 -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 257541BB; Sat, 3 Jun 2023 11:54:47 -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 C34646606EBA; Sat, 3 Jun 2023 19:54:41 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818485; bh=VNGGZRi4A9Mnt5jeD15aqWDciGe58NwxbjwHqV5hKJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHHO5hadMuUConDV8846JqFF0fEN4sAW4K7ZCgLW6LZWp+8WyoG24cTXNJbQLacZ1 0dfcHQ8V9cTbYNz2h0bKmouSVvohMYfSOD33ZKCuh7uE+3swL2Ce9F1A1zIiYe4GMz e0/x8jwu4qm9LDAyOZq/AZDaHWs1znkt+fR/9sS/tfSpFIIpcjSd1Ma8Io0cn2xm7C KgDtdboWl2RGlg5HAt2JIff7gB2A5rp7BakXcsf6ha7HsdkSw30+FXsYVllZWOMgpy uSihtW6RhfM0ziXzfj9e502/HYHCrYSx36U648Z7OZhyzIlK5T61sUC2LamtTPc7R3 OkXPGJm/ygVTA== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , AngeloGioacchino Del Regno Subject: [PATCH v3 4/8] iio: adc: rockchip_saradc: Use of_device_get_match_data Date: Sun, 4 Jun 2023 00:23:36 +0530 Message-Id: <20230603185340.13838-5-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767710224858671012?= X-GMAIL-MSGID: =?utf-8?q?1767710224858671012?= Use of_device_get_match_data() to simplify the code. Signed-off-by: Shreeya Patel Reviewed-by: AngeloGioacchino Del Regno --- Changes in v3 - No change 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 ac424ea50787..cbe347fe8df7 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -415,10 +415,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; @@ -432,13 +432,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 Sat Jun 3 18:53:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1802208vqr; Sat, 3 Jun 2023 11:57:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/bVnKSrOT2299+pGtuTFbnk+QoeztqUa9o8y5rDWQ4PkprRI+fGTSvwktlGw8AWCWYkFS X-Received: by 2002:a92:d08a:0:b0:339:f011:77f5 with SMTP id h10-20020a92d08a000000b00339f01177f5mr15962357ilh.12.1685818628577; Sat, 03 Jun 2023 11:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685818628; cv=none; d=google.com; s=arc-20160816; b=RxcACCNxJJyhLrjNxv4eFuD6wePpToOgtHBTKJmw5heGMyQP9d632NvKsrNdGNdZ0C qNWqyDObcUApzbgcO/pMJOGCOVVp8JOmYh5wyjEz/4yBEflXL3UZMsYePd0eJMw7NGuK I65nsdU032KiqTREJdn1q449qdfaapIwkDFoUBk2rSwZOjQiBdKv4jM4dtX7dPAOSkuG HhuOyUn4YPub7N3ORd9ax0jsM7Qn4TOUhiQ2mjQ7ZURheWGpZUDPqeZP+jmrzadOUs4J OVu/sb5TLyfwgWI4rFqxcuohfbyXPEWXZa3NRFNhw9QFavjp7MP7v8a215MlfHciTAWv vWVw== 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=yhh8ZTs/x1ybeU20wDg90IUbrcA05kjJnVHR03ujrM0=; b=QgcQJsFu1ww5KjFMznddonoP4McAsYjk9Xlxt1xzIvURtEriMuDjEOA/dyQ9bKSpVN mznNHUIBYXYsIPc+ymwyA+yt8ko/mxXSbOqQHvq9vkyMnGTukB9LyIp7ncl4klHl5Hna 8he75ypTiVfS55CHiNXX4nr6Cr+/ZjnqG/eG1FFMYnCRROAfcFw9hFSU15qit+uRiQlb xslxXZJGk4Hd0443vDFz0kEsQbpdRvRRecVvuI86NMtaRFELmWvUThcAJRZ4/cv3+lgD fjiFwU+IrZ05l9MCyS8zAoqeq5Ehy3EYht+EfLf7tdTxohwxuM3EIsGDm53gm9S5L5vs CG2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="XhWJ/UCy"; 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 i63-20020a636d42000000b0053f66c75b98si3108298pgc.703.2023.06.03.11.56.56; Sat, 03 Jun 2023 11:57:08 -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="XhWJ/UCy"; 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 S229801AbjFCSzE (ORCPT + 99 others); Sat, 3 Jun 2023 14:55:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjFCSzC (ORCPT ); Sat, 3 Jun 2023 14:55:02 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2467FE5A; Sat, 3 Jun 2023 11:54:52 -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 88EDE6603050; Sat, 3 Jun 2023 19:54:47 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818490; bh=wVq893NVcRnivMhnQm6Wl7GqGpgPC12kHSLJwuPQ3s0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhWJ/UCyNf8cioxQiwkBtM+o4dXTOVoviZmYCWOAqGvgKnnIorApx+GnguSDCFr/5 XWRPJ3nQ30nahJchgfH3UgUcRtr9VWCmclm4oh5Gs9EeQP+DRhs8HC+HUpIb0muSg5 3HB71E4URO0yhob73lpwftRmfJc9zEbkm2tAv6Mf/ctOAjeAPqWCpFphzSiS3lqPvp FmdsA4sOUNfR/YD1aWXI/lVziyz4YHbogTGbKt7ZMNuf5IPrvQxiTKTabds2i6UXkP pceTA356IzvWhOMHPQDkaD77LQUZ1QjTinEK7WFthDUsIhdTndgQsJVL2jKIFUp0p7 aM1EV452LCzbQ== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , AngeloGioacchino Del Regno Subject: [PATCH v3 5/8] iio: adc: rockchip_saradc: Match alignment with open parenthesis Date: Sun, 4 Jun 2023 00:23:37 +0530 Message-Id: <20230603185340.13838-6-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767708954298011136?= X-GMAIL-MSGID: =?utf-8?q?1767708954298011136?= Match alignment with open parenthesis for improving the code readability. Signed-off-by: Shreeya Patel Reviewed-by: AngeloGioacchino Del Regno --- Changes in v3 - No change 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 cbe347fe8df7..436e219984fd 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -151,7 +151,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); @@ -394,8 +394,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 Sat Jun 3 18:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102870 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1802242vqr; Sat, 3 Jun 2023 11:57:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5490c5rt8Z3VhI46sR1jvIrqneOLbkbWJSH8yEMglbjhEh2B87WHeB8ldhrbEaRl1Or90Y X-Received: by 2002:a54:4015:0:b0:39a:a78f:2b1d with SMTP id x21-20020a544015000000b0039aa78f2b1dmr531232oie.53.1685818636743; Sat, 03 Jun 2023 11:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685818636; cv=none; d=google.com; s=arc-20160816; b=kFxAoOezxmE/ik47tkLtgarnfo4FSD7pXSoFxsnsU+ylQC8VTzlNnYYBGF4nttZ3gF 527WQGny70R9cERky69SQL8G3RPuwHsJbUWsBzUBtKyq8wMCU6yxHVqTLS4JMRLSyg8+ 0vyZaLBxVCL+jDN4fzILsD2BpIP61e0u8mVDbc8S8U+OclNO9bJSej6DyphkqeMX++lP T+HYTGFIkYrm+A9+PgF8zGtXfCXpXaB/8cYBSMxGistSM76LAcPcjoEvOsLoAhHJUfbe dbnjU99yLE+bD0y9zNVWHAHm4aKStjNmVjMAxkFdFKkfRJ51We21eM/Gf2p4O4mlc+Ah tA/g== 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=iqkLJq4fmrnrkQHsgkUBdroDgBDiJxJhBrlhbJ+SlzU=; b=tTlH/+wOTuz//sDgkwgV1FFMb+7VLx8VJht592d6OqR+sTeRuaeWq/vP4a+gz10BA9 5WkcQ0aF6b+5xEJn6+dVD4J0f7+Y+JMd03k+Ib9C1t5b4ZVFI0naB8I7+Cr5QwYQn/Jv uyfzJOeAgdnregMoOIfJXo7BNdklGjYhj0RNfq5we15br/489N4+ninKbJ20pGOlua6m PeREcb3TYQWGLITLezvDH5V3E3nGiFrJcE/w4MKpBY3/HGdjOqQ1Gc5TEwAFKQrssrdz RpJ4Hj9IGclYKcKGAas+ZtzcYcSnU5gIgvvTx6W+CMjhgHfzBhoAaSsI8JhN3mz+FpwD y/OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=cOTtYJhl; 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 u5-20020a170903124500b001aafec82436si2977833plh.204.2023.06.03.11.57.04; Sat, 03 Jun 2023 11:57:16 -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=cOTtYJhl; 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 S229827AbjFCSzR (ORCPT + 99 others); Sat, 3 Jun 2023 14:55:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjFCSzP (ORCPT ); Sat, 3 Jun 2023 14:55:15 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C6ACA; Sat, 3 Jun 2023 11:54:58 -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 DBE516603147; Sat, 3 Jun 2023 19:54:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818496; bh=8dxa3AxEBlpgUQ0ClMFRIptu4pfjEzefRs26x8e/iQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cOTtYJhlLAEFYNPHn0rH56xZmVBUVaHNl5WbXHeLOijuS7R3nL6QgaYz4qV2gtQAG N6CY3vizDt0XoPpM6VJty3McTXSngliMiLlr9gsaXRCZY/7ZT8IZTAnaSTpdcY/xhJ yGbssgM4o6mU60feoq+ietYuogC3bZpJs818rrCmplbVyAs4fpWw0BlKRic4yQQVuO j/ou0vQDxEP3dUeeVITiSyEmAUheHwJpqZOmugBcoAmmg7Z/JAXvxbNEKxblSE0ovG +sT3GCZwWOfAzbqo08d6e0srfq4csdn9XMwlUpvmIYMffck3fuF67iXNY5JhCQ4glt 6Iu63USJi+2NA== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel Subject: [PATCH v3 6/8] iio: adc: rockchip_saradc: Use dev_err_probe Date: Sun, 4 Jun 2023 00:23:38 +0530 Message-Id: <20230603185340.13838-7-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767708962391519097?= X-GMAIL-MSGID: =?utf-8?q?1767708962391519097?= 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 v3 - No change Changes in v2 - No change 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 436e219984fd..921844d9232d 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -425,25 +425,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)) @@ -491,23 +489,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 Sat Jun 3 18:53:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1810085vqr; Sat, 3 Jun 2023 12:17:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4gKgrbcXN4vhLWaJKjvtboFAGFvA1uKPXSsJrXMBgqLVAK+nMAdQEeIXIDyc01cgqGaWLL X-Received: by 2002:a05:6a21:3985:b0:10c:67c9:2fdc with SMTP id ad5-20020a056a21398500b0010c67c92fdcmr2266914pzc.48.1685819821399; Sat, 03 Jun 2023 12:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685819821; cv=none; d=google.com; s=arc-20160816; b=fFVYelcFpb/0D6WyscuHp8k/Zb/f78eXikvFE1zEAS5YJpeKUOONoQParKdGJ/jPtk XuIWNPxhZepgCx99KHYx48lCWyzDIvKj9VMl+cxE8YxQUKtauOvwgXOShraCr8owhGzy G7gEqqiVbqt4tS5w0Wdu9S1xVMyzr/MTTHkXUt6qroD95EjupcLjdkEQp1BBIpG9KjVd 7I2SyDIq/6xu2WZai3lvG4E4p9k0lQU28JNF41LOTFucM0ol7mFQjmUC1loLAo9JqVQL 1dmYXKffnOj9CB23qk/9cKm+MMYNIUIAdW2KRCtKFExY39mzL/pB6lUmshPeqKKI+UC9 jc8A== 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=ACXtnc3MRA3mbkYgfhzRoRsgVZ1QxztPHsUvDM7u/yU=; b=D9muSvXJkm0n3VC3c5HQtdj3IscFe64Peuo1eug8bwyefWVLgTaWDFwh9AmaWESlYk HV89Z3Ac/QujkEGT7Sh8mmB/VdliNAYcQ2noMve37OhTNva6eQLBMIAF+XiWSnBVMSak PiHpby5dmDSoLunCZojYTycTAetZoLMzPFOOpkosBHbz6L9R7neqGTXmMT9y7biGG01d IIp7RTVUcRuDlwDHt+ncIGMTsR9jRB6JN+dmCstb6cqqoGkX7C3G8dbjP/VlJBk4B2tX n7xMGtR5OUvkjmFHw5QgB2C00/X0rJMwIaROZX7yEiJb7F6tQ3Fy0JKNHcECY+ig61Qp nKmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YrTmPgT0; 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 bu2-20020a632942000000b005343e03aa9fsi3149884pgb.145.2023.06.03.12.16.43; Sat, 03 Jun 2023 12:17:01 -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=YrTmPgT0; 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 S229814AbjFCSz0 (ORCPT + 99 others); Sat, 3 Jun 2023 14:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjFCSzX (ORCPT ); Sat, 3 Jun 2023 14:55:23 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C2110C7; Sat, 3 Jun 2023 11:55:03 -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 D621066031BB; Sat, 3 Jun 2023 19:54:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818502; bh=jSXs78i99G06gintRwSg5+8JsDLxQU7hBBHV8+/cw28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrTmPgT0nSO/i2DjLbZUkzrVO16s+Toq3RBgc13mU2Tx5NsBYKV1v7q/1A6qYxnO5 D42btqX0DnC7nwxrv4Nl4l9m0SjrERXdCVK1cg4JxH6CEtBA7reDG6wEnw1/uzqePn RqWvL7hkKxhphFSkAU3KhaBRGICbO7oiRuEZ0HGSoiGalEOf+mK2ZGHP7WC4ZVEIHT lIJqXqL1ZSAUMa9gat4ux7DUaqFByOxbnlgzgd29XTb0kieH96v98h9XTlufUeuB+f vFB6DopJjft/kHxRDQUZV8E/B+JMUOgi17gQR9iZ0P1v2r3ZM4oA009jXiGqhb/I2j rc1E+JisZRj9w== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel Subject: [PATCH v3 7/8] arm64: dts: rockchip: Add DT node for ADC support in RK3588 Date: Sun, 4 Jun 2023 00:23:39 +0530 Message-Id: <20230603185340.13838-8-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767710204983317676?= X-GMAIL-MSGID: =?utf-8?q?1767710204983317676?= Add DT node for ADC support in RK3588. Signed-off-by: Shreeya Patel --- Changes in v3 - No change Changes in v2 - No change 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 Sat Jun 3 18:53:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 102871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1802270vqr; Sat, 3 Jun 2023 11:57:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5CTPIKGuAPOolfsrYnPb4bdVXuz5nXb1rCHMZ86H3gdBXzimyGDoGcrfWF5zhDaKEuFjFH X-Received: by 2002:a17:90a:6b4e:b0:244:d441:8f68 with SMTP id x14-20020a17090a6b4e00b00244d4418f68mr3823486pjl.16.1685818643248; Sat, 03 Jun 2023 11:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685818643; cv=none; d=google.com; s=arc-20160816; b=AA77rO0q4ZaBlLf/+qDwVA6zQ/l53L8DYgybl8ZgbKcck47DD9U16ksYTMX7L9PQ0Y X/lkl9dIaP9k5Bbl1+cTymdiLpKOIeTpwL1YcrkPpx5j2Dn640IMcKNMcxRbostrNSp0 OojS/8Q6lpiO0IZ30hjQOFTLre7w5FHIn2ttG/NQoUYwf6TNzD4adtLY2ezzuiuUxHHM tmOOq2mKQhh2CJPcLL3PtBcAxexzulzGTMqEzPXDwOB3xkqeMFZ5Kd3Dosl2JUeBIoAL WPwS/n+rxsR5lkg+WmFm2jyBC6KlxWkpGivUm6AOWgakr+aHUO/77m8Wo7UGXKAQxrpi 2C8g== 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=MlantebJHSvuoe+wD+oXCXPvA+zxstMrPfV/sArEbgQ=; b=Ly9wTiUBb598hj9iZYIRMh5H7x/LZa2njMaBRGRZw5vL837CAFX7HRHgq1zyBoFDwj cK9NvNF220/6PKWB4kiB8C6bOGzT+cWx69+wZTGvHXWCxuea4LYFe/oMmnXuuLAGxBf5 SOAOLwHMmoFMCCY1zUFj0qv6GKqn/KrfK/kwKJOZLpWbZ/T4RagqQFKQoA4wQO7Br8Fj fSezXaivaquyIAEkSmuL9g+wA91yjZmYuaKUwBX5p/awLvD4OZH12xwcBtU15hrUc6dq 6mI2FFP416U9QTEwjrtTEF6E9sjdsxbFfMB4MNbgbpaLCPNyjPUMp3IQlQbdmZgtzgt0 VvWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=QWmWePs1; 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 me1-20020a17090b17c100b00256ba93c131si3268441pjb.4.2023.06.03.11.57.11; Sat, 03 Jun 2023 11:57:23 -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=QWmWePs1; 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 S229521AbjFCSzh (ORCPT + 99 others); Sat, 3 Jun 2023 14:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjFCSzf (ORCPT ); Sat, 3 Jun 2023 14:55:35 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2BACE6B; Sat, 3 Jun 2023 11:55:13 -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 0D5CD6603050; Sat, 3 Jun 2023 19:55:04 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685818508; bh=8S7OKZmsezN6RAz8kQrAHp0icflqSiGjbX9ZA0jDAwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QWmWePs19ts8sVUd4Z4OscrkOetjDVbAaFedKZFjEMnXmn2su4sDSPtsGHDjUAHjG bQwclcUFme+Pb7TeUB4X7eJJOsP1qnr46OVHC2HviY62rJRhBaHBsyS2MTdY46Ki+S VcF+ijqRifz0EFLjk9JsCwogHo3M4cPS8OzN+hfzBa5VG3Fbpbn7chHWaWQMqgZdkF 8w5Zh2S3ZuxhCOBc3YfIXPeaGlTXmrQNoEzCLXlStFIWJtR/hll94cy2BkMnG4kO/S fiSJ+E0KuzfkCz2IXvx560GjVaggcC0i9xkgwjKzV3xbFLDd22iL1bih51DlEpOpOD cj807GFcEHiMA== 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, gustavo.padovan@collabora.com, kernel@collabora.com, serge.broslavsky@collabora.com, Shreeya Patel , Krzysztof Kozlowski Subject: [PATCH v3 8/8] dt-bindings: iio: adc: Add rockchip,rk3588-saradc string Date: Sun, 4 Jun 2023 00:23:40 +0530 Message-Id: <20230603185340.13838-9-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230603185340.13838-1-shreeya.patel@collabora.com> References: <20230603185340.13838-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?1767708969489062343?= X-GMAIL-MSGID: =?utf-8?q?1767708969489062343?= Add rockchip,rk3588-saradc compatible string. Signed-off-by: Shreeya Patel Acked-by: Krzysztof Kozlowski --- Changes in v3 - No change 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