linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor@chromium.org>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Benson Leung <bleung@chromium.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] HID: google: whiskers: more robust tablet mode detection
Date: Sun, 15 Sep 2019 20:36:34 -0700	[thread overview]
Message-ID: <CAE_wzQ9U-Lu=Uce0jFjec9JMYMhsQZoTuB+xqDpkOdC+Ufq6Ng@mail.gmail.com> (raw)
In-Reply-To: <CANMq1KALGLdZmOgcrrOROU5BXjwnXWSfq6fr85jfRn079JympQ@mail.gmail.com>

On Sun, Sep 15, 2019 at 8:26 PM Nicolas Boichat <drinkcat@chromium.org> wrote:
>
> On Sat, Sep 14, 2019 at 6:03 AM Dmitry Torokhov <dtor@chromium.org> wrote:
> >
> > The USB interface may get detected before the platform/EC one, so let's
> > note the state of the base (if we receive event) and use it to correctly
> > initialize the tablet mode switch state.
> >
> > Also let's start the HID interface immediately when probing, this will
> > ensure that we correctly process "base folded" events that may be sent
> > as we initialize the base. Note that this requires us to add a release()
>
> s/release/remove/ ?

You are right.

>
> > function where we stop and close the hardware and switch the LED
> > registration away from devm interface as we need to make sure that we
> > destroy the LED instance before we stop the hardware.
> >
> > Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
> > ---
> >  drivers/hid/hid-google-hammer.c | 71 ++++++++++++++++++++++++++-------
> >  1 file changed, 56 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
> > index 84f8c127ebdc..4f64f93ddfcb 100644
> > --- a/drivers/hid/hid-google-hammer.c
> > +++ b/drivers/hid/hid-google-hammer.c
> > @@ -208,7 +209,14 @@ static int __cbas_ec_probe(struct platform_device *pdev)
> >                 return error;
> >         }
> >
> > -       input_report_switch(input, SW_TABLET_MODE, !cbas_ec.base_present);
> > +       if (!cbas_ec.base_present)
> > +               cbas_ec.base_folded = false;
>
> I'm not sure to see why this is necessary? The folded base state
> should be in bss and false anyway, and even if it was true, it would
> not change the result of the expression below (!cbas_ec.base_present
> || cbas_ec.base_folded).

To have a more accurate printout generated by the line below. The fact
that it is in bss it not relevant, as I can unbind and rebind the
driver via sysfs, so it could have stale data from the previous run.

>
> > +
> > +       dev_dbg(&pdev->dev, "%s: base: %d, folded: %d\n", __func__,
> > +               cbas_ec.base_present, cbas_ec.base_folded);
> > +
> > +       input_report_switch(input, SW_TABLET_MODE,
> > +                           !cbas_ec.base_present || cbas_ec.base_folded);
> >
> >         cbas_ec_set_input(input);
> >

Thanks,
Dmitry

  reply	other threads:[~2019-09-16  3:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 22:03 [PATCH 1/3] HID: google: whiskers: more robust tablet mode detection Dmitry Torokhov
2019-09-13 22:03 ` [PATCH 2/3] HID: google: whiskers: signal tablet mode switch on disconnect Dmitry Torokhov
2019-09-13 22:03 ` [PATCH 3/3] HID: google: whiskers: signal tablet mode on connect Dmitry Torokhov
2019-09-16  3:26 ` [PATCH 1/3] HID: google: whiskers: more robust tablet mode detection Nicolas Boichat
2019-09-16  3:36   ` Dmitry Torokhov [this message]
2019-09-23  9:09     ` Jiri Kosina
2019-10-01 14:16       ` Jiri Kosina

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='CAE_wzQ9U-Lu=Uce0jFjec9JMYMhsQZoTuB+xqDpkOdC+Ufq6Ng@mail.gmail.com' \
    --to=dtor@chromium.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=bleung@chromium.org \
    --cc=drinkcat@chromium.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.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).