Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3167034pxb; Sun, 26 Sep 2021 07:10:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQqxiFmkuvi2nY2oErAZGS2hzgEjUBVbIR8x8evySsJsAPT7NH2vWiQ60vQpvGvM7zr3LT X-Received: by 2002:a17:906:6a21:: with SMTP id qw33mr22912705ejc.326.1632665434571; Sun, 26 Sep 2021 07:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632665434; cv=none; d=google.com; s=arc-20160816; b=LAqmOrbQzwfZBcTTFEchqzDsgUryd+QYW+XC057FUHEUi9WdUvjwEjNDnLESFA417P CZClxkOXF/vrBUbB6nGlQay/XDXLXnuq2tYDWgH/g+6H0fquu3om3PN7hqvvdUQh/Xr1 YjGnw+YP6RtLN/ELR0qiBOdTpD4VXYJonOskI0yLx8n+dOYGBN8LOepfeLRNlfabiRbr QzhymdZNOacyJYEGKS1eijDpF3lspwv6BV2NsuBscRQDpYl8rC9pCATUIO85fpAMw4VC sGZkdmf9JetDC0vHUSZT1w4k6u5yojCuCGqrLjD8lHD/YgT9+8enL8XU/rkHXUN3IYm+ oHew== 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:subject:cc:to:from:date; bh=HzIGhjG/yg0c7DRB5+lcQAgLPUfzYvhMwV3mChrPYio=; b=KzmIPXopuarcZm1g6brB53Y1FFoNCyJy+scQzBEYQk9PLuV2Zv11LsjlVn1fjOqKsr aVwWrXnput2cSmTgXVPXK24AaAGdJ7sfcpQ0kIAG9LrZYwWZg/zMMszV7Nw2P0B2BQrD 6lWGYDbCb3XNHahUr3BNLsRf2aLtyY5IfxCcBcV5DEy5dY5Tzw0eKIQrp+ch1CFqpcnx m13k7FA2NnzpAJGZwGzbFfKpMgiXzZe2pwmWmwjwnJaU2fbST3MQ3zDDc9s1e7ip9LRK nnG0XURRG+Vl3MTjheXwD7Rwswf0eIwKVqPLC9SFNawPcQtiXPt9oRzPYuy9s4sL2Uz0 FU8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr6si24919102ejc.711.2021.09.26.07.10.09; Sun, 26 Sep 2021 07:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbhIZOKZ (ORCPT + 99 others); Sun, 26 Sep 2021 10:10:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:36358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231743AbhIZOKY (ORCPT ); Sun, 26 Sep 2021 10:10:24 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BCC6460724; Sun, 26 Sep 2021 14:08:45 +0000 (UTC) Date: Sun, 26 Sep 2021 15:12:34 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Lars-Peter Clausen , Rob Herring , Shawn Guo , "Sascha Hauer" , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , , , , Subject: Re: [PATCH v6 1/3] iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC Message-ID: <20210926151234.2b7b728b@jic23-huawei> In-Reply-To: <20210925020555.129-2-caihuoqing@baidu.com> References: <20210925020555.129-1-caihuoqing@baidu.com> <20210925020555.129-2-caihuoqing@baidu.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 25 Sep 2021 10:05:45 +0800 Cai Huoqing wrote: > The NXP i.MX 8QuadXPlus SOC has a new ADC IP, so add > driver support for this ADC. > > Signed-off-by: Cai Huoqing Hi. My local build tests throw up a "set but unused" warning which made me take another look. I've fixed as commented below. Shout if that was not the right fix! > + > +static void imx8qxp_adc_reg_config(struct imx8qxp_adc *adc, int channel) > +{ > + u32 adc_cfg, adc_tctrl, adc_cmdl, adc_cmdh; > + > + /* ADC configuration */ > + adc_cfg = FIELD_PREP(IMX8QXP_ADC_CFG_PWREN_MASK, 1) | > + FIELD_PREP(IMX8QXP_ADC_CFG_PUDLY_MASK, 0x80)| > + FIELD_PREP(IMX8QXP_ADC_CFG_REFSEL_MASK, 0) | > + FIELD_PREP(IMX8QXP_ADC_CFG_PWRSEL_MASK, 3) | > + FIELD_PREP(IMX8QXP_ADC_CFG_TPRICTRL_MASK, 0); > + writel(adc_cfg, adc->regs + IMX8QXP_ADR_ADC_CFG); > + > + /* config the trigger control */ > + adc_tctrl = FIELD_PREP(IMX8QXP_ADC_TCTRL_TCMD_MASK, 1) | > + FIELD_PREP(IMX8QXP_ADC_TCTRL_TDLY_MASK, 0) | > + FIELD_PREP(IMX8QXP_ADC_TCTRL_TPRI_MASK, IMX8QXP_ADC_TCTRL_TPRI_PRIORITY_HIGH) | > + FIELD_PREP(IMX8QXP_ADC_TCTRL_HTEN_MASK, IMX8QXP_ADC_TCTRL_HTEN_HW_TIRG_DIS); > + writel(adc_cfg, adc->regs + IMX8QXP_ADR_ADC_TCTRL(0)); adc_tctrl I assume? I've changed it to that so shout if that was not what was intented. > + > + /* config the cmd */ > + adc_cmdl = FIELD_PREP(IMX8QXP_ADC_CMDL_CSCALE_MASK, IMX8QXP_ADC_CMDL_CHANNEL_SCALE_FULL) | > + FIELD_PREP(IMX8QXP_ADC_CMDL_MODE_MASK, IMX8QXP_ADC_CMDL_STANDARD_RESOLUTION) | > + FIELD_PREP(IMX8QXP_ADC_CMDL_DIFF_MASK, IMX8QXP_ADC_CMDL_MODE_SINGLE) | > + FIELD_PREP(IMX8QXP_ADC_CMDL_ABSEL_MASK, IMX8QXP_ADC_CMDL_SEL_A_A_B_CHANNEL) | > + FIELD_PREP(IMX8QXP_ADC_CMDL_ADCH_MASK, channel); > + writel(adc_cmdl, adc->regs + IMX8QXP_ADR_ADC_CMDL(0)); > + > + adc_cmdh = FIELD_PREP(IMX8QXP_ADC_CMDH_NEXT_MASK, 0) | > + FIELD_PREP(IMX8QXP_ADC_CMDH_LOOP_MASK, 0) | > + FIELD_PREP(IMX8QXP_ADC_CMDH_AVGS_MASK, 7) | > + FIELD_PREP(IMX8QXP_ADC_CMDH_STS_MASK, 0) | > + FIELD_PREP(IMX8QXP_ADC_CMDH_LWI_MASK, IMX8QXP_ADC_CMDH_LWI_INCREMENT_DIS) | > + FIELD_PREP(IMX8QXP_ADC_CMDH_CMPEN_MASK, IMX8QXP_ADC_CMDH_CMPEN_DIS); > + writel(adc_cmdh, adc->regs + IMX8QXP_ADR_ADC_CMDH(0)); > +} > +