Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757229Ab3HGIpR (ORCPT ); Wed, 7 Aug 2013 04:45:17 -0400 Received: from f434.i.mail.ru ([185.5.136.105]:47672 "EHLO f434.i.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756301Ab3HGIpM (ORCPT ); Wed, 7 Aug 2013 04:45:12 -0400 X-Greylist: delayed 4662 seconds by postgrey-1.27 at vger.kernel.org; Wed, 07 Aug 2013 04:45:12 EDT From: =?UTF-8?B?QWxleGFuZGVyIFNoaXlhbg==?= To: =?UTF-8?B?V2VpIE5p?= Cc: =?UTF-8?B?R3VlbnRlciBSb2Vjaw==?= , =?UTF-8?B?c3dhcnJlbkB3d3dkb3Rvcmcub3Jn?= , =?UTF-8?B?bGludXgta2VybmVsQHZnZXIua2VybmVsLm9yZw==?= , =?UTF-8?B?bG0tc2Vuc29yc0BsbS1zZW5zb3JzLm9yZw==?= , =?UTF-8?B?bGludXgtdGVncmFAdmdlci5rZXJuZWwub3Jn?= , =?UTF-8?B?TWF0dGhldyBMb25nbmVja2Vy?= , =?UTF-8?B?a2hhbGlAbGludXgtZnIub3Jn?= , =?UTF-8?B?bGludXgtYXJtLWtlcm5lbEBsaXN0cy5pbmZyYWRlYWQub3Jn?= Subject: =?UTF-8?B?UmU6IFtQQVRDSCAxLzJdIGh3bW9uOiAobG05MCkgQWRkIHBvd2VyIGNvbnRy?= =?UTF-8?B?b2w=?= Mime-Version: 1.0 X-Mailer: Mail.Ru Mailer 1.0 X-Originating-IP: [217.119.30.118] Date: Wed, 07 Aug 2013 12:45:05 +0400 Reply-To: =?UTF-8?B?QWxleGFuZGVyIFNoaXlhbg==?= X-Priority: 3 (Normal) Message-ID: <1375865105.562600640@f434.i.mail.ru> Content-Type: text/plain; charset=utf-8 X-Mras: Ok In-Reply-To: <52020047.1080705@nvidia.com> References: <1375858358-15070-1-git-send-email-wni@nvidia.com> <5201FC2C.4030908@roeck-us.net> <52020047.1080705@nvidia.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id r778jPDb024956 Content-Length: 2164 Lines: 52 > On 08/07/2013 03:50 PM, Guenter Roeck wrote: > > On 08/07/2013 12:32 AM, Wei Ni wrote: > >> On 08/07/2013 03:27 PM, Alexander Shiyan wrote: > >>>> The device lm90 can be controlled by the vdd rail. > >>>> Adding the power control support to power on/off the vdd rail. > >>>> And make sure that power is enabled before accessing the device. > >>>> > >>>> Signed-off-by: Wei Ni > >>>> --- > >>>> drivers/hwmon/lm90.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ > >>> [...] > >>>> + if (!data->lm90_reg) { > >>>> + data->lm90_reg = regulator_get(&client->dev, "vdd"); > >>>> + if (IS_ERR_OR_NULL(data->lm90_reg)) { > >>>> + if (PTR_ERR(data->lm90_reg) == -ENODEV) > >>>> + dev_info(&client->dev, > >>>> + "No regulator found for vdd. Assuming vdd is always powered."); > >>>> + else > >>>> + dev_warn(&client->dev, > >>>> + "Error [%ld] in getting the regulator handle for vdd.\n", > >>>> + PTR_ERR(data->lm90_reg)); > >>>> + data->lm90_reg = NULL; > >>>> + mutex_unlock(&data->update_lock); > >>>> + return -ENODEV; > >>>> + } > >>>> + } > >>>> + if (is_enable) { > >>>> + ret = regulator_enable(data->lm90_reg); > >>>> + msleep(POWER_ON_DELAY); > >>> > >>> Can this delay be handled directly from regulator? > >> > >> I think it should be handled in the device driver. > >> Because there have different delay time to wait devices stable. > >> > > > > Then why does no other caller of regulator_enable() need this ? > > I don't think lm90 is so much different to other users of regulator > > functionality. > > May be I'm wrong. I noticed that in lm90 SPEC, the max of "SMBus Clock > Low Time" is 25ms, so I supposed that it may need about 20ms to stable > after power on. > > Anyway, if I remove this delay, the driver also works fine, so I will > remove it in my next patch. I originally had in mind that regulator API contain own delay option. E.g. reg-fixed-voltage && gpio-regulator contains "startup-delay-us" property. --- ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?