From patchwork Wed Dec 18 11:17:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181988 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp504550ile; Wed, 18 Dec 2019 03:18:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxwdgVI3TYPGwS2G+tZ6mJV7RHWPxZzVHs7XT3rPhZvLiynMQG1krhBtzUTdRfjqXVOL+MD X-Received: by 2002:a05:6808:a8a:: with SMTP id q10mr156023oij.66.1576667911814; Wed, 18 Dec 2019 03:18:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667911; cv=none; d=google.com; s=arc-20160816; b=k3OC71VaBskk+HArZfdmQ50asB2Exb1SnzZwkBzUS3qqoBJN/OSnieBrNd224ojFH6 YmdCo7xteR1Mfd8YR1CcIfaaqxSnR678mg6hlR8VzyVvYb8WgL4BvK53jstUMZJlpe7A 0MuOKI8Ood1hOFLQAuCH8Qn4J32sZEgNri/jtpSYjOnm/ZSetCM/q+ohw+VJAEHLo7HM b5EXiGqfM0208wYpirAZZhjZX+Pbo8Per5RUlgTqeEp40HsExlMa71B251x31Pg4HVyI SAkzEbysFoi9wWCd84W/hpH1XHOLkEVyH4ZDtP8GXD6LdwLbaCrc4lwdcnyKBEeuQNWI zuVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=G4itvC0cx9F7DWMiR0ULeRPFYjJ3uwzuI5hlidScpDE=; b=NFHNtHqkcwaPp5vs52T3/wj89/2niigWigysoUZ90PDbXJpZxMYTr4HUviQTmXT82S +v+M3W4Vv/NISsiD2sQi9D9n9fRASfmIVumgOinXDcoJ+KXmajQoCJ8z1BDiZmEpMfEE U5Pa5UsnNllgbMXmfFHUGBDT0DeURMvs2eZnSGy8Aqgg6OYOzTjaYywTQYlTrK+j1834 HiwGvKnNke7nEolM6AUR98cuFeR78OS9q6/gmOyOCFe7Oyb1qD0VoWRQKzotVc6pSzUS zjCMfM6eMfLWGoxcbgiu86btYz0G63tP2LqD74AMHm0lELPrs1FnNHI/DZQV5jvw11Gf d1KQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si1194079oix.100.2019.12.18.03.18.31; Wed, 18 Dec 2019 03:18:31 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727070AbfLRLS0 (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:26 -0500 Received: from foss.arm.com ([217.140.110.172]:42342 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725930AbfLRLRv (ORCPT ); Wed, 18 Dec 2019 06:17:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 826A731B; Wed, 18 Dec 2019 03:17:48 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D3A443F6CF; Wed, 18 Dec 2019 03:17:47 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 01/11] firmware: arm_scmi: Add support for multiple device per protocol Date: Wed, 18 Dec 2019 11:17:32 +0000 Message-Id: <20191218111742.29731-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently only one scmi device is created for each protocol enumerated. However, there is requirement to make use of some procotols by multiple kernel subsystems/frameworks. One such example is SCMI PERFORMANCE protocol which can be used by both cpufreq and devfreq drivers. Similarly, SENSOR protocol may be used by hwmon and iio subsystems, and POWER protocol may be used by genpd and regulator drivers. In order to achieve that, let us extend the scmi bus to match based not only protocol id but also the scmi device name if one is available. Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/bus.c | 20 +++++++++++++++++--- drivers/firmware/arm_scmi/driver.c | 6 +++--- include/linux/scmi_protocol.h | 5 ++++- 3 files changed, 24 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 7a30952b463d..3714e6307b05 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -28,8 +28,12 @@ scmi_dev_match_id(struct scmi_device *scmi_dev, struct scmi_driver *scmi_drv) return NULL; for (; id->protocol_id; id++) - if (id->protocol_id == scmi_dev->protocol_id) - return id; + if (id->protocol_id == scmi_dev->protocol_id) { + if (!id->name) + return id; + else if (!strcmp(id->name, scmi_dev->name)) + return id; + } return NULL; } @@ -125,7 +129,8 @@ static void scmi_device_release(struct device *dev) } struct scmi_device * -scmi_device_create(struct device_node *np, struct device *parent, int protocol) +scmi_device_create(struct device_node *np, struct device *parent, int protocol, + const char *name) { int id, retval; struct scmi_device *scmi_dev; @@ -134,8 +139,15 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol) if (!scmi_dev) return NULL; + scmi_dev->name = kstrdup_const(name ?: "unknown", GFP_KERNEL); + if (!scmi_dev->name) { + kfree(scmi_dev); + return NULL; + } + id = ida_simple_get(&scmi_bus_id, 1, 0, GFP_KERNEL); if (id < 0) { + kfree_const(scmi_dev->name); kfree(scmi_dev); return NULL; } @@ -154,6 +166,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol) return scmi_dev; put_dev: + kfree_const(scmi_dev->name); put_device(&scmi_dev->dev); ida_simple_remove(&scmi_bus_id, id); return NULL; @@ -161,6 +174,7 @@ scmi_device_create(struct device_node *np, struct device *parent, int protocol) void scmi_device_destroy(struct scmi_device *scmi_dev) { + kfree_const(scmi_dev->name); scmi_handle_put(scmi_dev->handle); ida_simple_remove(&scmi_bus_id, scmi_dev->id); device_unregister(&scmi_dev->dev); diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 3eb0382491ce..dee7ce3bd815 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -803,11 +803,11 @@ scmi_mbox_txrx_setup(struct scmi_info *info, struct device *dev, int prot_id) static inline void scmi_create_protocol_device(struct device_node *np, struct scmi_info *info, - int prot_id) + int prot_id, const char *name) { struct scmi_device *sdev; - sdev = scmi_device_create(np, info->dev, prot_id); + sdev = scmi_device_create(np, info->dev, prot_id, name); if (!sdev) { dev_err(info->dev, "failed to create %d protocol device\n", prot_id); @@ -892,7 +892,7 @@ static int scmi_probe(struct platform_device *pdev) continue; } - scmi_create_protocol_device(child, info, prot_id); + scmi_create_protocol_device(child, info, prot_id, NULL); } return 0; diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 881fea47c83d..5c873a59b387 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -257,6 +257,7 @@ enum scmi_std_protocol { struct scmi_device { u32 id; u8 protocol_id; + const char *name; struct device dev; struct scmi_handle *handle; }; @@ -264,11 +265,13 @@ struct scmi_device { #define to_scmi_dev(d) container_of(d, struct scmi_device, dev) struct scmi_device * -scmi_device_create(struct device_node *np, struct device *parent, int protocol); +scmi_device_create(struct device_node *np, struct device *parent, int protocol, + const char *name); void scmi_device_destroy(struct scmi_device *scmi_dev); struct scmi_device_id { u8 protocol_id; + const char *name; }; struct scmi_driver { From patchwork Wed Dec 18 11:17:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181978 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp503806ile; Wed, 18 Dec 2019 03:17:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwkqWn4JcDLCxRC0T3D7CGrxHns9KgaEYNaakADZWgxLLWIIFtfNofId9ZCjzgN6Shuz5HW X-Received: by 2002:a9d:7593:: with SMTP id s19mr1898652otk.219.1576667873408; Wed, 18 Dec 2019 03:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667873; cv=none; d=google.com; s=arc-20160816; b=tdNqLsSa1DxI3yAh7uVXYCllVo86fvJuiCxfFaQEt4CEYhiGtmbJS45JPYUOcuDZRj I7lRwcS/MD82Dn1oPgt15c7LDIKaSFzymtdXdMC6Z72WWsPSzt2gMHeN7ZLBesZ/eV7z bTvhafLngZNSTJgi+Rd6DtOgOQxmfwpnhcM5d6unaGvvl0FSLSi5J7/FnzBYRPJCQ76O 9wGqMDp7oeSI7UA1DtpEi/N4UL4xMaQm50Qpnvhw/33NTrDuCvzdkKSoNx9D+HvQFgrL 4uF5VULDzL222wmIuY6E1NknVmyCTzV1LaGIopZuWCRcOwdG6wSYSoY3bwFAuHHEcio+ VpjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=LKkUV1u920pJWNl5R7HSy02LkfSrnnHp6Q7QOLL4MPY=; b=SAOGfKu6DDZ8y5XfQd5FyBD+iGcBTo+rP7t2gHbv7O75aIJVSpM4G0byoPjMdBIFFt 622zahEggasAq+Nv1v6/J5asaFdmZpwX5/Z452tre4UC9B0ifDFhT67qJi2tGuuzijyT 9u2Nt/NBda0ddBybFqdasUExvw5sy2N5e/X6l0zluOZ/WkCFEwgvkQF3pQnTCa2QMof+ 3pdzLvR06jLPHsg+rGLGhgb3dQDZCEn3Fuh3zx4myxqS0cdgxGAxzmg5NJDF5yyLyHTp Qjb8rlgzPXL9fATd8oFT9Q1V15VOaG9pZ3ae8CbaFkJkL0TQxyIXiWfigb6k/1tuPPed cyWg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si1101679otj.239.2019.12.18.03.17.53; Wed, 18 Dec 2019 03:17:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726799AbfLRLRv (ORCPT + 27 others); Wed, 18 Dec 2019 06:17:51 -0500 Received: from foss.arm.com ([217.140.110.172]:42348 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbfLRLRu (ORCPT ); Wed, 18 Dec 2019 06:17:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6E4CB113E; Wed, 18 Dec 2019 03:17:49 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B606B3F6CF; Wed, 18 Dec 2019 03:17:48 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 02/11] firmware: arm_scmi: Skip scmi mbox channel setup for addtional devices Date: Wed, 18 Dec 2019 11:17:33 +0000 Message-Id: <20191218111742.29731-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the scmi bus supports adding multiple devices per protocol, and since scmi_create_protocol_device calls scmi_mbox_chan_setup, we must avoid allocating and initialising the mbox channel if it is already initialised. Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index dee7ce3bd815..2952fcd8dd8a 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -735,6 +735,11 @@ static int scmi_mbox_chan_setup(struct scmi_info *info, struct device *dev, idx = tx ? 0 : 1; idr = tx ? &info->tx_idr : &info->rx_idr; + /* check if already allocated, used for multiple device per protocol */ + cinfo = idr_find(idr, prot_id); + if (cinfo) + return 0; + if (scmi_mailbox_check(np, idx)) { cinfo = idr_find(idr, SCMI_PROTOCOL_BASE); if (unlikely(!cinfo)) /* Possible only if platform has no Rx */ From patchwork Wed Dec 18 11:17:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181987 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp504487ile; Wed, 18 Dec 2019 03:18:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxMqUCEDJiXn8y/qEZwziK0iq5fGmUIN0rCYXDSIFihEp9wKACR4tE1RZtcJJeLCou08QyG X-Received: by 2002:a05:6808:2c9:: with SMTP id a9mr172752oid.129.1576667908656; Wed, 18 Dec 2019 03:18:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667908; cv=none; d=google.com; s=arc-20160816; b=CwdrmYbz0nXfP4bQ4NKWVDY2mMUnkBNGYE+5Q+zrZ8oLcElXaiwg+TXQKEQVFUoWXr NS0PQ5wDxljuiMC8di9OmgfYF2NX1xEIlUMNtQw1DJL7QvUGj5EbcGah5MfGJkHaRAPy /l2cFGXcrdT8wCrA2vV2r1H5hxCWEqHuaSPrjMvsH3lkOWye5K8u2N0/rIZEH3jzJu5P qxJgNyRr3NDfh5Ltl3dOOt1mf2DQGWXVwSVN9UkalMY0Vj5tcC5woZH2HwWhVj9j7Z41 H2/kMAAT6MLYjtyb9nj06g+GBbh2tKDsJHIrGRa91x1FYrRT2opVUT8D0BYsVFmnS8Qu p83Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=oApDTxa0deKro9ziSvs1JV35m3rL5OChZ7VPVDFS5Gs=; b=DYVCylIySoRwXQlJKpUXG4CiiA5LupJAkUMtQpJsVujN7x3hi2EEznYv1/Y4yXDsvR cCZNgD+1VaDmrM4yC+cDHHZoxPzu3W2qRMwh/l9yKPrklHn/DploERyWObnPaAwfINWJ fzeXG0bG+LbWbpBJxEQImATPTNWtizxhjkpaFu3CA1EqtsArLdNSzMVuCmmsKIJTs4GC JUIeTm5p8fUVYvm2LpRRgqPkUm+IwsyMA06KCeTnflv8VYYfi30Yc6bi5bD8aQz2507T WN71cpBJYCyNyEPMm4tsMM04IlK04tJ5kJMRUSl5oWhiKydA3fIYa+r+2PwHqRGbktKX CecA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a205si1225154oii.95.2019.12.18.03.18.28; Wed, 18 Dec 2019 03:18:28 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbfLRLS1 (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:27 -0500 Received: from foss.arm.com ([217.140.110.172]:42356 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbfLRLRv (ORCPT ); Wed, 18 Dec 2019 06:17:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 50A6E11B3; Wed, 18 Dec 2019 03:17:50 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A1DF33F6CF; Wed, 18 Dec 2019 03:17:49 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 03/11] firmware: arm_scmi: Add names to scmi devices created Date: Wed, 18 Dec 2019 11:17:34 +0000 Message-Id: <20191218111742.29731-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that scmi bus provides option to create named scmi device, let us create the default devices with names. This will help to add names for matching to respective drivers and eventually to add multiple devices and drivers per protocol. Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 36 +++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 2952fcd8dd8a..0bbdc7c9eb0f 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -829,6 +829,40 @@ scmi_create_protocol_device(struct device_node *np, struct scmi_info *info, scmi_set_handle(sdev); } +#define MAX_SCMI_DEV_PER_PROTOCOL 2 +struct scmi_prot_devnames { + int protocol_id; + char *names[MAX_SCMI_DEV_PER_PROTOCOL]; +}; + +static struct scmi_prot_devnames devnames[] = { + { SCMI_PROTOCOL_POWER, { "genpd" },}, + { SCMI_PROTOCOL_PERF, { "cpufreq" },}, + { SCMI_PROTOCOL_CLOCK, { "clocks" },}, + { SCMI_PROTOCOL_SENSOR, { "hwmon" },}, + { SCMI_PROTOCOL_RESET, { "reset" },}, +}; + +static inline void +scmi_create_protocol_devices(struct device_node *np, struct scmi_info *info, + int prot_id) +{ + int loop, cnt; + + for (loop = 0; loop < ARRAY_SIZE(devnames); loop++) { + if (devnames[loop].protocol_id != prot_id) + continue; + + for (cnt = 0; cnt < ARRAY_SIZE(devnames[loop].names); cnt++) { + const char *name = devnames[loop].names[cnt]; + + if (name) + scmi_create_protocol_device(np, info, prot_id, + name); + } + } +} + static int scmi_probe(struct platform_device *pdev) { int ret; @@ -897,7 +931,7 @@ static int scmi_probe(struct platform_device *pdev) continue; } - scmi_create_protocol_device(child, info, prot_id, NULL); + scmi_create_protocol_devices(child, info, prot_id); } return 0; From patchwork Wed Dec 18 11:17:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181979 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp503833ile; Wed, 18 Dec 2019 03:17:54 -0800 (PST) X-Google-Smtp-Source: APXvYqxtotXCo3anArRzcFQGzrQhqLmBrwHW2JbGAfxsNEn3d+VT2X6wwTDFE4ekVFapp7aQsY2F X-Received: by 2002:a05:6830:109a:: with SMTP id y26mr1927148oto.227.1576667874714; Wed, 18 Dec 2019 03:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667874; cv=none; d=google.com; s=arc-20160816; b=TX61mzVfGS5/lPi0ahuW7dOMNL1QCTeilZd6QtvVM14FR9QdiJBLgFTXZb8mMTeA71 sg5hdYjkkn/rfHqeyNKH0wmlCHIFzMDD/SCuaE2UL5xkBaHTm44KXo9zgkRLXynuhS0A y9IPprtatu70O9h3Ox6YFFtP6eYVs9WxUdXPch9hw4fN/mClNDNUtZf6j4zr7YfRjjbo xCaT/VnpHvzASKqtZASgEhNAAV+CqVwzFD+Tn/mSAmYyEE6kUuB1b09l62Eb020oXPEe F0Q7F99fxLR4iPYXzVd94P9WBJuCb0NP6DpYuY7VZ9J68zzsRA0VraWbX5i1q9mdehb4 XqtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=eeFX//xhocunBOo2isqUer3x7gJOvlao2xl5WVoPFRI=; b=PRgIrwdPCceXH8p49WCMTOVLbGqTzfzapjNm1Rpx9qoAeEIexiPQo85Uu/4q8wtT+r QOXIMSRUEFY0VVpQq+F6tZVowyRfWQOZzGYLpW0zuLkboeyZiipmLv6Y+fyPnnszCtOn 2Vbz3yzeLAV8d/NpMHbRzbYpLZLHh5x87yku/VwdDkcgbZg8vhWNIPHJOFx+emeMz5Kh +Gr3o8MAPci6nmZM+nZ0wz7wLx6wnkgMKNMgOAn8zj7MqKVhKWycpollI90cJlO11UDa m6UtVSiBVjgvYYBd8JXYgtXoiwhCFHT/wg6Lu1nE0nzr4NcnDPh4oni8VhQGieS3Psy5 VIfA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si1101679otj.239.2019.12.18.03.17.54; Wed, 18 Dec 2019 03:17:54 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726861AbfLRLRx (ORCPT + 27 others); Wed, 18 Dec 2019 06:17:53 -0500 Received: from foss.arm.com ([217.140.110.172]:42362 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbfLRLRv (ORCPT ); Wed, 18 Dec 2019 06:17:51 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 349A030E; Wed, 18 Dec 2019 03:17:51 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 85D8B3F6CF; Wed, 18 Dec 2019 03:17:50 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 04/11] firmware: arm_scmi: Add versions and identifier attributes using dev_groups Date: Wed, 18 Dec 2019 11:17:35 +0000 Message-Id: <20191218111742.29731-5-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Platform drivers now have the option to have the platform core create and remove any needed sysfs attribute files. Using the same, let's add the scmi firmware and protocol version attributes as well as vendor and sub-vendor identifiers to sysfs. It helps to identify the firmware details from the sysfs entries similar to ARM SCPI implementation. Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 0bbdc7c9eb0f..26b2c438bd59 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -979,6 +979,52 @@ static int scmi_remove(struct platform_device *pdev) return ret; } +static ssize_t protocol_version_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scmi_info *info = dev_get_drvdata(dev); + + return sprintf(buf, "%u.%u\n", info->version.major_ver, + info->version.minor_ver); +} +static DEVICE_ATTR_RO(protocol_version); + +static ssize_t firmware_version_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scmi_info *info = dev_get_drvdata(dev); + + return sprintf(buf, "0x%x\n", info->version.impl_ver); +} +static DEVICE_ATTR_RO(firmware_version); + +static ssize_t vendor_id_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scmi_info *info = dev_get_drvdata(dev); + + return sprintf(buf, "%s\n", info->version.vendor_id); +} +static DEVICE_ATTR_RO(vendor_id); + +static ssize_t sub_vendor_id_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scmi_info *info = dev_get_drvdata(dev); + + return sprintf(buf, "%s\n", info->version.sub_vendor_id); +} +static DEVICE_ATTR_RO(sub_vendor_id); + +static struct attribute *versions_attrs[] = { + &dev_attr_firmware_version.attr, + &dev_attr_protocol_version.attr, + &dev_attr_vendor_id.attr, + &dev_attr_sub_vendor_id.attr, + NULL, +}; +ATTRIBUTE_GROUPS(versions); + static const struct scmi_desc scmi_generic_desc = { .max_rx_timeout_ms = 30, /* We may increase this if required */ .max_msg = 20, /* Limited by MBOX_TX_QUEUE_LEN */ @@ -997,6 +1043,7 @@ static struct platform_driver scmi_driver = { .driver = { .name = "arm-scmi", .of_match_table = scmi_of_match, + .dev_groups = versions_groups, }, .probe = scmi_probe, .remove = scmi_remove, From patchwork Wed Dec 18 11:17:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181980 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp503885ile; Wed, 18 Dec 2019 03:17:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxK1gjSVNAbh9ybutjLXSUystCMg5ZyhsnL7HGoWRHexOhv8mzdbnrnjHHJJJ5j2zWBPNQf X-Received: by 2002:a9d:7593:: with SMTP id s19mr1898882otk.219.1576667876874; Wed, 18 Dec 2019 03:17:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667876; cv=none; d=google.com; s=arc-20160816; b=0sEYZdxOKDJplcoHmPlne46ULlV0addJJXdjt1gxGFJteinn0jJnrILx4tKexNQqRa 4pwS3d7XL3ZNjZUuCWqV849cW0+DyoIA3Dp1+LzYEsrLjCB8JuGlbBS01yBenJWLO5Qy p6dB8lqiHQL0li2amwo80eskddV8C4TyehfGZTEl4Q7INeceiEf5gQWGto7Itz7gAhZM G3DeqdFLfqa4bGhw1tM4v1lHbm15uuYsm1En2jVxrIPbWkwGQl0kgiLl3UrFKq6Q2gGe l3b5R1rvFfH29CRRYy4HzRnIdACLmHoirhNj/53YFltEsocSPW6bQaRmWi3x4vlP2YPe CfVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=oP67VZjNRk5fNE5BnU/NJMizKp+k5BkrTEAf98YIfsc=; b=BWNCJcWf6eGi0kRquPv01615dPTx6UM0lhjNhXUsZtPglbnudU6QtQk27wirNYAR0y 2fkqZHzEAvDcw7MXsVIufdQL9vAcH5SBAxS16P2ZPyvVP3TMuJCa+KJ4nWU0eXrE1ofs HYX8Lhno9PcgvjGM3h3J2a2OVmijm1E39weGGOBZEv1aIab4Z1ewtQWnPNNIwiVIvWjw E1jnhrH2nue7CPyokunUwWEnu5/edACeHYRzav+PGvB6sJyqyeicMF6Yp4UUbNOkUXNG nLiO7j3ONskOmDBdEjzhFz1oy6ah/8EkO8xaV2Mzxq/UIa94e0t5ZZPHiAG16PaUQtKh sjeg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si1219000otk.304.2019.12.18.03.17.56; Wed, 18 Dec 2019 03:17:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbfLRLRz (ORCPT + 27 others); Wed, 18 Dec 2019 06:17:55 -0500 Received: from foss.arm.com ([217.140.110.172]:42366 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726830AbfLRLRw (ORCPT ); Wed, 18 Dec 2019 06:17:52 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2036D31B; Wed, 18 Dec 2019 03:17:52 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6826D3F6CF; Wed, 18 Dec 2019 03:17:51 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 05/11] firmware: arm_scmi: Match scmi device by both name and protocol id Date: Wed, 18 Dec 2019 11:17:36 +0000 Message-Id: <20191218111742.29731-6-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scmi bus now has support to match the driver with devices not only based on their protocol id but also based on their device name if one is available. This was added to cater the need to support multiple devices and drivers for the same protocol. Let us add the name "genpd" to scmi_device_id table in the driver so that in matches only with device with the same name and protocol id SCMI_PROTOCOL_POWER. Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/scmi_pm_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c index 87f737e01473..bafbfe358f97 100644 --- a/drivers/firmware/arm_scmi/scmi_pm_domain.c +++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c @@ -112,7 +112,7 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) } static const struct scmi_device_id scmi_id_table[] = { - { SCMI_PROTOCOL_POWER }, + { SCMI_PROTOCOL_POWER, "genpd" }, { }, }; MODULE_DEVICE_TABLE(scmi, scmi_id_table); From patchwork Wed Dec 18 11:17:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181986 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp504406ile; Wed, 18 Dec 2019 03:18:23 -0800 (PST) X-Google-Smtp-Source: APXvYqzmCoqeUD2Cud02VzYtaa+ra4oZiLpw/tp+DeByeYRnrFAUcuRfIxppTJV+kwcJOTzb5qk6 X-Received: by 2002:a54:468b:: with SMTP id k11mr152382oic.134.1576667903226; Wed, 18 Dec 2019 03:18:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667903; cv=none; d=google.com; s=arc-20160816; b=P+CF9FIRKJliddQXAKHA7PJ5L6xeiECmlJq5SRT8QyMuyIZRiNgb38ROy9e2ZFkd+5 muzJO01+3oTegc5eDfZ9/mZqpGHz29kEMfXokAkHON4/+wCHlkvfUrxjSW0Y8KOkEDSH aNBlmvDd3N97r2LeLfxJQnFHnferQqyHNVhLPAL8rjEMlVoW34IfidtDujYo2u3PU8LI S4pHuK11hRhGD4fO5YKt14kreJW6iLenampQ7L9ZTryeGsBJ5UhNLoYfai/8Fp8q+iyX 4QgIw6zhGQAPcL+Zjx3GFc+d1w+xORmxsnFvLF/2DhOw3n0nfm6tosO7oC52aB6w7oeg plwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=9NKwlhnnUW+PKWErTmQN1TKrlOcG6Y1jSpwC1CIgHb4=; b=Hwk9BbpItpHUwo5YHbhMtkr1F0dLCDDZyCDhItc8ymbjnJMx/EeHLWRTpii6o9q4SU aI7SI6EqMlJtNnI45AcwNQ61qwPpfvEUlNr8LzaW/y729cnPAr9ppDiDw8d+6LFtJk2N jPa501hjXs0/CB4Gg6grADnQVYNwTOxdLYH52YOgW8SphFhhxFGs2aPFz6xpeiryrMMk /JkUzWWP86ZdSQdNdXzNVGNxMFqCu/AqSUmmculZRsaZNqaTRDirDNGnTBVSvFFzCO0B HJuEYpyh48lBJ3u4xkJ6SRP0GT6yX2hipFRWKnOaK3SC/FufMXbP23InkHDwwLygHcUf HfTQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a205si1225154oii.95.2019.12.18.03.18.22; Wed, 18 Dec 2019 03:18:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbfLRLSS (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:18 -0500 Received: from foss.arm.com ([217.140.110.172]:42374 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfLRLRx (ORCPT ); Wed, 18 Dec 2019 06:17:53 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 02AEC113E; Wed, 18 Dec 2019 03:17:53 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 53BBC3F6CF; Wed, 18 Dec 2019 03:17:52 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 06/11] firmware: arm_scmi: Stash version in protocol init functions Date: Wed, 18 Dec 2019 11:17:37 +0000 Message-Id: <20191218111742.29731-7-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to avoid querying the individual protocol versions multiple time with more that one device created for each protocol, we can simple store the copy in the protocol specific private data and use them whenever required. Reviewed-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/clock.c | 2 ++ drivers/firmware/arm_scmi/perf.c | 2 ++ drivers/firmware/arm_scmi/power.c | 2 ++ drivers/firmware/arm_scmi/reset.c | 2 ++ drivers/firmware/arm_scmi/sensors.c | 2 ++ 5 files changed, 10 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 32526a793f3a..4c2227662b26 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -65,6 +65,7 @@ struct scmi_clock_set_rate { }; struct clock_info { + u32 version; int num_clocks; int max_async_req; atomic_t cur_async_req; @@ -340,6 +341,7 @@ static int scmi_clock_protocol_init(struct scmi_handle *handle) scmi_clock_describe_rates_get(handle, clkid, clk); } + cinfo->version = version; handle->clk_ops = &clk_ops; handle->clk_priv = cinfo; diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 601af4edad5e..ec81e6f7e7a4 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -145,6 +145,7 @@ struct perf_dom_info { }; struct scmi_perf_info { + u32 version; int num_domains; bool power_scale_mw; u64 stats_addr; @@ -736,6 +737,7 @@ static int scmi_perf_protocol_init(struct scmi_handle *handle) scmi_perf_domain_init_fc(handle, domain, &dom->fc_info); } + pinfo->version = version; handle->perf_ops = &perf_ops; handle->perf_priv = pinfo; diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 5abef7079c0a..214886ce84f1 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -50,6 +50,7 @@ struct power_dom_info { }; struct scmi_power_info { + u32 version; int num_domains; u64 stats_addr; u32 stats_size; @@ -207,6 +208,7 @@ static int scmi_power_protocol_init(struct scmi_handle *handle) scmi_power_domain_attributes_get(handle, domain, dom); } + pinfo->version = version; handle->power_ops = &power_ops; handle->power_priv = pinfo; diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index ab42c21c5517..de73054554f3 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -48,6 +48,7 @@ struct reset_dom_info { }; struct scmi_reset_info { + u32 version; int num_domains; struct reset_dom_info *dom_info; }; @@ -217,6 +218,7 @@ static int scmi_reset_protocol_init(struct scmi_handle *handle) scmi_reset_domain_attributes_get(handle, domain, dom); } + pinfo->version = version; handle->reset_ops = &reset_ops; handle->reset_priv = pinfo; diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index a400ea805fc2..eba61b9c1f53 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -68,6 +68,7 @@ struct scmi_msg_sensor_reading_get { }; struct sensors_info { + u32 version; int num_sensors; int max_requests; u64 reg_addr; @@ -294,6 +295,7 @@ static int scmi_sensors_protocol_init(struct scmi_handle *handle) scmi_sensor_description_get(handle, sinfo); + sinfo->version = version; handle->sensor_ops = &sensor_ops; handle->sensor_priv = sinfo; From patchwork Wed Dec 18 11:17:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181981 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp503898ile; Wed, 18 Dec 2019 03:17:57 -0800 (PST) X-Google-Smtp-Source: APXvYqy26mzO03pEW4apYYYaT73rF0lBsyYFBO+b6Q7tTW4WsASuM/AZbMLLxGe7Lh3k/LrRkpE9 X-Received: by 2002:a05:6830:1b78:: with SMTP id d24mr1954631ote.174.1576667877839; Wed, 18 Dec 2019 03:17:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667877; cv=none; d=google.com; s=arc-20160816; b=hbPYm00uO5oH9t6R4vxGsmBGofTw43CvMgk4VsJLES/p7j3N5y3Bd9DUtyJWEk8MF0 YgTeI/M0qE3swuQwpBM+FEmTLJMg7cDfxvmpsvlwSNT8PM4JhK/p7SCzxM8a//aEcEqX Z+t2raSql8mDX2YnvMRQ/NXKwl2IjFq6SzlahyZjU8Qy5SajD0AOK4VfHhIESeGE1Xix yQJhrkcBH6u6oPmp6iZnDCnddCtwIarvpyB3qsn3dFvdZ/kgszg2m1y7IUVtradnunXU rW8w+/rZYUd0LOr5AKTJ/gQcs5+cAndLIxmwE7j3mPm2XK4MfpYn1jR679ujStKj9rhS Gbtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=9TjBXKtn1L2SqimCijYlf2/QvdoPCpnU3yl2WvHo8Vc=; b=OYJqs/BxdxTDuS9aJHbXyP0Ac4cUuF16SjQWTkoSOJn9Zhj6iSNp+oUFKlE+cKCM/S X2Y6BYNf+VYF3B151DBLMUJYug+qG/3BRmS+MyMSHSxWJu5IbkqrgifO2743nyLZ1tzL 3N+O5Ica+rn8BNNkHmAnf+77OZeQ83v0+/DMcoY8uO6KaqoICqJRt9PP9D5yYrFd9lPy hbMv9gtKe81AWjrfNyD7EKZmGKZf2/A6tV/DCEqkmLPWfMhf/RajHH1fTggJsEiJUpv+ +rJaCQHhNMwzudzNbd87Ye1hEwJcSjElH/mZ/ri+U06+chjmlHjBEHFhkZ0ke2S/RvX+ Ax6Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si1219000otk.304.2019.12.18.03.17.57; Wed, 18 Dec 2019 03:17:57 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbfLRLR5 (ORCPT + 27 others); Wed, 18 Dec 2019 06:17:57 -0500 Received: from foss.arm.com ([217.140.110.172]:42378 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbfLRLRy (ORCPT ); Wed, 18 Dec 2019 06:17:54 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D947711B3; Wed, 18 Dec 2019 03:17:53 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 362D23F6CF; Wed, 18 Dec 2019 03:17:53 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 07/11] firmware: arm_scmi: Skip protocol initialisation for additional devices Date: Wed, 18 Dec 2019 11:17:38 +0000 Message-Id: <20191218111742.29731-8-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scmi bus now supports adding multiple devices per protocol, and since scmi_protocol_init is called for each scmi device created, we must avoid allocating protocol private data and initialising the protocol itself if it is already initialised. In order to achieve the same, we can simple replace the idr pointer from protocol initialisation function to a dummy function. Suggested-by: Cristian Marussi Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/bus.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 Reviewed-by: Cristian Marussi diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 3714e6307b05..db55c43a2cbd 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -60,6 +60,11 @@ static int scmi_protocol_init(int protocol_id, struct scmi_handle *handle) return fn(handle); } +static int scmi_protocol_dummy_init(struct scmi_handle *handle) +{ + return 0; +} + static int scmi_dev_probe(struct device *dev) { struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver); @@ -78,6 +83,10 @@ static int scmi_dev_probe(struct device *dev) if (ret) return ret; + /* Skip protocol initialisation for additional devices */ + idr_replace(&scmi_protocols, &scmi_protocol_dummy_init, + scmi_dev->protocol_id); + return scmi_drv->probe(scmi_dev); } From patchwork Wed Dec 18 11:17:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181985 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp504199ile; Wed, 18 Dec 2019 03:18:13 -0800 (PST) X-Google-Smtp-Source: APXvYqxKMdnE7lFaZpRF9kW46sMu4yAR6IbYQ/oKQRPhV5fO5LDHsNKIKyqm9MTMSUFHZ0s/NbTQ X-Received: by 2002:a9d:32e5:: with SMTP id u92mr2128255otb.85.1576667893205; Wed, 18 Dec 2019 03:18:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667893; cv=none; d=google.com; s=arc-20160816; b=QcswL7PYPrhmpWNObwYtb5f8i/pBOZzpi3CbLAszJ6JwtGTP/6HsvZbZPyUxBwX9B8 QhpH2M6QkUSFmjhoE7V0+AAievX4gAyMRKR0VqVGAg7fTMztp1Qxed+UQMsAnFprYeD/ VIOuMxO4Z3qHzpOujakFn8rVNJMHb5lrYUkjvaBrLekac0l+HQpwIudZz3fPdOZn0BnD 4H6Hfw+GRzA7FFUBn1eC7vywmmGSgNQfdCQ9v6bgzMlqNhT5kpFa8VvIAMH0TAyoSnGb ajuML7kpEMyaEXo9AE1m6Afl8PyjrWBxva/iYtk4bZB8Q812ZE0jSDLXKvCp3ppaPJnU tKKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Iht6AH8aq3NZKKlB+MfhVUyXwuTlIZaB9XJhWEn+TvA=; b=j7OU7f5IemS3Va0l+LuIJ+h5FnYac3CnGyTDqODuraPXeezrJrLqkAb5Cu9I3ouPR/ YXYaLjniLJDUXf4L+UEDhuykjX5P1u0jkq3kPqfH/6HtA8H/dY/UP0PeabQ3Llnu9ogW Oxkk2hRLwk/Hm3gzH0IMvl6wHlqz+Yf3NoiuM2Ru+TvmrhyWfxdRuFlLK84Y1j6qaVWU aSJUwkwFn6v3qxQ0Mqwud5JOBIfyELrlD2wtLIMXeLqCqmw/Olvm/IPp8k14aqcpipj1 w/Fmh4viQfbMDErdigQwaOfEdRLtMf0Inn4Z6WNq/syq+5VP4ng8b7aN0+IOHkqs0EYb hmVA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si1246310otr.16.2019.12.18.03.18.13; Wed, 18 Dec 2019 03:18:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726996AbfLRLSM (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:12 -0500 Received: from foss.arm.com ([217.140.110.172]:42382 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726880AbfLRLRz (ORCPT ); Wed, 18 Dec 2019 06:17:55 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 204D130E; Wed, 18 Dec 2019 03:17:55 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 18BE53F6CF; Wed, 18 Dec 2019 03:17:53 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v2 08/11] clk: scmi: Match scmi device by both name and protocol id Date: Wed, 18 Dec 2019 11:17:39 +0000 Message-Id: <20191218111742.29731-9-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scmi bus now has support to match the driver with devices not only based on their protocol id but also based on their device name if one is available. This was added to cater the need to support multiple devices and drivers for the same protocol. Let us add the name "clocks" to scmi_device_id table in the driver so that in matches only with device with the same name and protocol id SCMI_PROTOCOL_CLOCK. Cc: Michael Turquette Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/clk/clk-scmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 Acked-by: Stephen Boyd diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c index 886f7c5df51a..c491f5de0f3f 100644 --- a/drivers/clk/clk-scmi.c +++ b/drivers/clk/clk-scmi.c @@ -176,7 +176,7 @@ static int scmi_clocks_probe(struct scmi_device *sdev) } static const struct scmi_device_id scmi_id_table[] = { - { SCMI_PROTOCOL_CLOCK }, + { SCMI_PROTOCOL_CLOCK, "clocks" }, { }, }; MODULE_DEVICE_TABLE(scmi, scmi_id_table); From patchwork Wed Dec 18 11:17:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181982 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp503976ile; Wed, 18 Dec 2019 03:18:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyKTqPD5PV7l8f/buD/y/MwGOdpgwLaet+XywJJBzbQo82o7l7lSG6FlskjZ+VaMaxx0K06 X-Received: by 2002:a9d:282:: with SMTP id 2mr1917658otl.237.1576667881123; Wed, 18 Dec 2019 03:18:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667881; cv=none; d=google.com; s=arc-20160816; b=vkiZ/hIUsx5zjnjILgOvUfxUIb2LjyY7LnTfWYVlo5ere4BjtQwwGUyLURLocRHoxY d08u/BgXgN1ONF4zAXCYyuuX5bvs6MkPQ97EiaCd0auwgh+h1LvI+Xv1jrjY+1JonUGH sfMN7vB4LtHUZUL6LLXuc6DggR38onMcKVimqHGWXRfkZYxLoUTuVNUxpievDal2NcAT IZ5p9JW63/PdknkjOz3YSxp4jiKmB8wN2G0DJ3Esb2V4Z6gaPFt0GswIFftsAfs6Y3+M Ue2i2vq5z/ljdIR3n7qRQlTcC1CQ1fth6M9Vh2z2k8a4UCJXUQ5umNA0y7lAxlG2u43/ R8bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=wqNQuRcOkIElW1plU4458E9NklGtkN0i7+GZFsWQEfE=; b=q9BKYsPcaP70FdVB6CZzkSUlQEA6IPw4ypM5up1CglzaiXYALCx5L6J5fSrw5uQ8vX Vzq0QlWPZAKXiryfA7zPHJZeFs0CH0iveyh6TqvM7gr0dq44pFcWTHrtgo46u57qsTyF /QX/olp/SdUvv0oWVwDfIZUI0sLNoi2vTpMeq9zg7kv+YgDDcDp28pHrJLbq3nOdUPFz 6Vw27KnQ5ReR5eTkdvqoe2bsZYAZ7w5DeRDwR8ngreiFgUGMD2IgDRK5h0FPt4KrgKnU 9ApXMo8tvY6G/S5JIO8BxWx1OfGOU7UVQUYZ3SnBG1l3ZMFAlbua6+tT72d/WBofpzXs zFiw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si1246310otr.16.2019.12.18.03.18.00; Wed, 18 Dec 2019 03:18:01 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726936AbfLRLSA (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:00 -0500 Received: from foss.arm.com ([217.140.110.172]:42390 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726910AbfLRLR4 (ORCPT ); Wed, 18 Dec 2019 06:17:56 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0AA5731B; Wed, 18 Dec 2019 03:17:56 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 533903F6CF; Wed, 18 Dec 2019 03:17:55 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 09/11] cpufreq: scmi: Match scmi device by both name and protocol id Date: Wed, 18 Dec 2019 11:17:40 +0000 Message-Id: <20191218111742.29731-10-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scmi bus now has support to match the driver with devices not only based on their protocol id but also based on their device name if one is available. This was added to cater the need to support multiple devices and drivers for the same protocol. Let us add the name "cpufreq" to scmi_device_id table in the driver so that in matches only with device with the same name and protocol id SCMI_PROTOCOL_PERF. This will help to add "devfreq" device/driver. Acked-by: Viresh Kumar Signed-off-by: Sudeep Holla --- drivers/cpufreq/scmi-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index e6182c89df79..61623e2ff149 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -261,7 +261,7 @@ static void scmi_cpufreq_remove(struct scmi_device *sdev) } static const struct scmi_device_id scmi_id_table[] = { - { SCMI_PROTOCOL_PERF }, + { SCMI_PROTOCOL_PERF, "cpufreq" }, { }, }; MODULE_DEVICE_TABLE(scmi, scmi_id_table); From patchwork Wed Dec 18 11:17:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181983 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp504044ile; Wed, 18 Dec 2019 03:18:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwAfOycrZ+V92I31c7WAKRkj/RJNtRPayolPmvZf1eKqO7I6XFgnbUhwwgGZdv8NSeJntCI X-Received: by 2002:a05:6830:1b7b:: with SMTP id d27mr2183916ote.78.1576667885512; Wed, 18 Dec 2019 03:18:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667885; cv=none; d=google.com; s=arc-20160816; b=otsFXMK3TJZhXkleL3q+xubPqkF7MQTJ8zNqxRzmyK7/gBzq1qPBU+nKmVEjluH9eO VkmVVJmfnXnFUrdf4fL/Y6N6mbZerF8zEUAMn2VCZ/NV7I/WquuZStfG1ttshH1IusrK JDt40q8qLNQX6x8F8Bq9GV2I02L14DQnVpgu7XyQ8YvFL4+QKdQe04UxZTd8PjxH2wZs doGF1ItUNG+1wEyvxP9ZNe/zmohSPRCamc8PlS4JNgnIhHuGogN/dATP4HhzqE2v6zqM JM1LSGBg3xDBVwqs25CvsUTv7qR0BobVvcIkga/GHbePQ/AAlZ8/3kdbxHBmSoME6M2m jgLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=s4oFmb+EU98R1Xt9mX0NdpddjsRuopdDNmnCIo6AgB8=; b=zqj+TtVAKef8XNmNWsBJNKxfCnrFep8JcwwhRSP3kKqzHVNAzCXMu2FEkFvAipHEhC jOHEH0YfSGckgxEcWDZ7Hj8Cr10Mwwmhj8DjnSpkyl1gUT7/gdC7iS3Q5HimXhW+NRhh spI+k1zOR2tFqsPQ6uzDIoqEopNRhJHSAvKxZepQ+PIWdraGr92XJE1mnBg0rR97+jQ+ z7eIjp8TFmVVcNO43MJL3QmPZu+55UDz9pTbDMxH0qjkIxq9/v5GZUsZvIZkaAl748Lp ly0zonzrbVSW6VU3u+phtqRKjzw29gd5U+e4oz644aOIk6FfS/yto3NCbW4+UP1FbG7m poGg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si1246310otr.16.2019.12.18.03.18.05; Wed, 18 Dec 2019 03:18:05 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbfLRLSE (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:04 -0500 Received: from foss.arm.com ([217.140.110.172]:42398 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbfLRLR5 (ORCPT ); Wed, 18 Dec 2019 06:17:57 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 243B3113E; Wed, 18 Dec 2019 03:17:57 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3E9843F6CF; Wed, 18 Dec 2019 03:17:56 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi , Guenter Roeck , linux-hwmon@vger.kernel.org Subject: [PATCH v2 10/11] hwmon: (scmi-hwmon) Match scmi device by both name and protocol id Date: Wed, 18 Dec 2019 11:17:41 +0000 Message-Id: <20191218111742.29731-11-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scmi bus now has support to match the driver with devices not only based on their protocol id but also based on their device name if one is available. This was added to cater the need to support multiple devices and drivers for the same protocol. Let us add the name "hwmon" to scmi_device_id table in the driver so that in matches only with device with the same name and protocol id SCMI_PROTOCOL_SENSOR. This is just for sake of completion and must not be used to add IIO support in parallel. Instead, if IIO support is added ever in future, we need to drop this hwmon driver entirely and use the iio->hwmon bridge to access the sensors as hwmon devices if needed. Cc: Guenter Roeck Cc: linux-hwmon@vger.kernel.org Signed-off-by: Sudeep Holla --- drivers/hwmon/scmi-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 8a7732c0bef3..286d3cfda7de 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -259,7 +259,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) } static const struct scmi_device_id scmi_id_table[] = { - { SCMI_PROTOCOL_SENSOR }, + { SCMI_PROTOCOL_SENSOR, "hwmon" }, { }, }; MODULE_DEVICE_TABLE(scmi, scmi_id_table); From patchwork Wed Dec 18 11:17:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181984 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp504088ile; Wed, 18 Dec 2019 03:18:08 -0800 (PST) X-Google-Smtp-Source: APXvYqw/a+PwT8WWhYvFKqBogA+PG4Ug8+GJTN9OutiHeTrFx9nf2wTMwdpBzK+kCJtEN7/FWqnw X-Received: by 2002:a05:6830:1db3:: with SMTP id z19mr2156809oti.152.1576667887928; Wed, 18 Dec 2019 03:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576667887; cv=none; d=google.com; s=arc-20160816; b=aBC8lkbFxuz77JgS/T5ygYccmtmrkb3VUx0vEPdQ5m3uwTZKK7PT6lSklKjvWF02Sz yRRtX3briPFt5Yi8da83DtmU48M7g1Dmd2UH96YyAwrSb9FVJHboeahHYiBRtgK4HqBR 78TZ5eD4B3PbmHcY4EhzJSsfFLn7y2/osS+WO9+2teydSw1OsxsCh1AjJcy4eZqU1NAg PGxxuyLXk6y1S62+cjrOnV2os/AOpjnbcHGtviCn4OnIhmwRGOBYL4shtkIYL4ds8pH1 WCmzPf7B5Vx6iv8TPDPHC5XKGLZHG9bcqJy+1JXLDgT98tQXqNGOKX49WuiDWSr6+QT0 mE7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=usjd1l6S7zWI8hrAm4qHti1z/KE82dSPr+9qJEVndf4=; b=a9oZdjxicGS+KBuPbHd91w706o+aWwO3s+byaQMnCTt80Y0qt1kel2k/UvPPQYp+sN ctYirDPtQOsWGX2UyY8rlZWXh1YacCc8zjACO5IBDSMEthelNPmgn/93Np/eQn5zDLCr la3Mn24Y+YH0cqP2dQhgjk1M8XiCewa76p/XQP6yKTALCYDh5QPwBZdyd06hJchji2bs jRl0vhW9uX7hn3m9xVVm2Wm47rQ3NtKqcA9PHvsZGa8xo60vjrpiMZZ0Lk7Urt6kAJSo gczBId4O1MOW7L3qJWSCefp8+8Umh/6ZCk80i2wCUi3wSrerdU3X39WsA5oj3cLhAR++ yMQw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t28si1246310otr.16.2019.12.18.03.18.07; Wed, 18 Dec 2019 03:18:07 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbfLRLSD (ORCPT + 27 others); Wed, 18 Dec 2019 06:18:03 -0500 Received: from foss.arm.com ([217.140.110.172]:42404 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbfLRLR6 (ORCPT ); Wed, 18 Dec 2019 06:17:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0FE0511B3; Wed, 18 Dec 2019 03:17:58 -0800 (PST) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 561303F6CF; Wed, 18 Dec 2019 03:17:57 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH v2 11/11] reset: reset-scmi: Match scmi device by both name and protocol id Date: Wed, 18 Dec 2019 11:17:42 +0000 Message-Id: <20191218111742.29731-12-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191218111742.29731-1-sudeep.holla@arm.com> References: <20191218111742.29731-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The scmi bus now has support to match the driver with devices not only based on their protocol id but also based on their device name if one is available. This was added to cater the need to support multiple devices and drivers for the same protocol. Let us add the name "reset" to scmi_device_id table in the driver so that in matches only with device with the same name and protocol id SCMI_PROTOCOL_RESET. Acked-by: Philipp Zabel Signed-off-by: Sudeep Holla --- drivers/reset/reset-scmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index b46df80ec6c3..8d3a858e3b19 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -108,7 +108,7 @@ static int scmi_reset_probe(struct scmi_device *sdev) } static const struct scmi_device_id scmi_id_table[] = { - { SCMI_PROTOCOL_RESET }, + { SCMI_PROTOCOL_RESET, "reset" }, { }, }; MODULE_DEVICE_TABLE(scmi, scmi_id_table);