Change-Id: Iac4a6dceb3acae6eb3e838720cd08c412a5b1b6f
This commit is contained in:
Linux Build Service Account
2024-02-22 12:40:18 -08:00
6 fájl változott, egészen pontosan 103 új sor hozzáadva és 29 régi sor törölve

Fájl megtekintése

@@ -7,3 +7,5 @@ define_modules("pineapple", "gki")
define_modules("blair", "consolidate") define_modules("blair", "consolidate")
define_modules("blair", "gki") define_modules("blair", "gki")
define_modules("pitti", "consolidate")
define_modules("pitti", "gki")

Fájl megtekintése

@@ -18,7 +18,7 @@
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* *
*****************************************************************************/ *****************************************************************************/
#include <linux/gpio.h> #include <linux/gpio.h>
@@ -69,12 +69,16 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
pr_warn("NxpDrv: %s: dwl_req gpio invalid %d\n", __func__, pr_warn("NxpDrv: %s: dwl_req gpio invalid %d\n", __func__,
nfc_gpio->dwl_req); nfc_gpio->dwl_req);
} }
/* Read clkreq GPIO pin number from DTSI */ /* Read clock request gpio configuration if MGPIO configurations are not preasent */
nfc_gpio->clkreq = of_get_named_gpio(np, DTS_CLKREQ_GPIO_STR, 0); if (of_property_read_string(np, DTS_CLKSRC_GPIO_STR, &nfc_configs->clk_src_name)) {
if (!gpio_is_valid(nfc_gpio->clkreq)) { nfc_configs->clk_pin_voting = false;
dev_err(dev, "NxpDrv: clkreq gpio invalid %d\n", nfc_gpio->clkreq); nfc_gpio->clkreq = of_get_named_gpio(np, DTS_CLKREQ_GPIO_STR, 0);
return -EINVAL; if (!gpio_is_valid(nfc_gpio->clkreq)) {
} dev_err(dev, "NxpDrv: clkreq gpio invalid %d\n", nfc_gpio->clkreq);
return -EINVAL;
}
} else
nfc_configs->clk_pin_voting = true;
#ifdef NFC_SECURE_PERIPHERAL_ENABLED #ifdef NFC_SECURE_PERIPHERAL_ENABLED
/* Read DTS_SZONE_STR to check secure zone support */ /* Read DTS_SZONE_STR to check secure zone support */
@@ -403,9 +407,21 @@ static int nfc_ioctl_power_states(struct nfc_dev *nfc_dev, unsigned long arg)
nfc_dev->nfc_state = NFC_STATE_NCI; nfc_dev->nfc_state = NFC_STATE_NCI;
} else if (arg == NFC_ENABLE) { } else if (arg == NFC_ENABLE) {
if (nfc_dev->configs.clk_pin_voting) {
/* Enabling nfc clock */
ret = nfc_clock_select(nfc_dev);
if (ret)
pr_err("%s unable to select clock\n", __func__);
}
/* Setting flag true when NFC is enabled */ /* Setting flag true when NFC is enabled */
nfc_dev->cold_reset.is_nfc_enabled = true; nfc_dev->cold_reset.is_nfc_enabled = true;
} else if (arg == NFC_DISABLE) { } else if (arg == NFC_DISABLE) {
if (nfc_dev->configs.clk_pin_voting) {
/* Disabling nfc clock */
ret = nfc_clock_deselect(nfc_dev);
if (ret)
pr_err("%s unable to disable clock\n", __func__);
}
/* Setting flag true when NFC is disabled */ /* Setting flag true when NFC is disabled */
nfc_dev->cold_reset.is_nfc_enabled = false; nfc_dev->cold_reset.is_nfc_enabled = false;
} else { } else {
@@ -478,20 +494,23 @@ int nfc_post_init(struct nfc_dev *nfc_dev)
__func__, nfc_gpio->dwl_req); __func__, nfc_gpio->dwl_req);
} }
/* Read clkreq GPIO number from device tree*/ if (!(nfc_configs.clk_pin_voting)) {
ret = of_property_read_u32_index(nfc_dev->i2c_dev.client->dev.of_node, DTS_CLKREQ_GPIO_STR, 1, &clkreq_gpio); /* Read clkreq GPIO number from device tree*/
if (ret < 0) { ret = of_property_read_u32_index(nfc_dev->i2c_dev.client->dev.of_node,
pr_err("NxpDrv: %s Failed to read clkreq gipo number, ret: %d\n", __func__, ret); DTS_CLKREQ_GPIO_STR, 1, &clkreq_gpio);
return ret; if (ret < 0) {
} pr_err("NxpDrv: %s Failed to read clkreq gipo number, ret: %d\n",
/* configure clkreq GPIO as wakeup capable */ __func__, ret);
ret = msm_gpio_mpm_wake_set(clkreq_gpio, true); return ret;
if (ret < 0) { }
pr_err("NxpDrv: %s Failed to setup clkreq gpio %d as wakeup capable, ret: %d\n", __func__, clkreq_gpio , ret); /* configure clkreq GPIO as wakeup capable */
return ret; ret = msm_gpio_mpm_wake_set(clkreq_gpio, true);
} else { if (ret < 0) {
pr_info("NxpDrv: %s clkreq gpio %d successfully setup for wakeup capable\n", __func__, clkreq_gpio); pr_err("NxpDrv: %s clkreq gpio %d as wakeup capable failed, ret: %d\n",
} __func__, clkreq_gpio, ret);
return ret;
}
}
ret = nfcc_hw_check(nfc_dev); ret = nfcc_hw_check(nfc_dev);
if (ret || nfc_dev->nfc_state == NFC_STATE_UNKNOWN) { if (ret || nfc_dev->nfc_state == NFC_STATE_UNKNOWN) {

Fájl megtekintése

@@ -18,7 +18,7 @@
* *
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*****************************************************************************/ *****************************************************************************/
#ifndef _COMMON_H_ #ifndef _COMMON_H_
#define _COMMON_H_ #define _COMMON_H_
@@ -102,6 +102,7 @@
#define DTS_VEN_GPIO_STR "qcom,sn-ven" #define DTS_VEN_GPIO_STR "qcom,sn-ven"
#define DTS_FWDN_GPIO_STR "qcom,sn-firm" #define DTS_FWDN_GPIO_STR "qcom,sn-firm"
#define DTS_CLKREQ_GPIO_STR "qcom,sn-clkreq" #define DTS_CLKREQ_GPIO_STR "qcom,sn-clkreq"
#define DTS_CLKSRC_GPIO_STR "qcom,clk-src"
#define DTS_SZONE_STR "qcom,sn-szone" #define DTS_SZONE_STR "qcom,sn-szone"
#define NFC_LDO_SUPPLY_DT_NAME "qcom,sn-vdd-1p8" #define NFC_LDO_SUPPLY_DT_NAME "qcom,sn-vdd-1p8"
#define NFC_LDO_SUPPLY_NAME "qcom,sn-vdd-1p8-supply" #define NFC_LDO_SUPPLY_NAME "qcom,sn-vdd-1p8-supply"
@@ -237,6 +238,9 @@ struct platform_ldo {
struct platform_configs { struct platform_configs {
struct platform_gpio gpio; struct platform_gpio gpio;
struct platform_ldo ldo; struct platform_ldo ldo;
const char *clk_src_name;
/* NFC_CLK pin voting state */
bool clk_pin_voting;
const char *szone; const char *szone;
#ifdef NFC_SECURE_PERIPHERAL_ENABLED #ifdef NFC_SECURE_PERIPHERAL_ENABLED
bool CNSS_NFC_HW_SECURE_ENABLE; bool CNSS_NFC_HW_SECURE_ENABLE;
@@ -283,6 +287,10 @@ struct nfc_dev {
/*secure zone state*/ /*secure zone state*/
bool secure_zone; bool secure_zone;
/* CLK control */
bool clk_run;
struct clk *s_clk;
void *ipcl; void *ipcl;
/* function pointers for the common i2c functionality */ /* function pointers for the common i2c functionality */
@@ -318,6 +326,8 @@ int nfc_ese_pwr(struct nfc_dev *nfc_dev, unsigned long arg);
int nfc_ldo_unvote(struct nfc_dev *nfc_dev); int nfc_ldo_unvote(struct nfc_dev *nfc_dev);
int is_nfc_data_available_for_read(struct nfc_dev *nfc_dev); int is_nfc_data_available_for_read(struct nfc_dev *nfc_dev);
int validate_nfc_state_nci(struct nfc_dev *nfc_dev); int validate_nfc_state_nci(struct nfc_dev *nfc_dev);
int nfc_clock_select(struct nfc_dev *nfc_dev);
int nfc_clock_deselect(struct nfc_dev *nfc_dev);
int nfc_post_init(struct nfc_dev *nfc_dev); int nfc_post_init(struct nfc_dev *nfc_dev);
int nfc_dynamic_protection_ioctl(struct nfc_dev *nfc_dev, unsigned long sec_zone_trans); int nfc_dynamic_protection_ioctl(struct nfc_dev *nfc_dev, unsigned long sec_zone_trans);
bool nfc_hw_secure_check(void); bool nfc_hw_secure_check(void);

Fájl megtekintése

@@ -4,7 +4,7 @@
* *
***************************************************************************/ ***************************************************************************/
/* /*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* *
***************************************************************************/ ***************************************************************************/
@@ -162,3 +162,43 @@ int nfc_ldo_unvote(struct nfc_dev *nfc_dev)
return ret; return ret;
} }
/*
* Routine to enable clock.
* this routine can be extended to select from multiple
* sources based on clk name.
*/
int nfc_clock_select(struct nfc_dev *nfc_dev)
{
int r = 0;
nfc_dev->s_clk = clk_get(&nfc_dev->i2c_dev.client->dev, "nfc_ref_clk");
if (IS_ERR(nfc_dev->s_clk))
return PTR_ERR(nfc_dev->s_clk);
if (!nfc_dev->clk_run)
r = clk_prepare_enable(nfc_dev->s_clk);
if (r)
return r;
nfc_dev->clk_run = true;
return r;
}
/*
* Routine to disable clocks
*/
int nfc_clock_deselect(struct nfc_dev *nfc_dev)
{
int r = -EINVAL;
if (nfc_dev->s_clk != NULL) {
if (nfc_dev->clk_run) {
clk_disable_unprepare(nfc_dev->s_clk);
nfc_dev->clk_run = false;
}
return 0;
}
return r;
}

Fájl megtekintése

@@ -30,12 +30,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/ ****************************************************************************/
/* /*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* *
****************************************************************************/ ****************************************************************************/
@@ -435,6 +432,12 @@ int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)
nfc_dev->secure_zone = false; nfc_dev->secure_zone = false;
nfc_post_init(nfc_dev); nfc_post_init(nfc_dev);
#endif #endif
if (nfc_dev->configs.clk_pin_voting)
nfc_dev->clk_run = false;
else
nfc_dev->clk_run = true;
device_init_wakeup(&client->dev, true); device_init_wakeup(&client->dev, true);
i2c_set_clientdata(client, nfc_dev); i2c_set_clientdata(client, nfc_dev);
i2c_dev->irq_wake_up = false; i2c_dev->irq_wake_up = false;

Fájl megtekintése

@@ -12,11 +12,11 @@ endif
########## Build kernel module based on local DLKM flag status ########## ########## Build kernel module based on local DLKM flag status ##########
ifeq ($(NFC_DLKM_ENABLED), true) ifeq ($(NFC_DLKM_ENABLED), true)
ifeq ($(call is-board-platform-in-list, pineapple blair),true) ifeq ($(call is-board-platform-in-list, pineapple blair pitti),true)
BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/nxp-nci.ko BOARD_VENDOR_KERNEL_MODULES += $(KERNEL_MODULES_OUT)/nxp-nci.ko
endif endif
endif endif
ifeq ($(call is-board-platform-in-list, blair),true) ifeq ($(call is-board-platform-in-list, blair pitti),true)
TARGET_ENABLE_PERIPHERAL_CONTROL := false TARGET_ENABLE_PERIPHERAL_CONTROL := false
endif endif