Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HowTO write custom driver for TV Cards
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Mon Oct 04, 2004 10:58 pm    Post subject: HowTO write custom driver for TV Cards Reply with quote

This is really preliminary cause I have only a 7130 board to test....

I just wroted down the driver for my card:
*************************************************
[SAA7134_PCI_TV-Radio_LE] = {
/* "Matteo Az" <matte.az@libero.it> */
.name = "Empire PCI TV-Radio LE",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_PAL,
.gpiomask = 0x4000,
.inputs = {{
.name = name_tv_mono,
.vmux = 1,
.amux = LINE2,
.gpio = 0x8000,
.tv = 1,
},{
.name = name_comp,
.vmux = 3,
.amux = LINE1,
.gpio = 0x8000,
},{
.name = name_svideo,
.vmux = 6,
.amux = LINE1,
.gpio = 0x8000,
}},
.radio = {
.name = name_radio,
.amux = LINE1,
.gpio = 0x8000,
},
.mute = {
.name = name_mute,
.amux = TV,
.gpio =0x8000,
},
},
********************************************
and I'll explain how do I figured out this all.

U will need
1) Working program bundled with your card under win32 platform
2) Dscaler for win32, in particular RegSpy utility packed with newer version
of Dscaler

then:
A) start regspy after a reboot, click on log state.
B) start also your software, write down in wich mode started (tv,svideo...)
and click on log state
C) try all the modes and every time : write down and log state.
D) close the TV app, click dump to file and save your file.

Your file will be similar to this (i just mantained only the difference for states after 1):
**********************************************************
(netx post)
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Mon Oct 04, 2004 10:58 pm    Post subject: Reply with quote

SAA7130 Card [0]:

