From patchwork Thu May 25 12:09:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13255138 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 8FD7FC7EE33 for ; Thu, 25 May 2023 12:10:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241128AbjEYMKI (ORCPT ); Thu, 25 May 2023 08:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240825AbjEYMKF (ORCPT ); Thu, 25 May 2023 08:10:05 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05D6E7; Thu, 25 May 2023 05:10:01 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-96f6a9131fdso79529366b.1; Thu, 25 May 2023 05:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016600; x=1687608600; 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=e51ZnOfJ1t/HYqAKC9YQAQk0SSWNN6Gcf6eX15qnKverJ5v2wTq1XItzYrgvLb6Jlc nhS13CzXaongQ9ENjk2B1KGf3BvBL2Y0M6y9AlxFM4iysWL6uB9U25VP6lRXdjP5TbTk w2Ct2rt0kxCfGhR50mAp4HILAlPtkxTzsCi5xumrO/Pj/0Y2mkap5gqJyjiK9zj/0XBo 0xReVcHuBoxG9om06U1JiXltUSvNKtm+EWnDUNNtYHCiGVua/zsWiRI8bFRUJ8y4MODi Ss7ewqnkGgO68IVTpCqs4rJL5RTZuzncA2cPhTadyae4YsVGgLL5IIT91uDCAAgsdgaM l2HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016600; x=1687608600; 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=lvAwIzP4RsZXlposbj3n3VSqZvcQ0ewyq43P9BslIyqucnIyUTYfqlbReMQRf411sv AfZzO9j/mcqey+i8VhDga8ae3vxHIVMuJjKUfWpnss+hfeqAK0XB26iieeN5fsSMuIRk 4ywIKtNgBVo0loD+DyC4hjH+jmXb8OF2BARWWNXTSEOwzjTy1qd5kTexC5z41wjfMKO0 TRcAKk1kaiNLFiZsra+V9R5lPwMp+PR6Ucc+kNJn3tQTNHHyHN71njVgMtDhnJ5ah1/6 I7xKgVrbPXN96ucMga2HVdnWfDfrt+/OSsnI5W1a7fW6wK3ZNE5gFLEDTqHXmaPo6HpR DBdA== X-Gm-Message-State: AC+VfDySsFSSMnahpN7MUiD3+VKYVzEefuGtnH7qcDI0C/JI9NEUh5KB frVfwwa7zRzJTKdeskVdoPQ= X-Google-Smtp-Source: ACHHUZ7zIdWYYBbfyJFITOB1FxiDdqR7ygd9FU8331naFjWq13i+5GYuWd8Ym1lSFAJSdAzQNFATPg== X-Received: by 2002:a17:907:3185:b0:957:862a:9e6e with SMTP id xe5-20020a170907318500b00957862a9e6emr1104852ejb.73.1685016599901; Thu, 25 May 2023 05:09:59 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:09:59 -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 v3 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Date: Thu, 25 May 2023 14:09:52 +0200 Message-Id: <20230525120956.3095317-1-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 12:09:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13255136 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 AD853C7EE29 for ; Thu, 25 May 2023 12:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241004AbjEYMKG (ORCPT ); Thu, 25 May 2023 08:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233431AbjEYMKF (ORCPT ); Thu, 25 May 2023 08:10:05 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 306CE10B; Thu, 25 May 2023 05:10:03 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-970028cfb6cso102191866b.1; Thu, 25 May 2023 05:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016601; x=1687608601; 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=FqHt/Go8RthQVhVjmmrUcvTjDhA8Lt3EQbNyl9cwF7Y=; b=S3GoNPHLbgYnGsdrSNuL6+UlC1JIuKVF9MpiMN4jRcFF7V/CzmwFAg2c9va1jd81Sd /Lrou9b+Vy6SKu6FUKz7LsdzGpe2YNdMgBnFVTksylJYs7emkgcB60VNp9KhLNwK87R8 KS4CxbGUd0VkbGEPhIhfDTDvWKyIU8jcEuooWSH5KuWmShhKustnKVr0lJv2ihAStIWY oC5EN5HBo751bZ+xiguCGBJISUX8p1mt5AsJihzbJF8fvY/BXB/WX3xwT/Sur1q2uRNz /gFSNjYti9J1c4fdUPk62Mgt4syJzcjTQu8TQfB9Oj6KdgvEHwJZvWtElGy7a1ekIJpk ZecA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016601; x=1687608601; 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=FqHt/Go8RthQVhVjmmrUcvTjDhA8Lt3EQbNyl9cwF7Y=; b=OZfvNTQbrXLketKx1ci0czCxK05e1L5L4/QGg8dv2mnxtfFeG6VKZcPrDekH/UsGz7 GZCxLplbF0vzIlwItCQfq7UP8lq4NK9tZt8N7r4K5W6qL8ZYuDCnPqdWJY3frJ5YNqZs SjgN58HBG1j6IFDT6Pe/kuRfQrAoVWsj3he5yjM3a5JN/hCYLEZxujKSiWPRY0YezYYn 9KFCcu0KUnOHkj1YOnCR0Jzm8ncSWjCzRrqluNCJWeUoeZPqKnINoCWx+bykb58eCDHU acdlcEzp7F+PWpzAeJBA5AhxG/8ZRa6OEAATo4Kh3NJCy8gn7pWHVzki4SYCFTLdPYrc /7sQ== X-Gm-Message-State: AC+VfDy838y6B25nvNdjPQDm6kLJcwuPLaFKhoQZuzCHr5XxCuNJkh3E o71ZSXPwnb2uqBd/P7AEx/JO5UiIuf68kg== X-Google-Smtp-Source: ACHHUZ6MJNlxGAqqb96I+VPFic8OwNKvy5L6sJPUXDcV7pa2lWtzSibuhR2g6mx5IvFhMJdwJpXL3Q== X-Received: by 2002:a17:907:3da9:b0:966:7a0a:28ae with SMTP id he41-20020a1709073da900b009667a0a28aemr1581658ejc.22.1685016601102; Thu, 25 May 2023 05:10:01 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:00 -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 v3 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Date: Thu, 25 May 2023 14:09:53 +0200 Message-Id: <20230525120956.3095317-2-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 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 12:09:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13255137 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 C0698C7EE2D for ; Thu, 25 May 2023 12:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241122AbjEYMKH (ORCPT ); Thu, 25 May 2023 08:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240814AbjEYMKF (ORCPT ); Thu, 25 May 2023 08:10:05 -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 24D0C12E; Thu, 25 May 2023 05:10:04 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-510eb3dbaaeso4019607a12.1; Thu, 25 May 2023 05:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016602; x=1687608602; 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=QpR8//zxRxGnU7TlHH6wfvPeUzP0bueyOOjz5my8OPQ=; b=JyAUpP40azFAgzu44H45xkrBVGgHg0wB8bsU3WOWhTNG+cQI0cMJ26LU3/XsvYfeK0 FKbYqDbwE4XY2vUOU2q/MjWBaMMiBbCXECzYx8cCZZbC91FfKzpuDOZvkF80oRHD46Yw t+29ULqtPSATjFy6mFjhdLxjG6LwcwA76Tq4hXapj+K7OAB2pac5qXgio8LT8Id7/uLb ApRCPk16QmrF19OQrOhYK9mIQ1GuN5XAtQasOySTutrUCjkJn1FzcrEvdHHeWmUB2JBx jPhU8HNxen/pQx0O50DIo8oz/qC0fq4M/TvIU/OVAEgYRYyHVPrymygIq2F4bgRAd7Hu 4Qbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016602; x=1687608602; 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=QpR8//zxRxGnU7TlHH6wfvPeUzP0bueyOOjz5my8OPQ=; b=YjWbXTnTEZUF1HRm55g8upgvcOWyeZIgOY3Lb070cahCg7pptXWdrvkS18fjtdwfld ElmZcmvjstmgA6Z1oxaT919Pf6OvkMVl8Dk22PaHtvHhGmy69DL1StZbMX5hiN25zC98 2m8PdQpAaNPjBZW5E9cF9gkyDcdNA4c6Q4M7g3mBod5Bd+8mrcZYyGcSJqXMI0Z4gBoV b+75WNeuC6DvsU/ianSLjdeD6enwUVnDL+KfdUES7CpOdTALemBVq+ZVDe7dZLy6yJUt sNPrLdozjYNahMgZcWpf4U8yrsoupsC5o46Oh3Fn5JwVq+QosbxHfcnwHRBrYG9ZJFsA e4lQ== X-Gm-Message-State: AC+VfDzGJMwEB2R6VdrOAFD3iqHZiHH2J4hs4uHIzZcTrQzWwtSDEVIR unemRQqnhjexwwUM9CrUM2Y3VM+1eemvwA== X-Google-Smtp-Source: ACHHUZ5aBde6tPLcqBDGHfEVvTLRdXHQJIeSYsVLxQ3Nb++kc357mWQ9s7DWheGjMzk0r4XiWUhcng== X-Received: by 2002:a17:906:9b95:b0:96f:1f79:c0a6 with SMTP id dd21-20020a1709069b9500b0096f1f79c0a6mr1186172ejc.70.1685016602362; Thu, 25 May 2023 05:10:02 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:01 -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 v3 3/5] soc: qcom: smem: introduce qcom_smem_get_msm_id() Date: Thu, 25 May 2023 14:09:54 +0200 Message-Id: <20230525120956.3095317-3-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 v3: * Change export to EXPORT_SYMBOL_GPL * Use an argument for returning SoC ID * Update kerneldoc --- drivers/soc/qcom/smem.c | 24 ++++++++++++++++++++++++ include/linux/soc/qcom/smem.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index bc98520c4969..185ed0da11a1 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,29 @@ phys_addr_t qcom_smem_virt_to_phys(void *p) } EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys); +/** + * qcom_smem_get_msm_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_msm_id(u32 *id) +{ + size_t len; + struct socinfo *info; + + info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, &len); + if (IS_ERR(info)) + return PTR_ERR(info); + + *id = info->id; + + return 0; +} +EXPORT_SYMBOL_GPL(qcom_smem_get_msm_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..cb204ad6373c 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_msm_id(u32 *id); + #endif From patchwork Thu May 25 12:09:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13255139 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 999D1C7EE37 for ; Thu, 25 May 2023 12:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233431AbjEYMKJ (ORCPT ); Thu, 25 May 2023 08:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240900AbjEYMKG (ORCPT ); Thu, 25 May 2023 08:10:06 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4324813A; Thu, 25 May 2023 05:10:05 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-96f683e8855so82446066b.2; Thu, 25 May 2023 05:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016604; x=1687608604; 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=GOUtwfzPxtELqg3Ri36VE60/4NTg/iDdprk4djIdIXaitecB7GeUQUitlaVHTKL3FG WvY9g097lOTq9vdGSb4bKKl2GAyda+Blrko6ZYKOpF+LCPzWieRXvRbpi5sHHs5uwzSR vJPf7S6U+DxcRKRxLMGPBX2DT6keND7DbBTs0THzj1YqW9IZVZAXbqg6FOvP2VLA7uim nCSoxfVTf/HhHidvPFjOg5IiXQZ+buZh59Ns1yzOtbo4dvguBXUTUfx2M6Arab3R4Avh lMW7pQce1DzjwBxycTv4lgNTeUjR5JDQfvlYDRyYWfYGG0WxkjF9Kx+5a/Xo2EE1T1q/ 4WXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016604; x=1687608604; 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=VobwFHxlTsEnQYlCfkcxftQFhuimHWrnnSCKajTFQEmBbJooz3jje1tq/thuGQdvU0 W73GAwnkMyEmvcDnAjhqQDMVJlcGoKITIUm5HCoc5CcVh6ax5uPyhSVnFFhEVV7VvdoS 1Ao7Ryi8a9VMiwAqEPsI3sTUWx2h+2wWrrI4J3kz4s4GgplBxssJJFD7x2IifdW80PVk R/VZhubSsHcVdIqpu+TV7qwuG0Wc5+R7k7vzRYuRydnqy9s7xRFXFzuPdw1nuzUK5bSQ mzXsSsbIiOXbuNhogWfkYd6AjUSpffcM27vcmWAU6hW3ztSzGwmEo5qgVI/IwzZD+kwV +8Xw== X-Gm-Message-State: AC+VfDxJo3SvkkIik1xgFCKfKf0mQe2qthPnFyzvz6zj6nmg63szL3Ih mny03eCptWnKEM6lZdJbPJI= X-Google-Smtp-Source: ACHHUZ50n76LIZs5UAkNr6F2AbByhk+nIMIaLjRQ81Lo8S/DtZSCxZNV9AALDZRRc2ID3xJQ4T4hcQ== X-Received: by 2002:a17:907:948f:b0:967:769e:a098 with SMTP id dm15-20020a170907948f00b00967769ea098mr1209262ejc.15.1685016603673; Thu, 25 May 2023 05:10:03 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10:03 -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 v3 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Date: Thu, 25 May 2023 14:09:55 +0200 Message-Id: <20230525120956.3095317-4-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 12:09:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 13255140 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 411C9C7EE29 for ; Thu, 25 May 2023 12:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241140AbjEYMKJ (ORCPT ); Thu, 25 May 2023 08:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241125AbjEYMKH (ORCPT ); Thu, 25 May 2023 08:10:07 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A39049C; Thu, 25 May 2023 05:10:06 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-50bcb229adaso3994505a12.2; Thu, 25 May 2023 05:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685016605; x=1687608605; 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=KB+lfwPJ6+4o7RQeb0vcEyQtsD+Ddm0kRPNNohX3Hqg=; b=aCPHY8Fs8pUtdIZyoS5xQc5KsAKrLdSygCXYe7EdcX7jFgGe4AnK2V0jHWkDWUMhmn 3ByfK1HqA+mP4Qjm849pr8uuOZcmhGLQmAb6BvYNag82EwrjeqdaguPE/ZpBbw4abXME 2TG8zAUVO0H/xET1u6qut9MwCC9GNbdNzzNFkJycJx7mn8pvjBy6lFlMAtKWaOWxa58O BC4alUtagV93NyVx3njWgKkqE2CC2/Ryht4CteXWfYs0oCHvckxiJEl8ag9Hgk7QVTTE Qz8EN6lcfUc/RKJqnyXM+GPjzX4gBVXgFgoIs2UMjbbz1r+XXTSkEwZRPcGaiG+TxiFO nT8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685016605; x=1687608605; 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=KB+lfwPJ6+4o7RQeb0vcEyQtsD+Ddm0kRPNNohX3Hqg=; b=hjiNADUx0tK8XKfRsHuB+8t5CPKGatXyGFZWah0aZtQhyl6fISPrjb1HHZlEC4GIo9 9+yyudN2ZTuZc5WAYMqFLtvGUroq98yJ9cZrWCnYQpcCVh7mzenBzd6/3kWa4dwGyqx6 5tW2KpvodcF6PM74fTCHnyrdgb0DHekKrsu2soImDdva4NuzrjRb1F6EbeiV0GDu+Xpq DrhSdgmdyBopCSeN1uP2KcJZjihjnFr+ZdFzQCXynSTYr3mAKs7SADXSWMo0DyfoupT0 hll/soheyQELtqwkyrlkGn+omEEIeGryKsbtIZh+rtJFKHTbWAAmir9cBk+nN4sodsgz mH8w== X-Gm-Message-State: AC+VfDxa3/TA8xo8XF0tavo3r7h1EQtg0N1Zf4dUtveym5lJNr91Nsx3 n5/Ij2WGcCWW8OmgXAvItCQ= X-Google-Smtp-Source: ACHHUZ62HXKiBvds6Zc2xBIvzq0omQBhvCqoCbi+RzXy6Zb5ylUSSbcge4HU2Xvl9/faCsrkEXBgLg== X-Received: by 2002:a17:906:6a2a:b0:961:be96:b0e6 with SMTP id qw42-20020a1709066a2a00b00961be96b0e6mr1631797ejc.68.1685016604848; Thu, 25 May 2023 05:10:04 -0700 (PDT) Received: from fedora.. ([213.149.38.146]) by smtp.googlemail.com with ESMTPSA id d5-20020a170906640500b0094ef923a6ccsm765216ejm.219.2023.05.25.05.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 05:10: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 v3 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Date: Thu, 25 May 2023 14:09:56 +0200 Message-Id: <20230525120956.3095317-5-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230525120956.3095317-1-robimarko@gmail.com> References: <20230525120956.3095317-1-robimarko@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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_msm_id(). Signed-off-by: Robert Marko Acked-by: Viresh Kumar --- 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..ba001ebcba11 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_msm_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: