Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

static int mxci2c_suspend ( struct platform_device *  pdev,
pm_message_t  state 
) [static]

This function is called to put the I2C adapter in a low power state. Refer to the document driver-model/driver.txt in the kernel source tree for more information.

Parameters:
pdev the device structure used to give information on which I2C to suspend
state the power state the device is entering
Returns:
The function returns 0 on success and -1 on failure.

Definition at line 598 of file mxc_i2c.c.

References mxc_i2c_device::adap, gpio_i2c_inactive(), mxc_i2c_device::low_power, and mxc_i2c_device::membase.

{
      mxc_i2c_device *mxcdev = platform_get_drvdata(pdev);
      volatile unsigned int sr = 0;

      if (mxcdev == NULL) {
            return -1;
      }

      /* Prevent further calls to be processed */
      mxcdev->low_power = true;
      /* Wait till we finish the current transfer */
      sr = readw(mxcdev->membase + MXC_I2SR);
      while (sr & MXC_I2SR_IBB) {
            msleep(10);
            sr = readw(mxcdev->membase + MXC_I2SR);
      }
      gpio_i2c_inactive(mxcdev->adap.id);

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index