Lines Matching refs:client

111 	struct i2c_client *client;  member
124 static int mpu3050_xyz_read_reg(struct i2c_client *client, in mpu3050_xyz_read_reg() argument
134 .addr = client->addr, in mpu3050_xyz_read_reg()
140 .addr = client->addr, in mpu3050_xyz_read_reg()
147 return i2c_transfer(client->adapter, msg, 2); in mpu3050_xyz_read_reg()
157 static void mpu3050_read_xyz(struct i2c_client *client, in mpu3050_read_xyz() argument
162 mpu3050_xyz_read_reg(client, (u8 *)buffer, 6); in mpu3050_read_xyz()
166 dev_dbg(&client->dev, "%s: x %d, y %d, z %d\n", __func__, in mpu3050_read_xyz()
177 static void mpu3050_set_power_mode(struct i2c_client *client, u8 val) in mpu3050_set_power_mode() argument
181 value = i2c_smbus_read_byte_data(client, MPU3050_PWR_MGM); in mpu3050_set_power_mode()
185 i2c_smbus_write_byte_data(client, MPU3050_PWR_MGM, value); in mpu3050_set_power_mode()
204 error = i2c_smbus_write_byte_data(sensor->client, MPU3050_INT_CFG, in mpu3050_input_open()
243 mpu3050_read_xyz(sensor->client, &axis); in mpu3050_interrupt_thread()
261 struct i2c_client *client = sensor->client; in mpu3050_hw_init() local
266 ret = i2c_smbus_write_byte_data(client, MPU3050_PWR_MGM, in mpu3050_hw_init()
271 ret = i2c_smbus_read_byte_data(client, MPU3050_PWR_MGM); in mpu3050_hw_init()
277 ret = i2c_smbus_write_byte_data(client, MPU3050_PWR_MGM, ret); in mpu3050_hw_init()
282 ret = i2c_smbus_write_byte_data(client, MPU3050_SMPLRT_DIV, in mpu3050_hw_init()
291 ret = i2c_smbus_write_byte_data(client, MPU3050_DLPF_FS_SYNC, reg); in mpu3050_hw_init()
308 static int mpu3050_probe(struct i2c_client *client, in mpu3050_probe() argument
319 dev_err(&client->dev, "failed to allocate driver data\n"); in mpu3050_probe()
324 sensor->client = client; in mpu3050_probe()
325 sensor->dev = &client->dev; in mpu3050_probe()
328 mpu3050_set_power_mode(client, 1); in mpu3050_probe()
331 ret = i2c_smbus_read_byte_data(client, MPU3050_CHIP_ID_REG); in mpu3050_probe()
333 dev_err(&client->dev, "failed to detect device\n"); in mpu3050_probe()
339 dev_err(&client->dev, "unsupported chip id\n"); in mpu3050_probe()
346 idev->dev.parent = &client->dev; in mpu3050_probe()
361 pm_runtime_set_active(&client->dev); in mpu3050_probe()
367 error = request_threaded_irq(client->irq, in mpu3050_probe()
372 dev_err(&client->dev, in mpu3050_probe()
373 "can't get IRQ %d, error %d\n", client->irq, error); in mpu3050_probe()
379 dev_err(&client->dev, "failed to register input device\n"); in mpu3050_probe()
383 pm_runtime_enable(&client->dev); in mpu3050_probe()
384 pm_runtime_set_autosuspend_delay(&client->dev, MPU3050_AUTO_DELAY); in mpu3050_probe()
385 i2c_set_clientdata(client, sensor); in mpu3050_probe()
390 free_irq(client->irq, sensor); in mpu3050_probe()
392 pm_runtime_set_suspended(&client->dev); in mpu3050_probe()
405 static int mpu3050_remove(struct i2c_client *client) in mpu3050_remove() argument
407 struct mpu3050_sensor *sensor = i2c_get_clientdata(client); in mpu3050_remove()
409 pm_runtime_disable(&client->dev); in mpu3050_remove()
410 pm_runtime_set_suspended(&client->dev); in mpu3050_remove()
412 free_irq(client->irq, sensor); in mpu3050_remove()
428 struct i2c_client *client = to_i2c_client(dev); in mpu3050_suspend() local
430 mpu3050_set_power_mode(client, 0); in mpu3050_suspend()
443 struct i2c_client *client = to_i2c_client(dev); in mpu3050_resume() local
445 mpu3050_set_power_mode(client, 1); in mpu3050_resume()