From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
vkoul@kernel.org
Cc: sanyog.r.kale@intel.com, yung-chuan.liao@linux.intel.com,
linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH v2 1/5] soundwire: qcom: add support to missing transport params
Date: Wed, 3 Mar 2021 09:36:24 +0000 [thread overview]
Message-ID: <d0dc4c6f-cbd5-06e8-6ed8-234a55f9de9c@linaro.org> (raw)
In-Reply-To: <06a687f6-e79c-9bad-32c2-ea61356f882e@linux.intel.com>
On 02/03/2021 14:29, Pierre-Louis Bossart wrote:
>
>>>> for (i = 0; i < nports; i++) {
>>>> ctrl->pconfig[i].si = si[i];
>>>> ctrl->pconfig[i].off1 = off1[i];
>>>> ctrl->pconfig[i].off2 = off2[i];
>>>> ctrl->pconfig[i].bp_mode = bp_mode[i];
>>>> + ctrl->pconfig[i].hstart = hstart[i];
>>>> + ctrl->pconfig[i].hstop = hstop[i];
>>>> + ctrl->pconfig[i].word_length = word_length[i];
>>>> + ctrl->pconfig[i].blk_group_count = blk_group_count[i];
>>>> + ctrl->pconfig[i].lane_control = lane_control[i];
>>>> }
>>>
>>> I don't get why you test the values parsed from DT before writing the
>>> registers. Why do test them here? if some values are incorrect it's
>>> much better to provide an error log instead of writing a partially
>>> valid setup to hardware, no?
>>
>> from DT we pass parameters for all the master ports, however some of
>> these parameters are not really applicable for some of the ports! so
>> the way we handle this is by marking them as 0xFF which means these
>> values are not applicable for those ports! Having said that I think I
>> should probably redefine SWR_INVALID_PARAM to QCOM_SWR_PARAM_NA or
>> something on those lines!
>
> Humm, do you have an example here? It's a bit odd to define DT
In DT we describe parameters for each port in an array so, parameters
for ports that are not applicable/available for that platform can be
marked with 0xFF.
Most importantly, Some of these registers are only implemented based on
the data ports. Ex: GROUP_CONTROL register is only implemented for data
ports that support Group Count other than 0. Like wise for HSTART/STOP
for Full Data ports only!
So avoiding reading/writing to registers by passing
invalid/not-applicable value 0xFF made more sense!
Here are some examples of controller instances on SM8250 SoC.
soundwire-controller@3230000 {
reg = <0 0x3230000 0 0x2000>;
compatible = "qcom,soundwire-v1.5.1";
interrupts-extended = <&intc GIC_SPI 297 IRQ_TYPE_LEVEL_HIGH>,
<&pdc 109 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "core", "wakeup";
qcom,clock-stop-mode0;
clocks = <&txmacro>;
clock-names = "iface";
qcom,din-ports = <5>;
qcom,dout-ports = <0>;
qcom,ports-sinterval-low = /bits/ 8 <0xFF 0x01 0x01 0x03 0x03>;
qcom,ports-offset1 = /bits/ 8 <0xFF 0x01 0x00 0x02 0x00>;
qcom,ports-offset2 = /bits/ 8 <0xFF 0x00 0x00 0x00 0x00>;
qcom,ports-block-pack-mode = /bits/ 8 <0xFF 0xFF 0xFF 0xFF 0xFF>;
qcom,ports-hstart = /bits/ 8 <0xFF 0xFF 0xFF 0xFF 0xFF>;
qcom,ports-hstop = /bits/ 8 <0xFF 0xFF 0xFF 0xFF 0xFF>;
qcom,ports-word-length = /bits/ 8 <0xFF 0xFF 0xFF 0xFF 0xFF>;
qcom,ports-block-group-count = /bits/ 8 <0xFF 0xFF 0xFF 0xFF 0xFF>;
qcom,ports-lane-control = /bits/ 8 <0xFF 0x00 0x01 0x00 0x01>;
qcom,port-offset = <1>;
#sound-dai-cells = <1>;
#address-cells = <2>;
#size-cells = <0>;
};
soundwire-controller@3210000 {
reg = <0 0x3210000 0 0x2000>;
compatible = "qcom,soundwire-v1.5.1";
interrupts = <GIC_SPI 298 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rxmacro>;
clock-names = "iface";
qcom,clock-stop-mode0;
qcom,din-ports = <0>;
qcom,dout-ports = <5>;
qcom,ports-sinterval-low = /bits/ 8 <0x03 0x1F 0x1F 0x07 0x00>;
qcom,ports-offset1 = /bits/ 8 <0x00 0x00 0x0B 0x01 0x00>;
qcom,ports-offset2 = /bits/ 8 <0x00 0x00 0x0B 0x00 0x00>;
qcom,ports-hstart = /bits/ 8 <0xFF 0x03 0xFF 0xFF 0xFF>;
qcom,ports-hstop = /bits/ 8 <0xFF 0x06 0xFF 0xFF 0xFF>;
qcom,ports-word-length = /bits/ 8 <0x01 0x07 0x04 0xFF 0xFF>;
qcom,ports-block-pack-mode = /bits/ 8 <0xFF 0x00 0x01 0xFF 0xFF>;
qcom,ports-lane-control = /bits/ 8 <0x01 0x00 0x00 0x00 0x00>;
qcom,ports-block-group-count = /bits/ 8 <0xFF 0xFF 0xFF 0xFF 0x00>;
#sound-dai-cells = <1>;
#address-cells = <2>;
#size-cells = <0>;
};
> properties that may or may not be valid. If this is intentional and
> desired, this should still be captured somehow, e.g. in the bindings
> documentation or in the code with a comment, no?
Yes, I agree with you on this, I should document this in bindings!
--srini
next prev parent reply other threads:[~2021-03-03 14:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 15:58 [PATCH v2 0/5] soundwire: qcom: various improvements Srinivas Kandagatla
2021-02-26 15:58 ` [PATCH v2 1/5] soundwire: qcom: add support to missing transport params Srinivas Kandagatla
2021-02-26 16:45 ` Pierre-Louis Bossart
2021-03-02 10:13 ` Srinivas Kandagatla
2021-03-02 14:29 ` Pierre-Louis Bossart
2021-03-03 9:36 ` Srinivas Kandagatla [this message]
2021-03-03 16:16 ` Pierre-Louis Bossart
2021-02-26 15:58 ` [PATCH v2 2/5] soundwire: qcom: set continue execution flag for ignored commands Srinivas Kandagatla
2021-02-26 15:58 ` [PATCH v2 3/5] soundwire: qcom: start the clock during initialization Srinivas Kandagatla
2021-02-26 15:58 ` [PATCH v2 4/5] soundwire: qcom: update register read/write routine Srinivas Kandagatla
2021-02-26 15:58 ` [PATCH v2 5/5] soundwire: qcom: add support to new interrupts Srinivas Kandagatla
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=d0dc4c6f-cbd5-06e8-6ed8-234a55f9de9c@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--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
all inboxes | Powered by JetHome®