Message ID | 1400759708-25831-1-git-send-email-s.nawrocki@samsung.com |
---|---|
State | Superseded, archived |
Headers | show |
On Thu, May 22, 2014 at 01:55:07PM +0200, Sylwester Nawrocki wrote: > + sound { > + compatible = "samsung,odroidx2-audio"; > + samsung,i2s-controller = <&i2s0>; > + samsung,audio-codec = <&max98090>; > + }; Can this not use simple-card?
On Thu, May 22, 2014 at 01:55:08PM +0200, Sylwester Nawrocki wrote: > From: Chen Zhen <zhen1.chen@samsung.com> > > This machine driver primary defines the audio path, the supported > data formats and sample frequency. I guess it can't yet, it would have been good to explain that in the changelog for the bindings (and include the binding in this patch...). > + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S > + | SND_SOC_DAIFMT_NB_NF > + | SND_SOC_DAIFMT_CBM_CFM); > + if (ret < 0) > + return ret; > + > + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S > + | SND_SOC_DAIFMT_NB_NF > + | SND_SOC_DAIFMT_CBM_CFM); > + if (ret < 0) > + return ret; These are constant, set these in the dai_link. > + > + ret = snd_soc_dai_set_sysclk(codec_dai, 3, MAX98090_MCLK_FREQ, > + SND_SOC_CLOCK_IN); > + if (ret < 0) { > + dev_err(codec_dai->dev, > + "Unable to switch to FLL1: %d\n", ret); > + return ret; > + } So's this - also what is 3? Set it on init. > + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK, > + 0, MOD_OPCLK_PCLK); Similarly for the rest of the function. > + return snd_soc_register_card(card); devm_snd_soc_register_card().
On 22/05/14 20:53, Mark Brown wrote: > On Thu, May 22, 2014 at 01:55:08PM +0200, Sylwester Nawrocki wrote: >> From: Chen Zhen <zhen1.chen@samsung.com> >> >> This machine driver primary defines the audio path, the supported >> data formats and sample frequency. > > I guess it can't yet, it would have been good to explain that in the > changelog for the bindings (and include the binding in this patch...). Thanks for the review, I'm still rather inexperienced in the ASoC stuff, I've obviously overlooked there is actually no routing handling. I'd rather add those bits. As for the DT binding documentation patch, I thought we're supposed to keep documentation in separate patches, so processes of separating it from the kernel is easier ? >> + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S >> + | SND_SOC_DAIFMT_NB_NF >> + | SND_SOC_DAIFMT_CBM_CFM); >> + if (ret < 0) >> + return ret; >> + >> + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S >> + | SND_SOC_DAIFMT_NB_NF >> + | SND_SOC_DAIFMT_CBM_CFM); >> + if (ret < 0) >> + return ret; > > These are constant, set these in the dai_link. > >> + >> + ret = snd_soc_dai_set_sysclk(codec_dai, 3, MAX98090_MCLK_FREQ, >> + SND_SOC_CLOCK_IN); >> + if (ret < 0) { >> + dev_err(codec_dai->dev, >> + "Unable to switch to FLL1: %d\n", ret); >> + return ret; >> + } > > So's this - also what is 3? Set it on init. OK, will move it. I'm not sure why 3, it seems to be ignored by the codec anyway. Chen, can you confirm the second argument is actually a don't care value ? >> + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK, >> + 0, MOD_OPCLK_PCLK); > > Similarly for the rest of the function. > >> + return snd_soc_register_card(card); > > devm_snd_soc_register_card(). Thanks for the suggestions, I'll amend that. -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 22/05/14 20:46, Mark Brown wrote: > On Thu, May 22, 2014 at 01:55:07PM +0200, Sylwester Nawrocki wrote: > >> + sound { >> + compatible = "samsung,odroidx2-audio"; >> + samsung,i2s-controller = <&i2s0>; >> + samsung,audio-codec = <&max98090>; >> + }; > > Can this not use simple-card? I dug into that and it seems it almost could, but there is one thing I'm not sure how to cover with the simple-card DT bindings and the related driver. There are these two calls: + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK, + 0, MOD_OPCLK_PCLK); + /* Set the cpu DAI configuration in order to use CDCLK */ + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK, + 0, SND_SOC_CLOCK_OUT); This changes clocks routing so that the CPU DAI in slave mode generates master clock for the codec, on the SoC's CDCLK pin. Then this is a reference clock for the codec's PLL, which is a source of the I2S interface clocks. It's done this way to avoid changing at runtime frequency of the EPLL clock, which may be parent of other clocks than the sound subsystem, e.g. MMC. simple-card just calls set_sysclk once for the CPU DAI and CODEC with the second and last argument set to 0. I'll try and see again if there is some way to use simple-card.
On Fri, May 23, 2014 at 10:44:56AM +0200, Sylwester Nawrocki wrote: > On 22/05/14 20:53, Mark Brown wrote: > As for the DT binding documentation patch, I thought we're supposed to keep > documentation in separate patches, so processes of separating it from the > kernel is easier ? I'm not sure what the current theory is - they should definitely be separate if they're part of a multi-patch series but for a single patch I don't remember what the current taste is. If you're sending to the same recipients anyway splitting isn't going to accomplish much, the idea was to only send the DT binding to the DT maintainers and list and not the code. > >> + ret = snd_soc_dai_set_sysclk(codec_dai, 3, MAX98090_MCLK_FREQ, > >> + SND_SOC_CLOCK_IN); > >> + if (ret < 0) { > >> + dev_err(codec_dai->dev, > >> + "Unable to switch to FLL1: %d\n", ret); > >> + return ret; > >> + } > > So's this - also what is 3? Set it on init. > OK, will move it. I'm not sure why 3, it seems to be ignored by the codec > anyway. Chen, can you confirm the second argument is actually a don't care > value ? If it's don't care supply 0 instead.
On 22/05/14 20:53, Mark Brown wrote: >> + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S >> > + | SND_SOC_DAIFMT_NB_NF >> > + | SND_SOC_DAIFMT_CBM_CFM); >> > + if (ret < 0) >> > + return ret; >> > + >> > + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S >> > + | SND_SOC_DAIFMT_NB_NF >> > + | SND_SOC_DAIFMT_CBM_CFM); >> > + if (ret < 0) >> > + return ret; > > These are constant, set these in the dai_link. set_fmt also sets master/slave mode of the I2S DAI, after I moved this into the cpu_dai link data structure after suspend/resume cycle the I2S IP block is not being properly re-configured. Should the format setting be added in resume_post callback, or is there any other preferred way ? Similarly the syclk settings are being lost over suspend/resume cycle and nothing restores them. -- Thanks, Sylwester -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 07/04/2014 01:04 PM, Sylwester Nawrocki wrote: > On 22/05/14 20:53, Mark Brown wrote: >>> + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S >>>> + | SND_SOC_DAIFMT_NB_NF >>>> + | SND_SOC_DAIFMT_CBM_CFM); >>>> + if (ret < 0) >>>> + return ret; >>>> + >>>> + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S >>>> + | SND_SOC_DAIFMT_NB_NF >>>> + | SND_SOC_DAIFMT_CBM_CFM); >>>> + if (ret < 0) >>>> + return ret; >> >> These are constant, set these in the dai_link. > > set_fmt also sets master/slave mode of the I2S DAI, after I moved > this into the cpu_dai link data structure after suspend/resume cycle > the I2S IP block is not being properly re-configured. Should the > format setting be added in resume_post callback, or is there any > other preferred way ? Similarly the syclk settings are being lost > over suspend/resume cycle and nothing restores them. The I2S driver should save and restore it's register during suspend/resume. - Lars -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 04/07/14 13:10, Lars-Peter Clausen wrote: > On 07/04/2014 01:04 PM, Sylwester Nawrocki wrote: >> On 22/05/14 20:53, Mark Brown wrote: >>>> + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S >>>>> + | SND_SOC_DAIFMT_NB_NF >>>>> + | SND_SOC_DAIFMT_CBM_CFM); >>>>> + if (ret < 0) >>>>> + return ret; >>>>> + >>>>> + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S >>>>> + | SND_SOC_DAIFMT_NB_NF >>>>> + | SND_SOC_DAIFMT_CBM_CFM); >>>>> + if (ret < 0) >>>>> + return ret; >>> >>> These are constant, set these in the dai_link. >> >> set_fmt also sets master/slave mode of the I2S DAI, after I moved >> this into the cpu_dai link data structure after suspend/resume cycle >> the I2S IP block is not being properly re-configured. Should the >> format setting be added in resume_post callback, or is there any >> other preferred way ? Similarly the syclk settings are being lost >> over suspend/resume cycle and nothing restores them. > > The I2S driver should save and restore it's register during suspend/resume. OK, thanks. I checked the I2S driver does it, but only when dai->active flags is set [1]. However, during system resume this flag is not set (in situation where playback or capture wasn't active right before system suspend). Is the dai->active test wrong in that driver then ? I'm not sure if it could just be removed. [1] http://lxr.free-electrons.com/source/sound/soc/samsung/i2s.c#L913 -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 07/04/2014 01:24 PM, Sylwester Nawrocki wrote: > On 04/07/14 13:10, Lars-Peter Clausen wrote: >> On 07/04/2014 01:04 PM, Sylwester Nawrocki wrote: >>> On 22/05/14 20:53, Mark Brown wrote: >>>>> + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S >>>>>> + | SND_SOC_DAIFMT_NB_NF >>>>>> + | SND_SOC_DAIFMT_CBM_CFM); >>>>>> + if (ret < 0) >>>>>> + return ret; >>>>>> + >>>>>> + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S >>>>>> + | SND_SOC_DAIFMT_NB_NF >>>>>> + | SND_SOC_DAIFMT_CBM_CFM); >>>>>> + if (ret < 0) >>>>>> + return ret; >>>> >>>> These are constant, set these in the dai_link. >>> >>> set_fmt also sets master/slave mode of the I2S DAI, after I moved >>> this into the cpu_dai link data structure after suspend/resume cycle >>> the I2S IP block is not being properly re-configured. Should the >>> format setting be added in resume_post callback, or is there any >>> other preferred way ? Similarly the syclk settings are being lost >>> over suspend/resume cycle and nothing restores them. >> >> The I2S driver should save and restore it's register during suspend/resume. > > OK, thanks. I checked the I2S driver does it, but only when dai->active > flags is set [1]. However, during system resume this flag is not set > (in situation where playback or capture wasn't active right before > system suspend). Is the dai->active test wrong in that driver then ? > I'm not sure if it could just be removed. Yes, just remove the check. - Lars -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt b/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt new file mode 100644 index 0000000..b37e79a --- /dev/null +++ b/Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt @@ -0,0 +1,32 @@ +Odroid X2/U3 audio complex + +Required properties: +- compatible : "samsung,odroidx2-audio" +- samsung,i2s-controller : phandle to the I2S controller +- samsung,audio-codec : phandle to the audio codec + +Example: + + i2s0: i2s@03830000 { + ... + clocks = <&clock_audss EXYNOS_I2S_BUS>, + <&clock_audss EXYNOS_DOUT_AUD_BUS>; + clock-names = "iis", "i2s_opclk0"; + status = "okay"; + }; + + i2c@13870000 { + ... + max98090: max98090@10 { + compatible = "maxim,max98090"; + reg = <0x10>; + interrupt-parent = <&gpx0>; + interrupts = <1 0>; + }; + }; + + sound { + compatible = "samsung,odroidx2-audio"; + samsung,i2s-controller = <&i2s0>; + samsung,audio-codec = <&max98090>; + };
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> --- .../bindings/sound/samsung,odroidx2-max98090.txt | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/samsung,odroidx2-max98090.txt