1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

Return to previous check_for_i2c_devices() behaviour.

Cast the cmd parameter to unsigned char in every smbus call.

Submitted by: Roger Hardiman <roger@cs.strath.ac.uk>
This commit is contained in:
Nicolas Souchu 1998-11-07 14:30:48 +00:00
parent 08f9fcbfa8
commit dec0ec9e81
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40991
4 changed files with 34 additions and 48 deletions

View File

@ -1,4 +1,4 @@
/* $Id: brooktree848.c,v 1.56 1998/10/01 09:35:48 sos Exp $ */
/* $Id: brooktree848.c,v 1.57 1998/10/31 11:26:38 nsouch Exp $ */
/* BT848 Driver for Brooktree's Bt848 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@ -4421,16 +4421,6 @@ readEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data )
}
#define ABSENT (-1)
static int
probeDevice(bktr_ptr_t bktr, u_char addr)
{
int read;
read = i2cRead( bktr, addr);
if (read == ABSENT || read == 0)
return (0);
return (1);
}
/*
* get a signature of the card
@ -4448,8 +4438,9 @@ signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig )
sig[ x ] = 0;
for ( x = 0; x < count; ++x ) {
if (probeDevice(bktr, (u_char)(2 * x + 1)))
if ( i2cRead( bktr, (2 * x) + 1 ) != ABSENT ) {
sig[ x / 8 ] |= (1 << (x % 8) );
}
}
return( 0 );
@ -4468,12 +4459,17 @@ signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig )
* (eg VideoLogic Captivator PCI rev. 2F with BT848A)
*/
static int check_for_i2c_devices( bktr_ptr_t bktr ){
int x;
int x, temp_read;
int i2c_all_0 = 1;
int i2c_all_absent = 1;
for ( x = 0; x < 128; ++x ) {
if (probeDevice(bktr, (u_char)(2 * x + 1)))
return (1);
temp_read = i2cRead( bktr, (2 * x) + 1 );
if (temp_read != 0) i2c_all_0 = 0;
if (temp_read != ABSENT) i2c_all_absent = 0;
}
return (0);
if ((i2c_all_0) || (i2c_all_absent)) return 0;
else return 1;
}
/*
@ -4508,9 +4504,6 @@ probeCard( bktr_ptr_t bktr, int verbose )
int tuner_i2c_address = -1;
any_i2c_devices = check_for_i2c_devices( bktr );
if (bootverbose)
if (!any_i2c_devices)
printf("bktr: no I2C device found!\n");
bt848 = bktr->base;
bt848->gpio_out_en = 0;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: bt848_i2c.c,v 1.1 1998/10/31 11:26:38 nsouch Exp $
*
*/
@ -345,7 +345,7 @@ bti2c_smb_writeb(device_t dev, u_char slave, char cmd, char byte)
struct bti2c_softc *sc = (struct bti2c_softc *)device_get_softc(dev);
u_long data;
data = ((slave & 0xff) << 24) | ((byte & 0xff) << 16) | cmd;
data = ((slave & 0xff) << 24) | ((byte & 0xff) << 16) | (u_char)cmd;
return (bti2c_write(sc->base, data));
}
@ -365,7 +365,7 @@ bti2c_smb_writew(device_t dev, u_char slave, char cmd, short word)
high = (char)((word & 0xff00) >> 8);
data = ((slave & 0xff) << 24) | ((low & 0xff) << 16) |
((high & 0xff) << 8) | BT848_DATA_CTL_I2CW3B | cmd;
((high & 0xff) << 8) | BT848_DATA_CTL_I2CW3B | (u_char)cmd;
return (bti2c_write(sc->base, data));
}
@ -385,9 +385,9 @@ bti2c_smb_readb(device_t dev, u_char slave, char cmd, char *byte)
/* clear status bits */
bti2c->int_stat = (BT848_INT_RACK | BT848_INT_I2CDONE);
bti2c->i2c_data_ctl = ((slave & 0xff) << 24) | cmd;
bti2c->i2c_data_ctl = ((slave & 0xff) << 24) | (u_char)cmd;
BTI2C_DEBUG(printf("r%lx/", (u_long)(((slave & 0xff) << 24) | cmd)));
BTI2C_DEBUG(printf("r%lx/", (u_long)(((slave & 0xff) << 24) | (u_char)cmd)));
/* wait for completion */
for ( x = 0x7fffffff; x; --x ) { /* safety valve */

View File

@ -1,4 +1,4 @@
/* $Id: brooktree848.c,v 1.56 1998/10/01 09:35:48 sos Exp $ */
/* $Id: brooktree848.c,v 1.57 1998/10/31 11:26:38 nsouch Exp $ */
/* BT848 Driver for Brooktree's Bt848 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@ -4421,16 +4421,6 @@ readEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data )
}
#define ABSENT (-1)
static int
probeDevice(bktr_ptr_t bktr, u_char addr)
{
int read;
read = i2cRead( bktr, addr);
if (read == ABSENT || read == 0)
return (0);
return (1);
}
/*
* get a signature of the card
@ -4448,8 +4438,9 @@ signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig )
sig[ x ] = 0;
for ( x = 0; x < count; ++x ) {
if (probeDevice(bktr, (u_char)(2 * x + 1)))
if ( i2cRead( bktr, (2 * x) + 1 ) != ABSENT ) {
sig[ x / 8 ] |= (1 << (x % 8) );
}
}
return( 0 );
@ -4468,12 +4459,17 @@ signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig )
* (eg VideoLogic Captivator PCI rev. 2F with BT848A)
*/
static int check_for_i2c_devices( bktr_ptr_t bktr ){
int x;
int x, temp_read;
int i2c_all_0 = 1;
int i2c_all_absent = 1;
for ( x = 0; x < 128; ++x ) {
if (probeDevice(bktr, (u_char)(2 * x + 1)))
return (1);
temp_read = i2cRead( bktr, (2 * x) + 1 );
if (temp_read != 0) i2c_all_0 = 0;
if (temp_read != ABSENT) i2c_all_absent = 0;
}
return (0);
if ((i2c_all_0) || (i2c_all_absent)) return 0;
else return 1;
}
/*
@ -4508,9 +4504,6 @@ probeCard( bktr_ptr_t bktr, int verbose )
int tuner_i2c_address = -1;
any_i2c_devices = check_for_i2c_devices( bktr );
if (bootverbose)
if (!any_i2c_devices)
printf("bktr: no I2C device found!\n");
bt848 = bktr->base;
bt848->gpio_out_en = 0;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: bt848_i2c.c,v 1.1 1998/10/31 11:26:38 nsouch Exp $
*
*/
@ -345,7 +345,7 @@ bti2c_smb_writeb(device_t dev, u_char slave, char cmd, char byte)
struct bti2c_softc *sc = (struct bti2c_softc *)device_get_softc(dev);
u_long data;
data = ((slave & 0xff) << 24) | ((byte & 0xff) << 16) | cmd;
data = ((slave & 0xff) << 24) | ((byte & 0xff) << 16) | (u_char)cmd;
return (bti2c_write(sc->base, data));
}
@ -365,7 +365,7 @@ bti2c_smb_writew(device_t dev, u_char slave, char cmd, short word)
high = (char)((word & 0xff00) >> 8);
data = ((slave & 0xff) << 24) | ((low & 0xff) << 16) |
((high & 0xff) << 8) | BT848_DATA_CTL_I2CW3B | cmd;
((high & 0xff) << 8) | BT848_DATA_CTL_I2CW3B | (u_char)cmd;
return (bti2c_write(sc->base, data));
}
@ -385,9 +385,9 @@ bti2c_smb_readb(device_t dev, u_char slave, char cmd, char *byte)
/* clear status bits */
bti2c->int_stat = (BT848_INT_RACK | BT848_INT_I2CDONE);
bti2c->i2c_data_ctl = ((slave & 0xff) << 24) | cmd;
bti2c->i2c_data_ctl = ((slave & 0xff) << 24) | (u_char)cmd;
BTI2C_DEBUG(printf("r%lx/", (u_long)(((slave & 0xff) << 24) | cmd)));
BTI2C_DEBUG(printf("r%lx/", (u_long)(((slave & 0xff) << 24) | (u_char)cmd)));
/* wait for completion */
for ( x = 0x7fffffff; x; --x ) { /* safety valve */