Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1644234pxb; Sat, 23 Jan 2021 00:37:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJy53GO6nbxMzDXnhCPYqP01jIDE0BJCsTgrGu3adv0g3fEtsT/E1CQ3mWBddec1VwHSvoPm X-Received: by 2002:a50:ec05:: with SMTP id g5mr6177997edr.182.1611391022414; Sat, 23 Jan 2021 00:37:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611391022; cv=none; d=google.com; s=arc-20160816; b=LqNNx1DmRvN2RfiqnUTPSNEsKIPOa/htPDCEtftQEoevPvJWmJIPDlBIZ43bVWLtp/ payaHpCRYrQ6061HsERir7l7j1t7hBFABGZMzlY+2mEbLma6X8/rBXRmr5cg3KH6rWt1 zGYTkW5WpaHkUgAHAv/l0dgFoeYNknynCAeGe9+zT7VxA07ye7yttcxXV/f80IWFosx7 DECjc7rkmMs4TniPlcae+SXTtPCo0QZgvvxgH/vnvzPZ5TiD7hQDWVyZqEOV9hpgzVHR DfixTiUrqNMC8CjS2ZtDvLcgZRZ9IM1XktEvodqTPBJHP1vicbdeX1w1wTuYLX1OMrap yp4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=S6S1XUbpw3sWz7PK1At9O27hDXZ4W5lBRqtANOwgjMg=; b=Qg+JwEDSvBRGgPzU+Zj0eG+bBVpfKQ+4aNPUBBm6rASeKrazQ1GNtW8hMVAG6A20/F FWC75Ham6WSiAMJb/NvL2GR+dxJCPvOjzYElmkgH8CAFSaLDX+GYf0GYFsPJ6zoyRBv7 92qg4vyeuoOzM1iyjO2AQkmZ62kC4gzHGDKFPN7pGqtleH3/e4E/99DVw9vzr5ekO66c cPad4MENF0Rf7icYA/j2iMwUGBeD6C6CBH5fVw+6L/CV1vLBg8mVjZ0Yt0PChNpfZBcH /+VGMkVPP/P9qd6fhis2ZjeNLgic84z+z0i+N6/5g5JNtF4sbT1h4nB/Fe5/WhWPI/Yf wYCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s+5D3eXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx11si3915398ejb.357.2021.01.23.00.36.38; Sat, 23 Jan 2021 00:37:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s+5D3eXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726592AbhAWIfz (ORCPT + 99 others); Sat, 23 Jan 2021 03:35:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbhAWIfw (ORCPT ); Sat, 23 Jan 2021 03:35:52 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCE5C06174A; Sat, 23 Jan 2021 00:35:11 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id q1so16195096ion.8; Sat, 23 Jan 2021 00:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S6S1XUbpw3sWz7PK1At9O27hDXZ4W5lBRqtANOwgjMg=; b=s+5D3eXqnSvljv1ptw/fN2geCT5dzJJXlUh/4TKf71d8gh+skSUSU9iXCastD8SNsv dsVtMvYRBSawQzzFURmXpL22zwRqTyvP7qf0QeQpPY7tUmec5VIwohyENlObvnhC56Zd 5Mmt/fUl/EyH1Nx78oohQuxyj8lYXfp83yI5oxQqV+ZLdmkePcAFTtm9qGzWlcR3bkuu Rn7d6mWkNGXpzhtbQ4wl9PtBv11vqW0eyih/p5ZiufHMdSozRUOjJHJQ1y6/+3+BRJzP V8SusR6Y6NBghdSeiFe7UdWz3DxpdNRHU1BxXQ/Xw8Z0h4bMn2X4Kc18P6EXai6ST/gu VDdA== 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=S6S1XUbpw3sWz7PK1At9O27hDXZ4W5lBRqtANOwgjMg=; b=O3qGUviSJJ3mHLIorptCQMfKRiIcUxibsxDiL4JXZNvmAD26x/ziawBf8G0WJ2Xq+E HIvhSCx1T/lgnsWpSPRJkXUU5FRvPGAvFEN4jVgSd8Nvg38LNMa00/MinTZHEmkOGscs SG7xd4rm1DL2m0nx7rWxs2mYm2lJcOeCGG0kzu9H8ekNyqZFsFBBn/QVHX+QQ/ksaNEE OFyzFnrctl7+xSf2NaBu4BpyOLzUDMhba3PD8Bbl1i1tPCimmgyzkKjK3fYvRH56aI+m XSy5MSMJqt6lOcRiwsWsnT6+R+tujTjOnGGgADDcz5xJ32E05TX1NSuvjUP8EAJxcMRT YPxw== X-Gm-Message-State: AOAM531nF0DFyEjPX0JmLRWsvyZDrelH3Dj+M3V2pIU86y7PNf7sktXK 5cPYxD6NaZOOiJLk+hSZiM2zZO+lpFHlKc0K1sg= X-Received: by 2002:a6b:7d42:: with SMTP id d2mr6124418ioq.176.1611390910963; Sat, 23 Jan 2021 00:35:10 -0800 (PST) MIME-Version: 1.0 References: <20210117042539.1609-1-alistair@alistair23.me> <20210117042539.1609-4-alistair@alistair23.me> <20210118123158.GE4455@sirena.org.uk> <20210122133718.GB6391@sirena.org.uk> In-Reply-To: <20210122133718.GB6391@sirena.org.uk> From: Alistair Francis Date: Sat, 23 Jan 2021 00:34:44 -0800 Message-ID: Subject: Re: [PATCH 4/6] regulator: Initial commit of sy7636a To: Mark Brown Cc: Alistair Francis , Lee Jones , Rob Herring , lgirdwood@gmail.com, dl-linux-imx , Sascha Hauer , devicetree , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22, 2021 at 5:37 AM Mark Brown wrote: > > On Thu, Jan 21, 2021 at 10:24:10PM -0800, Alistair Francis wrote: > > On Mon, Jan 18, 2021 at 4:32 AM Mark Brown wrote: > > > On Sat, Jan 16, 2021 at 08:25:37PM -0800, Alistair Francis wrote: > > > > > +static int get_vcom_voltage_op(struct regulator_dev *rdev) > > > > +{ > > > > + int ret = get_vcom_voltage_mv(rdev->regmap); > > > > + > > > > Why is this get_vcom_voltage_mv() function not in the regulator driver, > > > and why is it not just inline here? It also needs namespacing. > > > I'm not sure what you mean, can you please explain? > > This is a wrapper for a function that has exactly one caller but is not > only a separate function but also in the MFD header, part of a separate > driver. This seems at best pointless. Ah I see. I think I have fixed this. > > > > Why do you need this delay here, and what purpose is this lock intended > > > The delay is to allow a power ramp up, I have added a comment. > > Use the standard ramp_delay, don't open code it. > > > > > +static int sy7636a_regulator_suspend(struct device *dev) > > > > +{ > > > > + int ret; > > > > + struct sy7636a *sy7636a = dev_get_drvdata(dev->parent); > > > > + > > > > + ret = get_vcom_voltage_mv(sy7636a->regmap); > > > > + > > > > + if (ret > 0) > > > > + sy7636a->vcom = (unsigned int)ret; > > > > + > > > > + return 0; > > > > +} > > > > What's going on here, and if you are going to store this value over > > > suspend why not store it in a variable of the correct type? In general > > > It is part of the vendor's kernel, they specifically added it to > > ensure vcom is set on resume. > > "I copied this from the vendor" isn't really a great explanation... If > the device is likely to get completely powered off and loosing settings > then presumably the entire register map, not just this one value, needs > to be saved and restored instead of just this one value. If that is the > case it's probably best to use a register cache and just resync it on > resume. Good point. I don't have a good answer so I have removed the suspend/resume part. I'll have to investigate in the future if/why this is required. Alistair