Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f848cfe authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: msm: Remove usage of dev_set_name in audio drivers



Currently audio drivers use dev_set_name when the device's probe
function is invoked to change device name. However the device name
cannot be changed after the device is registered by the Kernel and
inside the probe functions. Using dev_set_name would cause random
memory corruption leading to kernel crashes.

dev_set_name is used in platform and cpu dai drivers to satisfy the
needs of the ALSA SoC framework. ASoC framework does make use of
platform and cpu dai names to check whether they are registered to
it or not for sound card instantiation. However, the framework has
an alternative way to compare the device's of_nodes against dai_link's
of_nodes to know whether the platform/cpu dai is registered or not.
Make changes in the driver to retrieve of_nodes and then assign to
dai_link's of_node so that we can get rid of using dev_set_name in
the drivers.

CRs-Fixed: 706768
Change-Id: I085cfbe4bc60e1b7ec3522508989e6536b1af126
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent dbd2b72e
Loading
Loading
Loading
Loading
+181 −0
Original line number Diff line number Diff line
@@ -574,6 +574,23 @@ normally open.
- qcom,prim-auxpcm-gpio-set : set of GPIO lines used for Primary AUXPCM port
- qcom,tapan-codec-9302: Indicates that this device node is for WCD9302 audio
			    codec.
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".

Optional Properties:
- qcom,us-euro-gpios : GPIO on which gnd/mic swap signal is coming.
@@ -619,6 +636,36 @@ Example:
		qcom,prim-auxpcm-gpio-dout = <&msm_gpio 66 0>;
		qcom,prim-auxpcm-gpio-set = "prim-gpio-prim";
		qcom,tapan-codec-9302;
		asoc-platform = <&pcm0>, <&pcm1>, <&voip>, <&voice>,
				<&loopback>, <&compress>, <&hostless>,
				<&afe>, <&lsm>, <&routing>, <&lpa>;
		asoc-platform-names = "msm-pcm-dsp.0", "msm-pcm-dsp.1",
				"msm-voip-dsp", "msm-pcm-voice", "msm-pcm-loopback",
				"msm-compress-dsp", "msm-pcm-hostless", "msm-pcm-afe",
				"msm-lsm-client", "msm-pcm-routing", "msm-pcm-lpa";
		asoc-cpu = <&dai_pri_auxpcm>, <&dai_hdmi>,
				<&dai_mi2s0>, <&dai_mi2s1>, <&dai_mi2s2>, <&dai_mi2s3>,
				<&sb_0_rx>, <&sb_0_tx>, <&sb_1_rx>, <&sb_1_tx>,
				<&sb_3_rx>, <&sb_3_tx>, <&sb_4_rx>, <&sb_4_tx>,
				<&bt_sco_rx>, <&bt_sco_tx>, <&int_fm_rx>, <&int_fm_tx>,
				<&afe_pcm_rx>, <&afe_pcm_tx>, <&afe_proxy_rx>, <&afe_proxy_tx>,
				<&incall_record_rx>, <&incall_record_tx>, <&incall_music_rx>,
				<&incall_music_2_rx>;
		asoc-cpu-names = "msm-dai-q6-auxpcm.1", "msm-dai-q6-hdmi.8",
				"msm-dai-q6-mi2s.0", "msm-dai-q6-mi2s.1",
				"msm-dai-q6-mi2s.2", "msm-dai-q6-mi2s.3",
				"msm-dai-q6-dev.16384", "msm-dai-q6-dev.16385",
				"msm-dai-q6-dev.16386", "msm-dai-q6-dev.16387",
				"msm-dai-q6-dev.16390", "msm-dai-q6-dev.16391",
				"msm-dai-q6-dev.16392", "msm-dai-q6-dev.16393",
				"msm-dai-q6-dev.12288", "msm-dai-q6-dev.12289",
				"msm-dai-q6-dev.12292", "msm-dai-q6-dev.12293",
				"msm-dai-q6-dev.224", "msm-dai-q6-dev.225",
				"msm-dai-q6-dev.241", "msm-dai-q6-dev.240",
				"msm-dai-q6-dev.32771", "msm-dai-q6-dev.32772",
				"msm-dai-q6-dev.32773", "msm-dai-q6-dev.32770";
		asoc-codec = <&stub>, <&pm8916_tombak_dig>;
		asoc-codec-names = "msm-stub-codec.1", "tombak_codec";
	};

