From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Martin Kepplinger
<martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>,
knaack.h-Mmb7MZpHnFY@public.gmane.org,
lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org,
pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org,
mfuzzey-mB3Nsq4MPf1BDgjK7y7TUQ@public.gmane.org,
roberta.dobrescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
christoph.muellner-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org
Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Martin Kepplinger
<martin.kepplinger-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org>
Subject: Re: [PATCH 3/9] iio: mma8452: add freefall / motion interrupt source
Date: Sun, 05 Jul 2015 12:44:43 +0100 [thread overview]
Message-ID: <559918AB.5070908@kernel.org> (raw)
In-Reply-To: <55991885.9030204-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On 05/07/15 12:44, Jonathan Cameron wrote:
> On 04/07/15 14:55, Martin Kepplinger wrote:
>> This adds the freefall / motion interrupt source definitions to the driver.
>> It is not in use now, but mma_chip_info and iio_chan_spec can easily be
>> adapted to use it instead of the transient interrupt source.
> So some support is added, but nothing done with it? Not sure we want
> to do this as it adds unused code paths.
>
> Why not support this fully?
Ah, I get it now. Used in next patch. Please add a comment here to indicate
that!
>>
>> Signed-off-by: Martin Kepplinger <martin.kepplinger-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org>
>> Signed-off-by: Christoph Muellner <christoph.muellner-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org>
>> ---
>> drivers/iio/accel/mma8452.c | 45 ++++++++++++++++++++++++++++++++++++---------
>> 1 file changed, 36 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
>> index 209b0d7..0498b6e 100644
>> --- a/drivers/iio/accel/mma8452.c
>> +++ b/drivers/iio/accel/mma8452.c
>> @@ -38,9 +38,18 @@
>> #define MMA8452_DATA_CFG 0x0e
>> #define MMA8452_HP_FILTER_CUTOFF 0x0f
>> #define MMA8452_HP_FILTER_CUTOFF_SEL_MASK (BIT(0) | BIT(1))
>> +#define MMA8452_FF_MT_CFG 0x15
>> +#define MMA8452_FF_MT_CFG_OAE BIT(6)
>> +#define MMA8452_FF_MT_CFG_ELE BIT(7)
>> +#define MMA8452_FF_MT_SRC 0x16
>> +#define MMA8452_FF_MT_SRC_XHE BIT(1)
>> +#define MMA8452_FF_MT_SRC_YHE BIT(3)
>> +#define MMA8452_FF_MT_SRC_ZHE BIT(5)
>> +#define MMA8452_FF_MT_THS 0x17
>> +#define MMA8452_FF_MT_THS_MASK 0x7f
>> +#define MMA8452_FF_MT_COUNT 0x18
>> #define MMA8452_TRANSIENT_CFG 0x1d
>> #define MMA8452_TRANSIENT_CFG_ELE BIT(4)
>> -#define MMA8452_TRANSIENT_CFG_CHAN(chan) BIT(chan + 1)
>> #define MMA8452_TRANSIENT_CFG_HPF_BYP BIT(0)
>> #define MMA8452_TRANSIENT_SRC 0x1e
>> #define MMA8452_TRANSIENT_SRC_XTRANSE BIT(1)
>> @@ -74,6 +83,7 @@
>> #define MMA8452_DATA_CFG_HPF_MASK BIT(4)
>>
>> #define MMA8452_INT_DRDY BIT(0)
>> +#define MMA8452_INT_FF_MT BIT(2)
>> #define MMA8452_INT_TRANS BIT(5)
>>
>> #define MMA8452_DEVICE_ID 0x2a
>> @@ -564,7 +574,8 @@ static int mma8452_write_event_config(struct iio_dev *indio_dev,
>> else
>> val &= ~BIT(chan->scan_index + chip->ev_cfg_chan_shift);
>>
>> - val |= MMA8452_TRANSIENT_CFG_ELE;
>> + val |= chip->ev_cfg_ele;
>> + val |= MMA8452_FF_MT_CFG_OAE;
>>
>> return mma8452_change_config(data, chip->ev_cfg, val);
>> }
>> @@ -605,6 +616,7 @@ static irqreturn_t mma8452_interrupt(int irq, void *p)
>> {
>> struct iio_dev *indio_dev = p;
>> struct mma8452_data *data = iio_priv(indio_dev);
>> + const struct mma_chip_info *chip = data->chip_info;
>> int ret = IRQ_NONE;
>> int src;
>>
>> @@ -617,7 +629,10 @@ static irqreturn_t mma8452_interrupt(int irq, void *p)
>> ret = IRQ_HANDLED;
>> }
>>
>> - if (src & MMA8452_INT_TRANS) {
>> + if ((src & MMA8452_INT_TRANS &&
>> + chip->ev_src == MMA8452_TRANSIENT_SRC) ||
>> + (src & MMA8452_INT_FF_MT &&
>> + chip->ev_src == MMA8452_FF_MT_SRC)) {
>> mma8452_transient_interrupt(indio_dev);
>> ret = IRQ_HANDLED;
>> }
>> @@ -678,6 +693,16 @@ static const struct iio_event_spec mma8452_transient_event[] = {
>> },
>> };
>>
>> +static const struct iio_event_spec mma8452_motion_event[] = {
>> + {
>> + .type = IIO_EV_TYPE_THRESH,
>> + .dir = IIO_EV_DIR_RISING,
>> + .mask_separate = BIT(IIO_EV_INFO_ENABLE),
>> + .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |
>> + BIT(IIO_EV_INFO_PERIOD)
>> + },
>> +};
>> +
>> /*
>> * Threshold is configured in fixed 8G/127 steps regardless of
>> * currently selected scale for measurement.
>> @@ -962,13 +987,15 @@ static int mma8452_probe(struct i2c_client *client,
>>
>> if (client->irq) {
>> /*
>> - * Although we enable the transient interrupt source once and
>> - * for all here the transient event detection itself is not
>> - * enabled until userspace asks for it by
>> - * mma8452_write_event_config()
>> + * Although we enable the interrupt sources once and for
>> + * all here the event detection itself is not enabled until
>> + * userspace asks for it by mma8452_write_event_config()
>> */
>> - int supported_interrupts = MMA8452_INT_DRDY | MMA8452_INT_TRANS;
>> - int enabled_interrupts = MMA8452_INT_TRANS;
>> + int supported_interrupts = MMA8452_INT_DRDY |
>> + MMA8452_INT_TRANS |
>> + MMA8452_INT_FF_MT;
>> + int enabled_interrupts = MMA8452_INT_TRANS |
>> + MMA8452_INT_FF_MT;
>>
>> /* Assume wired to INT1 pin */
>> ret = i2c_smbus_write_byte_data(client,
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-07-05 11:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-04 13:55 [PATCH v3 0/9] iio: mma8452: improve driver and support more chips Martin Kepplinger
[not found] ` <1436018110-3903-1-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-04 13:55 ` [PATCH 1/9] iio: mma8452: refactor for seperating chip specific data Martin Kepplinger
[not found] ` <1436018110-3903-2-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:37 ` Jonathan Cameron
2015-07-04 13:55 ` [PATCH 2/9] iio: mma8452: add support for MMA8453Q accelerometer chip Martin Kepplinger
[not found] ` <1436018110-3903-3-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:41 ` Jonathan Cameron
2015-07-04 13:55 ` [PATCH 3/9] iio: mma8452: add freefall / motion interrupt source Martin Kepplinger
[not found] ` <1436018110-3903-4-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:44 ` Jonathan Cameron
[not found] ` <55991885.9030204-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-05 11:44 ` Jonathan Cameron [this message]
2015-07-04 13:55 ` [PATCH 4/9] iio: mma8452: add support for MMA8652FC and MMA8653FC accelerometers Martin Kepplinger
[not found] ` <1436018110-3903-5-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:47 ` Jonathan Cameron
2015-07-04 13:55 ` [PATCH 5/9] iio: mma8452: add devicetree documentation Martin Kepplinger
[not found] ` <1436018110-3903-6-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:48 ` Jonathan Cameron
[not found] ` <5599199B.6030006-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2015-07-05 11:50 ` Martin Kepplinger
[not found] ` <55991A1E.30608-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 12:12 ` Jonathan Cameron
2015-07-06 8:06 ` Martin Fuzzey
[not found] ` <559A3715.3040206-mB3Nsq4MPf1BDgjK7y7TUQ@public.gmane.org>
2015-07-06 8:13 ` Martin Kepplinger
2015-07-04 13:55 ` [PATCH 6/9] iio: mma8452: add copyright notice comment Martin Kepplinger
2015-07-04 13:55 ` [PATCH 7/9] iio: mma8452: change iio event type to IIO_EV_TYPE_MAG Martin Kepplinger
[not found] ` <1436018110-3903-8-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:50 ` Jonathan Cameron
2015-07-06 8:39 ` Martin Fuzzey
[not found] ` <559A3EB0.2060200-mB3Nsq4MPf1BDgjK7y7TUQ@public.gmane.org>
2015-07-07 7:05 ` Jonathan Cameron
[not found] ` <E94BB95F-0719-41A8-B7B7-E035BE1B9C43-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org>
2015-07-07 7:32 ` Martin Kepplinger
2015-07-04 13:55 ` [PATCH 8/9] iio: mma8452: leave sysfs namings to the iio core Martin Kepplinger
2015-07-04 13:55 ` [PATCH 9/9] iio: mma8452: add devicetree property to allow all pin wirings Martin Kepplinger
[not found] ` <1436018110-3903-10-git-send-email-martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org>
2015-07-05 11:51 ` 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=559918AB.5070908@kernel.org \
--to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=christoph.muellner-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
--cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=martin.kepplinger-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org \
--cc=martink-1KBjaw7Xf1+zQB+pC5nmwQ@public.gmane.org \
--cc=mfuzzey-mB3Nsq4MPf1BDgjK7y7TUQ@public.gmane.org \
--cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
--cc=roberta.dobrescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).