linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export
@ 2023-06-17 13:10 Frank Oltmanns
  2023-06-17 13:10 ` [PATCH v5 1/2] " Frank Oltmanns
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Frank Oltmanns @ 2023-06-17 13:10 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Frank Oltmanns, A.s. Dong, Abel Vesa, Fabio Estevam,
	linux-arm-kernel, linux-clk, linux-kernel, NXP Linux Team,
	Peng Fan, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
	Elaine Zhang

The fractional divider approximation does not utilize the full available
range for clocks that are flagged CLK_FRAC_DIVIDER_ZERO_BASED. This
patchset aims to fix that.

It also adds test cases for the edge cases of fractional divider clocks
with and without the CLK_FRAC_DIVIDER_ZERO_BASED flag to highlight the
changes.

Finally, it also exports clk_fractional_divider_general_approximation so
that the test cases (but also other users like rockchip clk driver) can
be compiled as a module.

Unfortunately, I have no boards to test this patch. So all we have are
the unit tests. It seems the only user of this flag in mainline is
drivers/clk/imx/clk-composite-7ulp.c, therefore I'm cc-ing
get_maintainers.pl --git-blame -f drivers/clk/imx/clk-composite-7ulp.c
in the hopes of a wider audience.

Thank you for considering this contribution,
  Frank

P.S.: V4 was short-lived, because it triggered a compiler warning on
clang. I'm sorry for the noise. -- Frank

V4: https://lore.kernel.org/all/20230617102919.27564-1-frank@oltmanns.dev/
V3: https://lore.kernel.org/all/20230614185521.477924-1-frank@oltmanns.dev/
V2: https://lore.kernel.org/lkml/20230613083626.227476-1-frank@oltmanns.dev/
V1: https://lore.kernel.org/lkml/20230529133433.56215-1-frank@oltmanns.dev/

Changes in V5 (since V4):
 - Fix compiler warnings on clang by removing superfluous variable max_m
   in the test cases for the maximum denominator (n) and max_n in the
   test cases for max numerator (m).
   Thank you, Intel, for your kernel test robot!

Changes in V4 (since V3):
 - Export clk_fractional_divider_general_approximation so that users
   (e.g., the testcases) can be compiled as modules.
 - Change test cases so that they test
   clk_fractional_divider_general_approximation again (like in V2)
   instead of clk_fd_round_rate (like in V3), but keeping the structure
   of V3 with separate file and individual test cases for each edge
   case.

Changes in V3 (since V2):
 - Completely reworked the test cases
   - Moved tests to separate file as per Stephen's request
   - Move each edge case into their individual test case as per
     Stephen's request
   - Test clk_fd_round_rate instead of
     clk_fractional_divider_general_approximation as testing the latter
     broke builds

Changes in V2 (since V1):
 - Added test case as requested by Stephen Boyd
 - Fixed commit message as the Cc: was missing a closing bracket, so that the
   original mail unfortunately did not go out to A. s. Dong.

Frank Oltmanns (2):
  clk: fractional-divider: Improve approximation when zero based and
    export
  clk: fractional-divider: tests: Add test suite for edge cases

 drivers/clk/.kunitconfig                  |   1 +
 drivers/clk/Kconfig                       |   7 +
 drivers/clk/Makefile                      |   1 +
 drivers/clk/clk-fractional-divider.c      |  27 +++-
 drivers/clk/clk-fractional-divider_test.c | 157 ++++++++++++++++++++++
 5 files changed, 186 insertions(+), 7 deletions(-)
 create mode 100644 drivers/clk/clk-fractional-divider_test.c

-- 
2.41.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 1/2] clk: fractional-divider: Improve approximation when zero based and export
  2023-06-17 13:10 [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
@ 2023-06-17 13:10 ` Frank Oltmanns
  2023-10-12 22:40   ` Stephen Boyd
  2023-06-17 13:10 ` [PATCH v5 2/2] clk: fractional-divider: tests: Add test suite for edge cases Frank Oltmanns
  2023-07-17  8:24 ` [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
  2 siblings, 1 reply; 7+ messages in thread
From: Frank Oltmanns @ 2023-06-17 13:10 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Frank Oltmanns, A . s . Dong, Abel Vesa, Fabio Estevam,
	linux-arm-kernel, linux-clk, linux-kernel, NXP Linux Team,
	Peng Fan, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
	Elaine Zhang

Consider the CLK_FRAC_DIVIDER_ZERO_BASED flag when finding the best
approximation for m and n. By doing so, increase the range of valid
values for the numerator and denominator by 1.

Furthermore, export the approximation function so that users of this
function can be compiled as modules.

Cc: A.s. Dong <aisheng.dong@nxp.com>
Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
---
 drivers/clk/clk-fractional-divider.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c
index 479297763e70..5067e067e906 100644
--- a/drivers/clk/clk-fractional-divider.c
+++ b/drivers/clk/clk-fractional-divider.c
@@ -123,6 +123,7 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw,
 						  unsigned long *m, unsigned long *n)
 {
 	struct clk_fractional_divider *fd = to_clk_fd(hw);
+	unsigned long max_m, max_n;
 
 	/*
 	 * Get rate closer to *parent_rate to guarantee there is no overflow
@@ -138,10 +139,17 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw,
 			rate <<= scale - fd->nwidth;
 	}
 
-	rational_best_approximation(rate, *parent_rate,
-			GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0),
-			m, n);
+	if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
+		max_m = 1 << fd->mwidth;
+		max_n = 1 << fd->nwidth;
+	} else {
+		max_m = GENMASK(fd->mwidth - 1, 0);
+		max_n = GENMASK(fd->nwidth - 1, 0);
+	}
+
+	rational_best_approximation(rate, *parent_rate, max_m, max_n, m, n);
 }
+EXPORT_SYMBOL_GPL(clk_fractional_divider_general_approximation);
 
 static long clk_fd_round_rate(struct clk_hw *hw, unsigned long rate,
 			      unsigned long *parent_rate)
@@ -169,13 +177,18 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
 {
 	struct clk_fractional_divider *fd = to_clk_fd(hw);
 	unsigned long flags = 0;
-	unsigned long m, n;
+	unsigned long m, n, max_m, max_n;
 	u32 mmask, nmask;
 	u32 val;
 
-	rational_best_approximation(rate, parent_rate,
-			GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0),
-			&m, &n);
+	if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
+		max_m = 1 << fd->mwidth;
+		max_n = 1 << fd->nwidth;
+	} else {
+		max_m = GENMASK(fd->mwidth - 1, 0);
+		max_n = GENMASK(fd->nwidth - 1, 0);
+	}
+	rational_best_approximation(rate, parent_rate, max_m, max_n, &m, &n);
 
 	if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
 		m--;
-- 
2.41.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v5 2/2] clk: fractional-divider: tests: Add test suite for edge cases
  2023-06-17 13:10 [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
  2023-06-17 13:10 ` [PATCH v5 1/2] " Frank Oltmanns
@ 2023-06-17 13:10 ` Frank Oltmanns
  2023-10-12 22:40   ` Stephen Boyd
  2023-07-17  8:24 ` [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
  2 siblings, 1 reply; 7+ messages in thread
From: Frank Oltmanns @ 2023-06-17 13:10 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Frank Oltmanns, A.s. Dong, Abel Vesa, Fabio Estevam,
	linux-arm-kernel, linux-clk, linux-kernel, NXP Linux Team,
	Peng Fan, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
	Elaine Zhang

In light of the recent discovery that the fractional divisor
approximation does not utilize the full available range for clocks that
are flagged CLK_FRAC_DIVIDER_ZERO_BASED [1], implement tests for the
edge cases of this clock type.

Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
Link: https://lore.kernel.org/lkml/20230529133433.56215-1-frank@oltmanns.dev [1]
---
Please note: I get two checkpatch warnings for this patch:
 - Concerning the help text in Kconfig.
 - Regarding the file being added, asking if MAINTAINERS needs updating.

Both the help text as well as the MAINTAINERS file seem fine to me.

As expected, when the tests are run *without* PATCH 1, the two "zero
based" test cases fail:

================= clk-fd-test (4 subtests) =================
[PASSED] clk_fd_test_approximation_max_denominator
[PASSED] clk_fd_test_approximation_max_numerator
# clk_fd_test_approximation_max_denominator_zero_based: EXPECTATION FAILED at drivers/clk/clk-fractional-divider_test.c:104
Expected n == max_n, but
    n == 7 (0x7)
    max_n == 8 (0x8)
[FAILED] clk_fd_test_approximation_max_denominator_zero_based
# clk_fd_test_approximation_max_numerator_zero_based: EXPECTATION FAILED at drivers/clk/clk-fractional-divider_test.c:134
Expected m == max_m, but
    m == 7 (0x7)
    max_m == 8 (0x8)
[FAILED] clk_fd_test_approximation_max_numerator_zero_based
# clk-fd-test: pass:2 fail:2 skip:0 total:4
# Totals: pass:2 fail:2 skip:0 total:4
=================== [FAILED] clk-fd-test ===================

Best regards,
  Frank

 drivers/clk/.kunitconfig                  |   1 +
 drivers/clk/Kconfig                       |   7 +
 drivers/clk/Makefile                      |   1 +
 drivers/clk/clk-fractional-divider_test.c | 157 ++++++++++++++++++++++
 4 files changed, 166 insertions(+)
 create mode 100644 drivers/clk/clk-fractional-divider_test.c

diff --git a/drivers/clk/.kunitconfig b/drivers/clk/.kunitconfig
index 2fbeb71316f8..efa12ac2b3f2 100644
--- a/drivers/clk/.kunitconfig
+++ b/drivers/clk/.kunitconfig
@@ -2,4 +2,5 @@ CONFIG_KUNIT=y
 CONFIG_COMMON_CLK=y
 CONFIG_CLK_KUNIT_TEST=y
 CONFIG_CLK_GATE_KUNIT_TEST=y
+CONFIG_CLK_FD_KUNIT_TEST=y
 CONFIG_UML_PCI_OVER_VIRTIO=n
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 016814e15536..3fbb40cb5551 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -513,4 +513,11 @@ config CLK_GATE_KUNIT_TEST
 	help
 	  Kunit test for the basic clk gate type.
 
+config CLK_FD_KUNIT_TEST
+	tristate "Basic fractional divider type Kunit test" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  Kunit test for the clk-fractional-divider type.
+
 endif
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 0aebef17edc6..9d2337c12dd1 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_COMMON_CLK)	+= clk-multiplier.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-mux.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-composite.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-fractional-divider.o
+obj-$(CONFIG_CLK_FD_KUNIT_TEST) += clk-fractional-divider_test.o
 obj-$(CONFIG_COMMON_CLK)	+= clk-gpio.o
 ifeq ($(CONFIG_OF), y)
 obj-$(CONFIG_COMMON_CLK)	+= clk-conf.o
diff --git a/drivers/clk/clk-fractional-divider_test.c b/drivers/clk/clk-fractional-divider_test.c
new file mode 100644
index 000000000000..7b8105496cbb
--- /dev/null
+++ b/drivers/clk/clk-fractional-divider_test.c
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Kunit test for clock fractional divider
+ */
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+
+/* Needed for clk_hw_get_clk() */
+#include "clk.h"
+
+/* Needed for clk_fractional_divider_general_approximation */
+#include "clk-fractional-divider.h"
+
+#include <kunit/test.h>
+
+/*
+ * Test the maximum denominator case for fd clock without flags.
+ *
+ * Expect the highest possible denominator to be used in order to get as close as possible to the
+ * requested rate.
+ */
+static void clk_fd_test_approximation_max_denominator(struct kunit *test)
+{
+	struct clk_fractional_divider *fd;
+	struct clk_hw *hw;
+	unsigned long rate, parent_rate, m, n, max_n;
+
+	fd = kunit_kzalloc(test, sizeof(*fd), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, fd);
+
+	fd->mwidth = 3;
+	fd->nwidth = 3;
+	max_n = 7;
+
+	hw = &fd->hw;
+
+	rate = 240000000;
+	parent_rate = (max_n + 1) * rate; /* so that it exceeds the maximum divisor */
+
+	clk_fractional_divider_general_approximation(hw, rate, &parent_rate, &m, &n);
+	KUNIT_EXPECT_EQ(test, parent_rate, (max_n + 1) * rate); /* parent remains unchanged */
+	KUNIT_EXPECT_EQ(test, m, 1);
+	KUNIT_EXPECT_EQ(test, n, max_n);
+}
+
+/*
+ * Test the maximum numerator case for fd clock without flags.
+ *
+ * Expect the highest possible numerator to be used in order to get as close as possible to the
+ * requested rate.
+ */
+static void clk_fd_test_approximation_max_numerator(struct kunit *test)
+{
+	struct clk_fractional_divider *fd;
+	struct clk_hw *hw;
+	unsigned long rate, parent_rate, m, n, max_m;
+
+	fd = kunit_kzalloc(test, sizeof(*fd), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, fd);
+
+	fd->mwidth = 3;
+	max_m = 7;
+	fd->nwidth = 3;
+
+	hw = &fd->hw;
+
+	rate = 240000000;
+	parent_rate = rate / (max_m + 1); /* so that it exceeds the maximum numerator */
+
+	clk_fractional_divider_general_approximation(hw, rate, &parent_rate, &m, &n);
+	KUNIT_EXPECT_EQ(test, parent_rate, rate / (max_m + 1)); /* parent remains unchanged */
+	KUNIT_EXPECT_EQ(test, m, max_m);
+	KUNIT_EXPECT_EQ(test, n, 1);
+}
+
+/*
+ * Test the maximum denominator case for zero based fd clock.
+ *
+ * Expect the highest possible denominator to be used in order to get as close as possible to the
+ * requested rate.
+ */
+static void clk_fd_test_approximation_max_denominator_zero_based(struct kunit *test)
+{
+	struct clk_fractional_divider *fd;
+	struct clk_hw *hw;
+	unsigned long rate, parent_rate, m, n, max_n;
+
+	fd = kunit_kzalloc(test, sizeof(*fd), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, fd);
+
+	fd->flags = CLK_FRAC_DIVIDER_ZERO_BASED;
+	fd->mwidth = 3;
+	fd->nwidth = 3;
+	max_n = 8;
+
+	hw = &fd->hw;
+
+	rate = 240000000;
+	parent_rate = (max_n + 1) * rate; /* so that it exceeds the maximum divisor */
+
+	clk_fractional_divider_general_approximation(hw, rate, &parent_rate, &m, &n);
+	KUNIT_EXPECT_EQ(test, parent_rate, (max_n + 1) * rate); /* parent remains unchanged */
+	KUNIT_EXPECT_EQ(test, m, 1);
+	KUNIT_EXPECT_EQ(test, n, max_n);
+}
+
+/*
+ * Test the maximum numerator case for zero based fd clock.
+ *
+ * Expect the highest possible numerator to be used in order to get as close as possible to the
+ * requested rate.
+ */
+static void clk_fd_test_approximation_max_numerator_zero_based(struct kunit *test)
+{
+	struct clk_fractional_divider *fd;
+	struct clk_hw *hw;
+	unsigned long rate, parent_rate, m, n, max_m;
+
+	fd = kunit_kzalloc(test, sizeof(*fd), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, fd);
+
+	fd->flags = CLK_FRAC_DIVIDER_ZERO_BASED;
+	fd->mwidth = 3;
+	max_m = 8;
+	fd->nwidth = 3;
+
+	hw = &fd->hw;
+
+	rate = 240000000;
+	parent_rate = rate / (max_m + 1); /* so that it exceeds the maximum numerator */
+
+	clk_fractional_divider_general_approximation(hw, rate, &parent_rate, &m, &n);
+	KUNIT_EXPECT_EQ(test, parent_rate, rate / (max_m + 1)); /* parent remains unchanged */
+	KUNIT_EXPECT_EQ(test, m, max_m);
+	KUNIT_EXPECT_EQ(test, n, 1);
+}
+
+static struct kunit_case clk_fd_test_cases[] = {
+	KUNIT_CASE(clk_fd_test_approximation_max_denominator),
+	KUNIT_CASE(clk_fd_test_approximation_max_numerator),
+	KUNIT_CASE(clk_fd_test_approximation_max_denominator_zero_based),
+	KUNIT_CASE(clk_fd_test_approximation_max_numerator_zero_based),
+	{}
+};
+
+/*
+ * Test suite for a fractional divider clock.
+ */
+static struct kunit_suite clk_fd_test_suite = {
+	.name = "clk-fd-test",
+	.test_cases = clk_fd_test_cases,
+};
+
+kunit_test_suites(
+	&clk_fd_test_suite
+);
+MODULE_LICENSE("GPL");
-- 
2.41.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export
  2023-06-17 13:10 [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
  2023-06-17 13:10 ` [PATCH v5 1/2] " Frank Oltmanns
  2023-06-17 13:10 ` [PATCH v5 2/2] clk: fractional-divider: tests: Add test suite for edge cases Frank Oltmanns
@ 2023-07-17  8:24 ` Frank Oltmanns
  2023-07-19 22:12   ` Stephen Boyd
  2 siblings, 1 reply; 7+ messages in thread
From: Frank Oltmanns @ 2023-07-17  8:24 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: A.s. Dong, Abel Vesa, Fabio Estevam, linux-arm-kernel, linux-clk,
	linux-kernel, NXP Linux Team, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo, Elaine Zhang

Hi,

On 2023-06-17 at 15:10:39 +0200, Frank Oltmanns <frank@oltmanns.dev> wrote:
> The fractional divider approximation does not utilize the full available
> range for clocks that are flagged CLK_FRAC_DIVIDER_ZERO_BASED. This
> patchset aims to fix that.
>
> It also adds test cases for the edge cases of fractional divider clocks
> with and without the CLK_FRAC_DIVIDER_ZERO_BASED flag to highlight the
> changes.
>
> Finally, it also exports clk_fractional_divider_general_approximation so
> that the test cases (but also other users like rockchip clk driver) can
> be compiled as a module.
>
> Unfortunately, I have no boards to test this patch. So all we have are
> the unit tests. It seems the only user of this flag in mainline is
> drivers/clk/imx/clk-composite-7ulp.c, therefore I'm cc-ing
> get_maintainers.pl --git-blame -f drivers/clk/imx/clk-composite-7ulp.c
> in the hopes of a wider audience.

Are there remarks or questions on this patchset? Anything that needs to
be improved?

Thanks,
  Frank

>
> Thank you for considering this contribution,
>   Frank
>
> P.S.: V4 was short-lived, because it triggered a compiler warning on
> clang. I'm sorry for the noise. -- Frank
>
> V4: https://lore.kernel.org/all/20230617102919.27564-1-frank@oltmanns.dev/
> V3: https://lore.kernel.org/all/20230614185521.477924-1-frank@oltmanns.dev/
> V2: https://lore.kernel.org/lkml/20230613083626.227476-1-frank@oltmanns.dev/
> V1: https://lore.kernel.org/lkml/20230529133433.56215-1-frank@oltmanns.dev/
>
> Changes in V5 (since V4):
>  - Fix compiler warnings on clang by removing superfluous variable max_m
>    in the test cases for the maximum denominator (n) and max_n in the
>    test cases for max numerator (m).
>    Thank you, Intel, for your kernel test robot!
>
> Changes in V4 (since V3):
>  - Export clk_fractional_divider_general_approximation so that users
>    (e.g., the testcases) can be compiled as modules.
>  - Change test cases so that they test
>    clk_fractional_divider_general_approximation again (like in V2)
>    instead of clk_fd_round_rate (like in V3), but keeping the structure
>    of V3 with separate file and individual test cases for each edge
>    case.
>
> Changes in V3 (since V2):
>  - Completely reworked the test cases
>    - Moved tests to separate file as per Stephen's request
>    - Move each edge case into their individual test case as per
>      Stephen's request
>    - Test clk_fd_round_rate instead of
>      clk_fractional_divider_general_approximation as testing the latter
>      broke builds
>
> Changes in V2 (since V1):
>  - Added test case as requested by Stephen Boyd
>  - Fixed commit message as the Cc: was missing a closing bracket, so that the
>    original mail unfortunately did not go out to A. s. Dong.
>
> Frank Oltmanns (2):
>   clk: fractional-divider: Improve approximation when zero based and
>     export
>   clk: fractional-divider: tests: Add test suite for edge cases
>
>  drivers/clk/.kunitconfig                  |   1 +
>  drivers/clk/Kconfig                       |   7 +
>  drivers/clk/Makefile                      |   1 +
>  drivers/clk/clk-fractional-divider.c      |  27 +++-
>  drivers/clk/clk-fractional-divider_test.c | 157 ++++++++++++++++++++++
>  5 files changed, 186 insertions(+), 7 deletions(-)
>  create mode 100644 drivers/clk/clk-fractional-divider_test.c

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export
  2023-07-17  8:24 ` [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
@ 2023-07-19 22:12   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2023-07-19 22:12 UTC (permalink / raw)
  To: Frank Oltmanns, Michael Turquette
  Cc: A.s. Dong, Abel Vesa, Fabio Estevam, linux-arm-kernel, linux-clk,
	linux-kernel, NXP Linux Team, Peng Fan, Pengutronix Kernel Team,
	Sascha Hauer, Shawn Guo, Elaine Zhang

Quoting Frank Oltmanns (2023-07-17 01:24:49)
> Hi,
> 
> On 2023-06-17 at 15:10:39 +0200, Frank Oltmanns <frank@oltmanns.dev> wrote:
> > The fractional divider approximation does not utilize the full available
> > range for clocks that are flagged CLK_FRAC_DIVIDER_ZERO_BASED. This
> > patchset aims to fix that.
> >
> > It also adds test cases for the edge cases of fractional divider clocks
> > with and without the CLK_FRAC_DIVIDER_ZERO_BASED flag to highlight the
> > changes.
> >
> > Finally, it also exports clk_fractional_divider_general_approximation so
> > that the test cases (but also other users like rockchip clk driver) can
> > be compiled as a module.
> >
> > Unfortunately, I have no boards to test this patch. So all we have are
> > the unit tests. It seems the only user of this flag in mainline is
> > drivers/clk/imx/clk-composite-7ulp.c, therefore I'm cc-ing
> > get_maintainers.pl --git-blame -f drivers/clk/imx/clk-composite-7ulp.c
> > in the hopes of a wider audience.
> 
> Are there remarks or questions on this patchset? Anything that needs to
> be improved?
> 

I haven't taken a look yet. You sent this almost exactly when I started
a weeks long trip with minimal network access.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 1/2] clk: fractional-divider: Improve approximation when zero based and export
  2023-06-17 13:10 ` [PATCH v5 1/2] " Frank Oltmanns
@ 2023-10-12 22:40   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2023-10-12 22:40 UTC (permalink / raw)
  To: Frank Oltmanns, Michael Turquette
  Cc: Frank Oltmanns, A . s . Dong, Abel Vesa, Fabio Estevam,
	linux-arm-kernel, linux-clk, linux-kernel, NXP Linux Team,
	Peng Fan, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
	Elaine Zhang

Quoting Frank Oltmanns (2023-06-17 06:10:40)
> Consider the CLK_FRAC_DIVIDER_ZERO_BASED flag when finding the best
> approximation for m and n. By doing so, increase the range of valid
> values for the numerator and denominator by 1.
> 
> Furthermore, export the approximation function so that users of this
> function can be compiled as modules.
> 
> Cc: A.s. Dong <aisheng.dong@nxp.com>
> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
> ---

Applied to clk-next

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v5 2/2] clk: fractional-divider: tests: Add test suite for edge cases
  2023-06-17 13:10 ` [PATCH v5 2/2] clk: fractional-divider: tests: Add test suite for edge cases Frank Oltmanns
