Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp397981pxa; Wed, 12 Aug 2020 05:07:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsSgp0yk8zfKda8BaWR+/e5118MmQAw63wuDLvWNji2sRB4mLdv1h9queUgBNUkxXjTloW X-Received: by 2002:a05:6402:60e:: with SMTP id n14mr30762429edv.29.1597234058825; Wed, 12 Aug 2020 05:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597234058; cv=none; d=google.com; s=arc-20160816; b=wjvvoZE5+5SM2kt/SfHh954NHErrHgnXfJKjSSs9KEQIn8wNf+7oVMTFxSEgiDDzLW SwqsRCXSmCPb4m27F1vwN03yNfSs03uya3wRKjdCVC8QSykO7/7zGdSRUgfSEOEnIP5+ 6Cb8XFnnnoq8pkicmNZMh03MxQ9Yreb5Qd10qXI5GoZggTUJFlExkURG51DKu52Jjo1W dgxG9FiUtX4e+KQCPoUt0tB46DReJTVeM1vQ9gO0OG4lvpXR/wWQaDTesd5N3YGFBXib E1dCGTGG2qpX2KqrREn5njOBmFGIrIpcA5SzjjMV4TYBKY01V78TZuChxVb/7iT+J5cI 81cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=P5NDw3UvfykLG53Z0PCfZFhEnaMK+tf2p4jlOMnuCSs=; b=PZqqg/yGqqRLrafDcqH5ZyoWUySHuvadWqJ0gI5aNZTLWkDzVmSyrBCqMM0bvQxtdy sVMEOQRvId7gdV71UdjkSvh5zGeXY9ZT4FrXrpJhjF7MGwKwKGg8l4/OdRQ4b0XK+sp0 SLmw5jIRzbxfwk1+x6eS9RRE3SxiXlDQteFFi7s8xmwBhYq00syJxdkc0LX4hhT6cAIC nvda7e085V/RxcclsGOKMXmK5kSLnKzyGi/D2IC3mIxU2hWeTGKmQmmpJGpYV/b2LT8H KzdgM3AKj5iRoURQy1oLWsKN8otKw9UoDTNNkpn1Qusu+JP2V0dnJojjhcXEmp+fKUTm t2RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jT2HBedN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si1182043edh.42.2020.08.12.05.07.15; Wed, 12 Aug 2020 05:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jT2HBedN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728019AbgHLMGX (ORCPT + 99 others); Wed, 12 Aug 2020 08:06:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:35414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727947AbgHLMGE (ORCPT ); Wed, 12 Aug 2020 08:06:04 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E78D4207F7; Wed, 12 Aug 2020 12:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597233964; bh=MM8pmV2QgsjxdXSSM0B2DrSsgot2dM8rNva9Cu3oxH8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jT2HBedN+7Xl2ZMqfco4gYuAi3jJlp6W72K6S+ofFy1AO5aUUC1zZeI5QwXPv89S+ JV0aP++AnLYNFZ7uvMw85wcAQJ7QwOTYxV2wD89dpQubayYvwWjJCwntESy3xnX3r1 0jrjy1RRyENK1rJGcsxsZdOpUos08yVoOzHs1NG8= Date: Wed, 12 Aug 2020 13:05:37 +0100 From: Mark Brown To: Jiaxin Yu Cc: matthias.bgg@gmail.com, robh+dt@kernel.org, tiwai@suse.com, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, howie.huang@mediatek.com, tzungbi@google.com, eason.yen@mediatek.com, shane.chien@mediatek.com Subject: Re: [PATCH v2 1/2] ASoC: mediatek: mt6359: add codec driver Message-ID: <20200812120537.GA5545@sirena.org.uk> References: <1597028754-7732-1-git-send-email-jiaxin.yu@mediatek.com> <1597028754-7732-2-git-send-email-jiaxin.yu@mediatek.com> <20200810185933.GI6438@sirena.org.uk> <1597217353.23246.45.camel@mhfsdcap03> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yrj/dFKFPuw6o+aM" Content-Disposition: inline In-Reply-To: <1597217353.23246.45.camel@mhfsdcap03> X-Cookie: No purchase necessary. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yrj/dFKFPuw6o+aM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Aug 12, 2020 at 03:29:13PM +0800, Jiaxin Yu wrote: > On Mon, 2020-08-10 at 19:59 +0100, Mark Brown wrote: > > On Mon, Aug 10, 2020 at 11:05:53AM +0800, Jiaxin Yu wrote: > > > +void mt6359_set_playback_gpio(struct snd_soc_component *cmpnt) > > > +{ > > > + struct mt6359_priv *priv =3D snd_soc_component_get_drvdata(cmpnt); > > What are these, should they not be managed through gpiolib and/or > > pinctrl? > These are the functions that control the mux of input or output > signal. I refer to the other codec drivers, most of them are manipulate > the regs in their codec drivers also. Maybe it's easier to control? These functions are exported for other drivers to use rather than something done internally by the driver - if this were internal to the driver it'd not be a big deal but when it's for use by another driver it'd be better to go through standard interfaces. > > > +int mt6359_mtkaif_calibration_enable(struct snd_soc_pcm_runtime *rtd) > > > +{ > > > +EXPORT_SYMBOL_GPL(mt6359_mtkaif_calibration_enable); > > Why is this exported? > This function is exported to machine driver to do calibration when > registering. The interface between MT6359 and MTK SoC is a special > interface that named MTKAIF. Therefore, if MT6359 is to be used > normally, it needs to rely on the platform for calibration when > registering. So this needs the SoC to do something as part of callibration? > > > + switch (event) { > > > + case SND_SOC_DAPM_PRE_PMU: > > > + priv->dev_counter[device]++; > > > + if (priv->dev_counter[device] > 1) > > > + break; /* already enabled, do nothing */ > > > + else if (priv->dev_counter[device] <=3D 0) > > Why are we doing additional refcounting on top of what DAPM is doing? > > This seems like there should be at least one widget representing the > > shared bits of the audio path. > We have "HPL Mux" and "HPR Mux", there will be two paths enabled when > playback throuh HP. But actually they share the same control sequences. > So in order to prevent setting it one more time we do additional > refcouting. That sounds like you should just have one output path defined in DAPM and merge the left and right signals together rather than maintaining them separately. > > > + /* hp gain ctl default choose ZCD */ > > > + priv->hp_gain_ctl =3D HP_GAIN_CTL_ZCD; > > > + hp_gain_ctl_select(priv, priv->hp_gain_ctl); > > Why not use the hardware default? > We have two ways to control the volume, there is to select ZCD. Because > the other one it not often used, ZCD is used by default.=20 Why not just let the user pick at runtime? > > > + ret =3D regulator_enable(priv->avdd_reg); > > > + if (ret) { > > > + dev_err(priv->dev, "%s(), failed to enable regulator!\n", > > > + __func__); > > > + return ret; > > > + } > > Perhaps make this a DAPM widget? > "vaud18" needs to be always on so we enable it when codec probe. If it is just supposed to be left on all the time it's better to do this in the main device model probe rather than the component probe. The component probe should usually only be used for things that need the rest of the card to be there. --yrj/dFKFPuw6o+aM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl8z2xAACgkQJNaLcl1U h9D7Wwf+OdwVBUD42cfqMOKbAwel1jObAQofx/ASxy8YgjsPQp8Jjkm39G6YSYyJ 8nK3lQ1sz6qZtJ2KsZp6jG/aEOC5w7aBQdZszyRHXuneIp4KtvLG+AYHSO54DMXb ftsOw4EyQjzNY61qz0ZZ3H7vMObW+1o8uMEBKadB8MMz7oufbCUcV8auAps+K+L1 si165INgJFZpfrKk/8YvNVqBAlcXMDjGpcZtO6gfEi9AuDQnZfJWte/1hOBgQynL 84UFJWIEtkVCWadlYwBU1VcQD/3bOkpfyFMIoYII0BquCKBUqxmcLA2NxFV7Ami1 U58UVe1qf4mt+vS7hAjBlmh6JTrUnw== =Fkwb -----END PGP SIGNATURE----- --yrj/dFKFPuw6o+aM--