Thread (27 messages) 27 messages, 2 authors, 2016-06-20

Re: [RFC PATCH 04/13] drm/tegra: Add sor-safe clock for DPAUX on Tegra210

From: Thierry Reding <hidden>
Date: 2016-06-20 16:33:29
Also in: dri-devel, linux-devicetree, linux-i2c, linux-tegra

On Mon, Jun 20, 2016 at 09:43:42AM +0100, Jon Hunter wrote:
On 17/06/16 17:18, Thierry Reding wrote:
quoted
On Fri, Jun 17, 2016 at 01:03:38PM +0100, Jon Hunter wrote:
quoted
diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
[...]
quoted
quoted
+	if (of_device_is_compatible(pdev->dev.of_node,
+				    "nvidia,tegra210-dpaux")) {
+		dpaux->clk_sor = devm_clk_get(&pdev->dev, "sor-safe");
+		if (IS_ERR(dpaux->clk_sor)) {
+			dev_err(&pdev->dev,
+				"failed to get sor-safe clock: %ld\n",
+				PTR_ERR(dpaux->clk_sor));
+			return PTR_ERR(dpaux->clk_sor);
+		}
+
+		err = clk_prepare_enable(dpaux->clk_sor);
+		if (err < 0) {
+			dev_err(&pdev->dev,
+				"failed to enable sor-safe clock: %d\n", err);
+			return err;
+		}
+	}
Please make this part of a struct tegra_dpaux_soc, so that we don't have
to check the compatible string again here. This could look like:

	struct tegra_dpaux_soc {
		bool needs_safe_clock;
	};

	static const struct tegra_dpaux_soc tegra124_dpaux_soc = {
		.needs_safe_clock = false,
	};

	static const struct tegra_dpaux_soc tegra210_dpaux_soc = {
		.needs_safe_clock = true,
	};

	...

	static const struct of_device_id tegra_dpaux_of_match[] = {
		{ .compatible = "nvidia,tegra210-dpaux", .data = &tegra210_dpaux_soc },
		{ .compatible = "nvidia,tegra124-dpaux", .data = &tegra124_dpaux_soc },
		{ },
	};
OK. I wonder if we should call it 'has_safe_clock' because this clock
does not exist for tegra124 AFAICT. #bikeshed ;-)
has_safe_clock is fine with me, too.

Thierry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help