Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp269552imp; Thu, 21 Feb 2019 00:50:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IbvN/CJDuMZfYGXaIAuQtJenE34DHSWYAbaASy/xmp0Tg17YCAylywfnU7OqluNysL1T3/5 X-Received: by 2002:a63:f5f:: with SMTP id 31mr32899119pgp.186.1550739017113; Thu, 21 Feb 2019 00:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550739017; cv=none; d=google.com; s=arc-20160816; b=JvXZSvg4bHZAG5qpE+rFKQ4sjpTm8K5AK1wtlg4F0ea5isp0Tr9r+zR5unJjj0Ccni ZlBZmpOlVHQMkHZm3ZpP5/aQn1zWvN+Ugq6U4adqkPx3hY7/b64dVwdiLbOiYxzM+E0A NAsR3bOMRy0cDleB8/dXdImK2DFMbh8EWsQb4jaWLzE7veYocs7gmRMbAZSus+v1+S6I qt4qe/OQRt+Ft+tEW94eYZHSix5spVp3T6eR2RLWJhD8S0jI8Jxf9FsyPhUOzvQZhDeb 5DBw/nVQ8yCipBt4IoV0D+0yE6EzkjKO+WlC5inpd7iJWwpBOTkRj71bvvAOaLsUDt6n BzCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=5kyP+RDjUaCs6JazO4rZ6jGdzsafANy/ynWxrK/hLmE=; b=SEKP5QlQbWzSEi4uSY6oqEcLutMMdt76qbWulhQEmXp15MV2Sa2PsaebaT7fb+F1mt E7tYb8BeNdZ/riK0qDh5rtDEB+UV6eBAMLbFPjkTcA/UGv0q8CkAaPxfHZxoYbOFWRJQ mSSQs6bgwaOUgy/wZ3UVhmGTUFrUJe6NFoW6dWRWHwqIuQM8V3d2lfpXV/ODyAT3vOnF kOcQrI9dgnvlY3ZYlXL2/HHUl9h/t6yoLV2wcBZybmYzL55UO8T4It8JIkgeJJg2qq1M DqQltjpJQvrc2d7zsa+CQoxTTXMJzxdProMf/AGT78SFoXL2nu9d7hMzoj6I1y9XZFQC eG0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chromium.org header.s=google header.b="m/NQnAZj"; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j127si15950312pgc.444.2019.02.21.00.50.02; Thu, 21 Feb 2019 00:50:17 -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; dkim=fail header.i=@chromium.org header.s=google header.b="m/NQnAZj"; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727550AbfBUItG (ORCPT + 99 others); Thu, 21 Feb 2019 03:49:06 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38215 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbfBUItE (ORCPT ); Thu, 21 Feb 2019 03:49:04 -0500 Received: by mail-pl1-f195.google.com with SMTP id e5so13823545plb.5 for ; Thu, 21 Feb 2019 00:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5kyP+RDjUaCs6JazO4rZ6jGdzsafANy/ynWxrK/hLmE=; b=m/NQnAZjTvl/nw74qS5P4EpeP/e6WuvOGpT1PqqdE9X6USwrUX1XNwK/aO0aJRwcBK lIS73Ur2lMol9MIZi/1z8Mfn6XIHB0aq0pe1inh+7YMzBLWHdugKo9Zsa2imklCU5rWi cnaW2Jr1XuzlMEjrf9OaSJ2LniwRIJbq5Qc6M= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5kyP+RDjUaCs6JazO4rZ6jGdzsafANy/ynWxrK/hLmE=; b=i/P2R5r4JLMyKJr8dgGBQjRofAjxDv27xbG35+kl0hx8WA2cA385kAaH7H8ZXk9N5R K6MWQMISnJvN+kMj94Pvkp41jjYERihfk/ZOo9sedo0koSmGH96i2mAZoJVpUlR5K5fg XQNSgFltVlZ7u6itOENsMkqPo5OnkX+gIz1K0GiY990yTGbyefTTRXly5YZpJuesOAO3 PWI8nUNBL1VY5+CPsNift2oD52xftETDcMLZ0VFuXhIEcexnjFhPWjvE9tZ3b4DpjaFb 19Mpej74X1eLukiZEunYZtSJa6jzbNumB5/VUVucrrqiyKtPWPZWkeF20S2zAxJbdZ/p eblw== X-Gm-Message-State: AHQUAubapdf11IvkOhwu+dn3fKoZ4TuHFrp2LAYX/+jG/X+BsefxfH3I Chm4sQrok1UPuzE95uq4MSkLdQ== X-Received: by 2002:a17:902:8348:: with SMTP id z8mr19879028pln.151.1550738943682; Thu, 21 Feb 2019 00:49:03 -0800 (PST) Received: from pihsun-z840.tpe.corp.google.com ([2401:fa00:1:10:7889:7a43:f899:134c]) by smtp.googlemail.com with ESMTPSA id b4sm23154027pgq.57.2019.02.21.00.49.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 00:49:03 -0800 (PST) From: Pi-Hsun Shih Cc: Pi-Hsun Shih , Lee Jones , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 6/6] cros_ec: differentiate SCP from EC by feature bit. Date: Thu, 21 Feb 2019 16:47:29 +0800 Message-Id: <20190221084729.101784-7-pihsun@chromium.org> X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog In-Reply-To: <20190221084729.101784-1-pihsun@chromium.org> References: <20190221084729.101784-1-pihsun@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since a SCP and EC would both exist on a system, and use the cros_ec_dev driver, we need to differentiate between them for the userspace, or they would both be registered at /dev/cros_ec, causing a conflict. Signed-off-by: Pi-Hsun Shih --- Changes from v4: - No change. Changes from v3: - No change. Changes from v2: - No change. Changes from v1: - New patch extracted from Patch 5. --- drivers/mfd/cros_ec_dev.c | 9 +++++++++ include/linux/mfd/cros_ec.h | 1 + include/linux/mfd/cros_ec_commands.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index d275deaecb1254..7fb81b11791f55 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -418,6 +418,15 @@ static int ec_device_probe(struct platform_device *pdev) device_initialize(&ec->class_dev); cdev_init(&ec->cdev, &fops); + if (cros_ec_check_features(ec, EC_FEATURE_SCP)) { + dev_info(dev, "SCP detected.\n"); + /* + * Help userspace differentiating ECs from SCP, + * regardless of the probing order. + */ + ec_platform->ec_name = CROS_EC_DEV_SCP_NAME; + } + /* * Add the class device * Link to the character device for creating the /dev entry diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h index 8f2a8918bfa33c..a971399bad82ee 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -24,6 +24,7 @@ #define CROS_EC_DEV_NAME "cros_ec" #define CROS_EC_DEV_PD_NAME "cros_pd" +#define CROS_EC_DEV_SCP_NAME "cros_scp" /* * The EC is unresponsive for a time after a reboot command. Add a diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index fc91082d4c357b..3e5da6e93b2f42 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -856,6 +856,8 @@ enum ec_feature_code { EC_FEATURE_RTC = 27, /* EC supports CEC commands */ EC_FEATURE_CEC = 35, + /* The MCU exposes a SCP */ + EC_FEATURE_SCP = 39, }; #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) -- 2.21.0.rc0.258.g878e2cd30e-goog