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: Vikram Mulukutla <markivx@codeaurora.org>
This commit is contained in:
Vikram Mulukutla 2015-01-22 16:02:34 -08:00
parent 893e87e826
commit 395254b2bc
2 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,5 @@
/*
* 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))

View file

@ -1,5 +1,5 @@
/*
* 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;
};