Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp423288ybt; Wed, 17 Jun 2020 04:45:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7yU4lE8sKSNJJgK/EXT6JiYM25zbChtcf5UtcgjD6YK9S+Cj8ujl77mIaZJ6LIJG4wFQN X-Received: by 2002:a17:906:899:: with SMTP id n25mr6641142eje.298.1592394327289; Wed, 17 Jun 2020 04:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592394327; cv=none; d=google.com; s=arc-20160816; b=B+B4W2qXy4IK25vIIpqMdj1RMX6VpzXkyDys/+ojsmzw/t4NCs4F0Hl0SchO8vVYyk dnUiekFYqz/apFE/mDtezo5znQDFw8cokSV7AOdVfjDu61H8QTVoFNYOBucnuyIsGJ5t d7s5pTUz8MqG4ZiYFIev7RfZ7dCZe5ilN+vcM5zvlIy/CqNQbdZw+Cr3PiwteF8uT/S2 XQs77071uoedeK4E47FVU2GcsJNvK/ZVrxua9zF7VO9SCODEabP8jOwPzNFfvMrSEAHb vNwJJgqZHyv0LSuTuFDCZsPpBgO7KU1dvt/t+/XbxXoMRKA4q1TyvRWlZ2ansCoiblgj 8QPA== 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=sKWtFIYfKFOwpbzZCQAzRyePUOEgW5s9rDZzhxjhDfs=; b=vQcBjWWYi4nwOrsJlBCRpLrQz1AiLyfPStndehwijSKqIap/fLqLO8KQImOnR2HJ/4 SgOukV1cmi08y9OUuE3jd4ONjMLjKyGm8RgOkNhga90+FwiQvLCixLWoWq6RQyudSaa4 rEGi0TOQEYAcVElKCOXGxGKnNiTFugfECWgFODq5Ewz9YxYyj4gsvhg29drWZcaATmZL ETaFUAaAO5cwnRSfaJEpIz8lDQ8pchy7HpqarGGXyTcwxAge3RcGaT4r1GQr+4c5W3Tb ep5I8YzlzACqTfB2IytbvBmKNjjhkXjegouhI5CADFxyFr5XkY8vy3fkJKaDsiwAiYKi B+2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HRikB7fK; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si7396051edy.143.2020.06.17.04.45.04; Wed, 17 Jun 2020 04:45:27 -0700 (PDT) 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=@linaro.org header.s=google header.b=HRikB7fK; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726282AbgFQLmu (ORCPT + 99 others); Wed, 17 Jun 2020 07:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbgFQLmt (ORCPT ); Wed, 17 Jun 2020 07:42:49 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C5DC06174E for ; Wed, 17 Jun 2020 04:42:47 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id k15so1336986otp.8 for ; Wed, 17 Jun 2020 04:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sKWtFIYfKFOwpbzZCQAzRyePUOEgW5s9rDZzhxjhDfs=; b=HRikB7fKxjKifECDakHvZhGhna07GnY3Vo+B+n4UD42jyVrmgGAEnpY33CQV88Z62X 0udVcVTTcJXD3fta2FIoFmWcBlryJUq8A18kNMdYsAS3qdCPCVuXQO1FbijWHQJik08d 24RVBLLRVqJb+fwxyGxVmgQ5LRItdP4RDe5Qm0dW/6slkJAONs7YsU9wt5By3TyykOCW jEw5GpBE73V4yFwVtHYdQiZLl39g4lYRBcNYc9p6qovoZe4KINyHYBMt1UwESvsCNtKL +H7LYzsmp7NiURlkLx8i59a/vNsC2shRxVOCuoNlRhKHPzoYaMld8PK+FiIwYvqyGUF7 NM5Q== 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=sKWtFIYfKFOwpbzZCQAzRyePUOEgW5s9rDZzhxjhDfs=; b=b3k1i9d33/vBgB5hJI/L1Vk6ymMcQLcSz9qlML/6St2CbioFtcSfNzo2NzPPdpLM2I WGzV7GF5B629csCrFNoiM4ZGAFaYwdz5KOyhcRBgMUJmhwCugJhBDXq0ySixANHctJuC A4S3nB0sPVrzQACkBcyk3Sj7lOizG6yZaHfG3hlU5S01bOcUxMkAuhB8tg78wc63QB47 EqPmCWMA823DbZazpqPE/MDplSYmYWw79zll1b04DbTOHJ4BavtzXMc9MHlk6p2sadhM Es7PGL95Vzjfpm2NVn+9Oy8pkw111gewWcVoVw2bOjAYyRmfYpiJp60pK298h2I0RMXd RfQA== X-Gm-Message-State: AOAM531qUKiECZlc9OdIKtaxNqSxr4rJwRXQh5UGBt6nlKA/MsnlETsq AgC2HgVXh+bPX2iDTv4YADJZeVwec2fhM30VQBee9w== X-Received: by 2002:a9d:6a85:: with SMTP id l5mr5361623otq.371.1592394167036; Wed, 17 Jun 2020 04:42:47 -0700 (PDT) MIME-Version: 1.0 References: <20200602100924.26256-1-sumit.semwal@linaro.org> <20200602100924.26256-5-sumit.semwal@linaro.org> <20200602113241.GE5684@sirena.org.uk> <20200602122554.GG5684@sirena.org.uk> In-Reply-To: <20200602122554.GG5684@sirena.org.uk> From: Sumit Semwal Date: Wed, 17 Jun 2020 17:12:35 +0530 Message-ID: Subject: Re: [PATCH v4 4/5] regulator: qcom: Add labibb driver To: Mark Brown Cc: agross@kernel.org, Bjorn Andersson , lgirdwood@gmail.com, robh+dt@kernel.org, Nisha Kumari , linux-arm-msm@vger.kernel.org, LKML , devicetree@vger.kernel.org, kgunda@codeaurora.org, Rajendra Nayak 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 Hello Mark, On Tue, 2 Jun 2020 at 17:55, Mark Brown wrote: > > On Tue, Jun 02, 2020 at 05:40:45PM +0530, Sumit Semwal wrote: > > On Tue, 2 Jun 2020 at 17:02, Mark Brown wrote: > > > On Tue, Jun 02, 2020 at 03:39:23PM +0530, Sumit Semwal wrote: > > > > This should be a get_status() callback... > > > From my (limited) understanding of downstream code, it seemed like for > > this set of regulators, the 'enabled' check is done via the > > 'REG_LABIBB_STATUS1 reg; for some reason, not via the same enable_reg > > / enable_mask ones. That's why I used it as is_enabled() callback. > > I will try and check with the QC folks to clarify this point about > > their hardware. > > The way this is functioning at the minute the downstream code is just > buggy. Apologies for the delay in responding - I pinged the QC folks, and was waiting for their reply but haven't got any response so far. I tried your suggestion to use the ENABLE_CTL register for checking if the regulator is actually enabled. In my limited testing on the Poco, it seems like the STATUS1 register updates faster than the ENABLE_CTL register, so on the device, I see noticeable lag when I use ENABLE_CTL for is_enabled() check. [This is especially true for the IBB, which takes longer to become usable than the LAB regulator.] I understand from a pure regulators' correctness point of view, ENABLE_CTL should be the one checked there, so I can change the patch as you suggested, but there seems to be some performance penalty there. > > > > ...is_enabled() should just be regulator_is_enabled_regmap() and these > > > functions should just be removed entirely, you can use the regmap > > > operations directly as the ops without the wrapper. > > > The 2 wrappers are a precursor to the next patch, where we keep track > > of regulator's enable status to check during SC handling. > > Add the functions when they're useful, not before. TBH if the register > is write only you're probably better off adding a register cache. Agreed, I will remove the wrappers from here, using the regmap functions, and add the wrappers with the SC handling patch. > > > > > + match = of_match_device(qcom_labibb_match, &pdev->dev); > > > > + if (!match) > > > > + return -ENODEV; > > > > + > > > > + for (reg_data = match->data; reg_data->name; reg_data++) { > > > > + child = of_get_child_by_name(pdev->dev.of_node, reg_data->name); > > > > + > > > > + if (WARN_ON(child == NULL)) > > > > + return -EINVAL; > > > > > > This feels like the DT bindings are confused - why do we need to search > > > like this? > > > The WARN_ON? This was suggested by Bjorn to catch the case where the > > DT binding for a PMIC instantiates only one of the regulators. > > No, this whole loop - why this whole match and get child stuff? This loop mechanism is what I saw in the other qcom regulators upstream, so thought it was an acceptable way. For the two children nodes, do you recommend another mechanism to get and validate both nodes? Best, Sumit.