From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbcG2UG5 (ORCPT ); Fri, 29 Jul 2016 16:06:57 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33218 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752304AbcG2UGw (ORCPT ); Fri, 29 Jul 2016 16:06:52 -0400 Subject: Re: [v3,2/6] power: add power sequence library To: Peter Chen , gregkh@linuxfoundation.org, stern@rowland.harvard.edu, ulf.hansson@linaro.org, broonie@kernel.org, sre@kernel.org, robh+dt@kernel.org, shawnguo@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org References: <1469007629-31757-3-git-send-email-peter.chen@nxp.com> Cc: k.kozlowski@samsung.com, linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de, devicetree@vger.kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, linux-usb@vger.kernel.org, arnd@arndb.de, s.hauer@pengutronix.de, mail@maciej.szmigiero.name, troy.kisky@boundarydevices.com, festevam@gmail.com, oscar@naiandei.net, stephen.boyd@linaro.org, linux-pm@vger.kernel.org, stillcompiling@gmail.com, linux-kernel@vger.kernel.org From: Matthias Kaehlcke Message-ID: Date: Fri, 29 Jul 2016 13:06:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1469007629-31757-3-git-send-email-peter.chen@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, Thanks for your work on this, a few comments inline On 07/20/2016 02:40 AM, Peter Chen wrote: > ... > > +static int pwrseq_generic_on(struct device_node *np, struct pwrseq *pwrseq) > +{ > > ... > > + if (gpiod_reset) { > + u32 duration_us = 50; > + > + of_property_read_u32(np, "reset-duration-us", > + &duration_us); > + usleep_range(duration_us, duration_us + 10); The end of the range could allow for more margin. Also consider busy looping for very short delays as in http://lxr.free-electrons.com/source/drivers/regulator/core.c#L2062 > ... > > +static int pwrseq_generic_get(struct device_node *np, struct pwrseq *pwrseq) > +{ > + struct pwrseq_generic *pwrseq_gen = to_generic_pwrseq(pwrseq); > + enum of_gpio_flags flags; > + int reset_gpio, ret = 0; > + > + pwrseq_gen->clk = of_clk_get_by_name(np, NULL); This only gets the first of potentially multiple clocks, is that intended?