public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] clk: x86: lpss-atom: A couple of cleanups and a feature
@ 2026-02-24 12:09 Andy Shevchenko
  2026-02-24 12:09 ` [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-24 12:09 UTC (permalink / raw)
  To: Andy Shevchenko, linux-clk, linux-kernel; +Cc: Michael Turquette, Stephen Boyd

A couple of cleanups for the clk-lpss-atom driver.
No functional changes intended.

On top of them, one feature is added.

Changelog v2:
- reshuffled code to add variables when it's needed (Stephen)
- added third patch

v1: 20240822161452.1780149-1-andriy.shevchenko@linux.intel.com

Andy Shevchenko (3):
  clk: x86: lpss-atom: Use predefined constants from units.h
  clk: x86: lpss-atom: Use temporary variable for struct device
  clk: x86: lpss-atom: Read frequency from the property

 drivers/clk/x86/clk-lpss-atom.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

-- 
2.50.1


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

* [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h
  2026-02-24 12:09 [PATCH v2 0/3] clk: x86: lpss-atom: A couple of cleanups and a feature Andy Shevchenko
@ 2026-02-24 12:09 ` Andy Shevchenko
  2026-02-25 22:33   ` Brian Masney
  2026-02-24 12:09 ` [PATCH v2 2/3] clk: x86: lpss-atom: Use temporary variable for struct device Andy Shevchenko
  2026-02-24 12:09 ` [PATCH v2 3/3] clk: x86: lpss-atom: Read frequency from the property Andy Shevchenko
  2 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-24 12:09 UTC (permalink / raw)
  To: Andy Shevchenko, linux-clk, linux-kernel; +Cc: Michael Turquette, Stephen Boyd

Use predefined constants from units.h to make code robust against typos
like how many zeros to put.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/clk/x86/clk-lpss-atom.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/x86/clk-lpss-atom.c b/drivers/clk/x86/clk-lpss-atom.c
index aa9d0bb98f8b..fb8637c472f2 100644
--- a/drivers/clk/x86/clk-lpss-atom.c
+++ b/drivers/clk/x86/clk-lpss-atom.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/platform_data/x86/clk-lpss.h>
 #include <linux/platform_device.h>
+#include <linux/units.h>
 
 static int lpss_atom_clk_probe(struct platform_device *pdev)
 {
@@ -25,7 +26,7 @@ static int lpss_atom_clk_probe(struct platform_device *pdev)
 	/* LPSS free running clock */
 	drvdata->name = "lpss_clk";
 	clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
-				      0, 100000000);
+				      0, 100 * HZ_PER_MHZ);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-- 
2.50.1


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

* [PATCH v2 2/3] clk: x86: lpss-atom: Use temporary variable for struct device
  2026-02-24 12:09 [PATCH v2 0/3] clk: x86: lpss-atom: A couple of cleanups and a feature Andy Shevchenko
  2026-02-24 12:09 ` [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h Andy Shevchenko
@ 2026-02-24 12:09 ` Andy Shevchenko
  2026-02-25 22:33   ` Brian Masney
  2026-02-24 12:09 ` [PATCH v2 3/3] clk: x86: lpss-atom: Read frequency from the property Andy Shevchenko
  2 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-24 12:09 UTC (permalink / raw)
  To: Andy Shevchenko, linux-clk, linux-kernel; +Cc: Michael Turquette, Stephen Boyd

Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/clk/x86/clk-lpss-atom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/x86/clk-lpss-atom.c b/drivers/clk/x86/clk-lpss-atom.c
index fb8637c472f2..57b0823d6ff2 100644
--- a/drivers/clk/x86/clk-lpss-atom.c
+++ b/drivers/clk/x86/clk-lpss-atom.c
@@ -16,17 +16,17 @@
 
 static int lpss_atom_clk_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct lpss_clk_data *drvdata;
 	struct clk *clk;
 
-	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
+	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
 	if (!drvdata)
 		return -ENOMEM;
 
 	/* LPSS free running clock */
 	drvdata->name = "lpss_clk";
-	clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL,
-				      0, 100 * HZ_PER_MHZ);
+	clk = clk_register_fixed_rate(dev, drvdata->name, NULL, 0, 100 * HZ_PER_MHZ);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-- 
2.50.1


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

* [PATCH v2 3/3] clk: x86: lpss-atom: Read frequency from the property
  2026-02-24 12:09 [PATCH v2 0/3] clk: x86: lpss-atom: A couple of cleanups and a feature Andy Shevchenko
  2026-02-24 12:09 ` [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h Andy Shevchenko
  2026-02-24 12:09 ` [PATCH v2 2/3] clk: x86: lpss-atom: Use temporary variable for struct device Andy Shevchenko
@ 2026-02-24 12:09 ` Andy Shevchenko
  2026-02-25 22:33   ` Brian Masney
  2 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-02-24 12:09 UTC (permalink / raw)
  To: Andy Shevchenko, linux-clk, linux-kernel; +Cc: Michael Turquette, Stephen Boyd

On the future platforms we might need to have different frequency
of the free running clock. Allow that to be modified via supplied
device property.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/clk/x86/clk-lpss-atom.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/x86/clk-lpss-atom.c b/drivers/clk/x86/clk-lpss-atom.c
index 57b0823d6ff2..597d20e492d2 100644
--- a/drivers/clk/x86/clk-lpss-atom.c
+++ b/drivers/clk/x86/clk-lpss-atom.c
@@ -10,23 +10,36 @@
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/module.h>
-#include <linux/platform_data/x86/clk-lpss.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/units.h>
 
+#include <linux/platform_data/x86/clk-lpss.h>
+
 static int lpss_atom_clk_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct lpss_clk_data *drvdata;
 	struct clk *clk;
+	u32 rate;
+	int ret;
 
 	drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
 	if (!drvdata)
 		return -ENOMEM;
 
+	if (device_property_present(dev, "clock-frequency")) {
+		ret = device_property_read_u32(dev, "clock-frequency", &rate);
+		if (ret)
+			return ret;
+	} else {
+		/* Default frequency is 100MHz */
+		rate = 100 * HZ_PER_MHZ;
+	}
+
 	/* LPSS free running clock */
 	drvdata->name = "lpss_clk";
-	clk = clk_register_fixed_rate(dev, drvdata->name, NULL, 0, 100 * HZ_PER_MHZ);
+	clk = clk_register_fixed_rate(dev, drvdata->name, NULL, 0, rate);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-- 
2.50.1


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

* Re: [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h
  2026-02-24 12:09 ` [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h Andy Shevchenko
@ 2026-02-25 22:33   ` Brian Masney
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Masney @ 2026-02-25 22:33 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-clk, linux-kernel, Michael Turquette, Stephen Boyd

On Tue, Feb 24, 2026 at 01:09:20PM +0100, Andy Shevchenko wrote:
> Use predefined constants from units.h to make code robust against typos
> like how many zeros to put.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

* Re: [PATCH v2 2/3] clk: x86: lpss-atom: Use temporary variable for struct device
  2026-02-24 12:09 ` [PATCH v2 2/3] clk: x86: lpss-atom: Use temporary variable for struct device Andy Shevchenko
@ 2026-02-25 22:33   ` Brian Masney
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Masney @ 2026-02-25 22:33 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-clk, linux-kernel, Michael Turquette, Stephen Boyd

On Tue, Feb 24, 2026 at 01:09:21PM +0100, Andy Shevchenko wrote:
> Use temporary variable for struct device to make code neater.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

* Re: [PATCH v2 3/3] clk: x86: lpss-atom: Read frequency from the property
  2026-02-24 12:09 ` [PATCH v2 3/3] clk: x86: lpss-atom: Read frequency from the property Andy Shevchenko
@ 2026-02-25 22:33   ` Brian Masney
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Masney @ 2026-02-25 22:33 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-clk, linux-kernel, Michael Turquette, Stephen Boyd

On Tue, Feb 24, 2026 at 01:09:22PM +0100, Andy Shevchenko wrote:
> On the future platforms we might need to have different frequency
> of the free running clock. Allow that to be modified via supplied
> device property.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Brian Masney <bmasney@redhat.com>


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

end of thread, other threads:[~2026-02-25 22:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 12:09 [PATCH v2 0/3] clk: x86: lpss-atom: A couple of cleanups and a feature Andy Shevchenko
2026-02-24 12:09 ` [PATCH v2 1/3] clk: x86: lpss-atom: Use predefined constants from units.h Andy Shevchenko
2026-02-25 22:33   ` Brian Masney
2026-02-24 12:09 ` [PATCH v2 2/3] clk: x86: lpss-atom: Use temporary variable for struct device Andy Shevchenko
2026-02-25 22:33   ` Brian Masney
2026-02-24 12:09 ` [PATCH v2 3/3] clk: x86: lpss-atom: Read frequency from the property Andy Shevchenko
2026-02-25 22:33   ` Brian Masney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox