From: Jonathan Cameron <jic23@kernel.org>
To: Cai Huoqing <caihuoqing@baidu.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>, <linux-iio@vger.kernel.org>,
<devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 1/3] iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC
Date: Sun, 26 Sep 2021 15:12:34 +0100 [thread overview]
Message-ID: <20210926151234.2b7b728b@jic23-huawei> (raw)
In-Reply-To: <20210925020555.129-2-caihuoqing@baidu.com>
On Sat, 25 Sep 2021 10:05:45 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:
> The NXP i.MX 8QuadXPlus SOC has a new ADC IP, so add
> driver support for this ADC.
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
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));
> +}
> +
next prev parent reply other threads:[~2021-09-26 14:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-25 2:05 [PATCH v6 0/3] iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC Cai Huoqing
2021-09-25 2:05 ` [PATCH v6 1/3] " Cai Huoqing
2021-09-26 11:41 ` Jonathan Cameron
2021-09-26 13:42 ` Cai Huoqing
2021-09-26 13:52 ` Fabio Estevam
2021-09-26 14:12 ` Jonathan Cameron [this message]
2021-09-25 2:05 ` [PATCH v6 2/3] dt-bindings: iio: adc: Add binding documentation " Cai Huoqing
2021-09-25 2:05 ` [PATCH v6 3/3] MAINTAINERS: Add the driver info of the NXP IMX8QXP Cai Huoqing
2021-09-26 14:16 ` [PATCH v6 0/3] iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210926151234.2b7b728b@jic23-huawei \
--to=jic23@kernel.org \
--cc=caihuoqing@baidu.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).