From patchwork Thu May 25 21:02:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 685790 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 023B0C7EE29 for ; Thu, 25 May 2023 21:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233039AbjEYVCt (ORCPT ); Thu, 25 May 2023 17:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbjEYVCt (ORCPT ); Thu, 25 May 2023 17:02:49 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF1C7E4A; Thu, 25 May 2023 14:02:18 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-510b4e488e4so5337770a12.3; Thu, 25 May 2023 14:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048537; x=1687640537; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rcZFua0EILx4UgL94m890/UaW7590iqXfYJZcRYRhjI=; b=plLBOrfRRrLKTFd8DM3UtUZCksznD4j1oAjH6MqevOs+L5cZ2wiRB2GqjLwGlXX6CU zlq/wrvABrF5J+hz83++55KphZPp8sE7CdQAoSm6FT+PUVOpVjXnir2nZdeFGvPughRg 2MLlfji2K6QX1B0vrgTYGxLV1yAdNcLbFgurysJcCEWMjybmRxOLooanzucfImdJy61S WgTOOkrglebpKpewgbAxJMEMq7DBol+G1d9VWWnhXzXcOc5BW6kYJ39/QJfUsx8U4kEc UTgZ3r/cYSyJ2PCM0eiEBZMzVK3OF77T/TZu2noiU+jDMOXoyjKjDh5oX2LxBB56sB2K XAfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048537; x=1687640537; 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=rcZFua0EILx4UgL94m890/UaW7590iqXfYJZcRYRhjI=; b=lV333o6mHMOrPW48H/hsrfZndG3VdhWJWSgAhz+46Ph4uOdut/DvG1egE+t4DJKYl+ 5GdGJxufL1aYt64TlxgpnTzpXaam2H9PTgd0fnguYuoGozzI+3qlNZc0jFW0Ehmq794H 0xt9Izf3fNXJX3f3H4/irPV7E8rQvBut+w1Vjn/B2GJOXJNUVr6kdzQyFZ8HswW2OXli J1TWkDwRsacOrGLi47pCLrEtHQSVwu7xYNPozaHZqMNIpCDWGD45Wchr7C021JdvmELr PIndDBvLGQ5iVP6dklqXBCnqyVlaExiFRq4akMV4slT24ZWyAb0iUnhf8wB3KeMXxekx Ab0g== X-Gm-Message-State: AC+VfDxYqRWQ0QxBqY/sgrrmptY5VgDWpNTbk0dSlHhfLvYPFUnl+dpm BYT1/Xoc+5kCqJxwAbjF7bvpBi/bkPA0Ag== X-Google-Smtp-Source: ACHHUZ4MAbNqROgew6250c1ibcAAraJFBK02li4jq/olWHmtGNQk+ySTPiowvkaMBK/HGQZ9q4HS5Q== X-Received: by 2002:aa7:d451:0:b0:50b:caac:d25 with SMTP id q17-20020aa7d451000000b0050bcaac0d25mr5303932edr.34.1685048536956; Thu, 25 May 2023 14:02:16 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id c25-20020aa7df19000000b0050e04125a46sm913010edy.10.2023.05.25.14.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:02:16 -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 v4 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Thu, 25 May 2023 23:02:10 +0200 Message-Id: <20230525210214.78235-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 --- 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 Thu May 25 21:02:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 686335 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 5E939C77B7E for ; Thu, 25 May 2023 21:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234890AbjEYVCu (ORCPT ); Thu, 25 May 2023 17:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233368AbjEYVCt (ORCPT ); Thu, 25 May 2023 17:02:49 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F76E4C; Thu, 25 May 2023 14:02:20 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-510b6a249a8so5360954a12.0; Thu, 25 May 2023 14:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048538; x=1687640538; 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=zQfAznflSLQf5yGCCk12QztHSZl1wyJLiF++XZ+fpqM=; b=Q6yzT5KjUTw2Kvb/+1ZiCaQtT68GkF15Rclvk+ZChtF5UuT6yBjqpNtk4tAIEy1J3v SCMhzJVdCF2mFGm0WlqcI+PGxi0Eqfg07So7MZOpYLEEWR0H2Ysd1Zz5ZzX8Pxpfm/ru LhBQcK/089X1lzaVcRpGd/Yo1geFq0D4gxtDEpeQfGzDjxDEKFJB7LTC1OM8yZ2TEKvY W0uzh/A8sln20dpmz2liUljdHPLTsXUMbjw4pZeq/WhOejgyK/C0CH6nL+XXzMXnXgW4 bT29B89cRUvR8pv8CaNr4XDbRhJ4XA4E+h6SthGtvi44QnDe35pEBLjHOpsRH8ihJ+ho jJ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048538; x=1687640538; 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=zQfAznflSLQf5yGCCk12QztHSZl1wyJLiF++XZ+fpqM=; b=gzxL53GhhA4O8KP5jd5Hr3+bfHUp39IVrd5SId9ZiQg+4P5jIqCqK8mwc+99SU3Bh+ JXj7wKvjbkz6mQ+7L2kJW4TbGmk3Wz3ntqODxELMzb+euVpVopg2OU5rrtJFGqfcYayA twh/NgOTgJiFHnLJElX383q1LT/3FPZta8rkVVr7NgYiJGkSUq8nsgTaQTzvaidWMp5M efWjmEsbLvL2BQj0KmR7MJcBTy6CoIe6NlMe1TvUKg4/yaqfTVTz24Y6pjl8MyzR1SeK Ut+GSjuj7ikVi5KQWcBguMJ1vTVZy/JC3/2+/cW4tGT1Q/bzohxOtJdL2icbmh2CBGlL 55aw== X-Gm-Message-State: AC+VfDxdxfDB/5n2QNPe4EnBTaQGLwuBMltD8tuzSLhiFRCg5piAZdJ2 thGNPFwd2HIUUtOmUCL45Q36rVcufYk1ig== X-Google-Smtp-Source: ACHHUZ5aI1Mmu2w4k+jIIe0GcOpYfhFK3+q4TwdrOjaA5r/8+1YW5zWLFXuOefXE6CFZRH8aL7wxeQ== X-Received: by 2002:aa7:da44:0:b0:50b:c308:7b4f with SMTP id w4-20020aa7da44000000b0050bc3087b4fmr4881715eds.17.1685048538262; Thu, 25 May 2023 14:02:18 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id c25-20020aa7df19000000b0050e04125a46sm913010edy.10.2023.05.25.14.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:02:17 -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 v4 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Date: Thu, 25 May 2023 23:02:11 +0200 Message-Id: <20230525210214.78235-2-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525210214.78235-1-robimarko@gmail.com> References: <20230525210214.78235-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 Thu May 25 21:02:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 685789 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 DD511C7EE37 for ; Thu, 25 May 2023 21:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240798AbjEYVCv (ORCPT ); Thu, 25 May 2023 17:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234025AbjEYVCu (ORCPT ); Thu, 25 May 2023 17:02:50 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4FCF199; Thu, 25 May 2023 14:02:21 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-510e419d701so5687375a12.1; Thu, 25 May 2023 14:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048539; x=1687640539; 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=zQtz6v7Hj5j1tfmowjTsEjjYvDTSsmx54tvIW02KIzE=; b=BgR3QBvaOti23Wx+ddMulO5QO8k+UajcZBC+FwQS8tgAsD9oUdoxRDNQQAO2/N5O/E m40TonwXHFwM0FmymmxGGxAQAKadR69sfcEmx5N5HhCIXPN9sizvgHc29El4F8fJnJvy DNM+k/WW93t6ya/5ha1gLvxaK5o/YxFo+Xn6Hn/Ze2qQJyr2M8clRAqDt3DxZJbz0g6k 4VVuruCe8TK84SvDrOQ0nRHzBkco4CUeszGDYD2sfzXIwyXmPycEzWVSsIgDGRosYSvi sxVZFPHXKaYos7wapvAVp9xLgwiGCf5dMblMznYTR9q1cSkocYb/HnpKBIGi1ECyzHc8 B30w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048539; x=1687640539; 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=zQtz6v7Hj5j1tfmowjTsEjjYvDTSsmx54tvIW02KIzE=; b=kuWDbUcwoe7t1Cq0w2TtESDV3DJY80c8hFNg+ltg0ps2xQSdrd1KLz1PRZ29FN8XUV D+slVfzpEmV/sVtMx6a8k+ilmWACBDHMtEOqJcDDQAAZwky6LE2XYN4PHRwmVdkNIVCT RrhMRgNCZT1O3L9QrzV6zpwC+0iFbk2NI2D1mN69JAk+SO5zHoHlXxvX9Fyhzay6x2ST FHa1ltLhyXtGh7ODz0M1VvZUWGy3S99JDrkjE2e96NIQn/XVZ3LuY8D1NcZy2WlHvroz /kNS9DEfo7dUSKoAdzJyhgZwROPwAthbDXw1DPyEh02848NSeCyKER8aRTCEBGWbrwYO ir3A== X-Gm-Message-State: AC+VfDxfuCWxh5QSiBmPcoW6UOFdgkYwNqC6Xs2BMa9hdTpYoyCsC6Ol jI5wQxNLL181iBgg2D9ZXWE= X-Google-Smtp-Source: ACHHUZ4hUXusKtbwX40uslNL/odfRfMKq3ncRSrLNqdQUnhQNCdanji0hT9vGkn42s0sCkPb4I/kVg== X-Received: by 2002:aa7:c688:0:b0:510:dd3e:86cd with SMTP id n8-20020aa7c688000000b00510dd3e86cdmr5994877edq.20.1685048539533; Thu, 25 May 2023 14:02:19 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id c25-20020aa7df19000000b0050e04125a46sm913010edy.10.2023.05.25.14.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:02:19 -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 v4 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Date: Thu, 25 May 2023 23:02:12 +0200 Message-Id: <20230525210214.78235-3-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525210214.78235-1-robimarko@gmail.com> References: <20230525210214.78235-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 --- 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) +{ + 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 From patchwork Thu May 25 21:02:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 686334 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 5EBBDC77B7A for ; Thu, 25 May 2023 21:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241661AbjEYVCw (ORCPT ); Thu, 25 May 2023 17:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239074AbjEYVCu (ORCPT ); Thu, 25 May 2023 17:02:50 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51DC4E44; Thu, 25 May 2023 14:02:22 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-510d9218506so364114a12.1; Thu, 25 May 2023 14:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048541; x=1687640541; 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=L5qtNbh7SdIzNNd/mBEdxZ2FXrZxraKRbC9vv+2cZMYlTmN7Fw6x3ZZh8YM1dv7Ph7 p7U9cm8tug0+kmBTUGpROeRlg9SQ+zQrkOA7Q+nCnYFjvjAzinqVRdt0nuQ3zWkY7yXi pS6MyLZAPaE6r0wjH7214ik//1ggheBqo477uQ7HCrMQJKPrPQ0gLP5a3M1YEILYYfOq UeXBCiebcgRS5HxKLa/4Ey7PIZRHuOOO/ysrqZ3KY6Z0ZuxkHB9WoXRkVLLPN59pWqGM wWPda2nzJiJMMzmzPCapojuwVHmgxg3Y0R14PE7Jp0+Kn2aGdoBX1LE2RuqvxHVyhlCY 3uuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048541; x=1687640541; 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=MjCBH4TgaXK36YE+LzyQdtd5CxlfH7bek91Q1Qeyw0fKZBe61C/eUZlkcLsDOyMms6 WaOqlR2Qhg+QIiILJ4eXAtWaVD3WLne9sOTaxIdr8rcznHitFnTlsGPKrvS3B6HtPEPt V+nohXMMEETPKTGtZZvNZNKfrJ8tg9eEWIBGFAcv9FfoK6sTQ6m0oZkXfTiXiwc8STbc H+i0fP4KjFj9+pQnqIr57hLkT2Q6XCer4wFta9qVrsA1ajcDCcVGDKjVzx6kC+e1DWv3 4EqJFBUL8Qn8X0FQI7Oe35g/MwE6wVM6BbY0WUTPnq8Vqu4mJxHv44qC9l33V67IH0dz DBGA== X-Gm-Message-State: AC+VfDyRzIwrPkk8V3xqB/ahvbRHfjdVHKR2OCs5rtOLX9+g2T+mjy6h cmRUtiWpWUqtpcHTcbIozuI= X-Google-Smtp-Source: ACHHUZ7cokGVc2W2zOPV2XYF80y64Q7vf/pSMINHzih9EoZmNvIAe4flYuau5K4CTTJCEgtdbO9XBg== X-Received: by 2002:aa7:d687:0:b0:50d:a804:423 with SMTP id d7-20020aa7d687000000b0050da8040423mr4007864edr.10.1685048540688; Thu, 25 May 2023 14:02:20 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id c25-20020aa7df19000000b0050e04125a46sm913010edy.10.2023.05.25.14.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:02:20 -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 v4 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Date: Thu, 25 May 2023 23:02:13 +0200 Message-Id: <20230525210214.78235-4-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525210214.78235-1-robimarko@gmail.com> References: <20230525210214.78235-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 Thu May 25 21:02:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 685788 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 57158C7EE39 for ; Thu, 25 May 2023 21:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241424AbjEYVCx (ORCPT ); Thu, 25 May 2023 17:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240717AbjEYVCu (ORCPT ); Thu, 25 May 2023 17:02:50 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 703901BC; Thu, 25 May 2023 14:02:23 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-510e90d785fso4624132a12.2; Thu, 25 May 2023 14:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048542; x=1687640542; 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=OXlXgQBpb4u1NkgDV1i/lhd5SbJunSLkTu8PXxsmdD/qe3nhjw5uMPXdtO7SsuZuze 5aR2XJx485G4YoTtB2RfnVfRgHMqaWGN6h5ofCax4MsfC3ZHQM8X+V6y0gB4Gp9FC+z2 XWawyGXLQfSCfT/IBo7/IveX5L/HPWg6swPJ+YcFGUsB8uWzMmE8wMUYo09FInaizaBo pOhXUK2gDeiX7CN546KLvqM0tYgm5+GsyHlbAkrjPXsnE1obyAh+OcbZfV6+T1bX2l9a N8ZDhmC+gshiqcnN8p7Y3UxmR0ce/UloMo6Jkb+qIqLK9jfU+nTQwAidJMawm6KX+Jck g6BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048542; x=1687640542; 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=KSVdbeIJYQ8u0YeWcUTuAy7Iyi6oMgcCs1eUpUGHDs5y7OnK7ffIbkrQ365LE4ma/q XlvSjRrn7p/MmTO14YmuHN3RNyS1SjzZuCE+g/RFHCCct6VHfXCYtW2+KZ+9JncW+2dY 6NOer+xd7mj5h0u3l/stT3IyK46JsCy1L8TXgcaXGmHcHIhU4aTpHs8hCZoCI166tjPL CE4b5JinW2vF2o1DIiAWma+Dpu71boO5kWn2MBKX4AQ9TGP2sX1gKXg5JmrdTv4CM7gj sLtnP/ahX5n0zPucS7zuyj6AWIGzSFP4WfCWVfWdtdczZWibHo9wNLOxX1e4GVlbQnf5 L8BA== X-Gm-Message-State: AC+VfDycBH+a5Mzmk5a9b48yr/7CgXZEX9/YNK99UNgRAFthDugTiYko 4MUa8xkW0Qq9l8+qUuo1ZmocHSNtDt+1Og== X-Google-Smtp-Source: ACHHUZ7kUlaXG8xtEFiebNPJ+ek33dTWoMyKVbou1e43+fOvN6gaFkMdKNUCudgXYcE3kK6WPAY8Yg== X-Received: by 2002:a05:6402:10d0:b0:504:894b:1bc9 with SMTP id p16-20020a05640210d000b00504894b1bc9mr5340222edu.26.1685048541916; Thu, 25 May 2023 14:02:21 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id c25-20020aa7df19000000b0050e04125a46sm913010edy.10.2023.05.25.14.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:02:21 -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 v4 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Date: Thu, 25 May 2023 23:02:14 +0200 Message-Id: <20230525210214.78235-5-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525210214.78235-1-robimarko@gmail.com> References: <20230525210214.78235-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 --- 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: