Example #1
0
static int
ecadc_match(device_t parent, cfdata_t cf, void *aux)
{
	struct i2c_attach_args *ia = aux;

	if (iic_compat_match(ia, ecadc_compats))
		return 1;

	return 0;
}
Example #2
0
static int
seeprom_match(device_t parent, cfdata_t cf, void *aux)
{
	struct i2c_attach_args *ia = aux;

	if (ia->ia_name) {
		if (iic_compat_match(ia, seeprom_compats))
			return (1);
	} else {
		if ((ia->ia_addr & AT24CXX_ADDRMASK) == AT24CXX_ADDR)
			return (1);
	}

	return (0);
}
Example #3
0
static int
as3722_match(device_t parent, cfdata_t match, void *aux)
{
	struct i2c_attach_args *ia = aux;
	uint8_t reg, id1;
	int error;

	if (ia->ia_name == NULL) {
		iic_acquire_bus(ia->ia_tag, I2C_F_POLL);
		reg = AS3722_ASIC_ID1_REG;
		error = iic_exec(ia->ia_tag, I2C_OP_READ_WITH_STOP, ia->ia_addr,
		    &reg, 1, &id1, 1, I2C_F_POLL);
		iic_release_bus(ia->ia_tag, I2C_F_POLL);

		if (error == 0 && id1 == 0x0c)
			return 1;

		return 0;
	} else {
		return iic_compat_match(ia, as3722_compats);
	}
}
Example #4
0
static int
adm1026_match(device_t parent, cfdata_t cf, void *aux)
{
	struct i2c_attach_args *ia = aux;
	struct adm1026_softc sc;	/* For chip ident */
	sc.sc_tag = ia->ia_tag;
	sc.sc_address = ia->ia_addr;
	sc.sc_iic_flags = 0;

	/* Direct config - match compats */
	if (ia->ia_name) {
		if (ia->ia_ncompat > 0) {
			if (iic_compat_match(ia, adm1026_compats))
				return 1;
		}
	/* Indirect config - check address and chip ID/rev. */
	} else {
		if ((ia->ia_addr & ADM1026_ADDRMASK) == ADM1026_ADDR &&
		    adm1026_ident(&sc))
			return 1;
	}

	return 0;
}