Message ID | 20190813083550.5877-1-srinivas.kandagatla@linaro.org |
---|---|
Headers | show |
Series | soundwire: Add support to Qualcomm SoundWire master | expand |
On 2019-08-13 10:35, Srinivas Kandagatla wrote: > On platforms which have smart speaker amplifiers connected via > soundwire and modeled as aux devices in ASoC, in such usecases machine > driver should be able to get sdw master stream from dai so that it can > use the runtime stream to setup slave streams. > > soundwire already as a set function, get function would provide more > flexibility to above configurations. > > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > include/sound/soc-dai.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h > index dc48fe081a20..1e01f4a302e0 100644 > --- a/include/sound/soc-dai.h > +++ b/include/sound/soc-dai.h > @@ -202,6 +202,7 @@ struct snd_soc_dai_ops { > > int (*set_sdw_stream)(struct snd_soc_dai *dai, > void *stream, int direction); > + void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); > /* > * DAI digital mute - optional. > * Called by soc-core to minimise any pops. > @@ -410,4 +411,13 @@ static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, > return -ENOTSUPP; > } > > +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, > + int direction) > +{ > + if (dai->driver->ops->get_sdw_stream) > + return dai->driver->ops->get_sdw_stream(dai, direction); > + else > + return ERR_PTR(-ENOTSUPP); > +} Drop redundant else.
Thanks for the review, On 13/08/2019 17:03, Cezary Rojewski wrote: > On 2019-08-13 10:35, Srinivas Kandagatla wrote: >> On platforms which have smart speaker amplifiers connected via >> soundwire and modeled as aux devices in ASoC, in such usecases machine >> driver should be able to get sdw master stream from dai so that it can >> use the runtime stream to setup slave streams. >> >> soundwire already as a set function, get function would provide more >> flexibility to above configurations. >> >> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> --- >> include/sound/soc-dai.h | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h >> index dc48fe081a20..1e01f4a302e0 100644 >> --- a/include/sound/soc-dai.h >> +++ b/include/sound/soc-dai.h >> @@ -202,6 +202,7 @@ struct snd_soc_dai_ops { >> int (*set_sdw_stream)(struct snd_soc_dai *dai, >> void *stream, int direction); >> + void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); >> /* >> * DAI digital mute - optional. >> * Called by soc-core to minimise any pops. >> @@ -410,4 +411,13 @@ static inline int >> snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, >> return -ENOTSUPP; >> } >> +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, >> + int direction) >> +{ >> + if (dai->driver->ops->get_sdw_stream) >> + return dai->driver->ops->get_sdw_stream(dai, direction); >> + else >> + return ERR_PTR(-ENOTSUPP); >> +} > > Drop redundant else. Not all the dai drivers would implement this function, I guess else is not redundant here! --srini >
On 2019-08-13 18:52, Srinivas Kandagatla wrote: > Thanks for the review, > > On 13/08/2019 17:03, Cezary Rojewski wrote: >> On 2019-08-13 10:35, Srinivas Kandagatla wrote: >>> On platforms which have smart speaker amplifiers connected via >>> soundwire and modeled as aux devices in ASoC, in such usecases machine >>> driver should be able to get sdw master stream from dai so that it can >>> use the runtime stream to setup slave streams. >>> >>> soundwire already as a set function, get function would provide more >>> flexibility to above configurations. >>> >>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >>> --- >>> +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, >>> + int direction) >>> +{ >>> + if (dai->driver->ops->get_sdw_stream) >>> + return dai->driver->ops->get_sdw_stream(dai, direction); >>> + else >>> + return ERR_PTR(-ENOTSUPP); >>> +} >> >> Drop redundant else. > Not all the dai drivers would implement this function, I guess else is > not redundant here! > > --srini >> Eh. By that I meant dropping "else" keyword and reducing indentation for "return ERR_PTR(-ENOTSUPP);" Czarek
On 8/13/19 11:50 AM, Srinivas Kandagatla wrote: > Thanks for the review, > > On 13/08/2019 15:44, Pierre-Louis Bossart wrote: >> On 8/13/19 3:35 AM, Srinivas Kandagatla wrote: >>> On platforms which have smart speaker amplifiers connected via >>> soundwire and modeled as aux devices in ASoC, in such usecases machine >>> driver should be able to get sdw master stream from dai so that it can >>> use the runtime stream to setup slave streams. >> >> using the _set_sdw_stream? I don't fully get the sequence with the >> wording above. > > Yes, using set_sdw_stream(). Maybe I am missing something here, but I don't see where the set_sdw_stream() is called. Also I don't fully get the rule. set_sdw_stream() looks required, get_sdw_stream() is optional, is this what you are suggesting? >> >>> >>> soundwire already as a set function, get function would provide more >>> flexibility to above configurations. >> >> I am not clear if you are asking for both to be used, or get only or >> set only? > > It depends on the usecase, in db845c usecase [1] as Aux device is dai > less, machine driver is using get function to get hold of master stream > so that it can setup slave port config. > > > Looks like there is a typo in above like > > This was supposed to be "soundwire already has a set function, get > function would provide more flexibility to above configurations" > > [1] > https://git.linaro.org/landing-teams/working/qualcomm/kernel.git/tree/sound/soc/qcom/db845c.c?h=integration-linux-qcomlt > > > thanks, > srini > >> >>> >>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >>> --- >>> include/sound/soc-dai.h | 10 ++++++++++ >>> 1 file changed, 10 insertions(+) >>> >>> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h >>> index dc48fe081a20..1e01f4a302e0 100644 >>> --- a/include/sound/soc-dai.h >>> +++ b/include/sound/soc-dai.h >>> @@ -202,6 +202,7 @@ struct snd_soc_dai_ops { >>> int (*set_sdw_stream)(struct snd_soc_dai *dai, >>> void *stream, int direction); >>> + void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); >>> /* >>> * DAI digital mute - optional. >>> * Called by soc-core to minimise any pops. >>> @@ -410,4 +411,13 @@ static inline int >>> snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, >>> return -ENOTSUPP; >>> } >>> +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, >>> + int direction) >>> +{ >>> + if (dai->driver->ops->get_sdw_stream) >>> + return dai->driver->ops->get_sdw_stream(dai, direction); >>> + else >>> + return ERR_PTR(-ENOTSUPP); >>> +} >>> + >>> #endif >>> >> > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On 13/08/2019 18:51, Pierre-Louis Bossart wrote: > On 8/13/19 11:50 AM, Srinivas Kandagatla wrote: >> Thanks for the review, >> >> On 13/08/2019 15:44, Pierre-Louis Bossart wrote: >>> On 8/13/19 3:35 AM, Srinivas Kandagatla wrote: >>>> On platforms which have smart speaker amplifiers connected via >>>> soundwire and modeled as aux devices in ASoC, in such usecases machine >>>> driver should be able to get sdw master stream from dai so that it can >>>> use the runtime stream to setup slave streams. >>> >>> using the _set_sdw_stream? I don't fully get the sequence with the >>> wording above. >> >> Yes, using set_sdw_stream(). > > Maybe I am missing something here, but I don't see where the > set_sdw_stream() is called. sorry for the confusion. It was too quick reply. :-) I was suppose to say sdw_stream_add_slave() instead of set_sdw_stream(). As Aux device is dailess there is no way to get hold of sdw stream runtime for slave device associated with it. Having snd_soc_dai_get_sdw_stream() would help machine driver to get hold of sdw_stream_runtime from controller dai and setup slave streams using sdw_stream_add_slave(). thanks, srini > > Also I don't fully get the rule. set_sdw_stream() looks required, > get_sdw_stream() is optional, is this what you are suggesting? > >>> >>>> >>>> soundwire already as a set function, get function would provide more >>>> flexibility to above configurations. >>> >>> I am not clear if you are asking for both to be used, or get only or >>> set only? >> >> It depends on the usecase, in db845c usecase [1] as Aux device is dai >> less, machine driver is using get function to get hold of master >> stream so that it can setup slave port config. >> >> >> Looks like there is a typo in above like >> >> This was supposed to be "soundwire already has a set function, get >> function would provide more flexibility to above configurations" >> >> [1] >> https://git.linaro.org/landing-teams/working/qualcomm/kernel.git/tree/sound/soc/qcom/db845c.c?h=integration-linux-qcomlt >> >> >> thanks, >> srini >> >>> >>>> >>>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >>>> --- >>>> include/sound/soc-dai.h | 10 ++++++++++ >>>> 1 file changed, 10 insertions(+) >>>> >>>> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h >>>> index dc48fe081a20..1e01f4a302e0 100644 >>>> --- a/include/sound/soc-dai.h >>>> +++ b/include/sound/soc-dai.h >>>> @@ -202,6 +202,7 @@ struct snd_soc_dai_ops { >>>> int (*set_sdw_stream)(struct snd_soc_dai *dai, >>>> void *stream, int direction); >>>> + void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); >>>> /* >>>> * DAI digital mute - optional. >>>> * Called by soc-core to minimise any pops. >>>> @@ -410,4 +411,13 @@ static inline int >>>> snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, >>>> return -ENOTSUPP; >>>> } >>>> +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai >>>> *dai, >>>> + int direction) >>>> +{ >>>> + if (dai->driver->ops->get_sdw_stream) >>>> + return dai->driver->ops->get_sdw_stream(dai, direction); >>>> + else >>>> + return ERR_PTR(-ENOTSUPP); >>>> +} >>>> + >>>> #endif >>>> >>> >> _______________________________________________ >> Alsa-devel mailing list >> Alsa-devel@alsa-project.org >> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel >
On 8/13/19 1:06 PM, Srinivas Kandagatla wrote: > > > On 13/08/2019 18:51, Pierre-Louis Bossart wrote: >> On 8/13/19 11:50 AM, Srinivas Kandagatla wrote: >>> Thanks for the review, >>> >>> On 13/08/2019 15:44, Pierre-Louis Bossart wrote: >>>> On 8/13/19 3:35 AM, Srinivas Kandagatla wrote: >>>>> On platforms which have smart speaker amplifiers connected via >>>>> soundwire and modeled as aux devices in ASoC, in such usecases machine >>>>> driver should be able to get sdw master stream from dai so that it can >>>>> use the runtime stream to setup slave streams. >>>> >>>> using the _set_sdw_stream? I don't fully get the sequence with the >>>> wording above. >>> >>> Yes, using set_sdw_stream(). >> >> Maybe I am missing something here, but I don't see where the >> set_sdw_stream() is called. > > sorry for the confusion. It was too quick reply. :-) > I was suppose to say sdw_stream_add_slave() instead of set_sdw_stream(). ok, so get_sdw_stream() and set_sdw_stream() are not meant to be mirrors or both implemented. It's just a helper to respectively get a context or set a context but a get-modify-set type of operation is not expected. Do I get this right? > > As Aux device is dailess there is no way to get hold of sdw stream > runtime for slave device associated with it. > > Having snd_soc_dai_get_sdw_stream() would help machine driver to get > hold of sdw_stream_runtime from controller dai and setup slave streams > using sdw_stream_add_slave(). > > > thanks, > srini > > >> >> Also I don't fully get the rule. set_sdw_stream() looks required, >> get_sdw_stream() is optional, is this what you are suggesting? >> >>>> >>>>> >>>>> soundwire already as a set function, get function would provide more >>>>> flexibility to above configurations. >>>> >>>> I am not clear if you are asking for both to be used, or get only or >>>> set only? >>> >>> It depends on the usecase, in db845c usecase [1] as Aux device is >>> dai less, machine driver is using get function to get hold of master >>> stream so that it can setup slave port config. >>> >>> >>> Looks like there is a typo in above like >>> >>> This was supposed to be "soundwire already has a set function, get >>> function would provide more flexibility to above configurations" >>> >>> [1] >>> https://git.linaro.org/landing-teams/working/qualcomm/kernel.git/tree/sound/soc/qcom/db845c.c?h=integration-linux-qcomlt >>> >>> >>> thanks, >>> srini >>> >>>> >>>>> >>>>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >>>>> --- >>>>> include/sound/soc-dai.h | 10 ++++++++++ >>>>> 1 file changed, 10 insertions(+) >>>>> >>>>> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h >>>>> index dc48fe081a20..1e01f4a302e0 100644 >>>>> --- a/include/sound/soc-dai.h >>>>> +++ b/include/sound/soc-dai.h >>>>> @@ -202,6 +202,7 @@ struct snd_soc_dai_ops { >>>>> int (*set_sdw_stream)(struct snd_soc_dai *dai, >>>>> void *stream, int direction); >>>>> + void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); >>>>> /* >>>>> * DAI digital mute - optional. >>>>> * Called by soc-core to minimise any pops. >>>>> @@ -410,4 +411,13 @@ static inline int >>>>> snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, >>>>> return -ENOTSUPP; >>>>> } >>>>> +static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai >>>>> *dai, >>>>> + int direction) >>>>> +{ >>>>> + if (dai->driver->ops->get_sdw_stream) >>>>> + return dai->driver->ops->get_sdw_stream(dai, direction); >>>>> + else >>>>> + return ERR_PTR(-ENOTSUPP); >>>>> +} >>>>> + >>>>> #endif >>>>> >>>> >>> _______________________________________________ >>> Alsa-devel mailing list >>> Alsa-devel@alsa-project.org >>> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel >>
On 8/13/19 2:18 PM, Mark Brown wrote: > On Tue, Aug 13, 2019 at 02:15:18PM -0500, Pierre-Louis Bossart wrote: >> On 8/13/19 1:06 PM, Srinivas Kandagatla wrote: > >>> sorry for the confusion. It was too quick reply. :-) >>> I was suppose to say sdw_stream_add_slave() instead of set_sdw_stream(). > >> ok, so get_sdw_stream() and set_sdw_stream() are not meant to be mirrors or >> both implemented. It's just a helper to respectively get a context or set a >> context but a get-modify-set type of operation is not expected. > >> Do I get this right? > > This seems like it's going to be confusing... Indeed. I don't have a full understanding of that part to be honest, nor why we need something SoundWire-specific. We already abused the set_tdm_slot API to store an HDaudio stream, now we have a rather confusing stream information for SoundWire and I have about 3 other 'stream' contexts in SOF... I am still doing basic cleanups but this has been on my radar for a while.
On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: > Indeed. I don't have a full understanding of that part to be honest, nor why > we need something SoundWire-specific. We already abused the set_tdm_slot API > to store an HDaudio stream, now we have a rather confusing stream > information for SoundWire and I have about 3 other 'stream' contexts in > SOF... I am still doing basic cleanups but this has been on my radar for a > while. There is something to be said for not abusing the TDM slot API if it can make things clearer by using bus-idiomatic mechanisms, but it does mean everything needs to know about each individual bus :/ .
On 13-08-19, 20:58, Mark Brown wrote: > On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: > > > Indeed. I don't have a full understanding of that part to be honest, nor why > > we need something SoundWire-specific. We already abused the set_tdm_slot API > > to store an HDaudio stream, now we have a rather confusing stream > > information for SoundWire and I have about 3 other 'stream' contexts in > > SOF... I am still doing basic cleanups but this has been on my radar for a > > while. > > There is something to be said for not abusing the TDM slot API if it can > make things clearer by using bus-idiomatic mechanisms, but it does mean > everything needs to know about each individual bus :/ . Here ASoC doesn't need to know about sdw bus. As Srini explained, this helps in the case for him to get the stream context and set the stream context from the machine driver. Nothing else is expected to be done from this API. We already do a set using snd_soc_dai_set_sdw_stream(). Here we add the snd_soc_dai_get_sdw_stream() to query Thanks -- ~Vinod
On Wed, Aug 14, 2019 at 09:41:42AM +0530, Vinod Koul wrote: > On 13-08-19, 20:58, Mark Brown wrote: > > There is something to be said for not abusing the TDM slot API if it can > > make things clearer by using bus-idiomatic mechanisms, but it does mean > > everything needs to know about each individual bus :/ . > Here ASoC doesn't need to know about sdw bus. As Srini explained, this > helps in the case for him to get the stream context and set the stream > context from the machine driver. Other drivers interoperating with the Soundwire DAI might want to do something, it looks like that's the case for SOF. > Nothing else is expected to be done from this API. We already do a set > using snd_soc_dai_set_sdw_stream(). Here we add the snd_soc_dai_get_sdw_stream() to query Well, if the API is not expected to do anything we can optimize it and just remove it!
On 8/13/19 11:11 PM, Vinod Koul wrote: > On 13-08-19, 20:58, Mark Brown wrote: >> On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: >> >>> Indeed. I don't have a full understanding of that part to be honest, nor why >>> we need something SoundWire-specific. We already abused the set_tdm_slot API >>> to store an HDaudio stream, now we have a rather confusing stream >>> information for SoundWire and I have about 3 other 'stream' contexts in >>> SOF... I am still doing basic cleanups but this has been on my radar for a >>> while. >> >> There is something to be said for not abusing the TDM slot API if it can >> make things clearer by using bus-idiomatic mechanisms, but it does mean >> everything needs to know about each individual bus :/ . > > Here ASoC doesn't need to know about sdw bus. As Srini explained, this > helps in the case for him to get the stream context and set the stream > context from the machine driver. > > Nothing else is expected to be done from this API. We already do a set > using snd_soc_dai_set_sdw_stream(). Here we add the snd_soc_dai_get_sdw_stream() to query I didn't see a call to snd_soc_dai_set_sdw_stream() in Srini's code?
On 13-08-19, 09:35, Srinivas Kandagatla wrote: > This patch adds bindings for Qualcomm soundwire controller. > > Qualcomm SoundWire Master controller is present in most Qualcomm SoCs > either integrated as part of WCD audio codecs via slimbus or > as part of SOC I/O. Rob.. ? > > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > .../bindings/soundwire/qcom,sdw.txt | 167 ++++++++++++++++++ > 1 file changed, 167 insertions(+) > create mode 100644 Documentation/devicetree/bindings/soundwire/qcom,sdw.txt > > diff --git a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt > new file mode 100644 > index 000000000000..436547f3b155 > --- /dev/null > +++ b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt > @@ -0,0 +1,167 @@ > +Qualcomm SoundWire Controller Bindings > + > + > +This binding describes the Qualcomm SoundWire Controller along with its > +board specific bus parameters. > + > +- compatible: > + Usage: required > + Value type: <stringlist> > + Definition: must be "qcom,soundwire-v<MAJOR>.<MINOR>.<STEP>", > + Example: > + "qcom,soundwire-v1.3.0" > + "qcom,soundwire-v1.5.0" > + "qcom,soundwire-v1.6.0" > +- reg: > + Usage: required > + Value type: <prop-encoded-array> > + Definition: the base address and size of SoundWire controller > + address space. > + > +- interrupts: > + Usage: required > + Value type: <prop-encoded-array> > + Definition: should specify the SoundWire Controller IRQ > + > +- clock-names: > + Usage: required > + Value type: <stringlist> > + Definition: should be "iface" for SoundWire Controller interface clock > + > +- clocks: > + Usage: required > + Value type: <prop-encoded-array> > + Definition: should specify the SoundWire Controller interface clock > + > +- #sound-dai-cells: > + Usage: required > + Value type: <u32> > + Definition: must be 1 for digital audio interfaces on the controller. > + > +- qcom,dout-ports: > + Usage: required > + Value type: <u32> > + Definition: must be count of data out ports > + > +- qcom,din-ports: > + Usage: required > + Value type: <u32> > + Definition: must be count of data in ports > + > +- qcom,ports-offset1: > + Usage: required > + Value type: <prop-encoded-array> > + Definition: should specify payload transport window offset1 of each > + data port. Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-offset2: > + Usage: required > + Value type: <prop-encoded-array> > + Definition: should specify payload transport window offset2 of each > + data port. Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-sinterval-low: > + Usage: required > + Value type: <prop-encoded-array> > + Definition: should be sample interval low of each data port. > + Out ports followed by In ports. Used for Sample Interval > + calculation. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-word-length: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be size of payload channel sample. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-block-pack-mode: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be 0 or 1 to indicate the block packing mode. > + 0 to indicate Blocks are per Channel > + 1 to indicate Blocks are per Port. > + Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-block-group-count: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be in range 1 to 4 to indicate how many sample > + intervals are combined into a payload. > + Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-lane-control: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be in range 0 to 7 to identify which data lane > + the data port uses. > + Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-hstart: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be number identifying lowerst numbered coloum in > + SoundWire Frame, i.e. left edge of the Transport sub-frame > + for each port. Values between 0 and 15 are valid. > + Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,ports-hstop: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be number identifying highest numbered coloum in > + SoundWire Frame, i.e. the right edge of the Transport > + sub-frame for each port. Values between 0 and 15 are valid. > + Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +- qcom,dports-type: > + Usage: optional > + Value type: <prop-encoded-array> > + Definition: should be one of the following types > + 0 for reduced port > + 1 for simple ports > + 2 for full port > + Out ports followed by In ports. > + More info in MIPI Alliance SoundWire 1.0 Specifications. > + > +Note: > + More Information on detail of encoding of these fields can be > +found in MIPI Alliance SoundWire 1.0 Specifications. > + > += SoundWire devices > +Each subnode of the bus represents SoundWire device attached to it. > +The properties of these nodes are defined by the individual bindings. > + > += EXAMPLE > +The following example represents a SoundWire controller on DB845c board > +which has controller integrated inside WCD934x codec on SDM845 SoC. > + > +soundwire: soundwire@c85 { > + compatible = "qcom,soundwire-v1.3.0"; > + reg = <0xc85 0x20>; > + interrupts = <20 IRQ_TYPE_EDGE_RISING>; > + clocks = <&wcc>; > + clock-names = "iface"; > + #sound-dai-cells = <1>; > + qcom,dports-type = <0>; > + qcom,dout-ports = <6>; > + qcom,din-ports = <2>; > + qcom,ports-sinterval-low = /bits/ 8 <0x07 0x1F 0x3F 0x7 0x1F 0x3F 0x0F 0x0F>; > + qcom,ports-offset1 = /bits/ 8 <0x01 0x02 0x0C 0x6 0x12 0x0D 0x07 0x0A >; > + qcom,ports-offset2 = /bits/ 8 <0x00 0x00 0x1F 0x00 0x00 0x1F 0x00 0x00>; > + > + /* Left Speaker */ > + left{ > + .... > + }; > + > + /* Right Speaker */ > + right{ > + .... > + }; > +}; > -- > 2.21.0 -- ~Vinod
Hi Rob, On 23/08/2019 08:28, Vinod Koul wrote: > On 13-08-19, 09:35, Srinivas Kandagatla wrote: >> This patch adds bindings for Qualcomm soundwire controller. >> >> Qualcomm SoundWire Master controller is present in most Qualcomm SoCs >> either integrated as part of WCD audio codecs via slimbus or >> as part of SOC I/O. > > Rob.. ? > >> >> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> --- >> .../bindings/soundwire/qcom,sdw.txt | 167 ++++++++++++++++++ >> 1 file changed, 167 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/soundwire/qcom,sdw.txt >> >> diff --git a/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt Do you see any issues with the these bindings? --srini >> new file mode 100644 >> index 000000000000..436547f3b155 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/soundwire/qcom,sdw.txt >> @@ -0,0 +1,167 @@ >> +Qualcomm SoundWire Controller Bindings >> + >> + >> +This binding describes the Qualcomm SoundWire Controller along with its >> +board specific bus parameters. >> + >> +- compatible: >> + Usage: required >> + Value type: <stringlist> >> + Definition: must be "qcom,soundwire-v<MAJOR>.<MINOR>.<STEP>", >> + Example: >> + "qcom,soundwire-v1.3.0" >> + "qcom,soundwire-v1.5.0" >> + "qcom,soundwire-v1.6.0" >> +- reg: >> + Usage: required >> + Value type: <prop-encoded-array> >> + Definition: the base address and size of SoundWire controller >> + address space. >> + >> +- interrupts: >> + Usage: required >> + Value type: <prop-encoded-array> >> + Definition: should specify the SoundWire Controller IRQ >> + >> +- clock-names: >> + Usage: required >> + Value type: <stringlist> >> + Definition: should be "iface" for SoundWire Controller interface clock >> + >> +- clocks: >> + Usage: required >> + Value type: <prop-encoded-array> >> + Definition: should specify the SoundWire Controller interface clock >> + >> +- #sound-dai-cells: >> + Usage: required >> + Value type: <u32> >> + Definition: must be 1 for digital audio interfaces on the controller. >> + >> +- qcom,dout-ports: >> + Usage: required >> + Value type: <u32> >> + Definition: must be count of data out ports >> + >> +- qcom,din-ports: >> + Usage: required >> + Value type: <u32> >> + Definition: must be count of data in ports >> + >> +- qcom,ports-offset1: >> + Usage: required >> + Value type: <prop-encoded-array> >> + Definition: should specify payload transport window offset1 of each >> + data port. Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-offset2: >> + Usage: required >> + Value type: <prop-encoded-array> >> + Definition: should specify payload transport window offset2 of each >> + data port. Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-sinterval-low: >> + Usage: required >> + Value type: <prop-encoded-array> >> + Definition: should be sample interval low of each data port. >> + Out ports followed by In ports. Used for Sample Interval >> + calculation. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-word-length: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be size of payload channel sample. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-block-pack-mode: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be 0 or 1 to indicate the block packing mode. >> + 0 to indicate Blocks are per Channel >> + 1 to indicate Blocks are per Port. >> + Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-block-group-count: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be in range 1 to 4 to indicate how many sample >> + intervals are combined into a payload. >> + Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-lane-control: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be in range 0 to 7 to identify which data lane >> + the data port uses. >> + Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-hstart: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be number identifying lowerst numbered coloum in >> + SoundWire Frame, i.e. left edge of the Transport sub-frame >> + for each port. Values between 0 and 15 are valid. >> + Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,ports-hstop: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be number identifying highest numbered coloum in >> + SoundWire Frame, i.e. the right edge of the Transport >> + sub-frame for each port. Values between 0 and 15 are valid. >> + Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +- qcom,dports-type: >> + Usage: optional >> + Value type: <prop-encoded-array> >> + Definition: should be one of the following types >> + 0 for reduced port >> + 1 for simple ports >> + 2 for full port >> + Out ports followed by In ports. >> + More info in MIPI Alliance SoundWire 1.0 Specifications. >> + >> +Note: >> + More Information on detail of encoding of these fields can be >> +found in MIPI Alliance SoundWire 1.0 Specifications. >> + >> += SoundWire devices >> +Each subnode of the bus represents SoundWire device attached to it. >> +The properties of these nodes are defined by the individual bindings. >> + >> += EXAMPLE >> +The following example represents a SoundWire controller on DB845c board >> +which has controller integrated inside WCD934x codec on SDM845 SoC. >> + >> +soundwire: soundwire@c85 { >> + compatible = "qcom,soundwire-v1.3.0"; >> + reg = <0xc85 0x20>; >> + interrupts = <20 IRQ_TYPE_EDGE_RISING>; >> + clocks = <&wcc>; >> + clock-names = "iface"; >> + #sound-dai-cells = <1>; >> + qcom,dports-type = <0>; >> + qcom,dout-ports = <6>; >> + qcom,din-ports = <2>; >> + qcom,ports-sinterval-low = /bits/ 8 <0x07 0x1F 0x3F 0x7 0x1F 0x3F 0x0F 0x0F>; >> + qcom,ports-offset1 = /bits/ 8 <0x01 0x02 0x0C 0x6 0x12 0x0D 0x07 0x0A >; >> + qcom,ports-offset2 = /bits/ 8 <0x00 0x00 0x1F 0x00 0x00 0x1F 0x00 0x00>; >> + >> + /* Left Speaker */ >> + left{ >> + .... >> + }; >> + >> + /* Right Speaker */ >> + right{ >> + .... >> + }; >> +}; >> -- >> 2.21.0 >
Hi Pierre, On 14/08/2019 15:09, Pierre-Louis Bossart wrote: > > > On 8/13/19 11:11 PM, Vinod Koul wrote: >> On 13-08-19, 20:58, Mark Brown wrote: >>> On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: >>> >>>> Indeed. I don't have a full understanding of that part to be honest, >>>> nor why >>>> we need something SoundWire-specific. We already abused the >>>> set_tdm_slot API >>>> to store an HDaudio stream, now we have a rather confusing stream >>>> information for SoundWire and I have about 3 other 'stream' contexts in >>>> SOF... I am still doing basic cleanups but this has been on my radar >>>> for a >>>> while. >>> >>> There is something to be said for not abusing the TDM slot API if it can >>> make things clearer by using bus-idiomatic mechanisms, but it does mean >>> everything needs to know about each individual bus :/ . >> >> Here ASoC doesn't need to know about sdw bus. As Srini explained, this >> helps in the case for him to get the stream context and set the stream >> context from the machine driver. >> >> Nothing else is expected to be done from this API. We already do a set >> using snd_soc_dai_set_sdw_stream(). Here we add the >> snd_soc_dai_get_sdw_stream() to query > > I didn't see a call to snd_soc_dai_set_sdw_stream() in Srini's code? There is a snd_soc_dai_get_sdw_stream() to get stream context and we add slave streams(amplifier in this case) to that context using sdw_stream_add_slave() in machine driver[1]. Without this helper there is no way to link slave streams to stream context in non dai based setup like smart speaker amplifiers. Currently this driver is blocked on this patch, If you think there are other ways to do this, am happy to try them out. Thanks, srini [1] https://git.linaro.org/people/srinivas.kandagatla/linux.git/tree/sound/soc/qcom/db845c.c?h=release/db845c/qcomlt-5.2
On 10/9/19 3:32 AM, Srinivas Kandagatla wrote: > Hi Pierre, > > On 14/08/2019 15:09, Pierre-Louis Bossart wrote: >> >> >> On 8/13/19 11:11 PM, Vinod Koul wrote: >>> On 13-08-19, 20:58, Mark Brown wrote: >>>> On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: >>>> >>>>> Indeed. I don't have a full understanding of that part to be >>>>> honest, nor why >>>>> we need something SoundWire-specific. We already abused the >>>>> set_tdm_slot API >>>>> to store an HDaudio stream, now we have a rather confusing stream >>>>> information for SoundWire and I have about 3 other 'stream' >>>>> contexts in >>>>> SOF... I am still doing basic cleanups but this has been on my >>>>> radar for a >>>>> while. >>>> >>>> There is something to be said for not abusing the TDM slot API if it >>>> can >>>> make things clearer by using bus-idiomatic mechanisms, but it does mean >>>> everything needs to know about each individual bus :/ . >>> >>> Here ASoC doesn't need to know about sdw bus. As Srini explained, this >>> helps in the case for him to get the stream context and set the stream >>> context from the machine driver. >>> >>> Nothing else is expected to be done from this API. We already do a set >>> using snd_soc_dai_set_sdw_stream(). Here we add the >>> snd_soc_dai_get_sdw_stream() to query >> >> I didn't see a call to snd_soc_dai_set_sdw_stream() in Srini's code? > > > There is a snd_soc_dai_get_sdw_stream() to get stream context and we add > slave streams(amplifier in this case) to that context using > sdw_stream_add_slave() in machine driver[1]. > > Without this helper there is no way to link slave streams to stream > context in non dai based setup like smart speaker amplifiers. > > Currently this driver is blocked on this patch, If you think there are > other ways to do this, am happy to try them out. So to be clear, you are *not* using snd_soc_dai_set_sdw_stream?
On 09/10/2019 15:29, Pierre-Louis Bossart wrote: > > > On 10/9/19 3:32 AM, Srinivas Kandagatla wrote: >> Hi Pierre, >> >> On 14/08/2019 15:09, Pierre-Louis Bossart wrote: >>> >>> >>> On 8/13/19 11:11 PM, Vinod Koul wrote: >>>> On 13-08-19, 20:58, Mark Brown wrote: >>>>> On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: >>>>> >>>>>> Indeed. I don't have a full understanding of that part to be >>>>>> honest, nor why >>>>>> we need something SoundWire-specific. We already abused the >>>>>> set_tdm_slot API >>>>>> to store an HDaudio stream, now we have a rather confusing stream >>>>>> information for SoundWire and I have about 3 other 'stream' >>>>>> contexts in >>>>>> SOF... I am still doing basic cleanups but this has been on my >>>>>> radar for a >>>>>> while. >>>>> >>>>> There is something to be said for not abusing the TDM slot API if >>>>> it can >>>>> make things clearer by using bus-idiomatic mechanisms, but it does >>>>> mean >>>>> everything needs to know about each individual bus :/ . >>>> >>>> Here ASoC doesn't need to know about sdw bus. As Srini explained, this >>>> helps in the case for him to get the stream context and set the stream >>>> context from the machine driver. >>>> >>>> Nothing else is expected to be done from this API. We already do a set >>>> using snd_soc_dai_set_sdw_stream(). Here we add the >>>> snd_soc_dai_get_sdw_stream() to query >>> >>> I didn't see a call to snd_soc_dai_set_sdw_stream() in Srini's code? >> >> >> There is a snd_soc_dai_get_sdw_stream() to get stream context and we >> add slave streams(amplifier in this case) to that context using >> sdw_stream_add_slave() in machine driver[1]. >> >> Without this helper there is no way to link slave streams to stream >> context in non dai based setup like smart speaker amplifiers. >> >> Currently this driver is blocked on this patch, If you think there are >> other ways to do this, am happy to try them out. > > So to be clear, you are *not* using snd_soc_dai_set_sdw_stream? Yes, am not using snd_soc_dai_set_sdw_stream(). --srini > > > > >
On 10/9/19 11:01 AM, Srinivas Kandagatla wrote: > > > On 09/10/2019 15:29, Pierre-Louis Bossart wrote: >> >> >> On 10/9/19 3:32 AM, Srinivas Kandagatla wrote: >>> Hi Pierre, >>> >>> On 14/08/2019 15:09, Pierre-Louis Bossart wrote: >>>> >>>> >>>> On 8/13/19 11:11 PM, Vinod Koul wrote: >>>>> On 13-08-19, 20:58, Mark Brown wrote: >>>>>> On Tue, Aug 13, 2019 at 02:38:53PM -0500, Pierre-Louis Bossart wrote: >>>>>> >>>>>>> Indeed. I don't have a full understanding of that part to be >>>>>>> honest, nor why >>>>>>> we need something SoundWire-specific. We already abused the >>>>>>> set_tdm_slot API >>>>>>> to store an HDaudio stream, now we have a rather confusing stream >>>>>>> information for SoundWire and I have about 3 other 'stream' >>>>>>> contexts in >>>>>>> SOF... I am still doing basic cleanups but this has been on my >>>>>>> radar for a >>>>>>> while. >>>>>> >>>>>> There is something to be said for not abusing the TDM slot API if >>>>>> it can >>>>>> make things clearer by using bus-idiomatic mechanisms, but it does >>>>>> mean >>>>>> everything needs to know about each individual bus :/ . >>>>> >>>>> Here ASoC doesn't need to know about sdw bus. As Srini explained, this >>>>> helps in the case for him to get the stream context and set the stream >>>>> context from the machine driver. >>>>> >>>>> Nothing else is expected to be done from this API. We already do a set >>>>> using snd_soc_dai_set_sdw_stream(). Here we add the >>>>> snd_soc_dai_get_sdw_stream() to query >>>> >>>> I didn't see a call to snd_soc_dai_set_sdw_stream() in Srini's code? >>> >>> >>> There is a snd_soc_dai_get_sdw_stream() to get stream context and we >>> add slave streams(amplifier in this case) to that context using >>> sdw_stream_add_slave() in machine driver[1]. >>> >>> Without this helper there is no way to link slave streams to stream >>> context in non dai based setup like smart speaker amplifiers. >>> >>> Currently this driver is blocked on this patch, If you think there >>> are other ways to do this, am happy to try them out. >> >> So to be clear, you are *not* using snd_soc_dai_set_sdw_stream? > Yes, am not using snd_soc_dai_set_sdw_stream(). It's been a while since this thread started, and I still don't quite get the concepts or logic. First, I don't understand what the problem with "aux" devices is. All the SoundWire stuff is based on the concept of DAI, so I guess I am missing why introducing the "aux" device changes anything. Next, a 'stream' connects multiple DAIs to transmit information from sources to sinks. A DAI in itself is created without having any notion of which stream it will be associated with. This can only be done with machine level information. If you query a DAI to get a stream context, then how is this stream context allocated in the first place? It looks like a horse and cart problem. Or you are assuming that a specific DAI provides the context, and that all other DAIs do not expose this .get_sdw_stream()? What if more that 1 DAI provide a stream context? And last, I am even more lost since w/ the existing codec drivers we have, sdw_stream_add_slave() is called from the dai .hw_params callback, once you have information on formats/rates, etc. using sdw_stream_add_slave() from a machine driver looks like an even bigger stretch. I really thought the machine driver would only propagate the notion of stream to all DAIs that are part of the same dailink. I am not trying to block the Qualcomm implementation, just would like to make sure the assumptions are clear and that we are not using the same API in completely different ways.
>>> It's been a while since this thread started, and I still don't >>> quite get the concepts or logic. >>> >>> First, I don't understand what the problem with "aux" devices is. >>> All the SoundWire stuff is based on the concept of DAI, so I guess >>> I am >> >> That is the actual problem! Some aux devices does not have dais. >> > > Usually aux devices are used for things like analog amplifiers that > clearly don't have a digital interface, thus it really makes no sense > to have a DAI link connecting them. So I guess my question here > would be what is the thinking on making the "smart amplifier" dailess? > It feels like having a CODEC to CODEC DAI between the CODEC and > the AMP would be a more obvious way to connect the two devices > and would presumably avoid the issues being discussed around the > patch. Ah, now I get it, I missed the point about not having DAIs for the amplifier. I will second Charles' point, the code you have in the machine driver at [1] gets a SoundWire stream context from the SLIMbus codec dai. It's a bit odd to mix layers this way. And if I look at the code below, taken from [1], if you have more than one codec, then your code looks problematic: data->sruntime would be overriden and you'd use the info from the last codec dai on the dailink... case SLIMBUS_0_RX...SLIMBUS_6_TX: for (i = 0 ; i < dai_link->num_codecs; i++) { [snip] data->sruntime[cpu_dai->id] = snd_soc_dai_get_sdw_stream(rtd->codec_dais[i], 0); << same destination for multiple codec_dais... If you keep the amp dai-less, then the stream concept should be somehow allocated on the master (or machine) side and passed to the codec dais that are associated to the same 'stream'. [1] https://git.linaro.org/people/srinivas.kandagatla/linux.git/tree/sound/soc/qcom/db845c.c?h=release/db845c/qcomlt-5.2
On 10/10/2019 15:01, Pierre-Louis Bossart wrote: > >>>> It's been a while since this thread started, and I still don't >>>> quite get the concepts or logic. >>>> >>>> First, I don't understand what the problem with "aux" devices is. >>>> All the SoundWire stuff is based on the concept of DAI, so I guess >>>> I am >>> >>> That is the actual problem! Some aux devices does not have dais. >>> >> >> Usually aux devices are used for things like analog amplifiers that >> clearly don't have a digital interface, thus it really makes no sense >> to have a DAI link connecting them. So I guess my question here >> would be what is the thinking on making the "smart amplifier" dailess? >> It feels like having a CODEC to CODEC DAI between the CODEC and >> the AMP would be a more obvious way to connect the two devices >> and would presumably avoid the issues being discussed around the >> patch. > > Ah, now I get it, I missed the point about not having DAIs for the > amplifier. > > I will second Charles' point, the code you have in the machine driver at I agree with Charles, WSA8810/WSA8815 is connected via SoundWire digital interface, so I can try to model this amplifier with dais and see how it ends up. I still need to figure out prefixing multiple instances of this Amplifier controls with "Left" and "Right" > [1] gets a SoundWire stream context from the SLIMbus codec dai. It's a > bit odd to mix layers this way. Yep we have a very mixed setup on this SoC. So it looks like this. Main WCD934X Codec which is connected via SLIMBus which has SoundWire Controller block along with other analog + digital blocks. Again the SoundWire Controller from that WCD934X codec is wired up to WSA881X Smart speaker amplifiers. > > > And if I look at the code below, taken from [1], if you have more than > one codec, then your code looks problematic: data->sruntime would be > overriden and you'd use the info from the last codec dai on the dailink... This code has been written very much specific to DB845c which has only one codec. But I agree with your point. --srini > > case SLIMBUS_0_RX...SLIMBUS_6_TX: > for (i = 0 ; i < dai_link->num_codecs; i++) { > [snip] > data->sruntime[cpu_dai->id] = > snd_soc_dai_get_sdw_stream(rtd->codec_dais[i], 0); << same > destination for multiple codec_dais... > > If you keep the amp dai-less, then the stream concept should be somehow > allocated on the master (or machine) side and passed to the codec dais > that are associated to the same 'stream'. > > > [1] > https://git.linaro.org/people/srinivas.kandagatla/linux.git/tree/sound/soc/qcom/db845c.c?h=release/db845c/qcomlt-5.2 > >
> I still need to figure out prefixing multiple instances of this > Amplifier controls with "Left" and "Right" FWIW we use the "snd_codec_conf" stuff to add a prefix for each amplifier, so that the controls are not mixed up between instances of the same amp, see e.g. static struct snd_soc_codec_conf codec_conf[] = { { .dev_name = "sdw:0:25d:711:0:1", .name_prefix = "rt711", }, { .dev_name = "sdw:1:25d:1308:0:0", .name_prefix = "rt1308-1", }, { .dev_name = "sdw:2:25d:1308:0:2", .name_prefix = "rt1308-2", }, { .dev_name = "sdw:3:25d:715:0:1", .name_prefix = "rt715", }, }; https://github.com/thesofproject/linux/pull/1142/commits/9ff9cf9d8994333df2250641c95431261bc66d69#diff-892560f80d603420baec7395e0b45d81R212
On 10/10/2019 16:49, Pierre-Louis Bossart wrote: > > >> I still need to figure out prefixing multiple instances of this >> Amplifier controls with "Left" and "Right" > > FWIW we use the "snd_codec_conf" stuff to add a prefix for each > amplifier, so that the controls are not mixed up between instances of > the same amp, see e.g. > Thanks Pierre for the inputs. Am using Documentation/devicetree/bindings/sound/name-prefix.txt for dt and it works! I will send new set of patches by dropping this patch! --srini > > static struct snd_soc_codec_conf codec_conf[] = { > { > .dev_name = "sdw:0:25d:711:0:1", > .name_prefix = "rt711", > }, > { > .dev_name = "sdw:1:25d:1308:0:0", > .name_prefix = "rt1308-1", > }, > { > .dev_name = "sdw:2:25d:1308:0:2", > .name_prefix = "rt1308-2", > }, > { > .dev_name = "sdw:3:25d:715:0:1", > .name_prefix = "rt715", > }, > }; > > > https://github.com/thesofproject/linux/pull/1142/commits/9ff9cf9d8994333df2250641c95431261bc66d69#diff-892560f80d603420baec7395e0b45d81R212 >