1 #ifdef HAVE_XORG_CONFIG_H
2 #include <xorg-config.h>
10 #define TDA9850(a,b) { \
13 I2C_WriteRead(&(t->d), data, 2, NULL, 0); \
16 TDA9850Ptr
Detect_tda9850(I2CBusPtr b
, I2CSlaveAddr addr
)
21 t
= xcalloc(1, sizeof(TDA9850Rec
));
22 if(t
== NULL
) return NULL
;
26 t
->d
.DevName
= "TDA9850 BTSC Stereo+SAP Audio Processor";
29 t
->d
.DevName
= "Generic TDAxxxx";
32 t
->d
.SlaveAddr
= addr
;
35 t
->d
.StartTimeout
= b
->StartTimeout
;
36 t
->d
.BitTimeout
= b
->BitTimeout
;
37 t
->d
.AcknTimeout
= b
->AcknTimeout
;
38 t
->d
.ByteTimeout
= b
->ByteTimeout
;
40 if(!I2C_WriteRead(&(t
->d
), NULL
, 0, &a
, 1))
46 /* set default parameters */
47 if(!I2CDevInit(&(t
->d
)))
56 Bool
tda9850_init(TDA9850Ptr t
)
66 void tda9850_setaudio(TDA9850Ptr t
)
72 TDA9850(0x04,0x0F); TDA9850(0x05,0x0F); TDA9850(0x06, 0x58);
73 TDA9850(0x07,0x07); TDA9850(0x08,0x00);
74 TDA9850(0x09,0x00); TDA9850(0x0A,0x03);
77 TDA9850(0x04,0x07); TDA9850(0x05,0x07);
78 TDA9850(0x06,0x58); TDA9850(0x07,0x07);
79 TDA9850(0x08,0x10); TDA9850(0x09,0x10);
83 TDA9850(0x06,(t
->stereo
<<6)|(t
->sap
<<7)|(t
->mute
?0x8:0)|(t
->sap_mute
?0x10:0x0));
86 void tda9850_mute(TDA9850Ptr t
, Bool mute
)
90 xf86DrvMsg(t
->d
.pI2CBus
->scrnIndex
, X_INFO
, "tda9850_mute %s\n", mute
? "on" : "off");
93 TDA9850(0x06,(t
->stereo
<<6)|(t
->sap
<<7)|(t
->mute
?0x8:0x0)|(t
->sap_mute
?0x10:0x0));
96 void tda9850_sap_mute(TDA9850Ptr t
, Bool sap_mute
)
100 xf86DrvMsg(t
->d
.pI2CBus
->scrnIndex
, X_INFO
, "tda9850_sap_mute %s\n", sap_mute
? "on" : "off");
101 t
->sap_mute
= sap_mute
;
103 TDA9850(0x06,(t
->stereo
<<6)|(t
->sap
<<7)|(t
->mute
?0x8:0x0)|(t
->sap_mute
?0x10:0x0));
106 CARD16
tda9850_getstatus(TDA9850Ptr t
)
110 I2C_WriteRead(&(t
->d
), NULL
, 0, (I2CByte
*)&status
, 2);