From owner-svn-src-all@freebsd.org Sun Jan 19 19:56:51 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 3D88022332F; Sun, 19 Jan 2020 19:56:51 +0000 (UTC) (envelope-from manu@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 4815D30tDnz4d8J; Sun, 19 Jan 2020 19:56:51 +0000 (UTC) (envelope-from manu@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 18E73181A4; Sun, 19 Jan 2020 19:56:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00JJuoaO008584; Sun, 19 Jan 2020 19:56:50 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00JJuoTb008583; Sun, 19 Jan 2020 19:56:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202001191956.00JJuoTb008583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sun, 19 Jan 2020 19:56:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356893 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 356893 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: Sun, 19 Jan 2020 19:56:51 -0000 Author: manu Date: Sun Jan 19 19:56:50 2020 New Revision: 356893 URL: https://svnweb.freebsd.org/changeset/base/356893 Log: rk805: Add a regnode_init method This method will set the desired voltaged based on values in the DTS. It will not enable the regulator, this is the job of either a consumer or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on. Reviewed by: mmel MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D23216 Modified: head/sys/arm64/rockchip/rk805.c Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Sun Jan 19 19:56:05 2020 (r356892) +++ head/sys/arm64/rockchip/rk805.c Sun Jan 19 19:56:50 2020 (r356893) @@ -97,6 +97,9 @@ struct rk805_softc { int nregs; }; +static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, + int max_uvolt, int *udelay); + static struct rk805_regdef rk805_regdefs[] = { { .id = RK805_DCDC1, @@ -354,7 +357,26 @@ rk805_write(device_t dev, uint8_t reg, uint8_t data) static int rk805_regnode_init(struct regnode *regnode) { - return (0); + struct rk805_reg_sc *sc; + struct regnode_std_param *param; + int rv, udelay; + + sc = regnode_get_softc(regnode); + param = regnode_get_stdparam(regnode); + if (param->min_uvolt == 0) + return (0); + + /* + * Set the regulator at the correct voltage + * Do not enable it, this is will be done either by a + * consumer or by regnode_set_constraint if boot_on is true + */ + rv = rk805_regnode_set_voltage(regnode, param->min_uvolt, + param->max_uvolt, &udelay); + if (rv != 0) + DELAY(udelay); + + return (rv); } static int