Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4922655pxj; Tue, 25 May 2021 21:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLPfuhBsBKDRZpmnFKa0tNvBXREfuMi8t2HFGW5LqXw3uSZBieSlN5TIThk8WudsVz2+jb X-Received: by 2002:a17:907:2bf4:: with SMTP id gv52mr31386356ejc.271.1622002689492; Tue, 25 May 2021 21:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622002689; cv=none; d=google.com; s=arc-20160816; b=UE7Ts1114c+rhEOAXqh2CYm0/dez+Nx8yq6L2QwSzBqDjPalRg7QtS2wdplntrt1Py dJ+EZtFhXxGlZuxIYKwHNpohkvf76Iniaw9JnbooOOTM8CMpQMrriIYfegtRL/VmpueC C1IEbME+dkGWfby5jxCYTeAmQ2O9FrY60AFceDJ2x/o8c3tjdcGbbrY9oelikXBs89qu aNG+iFYZeMetT310r7C6U6QOW3kYjLDXknaehas/RYi7IDPFTTH15shhTdAFrqkJiJiA MlezelQI+Gb9iqEc/aQuIElWRlEM/IziumVrjgWbNG89uDBzuw7Mq/M1fHoOUMzjMmAs KKsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=h4I/lmQLF7eC8YbAULo0vp9ivpmc3ogOd9LjXS/v39w=; b=XYOOK2BoE3zcKlH4Oc0ZoxwL/uIk4TeGfhWMEZV7lNibwMBiqCtu1LoEbackVKEN7d fUwFNbJhAuoHxbqj6DHA9P1SAymqnwrJ2XJf/wzIKPbbPjXu2T72Pk8Uik+963WS8WQV bT9WnmlSM+hQCmlKRzNDDQipuRLzBhEEviwB+Ep8BdDhI7kEolDFgd92lk2hBlmGAOyX IxRIyuSWF33CzJUGhpEGkesT2Ek306qGGt2SfFX/bSQijjxMZsM78V/YjHRAjtD5hLcg MtlSzhLiyYJ+wf8ut1pDchVzToi2NefNTkSFmpy00j5kEmDiS7RRaqFYPuX1O+tSXb4/ oURw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SzSx9r9H; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id js19si2827749ejc.73.2021.05.25.21.17.45; Tue, 25 May 2021 21:18:09 -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; dkim=pass header.i=@chromium.org header.s=google header.b=SzSx9r9H; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbhEZDqp (ORCPT + 99 others); Tue, 25 May 2021 23:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230313AbhEZDql (ORCPT ); Tue, 25 May 2021 23:46:41 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98139C061574 for ; Tue, 25 May 2021 20:45:09 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id e15so10818326plh.1 for ; Tue, 25 May 2021 20:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h4I/lmQLF7eC8YbAULo0vp9ivpmc3ogOd9LjXS/v39w=; b=SzSx9r9HU/jMj0DDp7j1fvpf9gRVLJgQtiIxEvauQmoGTi6R0+unIOdrY4NvuMUmxF 5Gqy+CAq+0r5pT2ZpkzwicCwEjbLswDdLHFF6eqrtsPbsiSOlPNo+oodm+kIvPIiqyWm Q/oK8qIV4ESWKWEilADDIGOuEMX66zubqCa3M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h4I/lmQLF7eC8YbAULo0vp9ivpmc3ogOd9LjXS/v39w=; b=SqvoBpyNfeIMAFmobXRPygAeogg7b3f1JAMgJtga1zo4DLxqrAIvOKc0KtaEUZ4I0Z XwU00Ip3IhNAOCPlC6UIO8ZEltE8RDAt+FpCaRu9/4qd8IrE/q5APXDcqZaz13eFK9zo KULFnlWvylU88xMW7VrQFrZSjALrQlPs15CpU/XlAv8xpCVh50AhED5qiBNKxAqdI/2K MgwNuVR/OOwo3z7xmLOcUkWZSiPrW2rTSIyP1Ylf9iyEgSKX+4V488qC39TMS4JHCCz2 8QriztRiJVBN+Ub73i0+FJ06xPI35G4tIIkzGCPDMOu4xvgcmD2J8oCSxAxZExnvTD7l Knqw== X-Gm-Message-State: AOAM530ALigNcd/vcquVGtCJnTAnMOKXFYngnlTt4Y/SR+ExXhaTWOMH PLfS/I2LBNI+vHb5Tg8jB/xJsmFm8Dl4dQ== X-Received: by 2002:a17:90a:7306:: with SMTP id m6mr1727889pjk.217.1622000709070; Tue, 25 May 2021 20:45:09 -0700 (PDT) Received: from localhost ([2620:15c:202:201:b7aa:6a6d:a1cc:d75c]) by smtp.gmail.com with UTF8SMTPSA id lp13sm3203909pjb.0.2021.05.25.20.45.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 May 2021 20:45:08 -0700 (PDT) From: Gwendal Grignou To: lee.jones@linaro.org, bleung@chromium.org, enric.balletbo@collabora.com, groeck@chromium.org, swboyd@chromium.org Cc: linux-kernel@vger.kernel.org, Gwendal Grignou Subject: [PATCH] mfd: cros_ec_dev: Load lightbar module only present Date: Tue, 25 May 2021 20:45:00 -0700 Message-Id: <20210526034500.954219-1-gwendal@chromium.org> X-Mailer: git-send-email 2.32.0.rc0.204.g9fa02ecfa5-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.32.0.rc0.204.g9fa02ecfa5-goog