From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>, "Liao, Bard" <bard.liao@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"vinod.koul@linaro.org" <vinod.koul@linaro.org>,
"Lin, Mengdong" <mengdong.lin@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"hui.wang@canonical.com" <hui.wang@canonical.com>,
"vkoul@kernel.org" <vkoul@kernel.org>,
"srinivas.kandagatla@linaro.org" <srinivas.kandagatla@linaro.org>,
"ranjani.sridharan@linux.intel.com"
<ranjani.sridharan@linux.intel.com>,
"jank@cadence.com" <jank@cadence.com>,
Greg KH <gregkh@linuxfoundation.org>,
"Kale, Sanyog R" <sanyog.r.kale@intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
"rander.wang@linux.intel.com" <rander.wang@linux.intel.com>
Subject: Re: [PATCH v3] soundwire: SDCA: add helper macro to access controls
Date: Fri, 30 Oct 2020 10:52:24 -0500 [thread overview]
Message-ID: <880a22a2-49f6-fa1c-46ad-6388cbd26ee4@linux.intel.com> (raw)
In-Reply-To: <s5hsg9wrlhc.wl-tiwai@suse.de>
>>>> +#define SDW_SDCA_CTL(fun, ent, ctl, ch) (BIT(30) |
>>> \
>>>> + (((fun) & 0x7) << 22) | \
>>>> + (((ent) & 0x40) << 15) | \
>>>> + (((ent) & 0x3f) << 7) | \
>>>> + (((ctl) & 0x30) << 15) | \
>>>> + (((ctl) & 0x0f) << 3) | \
>>>> + (((ch) & 0x38) << 12) | \
>>>> + ((ch) & 0x07))
>>>> +
>>>> +#define SDW_SDCA_MBQ_CTL(reg) ((reg) | BIT(13))
>>>> +#define SDW_SDCA_NEXT_CTL(reg) ((reg) | BIT(14))
>>>> +
>>>> #endif /* __SDW_REGISTERS_H */
>>>
>>>
>>> No users of these macros?
>>
>> SDW_SDCA_CTL is used in sdca codec drivers which are not upstream yet.
>> SDW_SDCA_MBQ_CTL will be used in a new regmap method.
>> SDW_SDCA_NEXT_CTL can be used in sdca codec drivers, too.
>
> Well, the point is that it's hard to review without seeing how the
> code of actual users are.
Agree, but our job is not made easy by the three-way dependency on
regmap, SoundWire before we can submit ASoC codec drivers (developed by
Realtek and tested by Intel).
If you prefer us to send all patches for SDCA codec support in one shot,
that would be fine with us.
> BTW, the bit definitions can be simplified with GENMASK().
> I personally don't think GENMASK() necessarily good, but it may fit
> better in a case like this.
we use this macro in switch cases, e.g. for regmap properties to define
read/volatile registers:
case SDW_SDCA_CTL(FUN_JACK_CODEC, RT711_SDCA_ENT_GE49,
RT711_SDCA_CTL_SELECTED_MODE, 0):
case SDW_SDCA_CTL(FUN_JACK_CODEC, RT711_SDCA_ENT_GE49,
RT711_SDCA_CTL_DETECTED_MODE, 0):
case SDW_SDCA_CTL(FUN_HID, RT711_SDCA_ENT_HID01,
RT711_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ...
SDW_SDCA_CTL(FUN_HID, RT711_SDCA_ENT_HID01,
RT711_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
case RT711_BUF_ADDR_HID1 ... RT711_BUF_ADDR_HID2:
return true;
https://github.com/thesofproject/linux/blob/70fe32e776dafb4b03581d62a4569f65c2f13ada/sound/soc/codecs/rt711-sdca-sdw.c#L35
and unfortunately all our attempts to use FIELD_PREP, FIELD_GET,
u32_encode, as suggested by Vinod, failed for this case due to
compilation issues (can't use these macros outside of a function scope).
The errors were shared with Vinod.
That's why we went back to the initial suggestion to deal with the
shifts/masks by hand. For now we don't have a better solution that works
in all cases were the macro is used.
Thanks
-Pierre
next prev parent reply other threads:[~2020-10-30 16:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 20:49 Bard Liao
2020-10-30 9:36 ` Greg KH
2020-10-30 11:24 ` Liao, Bard
2020-10-30 11:39 ` Takashi Iwai
2020-10-30 15:52 ` Pierre-Louis Bossart [this message]
2020-10-30 16:36 ` Takashi Iwai
2020-10-30 11:56 ` Greg KH
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=880a22a2-49f6-fa1c-46ad-6388cbd26ee4@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=bard.liao@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hui.wang@canonical.com \
--cc=jank@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mengdong.lin@intel.com \
--cc=rander.wang@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=srinivas.kandagatla@linaro.org \
--cc=tiwai@suse.de \
--cc=vinod.koul@linaro.org \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.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