Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3676016ybi; Sun, 2 Jun 2019 20:50:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqySEFq+y0y014eoou2lnc6JFfiGO1N8i5oAhRavvZMMbdhVOdwfeq/+9RrmJvYU/Uvzug8h X-Received: by 2002:a63:5d54:: with SMTP id o20mr24626152pgm.97.1559533823530; Sun, 02 Jun 2019 20:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559533823; cv=none; d=google.com; s=arc-20160816; b=kOwnunT1sR2ZyepS3J7DXabPS4RoP4sJflRqFE2QyA9nivsNpFvmFbTatahqDdY9YL CnJNtIbMkDGLffs/OV13H9IJDGTAVjy/s4RMnlwW0QtY7RMeKmXZpsonYspPPB2AYGOR 4zW2kGH5wGtMcRXRFjEvrUu3nUkO+5uYaYRsb3KmRdgpmyS8VPQhQ0V9RUuQVkqN3cZZ Y7G6r09xMiKkSdYtM8gYzTkOwCpnwzuMf8++9XbflLukR67RM2kuQy6p8OUIywiGpw/S R6BcV7DNiwAPbAV8vHvjDSUcfyRGpxhIfFqcw+znWdu+v6vPUDyMzHvtv/thUXb9yn71 r88w== 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=sylSLCQVSO44gThLUf89SvYA0i4320oG/Vj4A4WtxwI=; b=XMIW2fmKtN8MohWMMW33AEmp7w4K1/+9WbSo6Id8iJex2AlyfmmyJqWvxtaBc/oduk KJvPCuwWQSL2lOREwIVBb2sJQuzl+iIPPjesug5G2GNmRRwmMEG+ckPZ8m6uKpxVyqJ3 VcbjhJFVoVYISJvzcWKINWN7AOBSq53wS4rFZ/AxieGx0OR9P/iSd/bKY1HSTJEsXAfs lzOcOVoASOzW8j6nfeHLn97cHgXHOwDUdFL27h2QywxDoQMNjx0DcYWNdth6iOrWUThO BjTFZyhnaYMoFNqakqrkxOoHNcOu4n2oOs/oue4t9PiG+eTn8Ic77+DPeYjcMCSj6j5G N3Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chromium.org header.s=google header.b=LoVX3ACS; 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 a3si16964472pjv.64.2019.06.02.20.49.31; Sun, 02 Jun 2019 20:50:23 -0700 (PDT) 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=LoVX3ACS; 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 S1727051AbfFCDqe (ORCPT + 99 others); Sun, 2 Jun 2019 23:46:34 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46175 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbfFCDqa (ORCPT ); Sun, 2 Jun 2019 23:46:30 -0400 Received: by mail-pf1-f195.google.com with SMTP id y11so9737679pfm.13 for ; Sun, 02 Jun 2019 20:46:30 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=sylSLCQVSO44gThLUf89SvYA0i4320oG/Vj4A4WtxwI=; b=LoVX3ACS38bmDeiow/5CpIE2OnQgCBuPQOkKG8O+Av2gN5n979RBzCTMfsGwZhjam1 RoVaQih4KR0Wz6gjOBSeNarjh2FxfIRfSANfYDupC5t5KZIHcEsrL9C6qYZRMvzsOiDF gIPK8BsQsWqpranEo7EZrSBUpMew0/8Gap2nU= 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=sylSLCQVSO44gThLUf89SvYA0i4320oG/Vj4A4WtxwI=; b=QoYMmXbHR8TJBqPvWcdze6Dmho4APLDIDA30qeqFx4Szk4jmXTqSGyjsofTGTAADig t9t4CDOs093JL2U3dERcoF2VkWP/qimq06mxTPpwMguORgQwpf2jpTpzXdnGGJYTRWQU LRbV26+gWzeCaUvGSbjg4ZjUv+YG3kFqPAdhwB2C5C2YGOcdUnaZ0+tYht/yLeXyve4/ rch/Tgg5NE19G1q7cg6qi5NbqXp2XTlI3S/1Czpb1TZRCJezT7xsY2V86qMbJYhXBdQr iMOx945cCpw1OPI4OCcY5JgkoWSej1hhRoMWmxuQI2rrbp5pUnKx2KmnIkEYhAvS9esy X0RA== X-Gm-Message-State: APjAAAXe3MbDyqcmIsmwFqVh5YqlJKFvSe58YPnXQimkKESHT5KmMZ+D EUu0F9K+M2nb3uUEpYnBKV587g== X-Received: by 2002:a63:441c:: with SMTP id r28mr23392896pga.255.1559533589783; Sun, 02 Jun 2019 20:46:29 -0700 (PDT) Received: from pihsun-z840.tpe.corp.google.com ([2401:fa00:1:10:7889:7a43:f899:134c]) by smtp.googlemail.com with ESMTPSA id i73sm11878960pje.9.2019.06.02.20.46.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 20:46:29 -0700 (PDT) From: Pi-Hsun Shih Cc: Pi-Hsun Shih , Enric Balletbo i Serra , Lee Jones , Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v10 6/7] mfd: cros_ec: differentiate SCP from EC by feature bit. Date: Mon, 3 Jun 2019 11:45:11 +0800 Message-Id: <20190603034529.154969-7-pihsun@chromium.org> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190603034529.154969-1-pihsun@chromium.org> References: <20190603034529.154969-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 System Companion Processor (SCP) is Cortex M4 co-processor on some MediaTek platform that can run EC-style firmware. 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 Acked-by: Enric Balletbo i Serra --- Changes from v9: - Remove changes in cros_ec_commands.h (which is sync in https://lore.kernel.org/lkml/20190518063949.GY4319@dell/T/). Changes from v8: - No change. Changes from v7: - Address comments in v7. - Rebase the series onto https://lore.kernel.org/patchwork/patch/1059196/. Changes from v6, v5, v4, v3, v2: - No change. Changes from v1: - New patch extracted from Patch 5. --- drivers/mfd/cros_ec_dev.c | 10 ++++++++++ include/linux/mfd/cros_ec.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index a5391f96eafd..66107de3dbce 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -440,6 +440,16 @@ static int ec_device_probe(struct platform_device *pdev) ec_platform->ec_name = CROS_EC_DEV_TP_NAME; } + /* Check whether this is actually a SCP rather than an EC. */ + if (cros_ec_check_features(ec, EC_FEATURE_SCP)) { + dev_info(dev, "CrOS SCP MCU 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 cfa78bb4990f..751cb3756d49 100644 --- a/include/linux/mfd/cros_ec.h +++ b/include/linux/mfd/cros_ec.h @@ -27,6 +27,7 @@ #define CROS_EC_DEV_PD_NAME "cros_pd" #define CROS_EC_DEV_TP_NAME "cros_tp" #define CROS_EC_DEV_ISH_NAME "cros_ish" +#define CROS_EC_DEV_SCP_NAME "cros_scp" /* * The EC is unresponsive for a time after a reboot command. Add a -- 2.22.0.rc1.257.g3120a18244-goog