From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Cc: Fabio Estevam <festevam@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Igor Opaniuk <igor.opaniuk@toradex.com>,
Marcel Ziswiler <marcel.ziswiler@toradex.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Sasha Levin <sashal@kernel.org>,
Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH v5 2/6] ASoC: sgtl5000: Improve VAG power and mute control
Date: Thu, 18 Jul 2019 20:48:45 +0200 [thread overview]
Message-ID: <a86e4d6b-ed2c-d2f2-2974-6f00dc6ef68a@intel.com> (raw)
In-Reply-To: <9c9ee47c-48bd-7109-9870-8f73be1f1cfa@intel.com>
On 2019-07-18 20:42, Cezary Rojewski wrote:
> On 2019-07-18 11:02, Oleksandr Suvorov wrote:
>> +enum {
>> + HP_POWER_EVENT,
>> + DAC_POWER_EVENT,
>> + ADC_POWER_EVENT,
>> + LAST_POWER_EVENT
>> +};
>> +
>> +static u16 mute_mask[] = {
>> + SGTL5000_HP_MUTE,
>> + SGTL5000_OUTPUTS_MUTE,
>> + SGTL5000_OUTPUTS_MUTE
>> +};
>
> If mute_mask[] is only used within common handler, you may consider
> declaring const array within said handler instead (did not check that
> myself).
> Otherwise, simple comment for the second _OUTPUTS_MUTE should suffice -
> its not self explanatory why you doubled that mask.
>
>> +
>> /* sgtl5000 private structure in codec */
>> struct sgtl5000_priv {
>> int sysclk; /* sysclk rate */
>> @@ -137,8 +157,109 @@ struct sgtl5000_priv {
>> u8 micbias_voltage;
>> u8 lrclk_strength;
>> u8 sclk_strength;
>> + u16 mute_state[LAST_POWER_EVENT];
>> };
>
> When I spoke of LAST enum constant, I did not really had this specific
> usage in mind.
>
> From design perspective, _LAST_ does not exist and should never be
> referred to as "the next option" i.e.: new enum constant.
> That is way preferred usage is:
> u16 mute_state[ADC_POWER_EVENT+1;
> -or-
> u16 mute_state[LAST_POWER_EVENT+1];
>
> Maybe I'm just being radical here :)
>
> Czarek
Forgive me for double posting. Comment above is targeted towards:
>> +enum {
>> + HP_POWER_EVENT,
>> + DAC_POWER_EVENT,
>> + ADC_POWER_EVENT,
>> + LAST_POWER_EVENT
>> +};
as LAST_POWER_EVENT is not assigned explicitly to ADC_POWER_EVENT and
thus generates implicit "new option" of value 3.
Czarek
next prev parent reply other threads:[~2019-07-18 18:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 9:02 [PATCH v5 0/6] VAG power control improvement for sgtl5000 codec Oleksandr Suvorov
2019-07-18 9:02 ` [PATCH v5 1/6] ASoC: Define a set of DAPM pre/post-up events Oleksandr Suvorov
2019-07-18 9:02 ` [PATCH v5 2/6] ASoC: sgtl5000: Improve VAG power and mute control Oleksandr Suvorov
2019-07-18 16:25 ` Igor Opaniuk
2019-07-18 18:42 ` Cezary Rojewski
2019-07-18 18:48 ` Cezary Rojewski [this message]
2019-07-19 7:09 ` Oleksandr Suvorov
2019-07-19 7:19 ` Cezary Rojewski
2019-07-18 9:02 ` [PATCH v5 3/6] ASoC: sgtl5000: Fix definition of VAG Ramp Control Oleksandr Suvorov
2019-07-18 9:02 ` [PATCH v5 4/6] ASoC: sgtl5000: add ADC mute control Oleksandr Suvorov
2019-07-18 9:02 ` [PATCH v5 5/6] ASoC: sgtl5000: Fix of unmute outputs on probe Oleksandr Suvorov
2019-07-18 9:02 ` [PATCH v5 6/6] ASoC: sgtl5000: Fix charge pump source assignment Oleksandr Suvorov
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=a86e4d6b-ed2c-d2f2-2974-6f00dc6ef68a@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=igor.opaniuk@toradex.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel.ziswiler@toradex.com \
--cc=oleksandr.suvorov@toradex.com \
--cc=perex@perex.cz \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome