Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5235869pxj; Wed, 26 May 2021 06:08:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHmcCIbN8wt7uME4z/UsyL4JlrEUV1PwWjSaxGQ40cIPACQbUvWAlcbO+snORsD0RjF0ZO X-Received: by 2002:aa7:d282:: with SMTP id w2mr37600384edq.45.1622034527953; Wed, 26 May 2021 06:08:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622034527; cv=none; d=google.com; s=arc-20160816; b=oz43eLMHkbxr+aRRPwztp0mTJ681vspM+W48k1DszedYRQ94NDGfdJN6Sndb0431e9 CPuZRbdX6wm7l5sah1fUpsdP2d355jUZa6wHdkQ6A5V+E4i0L4tBZkEIrlM0nHydkYuv ru2Fha6xyDJ+KEh+nOgYVFUKFm4FqwZzu+if35qYkpBMikHDVXHC31Z7eW9y7umwCcWG GfTkcJ1VvPXYfqF+na5olCts+Sx9oVwx9tOh0zssNYJaHPPAt4ufq3evoPfGjgbrag4h sbcDAGJ2huOlSTi8zEk5uMEO0Mu/vQid/Cb6EVTqZHWaasleONSMbYhl9zBR3Cn1/PID mXUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=E4eKHLcFq56a0phX/ANaKqEZD35uAU/mIT6I/W/kEx0=; b=HQam9V1ZTgYtPODj2VlI4cWBLO7LWegcJRaXJTkEbbHj+QoQ+yY7wE8uY5mFB+2ba1 Dvio/k/g48pAnojyLqxkZEi7MYG9qax4bmcE8kYjVXUwqSutHfer//LKSNBYZkXJb6ZH wZgpOK7lNo2Xx0SG7DjIaUcm9ruCF2dOterJqkJTUvjKxIOuySolFFEEpxQ+CSWyiJZ9 VP1r2HOkWA0dPbSd5sDHc3sqvmEv69jiS96Tq71t++4qQlNvjN2ZGQRKaOHUCLGlXiYo 5w+wQwUwQMCCCRDdVLDu8mw5VE6SKwEYsOdALPvfU3Xl/BYweg0GTLEBSJuxvCyDi8iS i9Wg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id i10si22530665ejd.137.2021.05.26.06.08.24; Wed, 26 May 2021 06:08:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232191AbhEZMVR (ORCPT + 99 others); Wed, 26 May 2021 08:21:17 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60932 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbhEZMVQ (ORCPT ); Wed, 26 May 2021 08:21:16 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 590581F42D14 Subject: Re: [PATCH] mfd: cros_ec_dev: Load lightbar module only present To: Gwendal Grignou , lee.jones@linaro.org, bleung@chromium.org, groeck@chromium.org, swboyd@chromium.org Cc: linux-kernel@vger.kernel.org References: <20210526034500.954219-1-gwendal@chromium.org> From: Enric Balletbo i Serra Message-ID: <0d113ad0-2f99-8f07-8e8a-86453a285fc8@collabora.com> Date: Wed, 26 May 2021 14:19:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210526034500.954219-1-gwendal@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gwendal, Thank you for your patch. On 26/5/21 5:45, Gwendal Grignou wrote: > The pixel lightbar is only present on chromebook pixel (link), pixel 2 > and pixel C. For the latter two, the EC reports its presence. > Instead of always loading the lightbar driver on all chromebook, only > load it when reported by the EC or Link device. > > Signed-off-by: Gwendal Grignou Acked-by: Enric Balletbo i Serra > --- > drivers/mfd/cros_ec_dev.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c > index d07b43d7c761a..a9700436e5e51 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 > @@ -112,10 +113,13 @@ static const struct cros_feature_to_cells cros_subdevices[] = { > static const struct mfd_cell cros_ec_platform_cells[] = { > { .name = "cros-ec-chardev", }, > { .name = "cros-ec-debugfs", }, > - { .name = "cros-ec-lightbar", }, > { .name = "cros-ec-sysfs", }, > }; > > +static const struct mfd_cell cros_ec_lightbar_cells[] = { > + { .name = "cros-ec-lightbar", } > +}; > + > static const struct mfd_cell cros_ec_vbc_cells[] = { > { .name = "cros-ec-vbc", } > }; > @@ -206,6 +210,20 @@ static int ec_device_probe(struct platform_device *pdev) > } > } > > + /* > + * Lightbar is a special case. Newer devices support autodetection, > + * but older ones do not. > + */ > + if (cros_ec_check_features(ec, EC_FEATURE_LIGHTBAR) || > + dmi_match(DMI_PRODUCT_NAME, "Link")) { > + retval = mfd_add_hotplug_devices(ec->dev, > + cros_ec_lightbar_cells, > + ARRAY_SIZE(cros_ec_lightbar_cells)); > + if (retval) > + dev_warn(ec->dev, "failed to add lightbar: %d\n", > + retval); > + } > + > /* > * The PD notifier driver cell is separate since it only needs to be > * explicitly added on platforms that don't have the PD notifier ACPI >