[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d9e83f28187798f57dc2174a19eda735af09a90f.1223497217.git.aciddeath@gmail.com>
Date: Wed, 8 Oct 2008 14:41:42 -0600
From: "Richard A. Holden III" <aciddeath@...il.com>
To: linux-kernel@...r.kernel.org
Cc: "Richard A. Holden III" <aciddeath@...il.com>,
alan@...rguk.ukuu.org.uk
Subject: [PATCH 07/10] ixj: Refactor DTMF tone setting
All the DAA_Ceoff_* functions use the same set of DTMF tones so they are
refactored into a common function.
Signed-off-by: Richard A. Holden III <aciddeath@...il.com>
---
drivers/telephony/ixj.c | 130 +++++++++-------------------------------------
1 files changed, 26 insertions(+), 104 deletions(-)
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index a1bbe81..3b1315f 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -7769,6 +7769,26 @@ static void zero_caller_id(IXJ *j)
}
}
+static void set_dtmf_tones(IXJ *j)
+{
+ /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
+ /* 12,33,5A,C3 ; 770 Hz */
+ /* 13,3C,5B,32 ; 852 Hz */
+ /* 1D,1B,5C,CC ; 941 Hz */
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
+ /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
+ /* EC,1D,52,22 ; 1336 Hz */
+ /* AA,AC,51,D2 ; 1477 Hz */
+ /* 9B,3B,51,25 ; 1633 Hz */
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
+ j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+}
+
static void DAA_Coeff_US(IXJ *j)
{
j->daa_country = DAA_US;
@@ -7888,24 +7908,7 @@ static void DAA_Coeff_US(IXJ *j)
j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00;
/* Ext. Reg. 7 (Vdd) (xr7):40 */
j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; /* 0x40 ??? Should it be 0x00? */
- /* */
- /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
- /* 12,33,5A,C3 ; 770 Hz */
- /* 13,3C,5B,32 ; 852 Hz */
- /* 1D,1B,5C,CC ; 941 Hz */
-
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
-/* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
- /* EC,1D,52,22 ; 1336 Hz */
- /* AA,AC,51,D2 ; 1477 Hz */
- /* 9B,3B,51,25 ; 1633 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+ set_dtmf_tones(j);
}
static void DAA_Coeff_UK(IXJ *j)
@@ -8024,23 +8027,7 @@ static void DAA_Coeff_UK(IXJ *j)
j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00;
/* Ext. Reg. 7 (Vdd) (xr7):46 */
j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x46; /* 0x46 ??? Should it be 0x00? */
- /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
- /* 12,33,5A,C3 ; 770 Hz */
- /* 13,3C,5B,32 ; 852 Hz */
- /* 1D,1B,5C,CC ; 941 Hz */
-
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
-/* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
- /* EC,1D,52,22 ; 1336 Hz */
- /* AA,AC,51,D2 ; 1477 Hz */
- /* 9B,3B,51,25 ; 1633 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+ set_dtmf_tones(j);
}
@@ -8161,23 +8148,7 @@ static void DAA_Coeff_France(IXJ *j)
j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00;
/* Ext. Reg. 7 (Vdd) (xr7):46 */
j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x46; /* 0x46 ??? Should it be 0x00? */
- /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
- /* 12,33,5A,C3 ; 770 Hz */
- /* 13,3C,5B,32 ; 852 Hz */
- /* 1D,1B,5C,CC ; 941 Hz */
-
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
-/* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
- /* EC,1D,52,22 ; 1336 Hz */
- /* AA,AC,51,D2 ; 1477 Hz */
- /* 9B,3B,51,25 ; 1633 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+ set_dtmf_tones(j);
}
@@ -8318,23 +8289,7 @@ static void DAA_Coeff_Germany(IXJ *j)
j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00;
/* Ext. Reg. 7 (Vdd) (xr7):40 ; VDD=4.25 V */
j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; /* 0x40 ??? Should it be 0x00? */
- /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
- /* 12,33,5A,C3 ; 770 Hz */
- /* 13,3C,5B,32 ; 852 Hz */
- /* 1D,1B,5C,CC ; 941 Hz */
-
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
-/* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
- /* EC,1D,52,22 ; 1336 Hz */
- /* AA,AC,51,D2 ; 1477 Hz */
- /* 9B,3B,51,25 ; 1633 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+ set_dtmf_tones(j);
}
@@ -8454,24 +8409,7 @@ static void DAA_Coeff_Australia(IXJ *j)
j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00;
/* Ext. Reg. 7 (Vdd) (xr7):40 */
j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; /* 0x40 ??? Should it be 0x00? */
-
- /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
- /* 12,33,5A,C3 ; 770 Hz */
- /* 13,3C,5B,32 ; 852 Hz */
- /* 1D,1B,5C,CC ; 941 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
-
- /* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
- /* EC,1D,52,22 ; 1336 Hz */
- /* AA,AC,51,D2 ; 1477 Hz */
- /* 9B,3B,51,25 ; 1633 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+ set_dtmf_tones(j);
}
static void DAA_Coeff_Japan(IXJ *j)
@@ -8590,23 +8528,7 @@ static void DAA_Coeff_Japan(IXJ *j)
j->m_DAAShadowRegs.XOP_xr6_W.reg = 0x00;
/* Ext. Reg. 7 (Vdd) (xr7):40 */
j->m_DAAShadowRegs.XOP_REGS.XOP.xr7.reg = 0x40; /* 0x40 ??? Should it be 0x00? */
- /* DTMF Tone 1 (0B): 11,B3,5A,2C ; 697 Hz */
- /* 12,33,5A,C3 ; 770 Hz */
- /* 13,3C,5B,32 ; 852 Hz */
- /* 1D,1B,5C,CC ; 941 Hz */
-
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[3] = 0x11;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[2] = 0xB3;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[1] = 0x5A;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone1Coeff[0] = 0x2C;
-/* DTMF Tone 2 (0C): 32,32,52,B3 ; 1209 Hz */
- /* EC,1D,52,22 ; 1336 Hz */
- /* AA,AC,51,D2 ; 1477 Hz */
- /* 9B,3B,51,25 ; 1633 Hz */
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[3] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[2] = 0x32;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[1] = 0x52;
- j->m_DAAShadowRegs.COP_REGS.COP.Tone2Coeff[0] = 0xB3;
+ set_dtmf_tones(j);
}
static s16 tone_table[][19] =
--
1.5.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists