Lines Matching refs:haptics
78 struct drv2665_data *haptics = in drv2665_worker() local
83 error = regmap_read(haptics->regmap, DRV2665_STATUS, &read_buf); in drv2665_worker()
85 dev_err(&haptics->client->dev, in drv2665_worker()
91 error = regmap_bulk_write(haptics->regmap, in drv2665_worker()
96 dev_err(&haptics->client->dev, in drv2665_worker()
106 struct drv2665_data *haptics = input_get_drvdata(input); in drv2665_haptics_play() local
108 schedule_work(&haptics->work); in drv2665_haptics_play()
115 struct drv2665_data *haptics = input_get_drvdata(input); in drv2665_close() local
118 cancel_work_sync(&haptics->work); in drv2665_close()
120 error = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2, in drv2665_close()
123 dev_err(&haptics->client->dev, in drv2665_close()
132 static int drv2665_init(struct drv2665_data *haptics) in drv2665_init() argument
136 error = regmap_register_patch(haptics->regmap, in drv2665_init()
140 dev_err(&haptics->client->dev, in drv2665_init()
162 struct drv2665_data *haptics; in drv2665_probe() local
165 haptics = devm_kzalloc(&client->dev, sizeof(*haptics), GFP_KERNEL); in drv2665_probe()
166 if (!haptics) in drv2665_probe()
169 haptics->regulator = devm_regulator_get(&client->dev, "vbat"); in drv2665_probe()
170 if (IS_ERR(haptics->regulator)) { in drv2665_probe()
171 error = PTR_ERR(haptics->regulator); in drv2665_probe()
177 haptics->input_dev = devm_input_allocate_device(&client->dev); in drv2665_probe()
178 if (!haptics->input_dev) { in drv2665_probe()
183 haptics->input_dev->name = "drv2665:haptics"; in drv2665_probe()
184 haptics->input_dev->dev.parent = client->dev.parent; in drv2665_probe()
185 haptics->input_dev->close = drv2665_close; in drv2665_probe()
186 input_set_drvdata(haptics->input_dev, haptics); in drv2665_probe()
187 input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE); in drv2665_probe()
189 error = input_ff_create_memless(haptics->input_dev, NULL, in drv2665_probe()
197 INIT_WORK(&haptics->work, drv2665_worker); in drv2665_probe()
199 haptics->client = client; in drv2665_probe()
200 i2c_set_clientdata(client, haptics); in drv2665_probe()
202 haptics->regmap = devm_regmap_init_i2c(client, &drv2665_regmap_config); in drv2665_probe()
203 if (IS_ERR(haptics->regmap)) { in drv2665_probe()
204 error = PTR_ERR(haptics->regmap); in drv2665_probe()
210 error = drv2665_init(haptics); in drv2665_probe()
216 error = input_register_device(haptics->input_dev); in drv2665_probe()
228 struct drv2665_data *haptics = dev_get_drvdata(dev); in drv2665_suspend() local
231 mutex_lock(&haptics->input_dev->mutex); in drv2665_suspend()
233 if (input_device_enabled(haptics->input_dev)) { in drv2665_suspend()
234 ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2, in drv2665_suspend()
238 regulator_disable(haptics->regulator); in drv2665_suspend()
242 ret = regulator_disable(haptics->regulator); in drv2665_suspend()
245 regmap_update_bits(haptics->regmap, in drv2665_suspend()
251 mutex_unlock(&haptics->input_dev->mutex); in drv2665_suspend()
257 struct drv2665_data *haptics = dev_get_drvdata(dev); in drv2665_resume() local
260 mutex_lock(&haptics->input_dev->mutex); in drv2665_resume()
262 if (input_device_enabled(haptics->input_dev)) { in drv2665_resume()
263 ret = regulator_enable(haptics->regulator); in drv2665_resume()
269 ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2, in drv2665_resume()
273 regulator_disable(haptics->regulator); in drv2665_resume()
280 mutex_unlock(&haptics->input_dev->mutex); in drv2665_resume()