From: Lee Jones <lee.jones@linaro.org>
To: Jack Andersen <jackoalan@gmail.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH v5 3/3] mfd: dln2: Send restart command if HW init fails
Date: Thu, 6 Jul 2017 08:09:13 +0100 [thread overview]
Message-ID: <20170706070913.qh2ztrvbvi7gy5co@dell> (raw)
In-Reply-To: <CAPHBK3bnoUNXHdOwswGRDkiwHZSh6K1fRdJaTHDzaQwL_kP=Bw@mail.gmail.com>
On Wed, 05 Jul 2017, Jack Andersen wrote:
> I have mixed feelings about making this patch. The device appears to
> lose its ability to send command responses when the driver
> unexpectedly goes offline (probably overflowing an internal send
> buffer).
>
> The restart command is a send-only way to recover the device.
> What concerns me is if there's another issue causing init to fail and
> a restart doesn't fix, this will trigger an endless probe loop. I'm
> not sure if there's a better way to discern this condition.
Why does dln2_restart() cause an unbind/bind?
> On 5 July 2017 at 11:12, Jack Andersen <jackoalan@gmail.com> wrote:
> > There's an issue with reinitializing DLN2 hardware if ADC channel event
> > configurations aren't reset before suspending the driver. A physical reconnect
> > of the device solves the problem, but restarting the machine without a power
> > cycle leaves the device state inconsistent.
> >
> > This patch transmits a restart command in the event of a failed init.
> > To the kernel's perspective, this is the rough equivalent of a disconnect and
> > reconnect, so another probe occurs shortly afterwards.
> >
> > Signed-off-by: Jack Andersen <jackoalan@gmail.com>
> > ---
> > drivers/mfd/dln2.c | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
> > index a22ab8c..1eb0056 100644
> > --- a/drivers/mfd/dln2.c
> > +++ b/drivers/mfd/dln2.c
> > @@ -40,6 +40,7 @@ struct dln2_response {
> > #define DLN2_GENERIC_CMD(cmd) DLN2_CMD(cmd, DLN2_GENERIC_MODULE_ID)
> > #define CMD_GET_DEVICE_VER DLN2_GENERIC_CMD(0x30)
> > #define CMD_GET_DEVICE_SN DLN2_GENERIC_CMD(0x31)
> > +#define CMD_RESTART DLN2_GENERIC_CMD(0x43)
> >
> > #define DLN2_HW_ID 0x200
> > #define DLN2_USB_TIMEOUT 200 /* in ms */
> > @@ -531,6 +532,12 @@ int dln2_transfer(struct platform_device *pdev, u16 cmd,
> > }
> > EXPORT_SYMBOL(dln2_transfer);
> >
> > +static int dln2_restart(struct dln2_dev *dln2)
> > +{
> > + return _dln2_transfer(dln2, DLN2_HANDLE_CTRL, CMD_RESTART,
> > + NULL, 0, NULL, NULL);
> > +}
> > +
> > static int dln2_check_hw(struct dln2_dev *dln2)
> > {
> > int ret;
> > @@ -782,7 +789,9 @@ static int dln2_probe(struct usb_interface *interface,
> >
> > ret = dln2_hw_init(dln2);
> > if (ret < 0) {
> > - dev_err(dev, "failed to initialize hardware\n");
> > + dev_err(dev,
> > + "failed to initialize hardware; attempting restart\n");
> > + dln2_restart(dln2);
> > goto out_stop_rx;
> > }
> >
> >
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2017-07-06 7:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <b5ede0cc2cb36695b86edf44c0dddbc4736a6420>
2017-06-22 22:31 ` [PATCH v2] iio: adc: Add support for DLN2 ADC Jack Andersen
2017-06-23 7:25 ` Peter Meerwald-Stadler
2017-06-28 0:53 ` [PATCH v3] " Jack Andersen
2017-06-28 0:57 ` Jack Andersen
2017-06-28 1:05 ` [PATCH v4] " Jack Andersen
2017-07-01 11:57 ` Jonathan Cameron
2017-07-05 21:12 ` [PATCH v5 1/3] " Jack Andersen
2017-07-06 11:37 ` Jonathan Cameron
2017-07-05 21:12 ` [PATCH v5 2/3] mfd: dln2: Add cell for initializing " Jack Andersen
2017-07-06 7:10 ` Lee Jones
2017-07-05 21:12 ` [PATCH v5 3/3] mfd: dln2: Send restart command if HW init fails Jack Andersen
2017-07-05 21:23 ` Jack Andersen
2017-07-06 7:09 ` Lee Jones [this message]
2017-07-06 21:01 ` Jack Andersen
2017-07-06 22:39 ` [PATCH v6 1/3] iio: adc: Add support for DLN2 ADC Jack Andersen
2017-07-09 17:12 ` Jonathan Cameron
2017-07-10 20:04 ` Jack Andersen
2017-07-06 22:39 ` [PATCH v6 2/3] mfd: dln2: Add cell for initializing " Jack Andersen
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=20170706070913.qh2ztrvbvi7gy5co@dell \
--to=lee.jones@linaro.org \
--cc=jackoalan@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).