Proud to present Part 2 of ugly code ;).

See file COPYING for license information.

Before using the little program, ensure that you have i2c enabled in
your kernel - and of course, that all necc. modules are loaded
(i2c-core, i2c-dev, and i2c-i801 [for Siemens Activy])

Usage
- Option '-i': Number of i2c-adapter (default:0)
- Option '-a': Address of tdk5002c (default: 0x48)
- Option '-d': If given, prints out only the read-register info.
- Option '-s': Use a predefined register-sequence
		0: switch AUX-Scart to Tv-Out/Console
		1: switch AUX-Scart to loopthru from TV-Scart
		2: switch AUX-Scart to em8400 output (a+v)

- Writing the register one by one: You have to give the complete values (20)
  for the write registers (0-4), one after the other - you have to write them
  in Hex-Format.
  Sample:
  "MYSUPERPC> ./tdk5002cctl 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02"
  
  The parameters are in the same order as in the write registers of the
  TDK, order is from register 0-4, within register it's from LSB to MSB.
  
  You don't have to give an offset to a single parameter, e.g. if you want
  to turn on "TV RGB Mute" (Bit 6 in Register 1), just give a "0x01" - or a
  "0x00" if you want to turn it off.  

Examples:
"./tdk5002cctl -i 1 -a 0x50 -d": Gives only read-registers for chip 0x50 at i2c-adapter 1
"./tdk5002cctl -s 2": Switches AUX-Scart to em8400 output
"./tdk5002cctl -i 2 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02 0x03 0x01 0x02":
	sets all parameters for tdx at i2c-adapter 2

Parameters in detail(from 0-19):
0) The Volume Control Attenuation for TV, Line or Mod_mono audio
   Possible values: 0x00-0x3F
1) TV audio mute
   Possible values: 0x00-0x01
2) AUX audio mute
   Possible values: 0x00-0x01
3) TV A/V source
   Possible values: 0x00-0x07
4) Aux A/V source
   Possible values: 0x00-0x07
5) TV RGB Mute
   Possible values: 0x00-0x01
6) RGB Sync Source
   Possible values: 0x00-0x01
7) Function Control Output Voltage
   Possible values: 0x00-0x03
8) Function Pin Control*
   Possible values: 0x00-0x03
9) RGB Gain Control
   Possible values: 0x00-0x03
10) BLANK output selection
   Possible values: 0x00-0x03
11) DO_0 output control
   Possible values: 0x00-0x01
12) DO_1 output control
   Possible values: 0x00-0x01
13) Lin/Rin Gain control
   Possible values: 0x00-0x03
14) TV Stereo/mono control
   Possible values: 0x00-0x03
15) Aux Stereo/mono control
   Possible values: 0x00-0x03
16) TV volume control select 1
   Possible values: 0x00-0x01
17) TV volume control select 2
   Possible values: 0x00-0x01
18) Enable 6dB gain
   Possible values: 0x00-0x01
19) Line Out Source
   Possible values: 0x00-0x01

The bottom line
[1] See http://www.uni-klu.ac.at/~akoenig/activy2003/AVPro5002C.pdf for the DataSheet
of the TDK.
[2] Tested on Linux vanilla 2.4.27 with i2c-2.8.8 and lmsensors i2c-2.8.8
