haptic 67 drivers/input/misc/max77693-haptic.c static int max77693_haptic_set_duty_cycle(struct max77693_haptic *haptic) haptic 73 drivers/input/misc/max77693-haptic.c pwm_get_args(haptic->pwm_dev, &pargs); haptic 74 drivers/input/misc/max77693-haptic.c delta = (pargs.period + haptic->pwm_duty) / 2; haptic 75 drivers/input/misc/max77693-haptic.c error = pwm_config(haptic->pwm_dev, delta, pargs.period); haptic 77 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, "failed to configure pwm: %d\n", error); haptic 84 drivers/input/misc/max77693-haptic.c static int max77843_haptic_bias(struct max77693_haptic *haptic, bool on) haptic 88 drivers/input/misc/max77693-haptic.c if (haptic->dev_type != TYPE_MAX77843) haptic 91 drivers/input/misc/max77693-haptic.c error = regmap_update_bits(haptic->regmap_haptic, haptic 96 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, "failed to %s bias: %d\n", haptic 104 drivers/input/misc/max77693-haptic.c static int max77693_haptic_configure(struct max77693_haptic *haptic, haptic 110 drivers/input/misc/max77693-haptic.c switch (haptic->dev_type) { haptic 112 drivers/input/misc/max77693-haptic.c value = ((haptic->type << MAX77693_CONFIG2_MODE) | haptic 114 drivers/input/misc/max77693-haptic.c (haptic->mode << MAX77693_CONFIG2_HTYP) | haptic 119 drivers/input/misc/max77693-haptic.c value = (haptic->type << MCONFIG_MODE_SHIFT) | haptic 128 drivers/input/misc/max77693-haptic.c error = regmap_write(haptic->regmap_haptic, haptic 131 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, haptic 139 drivers/input/misc/max77693-haptic.c static int max77693_haptic_lowsys(struct max77693_haptic *haptic, bool enable) haptic 143 drivers/input/misc/max77693-haptic.c if (haptic->dev_type != TYPE_MAX77693) haptic 146 drivers/input/misc/max77693-haptic.c error = regmap_update_bits(haptic->regmap_pmic, haptic 151 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, "cannot update pmic regmap: %d\n", error); haptic 158 drivers/input/misc/max77693-haptic.c static void max77693_haptic_enable(struct max77693_haptic *haptic) haptic 162 drivers/input/misc/max77693-haptic.c if (haptic->enabled) haptic 165 drivers/input/misc/max77693-haptic.c error = pwm_enable(haptic->pwm_dev); haptic 167 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, haptic 172 drivers/input/misc/max77693-haptic.c error = max77693_haptic_lowsys(haptic, true); haptic 176 drivers/input/misc/max77693-haptic.c error = max77693_haptic_configure(haptic, true); haptic 180 drivers/input/misc/max77693-haptic.c haptic->enabled = true; haptic 185 drivers/input/misc/max77693-haptic.c max77693_haptic_lowsys(haptic, false); haptic 187 drivers/input/misc/max77693-haptic.c pwm_disable(haptic->pwm_dev); haptic 190 drivers/input/misc/max77693-haptic.c static void max77693_haptic_disable(struct max77693_haptic *haptic) haptic 194 drivers/input/misc/max77693-haptic.c if (!haptic->enabled) haptic 197 drivers/input/misc/max77693-haptic.c error = max77693_haptic_configure(haptic, false); haptic 201 drivers/input/misc/max77693-haptic.c error = max77693_haptic_lowsys(haptic, false); haptic 205 drivers/input/misc/max77693-haptic.c pwm_disable(haptic->pwm_dev); haptic 206 drivers/input/misc/max77693-haptic.c haptic->enabled = false; haptic 211 drivers/input/misc/max77693-haptic.c max77693_haptic_configure(haptic, true); haptic 216 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic = haptic 220 drivers/input/misc/max77693-haptic.c error = max77693_haptic_set_duty_cycle(haptic); haptic 222 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, "failed to set duty cycle: %d\n", error); haptic 226 drivers/input/misc/max77693-haptic.c if (haptic->magnitude) haptic 227 drivers/input/misc/max77693-haptic.c max77693_haptic_enable(haptic); haptic 229 drivers/input/misc/max77693-haptic.c max77693_haptic_disable(haptic); haptic 235 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic = input_get_drvdata(dev); haptic 239 drivers/input/misc/max77693-haptic.c haptic->magnitude = effect->u.rumble.strong_magnitude; haptic 240 drivers/input/misc/max77693-haptic.c if (!haptic->magnitude) haptic 241 drivers/input/misc/max77693-haptic.c haptic->magnitude = effect->u.rumble.weak_magnitude; haptic 248 drivers/input/misc/max77693-haptic.c pwm_get_args(haptic->pwm_dev, &pargs); haptic 249 drivers/input/misc/max77693-haptic.c period_mag_multi = (u64)pargs.period * haptic->magnitude; haptic 250 drivers/input/misc/max77693-haptic.c haptic->pwm_duty = (unsigned int)(period_mag_multi >> haptic 253 drivers/input/misc/max77693-haptic.c schedule_work(&haptic->work); haptic 260 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic = input_get_drvdata(dev); haptic 263 drivers/input/misc/max77693-haptic.c error = max77843_haptic_bias(haptic, true); haptic 267 drivers/input/misc/max77693-haptic.c error = regulator_enable(haptic->motor_reg); haptic 269 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, haptic 279 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic = input_get_drvdata(dev); haptic 282 drivers/input/misc/max77693-haptic.c cancel_work_sync(&haptic->work); haptic 283 drivers/input/misc/max77693-haptic.c max77693_haptic_disable(haptic); haptic 285 drivers/input/misc/max77693-haptic.c error = regulator_disable(haptic->motor_reg); haptic 287 drivers/input/misc/max77693-haptic.c dev_err(haptic->dev, haptic 290 drivers/input/misc/max77693-haptic.c max77843_haptic_bias(haptic, false); haptic 296 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic; haptic 299 drivers/input/misc/max77693-haptic.c haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL); haptic 300 drivers/input/misc/max77693-haptic.c if (!haptic) haptic 303 drivers/input/misc/max77693-haptic.c haptic->regmap_pmic = max77693->regmap; haptic 304 drivers/input/misc/max77693-haptic.c haptic->dev = &pdev->dev; haptic 305 drivers/input/misc/max77693-haptic.c haptic->type = MAX77693_HAPTIC_LRA; haptic 306 drivers/input/misc/max77693-haptic.c haptic->mode = MAX77693_HAPTIC_EXTERNAL_MODE; haptic 307 drivers/input/misc/max77693-haptic.c haptic->suspend_state = false; haptic 310 drivers/input/misc/max77693-haptic.c haptic->dev_type = platform_get_device_id(pdev)->driver_data; haptic 311 drivers/input/misc/max77693-haptic.c switch (haptic->dev_type) { haptic 313 drivers/input/misc/max77693-haptic.c haptic->regmap_haptic = max77693->regmap_haptic; haptic 316 drivers/input/misc/max77693-haptic.c haptic->regmap_haptic = max77693->regmap; haptic 320 drivers/input/misc/max77693-haptic.c haptic->dev_type); haptic 324 drivers/input/misc/max77693-haptic.c INIT_WORK(&haptic->work, max77693_haptic_play_work); haptic 327 drivers/input/misc/max77693-haptic.c haptic->pwm_dev = devm_pwm_get(&pdev->dev, NULL); haptic 328 drivers/input/misc/max77693-haptic.c if (IS_ERR(haptic->pwm_dev)) { haptic 330 drivers/input/misc/max77693-haptic.c return PTR_ERR(haptic->pwm_dev); haptic 337 drivers/input/misc/max77693-haptic.c pwm_apply_args(haptic->pwm_dev); haptic 339 drivers/input/misc/max77693-haptic.c haptic->motor_reg = devm_regulator_get(&pdev->dev, "haptic"); haptic 340 drivers/input/misc/max77693-haptic.c if (IS_ERR(haptic->motor_reg)) { haptic 342 drivers/input/misc/max77693-haptic.c return PTR_ERR(haptic->motor_reg); haptic 346 drivers/input/misc/max77693-haptic.c haptic->input_dev = devm_input_allocate_device(&pdev->dev); haptic 347 drivers/input/misc/max77693-haptic.c if (!haptic->input_dev) { haptic 352 drivers/input/misc/max77693-haptic.c haptic->input_dev->name = "max77693-haptic"; haptic 353 drivers/input/misc/max77693-haptic.c haptic->input_dev->id.version = 1; haptic 354 drivers/input/misc/max77693-haptic.c haptic->input_dev->dev.parent = &pdev->dev; haptic 355 drivers/input/misc/max77693-haptic.c haptic->input_dev->open = max77693_haptic_open; haptic 356 drivers/input/misc/max77693-haptic.c haptic->input_dev->close = max77693_haptic_close; haptic 357 drivers/input/misc/max77693-haptic.c input_set_drvdata(haptic->input_dev, haptic); haptic 358 drivers/input/misc/max77693-haptic.c input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE); haptic 360 drivers/input/misc/max77693-haptic.c error = input_ff_create_memless(haptic->input_dev, NULL, haptic 367 drivers/input/misc/max77693-haptic.c error = input_register_device(haptic->input_dev); haptic 373 drivers/input/misc/max77693-haptic.c platform_set_drvdata(pdev, haptic); haptic 381 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic = platform_get_drvdata(pdev); haptic 383 drivers/input/misc/max77693-haptic.c if (haptic->enabled) { haptic 384 drivers/input/misc/max77693-haptic.c max77693_haptic_disable(haptic); haptic 385 drivers/input/misc/max77693-haptic.c haptic->suspend_state = true; haptic 394 drivers/input/misc/max77693-haptic.c struct max77693_haptic *haptic = platform_get_drvdata(pdev); haptic 396 drivers/input/misc/max77693-haptic.c if (haptic->suspend_state) { haptic 397 drivers/input/misc/max77693-haptic.c max77693_haptic_enable(haptic); haptic 398 drivers/input/misc/max77693-haptic.c haptic->suspend_state = false; haptic 268 drivers/input/misc/max8997_haptic.c chip->client = iodev->haptic; haptic 36 drivers/input/misc/regulator-haptic.c static int regulator_haptic_toggle(struct regulator_haptic *haptic, bool on) haptic 40 drivers/input/misc/regulator-haptic.c if (haptic->active != on) { haptic 42 drivers/input/misc/regulator-haptic.c error = on ? regulator_enable(haptic->regulator) : haptic 43 drivers/input/misc/regulator-haptic.c regulator_disable(haptic->regulator); haptic 45 drivers/input/misc/regulator-haptic.c dev_err(haptic->dev, haptic 51 drivers/input/misc/regulator-haptic.c haptic->active = on; haptic 57 drivers/input/misc/regulator-haptic.c static int regulator_haptic_set_voltage(struct regulator_haptic *haptic, haptic 64 drivers/input/misc/regulator-haptic.c volt_mag_multi = (u64)(haptic->max_volt - haptic->min_volt) * magnitude; haptic 67 drivers/input/misc/regulator-haptic.c error = regulator_set_voltage(haptic->regulator, haptic 68 drivers/input/misc/regulator-haptic.c intensity + haptic->min_volt, haptic 69 drivers/input/misc/regulator-haptic.c haptic->max_volt); haptic 71 drivers/input/misc/regulator-haptic.c dev_err(haptic->dev, "cannot set regulator voltage to %d: %d\n", haptic 72 drivers/input/misc/regulator-haptic.c intensity + haptic->min_volt, error); haptic 76 drivers/input/misc/regulator-haptic.c regulator_haptic_toggle(haptic, !!magnitude); haptic 83 drivers/input/misc/regulator-haptic.c struct regulator_haptic *haptic = container_of(work, haptic 86 drivers/input/misc/regulator-haptic.c mutex_lock(&haptic->mutex); haptic 88 drivers/input/misc/regulator-haptic.c if (!haptic->suspended) haptic 89 drivers/input/misc/regulator-haptic.c regulator_haptic_set_voltage(haptic, haptic->magnitude); haptic 91 drivers/input/misc/regulator-haptic.c mutex_unlock(&haptic->mutex); haptic 97 drivers/input/misc/regulator-haptic.c struct regulator_haptic *haptic = input_get_drvdata(input); haptic 99 drivers/input/misc/regulator-haptic.c haptic->magnitude = effect->u.rumble.strong_magnitude; haptic 100 drivers/input/misc/regulator-haptic.c if (!haptic->magnitude) haptic 101 drivers/input/misc/regulator-haptic.c haptic->magnitude = effect->u.rumble.weak_magnitude; haptic 103 drivers/input/misc/regulator-haptic.c schedule_work(&haptic->work); haptic 110 drivers/input/misc/regulator-haptic.c struct regulator_haptic *haptic = input_get_drvdata(input); haptic 112 drivers/input/misc/regulator-haptic.c cancel_work_sync(&haptic->work); haptic 113 drivers/input/misc/regulator-haptic.c regulator_haptic_set_voltage(haptic, 0); haptic 117 drivers/input/misc/regulator-haptic.c regulator_haptic_parse_dt(struct device *dev, struct regulator_haptic *haptic) haptic 128 drivers/input/misc/regulator-haptic.c error = of_property_read_u32(node, "max-microvolt", &haptic->max_volt); haptic 134 drivers/input/misc/regulator-haptic.c error = of_property_read_u32(node, "min-microvolt", &haptic->min_volt); haptic 146 drivers/input/misc/regulator-haptic.c struct regulator_haptic *haptic; haptic 150 drivers/input/misc/regulator-haptic.c haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL); haptic 151 drivers/input/misc/regulator-haptic.c if (!haptic) haptic 154 drivers/input/misc/regulator-haptic.c platform_set_drvdata(pdev, haptic); haptic 155 drivers/input/misc/regulator-haptic.c haptic->dev = &pdev->dev; haptic 156 drivers/input/misc/regulator-haptic.c mutex_init(&haptic->mutex); haptic 157 drivers/input/misc/regulator-haptic.c INIT_WORK(&haptic->work, regulator_haptic_work); haptic 160 drivers/input/misc/regulator-haptic.c haptic->max_volt = pdata->max_volt; haptic 161 drivers/input/misc/regulator-haptic.c haptic->min_volt = pdata->min_volt; haptic 163 drivers/input/misc/regulator-haptic.c error = regulator_haptic_parse_dt(&pdev->dev, haptic); haptic 171 drivers/input/misc/regulator-haptic.c haptic->regulator = devm_regulator_get_exclusive(&pdev->dev, "haptic"); haptic 172 drivers/input/misc/regulator-haptic.c if (IS_ERR(haptic->regulator)) { haptic 174 drivers/input/misc/regulator-haptic.c return PTR_ERR(haptic->regulator); haptic 181 drivers/input/misc/regulator-haptic.c haptic->input_dev = input_dev; haptic 182 drivers/input/misc/regulator-haptic.c haptic->input_dev->name = "regulator-haptic"; haptic 183 drivers/input/misc/regulator-haptic.c haptic->input_dev->dev.parent = &pdev->dev; haptic 184 drivers/input/misc/regulator-haptic.c haptic->input_dev->close = regulator_haptic_close; haptic 185 drivers/input/misc/regulator-haptic.c input_set_drvdata(haptic->input_dev, haptic); haptic 186 drivers/input/misc/regulator-haptic.c input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE); haptic 195 drivers/input/misc/regulator-haptic.c error = input_register_device(haptic->input_dev); haptic 207 drivers/input/misc/regulator-haptic.c struct regulator_haptic *haptic = platform_get_drvdata(pdev); haptic 210 drivers/input/misc/regulator-haptic.c error = mutex_lock_interruptible(&haptic->mutex); haptic 214 drivers/input/misc/regulator-haptic.c regulator_haptic_set_voltage(haptic, 0); haptic 216 drivers/input/misc/regulator-haptic.c haptic->suspended = true; haptic 218 drivers/input/misc/regulator-haptic.c mutex_unlock(&haptic->mutex); haptic 226 drivers/input/misc/regulator-haptic.c struct regulator_haptic *haptic = platform_get_drvdata(pdev); haptic 229 drivers/input/misc/regulator-haptic.c mutex_lock(&haptic->mutex); haptic 231 drivers/input/misc/regulator-haptic.c haptic->suspended = false; haptic 233 drivers/input/misc/regulator-haptic.c magnitude = READ_ONCE(haptic->magnitude); haptic 235 drivers/input/misc/regulator-haptic.c regulator_haptic_set_voltage(haptic, magnitude); haptic 237 drivers/input/misc/regulator-haptic.c mutex_unlock(&haptic->mutex); haptic 195 drivers/mfd/max8997.c max8997->haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC); haptic 196 drivers/mfd/max8997.c if (IS_ERR(max8997->haptic)) { haptic 198 drivers/mfd/max8997.c ret = PTR_ERR(max8997->haptic); haptic 201 drivers/mfd/max8997.c i2c_set_clientdata(max8997->haptic, max8997); haptic 237 drivers/mfd/max8997.c i2c_unregister_device(max8997->haptic); haptic 373 include/linux/mfd/max8997-private.h struct i2c_client *haptic; /* slave addr 0x90 */