I2C: Remove the setfrequency method from the interface

This commit is contained in:
Gregory Nutt 2016-02-01 16:31:13 -06:00
parent 6ad641888b
commit 69ce24c70c
22 changed files with 5 additions and 107 deletions

@ -1 +1 @@
Subproject commit 7d40326c7f8ca77993caaa7bb940e3ae2a631f9d
Subproject commit 527fb2f92536a8dad7dee60da49281049dc545bb

2
arch

@ -1 +1 @@
Subproject commit 18c2083af2a73f710e2777c42ccd7ca8ae4096bf
Subproject commit 867f8d6f49f9bec687e98bfb2bedba81e017e90a

View File

@ -2501,11 +2501,6 @@ FAR struct audio_lowerhalf_s *
dq_init(&priv->pendq);
dq_init(&priv->doneq);
/* Initialize I2C */
auddbg("address=%02x frequency=%d\n", lower->address, lower->frequency);
I2C_SETFREQUENCY(i2c, lower->frequency);
/* Software reset. This puts all WM8904 registers back in their
* default state.
*/

View File

@ -87,7 +87,6 @@ int i2c_read(FAR struct i2c_master_s *dev,
/* Then perform the transfer. */
I2C_SETFREQUENCY(dev, config->frequency);
return I2C_TRANSFER(dev, &msg, 1);
}

View File

@ -82,7 +82,6 @@ int i2c_write(FAR struct i2c_master_s *dev,
/* Then perform the transfer. */
I2C_SETFREQUENCY(dev, config->frequency);
return I2C_TRANSFER(dev, &msg, 1);
}

View File

@ -109,7 +109,6 @@ int i2c_writeread(FAR struct i2c_master_s *dev,
/* Then perform the transfer. */
I2C_SETFREQUENCY(dev, config->frequency);
return I2C_TRANSFER(dev, msg, 2);
}

View File

@ -1517,7 +1517,6 @@ static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
DEBUGASSERT(priv->lower != NULL && ptr != NULL);
priv->frequency = *ptr;
(void)I2C_SETFREQUENCY(priv->i2c, *ptr);
}
break;
@ -1741,7 +1740,6 @@ static int mxt_hwinitialize(FAR struct mxt_dev_s *priv)
/* Set the selected I2C frequency */
priv->frequency = priv->lower->frequency;
(void)I2C_SETFREQUENCY(priv->i2c, priv->lower->frequency);
/* Read the info registers from the device */

View File

@ -324,13 +324,6 @@ STMPE811_HANDLE stmpe811_instantiate(FAR struct i2c_master_s *dev,
priv->spi = dev;
#else
priv->i2c = dev;
/* Set the I2C address and frequency. REVISIT: This logic would be
* insufficient if we share the I2C bus with any other devices that also
* modify the address and frequency.
*/
I2C_SETFREQUENCY(dev, config->frequency);
#endif
/* Read and verify the STMPE811 chip ID */

View File

@ -615,7 +615,7 @@ static int stmpe811_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
DEBUGASSERT(priv->config != NULL && ptr != NULL);
priv->config->frequency = I2C_SETFREQUENCY(priv->i2c, *ptr);
priv->config->frequency = *ptr;
}
break;

View File

