Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4356765imu; Mon, 28 Jan 2019 23:33:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN4g8hMkiBt0opm0GP6WqI5ls8hfMpK1jZOyGL8rIyH55Tod7/l85ZLFRwLH+WfkzHylTgAz X-Received: by 2002:a17:902:5a5:: with SMTP id f34mr25021871plf.161.1548747235850; Mon, 28 Jan 2019 23:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548747235; cv=none; d=google.com; s=arc-20160816; b=sGszULtqGIpjg7jmDpxgiY9Gw4YgLSyl/xAzB3TGtLuaoHWbfTIg+9BzVsDFCYXjJM aJ4WtL0kpu+y3rNMUcF7QMRWfu3/WRLg7+bwxKf13lGEHaC/0dUw0kw6f+ccacMPOEBz 3EjzwFzKD6voKD6qha0i/utH6j/KFIIE1f6V223TtAKmje1UBpczED+6yrM4uhbDbjMz ZtsX/7WtI4grZMYSugIvvRWiNNjSVBHrSMY68H1KT0fnaHnJKeWkInAiTj5ColHPgJN8 nIShJmwM8BDDMVTd7/gFgGohESBxVIdhgrT3piECW8JbgGFIRjaZHw4yV4st5HE/LxXV HISQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=WQtaQOrAP1hyqiwH/FlyjEgzvRKgxJyety+J8k9qjI8=; b=DsGlRUOrT88uicd6geAAPvjsfr4PG0aiHQOsSVbXR0VaO8DFkkyEfXIdWbLFbMiA4G Fu5vMv19e5+7kr7WtjIhL8BrENw/NteyXjgK1M7kBHJZ6Lsk4igHr9rvCR4M82oItzYe jDKft+VHC7RpXgCRz/dTnsSed01ywPFqBFz/3l4cMlPDKVQ5mfTcWGCp8L5iUVi1JexW 1hOUBGzfxeZL/hxMLIg+cPdH91jaIF+maG+PvLHYakv+QXnXzLHAe6Q2kdFebbHeQ0u6 xfp4Q1FuWe3dcs7CcG7/Df9UNsm5VtcN4FyCsyErbdCtyiD6+9+JMFe6qrxxYwYCHBoF 5tVQ== 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 r12si34757670plo.59.2019.01.28.23.33.40; Mon, 28 Jan 2019 23:33:55 -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 S1727397AbfA2Hcz (ORCPT + 99 others); Tue, 29 Jan 2019 02:32:55 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:5051 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725730AbfA2HcY (ORCPT ); Tue, 29 Jan 2019 02:32:24 -0500 X-UUID: 56c795c76bef427687a5aa4530569ff0-20190129 X-UUID: 56c795c76bef427687a5aa4530569ff0-20190129 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1057086815; Tue, 29 Jan 2019 15:32:16 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 29 Jan 2019 15:32:12 +0800 Received: from mtkslt302.mediatek.inc (10.21.14.115) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 29 Jan 2019 15:32:12 +0800 From: Bibby Hsieh To: Jassi Brar , Matthias Brugger , Rob Herring , CK HU CC: Daniel Kurtz , Sascha Hauer , , , , , , Sascha Hauer , Philipp Zabel , Nicolas Boichat , Bibby Hsieh , YT Shen , Daoyuan Huang , Jiaguang Zhang , Dennis-YC Hsieh , Houlong Wei , , , Frederic Chen Subject: [PATCH 07/10] soc: mediatek: add cmdq_dev_get_event function Date: Tue, 29 Jan 2019 15:32:04 +0800 Message-ID: <1548747128-60136-8-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> References: <1548747128-60136-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 4CE45F2FC5B550B8AC8860B88ABAAB76010FFFB65353564D761C9F06C5D9EEAB2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 29 +++++++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 1 + 2 files changed, 30 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 6ad997f..16c0393 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -56,6 +56,35 @@ struct cmdq_base *cmdq_register_device(struct device *dev) } EXPORT_SYMBOL(cmdq_register_device); +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, "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, "gce-events", + "#gce-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 a1f5eb6..e5b0a98 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -139,5 +139,6 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb, u8 cmdq_subsys_base_to_id(struct cmdq_base *clt_base, u32 base); struct cmdq_base *cmdq_register_device(struct device *dev); +s32 cmdq_dev_get_event(struct device *dev, const char *name); #endif /* __MTK_CMDQ_H__ */ -- 1.9.1