From: "Rojewski, Cezary" <cezary.rojewski@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "pierre-louis.bossart@linux.intel.com"
<pierre-louis.bossart@linux.intel.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"Kaczmarski, Filip" <filip.kaczmarski@intel.com>,
"N, Harshapriya" <harshapriya.n@intel.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"Barlik, Marcin" <marcin.barlik@intel.com>,
"zwisler@google.com" <zwisler@google.com>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"tiwai@suse.com" <tiwai@suse.com>,
"Proborszcz, Filip" <filip.proborszcz@intel.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"amadeuszx.slawinski@linux.intel.com"
<amadeuszx.slawinski@linux.intel.com>,
"Wasko, Michal" <michal.wasko@intel.com>,
"cujomalainey@chromium.org" <cujomalainey@chromium.org>,
"Hejmowski, Krzysztof" <krzysztof.hejmowski@intel.com>,
"ppapierkowski@habana.ai" <ppapierkowski@habana.ai>,
"Gopal, Vamshi Krishna" <vamshi.krishna.gopal@intel.com>
Subject: RE: [PATCH v9 02/14] ASoC: Intel: catpt: Implement IPC protocol
Date: Tue, 29 Sep 2020 09:39:36 +0000 [thread overview]
Message-ID: <39c11ae42aa84cd3b03e8cc376e57317@intel.com> (raw)
In-Reply-To: <20200929084626.GY3956970@smile.fi.intel.com>
On 2020-09-29 10:46 AM, Andy Shevchenko wrote:
> On Mon, Sep 28, 2020 at 04:52:41PM +0000, Rojewski, Cezary wrote:
>> On 2020-09-28 3:44 PM, Andy Shevchenko wrote:
>>> On Sat, Sep 26, 2020 at 10:58:58AM +0200, Cezary Rojewski wrote:
...
>>>> + ret = ipc->rx.rsp.status;
>>>> + if (reply) {
>>>> + reply->header = ipc->rx.header;
>>>> + if (!ret && reply->data)
>>>> + memcpy(reply->data, ipc->rx.data, reply->size);
>>>> + }
>>>> +
>>>> + return ret;
>>>
>>> One more looking into this... What about
>>>
>>> if (reply)
>>> reply->header = ipc->rx.header;
>>>
>>> ret = ipc->rx.rsp.status; // or even directly if (status) return status.
>>> if (ret)
>>> return ret;
>>>
>>> if (reply->data)
>>> memcpy(reply->data, ipc->rx.data, reply->size);
>>>
>>> return 0;
>>>
>>> It may be verbose but I think readability is better here.
>>
>> In your example, last 'if' will cause exception if reply==NULL.
>
> Yeah, should be reply && reply->data.
>
>> Got your point, although that's just few lines which already involve
>> 'if' with { } spacing. After removing size-checks you suggested this
>> code is quite thin already.
>
> Yes, sometimes too thin is not good in terms of readability.
>
This will cost us additional check (2x reply==NULL instead of 1x). Maybe
a newline between:
reply->header = ipc->rx.header;
if (!ret && reply->data)
memcpy(reply->data, ipc->rx.data, reply->size);
suffices?
...
>>>> + CATPT_CHANNEL_CONFIG_5_POINT_0 = 7, /* L, C, R, Ls & Rs */
>>>> + CATPT_CHANNEL_CONFIG_5_POINT_1 = 8, /* L, C, R, Ls, Rs & LFE */
>>>> + CATPT_CHANNEL_CONFIG_DUAL_MONO = 9, /* One channel replicated in two */
>>>> + CATPT_CHANNEL_CONFIG_INVALID = 10,
>>>
>>> Hmm... I think I got the point why DUAL_MONO was at the end of the switch-case.
>>>
>>
>> Well, well. Indeed we found where Willy is..
>
> So, we may return to the previous state, up to you.
>
> ...
>
>>>> +enum catpt_mclk_frequency {
>>>> + CATPT_MCLK_OFF = 0,
>>>> + CATPT_MCLK_FREQ_6_MHZ = 1,
>>>> + CATPT_MCLK_FREQ_21_MHZ = 2,
>>>> + CATPT_MCLK_FREQ_24_MHZ = 3,
>>>> +};
>>>
>>> Looks like a 3 MHz as base frequency with multiplicators 0, 2, 7, 8.
>>
>> Naming based on FW enum type equivalent.
>
> It was just an observation without any AR item :-)
> If you really know the (hardware) background of these choices then perhaps
> comment would be good to have.
>
In general I'm avoiding that subject here. Quite disappointed with what
I had to face, and that's not "just" existing linux solution but every
other component involved in LPT/WPT ADSP project.
I have plans for many more comments Andy, e.g.: fw image block division
(ascii graph and such). All of that will come in time, eventually. Not
intending to leave catpt without maintenance like other sound/soc/intel/
solutions once were.
>>>> +#define CATPT_STREAM_MSG(msg_type) \
>>>> +{ \
>>>> + .stream_msg_type = CATPT_STRM_##msg_type, \
>>>> + .global_msg_type = CATPT_GLB_STREAM_MESSAGE }
>>>> +#define CATPT_STAGE_MSG(msg_type) \
>>>> +{ \
>>>> + .stage_action = CATPT_STG_##msg_type, \
>>>> + .stream_msg_type = CATPT_STRM_STAGE_MESSAGE, \
>>>> + .global_msg_type = CATPT_GLB_STREAM_MESSAGE }
>>>
>>> Hmm... This split is interesting. I would rather move } to a new line.
>>>
>>
>> As basically everything in my code, style is based on existing example -
>> usually stuff from ASoC core - here, it's include/sound/soc.h. It's full
>> of such definitions so because catpt belongs to ASoC subsystem, I've
>> used the exact same style. No problem changing if that's your preference.
>
> I think it's better to follow the existing style across subsystem. You may
> discard my (style related) comments if they contradict with used style.
>
If there are no other concerns, either a quick spinoff (v10) or delay
those readability improvements till series with resource_union() re-use?
While catpt is a big upgrade when compared to existing /haswell/
(obviously) there are more fruits of this rewrite: house cleaning -
follow-up series targeting /haswell/, /baytrail/ and /common/ of
sound/soc/intel. Guess everyone would like to see those in 5.10.
Regards,
Czarek
next prev parent reply other threads:[~2020-09-29 9:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-26 8:58 [PATCH v9 00/14] ASoC: Intel: Catpt - Lynx and Wildcat point Cezary Rojewski
2020-09-26 8:58 ` [PATCH v9 01/14] ASoC: Intel: Add catpt base members Cezary Rojewski
2020-09-26 8:58 ` [PATCH v9 02/14] ASoC: Intel: catpt: Implement IPC protocol Cezary Rojewski
2020-09-28 13:44 ` Andy Shevchenko
2020-09-28 16:52 ` Rojewski, Cezary
2020-09-29 8:46 ` Andy Shevchenko
2020-09-29 9:39 ` Rojewski, Cezary [this message]
2020-09-29 10:43 ` Andy Shevchenko
2020-09-26 8:58 ` [PATCH v9 03/14] ASoC: Intel: catpt: Add IPC message handlers Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 04/14] ASoC: Intel: catpt: Define DSP operations Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 05/14] ASoC: Intel: catpt: Firmware loading and context restore Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 06/14] ASoC: Intel: catpt: PCM operations Cezary Rojewski
2020-09-29 11:33 ` Andy Shevchenko
2020-09-29 13:26 ` Rojewski, Cezary
2020-09-29 16:46 ` Andy Shevchenko
2020-09-26 8:59 ` [PATCH v9 07/14] ASoC: Intel: catpt: Device driver lifecycle Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 08/14] ASoC: Intel: catpt: Event tracing Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 09/14] ASoC: Intel: catpt: Simple sysfs attributes Cezary Rojewski
2020-09-28 13:03 ` Andy Shevchenko
2020-09-26 8:59 ` [PATCH v9 10/14] ASoC: Intel: haswell: Remove haswell-solution specific code Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 11/14] ASoC: Intel: broadwell: " Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 12/14] ASoC: Intel: bdw-5650: " Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 13/14] ASoC: Intel: bdw-5677: " Cezary Rojewski
2020-09-26 8:59 ` [PATCH v9 14/14] ASoC: Intel: Select catpt and deprecate haswell Cezary Rojewski
2020-09-29 11:49 ` Amadeusz Sławiński
2020-09-29 13:09 ` Rojewski, Cezary
2020-09-29 13:38 ` Rojewski, Cezary
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=39c11ae42aa84cd3b03e8cc376e57317@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cujomalainey@chromium.org \
--cc=filip.kaczmarski@intel.com \
--cc=filip.proborszcz@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=harshapriya.n@intel.com \
--cc=krzysztof.hejmowski@intel.com \
--cc=lgirdwood@gmail.com \
--cc=marcin.barlik@intel.com \
--cc=michal.wasko@intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ppapierkowski@habana.ai \
--cc=tiwai@suse.com \
--cc=vamshi.krishna.gopal@intel.com \
--cc=zwisler@google.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.