From: Jonathan Cameron <jic23@kernel.org>
To: Phil Reid <preid@electromag.com.au>
Cc: Song Qiang <songqiang1304521@gmail.com>,
knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
robh+dt@kernel.org, mark.rutland@arm.com,
himanshujha199640@gmail.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] iio: magnetometer: Add driver support for PNI RM3100
Date: Sun, 7 Oct 2018 16:07:30 +0100 [thread overview]
Message-ID: <20181007160730.4df1010b@archlinux> (raw)
In-Reply-To: <b73d2ff2-f93a-1268-67f9-08620f05770d@electromag.com.au>
On Wed, 3 Oct 2018 09:42:14 +0800
Phil Reid <preid@electromag.com.au> wrote:
> G'day Song,
Hi Phil. Good point below. One general thing though, if you
could possibly crop down a review email when you are addressing one specific
point it would be very much appreciated!
Saves everyone else scrolling and if they have a rubbish email client
missing the comment entirely!
Thanks,
>
> Noticed a one more thing below
>
...
> > +int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
> > +{
> > + struct iio_dev *indio_dev;
> > + struct rm3100_data *data;
> > + unsigned int tmp;
> > + int ret;
> > +
> > + indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> > + if (!indio_dev)
> > + return -ENOMEM;
> > +
> > + data = iio_priv(indio_dev);
> > + data->regmap = regmap;
> > +
> > + mutex_init(&data->lock);
> > +
> > + indio_dev->dev.parent = dev;
> > + indio_dev->name = "rm3100";
> > + indio_dev->info = &rm3100_info;
> > + indio_dev->channels = rm3100_channels;
> > + indio_dev->num_channels = ARRAY_SIZE(rm3100_channels);
> > + indio_dev->modes = INDIO_DIRECT_MODE;
> > + indio_dev->available_scan_masks = rm3100_scan_masks;
> > +
> > + if (!irq)
> > + data->use_interrupt = false;
> > + else {
> > + data->use_interrupt = true;
> > + ret = devm_request_irq(dev,
> > + irq,
> > + rm3100_irq_handler,
> > + IRQF_TRIGGER_RISING,
> > + indio_dev->name,
> > + data);
>
> Assuming the irq source is the DRDY pin, this pin is active high.
> Which is automatically cleared when reading the measurement results register.
>
> Perhaps when using interrupts the irq handler should do the read into data->buffer
> to clear the irq. Would need to use devm_request_threaded_irq instead.
Agreed. With a level interrupt that is the easiest way to handle it.
Grab the data in the threaded handler and complete after that.
Jonathan
>
> The SOC irq block I use doesn't support edge triggered irqs, so this currently wouldn't work if
> DRDY was connected to that.
>
>
> > + if (ret < 0) {
> > + dev_err(dev, "request irq line failed.\n");
> > + return ret;
> > + }
> > + init_completion(&data->measuring_done);
> > + }
> > +
> > + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
> > + rm3100_trigger_handler, NULL);
> > + if (ret < 0)
> > + return ret;
> > +
> > + ret = regmap_read(regmap, RM3100_REG_TMRC, &tmp);
> > + if (ret < 0)
> > + return ret;
> > + /* Initializing max wait time, 3sec more wait time for conversion. */
> > + data->conversion_time =
> > + rm3100_samp_rates[tmp - RM3100_TMRC_OFFSET][2] + 3000;
> > +
...
next prev parent reply other threads:[~2018-10-07 22:15 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 3:17 [PATCH 1/2] iio: magnetometer: Add DT support for PNI RM3100 Song Qiang
2018-09-25 3:17 ` [PATCH 2/2] iio: magnetometer: Add driver " Song Qiang
2018-09-25 13:30 ` Jonathan Cameron
2018-09-25 13:30 ` Jonathan Cameron
2018-09-25 14:36 ` Phil Reid
2018-09-26 1:49 ` Song Qiang
2018-09-26 2:30 ` Phil Reid
2018-09-26 8:09 ` Song Qiang
2018-09-27 1:57 ` Phil Reid
2018-09-29 11:37 ` Jonathan Cameron
2018-09-26 1:33 ` Song Qiang
2018-09-29 11:45 ` Jonathan Cameron
2018-09-25 17:50 ` Himanshu Jha
2018-09-26 2:24 ` Song Qiang
2018-09-25 13:05 ` [PATCH 1/2] iio: magnetometer: Add DT " Jonathan Cameron
2018-09-25 13:05 ` Jonathan Cameron
2018-10-02 14:38 ` [PATCH v3 0/3] Add support for PNI RM3100 magnetometer Song Qiang
2018-10-02 14:38 ` [PATCH v3 1/3] dt-bindings: Add PNI to the vendor prefixes Song Qiang
2018-10-02 14:38 ` [PATCH v3 2/3] dt-bindings: Add PNI RM3100 device tree binding Song Qiang
2018-10-07 15:18 ` Jonathan Cameron
2018-10-07 15:18 ` Jonathan Cameron
2018-10-07 15:20 ` Jonathan Cameron
2018-10-02 14:38 ` [PATCH v3 3/3] iio: magnetometer: Add driver support for PNI RM3100 Song Qiang
2018-10-03 1:42 ` Phil Reid
2018-10-07 15:07 ` Jonathan Cameron [this message]
2018-10-07 15:44 ` Jonathan Cameron
2018-10-11 4:35 ` Song Qiang
2018-10-13 9:24 ` Jonathan Cameron
2018-10-13 9:24 ` Jonathan Cameron
2018-10-12 7:35 ` [PATCH v4 0/3] Add support for PNI RM3100 magnetometer Song Qiang
2018-10-12 7:35 ` [PATCH v4 1/3] dt-bindings: Add PNI to the vendor prefixes Song Qiang
2018-10-12 11:36 ` Rob Herring
2018-10-12 11:36 ` Rob Herring
2018-10-12 7:35 ` [PATCH v4 2/3] iio: magnetometer: Add DT support for PNI RM3100 Song Qiang
2018-10-12 11:37 ` Rob Herring
2018-10-12 11:37 ` Rob Herring
2018-10-12 7:35 ` [PATCH v4 3/3] iio: magnetometer: Add driver " Song Qiang
2018-10-12 8:36 ` Song Qiang
2018-10-12 12:53 ` Himanshu Jha
2018-10-17 8:00 ` Song Qiang
2018-10-21 14:08 ` Jonathan Cameron
2018-10-21 14:08 ` Jonathan Cameron
2018-10-13 10:19 ` Jonathan Cameron
2018-10-18 8:24 ` Song Qiang
2018-10-21 14:14 ` Jonathan Cameron
2018-10-21 14:14 ` Jonathan Cameron
2018-11-02 7:55 ` Song Qiang
2018-11-02 9:24 ` Jonathan Cameron
2018-11-02 9:24 ` Jonathan Cameron
2018-11-05 0:39 ` Song Qiang
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=20181007160730.4df1010b@archlinux \
--to=jic23@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=himanshujha199640@gmail.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pmeerw@pmeerw.net \
--cc=preid@electromag.com.au \
--cc=robh+dt@kernel.org \
--cc=songqiang1304521@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.