From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754473AbcE3JEc (ORCPT ); Mon, 30 May 2016 05:04:32 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:22096 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754140AbcE3JEb (ORCPT ); Mon, 30 May 2016 05:04:31 -0400 X-AuditID: cbfec7f4-f796c6d000001486-40-574c021b5543 Subject: Re: [PATCH RFT] regulator: max8972: Fix setting ramp delay To: Axel Lin References: <1464520619.14023.4.camel@ingics.com> <574BFE5C.5010006@samsung.com> Cc: Mark Brown , Laxman Dewangan , Mikko Perttunen , Liam Girdwood , "linux-kernel@vger.kernel.org" From: Krzysztof Kozlowski X-Enigmail-Draft-Status: N1110 Message-id: <574C021A.2080502@samsung.com> Date: Mon, 30 May 2016 11:04:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrFLMWRmVeSWpSXmKPExsVy+t/xq7rSTD7hBp0tGhZH5nxltpj68Amb xesXhhZL961msfh2pYPJ4vKuOWwWD65OY3Ng99g56y67R9vPMo9NqzrZPHqb37F59G1Zxejx eZNcAFsUl01Kak5mWWqRvl0CV0bzsdiCfZwVbY8aWRoYH7J3MXJySAiYSLS3zGaBsMUkLtxb z9bFyMUhJLCUUeLT1lusEM4zRomZ306AVQkLOEssX7aMGcQWEVCSWHX/MgtE0UxGiTnTTzGC OMwCdxglLt46xARSxSZgLLF5+RI2iB1yEr3dk8Am8QpoSez/PZMRxGYRUJU48ecTWL2oQITE rO0/mCBqBCV+TL4HVs8pECxx6ckioM0cQAvUJaZMyQUJMwvIS2xe85Z5AqPgLCQdsxCqZiGp WsDIvIpRNLU0uaA4KT3XUK84Mbe4NC9dLzk/dxMjJAa+7GBcfMzqEKMAB6MSD2+Bpne4EGti WXFl7iFGCQ5mJRFeXQafcCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8c3e9DxESSE8sSc1OTS1I LYLJMnFwSjUwhp9357jpuJ7hukLo7/Mv8qKux0yZcsfx4c1VRw8c0dE5smEb0++YPvlQ49tq 5xPFuOJi7RfwM0v3sBxrCzU7/c9rcdZntrQQIZUFc0V/eAkW9kzJfHFslteU+2eXn5n/1/Gn utsh+/kxd58VCZhKbdyl7jb70TtjF4ODVktP3t4qICxyyJ/XQ4mlOCPRUIu5qDgRAPihzfp9 AgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30/2016 10:52 AM, Axel Lin wrote: > 2016-05-30 16:48 GMT+08:00 Krzysztof Kozlowski : >> On 05/29/2016 01:16 PM, Axel Lin wrote: >>> Current code can set ramp delay to a wrong setting that the return value >>> from .set_voltage_time_sel is not enough for proper delay. >> >> I don't understand what yo wanted to say here. What wrong setting is >> possible? Why do you mention set_voltage_time_sel() here? >> >> Can you elaborate? >> >> The only difference I spotted is how you round up the ramp_delay values. > > Assume rdev->constraints->ramp_delay is 20000. > > Original code will set MAX8973_RAMP_12mV_PER_US. > > However, in regulator_set_voltage_time_sel() > return DIV_ROUND_UP(abs(new_volt - old_volt), ramp_delay); > > This return value is not enough if the device is using MAX8973_RAMP_12mV_PER_US > setting. Thanks, now it makes sense but the commit message needs improvements. The problem is that current code for .set_ramp_delay() rounds down the value written to register, while the implementation of .set_voltage_time_sel() works on original constraints (not rounded down). Please, fix the message. Best regards, Krzysztof