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: 99658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp746200vqr; Fri, 26 May 2023 13:58:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53O0VIdBxqbOBb0OI9Vv7M2Eo8Kq4a7U8T+EZgbxEdYtXcL1s5TjifsQEdcSZl4a0hth+1 X-Received: by 2002:a05:6a21:338b:b0:10b:91c5:45a8 with SMTP id yy11-20020a056a21338b00b0010b91c545a8mr884441pzb.15.1685134728977; Fri, 26 May 2023 13:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685134728; cv=none; d=google.com; s=arc-20160816; b=HuPUVn8sefLIyhD3U91s46nw6i5zx6e346x9hPjI31lpHS+DqsWigqwZE+x2U6mX1P 3fH7RokjQVSLx0XA/tiN3yY+JVoCaaVnOPQ0071pciHJRtQZyFbfzcd4b0BB0OgGQ5UX 7rcyUHkvb1GCoXsA6O9+bK9g2a/kSKfCdrAT7Kk5yqOCR4OdE7yTYazE/guy7oIp6N9L kugyMj8FB03aMD5nn6DhZ6+dqi8ds6EX9gMPALsFMbUeCm83LIrofjwAOWBOTKwpU/dQ Q1gqBO4FYFPvZll+1rS0W5b2KMDXOSIiriYhGVut2uuoMmuYLLGIfYMA3dtjvsrWTca0 WHRg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0R0NrTV6Cqbu4tkPLJTMsGVN13FV0cFn1qP/yJKlxmM=; b=K0JlGGw0INaMgoLwkVB3RjahEvvz5ZEbrH0LUjkl1QKj9+eDd48Wmam9ufRjG2KRNt l4Qndc343BXUomqGvsoXUiRMKmED6Ynv0niTy8UPndEkTVuu+3TcH2S53iwIBQpfpzgy yRSx/abWjztW6n7IQAcLcAq08zLfRpim+Ck44jsFbnIzaFIvTQldVxSMnUK6PyJpLPJV JgnwJ6TmyzjteDTvlJvXkDnLguax/ufSQEhevLETps+HofdhxihhICXD7WCzxWOXj/3S 0zUJp/ENu9sNrM7kCwXBrPAO4tWgpATu6fNS5jcauMeN45TxbCVirYt/UmaVJ49PCbyD S2Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=X2rfpKXi; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l64-20020a622543000000b0064d419dd566si2070555pfl.205.2023.05.26.13.58.12; Fri, 26 May 2023 13:58:48 -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=@gmail.com header.s=20221208 header.b=X2rfpKXi; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243376AbjEZUsU (ORCPT + 99 others); Fri, 26 May 2023 16:48:20 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766991833611297795?= X-GMAIL-MSGID: =?utf-8?q?1766991833611297795?= 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: 99656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp742699vqr; Fri, 26 May 2023 13:49:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53aZXm2t2EWJ9jx/BT1VUoQasmMtocgYM2vpnTu+tmZqDqfOJx5mW/bB8jWIaHgNP3+4VQ X-Received: by 2002:a17:902:db05:b0:1ae:89a:9e with SMTP id m5-20020a170902db0500b001ae089a009emr3658597plx.61.1685134167310; Fri, 26 May 2023 13:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685134167; cv=none; d=google.com; s=arc-20160816; b=GpoiNXujVXLFgRB0jc0aziKG9juTG3MfeJWJ25TNOFVXUnt++pbGfgCvjCvmBlr6Ep wwl+ijUEGpi355YLbkAo1dyvoei99pbEXGRLvCMdMqrds8G1V+64oX+kL50l+MM/chfq +105bXyTw3hDWDQ869GDYNTDyfneo0G075ZiZrOLxL/S1L+CdQIPW1mKM1iX7YlyRFgT UXLmXRIoHmu1qAEvn9Xx6YSjBl2uj9/9f3cyK32a5hY76o1w7cNPUjpyM9No7rjq/P72 z7LL6gKw3/VcJ2K4D3rZNk0hBxoWpsYlhf9nx8WL41kDFLDrDpivYYQF9WhjuGOWEEX6 za5Q== 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:date:subject:cc:to:from :dkim-signature; bh=xqcvTDSmtR3/nHHqfw4x74tCgNTC4R8I5JW/MpzlYaI=; b=XgGVutM+WWpFHIRsOF1g5zVorxF6CL5NwuYwtLKnEvTfP+EgkjJsJzlGstAO//2wwX I5ZQ0wdtmu4Ayhfs4Z7azD0D+fmeAXD5suOdhDZJfPSA0G2V8GrUkUUG22XZLyXSOngc 5J0geEK2J/scEfVr+Ykq0FZe8vbDZXLIaxVlSHyM2VAM/rIpaYiDREO0syeOTRzmfXSt nNXcDP1QlMPdo1d/9Zwg+Wzfc7snVa+6lDX8BV7CqyqJikgODCPgKrqo4EHnMt9mZ56Y T6v5yMnTUpO0p4P20Gq13vm2NsGtnD3k+XkUwjoV3ZN7j9DK3N7/09x9YpP7+FwN8mit A9WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=b6hbdnN5; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a170902d2ce00b001ab2431f012si5138153plc.423.2023.05.26.13.48.55; Fri, 26 May 2023 13:49:27 -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=@gmail.com header.s=20221208 header.b=b6hbdnN5; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243431AbjEZUsR (ORCPT + 99 others); Fri, 26 May 2023 16:48:17 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766991244568057077?= X-GMAIL-MSGID: =?utf-8?q?1766991244568057077?= 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: 99660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp748420vqr; Fri, 26 May 2023 14:02:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ691SDvgOleZzQMaacosPcT+vftffdUsEyIcfA1LfZGbmxjZUs/n7t2Cl4mWKmgUXyrATeq X-Received: by 2002:a05:6a20:3ca1:b0:10f:2abb:c9fd with SMTP id b33-20020a056a203ca100b0010f2abbc9fdmr798288pzj.43.1685134957647; Fri, 26 May 2023 14:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685134957; cv=none; d=google.com; s=arc-20160816; b=Uk5wZFcSJm2t0ktvpN+hycPMl/8Ga2flx94tnGM+BmCGRKqZDs8M+uhMziZxmK6sLx yO2/pCrPBBdZ6H+YAWohwKEoViON/5sQqZ0l1QqLFeNJM1lQZ+UNMG1T+fwDdSxNnPXG VoOZjKJwOMWDQYGPo7gyg+GvJk92NZRnGu4gdE9KfHyp9HONJqnV0q5U3nr0Di3NAjL8 0tgYxb6zyfynZY2iZjlr1W+mi9Ib3N98fd/gkx10FdKV8enh5pTsN3JYFxM/gPp33qtI mYR6w50/3zDczUQyHPZXl7e6LuEpnUrZHGFz65+4m6Xpb55FZ4C/lQI/m9rlEb6GqHdW G7GA== 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:date:subject:cc:to:from :dkim-signature; bh=/eFkvxxfZGUWIwdt4Yk1IwgTRk71PWUDf3wOYpRw1LM=; b=t16HBUKzQyuCTYa/7gef4uNr4FVgEbQQa7NsVuaP3kOqZqi2dzmeRdkN993FTHV+69 ZW2cuRIcCmV2JUj/HQf+tl2viXONJKQMfPbvqRbQpeCAcTh6/cVW0P9ryCxpeyGfy0HQ Xzz3oO/BTM97Q3oRIkgv9+22QE1pZjfmpYFHv1qKUz+H3SNINH9eauaIKk9Q+O0Oiw1Q wCeXYnpbQzfgtTDRVxPeGxnTvFcQls9x9jvE8Jvu6z62bzVwA4lu2/Vm19bppBjzI1vX 0jyBlKrqx8I4hHvrh+qUeaDLFbumLla8jIXIX/eWbJSWLQLrP+wG8AS2B9W/mdRmws4Z WXYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oHp6ck0f; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y30-20020a63b51e000000b0053f47561f35si2239496pge.335.2023.05.26.14.02.09; Fri, 26 May 2023 14:02:37 -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=@gmail.com header.s=20221208 header.b=oHp6ck0f; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243227AbjEZUsW (ORCPT + 99 others); Fri, 26 May 2023 16:48:22 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766992073746983569?= X-GMAIL-MSGID: =?utf-8?q?1766992073746983569?= 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: 99657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp745088vqr; Fri, 26 May 2023 13:55:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6n8CGMvg7NaANxcujRlcapXUDwWILbkWUXS1e1mnllAduD9WULGK+xE/p8nNh6RITSaip9 X-Received: by 2002:a05:6a20:7350:b0:102:7c37:aef2 with SMTP id v16-20020a056a20735000b001027c37aef2mr635906pzc.58.1685134558638; Fri, 26 May 2023 13:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685134558; cv=none; d=google.com; s=arc-20160816; b=ixAhxzdeKk7WTqOImbtWnR0tSx3G6rqBdTgPL/iycVYJ6zvHrqeDFKEGYAoxMb/X4g ZotO9ysdJUH4Wuy8g17rqK2zgmQIpSBXaOMBaGdxUT/YXzwuzEuzLp2WBvHsgs8SbwxA Kc+jj1ak4FxILjRvMAItEKwloO9f8yElPP6M0/OUv6iAdP8oH/E1QU3cMCv2ocnAC6qc w+HTaEIdwsjiE1202VlMFynjvIxijP3sEf1WzPaNneih1f6Uk5AOaeyXX4TzfKeoFMwF FN2ekwBu6058SUEcDYFDReBiQ54lQ/Ydv/WXN3zp0fEeO8Q9669xNKvbnycVylaw6ZKp PGHg== 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:date:subject:cc:to:from :dkim-signature; bh=OpOWhP8DxFONC41kTCdHjaq2c0kscoG17qr+mKyv86Y=; b=dT2B4KwSbwi7m2BIpWgPhzb5FicKELAg56S9zoLHtINM/jtdKBCNYMG/46yi7HpvJE eElfUQUeq5Q0jo2AiyXsg/fLNg771S9kV8gACLtWBdHuDT/Jb5hhq31rFnsdG4EqGoE/ meyuQN+oSPloyEkxCruiB8ttOwVKVF4/SiXwBb722Vrp7i+qUGAy5zOPX4v8AQ8wwME7 W/JazLFfgx3pg4moEOMmRdw1cZLAQsJDtaySKSgUIfEL48XrqzJFEX5qTcg1Pp4jVQqZ 44udXw7/1i1915+BEeIHf3ArxBbZbMkBOAnqeXCY5QJZvxp48Zz4oS0VbQtTue4+ZVgm dMMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mfzOVkfq; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a22-20020aa794b6000000b0064d7336c80dsi2358608pfl.385.2023.05.26.13.55.38; Fri, 26 May 2023 13:55:58 -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=@gmail.com header.s=20221208 header.b=mfzOVkfq; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243699AbjEZUs1 (ORCPT + 99 others); Fri, 26 May 2023 16:48:27 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766991655007763804?= X-GMAIL-MSGID: =?utf-8?q?1766991655007763804?= 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: 99659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp746792vqr; Fri, 26 May 2023 14:00:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5fDI0bBTjMkYmiLMoIDXvLpn7mgtZ3q6zBPhfEeqJu9Dx4iilYNuzRnYiXLkXKCEMhtibN X-Received: by 2002:a17:902:b703:b0:1a6:6fe3:df8d with SMTP id d3-20020a170902b70300b001a66fe3df8dmr4140680pls.8.1685134809589; Fri, 26 May 2023 14:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685134809; cv=none; d=google.com; s=arc-20160816; b=kiQCoaOXSqLnI6ITWP7qTMK7UpumSQNdfT/MctIHWH6s48aJki8n/s9FvBlS+RjM2Z fx9GlHXFh8496pTXuBXQVYMvvbunsJQlFbvJ963IO57HetuaVmxOC1qY3830n9e2DrdC E3tKLqip16fqasjuUxpG2Hlt6d3gOk16uzlZbo6HfLa9f1hwpQ6Y58KV2vT77qFoOAJA ZyW34PiJsF1e7yNueG6zpaP9v0moT9eYDm6YV/BAIyMe4K0ITof6iZMTJTWS/6uLQEQV PMtiuWqZF+4IXE4KykpVRk3VnqjobKBGXwDVG+lr5jjbU0WyRXYp7NNIRiFSOkM3KhoW 43zQ== 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:date:subject:cc:to:from :dkim-signature; bh=Nax/DXvV7aPRLv33Egja3ns9F/aEPbpzdpouXsbNQfc=; b=aZXeQR3iDqATMqn4Y7Lq81KWA7DBlWeVhoMvZCqRt+PYqHzK1Hg6Bf6nSDJe0oFoxa tUle9A5H2AyazV3Om51i0Z92Ucn728JpZ5WyUmrsC66itsHd/SFPuXGbKAzJSK5Ndm2R kbfBghVLQpIO0/p3KUSOhPdqU0mwyNklmn5MTXMmGOMRxLWCYcgTnPZbFs+r11l8cmOR Z1YLuzFvEE3XMmcQmOPp9lj4JmJqLOT7TIQHR8h6eyN7f3Te5SYk0AjLC6VNuEfSu3qp OGQLCrX7K8v4spqOcOBv5c83SNIILcJk4wPefv1UPZRlenW2lHNNI7Ho3wJh6LgQggAD 1rcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qErUN8wO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j23-20020a63fc17000000b0053ef3c50929si320681pgi.508.2023.05.26.13.59.51; Fri, 26 May 2023 14:00:09 -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=@gmail.com header.s=20221208 header.b=qErUN8wO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243757AbjEZUsd (ORCPT + 99 others); Fri, 26 May 2023 16:48:33 -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-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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766991917828742593?= X-GMAIL-MSGID: =?utf-8?q?1766991917828742593?= 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: