]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
clock: tegra: Report range if no discrete rates
authorAlex Frid <afrid@nvidia.com>
Tue, 17 Mar 2015 06:40:45 +0000 (23:40 -0700)
committerAleksandr Frid <afrid@nvidia.com>
Sat, 21 Mar 2015 00:19:56 +0000 (17:19 -0700)
If shared bus rate is not clipped to discrete set of rates, report
minimum/maximum rate range in the debugfs possible rates node.

Change-Id: I208586766f69323857370abaa3880d33430f2927
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/718689
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
drivers/platform/tegra/clock.c

index 1c73455876b9acaf08229ed02d99eaa21083eab2..5bf449ac2b0bb2b3a9a6bfbfa50fe16abbaa05a3 100644 (file)
@@ -1965,13 +1965,21 @@ static int possible_rates_show(struct seq_file *s, void *data)
 {
        struct clk *c = s->private;
        long rate = 0;
+       bool at_min = !c->min_rate;
 
        /* shared bus clock must round up, unless top of range reached */
        while (rate <= c->max_rate) {
                unsigned long rounded_rate = c->ops->round_rate(c, rate);
-               if (IS_ERR_VALUE(rounded_rate) || (rounded_rate <= rate))
+               if (IS_ERR_VALUE(rounded_rate) || (rounded_rate <= rate)) {
+                       if ((rate == rounded_rate) && at_min) {
+                               /* bus doesn't clip rates to discrete set */
+                               seq_printf(s, "... %lu", c->max_rate / 1000);
+                               seq_printf(s, "(kHz): discrete rates N/A\n");
+                               return 0;
+                       }
                        break;
-
+               }
+               at_min = rounded_rate == c->min_rate;
                rate = rounded_rate + 2000;     /* 2kHz resolution */
                seq_printf(s, "%ld ", rounded_rate / 1000);
        }