Beispiel #1
0
static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message)
{
	struct adxl34x *ac = i2c_get_clientdata(client);

	adxl34x_suspend(ac);

	return 0;
}
Beispiel #2
0
static int __maybe_unused adxl34x_spi_suspend(struct device *dev)
{
	struct spi_device *spi = to_spi_device(dev);
	struct adxl34x *ac = spi_get_drvdata(spi);

	adxl34x_suspend(ac);

	return 0;
}
Beispiel #3
0
static int __maybe_unused adxl34x_i2c_suspend(struct device *dev)
{
	struct i2c_client *client = to_i2c_client(dev);
	struct adxl34x *ac = i2c_get_clientdata(client);

	adxl34x_suspend(ac);

	return 0;
}
static int adxl34x_i2c_suspend(struct i2c_client *client, pm_message_t message)
{
	printk("!!!!!!!!! %d %s %s----\n",__LINE__,__FILE__,__FUNCTION__);

	struct adxl34x *ac = i2c_get_clientdata(client);

	adxl34x_suspend(ac);

	return 0;
}
/**
 *  @brief one-time device driver initialization function.
 *         If the driver is built as a kernel module, this function will be
 *         called when the module is loaded in the kernel.
 *         If the driver is built-in in the kernel, this function will be
 *         called at boot time.
 *
 *  @param mlsl_handle
 *             the handle to the serial channel the device is connected to.
 *  @param slave
 *             a pointer to the slave descriptor data structure.
 *  @param pdata
 *             a pointer to the slave platform data.
 *
 *  @return INV_SUCCESS if successful or a non-zero error code.
 */
static int adxl34x_init(void *mlsl_handle,
			struct ext_slave_descr *slave,
			struct ext_slave_platform_data *pdata)
{
	int result;
	long range;

	struct adxl34x_private_data *private_data;
	private_data = (struct adxl34x_private_data *)
	    kzalloc(sizeof(struct adxl34x_private_data), GFP_KERNEL);

	if (!private_data)
		return INV_ERROR_MEMORY_EXAUSTED;

	pdata->private_data = private_data;

	result = adxl34x_set_odr(mlsl_handle, pdata, &private_data->suspend,
				false, 0);
	if (result) {
		LOG_RESULT_LOCATION(result);
		return result;
	}
	result = adxl34x_set_odr(mlsl_handle, pdata, &private_data->resume,
				false, 200000);
	if (result) {
		LOG_RESULT_LOCATION(result);
		return result;
	}

	range = range_fixedpoint_to_long_mg(slave->range);
	result = adxl34x_set_fsr(mlsl_handle, pdata, &private_data->suspend,
				false, range);
	result = adxl34x_set_fsr(mlsl_handle, pdata, &private_data->resume,
				false, range);
	if (result) {
		LOG_RESULT_LOCATION(result);
		return result;
	}

	result = adxl34x_suspend(mlsl_handle, slave, pdata);
	if (result) {
		LOG_RESULT_LOCATION(result);
		return result;
	}

	return result;
}
static void adxl34x_early_suspend(struct early_suspend *h)
{
	struct adxl34x *ac;
	ac = container_of(h, struct adxl34x, early_suspend);
	adxl34x_suspend(ac->bus, PMSG_SUSPEND);
}
static void adxl34x_early_suspend(struct early_suspend *h)
{
	// printk("========%s========\n",__FUNCTION__);
//	struct adxl34x *ac = i2c_get_clientdata(client);	
	adxl34x_suspend(acii);
}