Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673003 > unrolled thread

Re: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP events support over ACPI

Started byBenson Leung <bleung@google.com>
First post2017-06-22 21:40 +0200
Last post2017-06-23 20:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP  events support over ACPI Benson Leung <bleung@google.com> - 2017-06-22 21:40 +0200
    Re: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP  events support over ACPI Thierry Escande <thierry.escande@collabora.com> - 2017-06-23 09:40 +0200
      Re: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP  events support over ACPI Benson Leung <bleung@google.com> - 2017-06-23 20:00 +0200

#1673003 — Re: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP events support over ACPI

FromBenson Leung <bleung@google.com>
Date2017-06-22 21:40 +0200
SubjectRe: [PATCH RESEND 09/13] platform/chrome: cros_ec_lpc: Add MKBP events support over ACPI
Message-ID<tVg7o-xW-21@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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 <gwendal@chromium.org>
> 
> This patch installs a notify handler to process MKBP events for EC
> firmware directing them over ACPI.
> 
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
> Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
> ---
>  drivers/platform/chrome/cros_ec_lpc.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/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;
>  }
>  
> +static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
> +{
> +	struct cros_ec_device *ec_dev = 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 = &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;
>  	}
>  
> +	/*
> +	 * Connect a notify handler to process MKBP messages if we have a
> +	 * companion ACPI device.
> +	 */
> +	adev = ACPI_COMPANION(dev);
> +	if (adev) {
> +		status = 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;
>  }
>  
>  static int cros_ec_lpc_remove(struct platform_device *pdev)
>  {
>  	struct cros_ec_device *ec_dev;
> +	struct acpi_device *adev;
> +
> +	adev = ACPI_COMPANION(&pdev->dev);
> +	if (adev)
> +		acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
> +					   cros_ec_lpc_acpi_notify);
>  
>  	ec_dev = platform_get_drvdata(pdev);
>  	cros_ec_remove(ec_dev);
> -- 
> 2.9.3
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[toc] | [next] | [standalone]


#1673336

FromThierry Escande <thierry.escande@collabora.com>
Date2017-06-23 09:40 +0200
Message-ID<tVrma-7GV-19@gated-at.bofh.it>
In reply to#1673003
Hi Benson,

On 22/06/2017 21:35, Benson Leung wrote:

<snip>

>> +	adev = ACPI_COMPANION(dev);
>> +	if (adev) {
>> +		status = 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?
> 
In the original patch 
(https://chromium-review.googlesource.com/c/358155/) ACPI_ALL_NOTIFY is 
passed to acpi_install_notify_handler() and ACPI_SYSTEM_NOTIFY to 
acpi_remove_notify_handler. I changed it for remove_notify call to 
unsure all handler references were removed.

Regards,
  Thierry

>> +						     cros_ec_lpc_acpi_notify,
>> +						     ec_dev);
>> +		if (ACPI_FAILURE(status))
>> +			dev_warn(dev, "Failed to register notifier %08x\n",
>> +				 status);
>> +	}
>> +
>>   	return 0;
>>   }
>>   
>>   static int cros_ec_lpc_remove(struct platform_device *pdev)
>>   {
>>   	struct cros_ec_device *ec_dev;
>> +	struct acpi_device *adev;
>> +
>> +	adev = ACPI_COMPANION(&pdev->dev);
>> +	if (adev)
>> +		acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
>> +					   cros_ec_lpc_acpi_notify);
>>   
>>   	ec_dev = platform_get_drvdata(pdev);
>>   	cros_ec_remove(ec_dev);
>> -- 
>> 2.9.3
>>
> 

[toc] | [prev] | [next] | [standalone]


#1673739

FromBenson Leung <bleung@google.com>
Date2017-06-23 20:00 +0200
Message-ID<tVB2a-5e4-23@gated-at.bofh.it>
In reply to#1673336

[Multipart message — attachments visible in raw view] — view raw

Hi Thierry,

On Fri, Jun 23, 2017 at 09:35:06AM +0200, Thierry Escande wrote:
> Hi Benson,
> 
> On 22/06/2017 21:35, Benson Leung wrote:
> 
> <snip>
> 
> >>+	adev = ACPI_COMPANION(dev);
> >>+	if (adev) {
> >>+		status = 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?
> >
> In the original patch
> (https://chromium-review.googlesource.com/c/358155/) ACPI_ALL_NOTIFY
> is passed to acpi_install_notify_handler() and ACPI_SYSTEM_NOTIFY to
> acpi_remove_notify_handler. I changed it for remove_notify call to
> unsure all handler references were removed.
> 

Oh, I see. Looks good. I'll go ahead and make the same change in the
chromeos-4.4 kernel too.

Signed-off-by: Benson Leung <bleung@chromium.org>

Applied.

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web