From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Andrew Duggan <aduggan@synaptics.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Christopher Heiny <cheiny@synaptics.com>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Bjorn Andersson <bjorn.andersson@sonymobile.com>
Subject: Re: [PATCH] Input: synaptics-rmi4: Support regulator supplies
Date: Thu, 21 Apr 2016 15:37:55 -0700 [thread overview]
Message-ID: <20160421223755.GB3202@tuxbot> (raw)
In-Reply-To: <56FDD345.20605@synaptics.com>
On Thu 31 Mar 18:47 PDT 2016, Andrew Duggan wrote:
> On 03/31/2016 12:14 PM, Bjorn Andersson wrote:
> >On Thu 31 Mar 11:19 PDT 2016, Dmitry Torokhov wrote:
> >
> >>Hi Bjorn,
> >>
> >>On Wed, Mar 30, 2016 at 09:57:29AM -0700, Bjorn Andersson wrote:
> >>>From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> >>>
> >>>Support the two supplies - vdd and vio - to make it possible to control
> >>>power to the Synaptics chip.
> >>>
> >>>Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> >>>Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> >>>---
> >>> .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 7 ++++
> >>> drivers/input/rmi4/rmi_i2c.c | 45 ++++++++++++++++++++++
> >>Would not we need pretty much the same changes for SPI devices? Can this
> >>be done in core?
> >>
> >Yes, I believe it needs the exact same steps.
> >
> >I did a initial quick hack on v1 of the patchset and back then it was
> >possible, when I rebased it a few weeks back I kept ending up in getting
> >interrupts with the power off.
> >
> >Looking at the code this is likely because in the resume paths the IRQ
> >is enabled before we jump to rmi_driver_resume(), so putting this in the
> >core I ended up calling rmi_process_interrupt_requests() before powering
> >up the chip.
>
> Actually, I don't think the irq needs to be enabled before calling
> rmi_driver_resume(). Typically, the functions are just reading and writing
> to registers and do not need to handle interrupts. We could probably call to
> rmi_driver_resume() before enabling the irq. I can double check that there
> are not any exceptions to this.
>
I finally got back to giving this a spin.
The problem is that we register the transport device with the driver,
which triggers the rmi_driver probe() which resolves the resources. We
then continue on and call rmi_i2c_init_irq() which will (implicitly)
enable the irq. So if the rmi_driver probe() does not finish in a serial
fashion we will enable interrupts before we have fully initialized the
core.
I don't know if this causes other issues, but with the required delay
after enabling the regulators we always get an interrupt before the
rmi_driver probe() function is finished.
> I have also considered adding a power callback to the core so that the
> transport drivers can set the power independently of suspend and resume. One
> example would be to shut off power to a touchpad if a mouse is connected. If
> we do need to have the irq enabled before calling rmi_driver_resume() we
> could still move regulator support to the core and call the power callback
> from the transport drivers.
>
I see no (sane) way of waiting for the rmi_driver to finish probeing;
there could be cases where it's powered by a regulator (or reset gpio)
that is not yet probed. EPROBE_DEFER will handle this, but we can't wait
for it in the transport driver.
I therefor think these physical resources should be handled in the
context of the transport layer, to make sure we don't have temporal
dependencies to the other layers.
Or we should not have the rmi_driver as a separate device driver at all
- it could be a "library" that runs in the context of the transport
device.
Regards,
Bjorn
next prev parent reply other threads:[~2016-04-21 22:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 16:57 [PATCH] Input: synaptics-rmi4: Support regulator supplies Bjorn Andersson
[not found] ` <1459357049-5608-1-git-send-email-bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-03-31 18:19 ` Dmitry Torokhov
2016-03-31 19:14 ` Bjorn Andersson
2016-04-01 1:47 ` Andrew Duggan
2016-04-21 22:37 ` Bjorn Andersson [this message]
2016-05-05 20:55 ` Andrew Duggan
[not found] ` <572BB344.6030100-Gq53QDLGkWKakBO8gow8eQ@public.gmane.org>
2016-05-06 0:58 ` Bjorn Andersson
2016-05-07 4:40 ` [PATCH v2 0/3] input: rmi4: Regulator supply support Bjorn Andersson
2016-05-07 4:40 ` [PATCH v2 1/3] input: rmi4: Move IRQ handling to rmi_driver Bjorn Andersson
2016-05-07 4:40 ` [PATCH v2 2/3] input: rmi4: Acquire and enable VDD and VIO supplies Bjorn Andersson
2016-05-09 19:58 ` Rob Herring
2016-05-07 4:40 ` [PATCH v2 3/3] input: rmi4: Remove set_page() call before core is initialized Bjorn Andersson
2016-05-10 0:36 ` [PATCH v2 0/3] input: rmi4: Regulator supply support Andrew Duggan
[not found] ` <57312CFB.2040304-Gq53QDLGkWKakBO8gow8eQ@public.gmane.org>
2016-05-10 15:49 ` Bjorn Andersson
2016-05-11 23:30 ` Andrew Duggan
2016-05-12 3:05 ` Bjorn Andersson
2016-05-13 0:52 ` Andrew Duggan
2016-05-13 22:29 ` Bjorn Andersson
2016-05-16 23:55 ` Andrew Duggan
-- strict thread matches above, loose matches on Subject: below --
2016-03-30 16:57 [PATCH] Input: synaptics-rmi4: Support regulator supplies Bjorn Andersson
2016-03-30 17:02 ` Bjorn Andersson
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=20160421223755.GB3202@tuxbot \
--to=bjorn.andersson@linaro.org \
--cc=aduggan@synaptics.com \
--cc=bjorn.andersson@sonymobile.com \
--cc=cheiny@synaptics.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.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).