All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Cc: alsa-devel@alsa-project.org, garlic.tseng@mediatek.com,
	linux-mediatek@lists.infradead.org, chipeng.chang@mediatek.com,
	wsd_upstream@mediatek.com
Subject: Re: [PATCH v2 3/5] ASoC: mt6797: add mt6797 platform driver
Date: Wed, 18 Apr 2018 17:46:26 +0100	[thread overview]
Message-ID: <20180418164626.GH10061@sirena.org.uk> (raw)
In-Reply-To: <20180416003252.4177-4-kaichieh.chuang@mediatek.com>


[-- Attachment #1.1: Type: text/plain, Size: 1784 bytes --]

On Mon, Apr 16, 2018 at 08:32:50AM +0800, KaiChieh Chuang wrote:
> add support for mt6797 playback and capture
> to MediaTek sound codec,
> through MediaTek Proprietary audio interface.
> add memory interface as FE dai.
> add ADDA interface as BE dai.

Again this looks pretty good, some small comments but nothing major:

> +		/* set output mode */
> +		if (rate == 96000) {
> +			dl_src2_con0 |= (0x2 << 24); /* UP_SAMPLING_RATE_X4 */
> +			dl_src2_con0 |= 1 << 14;
> +		} else if (rate == 192000) {
> +			dl_src2_con0 |= (0x1 << 24); /* UP_SAMPLING_RATE_X2 */
> +			dl_src2_con0 |= 1 << 14;
> +		} else {
> +			dl_src2_con0 |= (0x3 << 24); /* UP_SAMPLING_RATE_X8 */
> +		}

This looks like a switch statement.

> +		/* turn of mute function */
> +		dl_src2_con0 |= (0x03 << 11);

Is there any reason for not implementing this as a mute_stream()
callback?  That'll keep the DAI muted during startup and before teardown
which will do the most to avoid any noise making it into the output.

> +static irqreturn_t mt6797_afe_irq_handler(int irq_id, void *dev)
> +{
> +	struct mtk_base_afe *afe = dev;
> +	struct mtk_base_afe_irq *irq;
> +	unsigned int status;
> +	unsigned int mcu_en;
> +	int ret;
> +	int i;
> +
> +	/* get irq that is sent to MCU */
> +	regmap_read(afe->regmap, AFE_IRQ_MCU_EN, &mcu_en);

...

> +	/* clear irq */
> +	regmap_write(afe->regmap,
> +		     AFE_IRQ_MCU_CLR,
> +		     status & AFE_IRQ_STATUS_BITS);
> +
> +	return IRQ_HANDLED;
> +}

This unconditionally returns IRQ_HANDLED even if we didn't get an
interrupt - it's better to return IRQ_NONE unless we actually handled
something since that is more robust if something goes wrong, it lets the
IRQ core shut up interrupts that get latched on and works with shared
interrupts if any future designs do that.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2018-04-18 16:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16  0:32 [PATCH v2 0/5] ASoC: mediatek: add support for mt6797 SoC KaiChieh Chuang
     [not found] ` <20180416003252.4177-1-kaichieh.chuang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2018-04-16  0:32   ` [PATCH v2 1/5] ASoC: add mt6351 codec driver KaiChieh Chuang
2018-04-18 16:40     ` Mark Brown
2018-04-19  1:58       ` KaiChieh Chuang
2018-04-19 14:41         ` Mark Brown
2018-04-20  6:54           ` KaiChieh Chuang
2018-04-20 23:49       ` KaiChieh Chuang
2018-04-23 11:39         ` Mark Brown
2018-04-16  0:32   ` [PATCH v2 2/5] ASoC: mt6797: add structure define and clock control function for 6797 KaiChieh Chuang
2018-04-16  0:32   ` [PATCH v2 3/5] ASoC: mt6797: add mt6797 platform driver KaiChieh Chuang
2018-04-18 16:46     ` Mark Brown [this message]
2018-04-19  1:51       ` KaiChieh Chuang
2018-04-19 11:29         ` Mark Brown
2018-04-16  0:32   ` [PATCH v2 4/5] ASoC: add mt6797-mt6351 driver and config option KaiChieh Chuang
2018-04-16  0:32 ` [PATCH v2 5/5] ASoC: mediatek: add documents for mt6797 KaiChieh Chuang
2018-04-18 16:46 ` [PATCH v2 0/5] ASoC: mediatek: add support for mt6797 SoC Mark Brown

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=20180418164626.GH10061@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=chipeng.chang@mediatek.com \
    --cc=garlic.tseng@mediatek.com \
    --cc=kaichieh.chuang@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=wsd_upstream@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.