* MSM8974 ASoC Machine driver
@@ -656,6 +703,23 @@ Required properties:
- qcom,sec-auxpcm-gpio-din  : GPIO on which Secondary AUXPCM DIN signal is coming.
- qcom,sec-auxpcm-gpio-dout : GPIO on which Secondary AUXPCM DOUT signal is coming.
- qcom,us-euro-gpios : GPIO on which gnd/mic swap signal is coming.
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".
Optional properties:
- qcom,hdmi-audio-rx: specifies if HDMI audio support is enabled or not.
- qcom,ext-ult-spk-amp-gpio : GPIO for enabling of speaker path amplifier.
@@ -952,6 +1016,23 @@ Required properties:
	to "Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt" for the
	pinctrl handles definitions. Each pinctrl-# corresponds to the respective
	state name that appears under pinctrl-state list.
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".


Optional Properties:
@@ -995,6 +1076,23 @@ Required properties:
- qcom,prim-i2s-gpio-dout : Specifies gpio assigned for primary DOUT I2S pin.
- qcom,prim-i2s-gpio-sclk : Specifies gpio assigned for primary SCLK I2S pin.
- qcom,prim-i2s-gpio-mclk : Specifies gpio assigned for MCLK I2S pin.
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".

Example:

@@ -1064,6 +1162,23 @@ Required properties:
- qcom,sec-auxpcm-gpio-din  : GPIO on which Secondary AUXPCM DIN signal is coming.
- qcom,sec-auxpcm-gpio-dout : GPIO on which Secondary AUXPCM DOUT signal is coming.
- qcom,ext-mclk-gpio  : audio uses this GPIO to request mclk in MTP and CDP
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".
Optional properties:
- qcom,us-euro-gpios : GPIO on which gnd/mic swap signal is coming.
- qcom,hdmi-audio-rx: specifies if HDMI audio support is enabled or not.
@@ -1160,6 +1275,23 @@ Required properties:
- pinctrl-x : defines pinctrl state for each pin group
- qcom,ext-ult-spk-amp-gpio : GPIO to enable ultrasound emitter amp.
- qcom,mbhc-audio-jack-type : Indicates headset jack type.
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".

Example:

@@ -1206,6 +1338,38 @@ Example:
		pinctrl-3 = <&sec_aux_pcm_active>;
		qcom,ext-ult-spk-amp-gpio = <&pmi8994_gpios 1 0>;
		qcom,mbhc-audio-jack-type = "6-pole-jack";
		asoc-platform = <&pcm0>,<&pcm1>,<&pcm2>,<&voip>,<&voice>,
				<&loopback>,<&compress>,<&hostless>,
				<&afe>,<&lsm>,<&routing>,<&cpe>,<&compr>;
		asoc-platform-names = "msm-pcm-dsp.0","msm-pcm-dsp.1","msm-pcm-dsp.2",
				"msm-voip-dsp","msm-pcm-voice","msm-pcm-loopback",
				"msm-compress-dsp","msm-pcm-hostless","msm-pcm-afe",
				"msm-lsm-client","msm-pcm-routing", "msm-cpe-lsm",
				"msm-compr-dsp";
		asoc-cpu = <&dai_pri_auxpcm>,<&dai_sec_auxpcm>,<&dai_hdmi>,<&dai_mi2s>,
				<&sb_0_rx>,<&sb_0_tx>,<&sb_1_rx>,<&sb_1_tx>,
				<&sb_2_rx>,<&sb_2_tx>,<&sb_3_rx>,<&sb_3_tx>,
				<&sb_4_rx>,<&sb_4_tx>,<&sb_5_tx>,<&bt_sco_rx>,
				<&bt_sco_tx>,<&int_fm_rx>,<&int_fm_tx>,<&afe_pcm_rx>,
				<&afe_pcm_tx>,<&afe_proxy_rx>,<&afe_proxy_tx>,
				<&incall_record_rx>,<&incall_record_tx>,<&incall_music_rx>,
				<&incall_music2_rx>;
		asoc-cpu-names = "msm-dai-q6-auxpcm.1","msm-dai-q6-auxpcm.2",
				"msm-dai-q6-hdmi.8","msm-dai-q6-mi2s.0",
				"msm-dai-q6-dev.16384","msm-dai-q6-dev.16385",
				"msm-dai-q6-dev.16386","msm-dai-q6-dev.16387",
				"msm-dai-q6-dev.16388","msm-dai-q6-dev.16389",
				"msm-dai-q6-dev.16390","msm-dai-q6-dev.16391",
				"msm-dai-q6-dev.16392","msm-dai-q6-dev.16393",
				"msm-dai-q6-dev.16395","msm-dai-q6-dev.12288",
				"msm-dai-q6-dev.12289","msm-dai-q6-dev.12292",
				"msm-dai-q6-dev.12293","msm-dai-q6-dev.224",
				"msm-dai-q6-dev.225","msm-dai-q6-dev.241",
				"msm-dai-q6-dev.240","msm-dai-q6-dev.32771",
				"msm-dai-q6-dev.32772","msm-dai-q6-dev.32773",
				"msm-dai-q6-dev.32770";
		asoc-codec = <&stub>;
		asoc-codec-names = "msm-stub-codec.1";
	};

