Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1786843rdf; Sun, 5 Nov 2023 14:32:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJcpMM72YlgZuaMlSI8ZdbVYZqgvQTyQ4B1Y0iYVPvVa+46llOk5tXO7da08Vf3Nc50bSo X-Received: by 2002:a05:6a20:3d82:b0:16b:9886:7eda with SMTP id s2-20020a056a203d8200b0016b98867edamr32880201pzi.35.1699223545827; Sun, 05 Nov 2023 14:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699223545; cv=none; d=google.com; s=arc-20160816; b=F4QWOvIxouQDnnydI+WTQII7o2+MpEoSxl5JiBwjWH/S36PRkpjkhA6dFC65NK2l6I F5oXF4MOavW0mU8A2nlv8bgGDoPV9Mcpz48vnG8Iiy1pGI/wbdujXtJHk6hj7l2MO3bB py+BKoNgojkYPhDgxo0R2uYyykqkLmi1apXfl/zN22v/c7p8i6EJyJoFYbLFJryXoWtx d1037M4in62qWqnCzvDes15EOANYyClpmkxN1ZjdzuGPTZc/QjIpJgSEIn1avOeFnqKm laGukdYKHDvJ3oBiY0D+jAtrPUgMvpg5/WgwSf9gTlwQl0ZXjKXF2A/briODfzMGBZtl aKBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:sender:dkim-signature; bh=6a/1tK8D+3pTldim80ICuo8nqDfb6HPfUZNmM3VgcKU=; fh=sCeQTdsOhdgzPwNKvNVUpKclFiAY28zjsD+xani1DR0=; b=AjjjDzBO6Kz9Id+wTO+3jSztikC4QJ9/XBFGSBCPdZwPnkN5a7Tx4V3PLA+6bwG/qn a8rGA7e6SGJS3t/K4aA6CUIPNxomFir+7kZ7MrCvuE+rC28FiJJ514mtX0n0WPnJTof5 iQxn0sCezGTtDAzSf0HS2XeL4YYmq4cVR0bO3kyyTAJTilnvoQEdn3pIHf+uFruZxJhs XhdSXc9uw7R0E/sYGlGczaxO4uchaQcTr/IHPUSjC5Tfin7GLga8qEcNWqNSmDDobjQd SwJ3SwSOHHdd3TlOcoX2CEYywfRYZtSBvY8CSRAJQ0KN4likYgqkCdXIfrp4/uRKQHNz YGpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fSsn2cB1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j12-20020a056a00234c00b006c0fe926fc9si7073602pfj.173.2023.11.05.14.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 14:32:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fSsn2cB1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 22DC88057E44; Sun, 5 Nov 2023 14:32:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbjKEWcG (ORCPT + 99 others); Sun, 5 Nov 2023 17:32:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjKEWcE (ORCPT ); Sun, 5 Nov 2023 17:32:04 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6B72CF; Sun, 5 Nov 2023 14:31:57 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1cc58219376so35269555ad.1; Sun, 05 Nov 2023 14:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699223517; x=1699828317; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=6a/1tK8D+3pTldim80ICuo8nqDfb6HPfUZNmM3VgcKU=; b=fSsn2cB1nQVpXzbz6+lG5X1IfOoAzHdt/iGAcjxZ8RjMxIOHzkMWA63GpGi0OZGZKw 1sdY7LUFfDQBdSxytlRAT33+UMXG45ApGHcy83sEdH5qQWpuLEh3cuaTU9WX5bwAMbHs hsm1xTFlNzzcKdXYABSNJwN1GMZxNR0jHh9ySVIAUp4BnQUT37yKudGO1BA14Smkiy0c 9m53BlYZB80LibhO55BQq+i1XFD9vAdub10Ol+nKH9Vpla3GLBx8XJ0TuPORzHGM++rp ks3K4wK6NhlU+uFTQhafHyMKjM8Y93iOGSmwvtEvxd398E9NBXTgmbsL++UvqrDz5zwP vMOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699223517; x=1699828317; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6a/1tK8D+3pTldim80ICuo8nqDfb6HPfUZNmM3VgcKU=; b=vQK1PeEP2nwPejyLTKWhWWbeJMUUvGH/4hkhlx8axKj9bdI2a3Bxh2MeRV/5R9Q7gL WfnsQXiiiN7xKgVwarCJR2bsNjUCx0WqhM8vmK8ZS/aac1gJlewkdWHMjqiEK4JF64eC GADH7OWu9uLCBv26GrKyLLKoWZFrFrVvRr1pwieFZ4VruQiIi+xTHaW7yjNcu7xBAU9P RdDhYDRRtW8Tn7SnFFbYTslBQkphdSGlmwL0q3zzdrtwCypTUXPCUXSzA6nDK4pJyT3Y Db6zQNi3/tIQGiayhCYwK3Fl/Xxbm1TnBaA+lSOEtx3V45OPGbe67lnT4vEhhSrR/G5M ZKPQ== X-Gm-Message-State: AOJu0YwHm5LwnqbqZ8ggd2zIXwDcijW8atz0xQKQ0ouyIzhcCB0i39oN qVDtrxIKdar9XZg3lWHg0kPTDNT+Kkg= X-Received: by 2002:a17:902:f301:b0:1cc:31a8:d733 with SMTP id c1-20020a170902f30100b001cc31a8d733mr18569270ple.44.1699223517260; Sun, 05 Nov 2023 14:31:57 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id ik14-20020a170902ab0e00b001bf8779e051sm4684459plb.289.2023.11.05.14.31.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Nov 2023 14:31:56 -0800 (PST) Sender: Guenter Roeck Message-ID: <9e4d3e8e-0a38-46d9-9277-31b7f6dbd0f3@roeck-us.net> Date: Sun, 5 Nov 2023 14:31:55 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] rtc: add pcf85053a Content-Language: en-US To: Carlos Menin Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Alessandro Zummo , Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jean Delvare , Sergio Prado References: <20231103125106.78220-1-menin@carlosaurelio.net> <5451ac26-c498-4af5-b3fa-fe2265433ccc@roeck-us.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= x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7CyuFclAksOdV/sdpQnYlYcRQWOUGY HhQ5eqTRZjm9z+qQe/T0HQpmiPTqQcIaG/edgKVTUjITfA7AJMKLQHgp04Vylb+G6jocnQQX JqvvP09whbqrABEBAAHCwWUEGAECAA8CGwwFAlVcpi8FCRmg08MACgkQyx8mb86fmYHNRQ/+ J0OZsBYP4leJvQF8lx9zif+v4ZY/6C9tTcUv/KNAE5leyrD4IKbnV4PnbrVhjq861it/zRQW cFpWQszZyWRwNPWUUz7ejmm9lAwPbr8xWT4qMSA43VKQ7ZCeTQJ4TC8kjqtcbw41SjkjrcTG wF52zFO4bOWyovVAPncvV9eGA/vtnd3xEZXQiSt91kBSqK28yjxAqK/c3G6i7IX2rg6pzgqh hiH3/1qM2M/LSuqAv0Rwrt/k+pZXE+B4Ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 05 Nov 2023 14:32:23 -0800 (PST) On 11/5/23 12:17, Carlos Menin wrote: > On Fri, Nov 03, 2023 at 07:09:27AM -0700, Guenter Roeck wrote: >> On 11/3/23 05:51, Carlos Menin wrote: >>> Add support for NXP's PCF85053A RTC chip. >>> >>> Signed-off-by: Carlos Menin >>> Reviewed-by: Sergio Prado >>> --- >> >> [ ... ] >> >>> +static int pcf85053a_bvl_to_mv(unsigned int bvl) >>> +{ >>> + long mv_table[] = { >>> + 1700, >>> + 1900, >>> + 2100, >>> + 2300, >>> + 2500, >>> + 2700, >>> + 2900, >>> + 3100, >> >> How are those numbers determined ? The datasheet gives voltage ranges. >> I'd have assumed that the center of those ranges is chosen, but for the >> most part it is the maximum, except for 2900 which is a bit above center >> and 3100 for "> 3.0V". Not that I care too much, but it seems to me that >> using the center voltage for each range would be more consistent. >> > > I just used numbers that would result in the same step between levels > (200 mV) at the same time they would fit in the ranges, but I agree Ah, thanks for the explanation. Still, I find it a bit misleading. > that using the center of the ranges makes sense. In this case which > values would you suggest for <= 1.7 and > 3.0 ? > The datasheet says that the battery voltage must be between 1.55 V and 3.6 V. With that in mind, and since the next voltages would be 1800 and 2850 if you use center voltages, I'd probably use 1600 and 3100. You'd then have 1600, 1800, 2000, 2200, 2400, 2600, 2850, 3100 This gets close to using the same step size but also reflects voltages more accurately. >>> +static int pcf85053a_hwmon_register(struct device *dev, const char *name) >>> +{ >>> + struct pcf85053a *pcf85053a = dev_get_drvdata(dev); >>> + struct device *hwmon_dev; >>> + >>> + hwmon_dev = devm_hwmon_device_register_with_info(dev, name, pcf85053a, >>> + &pcf85053a_hwmon_chip_info, >>> + 0); >> >> This won't compile if CONFIG_HWMON=n or if CONFIG_RTC_DRV_PCF85053A=y and >> CONFIG_HWMON=m. >> >> Guenter >> > > I will add dependencies in the Kconfig file. > You'll also need something like IS_REACHABLE() here unless you make the driver depend on HWMON, which is probably not what you want. Thanks, Guenter