Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp168014iob; Mon, 2 May 2022 16:08:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzER7bsqozr54hkDFJCmKrcTWfAxtUCKjHritNW8NO/RqtayDfKO5rIgETa0d+6dVAZ2cnS X-Received: by 2002:a62:15c7:0:b0:50d:388d:916a with SMTP id 190-20020a6215c7000000b0050d388d916amr13372609pfv.8.1651532892899; Mon, 02 May 2022 16:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651532892; cv=none; d=google.com; s=arc-20160816; b=oUKPquWonNrG6xc6ZYXr73vJitoqjio8dRwYZ6v89cHFWYnW0e/GfgJsdMnpI5f5sR MXj1lVECwe6v66YhBQBcLtA4e898ez+3UixNKtaryeI7vqf5xS+FPMR10EanyJ4Rl+vp 1CXejB99BQF0kIEF3p1wYPfqOIgJkd2FCXsW/ULG39fxlhwmV7J//qy4+gfwa8blvofv foOzEjn+Su+3L7yGb7NKfzPn7Io7Nk0hKMnQh84Ju2BUchQq/0W2ekFZerRv4NuQmJ9d 5b8yYEFevUJYar9BHxlxuMHUbiG0FnZebN7JGIVolUVhI9jWxMzh8AkUHbW/5MBsypur UeYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qlZmn0c/jvWK0534UAZNCa2HRnIaOsGwdXqViCtPzlM=; b=w38XKkCNW6PTnO3fSRfS7a4Dq86gKsQkD8amopiIRWI10q3klLL4dMwKdvNMguTL8r KjYkt27RgVYPbjmbugHBb1Fq9G/s0HQfLzev8lfQFnB/IbwsdnpVdLqzQPpGiarXv8dg JcXBaUlNYIGLQj6oQF1GJZLTFFD6sSXuiZpzPsOkxbzBxjvmRwFT63USHtMHBXwLKgVJ xz0n9EBR/CUkjKoSZmDUOABBvUVcN2HI+ysZBODKrsdcv1hsYwxBUwjipFpa8VJHI/WX nApBMx+ds7gp10+6njrPfZf6fPrPLdvFEoJR/77gPIiuULPmx+zWGIHXilRuMqWRYUkr PauA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mIQJGI+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d15-20020a621d0f000000b004fdb5bf7840si14427964pfd.138.2022.05.02.16.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mIQJGI+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AF1C62F002; Mon, 2 May 2022 16:08:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352977AbiEARYB (ORCPT + 99 others); Sun, 1 May 2022 13:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352805AbiEARXo (ORCPT ); Sun, 1 May 2022 13:23:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE7E614E; Sun, 1 May 2022 10:20:17 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5377A60F55; Sun, 1 May 2022 17:20:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8364DC385B0; Sun, 1 May 2022 17:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651425616; bh=tHHxRDQDtWRjj5+yflIBb+axcnk5v0Qd22de8ghVlbc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mIQJGI+scSXSB7jbTDKA+XP5efWhavRxTmsYxijmpkMDUhQQNLlwMF/ZZuNl2dq2j bFLkg+1hnJXjFvLRlL1UM5A/eljwuz7wKoYqi2TVde33gGC/SF0Leq13qLnpKbllQZ /kuDeBnMFXcQuvhve+t/eP4pizEnB9Z9WFg+bGwTLwwWMQbSYs7SBHLTswVz+GUkqx JG8jHHN6tsqiNDHk2g2KNbMEq8SuZqLefoBPpf99XZtPrAVDa2rvuaJUmwdnT+/2Ll 9XVeElLkssH0QKWLk6Mob0jj7gBh3DRB6Wp2nR6v2f4PdrVMbB8E5dq7/jkyzRxUm/ 78tUH/1KLR3QQ== Date: Sun, 1 May 2022 18:28:29 +0100 From: Jonathan Cameron To: Caleb Connolly Cc: Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Lee Jones , Stephen Boyd , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Jami Kettunen , Sumit Semwal , Dmitry Baryshkov Subject: Re: [PATCH v14 02/10] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Message-ID: <20220501182829.1edc181f@jic23-huawei> In-Reply-To: <20220429220904.137297-3-caleb.connolly@linaro.org> References: <20220429220904.137297-1-caleb.connolly@linaro.org> <20220429220904.137297-3-caleb.connolly@linaro.org> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Fri, 29 Apr 2022 23:08:57 +0100 Caleb Connolly wrote: > Some PMIC functions such as the RRADC need to be aware of the PMIC > chip revision information to implement errata or otherwise adjust > behaviour, export the PMIC information to enable this. > > This is specifically required to enable the RRADC to adjust > coefficients based on which chip fab the PMIC was produced in, > this can vary per unique device and therefore has to be read at > runtime. > > Signed-off-by: Caleb Connolly > Reviewed-by: Dmitry Baryshkov > Tested-by: Dmitry Baryshkov ... > +/** > + * qcom_pmic_get() - Get a pointer to the base PMIC device > + * > + * This function takes a struct device for a driver which is a child of a PMIC. > + * And locates the PMIC revision information for it. > + * > + * @dev: the pmic function device > + * @return: the struct qcom_spmi_pmic* pointer associated with the function device > + */ > +inline const struct qcom_spmi_pmic *qcom_pmic_get(struct device *dev) > +{ > + struct spmi_device *sdev; > + struct qcom_spmi_dev *spmi; > + > + /* > + * Make sure the device is actually a child of a PMIC > + */ > + if (!of_match_device(pmic_spmi_id_table, dev->parent)) > + return ERR_PTR(-EINVAL); > + > + sdev = qcom_pmic_get_base_usid(dev->parent); > > - if (subtype == PM8110_SUBTYPE) > - minor = rev2; > + if (IS_ERR(sdev)) > + return ERR_CAST(sdev); > > - dev_dbg(dev, "%x: %s v%d.%d\n", subtype, name, major, minor); > + spmi = (struct qcom_spmi_dev *)dev_get_drvdata(&sdev->dev); Shouldn't need the cast as dev_get_drvdata() returns void * and you can implicitly cast that to any other pointer type. If this is all that comes up in the series I can fixup whilst applying. Jonathan > + > + return &spmi->pmic; > } > +EXPORT_SYMBOL(qcom_pmic_get); >