devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: wangweidong.a@awinic.com, lgirdwood@gmail.com,
	broonie@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	perex@perex.cz, tiwai@suse.com, rf@opensource.cirrus.co,
	shumingf@realtek.com, herve.codina@bootlin.com,
	flatmax@flatmax.com, ckeepax@opensource.cirrus.com,
	doug@schmorgal.com, fido_max@inbox.ru,
	pierre-louis.bossart@linux.intel.com, kiseok.jo@irondevice.com,
	liweilei@awinic.com, colin.i.king@gmail.com, trix@redhat.com,
	alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: yijiangtao@awinic.com, zhangjianming@awinic.com
Subject: Re: [PATCH V1 2/5] ASoC: codecs: aw88261 function for ALSA Audio Driver
Date: Mon, 17 Jul 2023 22:39:07 +0200	[thread overview]
Message-ID: <4ef0d83e-b0c9-1f6e-c1a4-24d650630fe4@linaro.org> (raw)
In-Reply-To: <20230717115845.297991-3-wangweidong.a@awinic.com>

On 17/07/2023 13:58, wangweidong.a@awinic.com wrote:
> From: Weidong Wang <wangweidong.a@awinic.com>
> 
> The AW88261 is an I2S/TDM input, high efficiency
> digital Smart K audio amplifier with an integrated 10.25V
> smart boost convert

It's the same as in patch before. This does not help and does not
justify having one driver split into two.

> 

...

> +
> +static void aw_dev_i2s_tx_enable(struct aw_device *aw_dev, bool flag)
> +{
> +	int ret;
> +
> +	if (flag) {
> +		ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCFG1_REG,
> +			~AW88261_I2STXEN_MASK, AW88261_I2STXEN_ENABLE_VALUE);
> +	} else {
> +		ret = regmap_update_bits(aw_dev->regmap, AW88261_I2SCFG1_REG,
> +			~AW88261_I2STXEN_MASK, AW88261_I2STXEN_DISABLE_VALUE);
> +	}

You should not need {} here and in multiple other places.

> +	if (ret)
> +		dev_dbg(aw_dev->dev, "%s failed", __func__);

Why you are not handling the errors properly?

> +}
> +
> +static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd)
> +{
> +	int ret;
> +
> +	if (pwd) {
> +		ret = regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG,
> +				~AW88261_PWDN_MASK,	AW88261_PWDN_POWER_DOWN_VALUE);
> +	} else {
> +		ret = regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG,
> +				~AW88261_PWDN_MASK,	AW88261_PWDN_WORKING_VALUE);
> +	}
> +	if (ret)
> +		dev_dbg(aw_dev->dev, "%s failed", __func__);
> +}
> +

...

> +
> +int aw88261_dev_fw_update(struct aw_device *aw_dev)
> +{
> +	struct aw_prof_desc *prof_index_desc;
> +	struct aw_sec_data_desc *sec_desc;
> +	char *prof_name;
> +	int ret;
> +
> +	prof_name = aw88261_dev_get_prof_name(aw_dev, aw_dev->prof_index);
> +	if (!prof_name) {
> +		dev_err(aw_dev->dev, "get prof name failed");
> +		return -EINVAL;
> +	}
> +
> +	dev_dbg(aw_dev->dev, "start update %s", prof_name);
> +
> +	ret = aw88261_dev_get_prof_data(aw_dev, aw_dev->prof_index, &prof_index_desc);
> +	if (ret)
> +		return ret;
> +
> +	/* update reg */
> +	sec_desc = prof_index_desc->sec_desc;
> +	ret = aw_dev_reg_update(aw_dev, sec_desc[AW88261_DATA_TYPE_REG].data,
> +					sec_desc[AW88261_DATA_TYPE_REG].len);
> +	if (ret) {
> +		dev_err(aw_dev->dev, "update reg failed");
> +		return ret;
> +	}
> +
> +	aw_dev->prof_cur = aw_dev->prof_index;
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(aw88261_dev_fw_update);

Why do you need to export this? Where is the user?

> +
> +int aw88261_dev_reg_update(struct aw_device *aw_dev, bool force)
> +{
> +	int ret;
> +
> +	if (force) {
> +		aw88261_dev_soft_reset(aw_dev);
> +		ret = aw88261_dev_fw_update(aw_dev);
> +		if (ret < 0)
> +			return ret;
> +	} else {
> +		if (aw_dev->prof_cur != aw_dev->prof_index) {
> +			ret = aw88261_dev_fw_update(aw_dev);
> +			if (ret < 0)
> +				return ret;
> +		}
> +	}
> +
> +	aw_dev->prof_cur = aw_dev->prof_index;
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(aw88261_dev_reg_update);

Same question. And in all other places as well.


Best regards,
Krzysztof


  reply	other threads:[~2023-07-17 20:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 11:58 [PATCH V1 0/5] ASoC: codecs: Add Awinic AW88261 audio amplifier driver wangweidong.a
2023-07-17 11:58 ` [PATCH V1 1/5] ASoC: codecs: Add i2c and codec registration for aw88261 and their associated operation functions wangweidong.a
2023-07-17 20:33   ` Krzysztof Kozlowski
2023-07-19  3:06     ` wangweidong.a
2023-07-17 11:58 ` [PATCH V1 2/5] ASoC: codecs: aw88261 function for ALSA Audio Driver wangweidong.a
2023-07-17 20:39   ` Krzysztof Kozlowski [this message]
2023-07-19  3:09     ` wangweidong.a
2023-07-19  6:24       ` Krzysztof Kozlowski
2023-07-17 11:58 ` [PATCH V1 3/5] ASoC: codecs: ACF bin parsing and check library file for aw88261 wangweidong.a
2023-07-17 20:40   ` Krzysztof Kozlowski
2023-07-19  3:12     ` wangweidong.a
2023-07-19  6:23       ` Krzysztof Kozlowski
2023-07-17 11:58 ` [PATCH V1 4/5] ASoC: codecs: aw88261 chip register file, data type file and Kconfig Makefile wangweidong.a
2023-07-17 12:33   ` Randy Dunlap
2023-07-19  2:59     ` wangweidong.a
2023-07-17 11:58 ` [PATCH V1 5/5] ASoC: dt-bindings: Add schema for "awinic,aw88261" wangweidong.a
2023-07-17 20:23   ` Krzysztof Kozlowski
2023-07-19  3:02     ` wangweidong.a
2023-07-17 13:03 ` [PATCH V1 0/5] ASoC: codecs: Add Awinic AW88261 audio amplifier driver Herve Codina

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=4ef0d83e-b0c9-1f6e-c1a4-24d650630fe4@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=colin.i.king@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=doug@schmorgal.com \
    --cc=fido_max@inbox.ru \
    --cc=flatmax@flatmax.com \
    --cc=herve.codina@bootlin.com \
    --cc=kiseok.jo@irondevice.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liweilei@awinic.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rf@opensource.cirrus.co \
    --cc=robh+dt@kernel.org \
    --cc=shumingf@realtek.com \
    --cc=tiwai@suse.com \
    --cc=trix@redhat.com \
    --cc=wangweidong.a@awinic.com \
    --cc=yijiangtao@awinic.com \
    --cc=zhangjianming@awinic.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;
as well as URLs for NNTP newsgroup(s).