Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4108282imu; Tue, 18 Dec 2018 09:10:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9ZeVaXvzhk3zW68mIPlJij7QhsOAzGUQkK8ukBwHA90p3f27Sp7nwFjSLgP1Sp+BPq75W X-Received: by 2002:a62:8e19:: with SMTP id k25mr17365820pfe.185.1545153014324; Tue, 18 Dec 2018 09:10:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545153014; cv=none; d=google.com; s=arc-20160816; b=BYU+CsLNpPN5XR1VJXqnX4340bSMF4kBkIAtfkiOutmCCBBXZt09HqMzB8g/HsGiIZ HDLoyCBSZIWz6lqHIxMz+yQelZF2LIw0HGDV7Ez2h/VojJykAOVThqJvyb18K2t51ByY Z+PO2PMCDVdXqOuJ7SSqLu3lhnwrmFDsKy4YGVsyiL+LlYkadCFiTyn4DvljA6dFkCDg hxZj4/pylWOwxcwr2JjLzbUD1u5B2pLGzSftOp4ZFH89TYhp4gby9Kt0OYzGyJH8rP7h ffqLlj207HBlwRPFnN0psFvJUunIhPIHRRzJBRbzZng6o11jrihpJXT1J3F179sjVfFp 36cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=7iV38FSawx+T+n6HAhZcp2XGXU7yuE9V0HDRQFbllik=; b=pabj5BRj6/WfSLufJb9GCykgafN4NqMsPt1rmdv+qVOJrJokY5QgGpqopfTsFZbGm7 bRbk/cJvTvb+mxu/SGY5PkzlnIF0mJlu2koI44FIgFrdB8pZpxUQLO7YP+MFj+dfcyrg 9KrWIefK/Ctpypep0bXdsM70fsNSHew+B2eO0FiSwgCfeQLefgH77pEcDb5m/YXdn21h TfH7DJxowjBntWr0maTJ971l6CPL9IyGWzSAzqqDRxMO9utFG7HKtSEMVR1RTZlPMqEG WyazzGkkx43NrQ5MtqJpLN2zQQK95HY2f4Du8KHv0X7P9ADcMf47Zme20k68O6xNarcV BqSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=X7rlwMEp; dkim=pass header.i=@codeaurora.org header.s=default header.b=RrPw3yiR; 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 a193si15262271pfa.214.2018.12.18.09.09.41; Tue, 18 Dec 2018 09:10: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; dkim=pass header.i=@codeaurora.org header.s=default header.b=X7rlwMEp; dkim=pass header.i=@codeaurora.org header.s=default header.b=RrPw3yiR; 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 S1727163AbeLRRIS (ORCPT + 99 others); Tue, 18 Dec 2018 12:08:18 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:48942 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726899AbeLRRIS (ORCPT ); Tue, 18 Dec 2018 12:08:18 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6696E605A5; Tue, 18 Dec 2018 17:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1545152897; bh=aYJkrPOgJuHwT8PEc3wRoJtoLpp5dPqY7ziQqra9rAM=; h=From:To:Cc:Subject:Date:From; b=X7rlwMEpkGrrrE+U5PAhlj6nImLXrwYgawYhsDEweYXwqHl8/ZMzampmnyP9xOPxs fYatT79g1Kr0LfcLDaRrj43+AWZNAWiElkrODurcba1rTT7v0cypOOtIrbX2P5yD4O hVd4WPVHhznmmpzWDpRcTDzTZyAplUoU48V+Ai48= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from jhugo-perf-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D7A2C605A5; Tue, 18 Dec 2018 17:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1545152896; bh=aYJkrPOgJuHwT8PEc3wRoJtoLpp5dPqY7ziQqra9rAM=; h=From:To:Cc:Subject:Date:From; b=RrPw3yiR0XE2bZ+U0c96wnL1pv5bc58o4ImlNusPSUS03pHCk3GWBVubtF/bYuy9p 3pvcLB3e51tWX5V5IpKv4+l4SJ0oG0lJYdwndeqw+fKHs/Qx2+Cz1ZznPDjd2WDdyr h3Jv5Tjgvc2//zCH4NPnF0hlc+/ewCebcroyOMEc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D7A2C605A5 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org From: Jeffrey Hugo To: mturquette@baylibre.com, sboyd@kernel.org, andy.gross@linaro.org, david.brown@linaro.org Cc: bjorn.andersson@linaro.org, linux-clk@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH] clk: qcom: List rates in debugfs for rcg Date: Tue, 18 Dec 2018 10:08:04 -0700 Message-Id: <1545152884-768-1-git-send-email-jhugo@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RCGs typically have multiple frequencies they can support based on client requests. It can be very helpful to have a list of what are the supported frequencies when attempting to bringup or debug a new device. Add a clock specific "list_rates" debugfs file which dumps the supported rates of a selected rcg in a convenient format. Signed-off-by: Jeffrey Hugo --- drivers/clk/qcom/clk-rcg2.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index 6e3bd19..e4b1d35 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include @@ -347,6 +349,36 @@ static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw, return __clk_rcg2_set_rate(hw, rate, FLOOR); } +static int rcg2_list_rates_show(struct seq_file *m, void *unused) +{ + struct clk_rcg2 *rcg = m->private; + const struct freq_tbl *f; + + if (rcg->freq_tbl) + for (f = rcg->freq_tbl; f->freq; f++) + seq_printf(m, "%lu\n", f->freq); + + return 0; +} + +static int rcg2_list_rates_open(struct inode *inode, struct file *file) +{ + return single_open(file, rcg2_list_rates_show, inode->i_private); +} + +static const struct file_operations rcg2_list_rates_fops = { + .open = rcg2_list_rates_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + +static void clk_rcg2_debug_init(struct clk_hw *hw, struct dentry *dentry) +{ + debugfs_create_file("list_rates", 0444, dentry, to_clk_rcg2(hw), + &rcg2_list_rates_fops); +} + const struct clk_ops clk_rcg2_ops = { .is_enabled = clk_rcg2_is_enabled, .get_parent = clk_rcg2_get_parent, @@ -355,6 +387,7 @@ static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw, .determine_rate = clk_rcg2_determine_rate, .set_rate = clk_rcg2_set_rate, .set_rate_and_parent = clk_rcg2_set_rate_and_parent, + .debug_init = clk_rcg2_debug_init, }; EXPORT_SYMBOL_GPL(clk_rcg2_ops); -- Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.