Lines Matching +full:gpio +full:- +full:beeper
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Generic GPIO beeper driver
5 * Copyright (C) 2013-2014 Alexander Shiyan <shc_work@mail.ru>
10 #include <linux/gpio/consumer.h>
15 #define BEEPER_MODNAME "gpio-beeper"
25 gpiod_set_value_cansleep(beep->desc, on); in gpio_beeper_toggle()
32 gpio_beeper_toggle(beep, beep->beeping); in gpio_beeper_work()
41 return -ENOTSUPP; in gpio_beeper_event()
44 return -EINVAL; in gpio_beeper_event()
46 beep->beeping = value; in gpio_beeper_event()
47 /* Schedule work to actually turn the beeper on or off */ in gpio_beeper_event()
48 schedule_work(&beep->work); in gpio_beeper_event()
57 cancel_work_sync(&beep->work); in gpio_beeper_close()
66 beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL); in gpio_beeper_probe()
68 return -ENOMEM; in gpio_beeper_probe()
70 beep->desc = devm_gpiod_get(&pdev->dev, NULL, GPIOD_OUT_LOW); in gpio_beeper_probe()
71 if (IS_ERR(beep->desc)) in gpio_beeper_probe()
72 return PTR_ERR(beep->desc); in gpio_beeper_probe()
74 input = devm_input_allocate_device(&pdev->dev); in gpio_beeper_probe()
76 return -ENOMEM; in gpio_beeper_probe()
78 INIT_WORK(&beep->work, gpio_beeper_work); in gpio_beeper_probe()
80 input->name = pdev->name; in gpio_beeper_probe()
81 input->id.bustype = BUS_HOST; in gpio_beeper_probe()
82 input->id.vendor = 0x0001; in gpio_beeper_probe()
83 input->id.product = 0x0001; in gpio_beeper_probe()
84 input->id.version = 0x0100; in gpio_beeper_probe()
85 input->close = gpio_beeper_close; in gpio_beeper_probe()
86 input->event = gpio_beeper_event; in gpio_beeper_probe()
114 MODULE_DESCRIPTION("Generic GPIO beeper driver");