Message ID | 20191018001849.27205-1-srinivas.kandagatla@linaro.org |
---|---|
Headers | show |
Series | ASoC: Add support to WCD9340/WCD9341 codec | expand |
On Mon, 21 Oct 2019, Srinivas Kandagatla wrote: > > > On 21/10/2019 12:45, Lee Jones wrote: > > On Mon, 21 Oct 2019, Srinivas Kandagatla wrote: > > > > > Thanks Lee for taking time to review. > > > > > > I agree with most of the style related comments, will fix them in next > > > version. For others I have replied it inline. > > > > [...] > > > > > > > +static int wcd934x_slim_status(struct slim_device *sdev, > > > > > + enum slim_device_status status) > > > > > +{ > > > > > + struct device *dev = &sdev->dev; > > > > > + struct wcd934x_data *wcd; > > > > > + int ret; > > > > > > > > This is semantically odd! Why are you doing most of the > > > > initialisation and bring-up in 'status' and not 'probe'. Seems > > > > broken to me. > > > > > > SLIMBus device will not be in a state to communicate before enumeration (at > > > probe), so all the device initialization is done in status callback where it > > > is ready for communication. > > > > Why do we need the device to be up *before* calling probe? > > > > To Initialize the device. > And SLIMbus device registers access can not be done before enumeration. I'm not sure why you need any hardware to be enabled before calling .probe(). That is the purpose of .probe(). The only way in which I can see this being a requirement is if information located on the device is required in order to do device-driver matching. In which case, how was the .status() function matched? -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
On Fri, Oct 18, 2019 at 01:18:46AM +0100, Srinivas Kandagatla wrote: > Qualcomm Technologies Inc WCD9340/WCD9341 Audio Codec has integrated > gpio controller to control 5 gpios on the chip. This patch adds > required device tree bindings for it. > > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > .../pinctrl/qcom,wcd934x-pinctrl.yaml | 51 +++++++++++++++++++ > 1 file changed, 51 insertions(+) > create mode 100644 Documentation/devicetree/bindings/pinctrl/qcom,wcd934x-pinctrl.yaml > > diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,wcd934x-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/qcom,wcd934x-pinctrl.yaml > new file mode 100644 > index 000000000000..c8a36cbc4935 > --- /dev/null > +++ b/Documentation/devicetree/bindings/pinctrl/qcom,wcd934x-pinctrl.yaml > @@ -0,0 +1,51 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/pinctrl/qcom,wcd934x-pinctrl.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: WCD9340/WCD9341 GPIO Pin controller > + > +maintainers: > + - Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > + > +description: | > + Qualcomm Technologies Inc WCD9340/WCD9341 Audio Codec has integrated > + gpio controller to control 5 gpios on the chip. > + > +properties: > + compatible: > + enum: > + - qcom,wcd9340-pinctrl > + - qcom,wcd9341-pinctrl > + > + reg: > + maxItems: 1 > + > + gpio-controller: true > + > + gpio-ranges: > + maxItems: 1 > + > + '#gpio-cells': > + const: 2 > + > +required: > + - compatible > + - reg > + - gpio-controller > + - gpio-ranges > + - "#gpio-cells" additionalProperties: false > + > + > +examples: > + - | > + wcdpinctrl: wcdpinctrl@42 { pinctrl@42 > + compatible = "qcom,wcd9340-pinctrl"; > + reg = <0x042 0x2>; > + gpio-controller; > + gpio-ranges = <&wcdpinctrl 0 0 5>; > + #gpio-cells = <2>; > + }; > + > +... > -- > 2.21.0 >
On 29/10/2019 20:47, Rob Herring wrote: > On Mon, Oct 28, 2019 at 7:45 AM Srinivas Kandagatla > <srinivas.kandagatla@linaro.org> wrote: >> >> >> >> On 28/10/2019 12:40, Srinivas Kandagatla wrote: >>> Its Phandle. >>> >>> something like this is okay? >>> >>> slim-ifc-dev: >>> $ref: '/schemas/types.yaml#/definitions/phandle-array' >> >> Sorry this should not be an array, so something like this: >> >> slim-ifc-dev: >> description: SLIMBus Interface device phandle > > You're just spelling out the abbreviated name. I can do that much. > What is 'SLIMBus Interface device'? Each SLIMBus Component contains one Interface Device. Which is responsible for Monitoring and reporting the status of component, Data line to Data pin connection setup for SLIMBus streaming. Interface device is enumerated just like any other slim device. We already have exactly same bindings for WCD9335 in upstream at: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt?h=v5.4-rc5#n42 > > Is it a standard SLIMBus property? If so, document it in the right > place. If not, then needs a vendor prefix. "SLIMBus Interface Device" itself is documented in SLIMBus Specification. If I remember it correctly You suggested me to move to "slim-ifc-dev" as this is part of SLIMBus Specification. Thanks, srini > >> $ref: '/schemas/types.yaml#/definitions/phandle' >> >> >>> description: SLIMBus Interface device phandle
On Wed, Oct 30, 2019 at 4:55 AM Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote: > > > > On 29/10/2019 20:47, Rob Herring wrote: > > On Mon, Oct 28, 2019 at 7:45 AM Srinivas Kandagatla > > <srinivas.kandagatla@linaro.org> wrote: > >> > >> > >> > >> On 28/10/2019 12:40, Srinivas Kandagatla wrote: > >>> Its Phandle. > >>> > >>> something like this is okay? > >>> > >>> slim-ifc-dev: > >>> $ref: '/schemas/types.yaml#/definitions/phandle-array' > >> > >> Sorry this should not be an array, so something like this: > >> > >> slim-ifc-dev: > >> description: SLIMBus Interface device phandle > > > > You're just spelling out the abbreviated name. I can do that much. > > What is 'SLIMBus Interface device'? > > Each SLIMBus Component contains one Interface Device. Which is > responsible for Monitoring and reporting the status of component, Data > line to Data pin connection setup for SLIMBus streaming. Interface > device is enumerated just like any other slim device. So a standard set of registers every slimbus device has? In hindsight, I would have made reg have 2 entries with both addresses. I guess that ship has sailed. It seems strange you would need both "devices" described as separate nodes in DT. > > We already have exactly same bindings for WCD9335 in upstream at: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt?h=v5.4-rc5#n42 > > > > > Is it a standard SLIMBus property? If so, document it in the right > > place. If not, then needs a vendor prefix. > > "SLIMBus Interface Device" itself is documented in SLIMBus Specification. > > If I remember it correctly You suggested me to move to "slim-ifc-dev" > as this is part of SLIMBus Specification. Probably so. If it is common, then document it in bindings/slimbus/bus.txt. Then here, 'slim-ifc-dev: true' is sufficient. You can just assume we convert bus.txt to schema (or feel free to do that :) ). Rob
On Wed, Nov 6, 2019 at 12:09 PM Srinivas Kandagatla <srinivas.kandagatla@linaro.org> wrote: > > > > On 05/11/2019 19:08, Rob Herring wrote: > > On Wed, Oct 30, 2019 at 4:55 AM Srinivas Kandagatla > > <srinivas.kandagatla@linaro.org> wrote: > >> > >> > >> > >> On 29/10/2019 20:47, Rob Herring wrote: > >>> On Mon, Oct 28, 2019 at 7:45 AM Srinivas Kandagatla > >>> <srinivas.kandagatla@linaro.org> wrote: > >>>> > >>>> > >>>> > >>>> On 28/10/2019 12:40, Srinivas Kandagatla wrote: > >>>>> Its Phandle. > >>>>> > >>>>> something like this is okay? > >>>>> > >>>>> slim-ifc-dev: > >>>>> $ref: '/schemas/types.yaml#/definitions/phandle-array' > >>>> > >>>> Sorry this should not be an array, so something like this: > >>>> > >>>> slim-ifc-dev: > >>>> description: SLIMBus Interface device phandle > >>> > >>> You're just spelling out the abbreviated name. I can do that much. > >>> What is 'SLIMBus Interface device'? > >> > >> Each SLIMBus Component contains one Interface Device. Which is > >> responsible for Monitoring and reporting the status of component, Data > >> line to Data pin connection setup for SLIMBus streaming. Interface > >> device is enumerated just like any other slim device. > > > > So a standard set of registers every slimbus device has? In hindsight, > > I would have made reg have 2 entries with both addresses. I guess that > > ship has sailed. > > That will break SLIMBus bindings, Which is expecting one device per > device node. Like I said, that ship has sailed... > > > > It seems strange you would need both "devices" described as separate > > nodes in DT. > > Because they are two different devices on the SLIMBus Component. > > > > >> > >> We already have exactly same bindings for WCD9335 in upstream at: > >> > >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/sound/qcom,wcd9335.txt?h=v5.4-rc5#n42 > >> > >>> > >>> Is it a standard SLIMBus property? If so, document it in the right > >>> place. If not, then needs a vendor prefix. > >> > >> "SLIMBus Interface Device" itself is documented in SLIMBus Specification. > >> > >> If I remember it correctly You suggested me to move to "slim-ifc-dev" > >> as this is part of SLIMBus Specification. > > > > Probably so. If it is common, then document it in bindings/slimbus/bus.txt. > > > As we are dealing with audio codecs here, it might be that > "slim-ifc-dev" is common across wcd9335 and wcd934x but not all devices > on the SLIMBus Component would need handle to interface device. SLIMbus > can also be used for control buses as well which might not need this. Like you said, it's part of the the spec, so define it somewhere common, not in a device specific binding. > > Then here, 'slim-ifc-dev: true' is sufficient. You can just assume we > > convert bus.txt to schema (or feel free to do that :) ). > > We need phandle to the interface device so that we can program the > streaming parameters for the SLIMBus Component. 'true' just means 'I'm using the property' and have no other constraints. The constraints like type would be defined in the common binding and no need to duplicate here. Rob