Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbdFVTfa (ORCPT ); Thu, 22 Jun 2017 15:35:30 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:36409 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbdFVTf3 (ORCPT ); Thu, 22 Jun 2017 15:35:29 -0400 Date: Thu, 22 Jun 2017 12:35:24 -0700 From: Benson Leung To: Enric Balletbo i Serra Cc: olof@lixom.net, bleung@chromium.org, linux-kernel@vger.kernel.org, lee.jones@linaro.org, Gwendal Grignou , Thierry Escande , bleung@google.com Subject: Re: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP events support over ACPI Message-ID: <20170622193524.GA85041@decatoncale.mtv.corp.google.com> References: <20170516161319.13257-1-enric.balletbo@collabora.com> <20170516161319.13257-10-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline In-Reply-To: <20170516161319.13257-10-enric.balletbo@collabora.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3751 Lines: 126 --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Enric and Thierry, Just one minor question about this commit. On Tue, May 16, 2017 at 06:13:15PM +0200, Enric Balletbo i Serra wrote: > From: Gwendal Grignou >=20 > This patch installs a notify handler to process MKBP events for EC > firmware directing them over ACPI. >=20 > Signed-off-by: Gwendal Grignou > Signed-off-by: Thierry Escande > --- > drivers/platform/chrome/cros_ec_lpc.c | 32 +++++++++++++++++++++++++++++= +++ > 1 file changed, 32 insertions(+) >=20 > diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chr= ome/cros_ec_lpc.c > index 89afad7..eeb187e 100644 > --- a/drivers/platform/chrome/cros_ec_lpc.c > +++ b/drivers/platform/chrome/cros_ec_lpc.c > @@ -227,9 +227,20 @@ static int cros_ec_lpc_readmem(struct cros_ec_device= *ec, unsigned int offset, > return cnt; > } > =20 > +static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void = *data) > +{ > + struct cros_ec_device *ec_dev =3D data; > + > + if (ec_dev->mkbp_event_supported && cros_ec_get_next_event(ec_dev) > 0) > + blocking_notifier_call_chain(&ec_dev->event_notifier, 0, > + ec_dev); > +} > + > static int cros_ec_lpc_probe(struct platform_device *pdev) > { > struct device *dev =3D &pdev->dev; > + struct acpi_device *adev; > + acpi_status status; > struct cros_ec_device *ec_dev; > u8 buf[2]; > int ret; > @@ -277,12 +288,33 @@ static int cros_ec_lpc_probe(struct platform_device= *pdev) > return ret; > } > =20 > + /* > + * Connect a notify handler to process MKBP messages if we have a > + * companion ACPI device. > + */ > + adev =3D ACPI_COMPANION(dev); > + if (adev) { > + status =3D acpi_install_notify_handler(adev->handle, > + ACPI_ALL_NOTIFY, Is there a reason you're using ACPI_ALL_NOTIFY here instead of ACPI_SYSTEM_NOTIFY that is done in the CHROMIUM version of this? > + cros_ec_lpc_acpi_notify, > + ec_dev); > + if (ACPI_FAILURE(status)) > + dev_warn(dev, "Failed to register notifier %08x\n", > + status); > + } > + > return 0; > } > =20 > static int cros_ec_lpc_remove(struct platform_device *pdev) > { > struct cros_ec_device *ec_dev; > + struct acpi_device *adev; > + > + adev =3D ACPI_COMPANION(&pdev->dev); > + if (adev) > + acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY, > + cros_ec_lpc_acpi_notify); > =20 > ec_dev =3D platform_get_drvdata(pdev); > cros_ec_remove(ec_dev); > --=20 > 2.9.3 >=20 --=20 Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org --Nq2Wo0NMKNjxTN9z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJZTBv7AAoJEB8J9XsKL+ZYaLIP/3RFWUi/ICb0aQ9sLE86Dvkf bW9Ku9Gi+0G9aO7w/2kNVolVaEgqqS+cf14Hx3uRNwxw9VGAUOJpx0iFy8CF8YqR +LiMFXDYVrndrHiCtzqQphFYY8Ea0CVtK6322QS67T/bfK0g/ele8W84RnYUTon1 4Tz3VYsFkdug/rOeym+p8+ErUaHxelCIW2BC4STjM+x7cgfqDHENqqwNA91uKmth 2Oa9dp9NSfb4bTDhaDZ4pw5McAE196bcOBRp+2GVCDA00u/mnmpaAR32woY1ld9B XJFcjSXtVRvhdwCN2tYoKtPR3CvoM0iJS+Z9jWaVEKO3YbTRANAJfVvqZPDEvWte s3xNBYPCQTyTmNVZy+dzKcIivHUiQ2hSgLC0UE6uUNVgysp+7seBwyyf2sk3i2Sy YJEthPUGN1fnnAXZw+3l3DuVeVDiiPeSZ4qhp+b/u/jjYBziy0kGqejjF2DMqLjI ANA4yQSoWVxH4UKbqKT+PM+1zX4BJQT4NPf1/28U/sb+4diYvna9lsGIIfutI8yV +KeavzuheYcL9SIMIB008SggfpPOGoi+5b+ZSCaWreKEikcSK6AP1aU/GhQywOfL rcLphAZwJNVMG5fAb+zlozTPmwH7Sq/+fseTrzKorE5QPpFPrwbZQRYyrckqJghd y+nvkzT/+cHDK+f5Bu+z =Q+k5 -----END PGP SIGNATURE----- --Nq2Wo0NMKNjxTN9z--