Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4011026imb; Wed, 6 Mar 2019 03:07:43 -0800 (PST) X-Google-Smtp-Source: APXvYqztpE+z/xdG9P+Q5wO6BUGe5XczGneeof7Dq4Kym2kj1nNeDuaDfY/4FMFxpVI5qOveFvNW X-Received: by 2002:a63:2c4c:: with SMTP id s73mr5833915pgs.113.1551870463860; Wed, 06 Mar 2019 03:07:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551870463; cv=none; d=google.com; s=arc-20160816; b=BHnlgKbJji8qWlvY/x8Ae1FFAvOFWuMhD2Q34/L15ol3CIFJPOulbS+qQQzHhdNsaf Fxw3cwlzSN3c514kxBeObCl8X08FChLwblXagNSa6THSJ62QY2qxTytsi3iQvQFiQTDv NP6JP7fZCOeP04rlGR4nXRFTLaWVdXc+IwSvoxNLOfb9H5ApwPQMZ9GPQ73dhdG4kvyj O1gkY5NmbsuuK+I8WONugHbSE+qwehQ2Xidl5mm0PO1f4Z445bEHbvXLjlSaZrj3abWX 6ZJi5c/0XKMeh4IPtv2+a8oHrkgNe+k+WY8syAKf6Yo6BpWfQLBI/DNMhDNn5gx8/XqN rNpQ== 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=yA/qPToiNxkRqOeHvSdNW/79lOu9hXc9M6HGyrStdWk=; b=ZiGm+9iT2gmo5YE2uKmDzBdThlbeqRItCZhnJPsGHJEAYLJwchM5gW5BMneTL2xK8i v0mGHr3y7mpTkShniKEqE4zEcu+bbEL6ja9wFTBW6h0L+y3e72L5QIYLmJ1r2WjrDcua jOvLHa/B2qPtPNOEfYPI2Gy31OVFY9SGso2BFFf3SEF1aJh+yw/wOdu4ZRPQwQeGeO4r vm7/en4rsLuqCslk16J4LQmmV68TJCW/+oy30R/Mzlue60ZdeYU2sFHzZ/oFqs5gI1/Z f5FTCV6kxDsSLGpSC5iJqa2bi2N+b9V87lIPX2qCmc1WdXD7EQrcMnF5wYjXTtBRxYCE yAzg== 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 c132si1354329pfg.5.2019.03.06.03.07.28; Wed, 06 Mar 2019 03:07:43 -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 S1729947AbfCFJu6 (ORCPT + 99 others); Wed, 6 Mar 2019 04:50:58 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:29190 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729906AbfCFJu4 (ORCPT ); Wed, 6 Mar 2019 04:50:56 -0500 X-UUID: 6ea47da22e344777bfac4e6ac486ae40-20190306 X-UUID: 6ea47da22e344777bfac4e6ac486ae40-20190306 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1110594604; Wed, 06 Mar 2019 17:50:40 +0800 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; Wed, 6 Mar 2019 17:50:38 +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; Wed, 6 Mar 2019 17:50:38 +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 v2 10/10] soc: mediatek: cmdq: add cmdq_dev_get_event function Date: Wed, 6 Mar 2019 17:50:35 +0800 Message-ID: <1551865835-50974-11-git-send-email-bibby.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1551865835-50974-1-git-send-email-bibby.hsieh@mediatek.com> References: <1551865835-50974-1-git-send-email-bibby.hsieh@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain 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 | 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 0a9609e..ab49673 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -71,6 +71,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 e39ba1e..2abfb45 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -159,4 +159,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__ */ -- 1.9.1