^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * twl4030-vibra.c - TWL4030 Vibrator driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2008-2010 Nokia Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Written by Henrik Saari <henrik.saari@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Updates by Felipe Balbi <felipe.balbi@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Input by Jari Vanhala <ext-jari.vanhala@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/jiffies.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/mfd/twl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/mfd/twl4030-audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* MODULE ID2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define LEDEN 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* ForceFeedback */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define EFFECT_DIR_180_DEG 0x8000 /* range is 0 - 0xFFFF */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct vibra_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct input_dev *input_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct work_struct play_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) bool enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) int speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int direction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) bool coexist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static void vibra_disable_leds(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) u8 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /* Disable LEDA & LEDB, cannot be used with vibra (PWM) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) twl_i2c_read_u8(TWL4030_MODULE_LED, ®, LEDEN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) reg &= ~0x03;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) twl_i2c_write_u8(TWL4030_MODULE_LED, LEDEN, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* Powers H-Bridge and enables audio clk */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) static void vibra_enable(struct vibra_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u8 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) twl4030_audio_enable_resource(TWL4030_AUDIO_RES_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* turn H-Bridge on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ®, TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) (reg | TWL4030_VIBRA_EN), TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) twl4030_audio_enable_resource(TWL4030_AUDIO_RES_APLL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) info->enabled = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static void vibra_disable(struct vibra_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) u8 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /* Power down H-Bridge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) ®, TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) (reg & ~TWL4030_VIBRA_EN), TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) twl4030_audio_disable_resource(TWL4030_AUDIO_RES_APLL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) twl4030_audio_disable_resource(TWL4030_AUDIO_RES_POWER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) info->enabled = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) static void vibra_play_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct vibra_info *info = container_of(work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct vibra_info, play_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) int dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) int pwm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) u8 reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) dir = info->direction;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) pwm = info->speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) ®, TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) if (pwm && (!info->coexist || !(reg & TWL4030_VIBRA_SEL))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) if (!info->enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) vibra_enable(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* set vibra rotation direction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ®, TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) reg = (dir) ? (reg | TWL4030_VIBRA_DIR) :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) (reg & ~TWL4030_VIBRA_DIR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) reg, TWL4030_REG_VIBRA_CTL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) /* set PWM, 1 = max, 255 = min */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 256 - pwm, TWL4030_REG_VIBRA_SET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (info->enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) vibra_disable(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /*** Input/ForceFeedback ***/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static int vibra_play(struct input_dev *input, void *data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct ff_effect *effect)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) struct vibra_info *info = input_get_drvdata(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) info->speed = effect->u.rumble.strong_magnitude >> 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) if (!info->speed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) info->speed = effect->u.rumble.weak_magnitude >> 9;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) info->direction = effect->direction < EFFECT_DIR_180_DEG ? 0 : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) schedule_work(&info->play_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static void twl4030_vibra_close(struct input_dev *input)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct vibra_info *info = input_get_drvdata(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) cancel_work_sync(&info->play_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) if (info->enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) vibra_disable(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /*** Module ***/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static int __maybe_unused twl4030_vibra_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) struct platform_device *pdev = to_platform_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct vibra_info *info = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) if (info->enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) vibra_disable(info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static int __maybe_unused twl4030_vibra_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) vibra_disable_leds();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) twl4030_vibra_suspend, twl4030_vibra_resume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct device_node *parent)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) struct device_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) if (pdata && pdata->coexist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) node = of_get_child_by_name(parent, "codec");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) if (node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) of_node_put(node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static int twl4030_vibra_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) struct twl4030_vibra_data *pdata = dev_get_platdata(&pdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct device_node *twl4030_core_node = pdev->dev.parent->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct vibra_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) if (!pdata && !twl4030_core_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) dev_dbg(&pdev->dev, "platform_data not available\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if (!info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) info->dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) info->coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) INIT_WORK(&info->play_work, vibra_play_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) info->input_dev = devm_input_allocate_device(&pdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) if (info->input_dev == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) dev_err(&pdev->dev, "couldn't allocate input device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) input_set_drvdata(info->input_dev, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) info->input_dev->name = "twl4030:vibrator";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) info->input_dev->id.version = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) info->input_dev->close = twl4030_vibra_close;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) __set_bit(FF_RUMBLE, info->input_dev->ffbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ret = input_ff_create_memless(info->input_dev, NULL, vibra_play);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) dev_dbg(&pdev->dev, "couldn't register vibrator to FF\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) ret = input_register_device(info->input_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) dev_dbg(&pdev->dev, "couldn't register input device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) goto err_iff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) vibra_disable_leds();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) platform_set_drvdata(pdev, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) err_iff:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) input_ff_destroy(info->input_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static struct platform_driver twl4030_vibra_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .probe = twl4030_vibra_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .name = "twl4030-vibra",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .pm = &twl4030_vibra_pm_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) module_platform_driver(twl4030_vibra_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) MODULE_ALIAS("platform:twl4030-vibra");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) MODULE_DESCRIPTION("TWL4030 Vibra driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) MODULE_AUTHOR("Nokia Corporation");