From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25E47C433DF for ; Sun, 24 May 2020 17:39:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC8B22073B for ; Sun, 24 May 2020 17:39:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NVNuj+/X"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uVtaZAO0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC8B22073B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7hmpbHFN2JAcI4UG7IbXJ89a1/c8AG1IATDBoJKA2X8=; b=NVNuj+/XHfugLL kVxreNoDrZEJFRzFRJsgGz02C+zxJmJu77OxhwcB7PNYCJ29BYQ5ne3DxjtqELvPZRYEHd17rX5aB NdV316HtgZZPWwOBIzztDD3HxLpa7HfGywyWWGf1R0KoL3NJthVLSekKYhtW0eWkIg8GRzMep+Py7 E2Gco69m9diASXAKkR+ukZYOF0bFon6fA7zc4UaI74Iz679s7Bj5w/fXTgo6DXzdO7elFy8oDTnTJ cHdOLbZc2P+ciDq5535Yn2hi1M7emecdiV4CdXXFA+yzkz/HBK00uOk6jL+8rloWiU/H/UnUinxwQ fxdZLxFsPnibmq6P4aQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcub1-00086V-BH; Sun, 24 May 2020 17:39:35 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcuax-00085Q-Qe; Sun, 24 May 2020 17:39:33 +0000 X-UUID: 3ad4a9a503d64c7987de6ef5e185629d-20200524 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=Budt1Q/YKyyHz1LfMtaltAftGMWuXZGR8k5sFbQgD9I=; b=uVtaZAO0ztm5vjRXLPBVsHPSqkJDUZIT8Nku1f1uGLGcCikpf2MC6DJ/gmfZeJ0MeCFEAy7xDlaiL0bmnyCP0fgET1W/KvHNQHdIklTni3sMIPiLSHhAbNoH4R2GDlr7qdRcAW8vI+P1bdK98QyCkiNNdtt+8u4E6X3ufujFITo=; X-UUID: 3ad4a9a503d64c7987de6ef5e185629d-20200524 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 257335477; Sun, 24 May 2020 09:38:59 -0800 Received: from mtkmbs05n1.mediatek.inc (172.21.101.15) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 24 May 2020 10:39:24 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 25 May 2020 01:39:22 +0800 Received: from [172.21.77.33] (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 25 May 2020 01:39:22 +0800 Message-ID: <1590341965.31286.27.camel@mtkswgap22> Subject: Re: [PATCH v5 13/13] soc: mediatek: cmdq: add set event function From: Dennis-YC Hsieh To: Matthias Brugger Date: Mon, 25 May 2020 01:39:25 +0800 In-Reply-To: References: <1583664775-19382-1-git-send-email-dennis-yc.hsieh@mediatek.com> <1583664775-19382-14-git-send-email-dennis-yc.hsieh@mediatek.com> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200524_103931_871258_7721F1DC X-CRM114-Status: GOOD ( 18.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Philipp Zabel , wsd_upstream@mediatek.com, David Airlie , Jassi Brar , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, HS Liao , Rob Herring , linux-mediatek@lists.infradead.org, Houlong Wei , Daniel Vetter , CK Hu , Bibby Hsieh , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Matthias, Thanks for your comment. On Sat, 2020-05-16 at 20:32 +0200, Matthias Brugger wrote: > > On 08/03/2020 11:52, Dennis YC Hsieh wrote: > > Add set event function in cmdq helper functions to set specific event. > > > > Signed-off-by: Dennis YC Hsieh > > Reviewed-by: CK Hu > > --- > > drivers/soc/mediatek/mtk-cmdq-helper.c | 15 +++++++++++++++ > > include/linux/mailbox/mtk-cmdq-mailbox.h | 1 + > > include/linux/soc/mediatek/mtk-cmdq.h | 9 +++++++++ > > 3 files changed, 25 insertions(+) > > > > diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c > > index ec5637d43254..3294c9285994 100644 > > --- a/drivers/soc/mediatek/mtk-cmdq-helper.c > > +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c > > @@ -327,6 +327,21 @@ int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event) > > } > > EXPORT_SYMBOL(cmdq_pkt_clear_event); > > > > +int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) > > +{ > > + struct cmdq_instruction inst = { {0} }; > > + > > + if (event >= CMDQ_MAX_EVENT) > > + return -EINVAL; > > + > > + inst.op = CMDQ_CODE_WFE; > > + inst.value = CMDQ_WFE_UPDATE | CMDQ_WFE_UPDATE_VALUE; > > + inst.event = event; > > + > > + return cmdq_pkt_append_command(pkt, inst); > > +} > > +EXPORT_SYMBOL(cmdq_pkt_set_event); > > + > > int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, > > u16 offset, u32 value) > > { > > diff --git a/include/linux/mailbox/mtk-cmdq-mailbox.h b/include/linux/mailbox/mtk-cmdq-mailbox.h > > index 42d2a30e6a70..ba2d811183a9 100644 > > --- a/include/linux/mailbox/mtk-cmdq-mailbox.h > > +++ b/include/linux/mailbox/mtk-cmdq-mailbox.h > > @@ -17,6 +17,7 @@ > > #define CMDQ_JUMP_PASS CMDQ_INST_SIZE > > > > #define CMDQ_WFE_UPDATE BIT(31) > > +#define CMDQ_WFE_UPDATE_VALUE BIT(16) > > #define CMDQ_WFE_WAIT BIT(15) > > #define CMDQ_WFE_WAIT_VALUE 0x1 > > > > diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h > > index d63749440697..ca70296ae120 100644 > > --- a/include/linux/soc/mediatek/mtk-cmdq.h > > +++ b/include/linux/soc/mediatek/mtk-cmdq.h > > @@ -168,6 +168,15 @@ int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear); > > */ > > int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event); > > > > +/** > > + * cmdq_pkt_set_event() - append set event command to the CMDQ packet > > + * @pkt: the CMDQ packet > > + * @event: the desired event to be set > > Can we add the events and their code, so that later on, when a consumer calls > cmdq_pkt_set_event() we don't have any magic values that are hard to understand? Please see patch 02/13: http://lists.infradead.org/pipermail/linux-mediatek/2020-March/027801.html Definitions begin with CMDQ_EVENT_ is the event id to this function. Since the event id is different between platform, client must parse it from device tree. So no magic values require when call this function. Regard, Dennis > > Regards, > Matthias > > > + * > > + * Return: 0 for success; else the error code is returned > > + */ > > +int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event); > > + > > /** > > * cmdq_pkt_poll() - Append polling command to the CMDQ packet, ask GCE to > > * execute an instruction that wait for a specified > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel