All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org, tiwai@suse.com
Subject: Re: [PATCH 2/4] ASoC: codecs: add wsa883x amplifier support
Date: Wed, 29 Jun 2022 10:03:02 -0500	[thread overview]
Message-ID: <352fac7e-597c-84af-d33b-bdff0e2acdb6@linux.intel.com> (raw)
In-Reply-To: <20220629090644.67982-3-srinivas.kandagatla@linaro.org>


> +/* 4 ports */
> +static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = {
> +	{
> +		/* DAC */
> +		.num = 1,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}, {

nit-pick: it's unusual to see such opening brackets for structure
initialization, usually there are on a new line.

> +		/* COMP */
> +		.num = 2,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}, {
> +		/* BOOST */
> +		.num = 3,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}, {
> +		/* VISENSE */
> +		.num = 4,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}
> +};

> +static int wsa883x_update_status(struct sdw_slave *slave,
> +				 enum sdw_slave_status status)
> +{
> +	struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev);
> +
> +	if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)

do you actually need to test if slave->dev_num is > 0?

if I look at drivers/soundwire/bus.c, update_status cannot really be
invoked with dev_num == 0.

> +		wsa883x_init(wsa883x);
> +
> +	return 0;
> +}
> +

> +static int __maybe_unused wsa883x_runtime_resume(struct device *dev)
> +{
> +	struct sdw_slave *slave = dev_to_sdw_dev(dev);
> +	struct regmap *regmap = dev_get_regmap(dev, NULL);
> +	struct wsa883x_priv *wsa883x = dev_get_drvdata(dev);
> +	int ret;
> +
> +	ret = regulator_enable(wsa883x->vdd);
> +	if (ret) {
> +		dev_err(dev, "Failed to enable vdd regulator (%d)\n", ret);
> +		return ret;
> +	}
> +
> +	gpiod_direction_output(wsa883x->sd_n, 1);
> +
> +	wait_for_completion_timeout(&slave->initialization_complete,
> +				    msecs_to_jiffies(WSA883X_PROBE_TIMEOUT));

check for success? You don't want to enable regmap sync below if the
device never successfully attached and initialized.

> +
> +	usleep_range(20000, 20010);
> +	regcache_cache_only(regmap, false);
> +	regcache_sync(regmap);
> +
> +	return 0;
> +}


WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, tiwai@suse.com, lgirdwood@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] ASoC: codecs: add wsa883x amplifier support
Date: Wed, 29 Jun 2022 10:03:02 -0500	[thread overview]
Message-ID: <352fac7e-597c-84af-d33b-bdff0e2acdb6@linux.intel.com> (raw)
In-Reply-To: <20220629090644.67982-3-srinivas.kandagatla@linaro.org>


> +/* 4 ports */
> +static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = {
> +	{
> +		/* DAC */
> +		.num = 1,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}, {

nit-pick: it's unusual to see such opening brackets for structure
initialization, usually there are on a new line.

> +		/* COMP */
> +		.num = 2,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}, {
> +		/* BOOST */
> +		.num = 3,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}, {
> +		/* VISENSE */
> +		.num = 4,
> +		.type = SDW_DPN_SIMPLE,
> +		.min_ch = 1,
> +		.max_ch = 1,
> +		.simple_ch_prep_sm = true,
> +		.read_only_wordlength = true,
> +	}
> +};

> +static int wsa883x_update_status(struct sdw_slave *slave,
> +				 enum sdw_slave_status status)
> +{
> +	struct wsa883x_priv *wsa883x = dev_get_drvdata(&slave->dev);
> +
> +	if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)

do you actually need to test if slave->dev_num is > 0?

if I look at drivers/soundwire/bus.c, update_status cannot really be
invoked with dev_num == 0.

> +		wsa883x_init(wsa883x);
> +
> +	return 0;
> +}
> +

> +static int __maybe_unused wsa883x_runtime_resume(struct device *dev)
> +{
> +	struct sdw_slave *slave = dev_to_sdw_dev(dev);
> +	struct regmap *regmap = dev_get_regmap(dev, NULL);
> +	struct wsa883x_priv *wsa883x = dev_get_drvdata(dev);
> +	int ret;
> +
> +	ret = regulator_enable(wsa883x->vdd);
> +	if (ret) {
> +		dev_err(dev, "Failed to enable vdd regulator (%d)\n", ret);
> +		return ret;
> +	}
> +
> +	gpiod_direction_output(wsa883x->sd_n, 1);
> +
> +	wait_for_completion_timeout(&slave->initialization_complete,
> +				    msecs_to_jiffies(WSA883X_PROBE_TIMEOUT));

check for success? You don't want to enable regmap sync below if the
device never successfully attached and initialized.

> +
> +	usleep_range(20000, 20010);
> +	regcache_cache_only(regmap, false);
> +	regcache_sync(regmap);
> +
> +	return 0;
> +}


  reply	other threads:[~2022-06-29 15:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  9:06 [PATCH 0/4] ASoC: codecs: add WSA883x support Srinivas Kandagatla
2022-06-29  9:06 ` Srinivas Kandagatla
2022-06-29  9:06 ` [PATCH 1/4] ASoC: dt-bindings: Add WSA883x bindings Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29  9:06 ` [PATCH 2/4] ASoC: codecs: add wsa883x amplifier support Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29 15:03   ` Pierre-Louis Bossart [this message]
2022-06-29 15:03     ` Pierre-Louis Bossart
2022-06-29 16:09     ` Srinivas Kandagatla
2022-06-29 16:09       ` Srinivas Kandagatla
2022-06-29 16:42       ` Pierre-Louis Bossart
2022-06-29 16:42         ` Pierre-Louis Bossart
2022-06-29  9:06 ` [PATCH 3/4] ASoC: codecs: wsa883x: add control, dapm widgets and map Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29 10:58   ` Mark Brown
2022-06-29 10:58     ` Mark Brown
2022-06-29 11:00     ` Srinivas Kandagatla
2022-06-29 11:00       ` Srinivas Kandagatla
2022-06-29  9:06 ` [PATCH 4/4] MAINTAINERS: add ASoC Qualcomm codecs Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29 14:44 ` (subset) [PATCH 0/4] ASoC: codecs: add WSA883x support Mark Brown
2022-06-29 14:44   ` 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=352fac7e-597c-84af-d33b-bdff0e2acdb6@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.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: link
Be 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.