Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] Re: RFC: patch for support of volume control on DVB-C+analogue-module
Hi!
> > I'd like to include your patch. Please generate it using 'cvs diff -pu'
> > against the LinuxTV CVS repository for both the DVB/-tree and the
> > dvb-kernel/ tree. Please send your patch not inlined into the mail in
> > order to avoid that mail clients screw it up (I was not able to apply
> > your inlined patch - ).
Again wrong file, next try.
rgds
Tobias Bratfisch
Index: driver/av7110/av7110.c
===================================================================
RCS file: /cvs/linuxtv/DVB/driver/av7110/av7110.c,v
retrieving revision 1.38
diff -p -u -r1.38 av7110.c
--- driver/av7110/av7110.c 22 Apr 2003 13:18:59 -0000 1.38
+++ driver/av7110/av7110.c 23 Apr 2003 14:00:30 -0000
@@ -121,6 +121,19 @@ static inline void ddelay(int i)
schedule_timeout((HZ*i)/100);
}
+static inline int
+msp_writereg(av7110_t *av7110, u8 dev, u16 reg, u16 val)
+{
+ u8 msg[5]={ dev, reg>>8, reg&0xff, val>>8 , val&0xff };
+ struct dvb_i2c_bus *i2c = av7110->saa->i2c_bus;
+ struct i2c_msg msgs;
+
+ msgs.flags=0;
+ msgs.addr=0x40;
+ msgs.len=5;
+ msgs.buf=msg;
+ return i2c->xfer(i2c, &msgs, 1);
+}
/****************************************************************************
* GPIO and DEBI functions
@@ -1628,7 +1641,7 @@ static int
SetVolume(av7110_t *av7110, int volleft, int volright)
{
int err=0;
- int chleft, chright;
+ int chleft, chright, vol, val, balance = 0;
switch (av7110->adac_type) {
case DVB_ADAC_TI:
@@ -1650,6 +1663,17 @@ SetVolume(av7110_t *av7110, int volleft,
i2c_writereg(av7110, 0x20, 0x04, chright);
break;
+ case DVB_ADAC_MSP:
+ vol = (volleft > volright) ? volleft : volright;
+ val = (vol * 0x73 / 255) << 8;
+ if (vol > 0) {
+ balance = ((volright-volleft) * 127) / vol;
+ }
+ msp_writereg(av7110, 0x12, 0x0001, balance << 8);
+ msp_writereg(av7110, 0x12, 0x0000, val); /* loudspeaker */
+ msp_writereg(av7110, 0x12, 0x0006, val); /* headphonesr */
+ break;
+
default:
err = -1;
}
@@ -2504,20 +2528,6 @@ i2c_writereg(av7110_t *av7110, u8 id, u8
return i2c->xfer (i2c, &msgs, 1);
}
-static inline int
-msp_writereg(av7110_t *av7110, u8 dev, u16 reg, u16 val)
-{
- u8 msg[5]={ dev, reg>>8, reg&0xff, val>>8 , val&0xff };
- struct dvb_i2c_bus *i2c = av7110->saa->i2c_bus;
- struct i2c_msg msgs;
-
- msgs.flags=0;
- msgs.addr=0x40;
- msgs.len=5;
- msgs.buf=msg;
- return i2c->xfer(i2c, &msgs, 1);
-}
-
static inline u8
i2c_readreg(av7110_t *av7110, u8 id, u8 reg)
{
@@ -4956,6 +4966,7 @@ int av7110_attach (struct saa7146 *saa,
i2c_writereg(av7110, 0x80, 0x0, 0);
printk("av7110: DVB-C analog module detected, "
"initializing MSP3400\n");
+ av7110->adac_type = DVB_ADAC_MSP;
ddelay(10);
msp_writereg(av7110, 0x12, 0x0013, 0x0c00);
msp_writereg(av7110, 0x12, 0x0000, 0x7f00); // loudspeaker + headphone
@@ -4964,7 +4975,8 @@ int av7110_attach (struct saa7146 *saa,
msp_writereg(av7110, 0x12, 0x000a, 0x0220); // SCART 1 source
msp_writereg(av7110, 0x12, 0x0007, 0x7f00); // SCART 1 volume
msp_writereg(av7110, 0x12, 0x000d, 0x4800); // prescale SCART
- }
+ } else
+ av7110->adac_type = DVB_ADAC_NONE;
// switch DVB SCART on
outcom(av7110, COMTYPE_AUDIODAC, MainSwitch, 1, 0);
@@ -4972,8 +4984,7 @@ int av7110_attach (struct saa7146 *saa,
//setgpio(av7110, 1, GPIO_OUTHI); // RGB on, SCART pin 16
//setgpio(av7110, 3, GPIO_OUTLO); // SCARTpin 8
- av7110->adac_type = DVB_ADAC_NONE;
- }
+ }
av7110_setup_irc_config (av7110, 0);
}
Index: driver/av7110/av7110.h
===================================================================
RCS file: /cvs/linuxtv/DVB/driver/av7110/av7110.h,v
retrieving revision 1.9
diff -p -u -r1.9 av7110.h
--- driver/av7110/av7110.h 22 Apr 2003 13:18:59 -0000 1.9
+++ driver/av7110/av7110.h 23 Apr 2003 14:00:31 -0000
@@ -518,6 +518,7 @@ typedef struct av7110_s {
int adac_type; /* audio DAC type */
#define DVB_ADAC_TI 0
#define DVB_ADAC_CRYSTAL 1
+#define DVB_ADAC_MSP 2
#define DVB_ADAC_NONE -1
Home |
Main Index |
Thread Index