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

Commit 71467e46 authored by Xiubo Li's avatar Xiubo Li Committed by Mark Brown
Browse files

ASoC: simple-card: Add device's module clock selection.



Try to get the device's module clock if the dt has no clocks and
system-clock-frequency properties.

Signed-off-by: default avatarXiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent e874ddea
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -90,14 +90,29 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
	 * dai->sysclk come from
	 *  "clocks = <&xxx>" (if system has common clock)
	 *  or "system-clock-frequency = <xxx>"
	 *  or device's module clock.
	 */
	if (of_property_read_bool(np, "clocks")) {
		clk = of_clk_get(np, 0);
	if (IS_ERR(clk))
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			goto parse_error;
		}

		dai->sysclk = clk_get_rate(clk);
	} else if (of_property_read_bool(np, "system-clock-frequency")) {
		of_property_read_u32(np,
				     "system-clock-frequency",
				     &dai->sysclk);
	else
	} else {
		clk = of_clk_get(*node, 0);
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			goto parse_error;
		}

		dai->sysclk = clk_get_rate(clk);
	}

	ret = 0;