mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tinghan Shen <tinghan.shen@mediatek.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Borislav Petkov <bp@suse.de>, Michal Suchanek <msuchanek@suse.de>,
	"Cristian Marussi" <cristian.marussi@arm.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Simon Trimmer <simont@opensource.cirrus.com>,
	"John Stultz" <john.stultz@linaro.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Allen-KH Cheng <allen-kh.cheng@mediatek.com>,
	YC Hung <yc.hung@mediatek.com>,
	Tzung-Bi Shih <tzungbi@google.com>,
	Curtis Malainey <cujomalainey@chromium.org>,
	Mark Brown <broonie@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<alsa-devel@alsa-project.org>,
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [RESEND PATCH v7 1/1] firmware: mediatek: add adsp ipc protocol interface
Date: Fri, 6 May 2022 19:39:24 +0800	[thread overview]
Message-ID: <ef0c621760d63c28ad97d4b7e8bef34660ea079c.camel@mediatek.com> (raw)
In-Reply-To: <YnQ9h6k0yFN8f+Ui@kroah.com>

Hi Greg,

On Thu, 2022-05-05 at 23:11 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 05, 2022 at 01:30:48PM +0800, Tinghan Shen wrote:
> > From: TingHan Shen <tinghan.shen@mediatek.com>
> > 
> > Some of mediatek processors contain
> > the Tensilica HiFix DSP for audio processing.
> > 
> > The communication between Host CPU and DSP firmware is
> > taking place using a shared memory area for message passing.
> > 
> > ADSP IPC protocol offers (send/recv) interfaces using
> > mediatek-mailbox APIs.
> > 
> > We use two mbox channels to implement a request-reply protocol.
> > 
> > Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> > Signed-off-by: TingHan Shen <tinghan.shen@mediatek.com>
> > Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
> > Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
> > Reviewed-by: YC Hung <yc.hung@mediatek.com>
> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/firmware/Kconfig                      |   1 +
> >  drivers/firmware/Makefile                     |   1 +
> >  drivers/firmware/mediatek/Kconfig             |   9 +
> >  drivers/firmware/mediatek/Makefile            |   2 +
> >  drivers/firmware/mediatek/mtk-adsp-ipc.c      | 161 ++++++++++++++++++
> >  .../linux/firmware/mediatek/mtk-adsp-ipc.h    |  65 +++++++
> >  6 files changed, 239 insertions(+)
> >  create mode 100644 drivers/firmware/mediatek/Kconfig
> >  create mode 100644 drivers/firmware/mediatek/Makefile
> >  create mode 100644 drivers/firmware/mediatek/mtk-adsp-ipc.c
> >  create mode 100644 include/linux/firmware/mediatek/mtk-adsp-ipc.h
> > 
> > diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
> > index d65964996e8d..c4d149b28944 100644
> > --- a/drivers/firmware/Kconfig
> > +++ b/drivers/firmware/Kconfig
> > @@ -300,6 +300,7 @@ source "drivers/firmware/cirrus/Kconfig"
> >  source "drivers/firmware/google/Kconfig"
> >  source "drivers/firmware/efi/Kconfig"
> >  source "drivers/firmware/imx/Kconfig"
> > +source "drivers/firmware/mediatek/Kconfig"
> >  source "drivers/firmware/meson/Kconfig"
> >  source "drivers/firmware/psci/Kconfig"
> >  source "drivers/firmware/smccc/Kconfig"
> > diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
> > index 4e58cb474a68..88fbdc110100 100644
> > --- a/drivers/firmware/Makefile
> > +++ b/drivers/firmware/Makefile
> > @@ -34,6 +34,7 @@ obj-$(CONFIG_GOOGLE_FIRMWARE)	+= google/
> >  obj-$(CONFIG_EFI)		+= efi/
> >  obj-$(CONFIG_UEFI_CPER)		+= efi/
> >  obj-y				+= imx/
> > +obj-y				+= mediatek/
> >  obj-y				+= psci/
> >  obj-y				+= smccc/
> >  obj-y				+= tegra/
> > diff --git a/drivers/firmware/mediatek/Kconfig b/drivers/firmware/mediatek/Kconfig
> > new file mode 100644
> > index 000000000000..6d1e580b967b
> > --- /dev/null
> > +++ b/drivers/firmware/mediatek/Kconfig
> > @@ -0,0 +1,9 @@
> > +# SPDX-License-Identifier: GPL-2.0-only
> > +config MTK_ADSP_IPC
> > +	tristate "MTK ADSP IPC Protocol driver"
> > +	depends on MTK_ADSP_MBOX
> > +	help
> > +	  Say yes here to add support for the MediaTek ADSP IPC
> > +	  between host AP (Linux) and the firmware running on ADSP.
> > +	  ADSP exists on some mtk processors.
> > +	  Client might use shared memory to exchange information with ADSP side.
> > diff --git a/drivers/firmware/mediatek/Makefile b/drivers/firmware/mediatek/Makefile
> > new file mode 100644
> > index 000000000000..4e840b65650d
> > --- /dev/null
> > +++ b/drivers/firmware/mediatek/Makefile
> > @@ -0,0 +1,2 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +obj-$(CONFIG_MTK_ADSP_IPC)		+= mtk-adsp-ipc.o
> > diff --git a/drivers/firmware/mediatek/mtk-adsp-ipc.c b/drivers/firmware/mediatek/mtk-adsp-ipc.c
> > new file mode 100644
> > index 000000000000..87cee61dbf32
> > --- /dev/null
> > +++ b/drivers/firmware/mediatek/mtk-adsp-ipc.c
> > @@ -0,0 +1,161 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (c) 2022 MediaTek Corporation. All rights reserved.
> > + * Author: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> > + */
> > +
> > +#include <linux/firmware/mediatek/mtk-adsp-ipc.h>
> > +#include <linux/kernel.h>
> > +#include <linux/mailbox_client.h>
> > +#include <linux/module.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/slab.h>
> > +
> > +/*
> > + * mtk_adsp_ipc_send - send ipc cmd to MTK ADSP
> > + *
> > + * @ipc: ADSP IPC handle
> > + * @idx: index of the mailbox channel
> > + * @msg: IPC cmd (reply or request)
> > + *
> > + * Returns zero for success from mbox_send_message
> > + * negative value for error
> > + */
> > +int mtk_adsp_ipc_send(struct mtk_adsp_ipc *ipc, unsigned int idx, uint32_t msg)
> > +{
> > +	struct mtk_adsp_chan *adsp_chan;
> > +	int ret;
> > +
> > +	if (idx >= MTK_ADSP_MBOX_NUM)
> > +		return -EINVAL;
> > +
> > +	adsp_chan = &ipc->chans[idx];
> > +	ret = mbox_send_message(adsp_chan->ch, &msg);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	/*
> > +	 * mbox_send_message returns non-negative value on success,
> > +	 * return zero for success
> > +	 */
> > +	return 0;
> 
> You already said this up in the function comments, no need to duplicate
> it again.
> 
> > +}
> > +EXPORT_SYMBOL(mtk_adsp_ipc_send);
> 
> EXPORT_SYMBOL_GPL()?  I have to ask, sorry.
> 
> thanks,
> 
> greg k-h

I'll update these parts in next version.
Thank you!


Best regards,
TingHan


      reply	other threads:[~2022-05-06 11:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  5:30 [RESEND PATCH v7 0/1] firmware: mtk: add adsp ipc protocol for SOF Tinghan Shen
2022-05-05  5:30 ` [RESEND PATCH v7 1/1] firmware: mediatek: add adsp ipc protocol interface Tinghan Shen
2022-05-05 21:10   ` Greg Kroah-Hartman
2022-05-06 11:37     ` Tinghan Shen
2022-05-05 21:11   ` Greg Kroah-Hartman
2022-05-06 11:39     ` Tinghan Shen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef0c621760d63c28ad97d4b7e8bef34660ea079c.camel@mediatek.com \
    --to=tinghan.shen@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=allen-kh.cheng@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=bp@suse.de \
    --cc=broonie@kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=cujomalainey@chromium.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=etienne.carriere@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=javierm@redhat.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=msuchanek@suse.de \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=simont@opensource.cirrus.com \
    --cc=sudeep.holla@arm.com \
    --cc=tzimmermann@suse.de \
    --cc=tzungbi@google.com \
    --cc=yc.hung@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®