From patchwork Tue Dec 10 14:53:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181121 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605770och; Tue, 10 Dec 2019 06:54:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzSKNb84ReiASnPEDVMTkVvaAFTUN7VyD6xyua8JwkPMCmxFMmIPSlfnjPQiSrq7OoUoka8 X-Received: by 2002:a9d:1ca:: with SMTP id e68mr12277683ote.102.1575989649475; Tue, 10 Dec 2019 06:54:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989649; cv=none; d=google.com; s=arc-20160816; b=MSfRheO1SUk7XkMLW/BZwSgPG8/Qa2neEKEdV4KTRWQPWpQQRZRm9hXnbhmXjmtdfP 5aYPKqQKvPvwMiqE1x7w4eQGBFtQq0Hq/LRcO9x1en/aOruXBqbLX1+QRR+TH9FnaNXQ t0z+I+ZZV54G5G5hw21vyMrX8Qg/QjBUhfv314qHR/qUjLdRfveX/QCXKj1FImNSpUJJ 1GJKkncXCu79b2vbTpO/AEE21w00V2rcoXugW+jWYGI5Pa8Ax+W4R2gV1Vv7dj5zdjYw BgIffTi+y/L8GTeNf6QV3pWpx1cGC2GSIcVSKgjfgAJKYN4jiwqM2WLSYMt0ehNz/JvX oD2A== 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=AR8ArsxngFEmOWhMnVmn+Ub7Q0pI3yMwrquZPX1rF1o=; b=qYmCBUsOwwzD6QZbvE/rFYpv1PsKgYSeHPNd1mRXG0a4+dRZGizFtoIMvOJCiij6/e YA0ex6h+Rq200vzAPo365Pn8DNhUCNkLR4U4uKu52xiBfJwGIzpfbF79MKIOL5t+AzWR aa8uDaz8wXZO6PrXMhnlV5HHfFj+hLgrurI+BnlnSSvdMjnz3PpredSG9URyACgrqov4 z+EsPSOzIiS0MY8Hr21yk2QrAvMt3IeKF9KltySvQYxiMgVZqHEnhykboyQ6sSuHFI7b aTRNlmjh59qgb01gWA15P8zbLp2swfQM5crg/cimY10uxGsUgRrbQyIwN6NOQEP04/Jg rMYg== 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 a12si2053135oie.87.2019.12.10.06.54.09; Tue, 10 Dec 2019 06:54:09 -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 S1727642AbfLJOyI (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:08 -0500 Received: from foss.arm.com ([217.140.110.172]:47112 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbfLJOyG (ORCPT ); Tue, 10 Dec 2019 09:54:06 -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 B0B46328; Tue, 10 Dec 2019 06:54:05 -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 0DE173F67D; Tue, 10 Dec 2019 06:54:04 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 01/15] firmware: arm_scmi: Add support for multiple device per protocol Date: Tue, 10 Dec 2019 14:53:31 +0000 Message-Id: <20191210145345.11616-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. 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 Reviewed-by: Cristian Marussi 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 Tue Dec 10 14:53: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: 181135 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606631och; Tue, 10 Dec 2019 06:54:59 -0800 (PST) X-Google-Smtp-Source: APXvYqz7X+p+3GW8fOZ+S/KKNwM+X+xKK8+R9dQaz1YdJ37pTd13IZA3OIF60Kty+5+izDXnBK/d X-Received: by 2002:a9d:150:: with SMTP id 74mr14996015otu.149.1575989699071; Tue, 10 Dec 2019 06:54:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989699; cv=none; d=google.com; s=arc-20160816; b=NpaEQMzpBBvuj0jlD7p1dNeY5D95Kjp4HFyGNXhPd4hUMVRe9P0Rb9MmuF+IZ7yoSe eoYGaQnJytt/fUcUWjz108Sv/o6tchHKHmCRMyiy6ACFOnj568ivecZP0jfMdJEW4Esl gfE1veDb4qNAHeuv9LnWwsYfudRCp8nXUDnEdr+WTHm6AVF8itz4ziIwdHE9ZVIeP4XL W3YReyDTQMiuzYJezKfmxx3paz+bIeMpMT2ytAkSg/euQd8Wph1+Z9d69gMNjgIeXC5w kW7Q0RU/zn/hhXAz3DEoF5A6oFJmBc6ILvv//oNQSqEU/J15Lg13uXgY2tmtnT8cJZ4A 9UxA== 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=TvPUSE++IS2Q4iPpT+8V7yZqvADrqCQvmjFzzTIbvrA=; b=yP8D9Lxa4bH99soM1mKy7KWcWaCBhFxDFduXhpMrr+tDMSumgNFde6dDvFs1CnPhyX +v5r0Rck9xxDGAoju9+fVZNPjL34k+z5aFZ3MUjNc9YLcRZRvUkb9JcTIlgEfQWvNpsy tVssIzgrgfnrvcBghWvYLIgflItdKp7SrTIEeVwizulml2oLUlMlP8fT757nawnicF17 CRSWnVs8AyrKIUrI6odxm091PsYaVoCDAGmKhgVbuvXqtD2KkPfyyrNpjwc42OF804YF 7gI6041mdL28HKjYgL/1DBC0yzWMAoHf+Z9vhO2opTKOzrtsOXJ2VlMr7JLPnfll/Hh1 NB1g== 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 a12si2053863oie.87.2019.12.10.06.54.58; Tue, 10 Dec 2019 06:54:59 -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 S1727837AbfLJOy5 (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:57 -0500 Received: from foss.arm.com ([217.140.110.172]:47118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727615AbfLJOyH (ORCPT ); Tue, 10 Dec 2019 09:54:07 -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 9C0441045; Tue, 10 Dec 2019 06:54:06 -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 E42D53F67D; Tue, 10 Dec 2019 06:54:05 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 02/15] firmware: arm_scmi: Skip scmi mbox channel setup for addtional devices Date: Tue, 10 Dec 2019 14:53:32 +0000 Message-Id: <20191210145345.11616-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.17.1 Reviewed-by: Cristian Marussi 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 Tue Dec 10 14:53: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: 181122 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605820och; Tue, 10 Dec 2019 06:54:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxexJB9hvME/XUsYd7hYI0d6UejiC6XN8lDHruWTUUbnaZn0eBQi+knkQ92T+HZad5YCOmW X-Received: by 2002:aca:48cf:: with SMTP id v198mr4221498oia.35.1575989651355; Tue, 10 Dec 2019 06:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989651; cv=none; d=google.com; s=arc-20160816; b=Reg9AcHbghY/BV4zNAGiGZ0FlqYTpSLMpSAcn6brD64NthNUNXPcxtaFZrYm5KJo5u KaTkl9ucfEyCSHHhIsfUnpY+2KnF09rplTS0vMR342+iYlE37/uwxZ+JUNemOTdO4z83 H1YKpP51Ig9TtmgakndX43WZTlGaKDKSUK70aiHM31nNxhrClHbDvwJZ5BP2fM1a5fUK rw+91EzQjhSZruobvRKBni+pKT4zCrtyCwNmr2w7C7aKcxbTkBLQv3t5OYIWnu2/1rN2 OU1TWmKS5OKC3ijp+tlH3rwPLUKb7rJJU+EP4jOsxzjbX61X9hDPN9FHZVfmfsd/WRIo H42w== 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=g6kN/5/N0EYkjm0uZze5WNbgOHcBZtnuJxdueNOXugc=; b=QO0qJMaqt314EhHmRmdoQDyEQSPzkGhkm/Oe1UDb1bpU4erC4gtFH7ntJvNwT24bpL Y0ckuvA03m7mv412y73vsO2LQTEYUrhiCf7by49DrollH+hDIfwaVOUxTh17bMIQCpp2 Dnrs+3P1u4aTqH1xdcLI6iliHQFPY32/bA2JejiOPmRmvaFPfVbd66s05kI3rsmmdHiW a9v7JgMgsO15QilAd/Tek25vbqNUp/G+bY+96OPxiDj24hwbnh4ByCq53BFMYDPFk48o /wTwOEBxt8vs2up6pzfIB8EpEc0sL0/d2Nq/zout87sX4v0uXQ5J/UM2Ew4gMlhulkUi Wi/Q== 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 a12si2053135oie.87.2019.12.10.06.54.10; Tue, 10 Dec 2019 06:54:11 -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 S1727658AbfLJOyJ (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:09 -0500 Received: from foss.arm.com ([217.140.110.172]:47126 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727634AbfLJOyI (ORCPT ); Tue, 10 Dec 2019 09:54:08 -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 7E4F811B3; Tue, 10 Dec 2019 06:54:07 -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 CF7023F67D; Tue, 10 Dec 2019 06:54:06 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 03/15] firmware: arm_scmi: Skip protocol initialisation for additional devices Date: Tue, 10 Dec 2019 14:53:33 +0000 Message-Id: <20191210145345.11616-4-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/clock.c | 3 +++ drivers/firmware/arm_scmi/perf.c | 3 +++ drivers/firmware/arm_scmi/power.c | 3 +++ drivers/firmware/arm_scmi/reset.c | 3 +++ drivers/firmware/arm_scmi/sensors.c | 3 +++ 5 files changed, 15 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 32526a793f3a..922b22aaaf84 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -316,6 +316,9 @@ static int scmi_clock_protocol_init(struct scmi_handle *handle) int clkid, ret; struct clock_info *cinfo; + if (handle->clk_ops && handle->clk_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_CLOCK, &version); dev_dbg(handle->dev, "Clock Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 601af4edad5e..55c2a4c21ccb 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -710,6 +710,9 @@ static int scmi_perf_protocol_init(struct scmi_handle *handle) u32 version; struct scmi_perf_info *pinfo; + if (handle->perf_ops && handle->perf_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_PERF, &version); dev_dbg(handle->dev, "Performance Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 5abef7079c0a..9a7593238b8f 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -185,6 +185,9 @@ static int scmi_power_protocol_init(struct scmi_handle *handle) u32 version; struct scmi_power_info *pinfo; + if (handle->power_ops && handle->power_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_POWER, &version); dev_dbg(handle->dev, "Power Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index ab42c21c5517..809dc8faee1e 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -195,6 +195,9 @@ static int scmi_reset_protocol_init(struct scmi_handle *handle) u32 version; struct scmi_reset_info *pinfo; + if (handle->reset_ops && handle->reset_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_RESET, &version); dev_dbg(handle->dev, "Reset Version %d.%d\n", diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index a400ea805fc2..b7f92c37c8a4 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -276,6 +276,9 @@ static int scmi_sensors_protocol_init(struct scmi_handle *handle) u32 version; struct sensors_info *sinfo; + if (handle->sensor_ops && handle->sensor_priv) + return 0; /* initialised already for the first device */ + scmi_version_get(handle, SCMI_PROTOCOL_SENSOR, &version); dev_dbg(handle->dev, "Sensor Version %d.%d\n", From patchwork Tue Dec 10 14:53: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: 181134 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606452och; Tue, 10 Dec 2019 06:54:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzbABkk8V7VVfAHmnQWIyXiJSrUYmGH9A5gE1ZN4hxpTSJIT9/8nAD8ZGD+yKvmXbhk9i/A X-Received: by 2002:aca:cdd6:: with SMTP id d205mr4044354oig.90.1575989690049; Tue, 10 Dec 2019 06:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989690; cv=none; d=google.com; s=arc-20160816; b=ionqKF1DACPz2Ud+lytGH7Op+Ja3WjxDsfiou7uUqQ+9gB7SI5pCmce4w3Zmnks33Z THJ6BHk/yEnCX+HoHmSbylpeZadb7UF0UyMqpihO0GRUpQ6TKRV+B6sn/Y9Xt6x/MFjN U5IX6NDj5/ZZYGm+5mzFDYy+wXXQUwU602Ed40DndSAcQBF5dRM3ZJjAK2fhEHicBBSd SKHRMwSLNF9J6zQSLmI/67xtFnDN8nG2fYk65Buply7aQiCsJhrzrdWNiKNlMbmpdp2j RrWIECrIpxPFxGSoipHgYxR1DzV/5rNcINU0ikvWcqLaPI3p6CWb3dpJNTY/IlISKkGe AMwg== 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=bvZaVhuPlI7hXF56TTIbJVvWYLBJjLQNFFH/R6C5Nhs=; b=fZTeatHSLPSX15TZLVg7izM70P5TsykOE8CBRFgCuTHhzLdaoQuSo4LkAt3HWZZTt+ jvIghQ29qq0DM6OF6Mp2HCI286EV+dC2CJbSXnRr2Ud7rsSXgT1kL5t28urVl7nY7wOy mKmWhEsMP/9qsV0fvX84i7gmMr/hWyZQsxJKfX9JiVJLWrSG76WOJceq+u4ffQcAYEdM kTs3MnvNRyTmclIZYxdYCJCajysy6xWseP27B7yCN5mSEwG7cXvhu5FtNp7zgnxJwe1N T+GCacZUaG53c0MHTj9RsHJ/6t0tdzDZjUiTwQKcwJl0xNbWqvk03bkQE/11QKj/4zKr s//g== 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 a12si2053863oie.87.2019.12.10.06.54.49; Tue, 10 Dec 2019 06:54:50 -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 S1727677AbfLJOyM (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:12 -0500 Received: from foss.arm.com ([217.140.110.172]:47134 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727610AbfLJOyI (ORCPT ); Tue, 10 Dec 2019 09:54:08 -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 607D713A1; Tue, 10 Dec 2019 06:54:08 -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 B1D553F67D; Tue, 10 Dec 2019 06:54:07 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 04/15] firmware: arm_scmi: Add names to scmi devices created Date: Tue, 10 Dec 2019 14:53:34 +0000 Message-Id: <20191210145345.11616-5-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 36 +++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Cristian Marussi 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 Tue Dec 10 14:53: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: 181123 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605899och; Tue, 10 Dec 2019 06:54:14 -0800 (PST) X-Google-Smtp-Source: APXvYqykSrQgUPyshU/Uey6gzAfc5Q3ExigwqBkSD1p04G2d5lfrH/eoF9Z5p65z3xeFnQG7PrYs X-Received: by 2002:aca:fc07:: with SMTP id a7mr4351524oii.28.1575989654779; Tue, 10 Dec 2019 06:54:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989654; cv=none; d=google.com; s=arc-20160816; b=QhgxyvMsukUC5WTexPdLCBoLC+qlXfkhoCA86y88gRpzE9WNk++sN8cEMgrJ9V7NAo uX64cyzOyNF8/Lw9jfJITgP9F3W0LplUOxpbON7zEt07fHytYrp4kJwdsKl+c31fI7j3 UEma0KIFHQpHPXH64so7BTmf4u7nafg7BvNKnw1PjShly+I9JbdMmGhEtFuUOvJAM3GB wAPs4rebRjwZ4RhwF4KBlf3IBZHKlZZXbkH4rhj4+VZWws94C5+QkM3PoJ7wGcnl6sOL 01X0OooxfGEnusCcAt591AGnxbGr3HqA6spRCjAZz/tr3XkRaTVe+2WlWtGphk7QHjX2 litQ== 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=9KvzuCVrR3cmC256dnaRGDdFwv51oP8954ExbdqKZus=; b=r1r2bh/hhNFW5PSrxy3SsVGIdPf8F5GyVNYyrfhidhs8Rc+LQTFfA0kPAZ1MS04Kn/ GIx05c7/aGE2+SJKjLcQHsBIxWaBY+peqBwx/7uIPjS4hyHf5Z7yUuEpZyix72fiGA6z x5GzUZe/KUVnSPpJSC0/nlFoo/1vcSHjD9iHAZuu4Kq4J+FEqfiJFrM6xk9wEs2+/mb+ CD3JLw5qfB4gTnVuAAmmP7AyjdtZPDm23vbO4oWOZHn/2vhsKaSXYZj/GfN1H1xffgVN 7UvTPluKIi2V2F0Ladh7TzcSuDDBsvg1iMWGaWY4bHcP3wHXn8zAdoTRiESw2IwZlGu2 +G/Q== 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 a12si2053135oie.87.2019.12.10.06.54.14; Tue, 10 Dec 2019 06:54:14 -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 S1727695AbfLJOyN (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:13 -0500 Received: from foss.arm.com ([217.140.110.172]:47140 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727659AbfLJOyJ (ORCPT ); Tue, 10 Dec 2019 09:54:09 -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 43EF61396; Tue, 10 Dec 2019 06:54:09 -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 940C63F67D; Tue, 10 Dec 2019 06:54:08 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 05/15] firmware: arm_scmi: Add versions and identifier attributes using dev_groups Date: Tue, 10 Dec 2019 14:53:35 +0000 Message-Id: <20191210145345.11616-6-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/driver.c | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) -- 2.17.1 Reviewed-by: Cristian Marussi 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 Tue Dec 10 14:53: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: 181133 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606412och; Tue, 10 Dec 2019 06:54:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzJ/eh4kR9AGQjuGzk7qUQbJxFsxgsmZKv0UY0WAYfbJeU0fxDKMn46le57I60B9rzlU1OK X-Received: by 2002:a54:4085:: with SMTP id i5mr4284735oii.17.1575989687396; Tue, 10 Dec 2019 06:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989687; cv=none; d=google.com; s=arc-20160816; b=uJw+SLl/q7/GhuoxKUyuEGw/wDccegXig5qtFecowRcLurwRYpokXQLmxMPjnttowo YssusIXtJCc1nAazQdcDrI2LXSinLeb9OA1cHcIoqruhojrZ6u6IAF/wdo7IQBX8aSzD Y7G/fdDMBUZ5drS/JPiTawT9Y6zY9x564NxYdJ/CdG4Zu0FklmpzNrKRLicN9Qg9D+yp IqNIzTGFD82mOifYfnVEZR5oRIrOGLJgliFVJmyMBM7703U1MczWk07h8yBZBH2J8u8Z /vnPigzgsskp5VVJdU1ryxS+WezW6U6MDWGD0W3XmKVvqtdiZEXxlpcqYjfRvWESDO0w YboQ== 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=/bq/9REd8xQ0cDKvXVulq4kByxvwOKetpZp/z3K/Wzs=; b=AGsdHELlcG5WPprSROs9ScbAI4UeUFX7UcuigQUKXAY3wCLEzybMZwgtiC2x7UYQna eaDJAtby9UkQuEnVCFskdEiiIOJJfWZH38kIvyiS95ZBe4m/DsXuQ758MjXh1RBo+QM4 tjNLy2BrNn3IUUpTj6mon46/dAWKgFwH1t+AFs0XaJQ2V4zhYhevKAVn427DavhHdONH Pl4o0ahpZHurZGswhI72G8SKXbj8S/CtO/mwWYBBIHogDZhLL6OpON2e/Ehy335UHFCX aSh/rEECc0o3b2Hce6AfyDtwkuX7DB8xnbadUd1U1pfsocop56XvmcwuBMf5pFWLG6QU ORLQ== 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 a12si2053863oie.87.2019.12.10.06.54.46; Tue, 10 Dec 2019 06:54:47 -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 S1727709AbfLJOyP (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:15 -0500 Received: from foss.arm.com ([217.140.110.172]:47144 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727664AbfLJOyK (ORCPT ); Tue, 10 Dec 2019 09:54:10 -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 2668D113E; Tue, 10 Dec 2019 06:54:10 -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 776E63F67D; Tue, 10 Dec 2019 06:54:09 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 06/15] firmware: arm_scmi: Update scmi_prot_init_fn_t to use device instead of handle Date: Tue, 10 Dec 2019 14:53:36 +0000 Message-Id: <20191210145345.11616-7-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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 multiple device per protocol. So, in order to initialise each device and it's attributes, it's better to pass scmi_device pointer to the protocol initialise function rather than scmi_handle. scmi_handle can be still fetched from the scmi_device pointer. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/bus.c | 6 +++--- drivers/firmware/arm_scmi/clock.c | 3 ++- drivers/firmware/arm_scmi/perf.c | 3 ++- drivers/firmware/arm_scmi/power.c | 3 ++- drivers/firmware/arm_scmi/reset.c | 3 ++- drivers/firmware/arm_scmi/sensors.c | 3 ++- include/linux/scmi_protocol.h | 2 +- 7 files changed, 14 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 3714e6307b05..f619da2634a6 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -51,13 +51,13 @@ static int scmi_dev_match(struct device *dev, struct device_driver *drv) return 0; } -static int scmi_protocol_init(int protocol_id, struct scmi_handle *handle) +static int scmi_protocol_init(int protocol_id, struct scmi_device *dev) { scmi_prot_init_fn_t fn = idr_find(&scmi_protocols, protocol_id); if (unlikely(!fn)) return -EINVAL; - return fn(handle); + return fn(dev); } static int scmi_dev_probe(struct device *dev) @@ -74,7 +74,7 @@ static int scmi_dev_probe(struct device *dev) if (!scmi_dev->handle) return -EPROBE_DEFER; - ret = scmi_protocol_init(scmi_dev->protocol_id, scmi_dev->handle); + ret = scmi_protocol_init(scmi_dev->protocol_id, scmi_dev); if (ret) return ret; diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 922b22aaaf84..6c24eb8a4e68 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -310,11 +310,12 @@ static struct scmi_clk_ops clk_ops = { .disable = scmi_clock_disable, }; -static int scmi_clock_protocol_init(struct scmi_handle *handle) +static int scmi_clock_protocol_init(struct scmi_device *dev) { u32 version; int clkid, ret; struct clock_info *cinfo; + struct scmi_handle *handle = dev->handle; if (handle->clk_ops && handle->clk_priv) return 0; /* initialised already for the first device */ diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 55c2a4c21ccb..4f02bfba98ba 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -704,11 +704,12 @@ static struct scmi_perf_ops perf_ops = { .est_power_get = scmi_dvfs_est_power_get, }; -static int scmi_perf_protocol_init(struct scmi_handle *handle) +static int scmi_perf_protocol_init(struct scmi_device *dev) { int domain; u32 version; struct scmi_perf_info *pinfo; + struct scmi_handle *handle = dev->handle; if (handle->perf_ops && handle->perf_priv) return 0; /* initialised already for the first device */ diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 9a7593238b8f..5a8faa369d82 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -179,11 +179,12 @@ static struct scmi_power_ops power_ops = { .state_get = scmi_power_state_get, }; -static int scmi_power_protocol_init(struct scmi_handle *handle) +static int scmi_power_protocol_init(struct scmi_device *dev) { int domain; u32 version; struct scmi_power_info *pinfo; + struct scmi_handle *handle = dev->handle; if (handle->power_ops && handle->power_priv) return 0; /* initialised already for the first device */ diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index 809dc8faee1e..438d74a2c80a 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -189,11 +189,12 @@ static struct scmi_reset_ops reset_ops = { .deassert = scmi_reset_domain_deassert, }; -static int scmi_reset_protocol_init(struct scmi_handle *handle) +static int scmi_reset_protocol_init(struct scmi_device *dev) { int domain; u32 version; struct scmi_reset_info *pinfo; + struct scmi_handle *handle = dev->handle; if (handle->reset_ops && handle->reset_priv) return 0; /* initialised already for the first device */ diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index b7f92c37c8a4..afa51bedfa5d 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -271,10 +271,11 @@ static struct scmi_sensor_ops sensor_ops = { .reading_get = scmi_sensor_reading_get, }; -static int scmi_sensors_protocol_init(struct scmi_handle *handle) +static int scmi_sensors_protocol_init(struct scmi_device *dev) { u32 version; struct sensors_info *sinfo; + struct scmi_handle *handle = dev->handle; if (handle->sensor_ops && handle->sensor_priv) return 0; /* initialised already for the first device */ diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 5c873a59b387..b676825e6eb0 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -316,6 +316,6 @@ static inline void scmi_driver_unregister(struct scmi_driver *driver) {} #define module_scmi_driver(__scmi_driver) \ module_driver(__scmi_driver, scmi_register, scmi_unregister) -typedef int (*scmi_prot_init_fn_t)(struct scmi_handle *); +typedef int (*scmi_prot_init_fn_t)(struct scmi_device *); int scmi_protocol_register(int protocol_id, scmi_prot_init_fn_t fn); void scmi_protocol_unregister(int protocol_id); From patchwork Tue Dec 10 14:53: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: 181124 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605952och; Tue, 10 Dec 2019 06:54:17 -0800 (PST) X-Google-Smtp-Source: APXvYqy2JjG80iCTsVuFViRPCibb/9TxSUwp0WSuiI12YiqzOT9EfDBa2g2X1YhidZw8StLNDGZ8 X-Received: by 2002:aca:3b89:: with SMTP id i131mr4080464oia.43.1575989657311; Tue, 10 Dec 2019 06:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989657; cv=none; d=google.com; s=arc-20160816; b=uo7CBPaa8qPXFGfd0LCLfugjX3HjZixNzfxySbus8Rj8nyXespdD1ApC2GJXDcvqHO pEUlwIAhJ+klPH9otk+yHlAGFYW8jmnzfzNeeAOApLM82f0FJhvwSKkVWeiT3Wq40Nfy 5ezD45T8xuNJRbC0qzvs5sGSnWTM/jc1QugXgnQuB3XXbkcmS5tXpfT2IQ7eMamN1jXH /3rHpvSvdwxiIZ//g7zuz8iX/hu8Byd/yk5ByXeFShGwImO5KtmGtRdMdxTDNP2loIud N5+uRyk2lgqol/qMDGvo7B4HfCVwJrAEpG64CHoqmwUE22ESFr39YyM6N6jSBDAVv3jg CauA== 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=W6hIiz9eQa6XDDC50MkgIC1rZwkdiu622C9azLzl1gg=; b=dEC5p+aOPR812JO+W3w2nh7K8vMjLRpNCjxdTl2+cX059kQn55x53hdL0KFogvrj5P aoed/WfYpRr2169C2MvUp0FwNWZAxOtR4Pvqtw63ELTCNl5rWEJaD55huSuyHLeAjVTd dSE7QuxcK8EokvCebhJ3ByTI6pcmrEb75t9GyEwuix3VXdv6lqNt1twdV84nhu0/8e/E BVogtfMV7/t7i4dJdAhSOuQ6BxoVygJ7uXwRcdlbHHWDGJakX6cpOoNCiJdHJuGDCB/b v9dK0CW+i77fsJfaOrkoYhO+RkP8UVZC1KTgr9l+w45gw32ancoaLGO9PuoFfHwNiri4 r4MA== 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 a12si2053135oie.87.2019.12.10.06.54.16; Tue, 10 Dec 2019 06:54: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; 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 S1727728AbfLJOyQ (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:16 -0500 Received: from foss.arm.com ([217.140.110.172]:47150 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbfLJOyL (ORCPT ); Tue, 10 Dec 2019 09:54:11 -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 0900A1045; Tue, 10 Dec 2019 06:54:11 -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 5A4BF3F67D; Tue, 10 Dec 2019 06:54:10 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 07/15] firmware: arm_scmi: Stash version in protocol init functions Date: Tue, 10 Dec 2019 14:53:37 +0000 Message-Id: <20191210145345.11616-8-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. 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 Reviewed-by: Cristian Marussi diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 6c24eb8a4e68..b567ec03f711 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; @@ -344,6 +345,7 @@ static int scmi_clock_protocol_init(struct scmi_device *dev) 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 4f02bfba98ba..b1de6197f61c 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; @@ -740,6 +741,7 @@ static int scmi_perf_protocol_init(struct scmi_device *dev) 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 5a8faa369d82..d11c6cd6bbab 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; @@ -211,6 +212,7 @@ static int scmi_power_protocol_init(struct scmi_device *dev) 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 438d74a2c80a..dce103781b3f 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; }; @@ -221,6 +222,7 @@ static int scmi_reset_protocol_init(struct scmi_device *dev) 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 afa51bedfa5d..aac0243e2880 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; @@ -298,6 +299,7 @@ static int scmi_sensors_protocol_init(struct scmi_device *dev) scmi_sensor_description_get(handle, sinfo); + sinfo->version = version; handle->sensor_ops = &sensor_ops; handle->sensor_priv = sinfo; From patchwork Tue Dec 10 14:53: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: 181125 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5605976och; Tue, 10 Dec 2019 06:54:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxqSo3xeUk494fGrLDEZ56ceublm71bk1Sf9UqtWWK0+fW4tq+RdK9UcPU+S5e+pMGXqjqX X-Received: by 2002:aca:33d5:: with SMTP id z204mr4053440oiz.120.1575989658872; Tue, 10 Dec 2019 06:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989658; cv=none; d=google.com; s=arc-20160816; b=n6HjzBmt0R91Uoro5+ZnM+KZnkCo4k4qMgxicQR8tfM48QaekWxm1UctvkBlMe5izR 687TOTxsTIgUC0yR3VpyQ8hHRk6ZFhYnR2Zh0HquT5nG1YV48dhvA8Bt55pnCFoRoxhD 6TvIMMyJ1FsxfJjNAETJ+LSoUWSqWVpok+1O02YlOeIRdCzER9qjD6BALts33UuAbAv6 lC17Z8wh6kFQB3f6YuR5hiL5ZcHPmLpHSWK0pMYYuKfb8daxaDDFeNynAq16no0ZJnhd Ul6spBVjea/XfsksRqlKch3hGzORaJLg4ho43mT2gze1BW+4HrHEymRNFtzn5dq2eoVB bSng== 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=FcNod31knOXlLHoaCxNA+7Xc8qXJGhlTtKGV1MdZBe8=; b=df9os37h6BPx61Sqch7ELjrGhIibD4/08ph5Ggpd4lPkBFJgEfeq2qqQMuXfgZR03y F2hsPUeZdlAd0mxfpl6CBNPKqDKePMPAMxZe5/BAXvz3hecDsohZyiY1rAmwiCUvx8Bn atnpQOMETB2okbeH7pOs5v/FhYeVx7PIWOmOXJccTfnXs9zD1IsFGIp+oRl4eZieWSfe /vpih+9lhmn/AO7uGy+ArtSYV8tmNlbFq3rk4WHrb6Ylh7CKPFbIgYC6tSoiZQzYiTDt ZgbdkbG41JTWMyWKD+/Q5cUy1Zv4VPxyYwctwnS6R97b3cXHKuflvrBmwtGZCffqt4Bt IukQ== 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 a12si2053135oie.87.2019.12.10.06.54.18; Tue, 10 Dec 2019 06:54:18 -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 S1727749AbfLJOyR (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:17 -0500 Received: from foss.arm.com ([217.140.110.172]:47154 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727674AbfLJOyM (ORCPT ); Tue, 10 Dec 2019 09:54:12 -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 DF42C13D5; Tue, 10 Dec 2019 06:54:11 -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 3C6303F67D; Tue, 10 Dec 2019 06:54:11 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 08/15] firmware: arm_scmi: Add and initialise protocol version to scmi_device structure Date: Tue, 10 Dec 2019 14:53:38 +0000 Message-Id: <20191210145345.11616-9-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's useful to keep track of scmi protocol version in the scmi device structure along with the protocol id. These can be used to expose the information to the userspace via bus dev_groups attributes as well. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/clock.c | 6 +++++- drivers/firmware/arm_scmi/perf.c | 6 +++++- drivers/firmware/arm_scmi/power.c | 6 +++++- drivers/firmware/arm_scmi/reset.c | 6 +++++- drivers/firmware/arm_scmi/sensors.c | 6 +++++- include/linux/scmi_protocol.h | 1 + 6 files changed, 26 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index b567ec03f711..b68736ae7f88 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -318,8 +318,11 @@ static int scmi_clock_protocol_init(struct scmi_device *dev) struct clock_info *cinfo; struct scmi_handle *handle = dev->handle; - if (handle->clk_ops && handle->clk_priv) + if (handle->clk_ops && handle->clk_priv) { + cinfo = handle->clk_priv; + dev->version = cinfo->version; return 0; /* initialised already for the first device */ + } scmi_version_get(handle, SCMI_PROTOCOL_CLOCK, &version); @@ -345,6 +348,7 @@ static int scmi_clock_protocol_init(struct scmi_device *dev) scmi_clock_describe_rates_get(handle, clkid, clk); } + dev->version = version; 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 b1de6197f61c..8a02dc453894 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -712,8 +712,11 @@ static int scmi_perf_protocol_init(struct scmi_device *dev) struct scmi_perf_info *pinfo; struct scmi_handle *handle = dev->handle; - if (handle->perf_ops && handle->perf_priv) + if (handle->perf_ops && handle->perf_priv) { + pinfo = handle->perf_priv; + dev->version = pinfo->version; return 0; /* initialised already for the first device */ + } scmi_version_get(handle, SCMI_PROTOCOL_PERF, &version); @@ -741,6 +744,7 @@ static int scmi_perf_protocol_init(struct scmi_device *dev) scmi_perf_domain_init_fc(handle, domain, &dom->fc_info); } + dev->version = version; 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 d11c6cd6bbab..6267111e38e6 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -187,8 +187,11 @@ static int scmi_power_protocol_init(struct scmi_device *dev) struct scmi_power_info *pinfo; struct scmi_handle *handle = dev->handle; - if (handle->power_ops && handle->power_priv) + if (handle->power_ops && handle->power_priv) { + pinfo = handle->power_priv; + dev->version = pinfo->version; return 0; /* initialised already for the first device */ + } scmi_version_get(handle, SCMI_PROTOCOL_POWER, &version); @@ -212,6 +215,7 @@ static int scmi_power_protocol_init(struct scmi_device *dev) scmi_power_domain_attributes_get(handle, domain, dom); } + dev->version = version; 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 dce103781b3f..76f1cee85a06 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -197,8 +197,11 @@ static int scmi_reset_protocol_init(struct scmi_device *dev) struct scmi_reset_info *pinfo; struct scmi_handle *handle = dev->handle; - if (handle->reset_ops && handle->reset_priv) + if (handle->reset_ops && handle->reset_priv) { + pinfo = handle->reset_priv; + dev->version = pinfo->version; return 0; /* initialised already for the first device */ + } scmi_version_get(handle, SCMI_PROTOCOL_RESET, &version); @@ -222,6 +225,7 @@ static int scmi_reset_protocol_init(struct scmi_device *dev) scmi_reset_domain_attributes_get(handle, domain, dom); } + dev->version = version; 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 aac0243e2880..fb3bed4cb171 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -278,8 +278,11 @@ static int scmi_sensors_protocol_init(struct scmi_device *dev) struct sensors_info *sinfo; struct scmi_handle *handle = dev->handle; - if (handle->sensor_ops && handle->sensor_priv) + if (handle->sensor_ops && handle->sensor_priv) { + sinfo = handle->sensor_priv; + dev->version = sinfo->version; return 0; /* initialised already for the first device */ + } scmi_version_get(handle, SCMI_PROTOCOL_SENSOR, &version); @@ -299,6 +302,7 @@ static int scmi_sensors_protocol_init(struct scmi_device *dev) scmi_sensor_description_get(handle, sinfo); + dev->version = version; sinfo->version = version; handle->sensor_ops = &sensor_ops; handle->sensor_priv = sinfo; diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index b676825e6eb0..a863bc0cdf28 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -256,6 +256,7 @@ enum scmi_std_protocol { struct scmi_device { u32 id; + u32 version; u8 protocol_id; const char *name; struct device dev; From patchwork Tue Dec 10 14:53: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: 181127 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606041och; Tue, 10 Dec 2019 06:54:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzuSZOTt5uSR1EInNoCeSJa+ETWjfkCcBZJICnegnHxWnhEmL5+1hb53pqv4/valO4iLj5M X-Received: by 2002:a9d:eee:: with SMTP id 101mr16490562otj.5.1575989662710; Tue, 10 Dec 2019 06:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989662; cv=none; d=google.com; s=arc-20160816; b=Hc0zgv9twiqJgwfRyqrU6mgrL9Rg2uBIevNrilfWzp5nf8vw+3y7QMp1URTuu9gpnJ sjNToD5clv/3hj3W2VAsvKXEGZU0rSB4Jl3kXcYUW/WwjjmD+Hn3I+7tC4e87pEsJ6U+ S6yTjgyUzrcew5FDEhAf6gon5WKqfyVbnCi7b0vqIfaWktt6eQW3V6jGZB1luXiyLMs5 3luiGHJabniJGbcOA9I2Y7rmoWHXL2d1tCRJbTiUlKaZMr7efrOpc4Bhd0kqkNmjxS4Z NNPJ/v8kvOneZhxa2X9BN44/NFvBV0H/QCwbk+Ksgvc0aujxAZe8mmsbvBD52LSpBiIZ BUUQ== 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=ZMq72ZBzaRT1xU9DwEGwYdDPoh4TMxVapr5gN0Jwh9U=; b=ghMWP0dLnDLf8MpmP+I/dkZkz1BKA2i4lnzFTyYwTVoftcIEGKBQnLHu6scw2e/YD5 izf0kzda6vOnFoSb2SXQSPpkbnmwSfzbgz1zaOEuF2jIQCyiinOE4cIMpivLgpUsHdXZ A2SDGd+cc+BjU0JMceNbqG27cozY6E4eQruqBwpEyv9upaSaLeGUs1X4QWj4FylfjgyS LYHeooYYTUHYPWPaNiRud7bxScJzDJUApfZPJlHAU8UCX+FKzBgD5fyYX1f9NMamUQff ePWUWxXb0z4fzlnDKQfgPGv6LECgLPbiRTL6XU74wRx3DEkGn02yolT/vQGDNKI+YXav r5Kg== 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 j6si721501oij.197.2019.12.10.06.54.22; Tue, 10 Dec 2019 06:54:22 -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 S1727768AbfLJOyV (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:21 -0500 Received: from foss.arm.com ([217.140.110.172]:47158 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727681AbfLJOyN (ORCPT ); Tue, 10 Dec 2019 09:54:13 -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 C15AA328; Tue, 10 Dec 2019 06:54:12 -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 1E95E3F67D; Tue, 10 Dec 2019 06:54:12 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 09/15] firmware: arm_scmi: Add scmi protocol version and id device attributes Date: Tue, 10 Dec 2019 14:53:39 +0000 Message-Id: <20191210145345.11616-10-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linux kernel bus driver management layer provides way to add set of default attributes of the devices on the bus. Using the same, let's add the scmi per protocol version and id attributes to the sysfs. It helps to identify the individual protocol details from the sysfs entries similar to the SCMI protocol and firmware version. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/bus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index f619da2634a6..ed0ed02f7158 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -92,11 +92,38 @@ static int scmi_dev_remove(struct device *dev) return 0; } +static ssize_t protocol_version_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scmi_device *scmi_dev = to_scmi_dev(dev); + + return sprintf(buf, "%u.%u\n", PROTOCOL_REV_MAJOR(scmi_dev->version), + PROTOCOL_REV_MINOR(scmi_dev->version)); +} +static DEVICE_ATTR_RO(protocol_version); + +static ssize_t protocol_id_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct scmi_device *scmi_dev = to_scmi_dev(dev); + + return sprintf(buf, "%u\n", scmi_dev->protocol_id); +} +static DEVICE_ATTR_RO(protocol_id); + +static struct attribute *versions_attrs[] = { + &dev_attr_protocol_version.attr, + &dev_attr_protocol_id.attr, + NULL, +}; +ATTRIBUTE_GROUPS(versions); + static struct bus_type scmi_bus_type = { .name = "scmi_protocol", .match = scmi_dev_match, .probe = scmi_dev_probe, .remove = scmi_dev_remove, + .dev_groups = versions_groups, }; int scmi_driver_register(struct scmi_driver *driver, struct module *owner, From patchwork Tue Dec 10 14:53: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: 181128 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606065och; Tue, 10 Dec 2019 06:54:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwo2wV/6JxJeoyWLE7Xk6ZdOa0yQInS7E48KPfAIV4MW2ur8WuLVb46xTy2gsNUD9jnnhN5 X-Received: by 2002:a9d:7c97:: with SMTP id q23mr25608366otn.253.1575989664483; Tue, 10 Dec 2019 06:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989664; cv=none; d=google.com; s=arc-20160816; b=yJxDg5eoACvB/uYKzJ6JhJy7CaZLCavCoZU/I2Ivwff03rl0jfQ5uL0dLK1gY6BM1G W0Ve2cENzYo8y7/vJ4+pBlYw/tcHJLOAQxytlCmN8l9biD0gexsVnIFguYYRTsf+W75C L6efA11YTnz/tlsKDd9wETDBLp5GTvr7//G3jwjTGXm8clmncF9BiYK7Fg82YZcBjjaM oLQmq7x1lz9D7X9XZYr4M9uJIirEdhyhqmtUA6LngOGvSed/KxECF3xHJ9c3d0GOXJZS hvKOn8z0avBsTxGTE9OEJbbgSAoABmExdKaYihAduzMJ/HAqIoPp3EFsI+vKf6dYarnP Sd8g== 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=vT7dnmJDpSpkgM/nKsidnz08cQT/fl/5icmlUSlA7cQ=; b=GqNzMeGGrVnvpJEYpAQRGl8ISZkjpZEJvLYFdN2OxBa1wdhU/1yQFLQzRBFNxFbKBJ r7PAOFherJT6sPwp64w4NZh50g6L3Jyw+bzOcuYtAiYfDD8wUWM0/DiAUQI6NGCD+ffY ru4tIYBJB/P+3eT1o9iRf3u7Ay2JdN0kAWiua8clqEU9Fncrazu1SZC41XEa7dqAZzj0 ZO8TBOXi49uEMwVDaA1nDO6fOPTdB1gYAd3yXqguBXdInfqGZTIq3a4ZKOlNAeQsWhm4 Bfp6jX9N3I1uIc2pPCzvHHRfKSoLFYnFJr70VyhL2cpYJc3JrRUeYt257kqgYAfhhTG5 4Ipg== 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 j6si721501oij.197.2019.12.10.06.54.24; Tue, 10 Dec 2019 06:54:24 -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 S1727782AbfLJOyX (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:23 -0500 Received: from foss.arm.com ([217.140.110.172]:47162 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727659AbfLJOyO (ORCPT ); Tue, 10 Dec 2019 09:54:14 -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 A394511B3; Tue, 10 Dec 2019 06:54:13 -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 00CA03F67D; Tue, 10 Dec 2019 06:54:12 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 10/15] firmware: arm_scmi: Drop logging individual scmi protocol version Date: Tue, 10 Dec 2019 14:53:40 +0000 Message-Id: <20191210145345.11616-11-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-1-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SCMI firmware and individual protocol versions and other attributes are now exposed as device attributes through sysfs entries. These debug logs can be dropped as the same information is available through sysfs. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/clock.c | 3 --- drivers/firmware/arm_scmi/perf.c | 3 --- drivers/firmware/arm_scmi/power.c | 3 --- drivers/firmware/arm_scmi/reset.c | 3 --- drivers/firmware/arm_scmi/sensors.c | 3 --- 5 files changed, 15 deletions(-) -- 2.17.1 Reviewed-by: Cristian Marussi diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index b68736ae7f88..ce8cbefb0aa6 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -326,9 +326,6 @@ static int scmi_clock_protocol_init(struct scmi_device *dev) scmi_version_get(handle, SCMI_PROTOCOL_CLOCK, &version); - dev_dbg(handle->dev, "Clock Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); - cinfo = devm_kzalloc(handle->dev, sizeof(*cinfo), GFP_KERNEL); if (!cinfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 8a02dc453894..2ad3bc792692 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -720,9 +720,6 @@ static int scmi_perf_protocol_init(struct scmi_device *dev) scmi_version_get(handle, SCMI_PROTOCOL_PERF, &version); - dev_dbg(handle->dev, "Performance Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); - pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/power.c b/drivers/firmware/arm_scmi/power.c index 6267111e38e6..29d72fa7d085 100644 --- a/drivers/firmware/arm_scmi/power.c +++ b/drivers/firmware/arm_scmi/power.c @@ -195,9 +195,6 @@ static int scmi_power_protocol_init(struct scmi_device *dev) scmi_version_get(handle, SCMI_PROTOCOL_POWER, &version); - dev_dbg(handle->dev, "Power Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); - pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index 76f1cee85a06..a49155628ccf 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -205,9 +205,6 @@ static int scmi_reset_protocol_init(struct scmi_device *dev) scmi_version_get(handle, SCMI_PROTOCOL_RESET, &version); - dev_dbg(handle->dev, "Reset Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); - pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL); if (!pinfo) return -ENOMEM; diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index fb3bed4cb171..61e12f2fb587 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -286,9 +286,6 @@ static int scmi_sensors_protocol_init(struct scmi_device *dev) scmi_version_get(handle, SCMI_PROTOCOL_SENSOR, &version); - dev_dbg(handle->dev, "Sensor Version %d.%d\n", - PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); - sinfo = devm_kzalloc(handle->dev, sizeof(*sinfo), GFP_KERNEL); if (!sinfo) return -ENOMEM; From patchwork Tue Dec 10 14:53: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: 181129 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606128och; Tue, 10 Dec 2019 06:54:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwcW1A6YQBWA0F6HF1JLG6RYuteNSYSM5lck1n1kwbOH9Vvac4SfxNhbX1L8ukrqTTqmJqp X-Received: by 2002:aca:48d6:: with SMTP id v205mr4142436oia.10.1575989668433; Tue, 10 Dec 2019 06:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989668; cv=none; d=google.com; s=arc-20160816; b=r0pmw+Cz2OdnE+ILkWGo9c8cPwjUL7IjrIIt0KvJLslZfQfZ9BcWg64nFbahwgsu2R CV4MxGIl9hqhMSp2KZeRyDQRFs4CahXp6kvrDv2Tr0XCKPA2P32aPwvPheGKwdzX/ab4 UGGI84xj/qruJ/PDtFXvv5HoiWs7ShIdMNi4FZHe0GA4fz5I1ijChZbkfAnFhJfSwBRu 0wKWRsjd5srr1Kkm9Rn/JXK9Sn2TFfKygCER4eyFXSsRmEE08aJjoUVCRc7NMBKtWW42 us5e1L+Ka5Z8gxAluv7stuBU/qiDQE01N/pv6/yK6N17ykkaLxb3RxgWLvdeukuvOsuA Ah6g== 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=Oh7xo40YxOdcE4UZGfBWNdm/oEeesryA4u0I5tR0Gqw=; b=tntH6oEwUKQD54DS//baTXGY8xmR5frMFKXOe6fQU+YEwZhP1EIiLCU02JkU2Wp0/i VgYbXzlsUFnR7bVwZT6gNAUxocWJ8BIzMM8I92AIVwyc5TjDj79TRbW9efLuLt1KeRpv NIuLEZbGi4mk9s0naj6Gr/ubZ9x/KSkh1cNsm0LUu9fyODGBJNKb2c3Yf1lQeHN0Tk8r UXWSVRyxZaSwtYwLHpGwhB/eZHIZSsWTb6BnenF3q8PWLxSLmZPa0qsWXgvs3yjjjv2f IMli4KMdf+46akXhBhmNWxGpdELgvL0vKWFWN9U9mAdlW5c3gcv8RodmCWTpjDr01oks nDzA== 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 j6si721501oij.197.2019.12.10.06.54.27; Tue, 10 Dec 2019 06:54: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 S1727793AbfLJOy0 (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:26 -0500 Received: from foss.arm.com ([217.140.110.172]:47166 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbfLJOyP (ORCPT ); Tue, 10 Dec 2019 09:54:15 -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 8F36C1396; Tue, 10 Dec 2019 06:54:14 -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 D72D53F67D; Tue, 10 Dec 2019 06:54:13 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi Subject: [PATCH 11/15] firmware: arm_scmi: Match scmi device by both name and protocol id Date: Tue, 10 Dec 2019 14:53:41 +0000 Message-Id: <20191210145345.11616-12-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/scmi_pm_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Cristian Marussi 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 Tue Dec 10 14:53: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: 181131 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606187och; Tue, 10 Dec 2019 06:54:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzeGpRgtUhduxt26Xkl8HADPOod5UjJt4f88JQCBbFIBjnyXwwbigmGES7TKX5oMeEzcjl5 X-Received: by 2002:aca:6204:: with SMTP id w4mr4300607oib.62.1575989673128; Tue, 10 Dec 2019 06:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989673; cv=none; d=google.com; s=arc-20160816; b=0Kbe/AFjG4qSyW6j5puIORSBARGe1KdFO7u4maIzhJvpzXfb367zVYi1JhP7OaKPoM Hj2sSkqodHH/nD4FgnAyHo98UXw8BQzJvx80L3CBrT8HrFQ5oq+LQWOo/ESvQwk1OhlN t4ovNeuI5o5LpeZz7L+gmjMnyVKM9TNFkSFZo6jNEWjt+V3C+gSPgj2D43HFQTaeX9uy xvmmnlLTtxH9r0cbtGomgoEAxsBwfs6r4qm43r/KvJIGboJaJ8IER1D6G+jfhwacqSyR qendruh0rBcXV+lOjDWsHq5qOKE5uRd79sO6cymlhnwUfn+zZEi+XcBveDYjE+YeSPZv i7XQ== 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=bZMgOetbnuzXUlNc4NbzFjwds3423xKv878VE10XA1Jhj0JERLrjPjoTOv8YMzaDU5 kySKfkkmvDu27gFNQ6H7nsUfq1dbF48UuJMP5Lrt7W3ANPPz6rGtpXxd33EEaPdKuuI0 NrHz5TOXK+MvM91uj4h3uVdCmZdaISW8HHWjuAQgyqBDPUmRfuH/1TaTsSZ/iwOsXpEw jqRHtExchhNjjPoVedwUeZvkhStZuXV6szqJFJC7L0HpTBmKEfe+Qv75JrVi44t1ibKA 7qSLgag4aewkrwtceMp0f4x9y3nQJGbQF+91UukNmKisdDiv8V7NslnAB3wYUraERoMX x4Nw== 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 j6si721501oij.197.2019.12.10.06.54.32; Tue, 10 Dec 2019 06:54:33 -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 S1727804AbfLJOy2 (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:28 -0500 Received: from foss.arm.com ([217.140.110.172]:47176 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727717AbfLJOyQ (ORCPT ); Tue, 10 Dec 2019 09:54:16 -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 D59B5113E; Tue, 10 Dec 2019 06:54:15 -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 C36A03F67D; Tue, 10 Dec 2019 06:54:14 -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 12/15] clk: scmi: Match scmi device by both name and protocol id Date: Tue, 10 Dec 2019 14:53:42 +0000 Message-Id: <20191210145345.11616-13-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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 Tue Dec 10 14:53:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181132 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606310och; Tue, 10 Dec 2019 06:54:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyvHnQFx/AwxZCO0+sWdpelONhJeivnC3GsWPs0l9ATjzlYANO+YjU/R/FwPp7Jpqwxa+xz X-Received: by 2002:aca:6204:: with SMTP id w4mr4301034oib.62.1575989681336; Tue, 10 Dec 2019 06:54:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989681; cv=none; d=google.com; s=arc-20160816; b=j+h1kYvs3nV1LSm8f7mY6Mp5f4DCWv6zv83tAOko6TYLjtJTQZqOR3dau5gZgoGiIK tAnRrBlxEdq94YldialU/PB68w7PxiOTxLg6AAOhU8Xj/wLEgwzX+RvYqln3XfTQriMl 96LyjvBfDCChynshNBGx4EsGNiQwj1byBIKHWBRcm+AqwTPfVaJ5RTz9ELMoSupkmlMb hrohLIXNiWZ/RWYTlxxvf/4L5hid0ZQLAs+15FvVMLZi1jspbBRYOBCgmkR1gff13q8a lbcdrwomo4QNUndS26GBdzi+cz0d6T3Q3QNeqHKdlgQ2wsP4QRZUPYKyn5L4Dej5qHVv 34yA== 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=oIY4TDZk7ruy1An6fqLlEoBO2bgOIN/142//2CELs/c=; b=uhv5fDgDne9r17cdzcucaCOmwo7ItYVzJQ0AbGHdp6+VuskgHnqS77cc22TgO8hD4l LvNCtyWl0QHNZafJOchkWQA3HTDv02zbLuB6vPXd8z3ddyD2xPGfHZPtfzuBbyd+HKXQ YkM9FXbFSl6mFzC53ZEk1Yp+IaV6xtR2/n9CldbIDhKVWnXEp7b9Rev062NSu08GJLYE DiwHVmSlqvQd1/BdNy9UH97w4WkslbrhzGI0dbCT/EpihXjZ3T1uUIdt6WmJyAlPhPOo 8aFp4nWVVRH5/f0EmHmJkJtczq9owXfDg3VqxKbgZRueI85bnBGS6Q1V/NQD2Wln/HDm gfSA== 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 j6si721501oij.197.2019.12.10.06.54.41; Tue, 10 Dec 2019 06:54:41 -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 S1727836AbfLJOyk (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:40 -0500 Received: from foss.arm.com ([217.140.110.172]:47198 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727756AbfLJOyS (ORCPT ); Tue, 10 Dec 2019 09:54:18 -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 589C71045; Tue, 10 Dec 2019 06:54:18 -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 512153F67D; Tue, 10 Dec 2019 06:54:17 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi , Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org Subject: [PATCH 14/15] hwmon: (scmi-hwmon) Match scmi device by both name and protocol id Date: Tue, 10 Dec 2019 14:53:44 +0000 Message-Id: <20191210145345.11616-15-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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 will help to add IIO support in parallel if needed. Cc: Jean Delvare 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 Tue Dec 10 14:53:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 181130 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp5606255och; Tue, 10 Dec 2019 06:54:37 -0800 (PST) X-Google-Smtp-Source: APXvYqwlbNsXAYVfPZLkAlw1kUCYDe0m7ZzEzdwDpJUTqHLe/3+53DA+YMxc+1+/QLEIU0kwFO4U X-Received: by 2002:a9d:282:: with SMTP id 2mr19283062otl.237.1575989677420; Tue, 10 Dec 2019 06:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575989677; cv=none; d=google.com; s=arc-20160816; b=qZVhUUVeWq/YYNVuQQaRHrarDYWY3T7VUosXtJ/tV4Q4fP8Sk1aFNVkC8KuyWDqzfz eRlrqlzkoMVn0d+nBl2J5Fw3nOPQKlZzchvK/V/tfqUmqThTusT39QZJ0NimS6wMR/VT ly6CqcB7JHYlK37wyG7X5KoJjZHEiYaQIj0aDAbyN1akUrq/1h0eZ7bSOm4vKUtv54r8 7mAkAtGCoZbyQq8NMPfdSEmwKffzrSFcr0K6zy15iRZl3cLxnKKE+AAw0U9Cw9d6m4P5 3v2l3XJCa2OjZWH4wGfA6L6x3dS1X6Ug5VBAEwSIFZqtPp+ZkvM9R3SYHZwTEkD8p8RK +AUQ== 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=e1JqMlasMb/AZnbyVmiHZ1esufG4uVlZNFdJYLqlgoA=; b=O0WpL6vstUWCNKyqt0lsLyRrz4MReAxyTz4wce2pv0LWOuPnvkljLxRLI/hqfhTCWs M6GW3spv3UkzJ8ZRhVePO2d2dl7y6rKwpijPebOLM4/psVkf+MmeSntru43Nq8ewfBfo oM//vDBvGsze0w+u1amHHx70etHxdztjQYKmbbWsNeHoL2SUeZzNmFPrF3HEdkvSbcaY 9DR8UBhOat5nsRVogv7cFpZ3O3red4QeYHDZEJ7rr3eOTqj7zwAG8bSHbeW5UVKdADuk kMjMHIw7dAPOceC3xuec/BaWORmOxwS1vhmlQcwywqOEf/6Y9doD+UPpcf7Kfu6Ll0s+ Kcvg== 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 j6si721501oij.197.2019.12.10.06.54.37; Tue, 10 Dec 2019 06:54:37 -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 S1727823AbfLJOyg (ORCPT + 27 others); Tue, 10 Dec 2019 09:54:36 -0500 Received: from foss.arm.com ([217.140.110.172]:47206 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727758AbfLJOyT (ORCPT ); Tue, 10 Dec 2019 09:54:19 -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 5F7B6113E; Tue, 10 Dec 2019 06:54:19 -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 8C6793F67D; Tue, 10 Dec 2019 06:54:18 -0800 (PST) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sudeep Holla , Cristian Marussi , Philipp Zabel Subject: [PATCH 15/15] reset: reset-scmi: Match scmi device by both name and protocol id Date: Tue, 10 Dec 2019 14:53:45 +0000 Message-Id: <20191210145345.11616-16-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210145345.11616-1-sudeep.holla@arm.com> References: <20191210145345.11616-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. Cc: Philipp Zabel Signed-off-by: Sudeep Holla --- drivers/reset/reset-scmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 Acked-by: Philipp Zabel 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);