diff --git a/drivers/clk/qcom/clock-generic.c b/drivers/clk/qcom/clock-generic.c index 3da2bcd2ff37..32243ab3fce5 100644 --- a/drivers/clk/qcom/clock-generic.c +++ b/drivers/clk/qcom/clock-generic.c @@ -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)) diff --git a/include/linux/clk/msm-clock-generic.h b/include/linux/clk/msm-clock-generic.h index 6facd07c4fa1..739a29162938 100644 --- a/include/linux/clk/msm-clock-generic.h +++ b/include/linux/clk/msm-clock-generic.h @@ -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; };