* MSMZIRC ASoC Machine driver
@@ -1220,6 +1384,23 @@ the second being the connection's source.
codec can run at different mclk values. Mclk value can be 9.6MHz or 12.288MHz.
- pinctrl-names : pinctrl state names for each pin group configuration.
- pinctrl-x : defines pinctrl state for each pin group
- asoc-platform: This is phandle list containing the references to platform device
		 nodes that are used as part of the sound card dai-links.
- asoc-platform-names: This property contains list of platform names. The order of
		       the platform names should match to that of the phandle order
		       given in "asoc-platform".
- asoc-cpu: This is phandle list containing the references to cpu dai device nodes
	    that are used as part of the sound card dai-links.
- asoc-cpu-names: This property contains list of cpu dai names. The order of the
		  cpu dai names should match to that of the phandle order given
		  in "asoc-cpu". The cpu names are in the form of "%s.%d" form,
		  where the id (%d) field represents the back-end AFE port id that
		  this CPU dai is associated with.
- asoc-codec: This is phandle list containing the references to codec dai device
	      nodes that are used as part of the sound card dai-links.
- asoc-codec-names: This property contains list of codec dai names. The order of the
		    codec dai names should match to that of the phandle order given
		    in "asoc-codec".

Example:

+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@
	sound {
		qcom,model = "apq8084-taiko-cdp-snd-card";
		qcom,hdmi-audio-rx;
		asoc-codec = <&stub_codec>, <&hdmi_audio>;
		asoc-codec-names = "msm-stub-codec.1", "msm-hdmi-audio-codec-rx";
		qcom,cdc-micbias2-headset-only;
		qcom,ext-mclk-gpio  = <&msmgpio 47 0>;
	};
@@ -37,6 +39,8 @@
	sound-9330 {
		qcom,model = "apq8084-tomtom-cdp-snd-card";
		qcom,hdmi-audio-rx;
		asoc-codec = <&stub_codec>, <&hdmi_audio>;
		asoc-codec-names = "msm-stub-codec.1", "msm-hdmi-audio-codec-rx";
		qcom,cdc-micbias2-headset-only;
		qcom,ext-mclk-gpio  = <&msmgpio 47 0>;
	};
+2 −0
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@

		qcom,cdc-micbias2-headset-only;
		qcom,hdmi-audio-rx;
		asoc-codec = <&stub_codec>, <&hdmi_audio>;
		asoc-codec-names = "msm-stub-codec.1", "msm-hdmi-audio-codec-rx";
		qcom,ext-spk-amp-supply = <&hdmi_vreg>;
		qcom,ext-spk-amp-gpio = <&pma8084_mpps 6 0>;
		qcom,dock-plug-det-irq = <&msmgpio 142 0>;
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@
		qcom,hdmi-tx-hpd = <&msmgpio 34 0>;
		qcom,mdss-fb-map = <&mdss_fb1>;
		qcom,cont-splash-enabled;
		qcom,msm-hdmi-audio-rx {
		hdmi_audio: qcom,msm-hdmi-audio-rx {
			compatible = "qcom,msm-hdmi-audio-codec-rx";
		};
	};
+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,8 @@
			"MIC BIAS1 External", "Digital Mic4";

		qcom,hdmi-audio-rx;
		asoc-codec = <&stub_codec>, <&hdmi_audio>;
		asoc-codec-names = "msm-stub-codec.1", "msm-hdmi-audio-codec-rx";
		qcom,cdc-micbias2-headset-only;
		qcom,ext-mclk-gpio  = <&msmgpio 47 0>;
	};
@@ -91,6 +93,8 @@
			"MIC BIAS1 External", "Digital Mic4";

		qcom,hdmi-audio-rx;
		asoc-codec = <&stub_codec>, <&hdmi_audio>;
		asoc-codec-names = "msm-stub-codec.1", "msm-hdmi-audio-codec-rx";
		qcom,cdc-micbias2-headset-only;
		qcom,ext-mclk-gpio  = <&msmgpio 47 0>;
	};
Loading