linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: designware: register clkdev during acpi device configuration
@ 2015-10-20  6:38 Ken Xue
  2015-10-20 11:17 ` Mika Westerberg
  0 siblings, 1 reply; 12+ messages in thread
From: Ken Xue @ 2015-10-20  6:38 UTC (permalink / raw)
  To: mika.westerberg, baruch; +Cc: SPG_Linux_Kernel, linux-i2c, linux-kernel, stable

DW I2C driver tries to register a clk from id->driver_data as an
alternative way besides intel lpss. But code doesn't register the
clk to clkdev. So, devm_clk_get will fail during probe.

The patch can fix this issue.

Signed-off-by: Ken Xue <Ken.Xue@amd.com>
Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 3dd2de3..9ee1fc6 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -27,6 +27,7 @@
 #include <linux/i2c.h>
 #include <linux/clk.h>
 #include <linux/clk-provider.h>
+#include <linux/clkdev.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/err.h>
@@ -78,6 +79,7 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
 {
 	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
 	const struct acpi_device_id *id;
+	struct clk *clk;
 
 	dev->adapter.nr = -1;
 	dev->tx_fifo_depth = 32;
@@ -97,9 +99,11 @@ static int dw_i2c_acpi_configure(struct platform_device *pdev)
 	 * id->driver_data.
 	 */
 	id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev);
-	if (id && id->driver_data)
-		clk_register_fixed_rate(&pdev->dev, dev_name(&pdev->dev), NULL,
-					CLK_IS_ROOT, id->driver_data);
+	if (id && id->driver_data) {
+		clk = clk_register_fixed_rate(&pdev->dev, dev_name(&pdev->dev),
+					NULL, CLK_IS_ROOT, id->driver_data);
+		clk_register_clkdev(clk, NULL, dev_name(&pdev->dev));
+	}
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-10-23  5:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-20  6:38 [PATCH 1/2] i2c: designware: register clkdev during acpi device configuration Ken Xue
2015-10-20 11:17 ` Mika Westerberg
2015-10-21  1:11   ` Ken Xue
2015-10-21  7:28     ` Mika Westerberg
2015-10-21  8:42       ` Ken Xue
2015-10-21  9:25         ` Mika Westerberg
2015-10-21  9:37           ` Ken Xue
2015-10-21  9:49             ` Mika Westerberg
2015-10-21  9:50               ` Ken Xue
2015-10-21 10:02                 ` Mika Westerberg
2015-10-21 10:46                 ` Mika Westerberg
2015-10-23  5:29                   ` Ken Xue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).