Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1300bafe authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: input: sensors: Fix i2c api conflict of smi130 driver"

parents 8ab1a8a4 88e66bc7
Loading
Loading
Loading
Loading
+0 −60
Original line number Diff line number Diff line
@@ -7404,64 +7404,6 @@ void smi130_acc_shutdown(struct i2c_client *client)
	mutex_unlock(&data->enable_mutex);
}

#ifdef CONFIG_PM
static int smi130_acc_suspend(struct i2c_client *client, pm_message_t mesg)
{
	struct smi130_acc_data *data = i2c_get_clientdata(client);

	mutex_lock(&data->enable_mutex);
	if (atomic_read(&data->enable) == 1) {
		smi130_acc_set_mode(data->smi130_acc_client,
			SMI_ACC2X2_MODE_SUSPEND, SMI_ACC_ENABLED_INPUT);
#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT
		cancel_delayed_work_sync(&data->work);
#endif
	}
	if (data->is_timer_running) {
		hrtimer_cancel(&data->timer);
		data->base_time = 0;
		data->timestamp = 0;
		data->fifo_time = 0;
		data->acc_count = 0;
	}
	mutex_unlock(&data->enable_mutex);

	return 0;
}

static int smi130_acc_resume(struct i2c_client *client)
{
	struct smi130_acc_data *data = i2c_get_clientdata(client);

	mutex_lock(&data->enable_mutex);
	if (atomic_read(&data->enable) == 1) {
		smi130_acc_set_mode(data->smi130_acc_client,
			SMI_ACC2X2_MODE_NORMAL, SMI_ACC_ENABLED_INPUT);
#ifndef CONFIG_SMI_ACC_ENABLE_NEWDATA_INT
		schedule_delayed_work(&data->work,
				msecs_to_jiffies(atomic_read(&data->delay)));
#endif
	}
	if (data->is_timer_running) {
		hrtimer_start(&data->timer,
					ns_to_ktime(data->time_odr),
			HRTIMER_MODE_REL);
		data->base_time = 0;
		data->timestamp = 0;
		data->is_timer_running = 1;
	}
	mutex_unlock(&data->enable_mutex);

	return 0;
}

#else

#define smi130_acc_suspend      NULL
#define smi130_acc_resume       NULL

#endif /* CONFIG_PM */

static const struct i2c_device_id smi130_acc_id[] = {
	{ SENSOR_NAME, 0 },
	{ }
@@ -7480,8 +7422,6 @@ static struct i2c_driver smi130_acc_driver = {
		.name   = SENSOR_NAME,
		.of_match_table = smi130_acc_of_match,
	},
	//.suspend    = smi130_acc_suspend,
	//.resume     = smi130_acc_resume,
	.id_table   = smi130_acc_id,
	.probe      = smi130_acc_probe,
	.remove     = smi130_acc_remove,
+3 −47
Original line number Diff line number Diff line
@@ -293,10 +293,9 @@ static int smi_gyro_i2c_write(struct i2c_client *client, u8 reg_addr,
static void smi_gyro_dump_reg(struct i2c_client *client);
static int smi_gyro_check_chip_id(struct i2c_client *client);

static int smi_gyro_pre_suspend(struct i2c_client *client);
static int smi_gyro_post_resume(struct i2c_client *client);

#ifdef CONFIG_HAS_EARLYSUSPEND
static int smi_gyro_post_resume(struct i2c_client *client);
static int smi_gyro_pre_suspend(struct i2c_client *client);
static void smi_gyro_early_suspend(struct early_suspend *handler);
static void smi_gyro_late_resume(struct early_suspend *handler);
#endif
@@ -1812,6 +1811,7 @@ static int smi_gyro_probe(struct i2c_client *client, const struct i2c_device_id
	return err;
}

#ifdef CONFIG_HAS_EARLYSUSPEND
static int smi_gyro_pre_suspend(struct i2c_client *client)
{
	int err = 0;
@@ -1861,7 +1861,6 @@ static int smi_gyro_post_resume(struct i2c_client *client)
	return err;
}

#ifdef CONFIG_HAS_EARLYSUSPEND
static void smi_gyro_early_suspend(struct early_suspend *handler)
{
	int err = 0;
@@ -1902,45 +1901,6 @@ static void smi_gyro_late_resume(struct early_suspend *handler)

	mutex_unlock(&client_data->mutex_op_mode);
}
#else
static int smi_gyro_suspend(struct i2c_client *client, pm_message_t mesg)
{
	int err = 0;
	struct smi_gyro_client_data *client_data =
		(struct smi_gyro_client_data *)i2c_get_clientdata(client);

	PINFO("function entrance");

	mutex_lock(&client_data->mutex_op_mode);
	if (client_data->enable) {
		err = smi_gyro_pre_suspend(client);
		err = SMI_GYRO_CALL_API(set_mode)(
				SMI_GYRO_VAL_NAME(MODE_SUSPEND));
	}
	mutex_unlock(&client_data->mutex_op_mode);
	return err;
}

static int smi_gyro_resume(struct i2c_client *client)
{

	int err = 0;
	struct smi_gyro_client_data *client_data =
		(struct smi_gyro_client_data *)i2c_get_clientdata(client);

	PINFO("function entrance");

	mutex_lock(&client_data->mutex_op_mode);

	if (client_data->enable)
		err = SMI_GYRO_CALL_API(set_mode)(SMI_GYRO_VAL_NAME(MODE_NORMAL));

	/* post resume operation */
	smi_gyro_post_resume(client);

	mutex_unlock(&client_data->mutex_op_mode);
	return err;
}
#endif

void smi_gyro_shutdown(struct i2c_client *client)
@@ -2012,10 +1972,6 @@ static struct i2c_driver smi_gyro_driver = {
	.probe = smi_gyro_probe,
	.remove = smi_gyro_remove,
	.shutdown = smi_gyro_shutdown,
#ifndef CONFIG_HAS_EARLYSUSPEND
	//.suspend = smi_gyro_suspend,
	//.resume = smi_gyro_resume,
#endif
};

static int __init SMI_GYRO_init(void)