Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1390895ybd; Wed, 26 Jun 2019 17:00:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyO1lHr5HqWKaXbYrgDVnuzU3C5aUMUFtnt50HoX5JaKXW/IZr7CdLL/L1NwX7bVXzGemhd X-Received: by 2002:a17:90a:1d8:: with SMTP id 24mr2245130pjd.70.1561593629223; Wed, 26 Jun 2019 17:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561593629; cv=none; d=google.com; s=arc-20160816; b=PpPvAVqL6TJu4yKwHTBLn78OMqf6yXof5OhdjQ3DVM4OHJcTxKsu+mmyfOn9vwl8b9 w/xipVpqumhDGDBwcL8vMSt5G/vTRcZWBNgxGVed21JmntlZH7Z/Se0qiDZb8qcG87Hm DNqCLna8nSW9Bv+wT2pPVUFciSqZ01jijifDB7PABgwepPAUqA+oy5bAAx3MWIVM+ygn i0Na7lOUkBw0Xcpbn3tmRewwTMnHpHo1u/bwLelGt9aFnmltrOMR3v/HeDy8tavdWreU 4izfEDGWCFB4v/8I3I8S2MONaSohMYdOiaQ91yf/KeYuX2pBfroCZxFb2oGH2CH4JepD HMrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qgWBuqzxaFAQK/FVOErV8KvjirWmmsySw/PKmrxAmeo=; b=iO9/2hNi3A8XWZpNdXsxuoPIzinC5srFnBUriee/HbCydkjEwa/6vJQlTrUtxIKZLk RMDdEa1nHFwbNhPakYaT45R9liggTHVGmCLM9jnkH4XxYLinAePco1TIboRbbqaHnvpQ R2e9MOLB9D9M0LZQHRi7hZejlQE/QZJaNMujmx2+CjzrlAB6BS73I9LYsZQHP/zGBpBb zfHk7DGSmE5aUrX1P8Y5QIDjOae7+1fIQ6cUeFDBKjp126W9s83IVAsqmUYF4iPok1rF o4aF9rWfPRrEykSqGTwzJj6t3BXYTrjGGOujoFFFVMslfdHOQLTYInR6MNyHSgTuyTah NR6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=Q+QEOYsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si636724pfk.201.2019.06.26.17.00.13; Wed, 26 Jun 2019 17:00:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=Q+QEOYsh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbfFZX6f (ORCPT + 99 others); Wed, 26 Jun 2019 19:58:35 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:37830 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbfFZX6f (ORCPT ); Wed, 26 Jun 2019 19:58:35 -0400 Received: by mail-qt1-f195.google.com with SMTP id y57so559151qtk.4 for ; Wed, 26 Jun 2019 16:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qgWBuqzxaFAQK/FVOErV8KvjirWmmsySw/PKmrxAmeo=; b=Q+QEOYshpEmibbJUJT4fHh7GJi5tuodRocxnmajC3x+24kWpL3xwppzIjWBXBfeqie VV6FcuQjkYqL+1RfmUlR76Hs0n+096RHHaZBZOaLkdHASE7adAfT3tG2VYhwcdgiWQRX 1Npb1UpldNlocpga7yeiyzU0mPYkDk1OoF91B2y58BQN9tOTDZpo++2pLs/HxtPn+Wc+ /Y58Qook4qToF+0f3tgJD3GTlb0ciqhkRPACHi1mrvQnXPfDKsyzzYF0lVcrOswfkTtI qqomkqLQcdteeoIml5DVHgHPLh46IKYRZYfAvwjE6kT8AQkFAO2KhPOzGQXVcHG4beAU YjVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qgWBuqzxaFAQK/FVOErV8KvjirWmmsySw/PKmrxAmeo=; b=f8M9KdLkj56VTfuv7LQpvmhQZBJUiOesQ9Si+8TqFrUt6XFX2XO1qT0ypkaDcrmIju FBn9DQDWrmy0JekvT1rnSZaWLGrCuWt3MMa7UHQk5H6fD1rv1wCZSECFHsOC+yiLa/Wj RCIxmiScpepBqT0NaKUZTzFsZfZYafKT3fHblTvQSaat/nOQ7cc2f5i0Gjf+8V99CqBs Dwe1Z1GyNiUrvymB4zn3SHwwnyUudHc1OnKo6BD1ApWHeKv/vwicgweKM2pKE5wTt70S 7FQO4IIwZ+ZHBptoAjdzQs/ZDrKIdK5zrLrrN/ikUsfWQj2qH+QgSbtXG1tcfPRHpvw+ 0QZg== X-Gm-Message-State: APjAAAVox8LwCo79l2F4ppbu9Kbls84Qacep22JLEmZbYgjWmX/5BZhM oigivekqLVkF0lH5xVDNZrtEeYMpE8t0+lC9jGevCA== X-Received: by 2002:ac8:270e:: with SMTP id g14mr567929qtg.65.1561593514470; Wed, 26 Jun 2019 16:58:34 -0700 (PDT) MIME-Version: 1.0 References: <20190626132632.32629-1-axel.lin@ingics.com> <20190626132632.32629-2-axel.lin@ingics.com> In-Reply-To: From: Axel Lin Date: Thu, 27 Jun 2019 07:58:23 +0800 Message-ID: Subject: Re: [RFT][PATCH 2/2] regulator: lm363x: Fix n_voltages setting for lm36274 To: Dan Murphy Cc: Mark Brown , Liam Girdwood , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > With your current code where LM36274_LDO_VSEL_MAX and n_voltages is 0x34, > > the maximum voltage will become 400000 + 50000 * 0x34 = 6.6V which > > does not match the datasheet. > > Not sure how you get 6.6v the LDO max is 6.5v. > > After 0x32->0x7f maps to 6.5v > > 000000 = 4 V > 000001 = 4.05 V > : > 011110 = 5.5 V (Default) > : > 110010 = 6.5 V > > 110011 to 111111 map to 6.5 V <- Should never see 6.6v from LDO > > Page 7 of the Datasheet says range is 4v->6.5v Hi Dan, The device indeed can only support up to 6.5V, the point is you are using linear equation to calculate the voltage of each selecter. In your current code: #define LM36274_LDO_VSEL_MAX 0x34 (and it's .n_voltages) So it supports selector 0 ... 0x33. For selector 0x33 in the linear equation is 4000000 + 50000 * 51 = 6550000 (i.e. 6.55V) i.e. The device actually only support up to 6.5V but the driver reports it support up to 6.55V because regulator_list_voltage() will return 6.55V for selector 0x33. (I have off-by-one in my previous reply because when .n_voltages is 0x34, it supports up to 0x33) Regards, AXel