Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp457546ybl; Tue, 7 Jan 2020 09:03:33 -0800 (PST) X-Google-Smtp-Source: APXvYqwiOHCEcMeD7pyj7/jo3gTGI+HU1NqC0f7EvEf5M5Q1AmNJ1XcPkxNrf7j46lfqd7lircuK X-Received: by 2002:a54:4507:: with SMTP id l7mr412119oil.164.1578416613164; Tue, 07 Jan 2020 09:03:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578416613; cv=none; d=google.com; s=arc-20160816; b=wOBPIB0qXUNbKkxxnwL63IGjc2Tj7MaPAmrN5qedVPLj3VnrnigYKEeN9WFD4o9nF9 aLoTt2KWfUX6OJ5ThFdyCeCgwL/7EY8qd+juGbg0uWlLaCs2NK/N/iqa34gUg+CeqUgo 3ZwS1w6C+WXfqSlKpqBgAq4shHcVyElQT1oSWasUu3XWI1pmopVWpF6g1mv2e25QNS9r cl3hqNeI+NfyggM3rGEIHAsDQPtGxNztF7Jdkm5xM9PePzPITrniCG23NJ1BFdGqRwBF PW1oaXBb5rTlvDUNBjaSUDbDI2KQjFGJTHIrs8N0rOeHiiDyOz5o/SIfKtqS/CyeVofl 7A1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=0XVWStOl7GqS4ByG6Q6+yQNmlk2L1mpP6g32Aw0oOFY=; b=HnuaPaMOIyJqo5tVIypP0Qr2nkMRt0xQG/Sfq6vI+csdRzPtbi3ktBOvXDLVZSLe7A yNAn3mcYSTTtJlvCiLnBgXNKbyvZ93lGnDarWi3h8Kc+4lqLR/6o3LNb9F8AHAk6a73p OjaAViitZnyIi66WZhzNeUTGuEGkLIqFV3p1lEFhdzKXFQcPhBdqTkdQpXcrz+La+Iec dzS9XCxtn9WgHCEwauQG3rr/CeMxoU+UzQh/mmUjFRMMTdOu3o4CaFul7JbMQEVO1blQ n0VzSEnhLe8LLUhOw4UzP+RpRnsw6xpKXzffjH7XIe9A1Iys22cTk2VzC92f8bA+ZYe9 gIUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z194si249737oia.50.2020.01.07.09.03.17; Tue, 07 Jan 2020 09:03:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbgAGQvP (ORCPT + 99 others); Tue, 7 Jan 2020 11:51:15 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46662 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728173AbgAGQvP (ORCPT ); Tue, 7 Jan 2020 11:51:15 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 4BAC02732ED Subject: Re: [PATCH v4 2/2] mfd: cros_ec: Add cros-usbpd-notify subdevice To: Prashant Malani Cc: Guenter Roeck , Benson Leung , Lee Jones , Linux Kernel Mailing List References: <20191220193843.47182-1-pmalani@chromium.org> <20191220193843.47182-2-pmalani@chromium.org> <7eecafb2-4686-b448-2837-4181188365b1@collabora.com> From: Enric Balletbo i Serra Message-ID: Date: Tue, 7 Jan 2020 17:51:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prashant, On 3/1/20 0:52, Prashant Malani wrote: > Hi Enric, > > > On Mon, Dec 23, 2019 at 12:29 PM Prashant Malani wrote: >> >> Hi Enric, >> >> On Sun, Dec 22, 2019 at 11:25 PM Enric Balletbo i Serra >> wrote: >>> >>> Hi Prashant, >>> >>> On 20/12/19 20:38, Prashant Malani wrote: >>>> Add the cros-usbpd-notify driver as a subdevice on non-ACPI platforms >>>> that support the EC_FEATURE_USB_PD EC feature flag. >>>> >>>> This driver allows other cros-ec devices to receive PD event >>>> notifications from the Chrome OS Embedded Controller (EC) via a >>>> notification chain. >>>> >>>> Signed-off-by: Prashant Malani >>>> --- >>>> >>>> Changes in v4: >>>> - Removed #ifndef usage; instead, moved cros-usbpd-notify to a separate >>>> mfd_cell and used an IS_ENABLED() check. >>>> - Changed commit title and description slightly to reflect change in >>>> code. >>>> >>>> drivers/mfd/cros_ec_dev.c | 21 +++++++++++++++++++++ >>>> 1 file changed, 21 insertions(+) >>>> >>>> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c >>>> index c4b977a5dd966..da198abe2b0a6 100644 >>>> --- a/drivers/mfd/cros_ec_dev.c >>>> +++ b/drivers/mfd/cros_ec_dev.c >>>> @@ -5,6 +5,7 @@ >>>> * Copyright (C) 2014 Google, Inc. >>>> */ >>>> >>>> +#include >>>> #include >>>> #include >>>> #include >>>> @@ -87,6 +88,10 @@ static const struct mfd_cell cros_usbpd_charger_cells[] = { >>>> { .name = "cros-usbpd-logger", }, >>>> }; >>>> >>>> +static const struct mfd_cell cros_usbpd_notify_cells[] = { >>>> + { .name = "cros-usbpd-notify", }, >>>> +}; >>>> + >>>> static const struct cros_feature_to_cells cros_subdevices[] = { >>>> { >>>> .id = EC_FEATURE_CEC, >>>> @@ -202,6 +207,22 @@ static int ec_device_probe(struct platform_device *pdev) >>>> } >>>> } >>>> >>>> + /* >>>> + * The PD notifier driver cell is separate since it only needs to be >>>> + * explicitly added on non-ACPI platforms. >>> >>> >>> Sorry to not catch this before, but a worry arose. Is non-ACPI platforms or >>> non-X86 platforms or on OF platforms? >>> >>> ARM64 for example has the CONFIG_ACPI symbol set to yes, with the below >>> condition condition will not work on Kevin for example and IIUC this is not what >>> we want, I think we want IS_ENABLED(CONFIG_OF)? >> Thanks for noting this. I will check with a kevin, and with the >> internal build flags to verify whether there are ARM64 which have the >> GOOG0003 PD notification device. >> I'll update this thread with my findings. > AFAICT from the Chrome OS kernel build step .config output, kevin > doesn't have CONFIG_ACPI enabled (it is marked as "# CONFIG_ACPI is > not set"), and it doesn't look like there are Chrome OS ARM devices > that use ACPI (I believe it's only used on Chrome OS x86-based > devices). So perhaps it is not a concern? > The problem is, although it is not used in your configs, it can be selected, and fwiw some defconfigs in mainline have it enabled, i.e the arm64 defconfig. I think you're testing the patch on x86 but I suspect we want also the notifier on some arm64 platforms (like kevin) right? In such case I won't get the notifier because CONFIG_OF and CONFIG_ACPI is enabled on my defconfig. My guess is that the logic should be if IS_ENABLED(CONFIG_OF) call cros_ec_check_features, otherwise ACPI will do the magic instead of (!IS_ENABLED(CONFIG_ACPI)) Best, Enric >> >> Best, >> >>> >>> Thanks, >>> Enric >>> >>>> + */ >>>> + if (!IS_ENABLED(CONFIG_ACPI)) { >>>> + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) { >>>> + retval = mfd_add_hotplug_devices(ec->dev, >>>> + cros_usbpd_notify_cells, >>>> + ARRAY_SIZE(cros_usbpd_notify_cells)); >>>> + if (retval) >>>> + dev_err(ec->dev, >>>> + "failed to add PD notify devices: %d\n", >>>> + retval); >>>> + } >>>> + } >>>> + >>>> /* >>>> * The following subdevices cannot be detected by sending the >>>> * EC_FEATURE_GET_CMD to the Embedded Controller device. >>>>