@ 2023-10-12 22:40   ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2023-10-12 22:40 UTC (permalink / raw)
  To: Frank Oltmanns, Michael Turquette
  Cc: Frank Oltmanns, A.s. Dong, Abel Vesa, Fabio Estevam,
	linux-arm-kernel, linux-clk, linux-kernel, NXP Linux Team,
	Peng Fan, Pengutronix Kernel Team, Sascha Hauer, Shawn Guo,
	Elaine Zhang

Quoting Frank Oltmanns (2023-06-17 06:10:41)
> In light of the recent discovery that the fractional divisor
> approximation does not utilize the full available range for clocks that
> are flagged CLK_FRAC_DIVIDER_ZERO_BASED [1], implement tests for the
> edge cases of this clock type.
> 
> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
> Link: https://lore.kernel.org/lkml/20230529133433.56215-1-frank@oltmanns.dev [1]
> ---

Applied to clk-next

I made some changes but they're mostly cosmetic.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-10-12 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-17 13:10 [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
2023-06-17 13:10 ` [PATCH v5 1/2] " Frank Oltmanns
2023-10-12 22:40   ` Stephen Boyd
2023-06-17 13:10 ` [PATCH v5 2/2] clk: fractional-divider: tests: Add test suite for edge cases Frank Oltmanns
2023-10-12 22:40   ` Stephen Boyd
2023-07-17  8:24 ` [PATCH v5 0/2] clk: fractional-divider: Improve approximation when zero based and export Frank Oltmanns
2023-07-19 22:12   ` Stephen Boyd

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).