NFC: Driver: Remove SW WAR to enable NFC Clock

Removed SW WAR to enable NFC Clock, this feature not
required on Pineapple

Change-Id: I118502df98293a48f58569c91444b415076329c4
This commit is contained in:
Khageswararao Rao B
2022-12-13 13:03:02 +05:30
committed by Gerrit - the friendly Code Review server
parent 9f0ff151a7
commit f616cf76bd
4 changed files with 21 additions and 103 deletions

View File

@@ -64,21 +64,16 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
/* some products like sn220 does not required fw dwl pin */
nfc_gpio->dwl_req = of_get_named_gpio(np, DTS_FWDN_GPIO_STR, 0);
/* not returning failure for dwl gpio as it is optional for sn220 */
if ((!gpio_is_valid(nfc_gpio->dwl_req)))
if ((!gpio_is_valid(nfc_gpio->dwl_req))){
pr_warn("%s: nfc dwl_req gpio invalid %d\n", __func__,
nfc_gpio->dwl_req);
/* Read clock request gpio configuration if MGPIO configurations are not preasent */
if (of_property_read_string(np, DTS_CLKSRC_GPIO_STR, &nfc_configs->clk_src_name)) {
nfc_configs->clk_pin_voting = false;
}
/* Read clkreq GPIO pin number from DTSI */
nfc_gpio->clkreq = of_get_named_gpio(np, DTS_CLKREQ_GPIO_STR, 0);
if (!gpio_is_valid(nfc_gpio->clkreq)) {
dev_err(dev, "clkreq gpio invalid %d\n", nfc_gpio->clkreq);
return -EINVAL;
}
}
else {
nfc_configs->clk_pin_voting = true;
}
/* Read DTS_SZONE_STR to check secure zone support */
if (of_property_read_string(np, DTS_SZONE_STR, &nfc_configs->szone)) {
@@ -86,8 +81,8 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
}else
nfc_configs->CNSS_NFC_HW_SECURE_ENABLE = true;
pr_info("%s: irq %d, ven %d, dwl %d, clkreq %d, clk_pin_voting %d \n", __func__, nfc_gpio->irq, nfc_gpio->ven,
nfc_gpio->dwl_req, nfc_gpio->clkreq, nfc_configs->clk_pin_voting);
pr_info("%s: irq %d, ven %d, dwl %d, clkreq %d \n", __func__, nfc_gpio->irq, nfc_gpio->ven,
nfc_gpio->dwl_req, nfc_gpio->clkreq);
/* optional property */
ret = of_property_read_u32_array(np, NFC_LDO_VOL_DT_NAME,
@@ -353,21 +348,9 @@ static int nfc_ioctl_power_states(struct nfc_dev *nfc_dev, unsigned long arg)
nfc_dev->nfc_state = NFC_STATE_NCI;
} 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 */
nfc_dev->cold_reset.is_nfc_enabled = true;
} 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 */
nfc_dev->cold_reset.is_nfc_enabled = false;
} else {
@@ -439,21 +422,12 @@ int nfc_post_init(struct nfc_dev *nfc_dev)
__func__, nfc_gpio->dwl_req);
}
if(!(nfc_configs.clk_pin_voting)){
ret = configure_gpio(nfc_gpio->clkreq, GPIO_INPUT);
if (ret) {
pr_err("%s: unable to request nfc clkreq gpio [%d]\n",
__func__, nfc_gpio->clkreq);
return ret;
}
/* Read clkreq GPIO number from device tree*/
ret = of_property_read_u32_index(nfc_dev->i2c_dev.client->dev.of_node, DTS_CLKREQ_GPIO_STR, 1, &clkreq_gpio);
if (ret < 0) {
pr_err("%s Failed to read clkreq gipo number, ret: %d\n", __func__, ret);
return ret;
}
/* configure clkreq GPIO as wakeup capable */
ret = msm_gpio_mpm_wake_set(clkreq_gpio, true);
if (ret < 0) {
@@ -462,7 +436,6 @@ int nfc_post_init(struct nfc_dev *nfc_dev)
} else {
pr_info("%s clkreq gpio %d successfully setup for wakeup capable\n", __func__, clkreq_gpio);
}
}
ret = nfcc_hw_check(nfc_dev);
if (ret || nfc_dev->nfc_state == NFC_STATE_UNKNOWN) {

View File

@@ -110,7 +110,6 @@
#define DTS_VEN_GPIO_STR "qcom,sn-ven"
#define DTS_FWDN_GPIO_STR "qcom,sn-firm"
#define DTS_CLKREQ_GPIO_STR "qcom,sn-clkreq"
#define DTS_CLKSRC_GPIO_STR "qcom,clk-src"
#define DTS_SZONE_STR "qcom,sn-szone"
#define NFC_LDO_SUPPLY_DT_NAME "qcom,sn-vdd-1p8"
#define NFC_LDO_SUPPLY_NAME "qcom,sn-vdd-1p8-supply"
@@ -237,9 +236,6 @@ struct platform_ldo {
struct platform_configs {
struct platform_gpio gpio;
struct platform_ldo ldo;
const char *clk_src_name;
/* NFC_CLK pin voting state */
bool clk_pin_voting;
const char *szone;
bool CNSS_NFC_HW_SECURE_ENABLE;
};
@@ -284,10 +280,6 @@ struct nfc_dev {
/*secure zone state*/
bool secure_zone;
/* CLK control */
bool clk_run;
struct clk *s_clk;
void *ipcl;
/* function pointers for the common i2c functionality */
@@ -323,8 +315,6 @@ int nfc_ese_pwr(struct nfc_dev *nfc_dev, unsigned long arg);
int nfc_ldo_unvote(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 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_dynamic_protection_ioctl(struct nfc_dev *nfc_dev, unsigned long sec_zone_trans);
bool nfc_hw_secure_check(void);

View File

@@ -162,43 +162,3 @@ int nfc_ldo_unvote(struct nfc_dev *nfc_dev)
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;
}

View File

@@ -432,11 +432,6 @@ int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)
nfc_post_init(nfc_dev);
}
if(nfc_dev->configs.clk_pin_voting)
nfc_dev->clk_run = false;
else
nfc_dev->clk_run = true;
device_init_wakeup(&client->dev, true);
i2c_set_clientdata(client, nfc_dev);
i2c_dev->irq_wake_up = false;