From patchwork Tue Jan 24 11:12:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 47664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2090133wrn; Tue, 24 Jan 2023 03:17:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXsspZo0Z2IOsEoY0g4ubQlmoaJZdYvOvHUkAURbWksK9ggIGLfCdPHuxW/vlW2mmLFOo15v X-Received: by 2002:a17:906:7f05:b0:86c:e53a:d20b with SMTP id d5-20020a1709067f0500b0086ce53ad20bmr26009576ejr.21.1674559037180; Tue, 24 Jan 2023 03:17:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674559037; cv=pass; d=google.com; s=arc-20160816; b=u1B/FFu1U4Ob9oBi41X/dbv7/BZMXkyPeepWeg6IxxIJ5hiYV0ab1NKK0QSsvcoS1W QSlKfrXVDX9F8xg9Kn9LOe26NoYG6RZZNS//XwyNHow0Slx3KjzQ1LDuS722rdiPWM78 AAJY0GDo20c7s92YXEYkG0tAh3ZyIxvN5H9RtStAUu3CEMfDhahqTERaBNT0HlBBJEQP xRjDRCl1J9+fUjpM/omLneGlJ6SJO1lVObr8cHmZ8CE8Y2eu2GWH1az4j3YgBXqlu6JW Tx3miKtKdjDpXrM9zNYH9d5dIscGEHaflKKJYgfGPRPMtNdfeYsM+Lw/G41Gd4WFeFBt 26TA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3PaccwS4l3/4bLgvse1Lno5JdofhRgcC2KeXYT9suzc=; b=rLcWCNESy1mjQldILZEyVhaS9pW2Te/QhKzl099WNJlP6OsEHSNMiFiwwOxf8kzgQ3 uXjhxPDbt8J2iIoqvvglv89gXre3XHeqHhDqdCfyI3KSWOHjEBzBy8iPZ0WMZi219HfT BLgGW0bTL76wnmrVMx+8UQJ586TG9cCrYRxDVUJNvjcsp3fdtWzP/gZXi8aNNKGM6By4 7CVltmpsTO7LrGoAB1ZXQ1WdM4/LfB9e49yNl1ULoyzpeMippLpTOSKH2Xqdgj7AujzG dHimW4KFLcp6ACjdhvkzkKHT5C1iH9D0vRtLydpKvGK6bPdtyTuz2rCM15YJnUZd3M1E Uzsw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=Pzqj8iry; arc=pass (i=1 spf=pass spfdomain=mt.com dkim=pass dkdomain=mt.com dmarc=pass fromdomain=mt.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jr17-20020a170906515100b0081a9c3ca4c3si2585728ejc.374.2023.01.24.03.16.53; Tue, 24 Jan 2023 03:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=Pzqj8iry; arc=pass (i=1 spf=pass spfdomain=mt.com dkim=pass dkdomain=mt.com dmarc=pass fromdomain=mt.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233800AbjAXLNB (ORCPT + 99 others); Tue, 24 Jan 2023 06:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233812AbjAXLM5 (ORCPT ); Tue, 24 Jan 2023 06:12:57 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2122.outbound.protection.outlook.com [40.107.14.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51F512F0C; Tue, 24 Jan 2023 03:12:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=haRov4IJm5Xlkmk1hTzh/6M2bVIURjZi+zLwNvNrzZvNCWefm6VVePR6yfZAFspWYyuqKGurkYln/nyL26+5wAsMK7YXJ79GKIIz796f/2UcmY1L8Dl2fwgHNPWQUUeru8a5dnmYwvCIuXE/rHizP9klqGL3LSYkYTc/agi3LmiWk1dbeg6jGWzF7sLvwRFmQNExpcujKtB8PpP9T0XjwTmpNdHhg8xP6Rz13kuz2DbRLXUXo+xeDoXaxMYFHHd370Rn3z8MCN0lnKSH1cQ7z013tUN0EC/ecnxI2/km+tV+F4eDnAy+eU0ERe/ZRi3KQ3MhX+FB9m6r4j07VUkdyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3PaccwS4l3/4bLgvse1Lno5JdofhRgcC2KeXYT9suzc=; b=ck5yN6K6L8t2r5CTGxGMx/pMJtbv5WuvWc3oGzNYBeJtJAvu4K0U+bAznUCkkiPQvslDPpOnZ61R4+GzacTS0fSYstPf/gvl0DRw+8mxjmW4t15q4Dy6w7vzNQ8x5oBu6WgjZEJsANhcjyKzg1pcmni59/bs0p/zN9C0NC6/nNSVeaFMVGLcIOHkza+5/aS5fMCOWhxOFhYzI4LEKBLOqMDBNwfuDqpzH2YPPd4IFnK9gNXVFlAYRkw64ZgjvBE8zFQ1T8E2LKH9QjULq2ximw/ZawLAg31u9m32luR5E4CK877d7Ud42uzmHkMZNZSK6wQFLWVA8LgUGJjUl+2DDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mt.com; dmarc=pass action=none header.from=mt.com; dkim=pass header.d=mt.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3PaccwS4l3/4bLgvse1Lno5JdofhRgcC2KeXYT9suzc=; b=Pzqj8iryzKPBRyaTr8fAsV6jSr0UfGvZsVHfiCWRbgNCGK9uaBSvbd7i5RQnJvwiiDgB8Csa8n9Bbh6mYGzXNcoR7l/ELlDBXlneu6iuoc7ty3iETdeD0RYZnPzW1mfnW9ywpjKPd1zsQ5WsbuZeyHaT2iGKkNZ3+7ro3ZqorkUWTGJ6AuM2Z+L6uxgdKCgu0DprD4Cjs+38na+ajNrP5L+BwS5ZWJ7YNZWC/W10Op0e3/PLOcTjFeCTX2hlhAWWfxGAQ365lmXRlYiqEDbax6i+HQez43jLZnCVl0D8B1wdapF9kcv0DWWlMQiKdLX/ShCislX4ZKPZvNyf9c7cOw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mt.com; Received: from AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) by AM9PR03MB7995.eurprd03.prod.outlook.com (2603:10a6:20b:43e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 11:12:49 +0000 Received: from AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225]) by AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225%5]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 11:12:49 +0000 Date: Tue, 24 Jan 2023 12:12:47 +0100 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Frieder Schrempf , linux-input@vger.kernel.org Subject: [PATCH 1/3 v6] input: pwm-beeper: add feature to set volume level Message-ID: References: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: FR2P281CA0136.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::18) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|AM9PR03MB7995:EE_ X-MS-Office365-Filtering-Correlation-Id: efd74538-dce9-4479-f93e-08dafdfbeddf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ki+/FBkXpFzBQRdenp+1R7lPWALTrfLtIQPbldMEqMCcU4/RaAQWUheuR+rouZ8lzYhN1TAJpYxgcTgRhI4faPwkrbqOo/n6xie+ki3C2BTDexpXh75jeR3fEJSPRV1WHZohaQC3+AkPL5mz4VZN/+Rl93FYtY4p9MELcJ6f3FcS3XnDdQRqR15/Tb2ZA+GeZo6j6+kJxsF/PWhzg9Vnd1ct1bAscqjP76bomfdY7czNG6HSYpWn/GswbHeGvcvpcjeoeNeT6zsiKM8RXcHyzludqKqF5BNI2Ano71FRbX2kwgNqskHkPDDP/hKkZDerTmAIBg+hBDxv3yQA6PytW6ZmTd71h2WFSscFhUnhDvMGIJzhE9uFIVjgSkwdhjfbTzSNyuNY5GMGPCpbamUeMgmI2JceIS7/hlTJw63AFiGD1v+FJjPKWL7SNLkBkQLlejmksRx7PXH+3YNFVkU4BCwgbLRJIkCPzP2/o4ETFK4LKZhVPwkKz+cJahUXK4T+rsH9QJKvcoHQ8MQ/npUlFmSimV4MCPMGbl13/n4Z9Zxk5ar3KfM6rFtI5IvOrlIHj6IBHEBoloX0M4mNgR6jqVl6Ji/DgHX0Eek618UDWl+IKo4MFXtm3qLhJqoYcU50+IZL+XGL2JG6iDMU2zuQCW9JU1OLsSzxpdpdmgibAlnbyIab/cjlvMniOawXOF6p+MVU/Z4wgq5GWWYs3TSYDOAZ61GKYJPPPkD65R+ch7A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR03MB7621.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(346002)(396003)(366004)(39860400002)(451199015)(36756003)(41300700001)(86362001)(8936002)(5660300002)(4326008)(44832011)(2906002)(38100700002)(38350700002)(83380400001)(52116002)(478600001)(6486002)(66946007)(6916009)(6512007)(26005)(6506007)(186003)(8676002)(316002)(54906003)(2616005)(66476007)(66556008)(67856001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Yu/hcwQVxYOhqzLuwZrh1tEX9XhD?= =?utf-8?q?COqA6GcdzdPAaZnolOvf2RJDv2msSIsWs15nd298EBSONkI/wOsAmGULl4bicRv6Z?= =?utf-8?q?E7Ux9LbdVoebjLZUQ2C+zwJ1lJwvg3c4EZlwFoBxvSldgazv4BJfbrlDfjSiheVto?= =?utf-8?q?fMZHnaurVFr979TJ/bBAfcRylZalT1wtxF9JLlJ+pG16AyyOT65RQ+RjaydJzIa+g?= =?utf-8?q?XPtqCaOd/dhz1vLR01isal7DulCEdvll1pcArQhXqoNMzNPh9h5m1pUJMz0vsa1oV?= =?utf-8?q?jRrnubjN8eYmAFIUR61Mq1t9GADe0ohrGwYLI12gnRClmQO/rKzK7evK14ZGZzxsU?= =?utf-8?q?d82aOOwEQHDzgUlOJoaCfB5uh9y4tHgSOIS/GDt49oKufKW5Yc2BuVxoLFkwEAiE7?= =?utf-8?q?520LMMEiptD3msLu3aFu1UHM0aHd22kpL0LGnN49BabjvLca5tLZ1IsuEfPH0Outt?= =?utf-8?q?fQM0ZTg/gcJmqsQeNnRx+OyStEmWXFarAaHOCDp48scaovzyRqe4fxl6aVei2YiDd?= =?utf-8?q?1hEFeqkkMl9saSfbbjK+TPTqf+Q+wVRl4o6ajgD5fIDHOcz3DwaT+WJ+pH1/a73QN?= =?utf-8?q?nyDPfqlS7a+jZa6E0/rlkS6gm94LLxvf785x2a+4JiGgVWgyy2ySCbdsU4mq9dZIZ?= =?utf-8?q?mDzS9ceORzM7OyDdLEtZcx1DAq2qFnKRXYmoVnl6+xj013WQUKY8ozR570AfdXA3L?= =?utf-8?q?DDcXw8azIXUHa8djrQRvzYKb2hTkU9bMJqzoppEhQ1OXW4hFZDCbQMsjqMhu/XTMM?= =?utf-8?q?LfMWgz0kQc/tBcb4occr8xtHLZvHHiVDJHyFw9sZw0joRxZ2bXTrL27Gs3wZ5fN14?= =?utf-8?q?HCaj7OmbDgQSPb7XUsM9nvRFflcjB3CtrVRs9znF3ngLwgHItSrzf3twwCt/ccTjo?= =?utf-8?q?Ii33JOobvptPy8FOxlbaBxKdau58FskfI2G7TzCwGAQpEd9i3UE6dRF0QA2RDbCti?= =?utf-8?q?nyWSDupPWa9D2IVxjBdlYQdejEatuC9k+fX9a2bXtBE1GgTkXFZwfNTDw0PtvG7Wv?= =?utf-8?q?6McS+04jhRAXQ9Q0LRmPvX8Y4zFHtomyizpbzuSaB2N7GVQeOZbemvFjm57yFHhUb?= =?utf-8?q?/LPDzcmvIK1Em6jlnFosypyU5PLJtQFHzwNuhw65Fu6JDpMIaJg/SB1bhUfGsYEmq?= =?utf-8?q?lg/SkKxXHV9Lg/+vTLp9d43JRRu9Fs+LsSwtT2tqGwWGbNN0StJdmA1OUPBVhzWse?= =?utf-8?q?HeqbS2lyD/gRs3ZryqTucqBaRbdD4sHbEpqjLZKZfOVt4/AZYt0Iy/OK7yMH9bECz?= =?utf-8?q?JyPwh2edOpc8MnK4cE+xpC8b+o2p1h4LfeHeFFuZjHqvecl53EnpNwPzVm1m0l1pj?= =?utf-8?q?vZngsn58ju8/qGAago4KCMlgUzFerzvj+jnGCgf6Ch8cFGRW8ByRBy+UqB9KAH5lS?= =?utf-8?q?r2RqciEkiFsY74Bub4eAvkRDah1iv/45ykhyURlFmWN//vIU43kn+m95CQ6ZjKzUW?= =?utf-8?q?4Q1C5IHBVMCzkkbV2HbazK/ULMhosxr1UQ9as3eL/HEz75TUen59mYzMgh0YI6j+I?= =?utf-8?q?2tg0gyBS2dI1?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: efd74538-dce9-4479-f93e-08dafdfbeddf X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 11:12:49.6780 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fb4c0aee-6cd2-482f-a1a5-717e7c02496b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8imOwNft2zyERwAoinCml2RtgIFOnzLeLNVZjRFF1e4JsouqHgUS9gCNqiL34QhzrXEUnZhloaiMloUSNXdsZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7995 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755902235795346530?= X-GMAIL-MSGID: =?utf-8?q?1755902416982064024?= Make the driver accept switching volume levels via sysfs. This can be helpful if the beep/bell sound intensity needs to be adapted to the environment of the device. The volume adjustment is done by changing the duty cycle of the pwm signal. This patch adds the sysfs interface with 5 default volume levels (0 - mute, 4 - max. volume). Signed-off-by: Frieder Schrempf --- .../ABI/testing/sysfs-devices-pwm-beeper | 17 ++++ drivers/input/misc/pwm-beeper.c | 83 ++++++++++++++++++- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-pwm-beeper diff --git a/Documentation/ABI/testing/sysfs-devices-pwm-beeper b/Documentation/ABI/testing/sysfs-devices-pwm-beeper new file mode 100644 index 000000000000..d068c5814f48 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-devices-pwm-beeper @@ -0,0 +1,17 @@ +What: /sys/devices/.../pwm-beeper/volume +Date: February 2017 +KernelVersion: +Contact: Frieder Schrempf +Description: + Control the volume of this pwm-beeper. Values + are between 0 and max_volume. This file will also + show the current volume level stored in the driver. + +What: /sys/devices/.../pwm-beeper/max_volume +Date: February 2017 +KernelVersion: +Contact: Frieder Schrempf +Description: + This file shows the maximum volume level that can be + assigned to volume. + diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index d6b12477748a..fadc73e1c89a 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2010, Lars-Peter Clausen + * + * Copyright (C) 2016, Frieder Schrempf + * (volume support) + * * PWM beeper driver */ @@ -24,10 +28,61 @@ struct pwm_beeper { unsigned int bell_frequency; bool suspended; bool amplifier_on; + unsigned int volume; + unsigned int *volume_levels; + unsigned int max_volume; }; #define HZ_TO_NANOSECONDS(x) (1000000000UL/(x)) +static ssize_t volume_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct pwm_beeper *beeper = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", beeper->volume); +} + +static ssize_t max_volume_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct pwm_beeper *beeper = dev_get_drvdata(dev); + + return sprintf(buf, "%d\n", beeper->max_volume); +} + +static ssize_t volume_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + int rc; + struct pwm_beeper *beeper = dev_get_drvdata(dev); + unsigned int volume; + + rc = kstrtouint(buf, 0, &volume); + if (rc) + return rc; + + if (volume > beeper->max_volume) + return -EINVAL; + pr_debug("set volume to %u\n", volume); + beeper->volume = volume; + + return count; +} + +static DEVICE_ATTR_RW(volume, 0644, volume_show, volume_store); +static DEVICE_ATTR(max_volume, 0644, max_volume_show, NULL); + +static struct attribute *pwm_beeper_attributes[] = { + &dev_attr_volume.attr, + &dev_attr_max_volume.attr, + NULL, +}; + +static struct attribute_group pwm_beeper_attribute_group = { + .attrs = pwm_beeper_attributes, +}; + static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) { struct pwm_state state; @@ -37,7 +92,8 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) state.enabled = true; state.period = period; - pwm_set_relative_duty_cycle(&state, 50, 100); + + pwm_set_relative_duty_cycle(&state, beeper->volume_levels[beeper->volume], 1000); error = pwm_apply_state(beeper->pwm, &state); if (error) @@ -126,6 +182,7 @@ static int pwm_beeper_probe(struct platform_device *pdev) struct pwm_state state; u32 bell_frequency; int error; + size_t size; beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL); if (!beeper) @@ -171,6 +228,24 @@ static int pwm_beeper_probe(struct platform_device *pdev) beeper->bell_frequency = bell_frequency; + beeper->max_volume = 4; + + size = sizeof(*beeper->volume_levels) * + (beeper->max_volume + 1); + + beeper->volume_levels = devm_kzalloc(&(pdev->dev), size, + GFP_KERNEL); + if (!beeper->volume_levels) + return -ENOMEM; + + beeper->volume_levels[0] = 0; + beeper->volume_levels[1] = 8; + beeper->volume_levels[2] = 20; + beeper->volume_levels[3] = 40; + beeper->volume_levels[4] = 500; + + beeper->volume = beeper->max_volume; + beeper->input = devm_input_allocate_device(dev); if (!beeper->input) { dev_err(dev, "Failed to allocate input device\n"); @@ -192,6 +267,12 @@ static int pwm_beeper_probe(struct platform_device *pdev) input_set_drvdata(beeper->input, beeper); + error = sysfs_create_group(&pdev->dev.kobj, &pwm_beeper_attribute_group); + if (error) { + dev_err(&pdev->dev, "Failed to create sysfs group: %d\n", error); + return error; + } + error = input_register_device(beeper->input); if (error) { dev_err(dev, "Failed to register input device: %d\n", error);