From 12e9ade309db51e7ea26be3b4fd5bc6057ddc175 Mon Sep 17 00:00:00 2001
From: "Mark A. Greer" <mgreer@animalcreek.com>
Date: Tue, 25 Mar 2014 08:54:35 -0700
Subject: [PATCH] NFC: trf7970a: Allow different Modulator and SYS_CLK Control
 register values

Currently the driver writes the same value to the 'Modulator and SYS_CLK
Control' register no matter what RF technology is being used. That works
for now but new RF technologies (e.g., ISO/IEC 14443-B) will require
different values to be written to that register. To support this, add a
member to the trf7970a structure which is set by the RF technology handling
code and used by the framing code when it writes to that register.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
 drivers/nfc/trf7970a.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 90ec2ad35932..352aaab807b6 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -338,6 +338,7 @@ struct trf7970a {
 	void				*cb_arg;
 	u8				iso_ctrl;
 	u8				iso_ctrl_tech;
+	u8				modulator_sys_clk_ctrl;
 	u8				special_fcn_reg1;
 	int				technology;
 	int				framing;
@@ -887,9 +888,11 @@ static int trf7970a_config_rf_tech(struct trf7970a *trf, int tech)
 	switch (tech) {
 	case NFC_DIGITAL_RF_TECH_106A:
 		trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_14443A_106;
+		trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK;
 		break;
 	case NFC_DIGITAL_RF_TECH_ISO15693:
 		trf->iso_ctrl_tech = TRF7970A_ISO_CTRL_15693_SGL_1OF4_2648;
+		trf->modulator_sys_clk_ctrl = TRF7970A_MODULATOR_DEPTH_OOK;
 		break;
 	default:
 		dev_dbg(trf->dev, "Unsupported rf technology: %d\n", tech);
@@ -940,7 +943,7 @@ static int trf7970a_config_framing(struct trf7970a *trf, int framing)
 		trf->iso_ctrl = iso_ctrl;
 
 		ret = trf7970a_write(trf, TRF7970A_MODULATOR_SYS_CLK_CTRL,
-				TRF7970A_MODULATOR_DEPTH_OOK);
+				trf->modulator_sys_clk_ctrl);
 		if (ret)
 			return ret;
 	}
-- 
2.30.9