From: Mark Brown <broonie@kernel.org> To: Dan Murphy <dmurphy@ti.com> Cc: lgirdwood@gmail.com, tiwai@suse.com, robh+dt@kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] ASoC: tas2764: Add the driver for the TAS2764 Date: Thu, 1 Oct 2020 17:25:05 +0100 [thread overview] Message-ID: <20201001162505.GO6715@sirena.org.uk> (raw) In-Reply-To: <20200930163809.6978-2-dmurphy@ti.com> [-- Attachment #1: Type: text/plain, Size: 1831 bytes --] On Wed, Sep 30, 2020 at 11:38:09AM -0500, Dan Murphy wrote: This all looks good - a few very minor things below but nothing substantial: > + default: > + dev_err(tas2764->dev, "Not supported evevt\n"); > + return -EINVAL; evevt -> event > +static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) > +{ > + struct snd_soc_component *component = dai->component; > + int ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, > + TAS2764_PWR_CTRL_MASK, > + mute ? TAS2764_PWR_CTRL_MUTE : 0); > + > + if (ret < 0) > + return ret; This looks weird with the ternery operator and extreme indentation - could you please at least split the declaration of ret from the call to make the line length a bit extreme? > + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { > + case SND_SOC_DAIFMT_I2S: > + case SND_SOC_DAIFMT_DSP_A: > + tdm_rx_start_slot = 1; > + break; > + case SND_SOC_DAIFMT_DSP_B: > + case SND_SOC_DAIFMT_LEFT_J: > + tdm_rx_start_slot = 0; > + break; I'm not seeing any other handling that distinguishes between the I2S and DSP modes anywhere - I'm guessing this is because the device is really only implementing the DSP modes but because it's mono this is compatible with the I2S modes? It'd be worth having a comment saying this since while that would be OK not distinguishing between modes properly is a common error in drivers so it'd help avoid cut'n'paste issues if someone uses this code as a reference. > +static int tas2764_register_codec(struct tas2764_priv *tas2764) > +{ > + return devm_snd_soc_register_component(tas2764->dev, > + &soc_component_driver_tas2764, > + tas2764_dai_driver, > + ARRAY_SIZE(tas2764_dai_driver)); > +} This is a bit odd - can we not just inline the component registration rather than having this function? [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org> To: Dan Murphy <dmurphy@ti.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org Subject: Re: [PATCH 2/2] ASoC: tas2764: Add the driver for the TAS2764 Date: Thu, 1 Oct 2020 17:25:05 +0100 [thread overview] Message-ID: <20201001162505.GO6715@sirena.org.uk> (raw) In-Reply-To: <20200930163809.6978-2-dmurphy@ti.com> [-- Attachment #1: Type: text/plain, Size: 1831 bytes --] On Wed, Sep 30, 2020 at 11:38:09AM -0500, Dan Murphy wrote: This all looks good - a few very minor things below but nothing substantial: > + default: > + dev_err(tas2764->dev, "Not supported evevt\n"); > + return -EINVAL; evevt -> event > +static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) > +{ > + struct snd_soc_component *component = dai->component; > + int ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, > + TAS2764_PWR_CTRL_MASK, > + mute ? TAS2764_PWR_CTRL_MUTE : 0); > + > + if (ret < 0) > + return ret; This looks weird with the ternery operator and extreme indentation - could you please at least split the declaration of ret from the call to make the line length a bit extreme? > + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { > + case SND_SOC_DAIFMT_I2S: > + case SND_SOC_DAIFMT_DSP_A: > + tdm_rx_start_slot = 1; > + break; > + case SND_SOC_DAIFMT_DSP_B: > + case SND_SOC_DAIFMT_LEFT_J: > + tdm_rx_start_slot = 0; > + break; I'm not seeing any other handling that distinguishes between the I2S and DSP modes anywhere - I'm guessing this is because the device is really only implementing the DSP modes but because it's mono this is compatible with the I2S modes? It'd be worth having a comment saying this since while that would be OK not distinguishing between modes properly is a common error in drivers so it'd help avoid cut'n'paste issues if someone uses this code as a reference. > +static int tas2764_register_codec(struct tas2764_priv *tas2764) > +{ > + return devm_snd_soc_register_component(tas2764->dev, > + &soc_component_driver_tas2764, > + tas2764_dai_driver, > + ARRAY_SIZE(tas2764_dai_driver)); > +} This is a bit odd - can we not just inline the component registration rather than having this function? [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-10-01 16:26 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-30 16:38 [PATCH 1/2] dt-bindings: tas2764: Add the TAS2764 binding doc Dan Murphy 2020-09-30 16:38 ` Dan Murphy 2020-09-30 16:38 ` [PATCH 2/2] ASoC: tas2764: Add the driver for the TAS2764 Dan Murphy 2020-09-30 16:38 ` Dan Murphy 2020-10-01 16:25 ` Mark Brown [this message] 2020-10-01 16:25 ` Mark Brown 2020-10-02 11:49 ` Dan Murphy 2020-10-02 11:49 ` Dan Murphy 2020-10-01 16:15 ` [PATCH 1/2] dt-bindings: tas2764: Add the TAS2764 binding doc Mark Brown 2020-10-01 16:15 ` 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=20201001162505.GO6715@sirena.org.uk \ --to=broonie@kernel.org \ --cc=alsa-devel@alsa-project.org \ --cc=devicetree@vger.kernel.org \ --cc=dmurphy@ti.com \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=robh+dt@kernel.org \ --cc=tiwai@suse.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: linkBe 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.