All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Jeremy Cline <jeremy@jcline.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	russianneuromancer <russianneuromancer@ya.ru>
Subject: Re: [PATCH] iio: accel: kxcjk1013: Add tablet_mode sysfs file for exercising the KIOX010A ACPI DSM
Date: Wed, 25 Nov 2020 18:48:24 +0000	[thread overview]
Message-ID: <20201125184824.2052d6aa@archlinux> (raw)
In-Reply-To: <94522440-5842-4527-f14e-e02462272611@redhat.com>

On Wed, 25 Nov 2020 11:55:45 +0100
Hans de Goede <hdegoede@redhat.com> wrote:

> Hi,
> 
> On 11/25/20 11:34 AM, Andy Shevchenko wrote:
> > On Wed, Nov 25, 2020 at 10:56 AM Hans de Goede <hdegoede@redhat.com> wrote:  
> >>
> >> Some 360 degree hinges (yoga) style 2-in-1 devices use 2 KXCJ91008-s
> >> to allow the OS to determine the angle between the display and the base
> >> of the device, so that the OS can determine if the 2-in-1 is in laptop
> >> or in tablet-mode.
> >>
> >> On Windows both accelerometers are read by a special HingeAngleService
> >> process; and this process calls a DSM (Device Specific Method) on the
> >> ACPI KIOX010A device node for the sensor in the display, to let the
> >> embedded-controller (EC) know about the mode so that it can disable the
> >> kbd and touchpad to avoid spurious input while folded into tablet-mode.
> >>
> >> Currently the kxcjk1013 driver calls the DSM for this once at probe time
> >> to ensure that the builtin kbd and touchpad work.
> >>
> >> But some users have expressed interest in using this functionality to
> >> disable the kbd and touchpad when folded into tablet-mode as done under
> >> Windows.
> >>
> >> Add a tablet_mode sysfs file so that users can control the kbd/touchpad
> >> enable/disable functionality from user-space.  

Biggest thing missing here is documentation.

Documentation/ABI/testing/sysfs-bus-iio-kxcjk1013

Unless this is documented somewhere else?  I've no idea if there is any
precedence for this/

> > 
> > ...
> >   
> >> +       err = kiox010a_dsm(&data->client->dev,
> >> +                          tablet_mode ? KIOX010A_SET_TABLET_MODE :
> >> +                                        KIOX010A_SET_LAPTOP_MODE);  
> > 
> > A nit. With temporary variable it may be slightly better to read, like:
> > 
> >   int value;
> >   ...
> >   value = tablet_mode ? KIOX010A_SET_TABLET_MODE : KIOX010A_SET_LAPTOP_MODE);
> >   err = kiox010a_dsm(&data->client->dev, value);  
> 
> I'm fine with either solution, Jonathan let me know if you want a v2 with
> Andy's suggestion implemented (assuming you are willing to take this at all).

Prefer Andy's suggestion slightly seeing as you are going around again to
include some docs :)

Thanks,

Jonathan


  reply	other threads:[~2020-11-25 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25  8:54 [PATCH 0/1] iio: accel: kxcjk1013: Add tablet_mode sysfs file for exercising the KIOX010A ACPI DSM Hans de Goede
2020-11-25  8:54 ` [PATCH] " Hans de Goede
2020-11-25 10:34   ` Andy Shevchenko
2020-11-25 10:55     ` Hans de Goede
2020-11-25 18:48       ` Jonathan Cameron [this message]
2020-11-26 10:30         ` Hans de Goede
2020-11-26 12:04           ` 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=20201125184824.2052d6aa@archlinux \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=jeremy@jcline.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=russianneuromancer@ya.ru \
    /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.