Lines Matching defs:beeper
3 * PWM beeper driver
35 struct pwm_beeper *beeper = input_get_drvdata(input);
52 pwm_config(beeper->pwm, 0, 0);
53 pwm_disable(beeper->pwm);
56 ret = pwm_config(beeper->pwm, period / 2, period);
59 ret = pwm_enable(beeper->pwm);
62 beeper->period = period;
71 struct pwm_beeper *beeper;
74 beeper = kzalloc(sizeof(*beeper), GFP_KERNEL);
75 if (!beeper)
78 beeper->pwm = pwm_request(pwm_id, "pwm beeper");
80 if (IS_ERR(beeper->pwm)) {
81 error = PTR_ERR(beeper->pwm);
86 beeper->input = input_allocate_device();
87 if (!beeper->input) {
92 beeper->input->dev.parent = &pdev->dev;
94 beeper->input->name = "pwm-beeper";
95 beeper->input->phys = "pwm/input0";
96 beeper->input->id.bustype = BUS_HOST;
97 beeper->input->id.vendor = 0x001f;
98 beeper->input->id.product = 0x0001;
99 beeper->input->id.version = 0x0100;
101 beeper->input->evbit[0] = BIT(EV_SND);
102 beeper->input->sndbit[0] = BIT(SND_TONE) | BIT(SND_BELL);
104 beeper->input->event = pwm_beeper_event;
106 input_set_drvdata(beeper->input, beeper);
108 error = input_register_device(beeper->input);
114 platform_set_drvdata(pdev, beeper);
119 input_free_device(beeper->input);
121 pwm_free(beeper->pwm);
123 kfree(beeper);
130 struct pwm_beeper *beeper = platform_get_drvdata(pdev);
133 input_unregister_device(beeper->input);
135 pwm_disable(beeper->pwm);
136 pwm_free(beeper->pwm);
138 kfree(beeper);
146 struct pwm_beeper *beeper = dev_get_drvdata(dev);
148 if (beeper->period)
149 pwm_disable(beeper->pwm);
156 struct pwm_beeper *beeper = dev_get_drvdata(dev);
158 if (beeper->period) {
159 pwm_config(beeper->pwm, beeper->period / 2, beeper->period);
160 pwm_enable(beeper->pwm);
178 .name = "pwm-beeper",
186 MODULE_DESCRIPTION("PWM beeper driver");
188 MODULE_ALIAS("platform:pwm-beeper");