linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ayman.bagabas@gmail.com
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Takashi Iwai <tiwai@suse.de>
Cc: ALSA Development Mailing List <alsa-devel@alsa-project.org>,
	Hui Wang <hui.wang@canonical.com>,
	Andy Shevchenko <andy@infradead.org>,
	Darren Hart <dvhart@infradead.org>,
	Jaroslav Kysela <perex@perex.cz>,
	Kailang Yang <kailang@realtek.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v7 2/3] x86: add support for Huawei WMI hotkeys.
Date: Tue, 27 Nov 2018 19:49:48 -0500	[thread overview]
Message-ID: <789965489e73fd543f0552090063fdff69363497.camel@gmail.com> (raw)
In-Reply-To: <CAHp75Vd_k3Gu93hOUOLXD90O_eM3wy2K3QfMN0789PQEOixS=w@mail.gmail.com>

On Tue, 2018-11-27 at 17:52 +0200, Andy Shevchenko wrote:
> On Tue, Nov 27, 2018 at 1:02 PM Takashi Iwai <tiwai@suse.de> wrote:
> > On Tue, 27 Nov 2018 03:57:48 +0100,
> > Ayman Bagabas wrote:
> > > +     handle = ACPI_HANDLE(&inputdev->dev);
> > > +     args[0].type = args[1].type = args[2].type =
> > > ACPI_TYPE_INTEGER;
> > > +     args[1].integer.value = 0x04;
> > > +
> > > +     if (acpi_has_method(handle, method =
> > > "\\_SB.PCI0.LPCB.EC0.SPIN")) {
> > 
> > This looks ugly...  And checkpatch also complains.
> 
> Good point.
> Actually another question is what handle do we get here? Can we check
> method name by relative path, i.e. "SPIN" / "WPIN" instead?

The handle is a NULL handle at "\". Should I use acpi_get_handle(NULL,
"\\_SB.PCI0.LPCB.EC0", &handle)?  EC0 is a acpi device HID:PNP0C09.

> 
> > > +             args[0].integer.value = 0;
> > > +             args[2].integer.value = on ? 1 : 0;
> > > +     } else if (acpi_has_method(handle, method =
> > > "\\_SB.PCI0.LPCB.EC0.WPIN")) {
> > > +             args[0].integer.value = 1;
> > > +             args[2].integer.value = on ? 0 : 1;
> > > +     } else {
> > > +             dev_err(&inputdev->dev, "Unable to find ACPI
> > > method\n");
> > > +             return -ENOSYS;
> > > +     }
> > 
> > Can these checks be done at initialization phase?  It doesn't seem
> > needed to be executed at each call.
> 
> Agree.
> 

Even if it was done in init phase, we still need to check what acpi
method should be used and based on that and micmute status we set the
arguments args[0] and args[2], args[1] is the pin value. We could check
these using event_guid, but that would assume the methods exist for
each guid.
For example, if event_guid == MBX_EVENT_GUID, then method SPIN should
be used.


  reply	other threads:[~2018-11-28  0:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27  2:57 [PATCH v7 0/3] Huawei laptops Ayman Bagabas
2018-11-27  2:57 ` [PATCH v7 1/3] ALSA: hda: fix front speakers on Huawei MBXP Ayman Bagabas
2018-11-27  2:57 ` [PATCH v7 2/3] x86: add support for Huawei WMI hotkeys Ayman Bagabas
2018-11-27  9:45   ` Takashi Iwai
2018-11-28  0:58     ` ayman.bagabas
2018-11-27 11:02   ` Takashi Iwai
2018-11-27 15:52     ` Andy Shevchenko
2018-11-28  0:49       ` ayman.bagabas [this message]
2018-11-28  8:44         ` Takashi Iwai
2018-11-27  2:57 ` [PATCH v7 3/3] ALSA: hda: add support for Huawei WMI micmute LED Ayman Bagabas
     [not found] <20181126234624.31264-1-ayman.bagabas@gmail.com>
2018-11-26 23:46 ` [PATCH v7 2/3] x86: add support for Huawei WMI hotkeys Ayman Bagabas

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=789965489e73fd543f0552090063fdff69363497.camel@gmail.com \
    --to=ayman.bagabas@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=hui.wang@canonical.com \
    --cc=kailang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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).