@ -1073,7 +1073,6 @@ static int tsc2007_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg);
DEBUGASSERT(priv->config != NULL && ptr != NULL);
priv->config->frequency = *ptr;
(void)I2C_SETFREQUENCY(priv->i2c, *ptr);
}
break;
@ -1255,10 +1254,6 @@ int tsc2007_register(FAR struct i2c_master_s *dev,
sem_init(&priv->devsem, 0, 1); /* Initialize device structure semaphore */
sem_init(&priv->waitsem, 0, 0); /* Initialize pen event wait semaphore */
/* Set the I2C frequency (saving the actual frequency) */
config->frequency = I2C_SETFREQUENCY(dev, config->frequency);
/* Make sure that interrupts are disabled */
config->clear(config);

View File

@ -618,13 +618,6 @@ FAR struct ioexpander_dev_s *pca9555_initialize(FAR struct i2c_master_s *i2cdev,
pcadev->dev.ops = &g_pca9555_ops;
pcadev->config = config;
/* Set the I2C frequency. REVISIT: This logic would be
* insufficient if we share the I2C bus with any other devices that also
* modify the address and frequency.
*/
I2C_SETFREQUENCY(i2cdev, config->frequency);
#ifdef CONFIG_PCA9555_INT_ENABLE
pcadev->config->attach(pcadev->config, pca9555_interrupt);
pcadev->config->enable(pcadev->config, TRUE);

View File

@ -827,13 +827,6 @@ FAR struct lcd_dev_s *ssd1306_initialize(FAR struct i2c_master_s *dev, unsigned
priv->i2c = dev;
priv->addr = CONFIG_SSD1306_I2CADDR;
/* Set the I2C frequency. REVISIT: This logic would be
* insufficient if we share the I2C bus with any other devices that also
* modify the address and frequency.
*/
I2C_SETFREQUENCY(priv->i2c, CONFIG_SSD1306_I2CFREQ);
#endif
/* Lock and select device */

View File

@ -381,10 +381,6 @@ int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
return ret;
}
/* setup i2c frequency */
I2C_SETFREQUENCY(priv->i2c, I2C_BUS_FREQ_HZ);
return OK;
}

View File

@ -246,7 +246,6 @@ static int at24c_eraseall(FAR struct at24c_dev_s *priv)
int startblock = 0;
memset(&buf[AT24XX_ADDRSIZE], 0xff, priv->pagesize);
I2C_SETFREQUENCY(priv->dev, CONFIG_AT24XX_FREQUENCY);
for (startblock = 0; startblock < priv->npages; startblock++)
{
@ -298,8 +297,6 @@ static ssize_t at24c_read_internal(FAR struct at24c_dev_s *priv, off_t offset,
fvdbg("offset: %lu nbytes: %lu address: %02x\n",
(unsigned long)offset, (unsigned long)nbytes, address);
I2C_SETFREQUENCY(priv->dev, CONFIG_AT24XX_FREQUENCY);
/* "Random Read: A Random Read requires a dummy byte write sequence to load in the
* data word address. Once the device address word and data word address are clocked
* in and acknowledged by the EEPROM, the microcontroller must generate another
@ -422,7 +419,6 @@ static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t
}
fvdbg("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks);
I2C_SETFREQUENCY(priv->dev, CONFIG_AT24XX_FREQUENCY);
while (blocksleft-- > 0)
{

View File

@ -744,10 +744,6 @@ FAR struct battery_charger_dev_s *
priv->addr = addr;
priv->frequency = frequency;
/* Set the I2C frequency (ignoring the returned, actual frequency) */
(void)I2C_SETFREQUENCY(i2c, priv->frequency);
/* Reset the BQ2425x */
ret = bq2425x_reset(priv);

View File

@ -548,10 +548,6 @@ FAR struct battery_gauge_dev_s *max1704x_initialize(FAR struct i2c_master_s *i2c
priv->addr = addr;
priv->frequency = frequency;
/* Set the I2C frequency (ignoring the returned, actual frequency) */
(void)I2C_SETFREQUENCY(i2c, priv->frequency);
/* Reset the MAX1704x (mostly just to make sure that we can talk to it) */
#if 0

View File

@ -411,13 +411,6 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
#else
priv->i2c = dev;
/* Set the I2C address and frequency. REVISIT: This logic would be
* insufficient if we share the I2C bus with any other devices that also
* modify the address and frequency.
*/
I2C_SETFREQUENCY(dev, config->frequency);
#endif
/* Read and verify the ADXL345 device ID */

View File

@ -610,10 +610,6 @@ int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c)
priv->addr = BMP180_ADDR;
priv->freq = BMP180_FREQ;
/* Configure I2C before using it */
I2C_SETFREQUENCY(priv->i2c, priv->freq);
/* Check Device ID */
ret = bmp180_checkid(priv);

View File

@ -330,10 +330,6 @@ int up_rtc_getdatetime(FAR struct tm *tp)
msg[3].buffer = &seconds;
msg[3].length = 1;
/* Configure I2C before using it */
I2C_SETFREQUENCY(g_ds3231.i2c, CONFIG_DS3231_I2C_FREQUENCY);
/* Perform the transfer. The transfer may be performed repeatedly of the
* seconds values decreases, meaning that that was a rollover in the seconds.
*/
@ -549,10 +545,6 @@ int up_rtc_settime(FAR const struct timespec *tp)
msg[2].buffer = &seconds;
msg[2].length = 1;
/* Configure I2C before using it */
I2C_SETFREQUENCY(g_ds3231.i2c, CONFIG_DS3231_I2C_FREQUENCY);
/* Perform the transfer. This transfer will be repeated if the seconds
* count rolls over to a smaller value while writing.
*/

View File

@ -329,10 +329,6 @@ int up_rtc_getdatetime(FAR struct tm *tp)
msg[3].buffer = &seconds;
msg[3].length = 1;
/* Configure I2C before using it */
I2C_SETFREQUENCY(g_pcf85263.i2c, CONFIG_PCF85263_I2C_FREQUENCY);
/* Perform the transfer. The transfer may be performed repeatedly of the
* seconds values decreases, meaning that that was a rollover in the seconds.
*/
@ -513,10 +509,6 @@ int up_rtc_settime(FAR const struct timespec *tp)
msg[2].buffer = &seconds;
msg[2].length = 1;
/* Configure I2C before using it */
I2C_SETFREQUENCY(g_pcf85263.i2c, CONFIG_PCF85263_I2C_FREQUENCY);
/* Perform the transfer. This transfer will be repeated if the seconds
* count rolls over to a smaller value while writing.
*/

View File

@ -922,10 +922,6 @@ int ov2640_initialize(FAR struct i2c_master_s *i2c)
{
int ret;
/* Configure I2C bus for the OV2640 */
I2C_SETFREQUENCY(i2c, CONFIG_OV2640_FREQUENCY);
/* Reset the OVR2640 */
ret = ov2640_reset(i2c);

View File

@ -80,24 +80,6 @@
/* Access macros ************************************************************/
/****************************************************************************
* Name: I2C_SETFREQUENCY
*
* Description:
* Set the I2C frequency. This frequency will be retained in the struct
* i2c_master_s instance and will be used with all transfers. Required.
*
* Input Parameters:
* dev - Device-specific state data
* frequency - The I2C frequency requested
*
* Returned Value:
* Returns the actual frequency selected
*
****************************************************************************/
#define I2C_SETFREQUENCY(d,f) ((d)->ops->setfrequency(d,f))
/****************************************************************************
* Name: I2C_TRANSFER
*
@ -131,9 +113,8 @@ struct i2c_master_s;
struct i2c_msg_s;
struct i2c_ops_s
{
uint32_t (*setfrequency)(FAR struct i2c_master_s *dev, uint32_t frequency);
int (*transfer)(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s *msgs,
int count);
int (*transfer)(FAR struct i2c_master_s *dev, FAR struct i2c_msg_s *msgs,
int count);
};
/* This structure contains the full state of I2C as needed for a specific