Lines Matching +full:pwm +full:- +full:vibrator

1 // SPDX-License-Identifier: GPL-2.0-only
8 * Copyright (C) 2006-2008 Marvell International Ltd.
24 #define DA9030_MISC_CONTROL_A 0x26 /* Vibrator Control */
37 #define DA9030_LED_OFFSET(id) ((id) - DA9030_ID_LED_1)
38 #define DA9034_LED_OFFSET(id) ((id) - DA9034_ID_LED_1)
46 int offset, ret = -EINVAL; in da903x_led_set()
48 switch (led->id) { in da903x_led_set()
54 offset = DA9030_LED_OFFSET(led->id); in da903x_led_set()
55 val = led->flags & ~0x87; in da903x_led_set()
57 val |= (0x7 - (value >> 5)) & 0x7; /* PWM<2:0> */ in da903x_led_set()
58 ret = da903x_write(led->master, DA9030_LED1_CONTROL + offset, in da903x_led_set()
62 val = led->flags & ~0x80; in da903x_led_set()
64 ret = da903x_write(led->master, DA9030_MISC_CONTROL_A, val); in da903x_led_set()
68 offset = DA9034_LED_OFFSET(led->id); in da903x_led_set()
70 val |= (led->flags & DA9034_LED_RAMP) ? 0x80 : 0; in da903x_led_set()
71 ret = da903x_write(led->master, DA9034_LED1_CONTROL + offset, in da903x_led_set()
76 ret = da903x_write(led->master, DA9034_VIBRA, val); in da903x_led_set()
85 struct led_info *pdata = dev_get_platdata(&pdev->dev); in da903x_led_probe()
92 id = pdev->id; in da903x_led_probe()
96 dev_err(&pdev->dev, "invalid LED ID (%d) specified\n", id); in da903x_led_probe()
97 return -EINVAL; in da903x_led_probe()
100 led = devm_kzalloc(&pdev->dev, sizeof(struct da903x_led), GFP_KERNEL); in da903x_led_probe()
102 return -ENOMEM; in da903x_led_probe()
104 led->cdev.name = pdata->name; in da903x_led_probe()
105 led->cdev.default_trigger = pdata->default_trigger; in da903x_led_probe()
106 led->cdev.brightness_set_blocking = da903x_led_set; in da903x_led_probe()
107 led->cdev.brightness = LED_OFF; in da903x_led_probe()
109 led->id = id; in da903x_led_probe()
110 led->flags = pdata->flags; in da903x_led_probe()
111 led->master = pdev->dev.parent; in da903x_led_probe()
113 ret = led_classdev_register(led->master, &led->cdev); in da903x_led_probe()
115 dev_err(&pdev->dev, "failed to register LED %d\n", id); in da903x_led_probe()
128 led_classdev_unregister(&led->cdev); in da903x_led_remove()
135 .name = "da903x-led",
147 MODULE_ALIAS("platform:da903x-led");