From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbbBWJmz (ORCPT ); Mon, 23 Feb 2015 04:42:55 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:58927 "EHLO mx08-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbbBWJmy (ORCPT ); Mon, 23 Feb 2015 04:42:54 -0500 Message-ID: <54EAF5F4.3070509@st.com> Date: Mon, 23 Feb 2015 10:42:12 +0100 From: Maxime Coquelin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: =?UTF-8?B?VXdlIEtsZWluZS1Lw7ZuaWc=?= , Mike Turquette , Stephen Boyd CC: , =?UTF-8?B?U8O2cmVuIEJyaW5rbWFubg==?= , , Subject: Re: [PATCH 3/3] clk: divider: fix calculation of initial best divider when rounding to closest References: <20150221085620.GV19388@pengutronix.de> <1424515225-6929-1-git-send-email-u.kleine-koenig@pengutronix.de> <1424515225-6929-4-git-send-email-u.kleine-koenig@pengutronix.de> In-Reply-To: <1424515225-6929-4-git-send-email-u.kleine-koenig@pengutronix.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.251.16.163] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-02-23_01:2015-02-20,2015-02-22,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Uwe, On 02/21/2015 11:40 AM, Uwe Kleine-König wrote: > Similar to the reasoning for the previous commit > > DIV_ROUND_CLOSEST(parent_rate, rate) > > might not be the best integer divisor to get a good approximation for > rate from parent_rate (given the metric for CLK_DIVIDER_ROUND_CLOSEST). > > For example assume a parent rate of 1000 Hz and a target rate of 700. > Using DIV_ROUND_CLOSEST the suggested divisor gets calculated to 1 > resulting in a target rate of 1000 with a delta of 300 to the desired > rate. With choosing 2 as divisor however the resulting rate is 500 which > is nearer to 700. > > Signed-off-by: Uwe Kleine-König > --- > drivers/clk/clk-divider.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > This is correct. Thanks for fixing this. You can add my: Acked-by: Maxime Coquelin Best regards, Maxime