mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
integrate samsung RN4V NFC driver
integrate samsung RN4V NFC driver this driver support RN4V and SN4V Change-Id: Ibea9dcded110f0d058fcbc84516912a1be9d1915 Signed-off-by: Yunxian He <heyx6@motorola.com> Reviewed-on: https://gerrit.mot.com/2533690 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
53ad4b3fb9
commit
bf8cede7f6
6 changed files with 1372 additions and 0 deletions
|
|
@ -59,6 +59,7 @@ source "drivers/nfc/st-nci/Kconfig"
|
|||
source "drivers/nfc/nxp-nci/Kconfig"
|
||||
source "drivers/nfc/s3fwrn5/Kconfig"
|
||||
source "drivers/nfc/st95hf/Kconfig"
|
||||
source "drivers/nfc/samsung/Kconfig"
|
||||
endmenu
|
||||
|
||||
config NFC_QTI_I2C
|
||||
|
|
|
|||
|
|
@ -17,4 +17,5 @@ obj-$(CONFIG_NFC_ST_NCI) += st-nci/
|
|||
obj-$(CONFIG_NFC_NXP_NCI) += nxp-nci/
|
||||
obj-$(CONFIG_NFC_S3FWRN5) += s3fwrn5/
|
||||
obj-$(CONFIG_NFC_ST95HF) += st95hf/
|
||||
obj-$(CONFIG_SEC_NFC) += samsung/
|
||||
obj-y += qti/
|
||||
|
|
|
|||
67
drivers/nfc/samsung/Kconfig
Normal file
67
drivers/nfc/samsung/Kconfig
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#
|
||||
# Near Field Communication (NFC) devices
|
||||
#
|
||||
|
||||
menu "Near Field Communication (NFC) devices"
|
||||
depends on NFC
|
||||
|
||||
config SEC_NFC
|
||||
tristate "Samsung NFC driver"
|
||||
default m
|
||||
help
|
||||
SAMSUNG NFC Driver.
|
||||
This driver provides support for SAMSUNG NFC products.
|
||||
You should select your NFC product and interface.
|
||||
|
||||
Say Y here to compile support for SAMSUNG NFC driver into the
|
||||
kernel.
|
||||
|
||||
choice
|
||||
prompt "SEC NFC Products"
|
||||
depends on SEC_NFC
|
||||
default SEC_NFC_PRODUCT_N5
|
||||
config SEC_NFC_PRODUCT_N3
|
||||
bool "RN3"
|
||||
config SEC_NFC_PRODUCT_N5
|
||||
bool "RN5/RNx"
|
||||
endchoice
|
||||
choice
|
||||
prompt "SEC NFC Interface"
|
||||
depends on SEC_NFC
|
||||
default SEC_NFC_IF_I2C
|
||||
config SEC_NFC_IF_UART
|
||||
bool "UART"
|
||||
config SEC_NFC_IF_I2C
|
||||
bool "I2C"
|
||||
config SEC_NFC_IF_I2C_GPIO
|
||||
bool "I2C-GPIO (S/W-I2C)"
|
||||
select I2C_CHARDEV
|
||||
select I2C_MUX
|
||||
select I2C_MUX_GPIO
|
||||
select I2C_ARB_GPIO_CHALLENGE
|
||||
select I2C_ALGOBIT
|
||||
select I2C_GPIO
|
||||
endchoice
|
||||
config SEC_NFC_GPIO_CLK
|
||||
bool "SEC NFC GPIO CLK"
|
||||
default n
|
||||
help
|
||||
SAMSUNG NFC CLR REQ feature.
|
||||
This feature provides support for SAMSUNG NFC products.
|
||||
You should select this feature if your NFC product uses AP CLK.
|
||||
|
||||
Say Y here to compile support for SAMSUNG NFC CLK REQ feature into the
|
||||
kernel.
|
||||
config SEC_NFC_DEDICATED_CLK
|
||||
tristate "SEC NFC DEDICATED CLK"
|
||||
default m
|
||||
config SEC_NFC_LDO_EN
|
||||
tristate "SEC NFC LDO"
|
||||
default m
|
||||
config SEC_NFC_PMIC_LDO
|
||||
tristate "SEC NFC PMIC LDO"
|
||||
default m
|
||||
config SEC_ESE_COLDRESET
|
||||
tristate "eSE Cold reset"
|
||||
default m
|
||||
endmenu
|
||||
7
drivers/nfc/samsung/Makefile
Normal file
7
drivers/nfc/samsung/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# Makefile for Samsung NRNx NFC driver
|
||||
#
|
||||
|
||||
obj-$(CONFIG_SEC_NFC) += sec_nfc.o
|
||||
|
||||
ccflags-$(CONFIG_NFC_DEBUG) := -DDEBUG
|
||||
1154
drivers/nfc/samsung/sec_nfc.c
Normal file
1154
drivers/nfc/samsung/sec_nfc.c
Normal file
File diff suppressed because it is too large
Load diff
142
drivers/nfc/samsung/sec_nfc.h
Normal file
142
drivers/nfc/samsung/sec_nfc.h
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* SAMSUNG NFC Controller
|
||||
*
|
||||
* Copyright (C) 2013 Samsung Electronics Co.Ltd
|
||||
* Author: Woonki Lee <woonki84.lee@samsung.com>
|
||||
* Author: Heejae Kim <heejae12.kim@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Last update: 2016-01-14
|
||||
*/
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#ifdef CONFIG_SEC_NFC_GPIO_CLK
|
||||
#include <linux/clk.h>
|
||||
#endif
|
||||
#ifdef CONFIG_SEC_NFC_PMIC_LDO
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/err.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SEC_NFC_I2C /* support old driver configuration */
|
||||
|
||||
#ifndef CONFIG_SEC_NFC
|
||||
#define CONFIG_SEC_NFC
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SEC_NFC_IF_I2C) && !defined(CONFIG_SEC_NFC_IF_UART)
|
||||
#define CONFIG_SEC_NFC_IF_I2C
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_SEC_NFC_PRODUCT_N3) && !defined(CONFIG_SEC_NFC_PRODUCT_N5)
|
||||
#define CONFIG_SEC_NFC_PRODUCT_N3
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SEC_NFC_I2C */
|
||||
|
||||
#define SEC_NFC_DRIVER_NAME "sec-nfc"
|
||||
|
||||
#define SEC_NFC_MAX_BUFFER_SIZE 512
|
||||
|
||||
/* ioctl */
|
||||
#define SEC_NFC_MAGIC 'S'
|
||||
#define SEC_NFC_GET_MODE _IOW(SEC_NFC_MAGIC, 0, unsigned int)
|
||||
#define SEC_NFC_SET_MODE _IOW(SEC_NFC_MAGIC, 1, unsigned int)
|
||||
#define SEC_NFC_SLEEP _IOW(SEC_NFC_MAGIC, 2, unsigned int)
|
||||
#define SEC_NFC_WAKEUP _IOW(SEC_NFC_MAGIC, 3, unsigned int)
|
||||
#ifdef CONFIG_SEC_ESE_COLDRESET
|
||||
#define SEC_NFC_COLD_RESET _IOW(SEC_NFC_MAGIC, 5, unsigned int)
|
||||
#define SEC_NFC_SHUTDOWN _IOW(SEC_NFC_MAGIC, 6, unsigned int)
|
||||
#endif
|
||||
|
||||
/* size */
|
||||
#define SEC_NFC_MSG_MAX_SIZE (256 + 4)
|
||||
|
||||
/* wait for device stable */
|
||||
#ifdef CONFIG_SEC_NFC_MARGINTIME
|
||||
#define SEC_NFC_VEN_WAIT_TIME (150)
|
||||
#else
|
||||
#define SEC_NFC_VEN_WAIT_TIME (20)
|
||||
#endif
|
||||
|
||||
/* gpio pin configuration */
|
||||
struct sec_nfc_platform_data {
|
||||
int irq;
|
||||
int ven;
|
||||
int firm;
|
||||
int wake;
|
||||
int pvdd_en;
|
||||
unsigned int tvdd;
|
||||
unsigned int avdd;
|
||||
#ifdef CONFIG_SEC_ESE_COLDRESET
|
||||
unsigned int coldreset;
|
||||
#endif
|
||||
#ifdef CONFIG_SEC_NFC_GPIO_CLK
|
||||
unsigned int clk_req;
|
||||
struct clk *clk;
|
||||
#endif
|
||||
|
||||
void (*cfg_gpio)(void);
|
||||
u32 ven_gpio_flags;
|
||||
u32 firm_gpio_flags;
|
||||
u32 irq_gpio_flags;
|
||||
const char *nfc_pvdd;
|
||||
#ifdef CONFIG_SEC_NFC_PMIC_LDO
|
||||
const char *pvdd_regulator_name;
|
||||
struct regulator *pvdd_regulator;
|
||||
#endif
|
||||
#ifdef CONFIG_SEC_NFC_DEDICATED_CLK
|
||||
phys_addr_t clkctrl_addr;
|
||||
#endif
|
||||
};
|
||||
|
||||
enum sec_nfc_mode {
|
||||
SEC_NFC_MODE_OFF = 0,
|
||||
SEC_NFC_MODE_FIRMWARE,
|
||||
SEC_NFC_MODE_BOOTLOADER,
|
||||
SEC_NFC_MODE_COUNT,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SEC_NFC_PRODUCT_N3
|
||||
enum sec_nfc_power {
|
||||
SEC_NFC_PW_OFF = 0,
|
||||
SEC_NFC_PW_ON,
|
||||
};
|
||||
#else /* CONFIG_SEC_NFC_PRODUCT_N3 */
|
||||
enum sec_nfc_power {
|
||||
SEC_NFC_PW_ON = 0,
|
||||
SEC_NFC_PW_OFF,
|
||||
};
|
||||
#endif
|
||||
|
||||
enum sec_nfc_firmpin {
|
||||
SEC_NFC_FW_OFF = 0,
|
||||
SEC_NFC_FW_ON,
|
||||
};
|
||||
|
||||
enum sec_nfc_wake {
|
||||
SEC_NFC_WAKE_SLEEP = 0,
|
||||
SEC_NFC_WAKE_UP,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SEC_ESE_COLDRESET
|
||||
enum sec_nfc_coldreset{
|
||||
SEC_NFC_COLDRESET_OFF = 0,
|
||||
SEC_NFC_COLDRESET_ON,
|
||||
};
|
||||
|
||||
#define FIRMWARE_GUARD_TIME (4)
|
||||
#define DEVICEHOST_ID (0x00)
|
||||
#define ESE_ID (0x02)
|
||||
#define IDX_SLEEP_WAKEUP_NFC 0
|
||||
#define IDX_SLEEP_WAKEUP_ESE 1
|
||||
#endif
|
||||
|
||||
bool is_charging_mode;
|
||||
|
||||
#define NFC_I2C_LDO_ON 1
|
||||
#define NFC_I2C_LDO_OFF 0
|
||||
Loading…
Reference in a new issue