Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp698890iog; Mon, 13 Jun 2022 10:55:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD/kRTbEm+fxYcfYEv1gl9Dc11mxBZSDkiRc7+v2UEDIbVjU+cNWDecvWIU74hr7xK4Y11 X-Received: by 2002:a05:6402:3459:b0:431:9d03:a1b8 with SMTP id l25-20020a056402345900b004319d03a1b8mr1045698edc.352.1655142931695; Mon, 13 Jun 2022 10:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655142931; cv=none; d=google.com; s=arc-20160816; b=b7yFbxQVxr14wHo+qTMSmkv5C8vEP1MShUP/cUoX03RR36ir5ssLY9gIg0sjfkNW7h eLFf3wsfCt4o3dyLbCjarYVCkADbUHO6PumlyAq0hy7aRgGw1TLhzWHaUX2xsNhfn5JB Y3INWKpYKfCrvwCV2t09XQaeX2z6fAemRISO9sO2jOCNyCItKvTNWG0WfTYnKqG4wD5e kTghajMxNm5bPYig/tWf52lgWYMOWewER4UILJisOYVV5O1xCxAkVmbMkmnrfXuK9HGq UOYqkNubL2JILhPF+lGrd/lkAOJx/Z5YlTgpAmIUMaSAbHE78IEcxZPHlQ8MKQwbInb7 Az0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QP4fRC9IGTnk3usNuNaUxfLdrf1SnSjxaxiBNRdB06Q=; b=a7oSLJckkY2u3YhFmMZFBBu0ycc0g8i6Y1J/D+ICShg7ikc0TafOAOt6eYG0zqY5Er 1QRYNqbxgQuZCrtu4UjFO2d48cDRDBUifWLXXXwHogU5okgmoBWN+zyyO+hPO1qaQjwa mNTqlcCmBsomiCMs7qe8SrBef6x7+XrH2Z8Txa2MpvO5KxkTbZN13uafJUy+8Bun1n7o TkWaBYJ3PkXRWkwquSfW9E4oS71G+HJ+hbqR7J/Qu8x8vnT/oSyQIujFJqjOgnkLJ+XX wwJ6OxAtB7gerrlM26PoSjcljzufRtCK/+Wptd9TwlvA1qB+HQQ2HL8ETLFdbCkapn+D sKrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lst8DXId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g23-20020a50d0d7000000b0042e1a76680asi8646356edf.394.2022.06.13.10.55.06; Mon, 13 Jun 2022 10:55:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lst8DXId; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242473AbiFMRmO (ORCPT + 99 others); Mon, 13 Jun 2022 13:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242422AbiFMRiS (ORCPT ); Mon, 13 Jun 2022 13:38:18 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA6A147806; Mon, 13 Jun 2022 06:04:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7D025CE12AA; Mon, 13 Jun 2022 13:04:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A976FC3411B; Mon, 13 Jun 2022 13:04:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655125463; bh=tmW0UzmHilil9D6WRtZVvd2rIwKzTWLw3Xx3woeOXfk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lst8DXIdPr227QBx0vTZihAbIrVqyBL3NazUG+oAGYXZwApYXtW/A2YMtMh2hs4pw 7KFctvuzd2Up7KRd7/WMHg5QU1m0D96g+Q9VOcD8vskYiRvSjCoNI7Bt4xFmUGesXf XWUUO9Jdl9NrQ3n5yU8yfAMrpgr1OtUNKSu6HdTohZR63XZRC+8+WtLtiXq3zc4WB4 DWwB5crbHOeEJjMuaoB2S7A0nM+KbcYVNFi3TG0Sb5ebh7Z5Ib3QN2xhqfeQQp22FX ObB4rxnrMH0R2VsmSPU34+yMkYHFMbu38x5enMDNe3pnmaEWMxs+oc6OJzvzkZsT05 QHU98r2GypYDA== Date: Mon, 13 Jun 2022 14:04:17 +0100 From: Mark Brown To: Jerome NEANNE Cc: lgirdwood@gmail.com, robh+dt@kernel.org, nm@ti.com, kristo@kernel.org, will@kernel.org, lee.jones@linaro.org, khilman@baylibre.com, narmstrong@baylibre.com, msp@baylibre.com, j-keerthy@ti.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 3/5] regulator: drivers: Add TI TPS65219 PMIC regulators support Message-ID: References: <20220613090604.9975-1-jneanne@baylibre.com> <20220613090604.9975-4-jneanne@baylibre.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IopxgiwGnKTD/lJ2" Content-Disposition: inline In-Reply-To: <20220613090604.9975-4-jneanne@baylibre.com> X-Cookie: innovate, v.: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IopxgiwGnKTD/lJ2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 13, 2022 at 11:06:02AM +0200, Jerome NEANNE wrote: > +static int tps65219_pmic_enable(struct regulator_dev *dev) > +{ > + struct tps65219 *tps = rdev_get_drvdata(dev); > + int rid = rdev_get_id(dev); > + int ret; > + > + > + Lots of random blank space here. > + if (rid < TPS65219_BUCK_1 || rid > TPS65219_LDO_4) > + return -EINVAL; > + If a regulator doesn't support an operation it shouldn't be providing it, no need to check here. > + ret = tps65219_set_bits(tps, dev->desc->enable_reg, > + dev->desc->enable_mask, dev->desc->enable_mask); If you provide the regmap to the child devices then this can use the standard regmap helpers for most of the operations, meaning most of the operations in the driver can be removed. > +/* generic regulator_set_bypass_regmap does not match requirements use custom instead */ In what way? Please also try to keep within 80 columns normally. > + if (dev->desc->ops->is_enabled) { > + dev_err(tps->dev, "%s LDO%d is enabled, should be shut down to set bypass ", > + __func__, rid); > + return -EBUSY; > + } This is testing if there is an enable operation, not if the regulator is enabled. > + if (enable) { > + dev_dbg(tps->dev, "%s, LDO%d already in bypass mode", __func__, rid); > + return ret; > + } This is not a problem, just silently succeed. > + /* Allocate memory for strobes */ > + tps->strobes = devm_kcalloc(&pdev->dev, > + TPS65219_NUM_REGULATOR, sizeof(u8), > + GFP_KERNEL); > + if (!tps->strobes) > + return -ENOMEM; These are never referenced anywhere else in the driver, no need to allocate them. > + ret = regmap_read(tps->regmap, regulators[i].bypass_reg, &val); > + if (ret) { > + dev_err(tps->dev, "dev_err failed to map register for %s regulator\n", > + pdev->name); > + return ret; > + } I'm not clear what this check is intended to do, it at least needs to be better documented. --IopxgiwGnKTD/lJ2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKnNdAACgkQJNaLcl1U h9A3Rgf/XIyREPO3yKKsbHdyoXb7PZDaVPf9DpPKX/8m3fwGRc3Ba/JNM7lPLYzN vJOIYiyr/rFe/LAZckSMBhJo1d316Bmy0HlAMOHyzMWEjvD7iTLuQ/0G+BjNoK6J v1yEvj+bTtQ26oN3/4liVPkJNA4QBJsRR63eb9RUyOw6QESZyn2rUT23VUY2COTY SR4555QxcCsz9RnQiREp+reE6ImqQSkkbsaIzC5+9ch7olWmopmYOdJE1C/lpk4G z4Cz/BPfEZmxwi5RPS3gAlAjETKuBo4EyR4MlKTKsLLB8/1nvvwZNr1Pb4idKi5v tyQHzosfLSFm/jUGZjaTH0XjlNPUFA== =GrWr -----END PGP SIGNATURE----- --IopxgiwGnKTD/lJ2--