From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759958AbcAMMhc (ORCPT ); Wed, 13 Jan 2016 07:37:32 -0500 Received: from mx12-09.smtp.antispamcloud.com ([46.165.232.179]:43091 "EHLO mx12-09.smtp.antispamcloud.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754419AbcAMMh3 convert rfc822-to-8bit (ORCPT ); Wed, 13 Jan 2016 07:37:29 -0500 X-Greylist: delayed 4415 seconds by postgrey-1.27 at vger.kernel.org; Wed, 13 Jan 2016 07:37:28 EST Subject: Re: [PATCH] hwmon: Add LTC2990 sensor driver To: Guenter Roeck , References: <1452067627-24939-1-git-send-email-mike.looijmans@topic.nl> <568D3127.5090901@roeck-us.net> <568EB58C.3090701@topic.nl> <568FD131.4080308@roeck-us.net> CC: , From: Mike Looijmans Organization: TOPIC Message-ID: <56963392.9080101@topic.nl> Date: Wed, 13 Jan 2016 12:22:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <568FD131.4080308@roeck-us.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8BIT X-Originating-IP: [192.168.80.121] X-EXCLAIMER-MD-CONFIG: 9833cda7-5b21-4d34-9a38-8d025ddc3664 X-EXCLAIMER-MD-BIFURCATION-INSTANCE: 0 X-Filter-ID: s0sct1PQhAABKnZB5plbIbbvfIHzQjPVmPLZeVYSu3xU9luQrU+8/8qthi+0Jd/W6KAUC/fjyuDn NXFr4uarwyNwZSpVdakq5X66Q8VYQRca9vh+1iGKuQPOclYnYikQ0/2nHbqxWziKbKPiSpdwVJeh 6oj6+vlVI7HORWkrem3u4ONX+wVRdCv4IOs1C4geKx6e82Qhrl5Lh95/VjZqVHB+NvhiSkt9FGXX bXB10m9VPlSGMfU9Lzo0uxWN7kMhLncc/qbbv57GdnyRbm8yEqwX9iq9CU97LyncVAJzC56Yo+01 cJIiPyMsq/VTfzPkIbtf63VNbf0lrvssY+k7ACgUUZ6G78uMfV2DLUDoJYSPCwPTzw22wYdX31FM YXOOFl5Bgdd0xwbfE0yjjQqqICERbInMiTBIUBbQ/Dy6Ip5J/ASe1B0hWvEIK5cPBacYKufgB7Ba elLkNTG3g1L+53OYYq89G8LTxEq5+I242X/3Y80OmAux3oN13+ztUzneK7xP+LD+FavI7Ol7e9pH /Pe4Uvw3tUqH8Ib6WPRGPWZ1++6w8PqYuLgGb7u7tZKksfrTSy315T+eQnDC8Q/96JFVgpT1b21u ZVckGp0ccOYWZk7PZs7jDt+VcZIxsBahwbRYKWMNtROYKfbuaAYREoGDA1m3o6oTfuAaw/GRbb+4 REj+VRyQT2g/K9wiHAQyiNldDtb4wgJqb3SEHNi1T4VUdYndRiyhyQb8o5SNcNQUrz12+SBJmQRv giHhvJsV4JtjPJ4R6ft//lif1yYpLLiLFZJhYijeIOrG82fwxtlvEjSGiKhzEHocL7YhFpj+ X-Report-Abuse-To: spam@mx99.antispamcloud.com X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJUb3OPwsHaH0Fvg5oXltHd/JUWjZ8+qhjyB23tbDuyLOYL8Ff78gYsez 4Rl08xudmXi4esCQ0R1MchVjt7wblGlvhFgW0MjUMRkF5sMCDfftTXNFDzN17hnrWeZYOJvLq0Ic WjZ+XcEjj/7Pkld0zkmvziDInX9WdMov2kn2yXjdwv61T+KDYyYtREgszdyFwv8IxCB3p/oCKvxr eyISh3JGb7OS5oVgiO+kDxZrVPLz3MmEGC2PrUKqLq5WmHK+Nw== X-Originating-IP: 88.159.208.100 X-Spampanel-Domain: topic.nl X-Spampanel-Username: 88.159.208.100 Authentication-Results: antispamcloud.com; auth=pass smtp.auth=88.159.208.100@topic.nl X-Spampanel-Outgoing-Class: ham X-Spampanel-Outgoing-Evidence: SB/global_tokens (0.00440161453334) X-Recommended-Action: accept Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08-01-16 16:09, Guenter Roeck wrote: > On 01/07/2016 10:59 AM, Mike Looijmans wrote: >> Thank you very much for your review comments, I'll update the driver and >> post a v2 patch. >> >> Inlined some replies below. Assume that I "will do" for all comments I >> didn't comment on inline... >> >> On 06-01-16 16:22, Guenter Roeck wrote: >>> Hello Mike, >>> >>> On 01/06/2016 12:07 AM, Mike Looijmans wrote: >>>> This adds support for the Linear Technology LTC2990 I2C System Monitor. >>> >>> s/ / / >>> >>>> The LTC2990 supports a combination of voltage, current and temperature >>>> monitoring, but this driver currently only supports reading two currents >>>> by measuring two differential voltages across series resistors. >>>> >>> Plus VCC, plus the internal temperature. >> >> Yeah, I should give myself more credit :) I'll add that in Kconfig too. >> >>>> This is sufficient to support the Topic Miami SOM which uses this chip >>>> to monitor the currents flowing into the FPGA and the CPU parts. >>>> >>>> Signed-off-by: Mike Looijmans >>>> --- >>>> drivers/hwmon/Kconfig | 15 +++ >>>> drivers/hwmon/Makefile | 1 + >>>> drivers/hwmon/ltc2990.c | 273 >>>> ++++++++++++++++++++++++++++++++++++++++++++++++ >>> > > [ ... ] > >>>> +} >>>> + >>>> +static struct ltc2990_data *ltc2990_update_device(struct device *dev) >>>> +{ >>>> + struct i2c_client *i2c = to_i2c_client(dev); >>>> + struct ltc2990_data *data = i2c_get_clientdata(i2c); >>>> + struct ltc2990_data *ret = data; >>>> + unsigned int timeout; >>>> + >>>> + mutex_lock(&data->update_lock); >>>> + >>>> + /* Update about 4 times per second max */ >>>> + if (time_after(jiffies, data->last_updated + HZ / 4) || >>>> !data->valid) { >>>> + int val; >>>> + int i; >>>> + >>> >>> Please consider using continuous conversion. This would simplify the >>> code significantly >>> and reduce read delays. >> >> It might increase power consumption though, as typically some user program >> would poll this every 10 seconds or so. I'll check the data sheet. >> > > I suspect that the power savings will be less than the added power > consumed by the CPU due to the more complex code. > > Really, unless you have an application where a few mW power savings > are essential and warrant the additional code complexity, this is > the wrong approach. Yeah, you're right, checked the datasheet and it reports a 1mA typical power usage when converting. Not worth the trouble. Continuous conversion made the driver a LOT simpler, could even completely drop the private data structure. I sent v2 already, but just noticed that some of the #includes were no longer needed, so I'll send a v3 to fix that. ... Kind regards, Mike Looijmans System Expert TOPIC Embedded Products Eindhovenseweg 32-C, NL-5683 KH Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijmans@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail