linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jolly Shah <jolly.shah@xilinx.com>
To: <ard.biesheuvel@linaro.org>, <mingo@kernel.org>,
	<gregkh@linuxfoundation.org>, <matt@codeblueprint.co.uk>,
	<sudeep.holla@arm.com>, <hkallweit1@gmail.com>,
	<keescook@chromium.org>, <dmitry.torokhov@gmail.com>,
	<mturquette@baylibre.com>, <sboyd@codeaurora.org>,
	<michal.simek@xilinx.com>, <robh+dt@kernel.org>,
	<mark.rutland@arm.com>, <linux-clk@vger.kernel.org>
Cc: <rajanv@xilinx.com>, <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	Jolly Shah <jollys@xilinx.com>
Subject: [PATCH v6 09/11] firmware: xilinx: Add debugfs for clock control APIs
Date: Tue, 10 Apr 2018 12:38:45 -0700	[thread overview]
Message-ID: <1523389127-14243-10-git-send-email-jollys@xilinx.com> (raw)
In-Reply-To: <1523389127-14243-1-git-send-email-jollys@xilinx.com>

From: Rajan Vaja <rajanv@xilinx.com>

Add debugfs file to control clocks using firmware APIs
through debugfs interface.

Signed-off-by: Rajan Vaja <rajanv@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
---
 drivers/firmware/xilinx/zynqmp-debug.c | 48 ++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
index 1cb69f7..837fcd1 100644
--- a/drivers/firmware/xilinx/zynqmp-debug.c
+++ b/drivers/firmware/xilinx/zynqmp-debug.c
@@ -34,6 +34,15 @@ static struct pm_api_info pm_api_list[] = {
 	PM_API(PM_GET_API_VERSION),
 	PM_API(PM_IOCTL),
 	PM_API(PM_QUERY_DATA),
+	PM_API(PM_CLOCK_ENABLE),
+	PM_API(PM_CLOCK_DISABLE),
+	PM_API(PM_CLOCK_GETSTATE),
+	PM_API(PM_CLOCK_SETDIVIDER),
+	PM_API(PM_CLOCK_GETDIVIDER),
+	PM_API(PM_CLOCK_SETRATE),
+	PM_API(PM_CLOCK_GETRATE),
+	PM_API(PM_CLOCK_SETPARENT),
+	PM_API(PM_CLOCK_GETPARENT),
 };
 
 /**
@@ -87,6 +96,7 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 	const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 	u32 pm_api_version;
 	int ret;
+	u64 rate;
 
 	if (!eemi_ops)
 		return -ENXIO;
@@ -132,6 +142,44 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 				pm_api_ret[2], pm_api_ret[3]);
 		break;
 	}
+	case PM_CLOCK_ENABLE:
+		ret = eemi_ops->clock_enable(pm_api_arg[0]);
+		break;
+	case PM_CLOCK_DISABLE:
+		ret = eemi_ops->clock_disable(pm_api_arg[0]);
+		break;
+	case PM_CLOCK_GETSTATE:
+		ret = eemi_ops->clock_getstate(pm_api_arg[0], &pm_api_ret[0]);
+		if (!ret)
+			sprintf(debugfs_buf, "Clock state: %u\n",
+				pm_api_ret[0]);
+		break;
+	case PM_CLOCK_SETDIVIDER:
+		ret = eemi_ops->clock_setdivider(pm_api_arg[0], pm_api_arg[1]);
+		break;
+	case PM_CLOCK_GETDIVIDER:
+		ret = eemi_ops->clock_getdivider(pm_api_arg[0], &pm_api_ret[0]);
+		if (!ret)
+			sprintf(debugfs_buf, "Divider Value: %d\n",
+				pm_api_ret[0]);
+		break;
+	case PM_CLOCK_SETRATE:
+		ret = eemi_ops->clock_setrate(pm_api_arg[0], pm_api_arg[1]);
+		break;
+	case PM_CLOCK_GETRATE:
+		ret = eemi_ops->clock_getrate(pm_api_arg[0], &rate);
+		if (!ret)
+			sprintf(debugfs_buf, "Clock rate :%llu\n", rate);
+		break;
+	case PM_CLOCK_SETPARENT:
+		ret = eemi_ops->clock_setparent(pm_api_arg[0], pm_api_arg[1]);
+		break;
+	case PM_CLOCK_GETPARENT:
+		ret = eemi_ops->clock_getparent(pm_api_arg[0], &pm_api_ret[0]);
+		if (!ret)
+			sprintf(debugfs_buf,
+				"Clock parent Index: %u\n", pm_api_ret[0]);
+		break;
 	default:
 		sprintf(debugfs_buf, "Unsupported PM-API request\n");
 		ret = -EINVAL;
-- 
2.7.4

  parent reply	other threads:[~2018-04-10 19:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 19:38 [PATCH v6 00/11] drivers: Introduce firmware dnd clock river for ZynqMP core Jolly Shah
2018-04-10 19:38 ` [PATCH v6 01/11] dt-bindings: firmware: Add bindings for ZynqMP firmware Jolly Shah
2018-04-13 15:15   ` Rob Herring
2018-04-23 11:56     ` Greg KH
2018-04-10 19:38 ` [PATCH v6 02/11] firmware: xilinx: Add Zynqmp firmware driver Jolly Shah
2018-05-10 14:04   ` Sudeep Holla
2018-05-14 19:06     ` Jolly Shah
2018-04-10 19:38 ` [PATCH v6 03/11] firmware: xilinx: Add zynqmp IOCTL API for device control Jolly Shah
2018-05-10 14:09   ` Sudeep Holla
2018-05-14 19:11     ` Jolly Shah
2018-04-10 19:38 ` [PATCH v6 04/11] firmware: xilinx: Add query data API Jolly Shah
2018-05-10 14:12   ` Sudeep Holla
2018-05-14 19:16     ` Jolly Shah
2018-05-15  9:34       ` Sudeep Holla
2018-05-15 20:29         ` Jolly Shah
2018-04-10 19:38 ` [PATCH v6 05/11] firmware: xilinx: Add clock APIs Jolly Shah
2018-04-10 19:38 ` [PATCH v6 06/11] firmware: xilinx: Add debugfs interface Jolly Shah
2018-05-10 14:26   ` Sudeep Holla
2018-04-10 19:38 ` [PATCH v6 07/11] firmware: xilinx: Add debugfs for IOCTL API Jolly Shah
2018-04-10 19:38 ` [PATCH v6 08/11] firmware: xilinx: Add debugfs for query data API Jolly Shah
2018-04-10 19:38 ` Jolly Shah [this message]
2018-05-10 14:31   ` [PATCH v6 09/11] firmware: xilinx: Add debugfs for clock control APIs Sudeep Holla
2018-05-14 19:18     ` Jolly Shah
2018-05-15  8:57       ` Sudeep Holla
2018-05-25 19:23         ` Jolly Shah
2018-04-10 19:38 ` [PATCH v6 10/11] dt-bindings: clock: Add bindings for ZynqMP clock driver Jolly Shah
2018-04-16 21:28   ` Rob Herring
2018-04-10 19:38 ` [PATCH v6 11/11] drivers: clk: Add " Jolly Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1523389127-14243-10-git-send-email-jollys@xilinx.com \
    --to=jolly.shah@xilinx.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hkallweit1@gmail.com \
    --cc=jollys@xilinx.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=michal.simek@xilinx.com \
    --cc=mingo@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=rajanv@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).