public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Shenghao Ding <13916275206@139.com>
Cc: broonie@kernel.org, devicetree@vger.kernel.org,
	krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org,
	lgirdwood@gmail.com, perex@perex.cz,
	pierre-louis.bossart@linux.intel.com, kevin-lu@ti.com,
	shenghao-ding@ti.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, liam.r.girdwood@intel.com,
	mengdong.lin@intel.com, x1077012@ti.com, peeyush@ti.com,
	navada@ti.com
Subject: Re: [PATCH v2 2/3] ALSA: hda/tas2781: Add tas2781 HDA driver
Date: Mon, 10 Jul 2023 16:47:21 +0200	[thread overview]
Message-ID: <871qhfzuva.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230710041217.151099-2-13916275206@139.com>

On Mon, 10 Jul 2023 06:12:16 +0200,
Shenghao Ding wrote:
> 
> Create tas2781 side codec HDA driver for Lenovo Laptops. The quantity
> of the speakers has been define in ACPI. All of the tas2781s in the
> laptop will be aggregated as one audio speaker. The code supports
> realtek codec as the primary codec. Code offers several controls for
> digtial/analog gain setting during playback, and other for eq params
> setting in case of different audio profiles, such as music, voice,
> movie, etc.
> 
> Signed-off-by: Shenghao Ding <13916275206@139.com>
> 
> ---
> Changes in v2:
>  - All the controls set as const static
>  - Add descriptions for tas2781_save_calibration
>  - remove global addr handling in the code
>  - checking subid in switch statement in function tas2781_hda_bind
>  - add force firmware load Kcontrol
>  - rename the kcontrol name to be more undertandable
>  - remove Superfluous cast in tasdevice_fw_ready
>  - correct weird line break in function tas2781_acpi_get_i2c_resource
>  - correct Referencing adev after acpi_dev_put() in tas2781_hda_read_acpi
>  - As to checking the given value in tasdevice_set_profile_id, it seems done
>    by the tasdevice_info_profile
>  - replace strcpy with strscpy in tas2781_hda_read_acpi
>  - rewrite the subid judgement
>  - Add tiwai@suse.de into Cc list
>  - remove the cast in tas2781_acpi_get_i2c_resource
>  - remove else in tas2781_acpi_get_i2c_resource
>  - fix the return value in tasdevice_set_profile_id
>  - remove unneeded NL in tasdevice_config_get
>  - Unifiy the comment style
>  - remove ret = 0 in tasdevice_fw_ready
>  - remove ret in tas2781_save_calibration
>  - remove unused ret in tas2781_hda_playback
>  - add force firmware load Kcontrol

The new version looks much better.  Another few minor comments:

> +static int tas2781_acpi_get_i2c_res(struct acpi_resource *ares,
> +	void *data)

The indentation could be improved in this patch, too.
Not only this line but in many places.

> +static int tas2781_hda_read_acpi(struct tasdevice_priv *tas_priv,
> +	const char *hid)
> +{
...
> +err:
> +	dev_err(tas_priv->dev, "Failed acpi ret: %d\n", ret);

Too ambiguous error message.  It's hard to spot what the error is only
from this text.

> +static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
> +		struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
> +	int ret = 0;
> +
> +	if (tas_priv->rcabin.profile_cfg_id !=
> +		ucontrol->value.integer.value[0]) {
> +		tas_priv->rcabin.profile_cfg_id =
> +			ucontrol->value.integer.value[0];

You should have a sanity check of the given values.  User-space may
pass any arbitrary value, and ALSA core doesn't always filter invalid
values.  Ditto for other *_put() callbacks.

> +static void tas2781_apply_calib(struct tasdevice_priv *tas_priv)
> +{
> +	const unsigned char page_array[CALIB_MAX] = {
> +		0x17, 0x18, 0x18, 0x0d, 0x18
> +	};

Missing static.

> +	const unsigned char rgno_array[CALIB_MAX] = {
> +		0x74, 0x0c, 0x14, 0x3c, 0x7c
> +	};

Ditto.

> +static void tas2781_hda_remove(struct device *dev)
> +{
> +	struct tasdevice_priv *tas_priv = dev_get_drvdata(dev);
> +
> +	pm_runtime_get_sync(tas_priv->dev);
> +	pm_runtime_disable(tas_priv->dev);
> +
> +

Too many blank lines.


thanks,

Takashi

  reply	other threads:[~2023-07-10 14:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10  4:12 [PATCH v2 1/3] ALSA: hda/tas2781: Add tas2781 HDA driver Shenghao Ding
2023-07-10  4:12 ` [PATCH v2 2/3] " Shenghao Ding
2023-07-10 14:47   ` Takashi Iwai [this message]
2023-07-10  4:12 ` [PATCH v2 3/3] MAINTAINERS: Add entries for TEXAS INSTRUMENTS AUDIO (ASoC/HDA) DRIVERS Shenghao Ding
2023-07-10 14:30 ` [PATCH v2 1/3] ALSA: hda/tas2781: Add tas2781 HDA driver Takashi Iwai

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=871qhfzuva.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=13916275206@139.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengdong.lin@intel.com \
    --cc=navada@ti.com \
    --cc=peeyush@ti.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=shenghao-ding@ti.com \
    --cc=x1077012@ti.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