From patchwork Tue Oct 31 20:01:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10035331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A4D3602B9 for ; Tue, 31 Oct 2017 20:02:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DA9528A7C for ; Tue, 31 Oct 2017 20:02:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 625A228AA1; Tue, 31 Oct 2017 20:02:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0649F28A7C for ; Tue, 31 Oct 2017 20:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753875AbdJaUC2 (ORCPT ); Tue, 31 Oct 2017 16:02:28 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:50222 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752066AbdJaUC2 (ORCPT ); Tue, 31 Oct 2017 16:02:28 -0400 Received: by mail-wm0-f68.google.com with SMTP id s66so1080135wmf.5 for ; Tue, 31 Oct 2017 13:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T1WguF+Ob9cAYVaUxpggqIYZO04GvuKUm1dwJLYANas=; b=qt7n5xxs3QSIZu620EdlTP1ls1dV0TOsAjWoQYDWgq5lbwcVblkoRLBWvSon+bKUJw /IjCuaTWAt3RHgJ9X0WIrIphIgdj8TlSnxHeBWig4CpMbZb51WXenfEfRDUCBPOpT1lB 1rE2tbJYWXc43znO7CNJ7BDO5V5ViXVuomjHcUe6hQIBKnVQaSj06vDPnOAnMqh2cEz2 W5m+YU/e2ABzQbx5kki8tNKdIIA7lLcgo5c7/7flOSCJ84BMCFMrhq9AC3c84RC9qIim zI0aNnh67l7TqE2lqB101G6C3gTqtggdkgWliFcCT/nsbUMScCnOLaTt/C8sNPV+euLb i7cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=T1WguF+Ob9cAYVaUxpggqIYZO04GvuKUm1dwJLYANas=; b=i3pvfHHm4WuLjdcWAx0/dEo2rS63CrGog6xi0Ot8dguH//4fykSQqB820FyMxg6kff s7hXtlss/VRxpkyuYTzyHd/7734EtcnOwa8w8iZ25f3ML+j+y5fAGyZrEalxCxNpfIIV sn+ePB2cgyI1NTuWldPhmS9mnyjYf+NDVmSiPT+1p5AuCAMygBFSnENsf1nuO6KZlh5/ E0dBLk07V9U4YE1D/3jq4LJjgjRmdGmj3+zwRauc2e89zyEwyPp/biySc1bv36KZ9pw9 V4g4RsjEAp01RJNM1xqRcPRayBxInN1K40L0vb6s3+0rN3y3dOQDPxaP7KUgcQ/05h23 uy7Q== X-Gm-Message-State: AMCzsaXVs9BcWdGzbg1eNyivD5ZIycBbuDvIQekPdASki1n9f8fpj1S/ 2pCnaIGikgQJNTPiab0v7buHvWNZ X-Google-Smtp-Source: ABhQp+QRrFitvI7R9CwtGKKJEf2p7VOZXS4icUCgCF/AdIgsQANvCm1M2zxjnkE3FcCkpUWjIiDWjw== X-Received: by 10.28.1.70 with SMTP id 67mr2641440wmb.34.1509480146286; Tue, 31 Oct 2017 13:02:26 -0700 (PDT) Received: from blackbox.darklights.net (p5DE3887A.dip0.t-ipconnect.de. [93.227.136.122]) by smtp.googlemail.com with ESMTPSA id c17sm3420261wrg.26.2017.10.31.13.02.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 13:02:25 -0700 (PDT) From: Martin Blumenstingl To: linux-iio@vger.kernel.org, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net Cc: linux-amlogic@lists.infradead.org, Martin Blumenstingl Subject: [PATCH 3/5] iio: adc: meson-saradc: Meson8 and Meson8b do not have REG11 and REG13 Date: Tue, 31 Oct 2017 21:01:45 +0100 Message-Id: <20171031200147.14660-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171031200147.14660-1-martin.blumenstingl@googlemail.com> References: <20171031200147.14660-1-martin.blumenstingl@googlemail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Meson GXBB and newer SoCs have a few more registers than the older Meson8 and Meson8b SoCs. Use a separate regmap config to limit the older SoCs to the DELTA_10 register. Fixes: 6c76ed31cd05 ("iio: adc: meson-saradc: add Meson8b SoC compatibility") Signed-off-by: Martin Blumenstingl --- drivers/iio/adc/meson_saradc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index abe9df879b2a..7dc7d297a0fc 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -224,6 +224,7 @@ struct meson_sar_adc_data { u32 bandgap_reg; unsigned int resolution; const char *name; + const struct regmap_config *regmap_config; }; struct meson_sar_adc_priv { @@ -243,13 +244,20 @@ struct meson_sar_adc_priv { int calibscale; }; -static const struct regmap_config meson_sar_adc_regmap_config = { +static const struct regmap_config meson_sar_adc_regmap_config_gxbb = { .reg_bits = 8, .val_bits = 32, .reg_stride = 4, .max_register = MESON_SAR_ADC_REG13, }; +static const struct regmap_config meson_sar_adc_regmap_config_meson8 = { + .reg_bits = 8, + .val_bits = 32, + .reg_stride = 4, + .max_register = MESON_SAR_ADC_DELTA_10, +}; + static unsigned int meson_sar_adc_get_fifo_count(struct iio_dev *indio_dev) { struct meson_sar_adc_priv *priv = iio_priv(indio_dev); @@ -860,6 +868,7 @@ static const struct iio_info meson_sar_adc_iio_info = { static const struct meson_sar_adc_data meson_sar_adc_meson8_data = { .has_bl30_integration = false, .bandgap_reg = MESON_SAR_ADC_DELTA_10, + .regmap_config = &meson_sar_adc_regmap_config_meson8, .resolution = 10, .name = "meson-meson8-saradc", }; @@ -867,6 +876,7 @@ static const struct meson_sar_adc_data meson_sar_adc_meson8_data = { static const struct meson_sar_adc_data meson_sar_adc_meson8b_data = { .has_bl30_integration = false, .bandgap_reg = MESON_SAR_ADC_DELTA_10, + .regmap_config = &meson_sar_adc_regmap_config_meson8, .resolution = 10, .name = "meson-meson8b-saradc", }; @@ -874,6 +884,7 @@ static const struct meson_sar_adc_data meson_sar_adc_meson8b_data = { static const struct meson_sar_adc_data meson_sar_adc_gxbb_data = { .has_bl30_integration = true, .bandgap_reg = MESON_SAR_ADC_REG11, + .regmap_config = &meson_sar_adc_regmap_config_gxbb, .resolution = 10, .name = "meson-gxbb-saradc", }; @@ -881,6 +892,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxbb_data = { static const struct meson_sar_adc_data meson_sar_adc_gxl_data = { .has_bl30_integration = true, .bandgap_reg = MESON_SAR_ADC_REG11, + .regmap_config = &meson_sar_adc_regmap_config_gxbb, .resolution = 12, .name = "meson-gxl-saradc", }; @@ -888,6 +900,7 @@ static const struct meson_sar_adc_data meson_sar_adc_gxl_data = { static const struct meson_sar_adc_data meson_sar_adc_gxm_data = { .has_bl30_integration = true, .bandgap_reg = MESON_SAR_ADC_REG11, + .regmap_config = &meson_sar_adc_regmap_config_gxbb, .resolution = 12, .name = "meson-gxm-saradc", }; @@ -965,7 +978,7 @@ static int meson_sar_adc_probe(struct platform_device *pdev) return ret; priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, - &meson_sar_adc_regmap_config); + priv->data->regmap_config); if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap);