public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] ASoC: TSCS42xx: Add support for Tempo Semiconductor's TSCS42xx audio CODEC
Date: Tue, 12 Dec 2017 16:32:54 +0000	[thread overview]
Message-ID: <20171212163254.GL16323@sirena.org.uk> (raw)
In-Reply-To: <20171211195403.3irxp7g3n326ub3g@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2856 bytes --]

On Mon, Dec 11, 2017 at 01:54:25PM -0600, Steven Eckhoff wrote:
> Currently there is no support for the TSCS42xx audio CODEC.
> 
> Add support for it.
> 
> v5 attempts to address all issues raised in the previous reviews.
> 
> Thank you to everyone who has invested their time reviewing these
> patches.

Please add inter-version changelogs and commentary like this after --- 
as covered in SubmittingPatches - this lets tools know they don't need
to end up in git.

> +  - compatible : "tscs:tscs42xx"

Compatible strings should be for specific devices, they may all be
treated identically by software now but may not be in future.

> +		do {
> +			ret = snd_soc_read(codec, R_DACCRSTAT);
> +			if (ret < 0) {
> +				dev_err(codec->dev,
> +					"Failed to read stat (%d)\n", ret);
> +				return ret;
> +			}
> +		} while (ret);

There should be some sort of upper bound on how many times we'll try to
wait for this in case the hardware fails somehow.

> +static int tscs42xx_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
> +{
> +	struct snd_soc_codec *codec = dai->codec;
> +	int ret;
> +
> +	if (mute)
> +		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
> +			ret = dac_mute(codec);
> +		else
> +			ret = adc_mute(codec);
> +	else
> +		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
> +			ret = dac_unmute(codec);
> +		else
> +			ret = adc_unmute(codec);
> +
> +	return ret;
> +}

All these mute functions also shut down the PLLs which since...

> +	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> +	case SND_SOC_DAIFMT_CBM_CFM:
> +		ret = snd_soc_update_bits(codec, R_AIC1, RM_AIC1_MS,
> +				RV_AIC1_MS_MASTER);
> +		if (ret < 0)
> +			dev_err(codec->dev,
> +				"Failed to set codec DAI master (%d)\n", ret);
> +		else
> +			ret = 0;
> +		break;
> +	default:

...we only support the CODEC being the clock master seems like it might
mean we stop clocking the DAI?  If that's the case it's better to just
not have the mute control and allow the user to just control these as
normal mutes.

> +static int tscs42xx_probe(struct snd_soc_codec *codec)
> +{
> +	int i;
> +	int ret;
> +
> +	for (i = 0; i < ARRAY_SIZE(r_inits); ++i) {
> +		ret = snd_soc_write(codec, r_inits[i].reg, r_inits[i].def);
> +		if (ret < 0) {
> +			dev_err(codec->dev,
> +				"Failed to write codec defaults (%d)\n", ret);
> +			return ret;
> +		}
> +	}

I'd expect the driver to just reset the CODEC (it appears to have that
feature) and the regmap.

> +static int tscs42xx_remove(struct snd_soc_codec *codec)
> +{
> +	return 0;
> +}

Just remove empty functions.

> +static const struct i2c_device_id tscs42xx_i2c_id[] = {
> +	{ "tscs42xx", 0 },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(i2c, tscs42xx_i2c_id);

I2C IDs are better as explicit part numbers too like compatible
strings.

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

  parent reply	other threads:[~2017-12-12 16:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 19:54 [PATCH v5] ASoC: TSCS42xx: Add support for Tempo Semiconductor's TSCS42xx audio CODEC Steven Eckhoff
2017-12-12 13:04 ` Charles Keepax
2017-12-12 13:10   ` Takashi Iwai
2017-12-12 16:54     ` Steven Eckhoff
2017-12-12 16:35   ` Steven Eckhoff
2017-12-12 16:32 ` Mark Brown [this message]
2017-12-12 21:31   ` Steven Eckhoff
2017-12-12 22:51     ` Steven Eckhoff
2017-12-13  6:20       ` Steven Eckhoff
2017-12-13 10:47       ` Mark Brown
2017-12-13 15:40         ` Steven Eckhoff
2017-12-14  9:32     ` [alsa-devel] " Charles Keepax
2017-12-14 22:36       ` Steven Eckhoff
2017-12-14 22:43         ` Steven Eckhoff
2017-12-15 11:36           ` Charles Keepax
2017-12-15 16:08             ` Steven Eckhoff
2017-12-17 19:23       ` Steven Eckhoff

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=20171212163254.GL16323@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=steven.eckhoff.opensource@gmail.com \
    --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: 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