From owner-svn-src-all@freebsd.org Wed Apr 29 13:45:21 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B32AD2B4EEF; Wed, 29 Apr 2020 13:45:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C0Bn4J9zz4DmR; Wed, 29 Apr 2020 13:45:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EC4D65C9; Wed, 29 Apr 2020 13:45:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TDjLWJ019339; Wed, 29 Apr 2020 13:45:21 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TDjLwQ019338; Wed, 29 Apr 2020 13:45:21 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291345.03TDjLwQ019338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 13:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360462 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 360462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 13:45:21 -0000 Author: mmel Date: Wed Apr 29 13:45:21 2020 New Revision: 360462 URL: https://svnweb.freebsd.org/changeset/base/360462 Log: Don't try to re-initialize already preseted regulator. Don't set initial voltage for regulators having their voltage already in allowed range. As side effect of this change, we don't try to set initial voltage for fixed voltage regulators - these don't have impemented voltage set method so their initialization has always failed. MFC after: 3 weeks Modified: head/sys/arm64/rockchip/rk805.c Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Wed Apr 29 13:43:15 2020 (r360461) +++ head/sys/arm64/rockchip/rk805.c Wed Apr 29 13:45:21 2020 (r360462) @@ -105,6 +105,7 @@ struct rk805_softc { static int rk805_regnode_status(struct regnode *regnode, int *status); static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay); +static int rk805_regnode_get_voltage(struct regnode *regnode, int *uvolt); static struct rk805_regdef rk805_regdefs[] = { { @@ -366,13 +367,21 @@ rk805_regnode_init(struct regnode *regnode) { struct rk805_reg_sc *sc; struct regnode_std_param *param; - int rv, udelay, status; + int rv, udelay, uvolt, status; sc = regnode_get_softc(regnode); + dprintf(sc, "Regulator %s init called\n", sc->def->name); param = regnode_get_stdparam(regnode); if (param->min_uvolt == 0) return (0); + /* Check that the regulator is preset to the correct voltage */ + rv = rk805_regnode_get_voltage(regnode, &uvolt); + if (rv != 0) + return(rv); + + if (uvolt >= param->min_uvolt && uvolt <= param->max_uvolt) + return(0); /* * Set the regulator at the correct voltage if it is not enabled. * Do not enable it, this is will be done either by a