[PATCH 06/10] ixj: Caller ID Refactoring

From: Richard A. Holden III
Date: Wed Oct 08 2008 - 15:42:48 EST


Move all caller id settings into a single function to reduce code duplication.
All the DAA_Coeff_* methods set the same caller id tone values.

Signed-off-by: Richard A. Holden III <aciddeath@xxxxxxxxx>
---
drivers/telephony/ixj.c | 138 ++++++++++-------------------------------------
1 files changed, 29 insertions(+), 109 deletions(-)

diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index 80a31e4..a1bbe81 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -7719,6 +7719,28 @@ static void set_shared_ringerimpendance(IXJ *j)
j->m_DAAShadowRegs.COP_REGS.COP.RingerImpendance_2[0] = 0xD5;
}

+static void set_caller_id_tones(IXJ *j)
+{
+ /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
+ /* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
+ j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+}
+
static void set_50hz_20v_levelmetering_ringing(IXJ *j)
{
/* Levelmetering Ringing (0D):32,45,B5,84 ; 50Hz 20V */
@@ -7829,25 +7851,7 @@ static void DAA_Coeff_US(IXJ *j)
/* */
set_shared_ringerimpendance(j);
set_25hz_30v_levemetering_ringing(j);
-
- /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
-/* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+ set_caller_id_tones(j);
/* */
/* ;CR Registers */
/* Config. Reg. 0 (filters) (cr0):FE ; CLK gen. by crystal */
@@ -7985,24 +7989,7 @@ static void DAA_Coeff_UK(IXJ *j)
/* ; idle */
set_shared_ringerimpendance(j);
set_25hz_30v_levemetering_ringing(j);
-/* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
-/* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+ set_caller_id_tones(j);
/* ;CR Registers */
/* Config. Reg. 0 (filters) (cr0):FF */
j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF;
@@ -8136,26 +8123,10 @@ static void DAA_Coeff_France(IXJ *j)
j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[1] = 0x2C;
j->m_DAAShadowRegs.COP_REGS.COP.THFilterCoeff_3[0] = 0x45;
/* ; idle */
+
set_shared_ringerimpendance(j);
set_50hz_20v_levelmetering_ringing(j);
-/* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
-/* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+ set_caller_id_tones(j);
/* ;CR Registers */
/* Config. Reg. 0 (filters) (cr0):FF */
j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF;
@@ -8312,24 +8283,7 @@ static void DAA_Coeff_Germany(IXJ *j)
j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[2] = 0x45;
j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[1] = 0x0F;
j->m_DAAShadowRegs.COP_REGS.COP.LevelmeteringRinging[0] = 0x8E;
-/* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
-/* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+ set_caller_id_tones(j);
/* ;CR Registers */
/* Config. Reg. 0 (filters) (cr0):FF ; all Filters enabled, CLK from ext. source */
j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF;
@@ -8465,24 +8419,7 @@ static void DAA_Coeff_Australia(IXJ *j)
/* ; idle */
set_shared_ringerimpendance(j);
set_50hz_20v_levelmetering_ringing(j);
- /* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
-/* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+ set_caller_id_tones(j);
/* ;CR Registers */
/* Config. Reg. 0 (filters) (cr0):FF */
j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF;
@@ -8618,24 +8555,7 @@ static void DAA_Coeff_Japan(IXJ *j)
/* ; idle */
set_shared_ringerimpendance(j);
set_25hz_30v_levemetering_ringing(j);
-/* Caller ID 1st Tone (0E):CA,0E,CA,09,99,99,99,99 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[7] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[6] = 0x0E;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[5] = 0xCA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[4] = 0x09;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[3] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[2] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[1] = 0x99;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID1stTone[0] = 0x99;
-/* Caller ID 2nd Tone (0F):FD,B5,BA,07,DA,00,00,00 */
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[7] = 0xFD;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[6] = 0xB5;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[5] = 0xBA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[4] = 0x07;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[3] = 0xDA;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[2] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[1] = 0x00;
- j->m_DAAShadowRegs.COP_REGS.COP.CallerID2ndTone[0] = 0x00;
+ set_caller_id_tones(j);
/* ;CR Registers */
/* Config. Reg. 0 (filters) (cr0):FF */
j->m_DAAShadowRegs.SOP_REGS.SOP.cr0.reg = 0xFF;
--
1.5.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/