From: Jonathan Cameron <jic23@kernel.org>
To: Mehdi Djait <mehdi.djait.k@gmail.com>
Cc: mazziesaccount@gmail.com, krzysztof.kozlowski+dt@linaro.org,
andriy.shevchenko@linux.intel.com, robh+dt@kernel.org,
lars@metafoo.de, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure
Date: Sun, 28 May 2023 17:55:50 +0100 [thread overview]
Message-ID: <20230528175550.4e58f90f@jic23-huawei> (raw)
In-Reply-To: <de588a5a3ca311f6dc3a543bfa5cea7b590ae44c.1685109507.git.mehdi.djait.k@gmail.com>
On Fri, 26 May 2023 16:30:46 +0200
Mehdi Djait <mehdi.djait.k@gmail.com> wrote:
> Add the chip_info structure to the driver's private data to hold all
> the device specific infos.
> Refactor the kx022a driver implementation to make it more generic and
> extensible.
>
> Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
Hi Mehdi,
Just one trivial comment from me about missing docs / unused element.
Thanks,
Jonathan
...
> diff --git a/drivers/iio/accel/kionix-kx022a.h b/drivers/iio/accel/kionix-kx022a.h
> index 12424649d438..c23b6f03409e 100644
> --- a/drivers/iio/accel/kionix-kx022a.h
> +++ b/drivers/iio/accel/kionix-kx022a.h
> @@ -76,7 +76,56 @@
>
> struct device;
>
> -int kx022a_probe_internal(struct device *dev);
> -extern const struct regmap_config kx022a_regmap;
> +/**
> + * struct kx022a_chip_info - Kionix accelerometer chip specific information
> + *
> + * @name: name of the device
> + * @regmap_config: pointer to register map configuration
> + * @channels: pointer to iio_chan_spec array
> + * @num_channels: number of iio_chan_spec channels
> + * @fifo_length: number of 16-bit samples in a full buffer
> + * @who: WHO_AM_I register
> + * @id: WHO_AM_I register value
> + * @cntl: control register 1
> + * @cntl2: control register 2
> + * @odcntl: output data control register
> + * @buf_cntl1: buffer control register 1
> + * @buf_cntl2: buffer control register 2
> + * @buf_clear: buffer clear register
> + * @buf_status1: buffer status register 1
Missing entry for buf_smp_lvl_mask.
Mind you it's also not used in this patch and only seems to be used in the
get_fifo_bytes() function in patch 7, so might not be needed at all?
If it is, then introduce it in patch 7 where we can see how it is used.
> + * @buf_read: buffer read register
> + * @inc1: interrupt control register 1
> + * @inc4: interrupt control register 4
> + * @inc5: interrupt control register 5
> + * @inc6: interrupt control register 6
> + * @xout_l: x-axis output least significant byte
> + */
> +struct kx022a_chip_info {
> + const char *name;
> + const struct regmap_config *regmap_config;
> + const struct iio_chan_spec *channels;
> + unsigned int num_channels;
> + unsigned int fifo_length;
> + u8 who;
> + u8 id;
> + u8 cntl;
> + u8 cntl2;
> + u8 odcntl;
> + u8 buf_cntl1;
> + u8 buf_cntl2;
> + u8 buf_clear;
> + u8 buf_status1;
> + u16 buf_smp_lvl_mask;
> + u8 buf_read;
> + u8 inc1;
> + u8 inc4;
> + u8 inc5;
> + u8 inc6;
> + u8 xout_l;
> +};
> +
> +int kx022a_probe_internal(struct device *dev, const struct kx022a_chip_info *chip_info);
> +
> +extern const struct kx022a_chip_info kx022a_chip_info;
>
> #endif
next prev parent reply other threads:[~2023-05-28 16:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 14:30 [PATCH v4 0/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 1/7] dt-bindings: iio: Add " Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 2/7] iio: accel: kionix-kx022a: Remove blank lines Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 3/7] iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility Mehdi Djait
2023-05-26 14:30 ` [PATCH v4 4/7] iio: accel: kionix-kx022a: Add an i2c_device_id table Mehdi Djait
2023-05-26 16:35 ` Matti Vaittinen
2023-05-26 14:30 ` [PATCH v4 5/7] iio: accel: kionix-kx022a: Refactor driver and add chip_info structure Mehdi Djait
2023-05-26 17:04 ` Matti Vaittinen
2023-05-28 16:49 ` Jonathan Cameron
2023-05-27 13:39 ` Andy Shevchenko
2023-05-28 16:55 ` Jonathan Cameron [this message]
2023-05-26 14:30 ` [PATCH v4 6/7] iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer Mehdi Djait
[not found] <cover.1685111274.git.mehdi.djait.k@gmail.com>
2023-05-26 14:30 ` [PATCH v4 7/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Mehdi Djait
2023-05-26 14:42 ` Mehdi Djait
2023-05-26 17:13 ` Matti Vaittinen
2023-05-27 8:24 ` Andy Shevchenko
2023-05-28 16:59 ` 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=20230528175550.4e58f90f@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=mehdi.djait.k@gmail.com \
--cc=robh+dt@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).