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

Commit 395254b2 authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

msm: clock-generic: Add a flag to ignore odd divider values



Some hardware implementations do not support odd
divider values. Add a flag to ignore those divider
values.

Change-Id: Iccc2fae8feb4caf80a50da2924efdd14fdf3561c
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent 893e87e8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -276,6 +276,8 @@ static long __div_round_rate(struct div_data *data, unsigned long rate,
	numer = data->is_half_divider ? 2 : 1;

	for (div = min_div; div <= max_div; div++) {
		if (data->skip_odd_div && (div & 1))
				continue;
		req_prate = mult_frac(rate, div, numer);
		prate = clk_round_rate(parent, req_prate);
		if (IS_ERR_VALUE(prate))
+5 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -119,6 +119,10 @@ struct div_data {
	 * they are 2*N.
	 */
	bool is_half_divider;
	/*
	 * Skip odd dividers since the hardware may not support them.
	 */
	bool skip_odd_div;
	unsigned int cached_div;
};