public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Nikola Jelic <nikola.jelic83@gmail.com>
Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, rwalton@cmlmicro.com
Subject: Re: [PATCH 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec
Date: Mon, 3 Feb 2025 17:20:54 +0000	[thread overview]
Message-ID: <177e0b6d-e8e0-41e1-bccf-0b84b178678d@sirena.org.uk> (raw)
In-Reply-To: <20250203170117.12004-2-nikola.jelic83@gmail.com>

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

On Mon, Feb 03, 2025 at 06:01:17PM +0100, Nikola Jelic wrote:

This looks like a new version of:

   https://lore.kernel.org/linux-sound/20250121230903.89808-2-nikola.jelic83@gmail.com/

but it's not identified as v2 (nor does it have a changelog of any
kind, inter-version or otherwise).

> +static int cmx655_i2c_probe(struct i2c_client *client)
> +{
> +	int ret;
> +
> +	ret =
> +	    cmx655_common_register_component(&client->dev,
> +					     devm_regmap_init_i2c(client,
> +								  &cmx655_regmap),
> +					     client->irq);

This would be more legible if you used a temporary variable to store the
regmap.

> +	cmx655_common_unregister_component(&client->dev);
> +	gpiod_set_value_cansleep(cmx655_data->reset_gpio, 1);

Why isn't the GPIO set in the common unregister function?

> +	*ndiv = 0;
> +	*pll_ctrl = 0;
> +	switch (clk_id) {
> +	case (CMX655_SYSCLK_RCLK):
> +	case (CMX655_SYSCLK_LPO):
> +	case (CMX655_SYSCLK_LRCLK):

The brackets around the constants here are weird.

> +	ret = cmx655_get_sys_clk_config(cmx655_dai_data->sys_clk,
> +					primary_mode, srate_setting,
> +					&clk_src, &rdiv, &ndiv, &pll_ctrl);
> +	if (ret < 0) {
> +		dev_err(component->dev,
> +			"Failed to get system clock settings %i\n", ret);
> +	}

We then proceed to use the configuration?

> +	} else {
> +		cmx655_dai_data->best_clk_running = true;
> +	}
> +	if (snd_soc_component_test_bits(component, CMX655_CLKCTRL,

Some blank lines between blocks would help a lot with legibility
throughout the driver.

> +		/* Wait for filters to settle */
> +		if (snd_soc_component_test_bits
> +		    (component, CMX655_RVF, CMX655_VF_DCBLOCK,
> +		     CMX655_VF_DCBLOCK) == 0) {

Please try to follow the kernel coding style more, here just putting one
parameter per line with normal indentation is probably better.

> +static const unsigned int cmx655_rate_vals[] = {
> +	8000, 16000, 32000, 48000
> +};
> +
> +static const struct snd_pcm_hw_constraint_list cmx655_rate_constraint = {
> +	.count = ARRAY_SIZE(cmx655_rate_vals),
> +	.list = cmx655_rate_vals,
> +};
> +
> +static int cmx655_dai_startup(struct snd_pcm_substream *stream,
> +			      struct snd_soc_dai *dai)
> +{
> +	int ret = 0;
> +
> +	ret = snd_pcm_hw_constraint_list(stream->runtime, 0,
> +					 SNDRV_PCM_HW_PARAM_RATE,
> +					 &cmx655_rate_constraint);
> +	return ret;
> +}

If the driver just supports a constant set of constraints why set them
dynamically - set them in the rates for the DAI.

> +	SOC_SINGLE_TLV("ALC Gain Playback Volume", CMX655_ALCGAIN, 0, 12, 0,
> +		       cmx655_alc_gain),

A gain is a volume.

> +	SOC_SINGLE("Companding Switch", CMX655_SAIMUX, 4, 1, 0),
> +	SOC_ENUM("Companding Type Enum", cmx655_companding_enum),

No Enum, the control is for Companding Type.

> +	/* Custom widgets for Mics to get them to turn on before switches */
> +	{.id = snd_soc_dapm_mic,
> +	 .name = "Left Mic",
1
> +	{.id = snd_soc_dapm_mic,
> +	 .name = "Right Mic",

Define a macro for the repated pattern if one is really needed.

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

  reply	other threads:[~2025-02-03 17:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 17:01 [PATCH 1/2] ASoC: dt-bindings: Add cmx655 codec Nikola Jelic
2025-02-03 17:01 ` [PATCH 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec Nikola Jelic
2025-02-03 17:20   ` Mark Brown [this message]
2025-02-03 17:05 ` [PATCH 1/2] ASoC: dt-bindings: Add cmx655 codec Mark Brown
2025-02-03 18:22 ` Rob Herring (Arm)
2025-02-03 20:31 ` Krzysztof Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2025-02-10 22:28 Nikola Jelic
2025-02-10 22:28 ` [PATCH 2/2] ASoC: codecs: cmx655: Add CML's CMX655D codec Nikola Jelic

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=177e0b6d-e8e0-41e1-bccf-0b84b178678d@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nikola.jelic83@gmail.com \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=rwalton@cmlmicro.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