NFC: Driver: Add clock request gpio configurations
Added clock request gpio configuration for kalama R2. Change-Id: I61fe3e0d252e7b6bacd8be437725430d0c7def8e
This commit is contained in:
24
nfc/common.c
24
nfc/common.c
@@ -45,6 +45,7 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
|
|||||||
nfc_gpio->irq = -EINVAL;
|
nfc_gpio->irq = -EINVAL;
|
||||||
nfc_gpio->dwl_req = -EINVAL;
|
nfc_gpio->dwl_req = -EINVAL;
|
||||||
nfc_gpio->ven = -EINVAL;
|
nfc_gpio->ven = -EINVAL;
|
||||||
|
nfc_gpio->clkreq = -EINVAL;
|
||||||
|
|
||||||
/* irq required for i2c based chips only */
|
/* irq required for i2c based chips only */
|
||||||
if (interface == PLATFORM_IF_I2C) {
|
if (interface == PLATFORM_IF_I2C) {
|
||||||
@@ -67,16 +68,21 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
|
|||||||
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__,
|
pr_warn("%s: nfc dwl_req gpio invalid %d\n", __func__,
|
||||||
nfc_gpio->dwl_req);
|
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)) {
|
if (of_property_read_string(np, DTS_CLKSRC_GPIO_STR, &nfc_configs->clk_src_name)) {
|
||||||
nfc_configs->clk_pin_voting = false;
|
nfc_configs->clk_pin_voting = false;
|
||||||
|
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 {
|
else {
|
||||||
nfc_configs->clk_pin_voting = true;
|
nfc_configs->clk_pin_voting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_info("%s: irq %d, ven %d, dwl %d\n", __func__, nfc_gpio->irq, nfc_gpio->ven,
|
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->dwl_req, nfc_gpio->clkreq, nfc_configs->clk_pin_voting);
|
||||||
|
|
||||||
/* optional property */
|
/* optional property */
|
||||||
ret = of_property_read_u32_array(np, NFC_LDO_VOL_DT_NAME,
|
ret = of_property_read_u32_array(np, NFC_LDO_VOL_DT_NAME,
|
||||||
@@ -188,6 +194,9 @@ void gpio_free_all(struct nfc_dev *nfc_dev)
|
|||||||
{
|
{
|
||||||
struct platform_gpio *nfc_gpio = &nfc_dev->configs.gpio;
|
struct platform_gpio *nfc_gpio = &nfc_dev->configs.gpio;
|
||||||
|
|
||||||
|
if (gpio_is_valid(nfc_gpio->clkreq))
|
||||||
|
gpio_free(nfc_gpio->clkreq);
|
||||||
|
|
||||||
if (gpio_is_valid(nfc_gpio->dwl_req))
|
if (gpio_is_valid(nfc_gpio->dwl_req))
|
||||||
gpio_free(nfc_gpio->dwl_req);
|
gpio_free(nfc_gpio->dwl_req);
|
||||||
|
|
||||||
@@ -420,6 +429,15 @@ int nfc_post_init(struct nfc_dev *nfc_dev)
|
|||||||
__func__, nfc_gpio->dwl_req);
|
__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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
pr_err("nfc hw check failed ret %d\n", ret);
|
pr_err("nfc hw check failed ret %d\n", ret);
|
||||||
|
@@ -103,6 +103,7 @@
|
|||||||
#define DTS_IRQ_GPIO_STR "qcom,sn-irq"
|
#define DTS_IRQ_GPIO_STR "qcom,sn-irq"
|
||||||
#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_CLKSRC_GPIO_STR "qcom,clk-src"
|
#define DTS_CLKSRC_GPIO_STR "qcom,clk-src"
|
||||||
#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"
|
||||||
@@ -204,6 +205,7 @@ enum gpio_values {
|
|||||||
struct platform_gpio {
|
struct platform_gpio {
|
||||||
unsigned int irq;
|
unsigned int irq;
|
||||||
unsigned int ven;
|
unsigned int ven;
|
||||||
|
unsigned int clkreq;
|
||||||
unsigned int dwl_req;
|
unsigned int dwl_req;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user