From: Jonathan Cameron <jic23@kernel.org>
To: Angelo Dureghello <adureghello@baylibre.com>
Cc: "Greg Ungerer" <gerg@linux-m68k.org>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Steven King" <sfking@fdwdc.com>, "Arnd Bergmann" <arnd@arndb.de>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Greg Ungerer" <gerg@uclinux.org>,
linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 11/11] iio: dac: add mcf54415 DAC
Date: Wed, 13 May 2026 15:07:51 +0100 [thread overview]
Message-ID: <20260513150751.3305bf99@jic23-huawei> (raw)
In-Reply-To: <20260513-wip-stmark2-dac-v2-11-fcdae50cf51a@baylibre.com>
On Wed, 13 May 2026 11:14:35 +0200
Angelo Dureghello <adureghello@baylibre.com> wrote:
> From: Angelo Dureghello <adureghello@baylibre.com>
>
> Add basic version of mcf54415 DAC driver. DAC is embedded in the cpu and
> DAC configuration registers are mapped in the internal IO address space.
>
> The DAC accepts a 12-bit digital signal and creates a monotonic 12-bit
> analog output varying from DAC_VREFL to DAC_VREFH. The DAC module
> consists of a conversion unit, an output amplifier, and the associated
> digital control blocks. Default register values for DAC_VREFL and DAC_VREFH
> are respectively 0 and 0xfff, left untouched in this initial version.
>
> This initial version of the driver is minimalistic, "output raw" only, to
> be extended in the future. DMA and external sync are disabled, default mode
> is high speed, default format is right-justified 12bit on 16bit word.
>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
As for all new IIO code, Sashiko will eventually take a look at it - I think
it's running about a day behind at the moment. Once it catches up please
take a look (so far it's not even listing the series as pending!)
Looks good to me. Some trivial stuff inline. Only one I'm that fussed about
is not having a macro for the definition of a single channel.
Superficially looks like no compile time dependencies between this and
the rest of the series I think so once people are happy with the whole thing
I'll pick this up through the IIO tree.
Jonathan
> diff --git a/drivers/iio/dac/mcf54415_dac.c b/drivers/iio/dac/mcf54415_dac.c
> new file mode 100644
> index 000000000000..e95ab6b89b17
> --- /dev/null
> +++ b/drivers/iio/dac/mcf54415_dac.c
...
> +static void mcf54415_dac_exit(void *data)
> +{
> + struct mcf54415_dac *info = data;
> +
> + regmap_update_bits(info->map, MCF54415_DAC_CR, MCF54415_DAC_CR_PDN,
> + MCF54415_DAC_CR_PDN);
regmap_set_bits() just to be a tiny bit more compact.
> +}
> +
> +#define MCF54415_DAC_CHAN \
> +{ \
> + .type = IIO_VOLTAGE, \
> + .output = 1, \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
> +}
> +
> +static const struct iio_chan_spec mcf54415_dac_iio_channels[] = {
> + MCF54415_DAC_CHAN,
For a single channel case like this I'd skip the macro - it's just
making things a little harder to read. i.e.
.type = IIO_VOLTAGE,
etc here
> +};
> +
> +static int mcf54415_dac_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
Given the type passed to iio_priv() is very well known this
isn't really bringing any type safety - so you could just do
struct mcf54415_dac *info = iio_priv(dev_get_drvdata(dev));
here and in resume.
I don't really care either way!
> + struct mcf54415_dac *info = iio_priv(indio_dev);
> +
> + mcf54415_dac_exit(info);
> + clk_disable_unprepare(info->clk);
> +
> + return 0;
> +}
> +
> +static int mcf54415_dac_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> + struct mcf54415_dac *info = iio_priv(indio_dev);
> + int ret;
> +
> + ret = clk_prepare_enable(info->clk);
> + if (ret)
> + return ret;
> +
> + mcf54415_dac_init(info);
> +
> + return 0;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(mcf54415_dac_pm_ops,
> + mcf54415_dac_suspend,
> + mcf54415_dac_resume);
> +
Trivial but might as well wrap as:
static DEFINE_SIMPLE_DEV_PM_OPS(mcf54415_dac_pm_ops,
mcf54415_dac_suspend, mcf54415_dac_resume);
And save us scrolling one line extra.
prev parent reply other threads:[~2026-05-13 14:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 9:14 [PATCH v2 00/11] add mcf54415 DAC driver Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 01/11] m68k: mcf5441x: fix clocks numbering Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 02/11] m68k: mcf5441x: add clock for DAC channel 1 Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 03/11] m68k: mcf5441x: setup DAC clock name as per driver name Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 04/11] m68k: defconfig: update stmark2 defconfig Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 05/11] m68k: add DAC modules base addresses Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 06/11] m68k: mcf5441x: add CCM registers Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 07/11] m68k: mcf5441x: add CCR MISCCR2 bitfields Angelo Dureghello
2026-05-13 9:14 ` [PATCH v2 08/11] m68k: stmark2: add mcf5441x DAC platform devices Angelo Dureghello
2026-05-13 13:53 ` Jonathan Cameron
2026-05-13 9:14 ` [PATCH v2 09/11] m68k: stmark2: use ioport.h macros for resources Angelo Dureghello
2026-05-13 13:55 ` Jonathan Cameron
2026-05-13 9:14 ` [PATCH v2 10/11] m68k: stmark2: enable DACs outputs Angelo Dureghello
2026-05-13 13:56 ` Jonathan Cameron
2026-05-13 9:14 ` [PATCH v2 11/11] iio: dac: add mcf54415 DAC Angelo Dureghello
2026-05-13 14:07 ` Jonathan Cameron [this message]
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=20260513150751.3305bf99@jic23-huawei \
--to=jic23@kernel.org \
--cc=adureghello@baylibre.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andy@kernel.org \
--cc=arnd@arndb.de \
--cc=dlechner@baylibre.com \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=gerg@uclinux.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=nuno.sa@analog.com \
--cc=sfking@fdwdc.com \
/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