Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp506725pxb; Tue, 3 Nov 2020 05:32:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJymwC36y/ugL49770hb0ULKu/Rl8c+8uplBFHC/CaSGa5nI/W6fVJfYwsrOPdByQuDct+dz X-Received: by 2002:aa7:df04:: with SMTP id c4mr12074269edy.25.1604410335761; Tue, 03 Nov 2020 05:32:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604410335; cv=none; d=google.com; s=arc-20160816; b=RgkCUC1VLf2/B9xcOIqXp2P8a/EVv9MCqt8+qlWHL1IM4HufeixZIhc7FxOyeNhmD4 shI5/p/E+YKlvjJqBuWVOlCakWQRu1rnsWK9JhP36rpFDWZ9kwrtNS/YbrWs1PnfMzfq 59JXS/daDombRDbASFpo4UCvznw9hc5pVc2pCy0gjxyLmO2FqVV5kCLzbo3r/Gyv55Gd 8Hm++s+WyjkOujF/UZ/u4zOMXoeD00c++8m5ei02adrZP0B51mtFQOh0T628q4nc6qWP SDlkCBK2RGMeCpmpFz7lbCmip1BS35yDooeDMkVGDDPVXADIo88v8xYdSgT47/xYIqX6 XbjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=NlUD522q1UZNeJibuUElRVCfmzqNBBfP4N2mc7yBIMU=; b=qXfxovYToy40yPfMyHeSfzDHq6Sy6YtkSSvlxpm3/KByUB9mIJ3+/N3cumXou25aaq l8k2O6xijaQgUjaQTNOZfN44W6nPSkqfjMmo1LOXhzNRrM2xbXZCwle5e+biojUyJwhK gaWLeanvsag7V1ddmNs/qbsNHxm0DHvndJeTJqYP2G9gHUqFFNKQyQSHhK8tDcNmhSxo wCThRiO/q+2jEJTPPA9o9F7cWBrxBAiefnvJAhKiYIFGuToPjNzaz8sSh60uehLfDrEH dnU3ryyJ3Bv8LN+W75hcU559tMfcbdmh5/MrTjybn6JMNGBfQKq+5T5erLewRpqzV7bi XxDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=KX+l3mmJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d11si12293479edj.223.2020.11.03.05.31.52; Tue, 03 Nov 2020 05:32:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=KX+l3mmJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729324AbgKCN3Q (ORCPT + 99 others); Tue, 3 Nov 2020 08:29:16 -0500 Received: from z5.mailgun.us ([104.130.96.5]:30930 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729216AbgKCN2Y (ORCPT ); Tue, 3 Nov 2020 08:28:24 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604410104; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=NlUD522q1UZNeJibuUElRVCfmzqNBBfP4N2mc7yBIMU=; b=KX+l3mmJYISHkHhz3MYqZqp4m20gQz3KKHIOEkuyUs3etdPYgrFMfr4yMig02RLqNouVt//v Cq+DtXgADluPWRTq1PptaHmomSpg8gPRoDniSy3AbbUs3dRifptK8KPS49Fn9lITVNoX7JgD ryD2SwFtL78KgtKl/tP4u/E9HQQ= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 5fa15af723306fb6028ce10f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 03 Nov 2020 13:28:23 GMT Sender: clew=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7947BC43452; Tue, 3 Nov 2020 03:19:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from swarchsd3-linux.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: clew) by smtp.codeaurora.org (Postfix) with ESMTPSA id B7381C433B1; Tue, 3 Nov 2020 03:19:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B7381C433B1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=clew@codeaurora.org From: Chris Lew To: bjorn.andersson@linaro.org, agross@kernel.org Cc: sibis@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, clew@codeaurora.org Subject: [PATCH 2/2] soc: qcom: aoss: Add debugfs send entry Date: Mon, 2 Nov 2020 19:19:01 -0800 Message-Id: <1604373541-12641-2-git-send-email-clew@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1604373541-12641-1-git-send-email-clew@codeaurora.org> References: <1604373541-12641-1-git-send-email-clew@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It can be useful to control the different power states of various parts of hardware for device testing. Add a debugfs node to send messages through qmp to aoss for debugging and testing purposes. Signed-off-by: Chris Lew --- drivers/soc/qcom/qcom_aoss.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index 8f052db1880a..2fd755d2a92d 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -4,6 +4,7 @@ */ #include #include +#include #include #include #include @@ -85,6 +86,8 @@ struct qmp { struct clk_hw qdss_clk; struct genpd_onecell_data pd_data; struct qmp_cooling_device *cooling_devs; + + struct dentry *debugfs_fp; }; struct qmp_pd { @@ -541,6 +544,34 @@ struct qmp_device *qmp_get(struct device_node *np) } EXPORT_SYMBOL_GPL(qmp_get); +static ssize_t aoss_dbg_write(struct file *file, const char __user *userstr, + size_t len, loff_t *pos) +{ + struct qmp *qmp = file->private_data; + char buf[QMP_MSG_LEN] = {}; + int ret; + + if (!len || len >= QMP_MSG_LEN) + return len; + + ret = copy_from_user(buf, userstr, len); + if (ret) { + dev_err(qmp->dev, "copy from user failed, ret:%d\n", ret); + return len; + } + + ret = qmp_send(qmp, buf, QMP_MSG_LEN); + if (ret) + dev_err(qmp->dev, "debug send failed, ret:%d\n", ret); + + return len; +} + +static const struct file_operations aoss_dbg_fops = { + .open = simple_open, + .write = aoss_dbg_write, +}; + static int qmp_probe(struct platform_device *pdev) { struct resource *res; @@ -595,6 +626,9 @@ static int qmp_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qmp); + qmp->debugfs_fp = debugfs_create_file("aoss_send_message", 0220, NULL, + qmp, &aoss_dbg_fops); + return 0; err_remove_qdss_clk: @@ -611,6 +645,8 @@ static int qmp_remove(struct platform_device *pdev) { struct qmp *qmp = platform_get_drvdata(pdev); + debugfs_remove(qmp->debugfs_fp); + qmp_qdss_clk_remove(qmp); qmp_pd_remove(qmp); qmp_cooling_devices_remove(qmp); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project