From patchwork Thu Mar 28 02:19:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bibby Hsieh X-Patchwork-Id: 10874399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70F691575 for ; Thu, 28 Mar 2019 02:21:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5861C28715 for ; Thu, 28 Mar 2019 02:21:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B667288AF; Thu, 28 Mar 2019 02:21:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43C9628715 for ; Thu, 28 Mar 2019 02:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vXejBXud+6Ivt5b8gtfF0VPk6PSsgwAv3IN08Jt+4yc=; b=CltzLAUSVCPuM6 S6llXqMASWWd952yV2qYV15Kyv4q49qJ8os68lZooKOg67tIHR8I7jZVutEdBmQ1NkXIizvdc9aiP a8M3v/J5ccAijLKQfkvxqBTVVVGdin9v6x0cn5+JJ22vh1X3ILYrmzy/gdFRipYusfLpqFZJwFWTP S3FkrR5j+1OZfotRW8KvlytRsSE8sr/QLv4wlL1Agl988oTwHou/b80HN0nfP7Fy08yu9V/+58G4n 3g7ZA8juErB6bJCEfLF9RJ3XYR6/KhtZzSzn7MP/GLrK+VrE9g0qHaEYJmvkxKeb0AL4GG8KYbIhW Dn3ZZM5/iphrPs8Jhi0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9Kf1-0004CQ-Jq; Thu, 28 Mar 2019 02:20:55 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9Ke6-0001oO-D9; Thu, 28 Mar 2019 02:20:08 +0000 X-UUID: eb4c74d744134c37b31941c1d1dfcce5-20190327 X-UUID: eb4c74d744134c37b31941c1d1dfcce5-20190327 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1902581093; Wed, 27 Mar 2019 18:19:39 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 19:19:38 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 28 Mar 2019 10:19:36 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 28 Mar 2019 10:19:36 +0800 From: Bibby Hsieh To: Jassi Brar , Matthias Brugger , Rob Herring , CK HU Subject: [PATCH v3 11/12] soc: mediatek: cmdq: add cmdq_dev_get_event function Date: Thu, 28 Mar 2019 10:19:32 +0800 Message-ID: <1553739573-19708-12-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1553739573-19708-1-git-send-email-bibby.hsieh@mediatek.com> References: <1553739573-19708-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190327_191958_997908_966F9ECB X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Nicolas Boichat , Philipp Zabel , srv_heupstream@mediatek.com, Daoyuan Huang , Sascha Hauer , linux-kernel@vger.kernel.org, Dennis-YC Hsieh , kendrick.hsu@mediatek.com, linux-mediatek@lists.infradead.org, Houlong Wei , Sascha Hauer , Frederic Chen , Jiaguang Zhang , Bibby Hsieh , linux-arm-kernel@lists.infradead.org, ginny.chen@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When client ask gce to clear or wait for event, client need to pass event number to the API. We suggest client store the event information in device node, so we provide an API for client parse the event property. Signed-off-by: Bibby Hsieh --- drivers/soc/mediatek/mtk-cmdq-helper.c | 32 ++++++++++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 12 ++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 2def9dc..58ce53c 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -72,6 +72,38 @@ struct cmdq_subsys *cmdq_dev_get_subsys(struct device *dev, int idx) } EXPORT_SYMBOL(cmdq_dev_get_subsys); +s32 cmdq_dev_get_event(struct device *dev, const char *name) +{ + s32 index = 0; + struct of_phandle_args spec; + s32 result; + + if (!dev) + return -EINVAL; + + index = of_property_match_string(dev->of_node, + "mediatek,gce-event-names", name); + if (index < 0) { + dev_err(dev, "no gce-event-names property or no such event:%s", + name); + + return index; + } + + if (of_parse_phandle_with_args(dev->of_node, "mediatek,gce-events", + "#event-cells", index, &spec)) { + dev_err(dev, "can't parse gce-events property"); + + return -ENODEV; + } + + result = spec.args[0]; + of_node_put(spec.np); + + return result; +} +EXPORT_SYMBOL(cmdq_dev_get_event); + static void cmdq_client_timeout(struct timer_list *t) { struct cmdq_client *client = from_timer(client, t, timer); diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 574006c..1588435 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -160,4 +160,16 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, */ struct cmdq_subsys *cmdq_dev_get_subsys(struct device *dev, int idx); +/** + * cmdq_dev_get_event() - parse event from the device node of CMDQ client + * @dev: device of CMDQ mailbox client + * @name: the name of desired event + * + * Return: CMDQ event number + * + * Help CMDQ client pasing the event number + * from the device node of CMDQ client. + */ +s32 cmdq_dev_get_event(struct device *dev, const char *name); + #endif /* __MTK_CMDQ_H__ */