Lines Matching +full:sc2731 +full:- +full:vibrator
1 // SPDX-License-Identifier: GPL-2.0
58 const struct sc27xx_vibra_data *data = info->data; in sc27xx_vibra_set()
60 regmap_update_bits(info->regmap, info->base, data->ldo_pd, 0); in sc27xx_vibra_set()
61 regmap_update_bits(info->regmap, info->base, in sc27xx_vibra_set()
62 data->slp_pd_en, 0); in sc27xx_vibra_set()
63 info->enabled = true; in sc27xx_vibra_set()
65 regmap_update_bits(info->regmap, info->base, data->ldo_pd, in sc27xx_vibra_set()
66 data->ldo_pd); in sc27xx_vibra_set()
67 regmap_update_bits(info->regmap, info->base, in sc27xx_vibra_set()
68 data->slp_pd_en, data->slp_pd_en); in sc27xx_vibra_set()
69 info->enabled = false; in sc27xx_vibra_set()
75 const struct sc27xx_vibra_data *data = info->data; in sc27xx_vibra_hw_init()
77 if (!data->cur_drv_cal_sel) in sc27xx_vibra_hw_init()
80 return regmap_update_bits(info->regmap, info->base, in sc27xx_vibra_hw_init()
81 data->cur_drv_cal_sel, 0); in sc27xx_vibra_hw_init()
89 if (info->strength && !info->enabled) in sc27xx_vibra_play_work()
91 else if (info->strength == 0 && info->enabled) in sc27xx_vibra_play_work()
100 info->strength = effect->u.rumble.weak_magnitude; in sc27xx_vibra_play()
101 schedule_work(&info->play_work); in sc27xx_vibra_play()
110 cancel_work_sync(&info->play_work); in sc27xx_vibra_close()
111 if (info->enabled) in sc27xx_vibra_close()
121 data = device_get_match_data(&pdev->dev); in sc27xx_vibra_probe()
123 dev_err(&pdev->dev, "no matching driver data found\n"); in sc27xx_vibra_probe()
124 return -EINVAL; in sc27xx_vibra_probe()
127 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in sc27xx_vibra_probe()
129 return -ENOMEM; in sc27xx_vibra_probe()
131 info->regmap = dev_get_regmap(pdev->dev.parent, NULL); in sc27xx_vibra_probe()
132 if (!info->regmap) { in sc27xx_vibra_probe()
133 dev_err(&pdev->dev, "failed to get vibrator regmap.\n"); in sc27xx_vibra_probe()
134 return -ENODEV; in sc27xx_vibra_probe()
137 error = device_property_read_u32(&pdev->dev, "reg", &info->base); in sc27xx_vibra_probe()
139 dev_err(&pdev->dev, "failed to get vibrator base address.\n"); in sc27xx_vibra_probe()
143 info->input_dev = devm_input_allocate_device(&pdev->dev); in sc27xx_vibra_probe()
144 if (!info->input_dev) { in sc27xx_vibra_probe()
145 dev_err(&pdev->dev, "failed to allocate input device.\n"); in sc27xx_vibra_probe()
146 return -ENOMEM; in sc27xx_vibra_probe()
149 info->input_dev->name = "sc27xx:vibrator"; in sc27xx_vibra_probe()
150 info->input_dev->id.version = 0; in sc27xx_vibra_probe()
151 info->input_dev->close = sc27xx_vibra_close; in sc27xx_vibra_probe()
152 info->data = data; in sc27xx_vibra_probe()
154 input_set_drvdata(info->input_dev, info); in sc27xx_vibra_probe()
155 input_set_capability(info->input_dev, EV_FF, FF_RUMBLE); in sc27xx_vibra_probe()
156 INIT_WORK(&info->play_work, sc27xx_vibra_play_work); in sc27xx_vibra_probe()
157 info->enabled = false; in sc27xx_vibra_probe()
161 dev_err(&pdev->dev, "failed to initialize the vibrator.\n"); in sc27xx_vibra_probe()
165 error = input_ff_create_memless(info->input_dev, NULL, in sc27xx_vibra_probe()
168 dev_err(&pdev->dev, "failed to register vibrator to FF.\n"); in sc27xx_vibra_probe()
172 error = input_register_device(info->input_dev); in sc27xx_vibra_probe()
174 dev_err(&pdev->dev, "failed to register input device.\n"); in sc27xx_vibra_probe()
182 { .compatible = "sprd,sc2721-vibrator", .data = &sc2721_data },
183 { .compatible = "sprd,sc2730-vibrator", .data = &sc2730_data },
184 { .compatible = "sprd,sc2731-vibrator", .data = &sc2731_data },
191 .name = "sc27xx-vibrator",
199 MODULE_DESCRIPTION("Spreadtrum SC27xx Vibrator Driver");