From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E32A3C77B73 for ; Fri, 26 May 2023 21:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243830AbjEZVFa (ORCPT ); Fri, 26 May 2023 17:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236835AbjEZVF2 (ORCPT ); Fri, 26 May 2023 17:05:28 -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 8EFE41B1 for ; Fri, 26 May 2023 14:05:18 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f37b860173so1365316e87.2 for ; Fri, 26 May 2023 14:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685135117; x=1687727117; 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=GqzChK2p9Fmsbypm5fA/GYnlAjU1PYB3ZgmsKK+VVus=; b=t2cG7LYWCQ/fIqzKcGIfk8cwHzaznVTEc9PDO/9dcOBDmlYOw89iJUHjEWU/vSWIga uN+5r85b0ymLK9qb/cjnwav6OXL2AQNSx4FUrbqXm2LiD+EJWIOWcA1CWaHGk24z/j5t +iPXTpgeaVuDao1h3fkkw6uk8Hzl9360uPMzJJjBM27071/yl4kEIoCY9Ot7HL95lzwh LJEZ4P1YtgaSqTGP1qA655qKXErtuC81ekYUrvb++UQKoqan/I2wXBE8ZDW9zMok9/6o ohgLcLPkdP2HD81wTynIMiSdSJ/e8KV9RUP+WQUGUjfULLHUn2MnL3hhubMlE2rF6O9x DB2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685135117; x=1687727117; 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=GqzChK2p9Fmsbypm5fA/GYnlAjU1PYB3ZgmsKK+VVus=; b=UMnBg/C/5iThezP1co0CQYjofG6ACOw8ORdr+qo+bjO+AVFFuHvDXNCl6zYYtlZJk0 eCwETOTmAaTCe+QhtwifqToXi81r8uNoGI2/XB3gO3r+MsGcjuk1T/1dSrwNRTq45tTk wmxE82pJvqRd6MZcby+1u7kyHi4fYAKhZUfj2PHG4Vq9SZ7fvEFf106IdhB+wG1SBqhQ fy6sclsHZd+LoTrChh9JFike0azyf+zePBQbGi+MS7NIywonc1EGgTIHRdH6o2wRyQI1 McQ84M/HJEUNTp1kE5QBc4SiB9iC/WDfAZbmansqqllGI+LrFcqe8JrA2Z8dFFlD/pte QWJQ== X-Gm-Message-State: AC+VfDwbEcwuxHCw4VrtXGaGRXact49PILeqb68+QyeT27H4jyucEHg4 i8Hq2Dm6G7lnF/BlQ/rK1Q3HGw== X-Google-Smtp-Source: ACHHUZ7O5tQX7gUXjHxxBp9kqHiKWVIiLCI+vuE0LsVKLdoVIEf/7YYM17Gn3NJ68MieU9Pnvc8NSg== X-Received: by 2002:a2e:a164:0:b0:2af:b4b:8583 with SMTP id u4-20020a2ea164000000b002af0b4b8583mr1060146ljl.15.1685135116776; Fri, 26 May 2023 14:05:16 -0700 (PDT) Received: from [192.168.1.101] (abyj77.neoplus.adsl.tpnet.pl. [83.9.29.77]) by smtp.gmail.com with ESMTPSA id a24-20020a2e8618000000b002a76c16ad65sm951941lji.87.2023.05.26.14.05.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 May 2023 14:05:16 -0700 (PDT) Message-ID: Date: Fri, 26 May 2023 23:05:14 +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 v5 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: <20230526204802.3081168-1-robimarko@gmail.com> <20230526204802.3081168-3-robimarko@gmail.com> From: Konrad Dybcio In-Reply-To: <20230526204802.3081168-3-robimarko@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On 26.05.2023 22:48, 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 v5: > * Convert the __le32 ID to CPU endinaness Sorry for the confusion in my previous reviews. Reviewed-by: Konrad Dybcio Konrad > > 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..b0d59e815c3b 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) > +{ > + 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 = __le32_to_cpu(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