[EMPIRE PCI TV-Radio LE Model, only mono audio for TV mode, max res: 640x480 (without
stretching]


Vendor ID: 0x1131
Device ID: 0x7130
Subsystem ID: 0x00001131

-------CLEAN REBOOT-----
7 states dumped

----------------------------------------------------------------------------------

SAA7130 Card - State 0:
SAA7134_GPIO_GPMODE: 80004700 (10000000 00000000 01000111 00000000)
SAA7134_GPIO_GPSTATUS: 0000007f (00000000 00000000 00000000 01111111)
SAA7134_ANALOG_IN_CTRL1: c1 (11000001)
SAA7134_ANALOG_IO_SELECT: 02 * (00000010)
SAA7134_VIDEO_PORT_CTRL0: 00000000 (00000000 00000000 00000000 00000000)
SAA7134_VIDEO_PORT_CTRL4: 00000000 (00000000 00000000 00000000 00000000)
SAA7134_VIDEO_PORT_CTRL8: 00 (00000000)
SAA7134_I2S_OUTPUT_SELECT: 00 (00000000)
SAA7134_I2S_OUTPUT_FORMAT: 00 (00000000)
SAA7134_I2S_OUTPUT_LEVEL: 00 (00000000)
SAA7134_I2S_AUDIO_OUTPUT: 00 (00000000)
SAA7134_TS_PARALLEL: 00 (00000000)
SAA7134_TS_PARALLEL_SERIAL: 00 (00000000)
SAA7134_TS_SERIAL0: 00 (00000000)
SAA7134_TS_SERIAL1: 00 (00000000)
SAA7134_TS_DMA0: 00 (00000000)
SAA7134_TS_DMA1: 00 (00000000)
SAA7134_TS_DMA2: 00 (00000000)
SAA7134_SPECIAL_MODE: 01 (00000001)

-----------------Video (TV) start [note: after not clean reboot it changes to ANALOG_IO_
_SELECT: 0a -> 09 and _GPMODE: ..047f -> ..007f ]
Changes: State 0 -> State 1:
SAA7134_ANALOG_IO_SELECT: 02 -> 01 (------10)

1 changes

----------------TV to COMPOSITE (low noise, I think because no source attached)
Changes: State 1 -> State 2:
SAA7134_GPIO_GPSTATUS: 0000007f -> 0000027f (-------- -------- ------0- --------)
SAA7134_ANALOG_IN_CTRL1: c1 -> c3 (------0-)
SAA7134_ANALOG_IO_SELECT: 01 -> 00 (-------1)
[ -note: _SELECT: 09 -> 08 for non clean reboot.]
3 changes

---------------COMPOSITE TO SVIDEO
Changes: State 2 -> State 3:
SAA7134_ANALOG_IN_CTRL1: c3 -> c6 (-----0-1)

1 changes

---------------SVIDEO TO TV
Changes: State 3 -> State 4:
SAA7134_GPIO_GPSTATUS: 0000027f -> 0000007f (-------- -------- ------1- --------) (same as 0, 1)
SAA7134_ANALOG_IN_CTRL1: c6 -> c1 (-----110) (same as 0, 1)
SAA7134_ANALOG_IO_SELECT: 00 -> 01 (-------0) (same as 1)
[again, 08 -> 09 for non clean reboot]
3 changes

---------------TV to radio
Changes: State 4 -> State 5:
SAA7134_GPIO_GPSTATUS: 0000007f -> 0000017f (-------- -------- -------0 --------)
SAA7134_ANALOG_IO_SELECT: 01 -> 00 (-------1) (same as 2, 3)
[guess what? 09->08 here....]
2 changes

Changes: State 5 -> Register Dump:

0 changes
[Dump not useful, but disabling tv ptogram it goes to _GPSTATUS: ..047f
and _ANALOG_IO_SELECT: 0a]

=================================================================================

SAA7130 Card - Register Dump:
SAA7134_GPIO_GPMODE: 80004700 (10000000 00000000 01000111 00000000)
SAA7134_GPIO_GPSTATUS: 0000017f (00000000 00000000 00000001 01111111)
SAA7134_ANALOG_IN_CTRL1: c1 (11000001)
SAA7134_ANALOG_IO_SELECT: 00 (00000000)
SAA7134_VIDEO_PORT_CTRL0: 00000000 (00000000 00000000 00000000 00000000)
SAA7134_VIDEO_PORT_CTRL4: 00000000 (00000000 00000000 00000000 00000000)
SAA7134_VIDEO_PORT_CTRL8: 00 (00000000)
SAA7134_I2S_OUTPUT_SELECT: 00 (00000000)
SAA7134_I2S_OUTPUT_FORMAT: 00 (00000000)
SAA7134_I2S_OUTPUT_LEVEL: 00 (00000000)
SAA7134_I2S_AUDIO_OUTPUT: 00 (00000000)
SAA7134_TS_PARALLEL: 00 (00000000)
SAA7134_TS_PARALLEL_SERIAL: 00 (00000000)
SAA7134_TS_SERIAL0: 00 (00000000)
SAA7134_TS_SERIAL1: 00 (00000000)
SAA7134_TS_DMA0: 00 (00000000)
SAA7134_TS_DMA1: 00 (00000000)
SAA7134_TS_DMA2: 00 (00000000)
SAA7134_SPECIAL_MODE: 01 (00000001)

end of dump
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Mon Oct 04, 2004 11:05 pm    Post subject: Reply with quote

Now is time to figure out what the GPIO means......
GPIO_GPMODE : fourth char from righ (4)gived me the .gpiomask: 0x4000
first char from left (8)gived me the .gpio values :0x8000
(everytime 0x8000 for my board)
GPSTATUS : i did not figured out how to use......

ANALOG_IN_CTRL1: c1 means .vmux = 1, c3 means .vmux = 3 ..........
ANALOG_IO_SELECT: 00 is .amux = LINE1, 01 is .amux = LINE2,
02 (or 0a, in this case) is .amux = TV

ok, for Saa7130 should be all....... if anybody wants to continue for
Saa 7134 (7133,35....) is welcome! :wink:
Back to top
View user's profile Send private message
Matteo Azzali
Retired Dev
Retired Dev


Joined: 23 Sep 2004
Posts: 1133

PostPosted: Mon Oct 04, 2004 11:08 pm    Post subject: Reply with quote

Oooops. ps : If you change saa7134-cards.c by adding your board,
u should need to change also saa7134-cards.h in wich u should add the
definitions (just inspect, is easy...)
U can find saa7134-cards.c (in kernel 2.6.8 ) in
/usr/src/linux/drivers/media/video/saa7134/
that's all.

Matteo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum