From patchwork Fri May 26 20:47:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13257316 X-Patchwork-Delegate: viresh.linux@gmail.com 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 A8A64C7EE2F for ; Fri, 26 May 2023 20:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243441AbjEZUsR (ORCPT ); Fri, 26 May 2023 16:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237856AbjEZUsL (ORCPT ); Fri, 26 May 2023 16:48:11 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D979518D; Fri, 26 May 2023 13:48:06 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-96f7bf3cf9eso223940266b.0; Fri, 26 May 2023 13:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685134085; x=1687726085; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0R0NrTV6Cqbu4tkPLJTMsGVN13FV0cFn1qP/yJKlxmM=; b=X2rfpKXipfhG+PEUWJBDIQ1o5PogCoENlvEt+SGQ+7rF8iLBN7SFnV13wRnDdiXT2r NGXjedeOg+tIWRV5stWzQa3BSAAozyh3AzsH/FSAw74GAmCkvfBcJlYAdFockCIgeLyY dYGEp6v6D0GLNAOv5J5dg8XR5yXkpKP9SGDL+OqzS+PxMC2u9T9rVraYige205g+dtZt pmBNSpBVUdbjRp6AA9k6XhyvMLy8LJg4ypDXmkMaLHhEbKP7Yy5XfV+vB2aaEQz+eI/R Yx4YuvzAeRh1YCr4PkNRyTAj0mo6CJfDNjE2c+4pXYGZ3lWMy7HRCcg+UDZR2PJK2b5n wjow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685134085; x=1687726085; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0R0NrTV6Cqbu4tkPLJTMsGVN13FV0cFn1qP/yJKlxmM=; b=MHs1PYlZqemGFJ3laEajmlbC86p/ThusgY3bQv7UCfAYgp0iTiavJe28Zc/Ghn5+U3 cAdh9HzAHhH54NbfePNnty2ZOBQeBCd0CgfZxWXL288YE09UjFBHveS9kre7JeOf3d4P CpqbjhBi67gbWaMMUrpPc5Rjb/vHj/8zXgnIZFtnKWgOJRRn79uC9D3m+Vy0B+Hhql3K wKRvLFVPlVr7RA0t1u2KtlAy2JuC5LIYTBtxMlOluFjRZpvaxd2zYWYQZMQ50KaQC8Vs JqhfhWsach1pF1tESj/25x59zDNbUZdkrtjhjhep31p0Fuxp1Pfo222L6ldfUoTyDNmD k42A== X-Gm-Message-State: AC+VfDxVDTUjpW+2jLKpV5EZGoYsIC6GGfNsAAIXj4MwdMus8qOeTGlV z0LieD2ybMr40eMXZH7WUSg= X-Google-Smtp-Source: ACHHUZ4tltghkDEs4H+WeAaNWWmoAVTk1B3YVlbFYjpOos6TovJcH77mpK7bVtLFFU/UdEgvlSV3eg== X-Received: by 2002:a17:907:60c9:b0:96f:cde5:5f5e with SMTP id hv9-20020a17090760c900b0096fcde55f5emr3233901ejc.29.1685134084976; Fri, 26 May 2023 13:48:04 -0700 (PDT) Received: from fedora.. (dh207-98-6.xnet.hr. [88.207.98.6]) by smtp.googlemail.com with ESMTPSA id m13-20020a170906160d00b0095342bfb701sm2604413ejd.16.2023.05.26.13.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 13:48:04 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.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, Robert Marko Subject: [PATCH v5 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Fri, 26 May 2023 22:47:58 +0200 Message-Id: <20230526204802.3081168-1-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Move SMEM item struct and related defines to a header in order to be able to reuse them in the SMEM driver instead of duplicating them. Signed-off-by: Robert Marko Reviewed-by: Konrad Dybcio --- drivers/soc/qcom/socinfo.c | 67 +----------------------------- include/linux/soc/qcom/socinfo.h | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 66 deletions(-) create mode 100644 include/linux/soc/qcom/socinfo.h diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c index c2e4a57dd666..ee6bbf76d941 100644 --- a/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -32,15 +33,6 @@ #define qcom_board_id(id) QCOM_ID_ ## id, __stringify(id) #define qcom_board_id_named(id, name) QCOM_ID_ ## id, (name) -#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 -#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 - -/* - * SMEM item id, used to acquire handles to respective - * SMEM region. - */ -#define SMEM_HW_SW_BUILD_ID 137 - #ifdef CONFIG_DEBUG_FS #define SMEM_IMAGE_VERSION_BLOCKS_COUNT 32 #define SMEM_IMAGE_VERSION_SIZE 4096 @@ -126,64 +118,7 @@ static const char *const pmic_models[] = { [58] = "PM8450", [65] = "PM8010", }; -#endif /* CONFIG_DEBUG_FS */ - -/* Socinfo SMEM item structure */ -struct socinfo { - __le32 fmt; - __le32 id; - __le32 ver; - char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; - /* Version 2 */ - __le32 raw_id; - __le32 raw_ver; - /* Version 3 */ - __le32 hw_plat; - /* Version 4 */ - __le32 plat_ver; - /* Version 5 */ - __le32 accessory_chip; - /* Version 6 */ - __le32 hw_plat_subtype; - /* Version 7 */ - __le32 pmic_model; - __le32 pmic_die_rev; - /* Version 8 */ - __le32 pmic_model_1; - __le32 pmic_die_rev_1; - __le32 pmic_model_2; - __le32 pmic_die_rev_2; - /* Version 9 */ - __le32 foundry_id; - /* Version 10 */ - __le32 serial_num; - /* Version 11 */ - __le32 num_pmics; - __le32 pmic_array_offset; - /* Version 12 */ - __le32 chip_family; - __le32 raw_device_family; - __le32 raw_device_num; - /* Version 13 */ - __le32 nproduct_id; - char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; - /* Version 14 */ - __le32 num_clusters; - __le32 ncluster_array_offset; - __le32 num_defective_parts; - __le32 ndefective_parts_array_offset; - /* Version 15 */ - __le32 nmodem_supported; - /* Version 16 */ - __le32 feature_code; - __le32 pcode; - __le32 npartnamemap_offset; - __le32 nnum_partname_mapping; - /* Version 17 */ - __le32 oem_variant; -}; -#ifdef CONFIG_DEBUG_FS struct socinfo_params { u32 raw_device_family; u32 hw_plat_subtype; diff --git a/include/linux/soc/qcom/socinfo.h b/include/linux/soc/qcom/socinfo.h new file mode 100644 index 000000000000..d1cbc49a2a2d --- /dev/null +++ b/include/linux/soc/qcom/socinfo.h @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __QCOM_SOCINFO_H__ +#define __QCOM_SOCINFO_H__ + +/* + * SMEM item id, used to acquire handles to respective + * SMEM region. + */ +#define SMEM_HW_SW_BUILD_ID 137 + +#define SMEM_SOCINFO_BUILD_ID_LENGTH 32 +#define SMEM_SOCINFO_CHIP_ID_LENGTH 32 + +/* Socinfo SMEM item structure */ +struct socinfo { + __le32 fmt; + __le32 id; + __le32 ver; + char build_id[SMEM_SOCINFO_BUILD_ID_LENGTH]; + /* Version 2 */ + __le32 raw_id; + __le32 raw_ver; + /* Version 3 */ + __le32 hw_plat; + /* Version 4 */ + __le32 plat_ver; + /* Version 5 */ + __le32 accessory_chip; + /* Version 6 */ + __le32 hw_plat_subtype; + /* Version 7 */ + __le32 pmic_model; + __le32 pmic_die_rev; + /* Version 8 */ + __le32 pmic_model_1; + __le32 pmic_die_rev_1; + __le32 pmic_model_2; + __le32 pmic_die_rev_2; + /* Version 9 */ + __le32 foundry_id; + /* Version 10 */ + __le32 serial_num; + /* Version 11 */ + __le32 num_pmics; + __le32 pmic_array_offset; + /* Version 12 */ + __le32 chip_family; + __le32 raw_device_family; + __le32 raw_device_num; + /* Version 13 */ + __le32 nproduct_id; + char chip_id[SMEM_SOCINFO_CHIP_ID_LENGTH]; + /* Version 14 */ + __le32 num_clusters; + __le32 ncluster_array_offset; + __le32 num_defective_parts; + __le32 ndefective_parts_array_offset; + /* Version 15 */ + __le32 nmodem_supported; + /* Version 16 */ + __le32 feature_code; + __le32 pcode; + __le32 npartnamemap_offset; + __le32 nnum_partname_mapping; + /* Version 17 */ + __le32 oem_variant; +}; + +#endif From patchwork Fri May 26 20:47:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13257317 X-Patchwork-Delegate: viresh.linux@gmail.com 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 228FCC77B73 for ; Fri, 26 May 2023 20:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243357AbjEZUsQ (ORCPT ); Fri, 26 May 2023 16:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243227AbjEZUsL (ORCPT ); Fri, 26 May 2023 16:48:11 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08193189; Fri, 26 May 2023 13:48:08 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5148ebc4b89so223919a12.3; Fri, 26 May 2023 13:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685134086; x=1687726086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xqcvTDSmtR3/nHHqfw4x74tCgNTC4R8I5JW/MpzlYaI=; b=b6hbdnN5b5gw+aNwMDh0jp1oPnfJIYsBcs6R9y2tmvUH+P9npp9e2zkLfMZ4uWXLOO RnVpq2kwjpl1tceIP6GTAlhT7S+++aDbK/IsX7zUQva8wy1+TkEUe5nNI+RGZEiIVMJV 6p3FfOAjFkbImsVv2jCWrjmtAkLyAOi9Sl5oh+NdZZmj/kd2skgdqKX7pFJI/gTQO2PA zuE6bB6P7g5YqnKn6wvMaTW7DjNwxWO5RY26spVFeuuFRbgXHFtqSQFbPbFioCKmWNww tLc25smjSlKvsUhwhujmarpNxI4sD5sD7AIqjUGgeQF+C2Lb2U1eie4B0rviRbFTxHXq E2mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685134086; x=1687726086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xqcvTDSmtR3/nHHqfw4x74tCgNTC4R8I5JW/MpzlYaI=; b=aumg7hZ7DegL493AgzF7IbybHijQDM6GLUWjAPLsjlHVCjCe9jGBfMjqWC9gsCknsm jljiPQffQsXA3giMn5lAJjVuiH+lDFIh5wWVhx0oxvyZ3q5gh80eDvoP6Q9YvU7m50cj 1FIJjyTKQaTjgEBwDd0UDSHTDfcN6IH+eBJ+9G1bt5IzAUmYSpl5IagXMUV4uheNbdHb /kG0N4xQduVyFlSb/zuvQ2/MF4Bx1ZTAc7bNsDzlDZixTmo971c3p8V6gZcgQtFScQV7 v4u85o3+2QPRcNz860kS8FwhFXAhpqbUXskb+B5AuUrt2MJZ9HdcvbL5FCwn0X7AvmIm DpPQ== X-Gm-Message-State: AC+VfDz1py6nJFvMIHvTVqpug//yZ1gjQz354zm7gZjbzuf9HNPDGMQ8 4R+qKvaRVDiaWZcCvZEqxoI= X-Google-Smtp-Source: ACHHUZ4jSFssmk51geC9a85dPFQ13pfskwpL+6lMQ1VR5k9NVHtoBt9W0yX9NH+VgoQIe+YkJpRkUw== X-Received: by 2002:a17:906:db0e:b0:96f:b8a0:6cfe with SMTP id xj14-20020a170906db0e00b0096fb8a06cfemr3069025ejb.54.1685134086303; Fri, 26 May 2023 13:48:06 -0700 (PDT) Received: from fedora.. (dh207-98-6.xnet.hr. [88.207.98.6]) by smtp.googlemail.com with ESMTPSA id m13-20020a170906160d00b0095342bfb701sm2604413ejd.16.2023.05.26.13.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 13:48:05 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.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, Robert Marko , Trilok Soni Subject: [PATCH v5 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Date: Fri, 26 May 2023 22:47:59 +0200 Message-Id: <20230526204802.3081168-2-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230526204802.3081168-1-robimarko@gmail.com> References: <20230526204802.3081168-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org SMEM has been GPL licensed from the start, and there is no reason to use EXPORT_SYMBOL() so switch to the GPL version. Signed-off-by: Robert Marko Reviewed-by: Konrad Dybcio Reviewed-by: Trilok Soni --- drivers/soc/qcom/smem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 6be7ea93c78c..bc98520c4969 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -500,7 +500,7 @@ int qcom_smem_alloc(unsigned host, unsigned item, size_t size) return ret; } -EXPORT_SYMBOL(qcom_smem_alloc); +EXPORT_SYMBOL_GPL(qcom_smem_alloc); static void *qcom_smem_get_global(struct qcom_smem *smem, unsigned item, @@ -674,7 +674,7 @@ void *qcom_smem_get(unsigned host, unsigned item, size_t *size) return ptr; } -EXPORT_SYMBOL(qcom_smem_get); +EXPORT_SYMBOL_GPL(qcom_smem_get); /** * qcom_smem_get_free_space() - retrieve amount of free space in a partition @@ -719,7 +719,7 @@ int qcom_smem_get_free_space(unsigned host) return ret; } -EXPORT_SYMBOL(qcom_smem_get_free_space); +EXPORT_SYMBOL_GPL(qcom_smem_get_free_space); static bool addr_in_range(void __iomem *base, size_t size, void *addr) { @@ -770,7 +770,7 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) return 0; } -EXPORT_SYMBOL(qcom_smem_virt_to_phys); +EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys); static int qcom_smem_get_sbl_version(struct qcom_smem *smem) { From patchwork Fri May 26 20:48:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13257318 X-Patchwork-Delegate: viresh.linux@gmail.com 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 B2290C7EE33 for ; Fri, 26 May 2023 20:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243496AbjEZUsS (ORCPT ); Fri, 26 May 2023 16:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243223AbjEZUsM (ORCPT ); Fri, 26 May 2023 16:48:12 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C08A1B6; Fri, 26 May 2023 13:48:09 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-969f90d71d4so165635266b.3; Fri, 26 May 2023 13:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685134087; x=1687726087; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/eFkvxxfZGUWIwdt4Yk1IwgTRk71PWUDf3wOYpRw1LM=; b=oHp6ck0f9MlkTkklyXE4ayemD+ST6s3ykHOS/4QXEsHgKgibi63kVFKRV2bQyeIgMI 2irNYGMoVVXVhE29ExeeNRRZJRa+xS1wdsUtFt52j9NTwkFll0n9mJ39nPMgZy+RIkM+ JkBpHhqAz1/rGL0faJ+EGXu0q3bK0kNoTX09JcbOphuBUaJfrjfc+NOksOMYCG/KItvP G3tz+5DueHCQAnrxI5hW5BW+83wEUxVtgQbqF7ELFUFuieWu74gKVTeVj3qD+8ukzIBB DQSgUkZmGX8ZPDjP7P7XM5Lp6EMJYQdYUVElrnM/UMxRk1a4OqLk6GMWi1IrC3gp4I1f 6UEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685134087; x=1687726087; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/eFkvxxfZGUWIwdt4Yk1IwgTRk71PWUDf3wOYpRw1LM=; b=Usv1NvB/58Cv4GmgjfVMdCL6iRQwq37CF6UwSgJfdLU7kcX1UhM8rjxyOhncvAsi05 dQvgUHl5mdTgEYV4DUN2OWJrAchprOXnLJGltVU+zVFZILcfljtC1sgLWJTp2tqMLlN9 npzIrgUlnZNdAazHudGDYh/LgmsWHWnjYTdLos/6/LNJAQ9DAHQ+bEbHEL0W24BitrzJ 5ULhV9zHpl94K92Pax0n1Yv04d7pVSZS7QoMOJLZD1KKvEGdWF17AjELYsbQqr5aBx+G LAmwuEaUXSWo1t1wAt3U/tSQLDqRO4ZUlNwFbrjLh+WXL9z63b3bhq25TJqkFyadxOLA PbIQ== X-Gm-Message-State: AC+VfDyJAKlNf1FmA1UX/0CGpR2fgeBjhyWejJf/airWRxwabhbIJYuG XP2I0fQ2gDV7CImkj6iD93t4zBE5efInxw== X-Google-Smtp-Source: ACHHUZ4ZLkwcnY9Sj0z0sYSrR/+0JuJnjoh+WJFfArB/rromxPsYjXooWxUHyo0C8dH5ajc3O9qFgQ== X-Received: by 2002:a17:906:6a14:b0:962:582d:89d7 with SMTP id qw20-20020a1709066a1400b00962582d89d7mr3535398ejc.38.1685134087534; Fri, 26 May 2023 13:48:07 -0700 (PDT) Received: from fedora.. (dh207-98-6.xnet.hr. [88.207.98.6]) by smtp.googlemail.com with ESMTPSA id m13-20020a170906160d00b0095342bfb701sm2604413ejd.16.2023.05.26.13.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 13:48:07 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.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, Robert Marko Subject: [PATCH v5 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Date: Fri, 26 May 2023 22:48:00 +0200 Message-Id: <20230526204802.3081168-3-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230526204802.3081168-1-robimarko@gmail.com> References: <20230526204802.3081168-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 Reviewed-by: Konrad Dybcio Reviewed-by: Kathiravan T --- Changes in v5: * Convert the __le32 ID to CPU endinaness 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 From patchwork Fri May 26 20:48:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13257319 X-Patchwork-Delegate: viresh.linux@gmail.com 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 684EDC77B7A for ; Fri, 26 May 2023 20:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243342AbjEZUsT (ORCPT ); Fri, 26 May 2023 16:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243247AbjEZUsP (ORCPT ); Fri, 26 May 2023 16:48:15 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 551D2187; Fri, 26 May 2023 13:48:10 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5147f7d045bso1011718a12.2; Fri, 26 May 2023 13:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685134089; x=1687726089; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OpOWhP8DxFONC41kTCdHjaq2c0kscoG17qr+mKyv86Y=; b=mfzOVkfqB/p9o5a19CJ3Q8uzxdeWxlyk+I7RGvjW+fvlf/XKW4d65EwM22puPWmmyI IbN6lpXgm69WIY64/MYpJbOFTYSkGsQea+kqrixVrz0H/kPHzaASX/syIyrMY3DmVa0K G5VkuJPxCUILjR0VRNoscE47XIKSvnN3Musnrk1YTm8XPIb87iJVJS3sjIrnvtyRBuZn xxOdzNtUFjGORl/VEkk3QiuPa5xpmqJbX+ajyIFTm3Y2whC2D1agwgy0vWivEv+MwHdK EIA7dpQw/9umQfR3GSl3hqdtWaT7yugCszRapzqfJ7xtxkVjBEYDJflNTggX/zyQR4XB /qgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685134089; x=1687726089; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OpOWhP8DxFONC41kTCdHjaq2c0kscoG17qr+mKyv86Y=; b=VsLfljJWSRTlOnZAW/668hd/os8q26+GtymSOudf8puDclXAS6VAbb4ZYP/JRsJBSB SJnkfEiDWweja1FTlfAeB55r8dB2v1yZ09CEhY9SWmEkjItY1IuR5WK0DRcD7l6bzhKJ ThYE+367FSF3owuMCWTObNyHQs3ouX5AH0ByI24evHIsplV1L/tJZv69z7eN8xxuFiuL BYPYoyYhXzl5ptIGO4diXnaVNBzMCI1key559VzlpZCuaur6nfoda2IOioGFk+irRAra waEc3jMpt1XyPMAwDxXtFX7sjdeXeDzfob5cHfxj3/y6EF+VgkjVODCBavFZd3gnMk1j gHnQ== X-Gm-Message-State: AC+VfDyUqfs1YVTBlbYUq5eAqzpztfcEP1MCdgJ6vdMpyn/yiFGHrYlk cLDVnjTpkZiYSZ1iC0/tv1E= X-Google-Smtp-Source: ACHHUZ6rwAbVvuSastJygwvVxbdtVLRvvy6CRx4rQ80ylwCVSk497cf8NbyG/QsqD+c+26HD5mM5OQ== X-Received: by 2002:a17:907:3e0d:b0:96a:1f7c:3207 with SMTP id hp13-20020a1709073e0d00b0096a1f7c3207mr4480714ejc.19.1685134088729; Fri, 26 May 2023 13:48:08 -0700 (PDT) Received: from fedora.. (dh207-98-6.xnet.hr. [88.207.98.6]) by smtp.googlemail.com with ESMTPSA id m13-20020a170906160d00b0095342bfb701sm2604413ejd.16.2023.05.26.13.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 13:48:08 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.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, Robert Marko , Bjorn Andersson Subject: [PATCH v5 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Date: Fri, 26 May 2023 22:48:01 +0200 Message-Id: <20230526204802.3081168-4-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230526204802.3081168-1-robimarko@gmail.com> References: <20230526204802.3081168-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org SMEM SoC ID-s are now stored in DT bindings so lets use those instead of defining them in the driver again. Signed-off-by: Robert Marko Reviewed-by: Konrad Dybcio Reviewed-by: Bjorn Andersson Acked-by: Viresh Kumar --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index a577586b23be..60e99be2d3db 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -31,12 +31,7 @@ #define MSM_ID_SMEM 137 -enum _msm_id { - MSM8996V3 = 0xF6ul, - APQ8096V3 = 0x123ul, - MSM8996SG = 0x131ul, - APQ8096SG = 0x138ul, -}; +#include enum _msm8996_version { MSM8996_V3, @@ -154,12 +149,12 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void) msm_id++; switch ((enum _msm_id)*msm_id) { - case MSM8996V3: - case APQ8096V3: + case QCOM_ID_MSM8996: + case QCOM_ID_APQ8096: version = MSM8996_V3; break; - case MSM8996SG: - case APQ8096SG: + case QCOM_ID_MSM8996SG: + case QCOM_ID_APQ8096SG: version = MSM8996_SG; break; default: From patchwork Fri May 26 20:48:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13257320 X-Patchwork-Delegate: viresh.linux@gmail.com 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 0648EC7EE39 for ; Fri, 26 May 2023 20:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243408AbjEZUsU (ORCPT ); Fri, 26 May 2023 16:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242952AbjEZUsP (ORCPT ); Fri, 26 May 2023 16:48:15 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF2CA19D; Fri, 26 May 2023 13:48:11 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-51458187be1so1878573a12.2; Fri, 26 May 2023 13:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685134090; x=1687726090; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nax/DXvV7aPRLv33Egja3ns9F/aEPbpzdpouXsbNQfc=; b=qErUN8wO/o7+mPSK+abk4dbiXgqMGTY4lNyqajrCwaMjOgQ8oeuKVGjrQJWl6MEIvf TTlmanszl+SYiyQL7xqVNn5P5xs6Xj7plETMqPnN2j1H3b46t2ZVaQ6KKInvsnlh56s9 S7Fg9MaQv7y8G9IwwwF7EEFwBIZojFYbXwLN6gPcEL0PtayCwnEHXiBlWvkCLNmlTWrJ +Z/FenAitnmtvlZNZz+JWFSsMrSmIcWtFTeIFjp0ELeSnFYrfB7vOvYQFZbHNgUPRJ2z LxPctVOtBsNNIgata30YQso8vgQooNQW/IkPFThNp0f+ibUwl3VO0Dp7d+JG2mTP8sQh 7CbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685134090; x=1687726090; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nax/DXvV7aPRLv33Egja3ns9F/aEPbpzdpouXsbNQfc=; b=XE0vyET4CW2sViaGYAWldEmhm00TtYhVvKBpx9uIrgXWRHWg4FBYrIy2wFtxjVCvj1 ZRGIkcPySofFg3txauIYFuh/WHK/9t9ztOSdCMzdXC7NqdTqk6CZzH2G/yDghJAPO8p+ pAeMr54wykUJvKei+HA2UGdJRCihKQkLY0O23yBrrUym2fVmZmw+LaXbvY9C676nhQsG e+DKE1zvCSWXj6RtryPTazfLLcOaAsPk/zxUsu14x98OUB+77vj98seKYXJicro02K4F Xn4yNXzb4NfyK8pjQF0lMMOjjKkeXLrifZNe0YV66WycbLJfUghLYJfYTw1FljelpoQy XxSg== X-Gm-Message-State: AC+VfDyYCLzbIqAmBuS5jXhTOGKETVJU0lg9kJAIeFeudgyeWM6+6n2e RE0f/QkSzf3s+SJyi3/gK1ByTujhozL9AA== X-Google-Smtp-Source: ACHHUZ4z6HWPoyT9/k9E+VkmVtD5LsOYm+2rvPKlOgL9RflARsxvV7k6h/qHqedcXhwL1BPRPhwXrA== X-Received: by 2002:a17:906:ef07:b0:969:e88a:6071 with SMTP id f7-20020a170906ef0700b00969e88a6071mr3116987ejs.61.1685134089858; Fri, 26 May 2023 13:48:09 -0700 (PDT) Received: from fedora.. (dh207-98-6.xnet.hr. [88.207.98.6]) by smtp.googlemail.com with ESMTPSA id m13-20020a170906160d00b0095342bfb701sm2604413ejd.16.2023.05.26.13.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 13:48:09 -0700 (PDT) From: Robert Marko To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.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, Robert Marko Subject: [PATCH v5 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Date: Fri, 26 May 2023 22:48:02 +0200 Message-Id: <20230526204802.3081168-5-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230526204802.3081168-1-robimarko@gmail.com> References: <20230526204802.3081168-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that SMEM exports a helper to get the SMEM SoC ID lets utilize it. Currently qcom_cpufreq_get_msm_id() is encoding the returned SMEM SoC ID into an enum, however there is no reason to do so and we can just match directly on the SMEM SoC ID as returned by qcom_smem_get_soc_id(). Signed-off-by: Robert Marko Acked-by: Viresh Kumar Reviewed-by: Konrad Dybcio --- Changes in v4: * Adapt to name change to qcom_smem_get_soc_id() Changes in v3: * Adapt to helper using argument now Changes in v2: * Utilize helper exported by SMEM instead of refactoring qcom_cpufreq_get_msm_id() --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 56 +++++----------------------- 1 file changed, 10 insertions(+), 46 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index 60e99be2d3db..a88b6fe5db50 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -29,16 +29,8 @@ #include #include -#define MSM_ID_SMEM 137 - #include -enum _msm8996_version { - MSM8996_V3, - MSM8996_SG, - NUM_OF_MSM8996_VERSIONS, -}; - struct qcom_cpufreq_drv; struct qcom_cpufreq_match_data { @@ -135,60 +127,32 @@ static void get_krait_bin_format_b(struct device *cpu_dev, dev_dbg(cpu_dev, "PVS version: %d\n", *pvs_ver); } -static enum _msm8996_version qcom_cpufreq_get_msm_id(void) -{ - size_t len; - u32 *msm_id; - enum _msm8996_version version; - - msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len); - if (IS_ERR(msm_id)) - return NUM_OF_MSM8996_VERSIONS; - - /* The first 4 bytes are format, next to them is the actual msm-id */ - msm_id++; - - switch ((enum _msm_id)*msm_id) { - case QCOM_ID_MSM8996: - case QCOM_ID_APQ8096: - version = MSM8996_V3; - break; - case QCOM_ID_MSM8996SG: - case QCOM_ID_APQ8096SG: - version = MSM8996_SG; - break; - default: - version = NUM_OF_MSM8996_VERSIONS; - } - - return version; -} - static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, char **pvs_name, struct qcom_cpufreq_drv *drv) { size_t len; + u32 msm_id; u8 *speedbin; - enum _msm8996_version msm8996_version; + int ret; *pvs_name = NULL; - msm8996_version = qcom_cpufreq_get_msm_id(); - if (NUM_OF_MSM8996_VERSIONS == msm8996_version) { - dev_err(cpu_dev, "Not Snapdragon 820/821!"); - return -ENODEV; - } + ret = qcom_smem_get_soc_id(&msm_id); + if (ret) + return ret; speedbin = nvmem_cell_read(speedbin_nvmem, &len); if (IS_ERR(speedbin)) return PTR_ERR(speedbin); - switch (msm8996_version) { - case MSM8996_V3: + switch (msm_id) { + case QCOM_ID_MSM8996: + case QCOM_ID_APQ8096: drv->versions = 1 << (unsigned int)(*speedbin); break; - case MSM8996_SG: + case QCOM_ID_MSM8996SG: + case QCOM_ID_APQ8096SG: drv->versions = 1 << ((unsigned int)(*speedbin) + 4); break; default: