Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1662022rwd; Thu, 25 May 2023 16:25:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ776WmFIjDFJvBuyjDmPDZWTpvWeWP9kUOxUalz++zXc7QWGMxc/1q9jQC31zcOXkE1I+cX X-Received: by 2002:a17:902:da8b:b0:1af:de3d:bbe3 with SMTP id j11-20020a170902da8b00b001afde3dbbe3mr440076plx.26.1685057149389; Thu, 25 May 2023 16:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685057149; cv=none; d=google.com; s=arc-20160816; b=sDQ6iek6JEe8ZfhulX/JWUgo+j3W8Ku7MYCHeLLiK7PK3DliK7gTrjhoCnVhudyHLF zNlTeq0ONYnHSTa7evdBNTEbObdUXQFccgU6kPPkb5kS/cW+cFoc5hBWIE3QbvizpjqY EJQewBfTwtPdflFjVROP6j6kS14jvTwipkY9p5GvwBytAG1FY+nWO2d0sCSemN8rjpOb nxbuvvFLcyAQ2FKw0WnCUNfDWJufjKZEeFzSZLBm6zisMz5KTCr9bPymA9x5O5QJBL2O ijb04kc7I3fkZUlDNlAPDQqHWoefLSd7ebTTISdcHRJKSd5Vx8FfPEy+FBmE1xgvA5Dp YTlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=nVpMlft04baQe3FGBQ1uPFAK60NKjDWRg8PgqN8ZkKs=; b=tzDcbLsdlc+eP3rZpfIhttgBaKh4878M1OQeqfQiZqf+oVh3MjkMo19Xyyg5wCI4Ah xFd9G/OQrqOOy/+0pjL86988M3NMC4b0s3H8oGKP4QhrWAa6U0QP0sNKCHLdT+VA2xd5 +Uiap/XG2QrZEKAOamFBDUYz5q5Tfbm7HthM0P3VEG4sCj8a5KXurBtn4yiujdaJVug4 +x1Hk4c/xY3V9DexUIpiadMds8Fr1gg3BMcr29DkoxBrP6HU5Aicw9oztQjvR//FBxtH ojJK9XF6Ats96oBnWP73U62Qm3GIequ7bI9oq+tg26debnk0YX0qTQN5NGZrgytQRFZR wEaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GWTOtMpf; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a170902d2ca00b001a507d6feb8si2707570plc.628.2023.05.25.16.25.34; Thu, 25 May 2023 16:25:49 -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=@linaro.org header.s=google header.b=GWTOtMpf; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239614AbjEYXSc (ORCPT + 99 others); Thu, 25 May 2023 19:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241149AbjEYXSZ (ORCPT ); Thu, 25 May 2023 19:18:25 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F2DE56 for ; Thu, 25 May 2023 16:18:21 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f3a9ad31dbso63516e87.0 for ; Thu, 25 May 2023 16:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685056699; x=1687648699; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nVpMlft04baQe3FGBQ1uPFAK60NKjDWRg8PgqN8ZkKs=; b=GWTOtMpfSAgViyuzSRA6mbYzXhGs2FqqTAwIzKk3x37OoFGbj85vDXPTmX+X0nyUPj lG1Fhx76fjwSnGCNkjGDFbwZWQzxlot5ZPq2QY+XP7yxKv+C6/LY4US57qZgGBn+RJZ4 CVWdzs0wvNq8SCL04pSVU9U2QvGY3cLy21bZakUGE299pqo26qW40fk0z1F5Mb0I2Cev 5V/EoO9gAIuMbozA/5zAWCi8KYlQOv5YvyrecOuybW2ze6N7yRHa+ge0NWYZJCRnyz14 wvgY/Qo55yWcXyOTKZIrc6eqQa1xrO+v8yHLgvlWJeh0xMSuwb1r8GLEn6PoJTi6ha97 NF6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685056699; x=1687648699; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nVpMlft04baQe3FGBQ1uPFAK60NKjDWRg8PgqN8ZkKs=; b=N6WTUua30wN1/+5xk4mwauxcDcZlkmHf4YchoWnAzqP1wlPJiqWFIJMmHbKuuqVxr2 nBkj5vBQNywqF+hpdwlBJgMd4BAbGHNSqBMapLDGNuL3mp35UVq9O1xutCN4GjwGVj83 bs8afmbtPB+HtdL2eI0zYXOVcs4/sNEYAeyxHKBbYcFikePax7vJajMS7CMbOuGNl2YR Lj0VmDEIvZ1ZShtNQL6DTIG5DumBQVPyFMLVGBAkRIv2fpPp5R5W3fW9HVfk3x3XQFYP +7Cn5DR6NTHiWVGA4cQaHe1PsG2SSQOkfBegTV+bHHDOZvSZo14eks14Inqful/310yz xvsA== X-Gm-Message-State: AC+VfDxNywZxpbgeaPvx+NcqeNT250KcywLnzvwT0uoIX1XhBkLsMfsh FHdoXXV5S56nLSepWg4cEW6Zmw== X-Received: by 2002:a05:6512:410:b0:4f4:d805:cf62 with SMTP id u16-20020a056512041000b004f4d805cf62mr950794lfk.5.1685056699552; Thu, 25 May 2023 16:18:19 -0700 (PDT) Received: from [192.168.1.101] (abyj77.neoplus.adsl.tpnet.pl. [83.9.29.77]) by smtp.gmail.com with ESMTPSA id t9-20020ac243a9000000b004edc485f86bsm366766lfl.239.2023.05.25.16.18.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 May 2023 16:18:19 -0700 (PDT) Message-ID: Date: Fri, 26 May 2023 01:18:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v4 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Content-Language: en-US To: Robert Marko , agross@kernel.org, andersson@kernel.org, ilia.lin@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org Cc: ansuelsmth@gmail.com References: <20230525210214.78235-1-robimarko@gmail.com> <20230525210214.78235-3-robimarko@gmail.com> From: Konrad Dybcio In-Reply-To: <20230525210214.78235-3-robimarko@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 25.05.2023 23:02, Robert Marko wrote: > Introduce a helper to return the SoC SMEM ID, which is used to identify the > exact SoC model as there may be differences in the same SoC family. > > Currently, cpufreq-nvmem does this completely in the driver and there has > been more interest expresed for other drivers to use this information so > lets expose a common helper to prevent redoing it in individual drivers > since this field is present on every SMEM table version. > > Signed-off-by: Robert Marko > --- > Changes in v4: > * Change helper name to qcom_smem_get_soc_id() > * Remove len and just pass NULL, that is sufficient here > > Changes in v3: > * Change export to EXPORT_SYMBOL_GPL > * Use an argument for returning SoC ID > * Update kerneldoc > --- > drivers/soc/qcom/smem.c | 23 +++++++++++++++++++++++ > include/linux/soc/qcom/smem.h | 2 ++ > 2 files changed, 25 insertions(+) > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > index bc98520c4969..78cf79ea4924 100644 > --- a/drivers/soc/qcom/smem.c > +++ b/drivers/soc/qcom/smem.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > > /* > * The Qualcomm shared memory system is a allocate only heap structure that > @@ -772,6 +773,28 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) > } > EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys); > > +/** > + * qcom_smem_get_soc_id() - return the SoC ID > + * @id: On success, we return the SoC ID here. > + * > + * Look up SoC ID from HW/SW build ID and return it. > + * > + * Return: 0 on success, negative errno on failure. > + */ > +int qcom_smem_get_soc_id(u32 *id) __le32 *id LGTM otherwise! Konrad > +{ > + struct socinfo *info; > + > + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL); > + if (IS_ERR(info)) > + return PTR_ERR(info); > + > + *id = info->id; > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id); > + > static int qcom_smem_get_sbl_version(struct qcom_smem *smem) > { > struct smem_header *header; > diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h > index 86e1b358688a..223db6a9c733 100644 > --- a/include/linux/soc/qcom/smem.h > +++ b/include/linux/soc/qcom/smem.h > @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host); > > phys_addr_t qcom_smem_virt_to_phys(void *p); > > +int qcom_smem_get_soc_id(u32 *id); > + > #endif