Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64fceb1d authored by Russell King's avatar Russell King
Browse files

ARM: ICST: use Hz instead of kHz



This makes the ICST support fit more nicely with the clk API,
eliminating the need to *1000 and /1000 in places.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 4de2edbd
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -24,12 +24,12 @@
 */
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };

unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco)
unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
{
	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
}

EXPORT_SYMBOL(icst307_khz);
EXPORT_SYMBOL(icst307_hz);

/*
 * Ascending divisor S values.
@@ -37,7 +37,7 @@ EXPORT_SYMBOL(icst307_khz);
static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };

struct icst_vco
icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
{
	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	unsigned long f;
@@ -94,4 +94,4 @@ icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
	return vco;
}

EXPORT_SYMBOL(icst307_khz_to_vco);
EXPORT_SYMBOL(icst307_hz_to_vco);
+4 −4
Original line number Diff line number Diff line
@@ -21,12 +21,12 @@
 */
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };

unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco)
unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
{
	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
}

EXPORT_SYMBOL(icst525_khz);
EXPORT_SYMBOL(icst525_hz);

/*
 * Ascending divisor S values.
@@ -34,7 +34,7 @@ EXPORT_SYMBOL(icst525_khz);
static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };

struct icst_vco
icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
{
	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	unsigned long f;
@@ -92,4 +92,4 @@ icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
	return vco;
}

EXPORT_SYMBOL(icst525_khz_to_vco);
EXPORT_SYMBOL(icst525_hz_to_vco);
+4 −4
Original line number Diff line number Diff line
@@ -18,14 +18,14 @@

#include <asm/hardware/icst.h>

unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco);
struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long freq);

/*
 * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
 * This frequency is pre-output divider.
 */
#define ICST307_VCO_MIN	6000
#define ICST307_VCO_MAX	200000
#define ICST307_VCO_MIN	6000000
#define ICST307_VCO_MAX	200000000

#endif
+5 −5
Original line number Diff line number Diff line
@@ -16,15 +16,15 @@

#include <asm/hardware/icst.h>

unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco);
struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long freq);

/*
 * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
 * This frequency is pre-output divider.
 */
#define ICST525_VCO_MIN		10000
#define ICST525_VCO_MAX_3V	200000
#define ICST525_VCO_MAX_5V	320000
#define ICST525_VCO_MIN		10000000
#define ICST525_VCO_MAX_3V	200000000
#define ICST525_VCO_MAX_5V	320000000

#endif
+4 −4
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ EXPORT_SYMBOL(clk_get_rate);
long clk_round_rate(struct clk *clk, unsigned long rate)
{
	struct icst_vco vco;
	vco = icst525_khz_to_vco(clk->params, rate / 1000);
	return icst525_khz(clk->params, vco) * 1000;
	vco = icst525_hz_to_vco(clk->params, rate);
	return icst525_hz(clk->params, vco);
}
EXPORT_SYMBOL(clk_round_rate);

@@ -50,8 +50,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
	if (clk->setvco) {
		struct icst_vco vco;

		vco = icst525_khz_to_vco(clk->params, rate / 1000);
		clk->rate = icst525_khz(clk->params, vco) * 1000;
		vco = icst525_hz_to_vco(clk->params, rate);
		clk->rate = icst525_hz(clk->params, vco);
		clk->setvco(clk, vco);
		ret = 0;
	}
Loading