No need to use I2C_F_POLL here.

This commit is contained in:
thorpej 2019-12-23 18:09:05 +00:00
parent 721b6ed7c4
commit 5f3ac896d3
2 changed files with 14 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cx24227.c,v 1.9 2019/12/23 18:03:14 thorpej Exp $ */ /* $NetBSD: cx24227.c,v 1.10 2019/12/23 18:09:05 thorpej Exp $ */
/* /*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.9 2019/12/23 18:03:14 thorpej Exp $"); __KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.10 2019/12/23 18:09:05 thorpej Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -108,16 +108,16 @@ cx24227_writereg(struct cx24227 *sc, uint8_t reg, uint16_t data)
int error; int error;
uint8_t r[3]; uint8_t r[3];
if ((error = iic_acquire_bus(sc->tag, I2C_F_POLL) != 0)) if ((error = iic_acquire_bus(sc->tag, 0) != 0))
return error; return error;
r[0] = reg; r[0] = reg;
r[1] = (data >> 8) & 0xff; r[1] = (data >> 8) & 0xff;
r[2] = data & 0xff; r[2] = data & 0xff;
error = iic_exec(sc->tag, I2C_OP_WRITE_WITH_STOP, sc->addr, error = iic_exec(sc->tag, I2C_OP_WRITE_WITH_STOP, sc->addr,
r, 3, NULL, 0, I2C_F_POLL); r, 3, NULL, 0, 0);
iic_release_bus(sc->tag, I2C_F_POLL); iic_release_bus(sc->tag, 0);
return error; return error;
} }
@ -130,13 +130,13 @@ cx24227_readreg(struct cx24227 *sc, uint8_t reg, uint16_t *data)
*data = 0x0000; *data = 0x0000;
if ((error = iic_acquire_bus(sc->tag, I2C_F_POLL) != 0)) if ((error = iic_acquire_bus(sc->tag, 0) != 0))
return error; return error;
error = iic_exec(sc->tag, I2C_OP_READ_WITH_STOP, sc->addr, error = iic_exec(sc->tag, I2C_OP_READ_WITH_STOP, sc->addr,
&reg, 1, r, 2, I2C_F_POLL); &reg, 1, r, 2, 0);
iic_release_bus(sc->tag, I2C_F_POLL); iic_release_bus(sc->tag, 0);
*data |= r[0] << 8; *data |= r[0] << 8;
*data |= r[1]; *data |= r[1];

View File

@ -1,4 +1,4 @@
/* $NetBSD: ddc.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $ */ /* $NetBSD: ddc.c,v 1.9 2019/12/23 18:12:50 thorpej Exp $ */
/*- /*-
* Copyright (c) 2006 Itronix Inc. * Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ddc.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $"); __KERNEL_RCSID(0, "$NetBSD: ddc.c,v 1.9 2019/12/23 18:12:50 thorpej Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -102,17 +102,17 @@ ddc_read_edid_block(i2c_tag_t tag, uint8_t *dest, size_t len, uint8_t block)
uint8_t wbuf[2]; uint8_t wbuf[2];
int error; int error;
if ((error = iic_acquire_bus(tag, I2C_F_POLL)) != 0) if ((error = iic_acquire_bus(tag, 0)) != 0)
return error; return error;
wbuf[0] = block >> 1; /* start address */ wbuf[0] = block >> 1; /* start address */
if ((error = iic_exec(tag, I2C_OP_READ_WITH_STOP, DDC_ADDR, wbuf, 1, if ((error = iic_exec(tag, I2C_OP_READ_WITH_STOP, DDC_ADDR, wbuf, 1,
edid, sizeof(edid), I2C_F_POLL)) != 0) { edid, sizeof(edid), 0)) != 0) {
iic_release_bus(tag, I2C_F_POLL); iic_release_bus(tag, 0);
return error; return error;
} }
iic_release_bus(tag, I2C_F_POLL); iic_release_bus(tag, 0);
if (block & 1) { if (block & 1) {
memcpy(dest, &edid[128], uimin(len, 128)); memcpy(dest, &edid[128], uimin(len, 128));