From patchwork Tue Jan 24 16:39: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: 47771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2256012wrn; Tue, 24 Jan 2023 08:47:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1vBwv4eg6pOnOEeGGa9iTAGnQfC6GI76Q6hPbf+vZht8/MPqjY4mdVBiTBQAXQ5QyKuKq X-Received: by 2002:a17:907:c5c6:b0:877:8a55:2a26 with SMTP id ts6-20020a170907c5c600b008778a552a26mr19075842ejc.60.1674578821978; Tue, 24 Jan 2023 08:47:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674578821; cv=pass; d=google.com; s=arc-20160816; b=jDbiZAoeb2gY2MkEJ/EdxhF+VwD4J2UnFRcEQh/w96EkE8NpI0bUFCPCxoiKkPUo6I TpuqLOTU96rk+4ITUICRS8SvGodvMTmfEzfZLDYKjWZy79irQ8Rrxt6FPPHaPjxdHLz0 6RbZ9VxOo9rv2n0MdF9prwbMUNzAyKemHMIlKgWpO5Mvzi4r17YmTTaUq53Jjvpd/1gj 40tTrOYkV6BP5kOgq0YfLsQwtfp9sNIS5eENWsAq5rfrpS6hE1898gtZna15mMPmKOBI IaUiu7pwq4Bef+FxaC7pso0nSBAHNSYY2AhiIc/1DhpjM/UoCHHGMAhrJkR3n/qlBWlz y/uQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-disposition:message-id :subject:cc:to:from:date:dkim-signature; bh=lY9YRAXQvO2xhh93Xhcu8iiXDTffNPYYaP+YJcU7zEw=; b=RrmiMqPPN2P6Ek0AdTRnUIZ7pldj9kUbEY7Tk/y9hjRm1FA7yBYCLhvBMaP7dn7alO YM2B0tlfyNTyikz9VuQpzz0ZxkdpE2vNWW05MaMnPQFK9d8cxgQStAemIldfh2utO2nD zD945ZxcgLsw4+Lgq9NrNOvM7nBw8E6aPg3XjxjIzvyNHKc5VkQZkRm4TIfhH4VmL8i4 YXxVa+YxumSdkp5Yx1tN8K5mVOcDEyK1+vq3I4Q3kXdoF3ydwoeHFJTr36QrOemPCu+c X3n8reIrSN9givUEwyLQxsev+XYejBDw7gXwKyHf055z6uZ89LTUXkCwU5C9cYjKji4b 9nyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=rTKtHPcY; 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 q1-20020aa7d441000000b0047ed405b4a7si3269554edr.224.2023.01.24.08.46.36; Tue, 24 Jan 2023 08:47:01 -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=rTKtHPcY; 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 S234038AbjAXQkG (ORCPT + 99 others); Tue, 24 Jan 2023 11:40:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234537AbjAXQj5 (ORCPT ); Tue, 24 Jan 2023 11:39:57 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2105.outbound.protection.outlook.com [40.107.247.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7F503585; Tue, 24 Jan 2023 08:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aF+L/cehiYLvWYKIS0B8ra7J3g7Fb40BsYAd/je6W9g5BtRoIPKVQavnCnaqoP9mDS275LM8TuSaqPSCxQa/XRS9KuGM4CYiBwAgpBReRS5w8vQw1m93Mh5Z0K0b2JziK5NDKGnomcnlRyH12ypXLWUAKllAG4YDDGlLfvHR92gBTdIYQSh+Uepg2LzLlywE+GFuDq/t8emCVkHp0u/tgukz5JBwLdhxGAeayEJ+xeQKWuY8KrTVQW0MjI1wc/ihLbAH+Pdffo49GDgIvJkMCKdbKbBu9KMM5yZlZZ03lKCd+JKM/DPlJd4VhK4zhYqMtxIhm59F/Mn+x2BwafRjHQ== 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=lY9YRAXQvO2xhh93Xhcu8iiXDTffNPYYaP+YJcU7zEw=; b=GdOVUB8zsmLH06VgnOGxpvgquoY3haBc+gcevI/GynOveoZp804Mobwr2euKO6kCuBC/VKIla1HxlNv9XzhjD3D2zswdJBRDGQwucI1Mu9F0UbxVvJUM2T+FSIP1dUSxqA9q5f8rRdD6Y/HptbYfX6/svR6vpxh4r4Tnv9/BD0akM9SWMbgNcZrvU+xKBvEW0rreDqmoCmsN6gQiwmfZcfGZwK3BeLVONE+yrbVkMfVpr+saKOrNwYQ3CJ8JoIhRro9NK8MQcz1i1kx4mWPjOwgWtneN0G3IZRzB7DGGG1CRq6cuiG6jXADzUCxkE6vub9wAL6JvTNJiqL0lyYfaPw== 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=lY9YRAXQvO2xhh93Xhcu8iiXDTffNPYYaP+YJcU7zEw=; b=rTKtHPcY2lsATuZDX+i8MI4z35S+OOF4U0FMHxrhTqz0MK6QbdVzr059wLLbW6f1bNZmU2JRQQ51gddMyzNv7U1V3YRewzoDwC/E55wRduMh46kEg+daWgIi9+ts6typXehNMfd3HvEAZeyBBI4pHzvOea26LaOfErruiCpWfEa4bgA/eN/MH35P6y8PlJ5wLHTNSjOm5kGiMl6GFK0QDfOYQfdT+BQkJJHr3LePwPuM1jP+7eozDUga6ISGuI4a0O1VLhjd5BRQv5uXBZCdcnCQkWOpLfHP6ZrTNRD6CTy8nePpF4AaRJP82615RpKx/os+1uesVsQ0gweWLfxwUA== 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 AS8PR03MB6726.eurprd03.prod.outlook.com (2603:10a6:20b:29e::11) 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 16:39:50 +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 16:39:50 +0000 Date: Tue, 24 Jan 2023 17:39:47 +0100 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Frieder Schrempf , linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/5 v7] dt-bindings: input: pwm-beeper: Convert txt bindings to yaml Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR2P281CA0133.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::17) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|AS8PR03MB6726:EE_ X-MS-Office365-Filtering-Correlation-Id: c69b2bdb-fed8-4179-c998-08dafe299c71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QxVTnvwYItuagO28bTf4qAkaai5qZ3Un7MaUN4U80RuhS+kbDr6J6SPPe+IuaSgdjWVtN7FBJT26/J2UTZq3zcAszSNuQNR/K5UvygCh7gQYCE0nqg3PFHq5saAZDZLrb4AbYMFlY/KV6Ba3JyuHip8e53ZO3UROtm0nVtx93MQXvtrYAjudjAkvzc0C7Uua6cMrsU4C5sTsOZINEG72fW0kkQeK7//S1K6VQud1KiE/cGhZ/6kT19v+14x2wHIaJaGpq+WfCxYh6bk48ZhOT/6d64NeTaxyeBdH6TiLLvEx+94naYooEzzoTGM5aPL02fa+iNp+mcaINxmx8QSHfJWDcFdcHHshKx49DTpefeUdPWS1UQGkz8kgXY5hEIFMyW0SBt+wHx9AR/0RZIzHq25QxNJlU0eynmRHM5sGZoJvjpuoUpDRWsie/8/xP5/Exw8dLpapM9ztDJxMBL9ZL6PzGfgXAstvlX3hJnLDnpMCsumpUzhXS0uFt9HraPOpQpPu3k9AKH8r7VqVHYPuqRadWJwgx3Bb5Mri4OPDdusx/ckt16p7joRo7j6bGKp5lTDEeQ8z6nI8lxrxrE75xfITcSn8dLYY+f5VpXn8uOEnP2njUxCVIQZhmPIT7PMnJiiH8AIFRZh2N+n396WqwnOFzkIOOz2KR2yCub3/Uv66V1XhPXn3gtKFB/pnxM0ZmrTpUA2a0H64MYlzgwcz9UCfDne9oGdv9ch8lRqpKD0= 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)(366004)(396003)(376002)(136003)(346002)(39860400002)(451199015)(6666004)(86362001)(478600001)(6506007)(6486002)(26005)(6512007)(186003)(52116002)(316002)(36756003)(54906003)(83380400001)(2906002)(2616005)(38100700002)(66556008)(38350700002)(66946007)(6916009)(4326008)(66476007)(8676002)(41300700001)(44832011)(8936002)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aAIuGhUwkXsytv5mZunMBVTRyLBO?= =?utf-8?q?LtLJkeC8sgOtoOva7D2WdMFB/Y3dA1yfZjVBfJHWqUuTHwFUEslHppQgnkhwTsHdP?= =?utf-8?q?7Kfa7zqb1ouFi+h4ohfUu3yM/syAYXb3QghlwloCEz1H3PLY7v4nHE9vMTjXdOhWi?= =?utf-8?q?f/rqFYWJAgBJ1D9eAXXsao0N4sumKj2IpXS4JB5L4y2lFmIim+TPsiaoPX0mk+djk?= =?utf-8?q?wqiE7HqvLn0brDhnQ+AtaXOIXkSTLPPfKbBudwtIlRgwUmDc04YmXIz3X1YrN+8jf?= =?utf-8?q?+QtRhXY3SYVBb1iMVO9PDhyUhRq0s9+fovWVsXmkCX6kwACbEySKcFa0+t2n+i1T4?= =?utf-8?q?mmmfC9wuZTdGn/4rmaKPXpZG5srCSiqZ5+xdpJWdOKSGSmu296aVX7mDmDryUG49b?= =?utf-8?q?plSHbAzMyWjr3H8S5RToVEA2+GIlVkl4wQh7wFda0NqT4MBoappmXVjMtNI1lakQD?= =?utf-8?q?kFhitUmEWd6Z8Tk/oaXwHlra+nBWe8X54ioJUu3hplaIy7VUXJ27KM2ECys0rzTn/?= =?utf-8?q?Z52QphJCz2ikiW1x79PFYRLai/R+NiID+EUF07v3A7dlEVvuW0GbcriHNIairTZq0?= =?utf-8?q?uaG5l1mZaQecRnCTQb7XBlGGEzn25fzaVidm5VqiABcdQ9YRq6fr4DO1dGN+dGE1X?= =?utf-8?q?+NO0c5lrnAFRcv2cdRX+KGxP4rvQdOzF5uhMnoO25Kx+w6ejNkegud2CtiLpywRY/?= =?utf-8?q?gCFbqGYAOqBr4ODGBpy7UppTM2QRPyYKJ2S0p8U3a0MMsyJcNzKpRIewQBVjVQ878?= =?utf-8?q?RcyMx4qdVWGgKV01CQ3vpYUygiNXkCMsbM0Zgrd5d9H57pYtCJf0NY9coad0kBU9v?= =?utf-8?q?hm7iE7DP7Ecs9rxeNGBPZSsIKq8Sofv38zrbNmGF7PDoeA7qHGwuMzU4TL3ZnvGo7?= =?utf-8?q?v8/5w2450qaQKuc3fXtnke5jRa4LSZrBjjbXsU4LFyxs7m2acNTzYheUgCH1MppTf?= =?utf-8?q?KROGAJxUvjsB5wy8AcFy5zeU7t2USLxFbSTmovTgd9Muxhj3uhrhKGLgBQPMVPtBE?= =?utf-8?q?hazYAF76A1HHaAlwKRhD6ykI08lQfo0ZIVljiQdK/WFeQHAXTR7hGjEPRyb2mjlGi?= =?utf-8?q?yIBk6ZkMLqlFPtGZ7gOrvxlnMGItnquTm/H5cYtNo43KI5a84f0HzNo373u1yt5sZ?= =?utf-8?q?6R1CKXlj4jBWPlixJ1LMUAZQrffqJ1lRxW3jr9dIh4FD/YQie8DBpKErLuhajkilH?= =?utf-8?q?VfjgWx8Z4ZDWe7qdb5bW9dWrEkJ1W/UXW/G3gRfPi4FR0dkmyZVENfF85YK7x5HbK?= =?utf-8?q?bQu3KYEUzqK7U/hsIjUUd+6IxksFZkUhj6BIrExOHNDkIKkz6vJ2hXGwmiCiBMeHg?= =?utf-8?q?jVBs2wlRTuwHiXvm2vYYP4kJVYnOW9ErpkdnDNnw4XAciCQv5tYma2Xo3uJvMGnts?= =?utf-8?q?lVjeAjuCCQ3yFhiQoeuO9BKNDgK0pAPOmSvGwIfcZFZP7Lu64Uyh9P7QIoPQG1S2Q?= =?utf-8?q?jQ5QfxmVF4sZrHjiXXZamtt+KQEPPWC+G3fUnCheRwfueEmFDPyEXNa9GcHK6bpDv?= =?utf-8?q?6csJk6bYqe9r?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: c69b2bdb-fed8-4179-c998-08dafe299c71 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 16:39:49.9257 (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: axIW3dNdk71Wjomd4QxUxXvkMP0hRiaWAMSKRWtRdEb479TXqdhafd5h+H3sILbnGUsuCnpjT5Z2Ke8X9pzlBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB6726 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?1755923162514264125?= X-GMAIL-MSGID: =?utf-8?q?1755923162514264125?= Converts txt binding to new YAML format. Signed-off-by: Manuel Traut --- .../devicetree/bindings/input/pwm-beeper.txt | 24 ---------- .../devicetree/bindings/input/pwm-beeper.yaml | 48 +++++++++++++++++++ 2 files changed, 48 insertions(+), 24 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.txt create mode 100644 Documentation/devicetree/bindings/input/pwm-beeper.yaml diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.txt b/Documentation/devicetree/bindings/input/pwm-beeper.txt deleted file mode 100644 index 8fc0e48c20db..000000000000 --- a/Documentation/devicetree/bindings/input/pwm-beeper.txt +++ /dev/null @@ -1,24 +0,0 @@ -* PWM beeper device tree bindings - -Registers a PWM device as beeper. - -Required properties: -- compatible: should be "pwm-beeper" -- pwms: phandle to the physical PWM device - -Optional properties: -- amp-supply: phandle to a regulator that acts as an amplifier for the beeper -- beeper-hz: bell frequency in Hz - -Example: - -beeper_amp: amplifier { - compatible = "fixed-regulator"; - gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; -}; - -beeper { - compatible = "pwm-beeper"; - pwms = <&pwm0>; - amp-supply = <&beeper_amp>; -}; diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.yaml b/Documentation/devicetree/bindings/input/pwm-beeper.yaml new file mode 100644 index 000000000000..24a40f0f77c1 --- /dev/null +++ b/Documentation/devicetree/bindings/input/pwm-beeper.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/input/pwm-beeper.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: PWM beeper device tree bindings + +maintainers: + - Dmitry Torokhov + +description: Registers a PWM device as beeper. + +properties: + compatible: + const: pwm-beeper + + pwms: + description: phandle to the physical PWM device + minItems: 1 + maxItems: 1 + + amp-supply: + description: > + phandle to a regulator that acts as an amplifier for + the beeper + + beeper-hz: + description: bell frequency in Hz + +required: + - compatible + - pwms + +additionalProperties: false + +examples: + - | + beeper_amp: amplifier { + compatible = "fixed-regulator"; + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + }; + + beeper { + compatible = "pwm-beeper"; + pwms = <&pwm0>; + amp-supply = <&beeper_amp>; + }; From patchwork Tue Jan 24 16:40:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 47778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2262360wrn; Tue, 24 Jan 2023 09:01:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtR4QH+YenV5nE1etU7kBYoVw5DMR2jhVY5unfQHzcjNTC6IAgiMne9f9Ku11KF/B8ZOtN X-Received: by 2002:a50:ff08:0:b0:49b:7416:e3ff with SMTP id a8-20020a50ff08000000b0049b7416e3ffmr29843664edu.5.1674579679294; Tue, 24 Jan 2023 09:01:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674579679; cv=pass; d=google.com; s=arc-20160816; b=V1wK7WMkHXrM3DI5UQppuX6nptA+cz+kcCoEHZ/mPWI7iMNkTzfqFROx4KbstJCnJR nqAePwEVBqStgtK4yAtCjE1//E8kOACTwHKnjWjVd3xE7AbgU3s8FpZ9b6CPQdSORAJ1 1S6vEyJWp4DNiQOomJ9Ur8SY0zZOQFYSwwpK1WVZwGP6Mn7LyhUpggo+9h1nxiu1lHi8 fU6H+7lTBQGGz23UQKkCTJfNJAkX2dcf6plk58tPvib8D9vNf2eLGjtsYz5pOvgezj7g bfZ2Rye3VKfPm/HkZkX44PVD+MXKJrKITQkHO8ssnHEBjGHThpuly4OnDdh4vJuOJeft llUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-disposition:message-id :subject:to:from:date:dkim-signature; bh=PGGzLFLmfnBZaHGdccMyfAmnrSmSHgOf2zOPUT8XUpY=; b=MkVZ2sYUDXLjF0NrZXzCwHcQgnkGD8E7ymHrGQ3G9q2bKIgx1zWwNg8XeVsc7JEV73 6YYxWgbhqDX590Wkna0UnnRA495WxoEihmfwfHNdMG1CjKHbvKbnDfn3EXINGUbSjL1w Li5kfJfh8/UffPUVTTmIsZswoQjDFsuSOMiL/6yxvqOHESSiQBlundXK7gSPN6CPh3LK NCbZIFjOKETpSr+rtjcKRc5ZasxC7FLRBr3hxLuez3gnfD8prvIrc+ntkOTVDFERMPYc nvFFht2irfdxBEAgXf97l/3Eg7CwSBRBUXOrMG8/bAwEJUHyvantVkeeWwT7l5Oly2/k CHhw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b="RV/ZVv9K"; 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 30-20020a17090600de00b00871a4e8d7c4si2859810eji.767.2023.01.24.09.00.54; Tue, 24 Jan 2023 09:01:19 -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="RV/ZVv9K"; 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 S234454AbjAXQlO (ORCPT + 99 others); Tue, 24 Jan 2023 11:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234494AbjAXQlJ (ORCPT ); Tue, 24 Jan 2023 11:41:09 -0500 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2122.outbound.protection.outlook.com [40.107.241.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59F249020 for ; Tue, 24 Jan 2023 08:41:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LMm4Dl4UVIHfu+iZhufNxmzDeBcUGIf0GsWQyq2jdtpW/Ln2Gt2f6H6tImkF4egJh9w256jpFeWmt3GfNpM1LYorz+3xQk68mxDXP5LzXsWjjFHYd7bHPc9GNSg2SZXvuaJI72RjJiopPR9nassUbX/IRveJpdCVVLuUzKyD5XHtlnhg/UUFq+/OhwihPMz0Q4UFjYlpOLZF46HM1Dny9YX6BoFOcW3uAzcJxgIDT+almE3Wur+vsWr11GrDiLmyxdf7+nCVOqvGH/b2KR4TVk+JNjGxA58DfM6lTXy3fR2SzJdpADK4/+jPsSj7oDDfgIzBBUStQxF185mjU4jlwQ== 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=PGGzLFLmfnBZaHGdccMyfAmnrSmSHgOf2zOPUT8XUpY=; b=hgCtvsgqvFb5Nz/9Z1lpByYsx6GzhQHRymykOCgHhfl5fXa7d5m+Rx3OkcqDOqVty5RMEbLWbaT5JY1ePaVpuHmRUcUggShnr8MAPCb5wLAJH5lAEcCbKF+buxp6YEKiwJQ/rqh+XAWe4GZr6dTHa3LnPyHtCEbG4nLcUTBL40V/nNUKRr3uemtKhgRLa+RUFtIQW6PSYIuB3YKHD/2KuzyDUW3s8pzXDVbx0sDYsMmJvt7OQCV6KHLbtkTiGsBXtoQC+iHMF7diihGYzDpNEVB++9SvzhbRXxnrwbB8FxHwvMliLv7jood/2rB1Vp2vLP+FZBnlhtbMTPmMo0FK1w== 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=PGGzLFLmfnBZaHGdccMyfAmnrSmSHgOf2zOPUT8XUpY=; b=RV/ZVv9Kb6UknLqjQKOZxl1YTgsgZrcnqOnjRC8AcPp6THzV/rvm9F8hk5DZac+123KboOtOxQx50URjT93NXEcX4cFNTZQSDx1ABEr+94LuPHLSnhv7zqo/t+kI+J7vTnJGg/wsnYEBauyfF3e1jOEGViMIKQ88dgtwK79DuU6jBEqG42fBWobcLSoXWxBFPWqysObXCB21X9ONOwwKBqVdFRxzFFJ1nQTMfxOsaodU6qB+uL0Uy/LHMwAcyKDP+wM5sV9HsqOJTUSub+ZoDka+aVmuN48qXFU1Hbd7sSMXlPsXqrn6cbkQ5PADqAW6kehOqt2dPQJlWoff96HT9A== 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 PAVPR03MB9848.eurprd03.prod.outlook.com (2603:10a6:102:31c::6) 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 16:40:58 +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 16:40:58 +0000 Date: Tue, 24 Jan 2023 17:40:56 +0100 From: Manuel Traut To: linux-kernel@vger.kernel.org Subject: [PATCH 2/5 v7] input: pwm-beeper: add feature to set volume via sysfs Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR0P281CA0104.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::15) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|PAVPR03MB9848:EE_ X-MS-Office365-Filtering-Correlation-Id: 52c29732-d1ed-420a-0e23-08dafe29c556 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Set//yFatKlcQRM7AkteKHBS6uuptFZhILhlAtc3WC2dxrlnc29F8+KA+4vZftPWPmFKXsT9dBNZ0QDeKMWHsvSOK4fEzDMwShd/Ccl4nTNSdfxA7A4w78bc3Ek0HepuKdQn2Q3/HwFm18XMVpchTSPs+blOdwO6qeClxjZ6uE7Yk0n3CKueGPJTuuUkem1d9m73dzotkt7YTamhL//xsvwMboSwpM07HERHG16n0c3yHQvZjrAr8yzz7O4UZOf4DQYOhpb7dt8eoEhNIefbl67TAxMMAI9sTms74/rvZrvSGv7/Wzk4e1DfWCAkbsgCtnFW9SCwERgtiSQjSRMTPwYWxDuLBF6VVbCXxjIrYXp2mzO/oIEBBa5xseOUi2KD9JWA1kNkLOk/tBtnlFaz6BlqcbpxuusfPEjVvmyQgZQbnl4V80AnVzYODK1r53RLz/+JG+MQxL3ypaiYD8xJxBhBUJVN3sVPxBPMcPhMWl8sopM8YkMVY+TcVQDjdOnlS4tfpLHb1cZS+hRaIoMzETvol5ryzj+3SXfdlnwEw09R3xREOJJofRZGm8p6LDCqNEOqyXZkV+GHX/C6GfATjqalfRP7uSnSbWZU+Kv2SINBsHY48cqrrUV7PpAlqzFCUJRH9hw03FpXB8ze8CQ5isHPgT6zTVElisqraLo68K7J1rRn0by9KuRoWSS1Qdr1pkiFWBXFraDmbtgwKmHKLw== 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)(366004)(396003)(376002)(136003)(346002)(39860400002)(451199015)(38350700002)(38100700002)(83380400001)(41300700001)(86362001)(44832011)(2906002)(8936002)(5660300002)(316002)(6916009)(26005)(6512007)(6506007)(8676002)(186003)(66476007)(66556008)(2616005)(478600001)(52116002)(6486002)(66946007)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?BdOM16YGcAYVrd9uXu9D+vxM6aSH?= =?utf-8?q?Qy0SR7le7+/ZehlOcKIqq29rzB8DQbGofrhfQqd4E/t+1JWlKhGJuKvOoin5OpVNm?= =?utf-8?q?piwh7HPpVb0R7hCp3uW80m1BxgywAxpjtfPoDObuLBSEbSBS0CrgdpzkU1/mruRDG?= =?utf-8?q?A3MJRCJvZ0cZyMqjzwuJc6xqEJ012cRIo62HxbKY6RNL70fCmI8L0PhddpUgC6VQk?= =?utf-8?q?bEgKXVMH41FqPGiLaw+uGoVvewPt4v7fixZ2g4HQxiQUytXcnxCg7mpnGdVmKx5Nf?= =?utf-8?q?JL6XUf7aaXKNp0CT9ocW16sE0qzB2KjpKKlNJ6rItIaye7iCQAYPDSsQFre2GY8hM?= =?utf-8?q?C/8vweHM5iaZukYdmI5zu5JTS+z6CBOSFp0XKJeQjRkfxfxRDU3xgm43+8CGbZ0oh?= =?utf-8?q?Nms8xhw/Ph3THN+iRYrNyfOMZ6ptjQz+id4KyPWfY9ln02xMIo/TmQNLJh0qONNRk?= =?utf-8?q?YSyaBRg3sbfP1bVoie+1bwjx+axU7NXEtRhWQuIZKoSiIRSMymQMYVzTnvxm1fIzq?= =?utf-8?q?sP11S/1Tqg8eCZd6+3/3MDhEw8vTFJT8SVY86+YPD+g2Ua30RzB6jqub1EPS9sy/a?= =?utf-8?q?0n1aRXP5Dv9AMz5sS89cjuj+ttbUjgEUQjIJ8IzIy6ZKD34uz8R3MJpcOZ1BguCBY?= =?utf-8?q?DmPWMCeQ0lmivyf9WVWvJe+S0FK69x+UipmobG9ok3q5hpml6yWHb1ARdd3KYao3h?= =?utf-8?q?q+F0/9zubfvE/5U34o/12qAjTS8cujfc9gUd7s8/JsMIJXd8dcs6/EdC7WXDX/zfi?= =?utf-8?q?i0eum4M3rSPlbghtEbYGc7rJ6WQD2HRjZ4junYMEeI975HPPrPpKE/oiffRHAE/5h?= =?utf-8?q?lbtDJnyn9rD79b6iOUP2uPEpbydtDhrlxH+MEuAPPAkW606HExHwf41Lu5SlCdyPp?= =?utf-8?q?LDOVLvDyiwEf83843R8kVrO0cxC3P5oh+J7a1sdxs2uNWZanTFrlP/BV0XZlFgz0O?= =?utf-8?q?c9DC4QkNHHPdupzOPK+DiHGIg/LycioptHY7ykfcGRUmh5QTLrRZQLA1uMFHZtFdM?= =?utf-8?q?fxTJWDMJFQ5MDxLjBcbi+PAWbFRovTyxxOFLdDQ4UCoYZvmVwT83OPnE3DtPQv2Hh?= =?utf-8?q?GQsFCRJnIAEiRXrJfDY/MzQZ+FBZL467hhg+JjhpKHJFuksk36rPdDKc9mSXoA2OR?= =?utf-8?q?NhobXDvDYoQGK17DxA7pm4yuYXmMh6fA5+lv2Yxcq08Bxa8qxx0fwGX73pw6yBaA0?= =?utf-8?q?C+sKjGeBe7gWDfLBuqNHWhPzL/Rq7EyWnRwXD8v5+DYPywiKS4oRNnImtUV43e2fg?= =?utf-8?q?5FM6iOjUmts2cuw7ruNMwSdvfJ6ZxzlkGnO5dn3jS0lU/tFE5DdH1hA6NsoX0XUPf?= =?utf-8?q?DLSVSs7/Mrm1vDAVBFML6XvHPGzXRCO6W7QeuimCknEK4Gv3Cvyjm1CM2tsc9pSbj?= =?utf-8?q?AbnXX5KC/V/IjkWRp+Ex7wGKNT1gKEUZ6mbGth9o9xPZnozWHfxKSCVyccFxzeo9+?= =?utf-8?q?N93Rbwodrr5V1EzLktmU9LB09Q2t/X1GNpsyO83B3dyaNxu+lQ2c4yqzx6NxqiCcJ?= =?utf-8?q?8Id+crG4uXrP?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52c29732-d1ed-420a-0e23-08dafe29c556 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 16:40:58.4993 (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: cX/88pO4yUnSUtVTBjJspqTZmq0XN0RULndfJ70ABazVBtpCeDZ+y/o713jz+voKXC3H+rY44D2SNSIzFfEeIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB9848 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?1755924061879075146?= X-GMAIL-MSGID: =?utf-8?q?1755924061879075146?= 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 Signed-off-by: Manuel Traut Tested-by: Manuel Traut --- .../ABI/testing/sysfs-devices-pwm-beeper | 17 ++++ drivers/input/misc/pwm-beeper.c | 84 ++++++++++++++++++- 2 files changed, 100 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..8424b6776ca9 --- /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..fb7b377fee6a 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -1,9 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2010, Lars-Peter Clausen + * + * Copyright (C) 2016, Frieder Schrempf + * (volume support) + * * PWM beeper driver */ +#include #include #include #include @@ -24,10 +29,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); +static DEVICE_ATTR_RO(max_volume); + +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 +93,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 +183,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 +229,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 +268,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); From patchwork Tue Jan 24 16:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 47779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2262478wrn; Tue, 24 Jan 2023 09:01:29 -0800 (PST) X-Google-Smtp-Source: AK7set/5UNwS0MwNdBxffGn4fIYepzLZ7yLYWume/Dg8prumaUgTHpgXFMB69St2/ENCNqyN2Mlr X-Received: by 2002:a17:90b:3a8e:b0:22b:ec81:c385 with SMTP id om14-20020a17090b3a8e00b0022bec81c385mr3335461pjb.25.1674579688939; Tue, 24 Jan 2023 09:01:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674579688; cv=pass; d=google.com; s=arc-20160816; b=omCWl9oO1H2RZbJG24L5VpDffwOyG43CPbzxQK2Eq5E3INxYGAQA8dh6QbD9rP9Q2C jG4M1FWU8xdihITel9EmeBvGfx94g16AcKn8gY8sTH66hs7TLE0I0ne30ZpGzvI0HSR/ S8a1GGHyD4DR3/MjPNdYrZTwPwMagVLtZ2JIn1KbPhw7PjEyKO7q/oLJOMCsZ/d8wBxA X021+zET8OP4lq1iaSAWNSVJddNVw1kITCiUbBZuh8pWtbxkNzBCanxNp/+f3LT/OxFx uLf1dFcV4FjmLKnW0Q1tSaLUmA9LRnql90YDVy9OMWzVWecH6r1EhIf8CoNm4yJh7vAd Wm0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-disposition:message-id :subject:to:from:date:dkim-signature; bh=1HRMwTPc/kfLY/jcFogHCzEOSKzQmCifk5X6VwpBOsc=; b=Q7dty4KurcpfpHvsJM7jk3BNWYQbBriMapEi+cQAZCKHFnTQgzeBC5JxU6bci1dx89 a0/Hf0HDyhDJ0PeU5LwDdVjxqU7NEvlT2SngUXtyTvgT4MQqb32bARvSiHpBy5LCQL74 VMn9KHold9c9QZ063+CbUGe3M43oERaN22Q0zaLlv64i9TNzzYZlWQRnXrRxkQMcHFho YzepMjMXr3R7DZe7LCinSLT+++fKobC5kKk2sbEIDgffZaG3OxxemwrirhvuaIHT14in u55MmeVtWM2D+Su35VUNcQ+9SmKz/GUO0ZpgsAvjiV7+rPlIregpYPWqFqP7JIrc7Y5Y 75dw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=TITI3A+l; 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 nu11-20020a17090b1b0b00b002298836bbecsi18381147pjb.171.2023.01.24.09.01.16; Tue, 24 Jan 2023 09:01:28 -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=TITI3A+l; 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 S234447AbjAXQmX (ORCPT + 99 others); Tue, 24 Jan 2023 11:42:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbjAXQmV (ORCPT ); Tue, 24 Jan 2023 11:42:21 -0500 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2103.outbound.protection.outlook.com [40.107.249.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED5914DBF3 for ; Tue, 24 Jan 2023 08:41:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oFqlYj3RZLMtUsp670a88XXrrqYYFpM/uRqLRAQC+7kFtNTmmGzkpAnZO6dc33X9LSY9HdrOGIi4wmIRhU4L+kYpDmjc/mCSWCU+ezPAk+YKZ6SGvWyyI1CJJLZCNhmdFIUQhhklnuOJAnp+2TESbCDrROCm1WmZmenbwd1I3MM6rtGn7oYqC7ttsMpenbKFZ39SN+SADVSSSAdV9kW8uSgA0hu/3IpFP1EpGDND2gbCVsKCGAooV0zPgFbSsb9689h1kmatywc1kAXjnKo3Pqa4Kt3nJUXkNzRFNDVfIp9oYU7r9V7KgM5MceSOOsJm3Z37vdBSfRd0CoJmD+4C7w== 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=1HRMwTPc/kfLY/jcFogHCzEOSKzQmCifk5X6VwpBOsc=; b=dGYlnCLcPFGZ5cmLPiSp+AqyVgNbGp8L/pbdxPEfaxLwLplZAtR+KqMlAue8w/9aYsPDKKKsBUWCoiWIfX5x7SMt2jIE8vBNU6E6Rruz2P5SpHL8zXal8EC5oJEhuAo0rsWYrZlv/znGFjVbZYgf3A0eVfiAOXG1ruaPWBycAhRdsu+7aeUtZMnse7AKSe+iOZXmLd6nsQYDv68faML5YEtZRmtEdkwcjwMwzAZu8YAHLreET1yhBLHnA8jafYG50tOV/oOMwrLjoq+VTjeaHSq62oluboZalRx2qYW1HPUAUjhxcHHkSFFEobQlTeCNQUeO8jJ2GEWZtoEeSyFK6g== 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=1HRMwTPc/kfLY/jcFogHCzEOSKzQmCifk5X6VwpBOsc=; b=TITI3A+lAt4kI3NXbHbm8l7+rZEqwFmW9lZocE8G9mtHEF7MN9gZAVJyD6gwc9Gwh4XBSrCPPPrWr9L7RaB+mUM3asR9OHu6RdukaxxEY2aDIB8Xz/aNPVwYsS/P+19nPGfpwmJ5b6Y88McGlgosygUt12lM2lxrH5E9k1enMj5wmsIpEZ9rJTg7ec01QiOEkHKkOTCIce2FBc3Kt6TORFhb9xhaxdFnXxyIFpYxkBb7mCg9d5PQyrFGvLGVKvSqLmmZNFCNX8zD1N9lZcUmBrponcS0bFQZjLCIy23G+JnQB/CEEGPj4vdATOmtiOqlkdsukoaSyIsqCZ5hYow9cQ== 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 DU0PR03MB8788.eurprd03.prod.outlook.com (2603:10a6:10:40f::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 16:41:54 +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 16:41:53 +0000 Date: Tue, 24 Jan 2023 17:41:52 +0100 From: Manuel Traut To: linux-kernel@vger.kernel.org Subject: [PATCH 3/5 v7] dt-bindings: input: pwm-beeper: add documentation for volume devcetree bindings Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR2P281CA0128.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9e::9) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|DU0PR03MB8788:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c0a5c76-d1c0-4b06-d391-08dafe29e65b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bb4GKk81zhcjxnMPaBilFdlrtkTRPUZ71gMXbREbGhGoFTvoFZN7+TY0DJTfVe+pGIFSDery6UwNRVklswm3JCiZbLeA8JblDfE1voq7XF97+w6/56TeCrsDbbuIqsfWkIDcrCbR93Kt41nu8MLmSS/7F18bz5qviL5RwOQP/UllzAXVmRoPzNjAOG5jgZM7GPDUB5BJWxgSmCYBsDaVc5suNYRyYwLrivopaotqErrWm+bqJZvfNKE7n8l97mqE4jkHQfGqFn8K7ZrWDLmTrwDMpOb5vORMEaLFuYbXHA9qlp9Rkk9wJkeho/Ek6fZKYXt/6pgz1XyYj2XJlsyQCm19exA9JIonXLO9qiQjYcoWBk4SHmFSUBRpB5ED7tHW5k+FaJ1yUIOEFrzuR0qeZbVBh7MgefMiU/i3SU/td6OATZTU7WsFK36db3kEckBbxq4rta3fC8Vgo58oz7y1bLoQ2JR4AxM9vU1j7lceT/hxuje76HrKPub1rCfBQo1xIfk44JfqliorYboi0cI4cXc5VryMS5Vd9q1M06WELc8DHp1+j+FEj9iRfA8Ia+n47OayPIseLojQRG/0s5fj7dZEi/EGUwsPFLVz9UFl1O8sr29rva8fXdKb3xzVs1zNfgcE8dW6lWC7ykRkuysQWHE+SCcBk3BFWQYZgUKW2O0wVY1zgO5zmVLNxLdw3wafqrfFycX1xjltRHY5D3TK9Tlaqbf/qZoon07N35Js0DE= 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)(366004)(346002)(396003)(376002)(136003)(39860400002)(451199015)(36756003)(86362001)(44832011)(38100700002)(8936002)(5660300002)(38350700002)(2906002)(41300700001)(66476007)(6486002)(478600001)(52116002)(6916009)(8676002)(6512007)(186003)(26005)(2616005)(6506007)(66946007)(316002)(66556008)(67856001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?LANwgaquQyHDpI7sRh+V8v1kq4ZM?= =?utf-8?q?PyL4GnJq/sWQyQsVJrOuCHhQnbcDIFB9dyqyFyGRLMJ8HnPxYXGmiIKVGn5sgYuol?= =?utf-8?q?aGrsY6Zib2/3JowHXruLm5N2A02H5ZEHuDtwZSWXRfZFBCUbet2j0veRxBxaZw2Op?= =?utf-8?q?ztoBrddggjjEx6RZ6pv09KSBYxPww2Jk6DTTDbuxlo9Pa9P48TlsPpts5tcSxaPL8?= =?utf-8?q?ANGGu2vBIOIMB7C33pOTVEw6t+Q+DKgLEr+BqPHRlXb4zGQQjN81k6qDD9qMbaa/q?= =?utf-8?q?rNoaJ1rhvVElXOZUO1jVi5nzsK0JHMiKPId0nIKKTAjlb1vpRqyuGAHx9n3PGi7At?= =?utf-8?q?0/Lz8fpsxAdyE4qiFAYLC+P5cbl85H+S4M4lAWYvdXl82ZfiBzUk2XXw4MtvoY0re?= =?utf-8?q?ilXivpESV1tGDkgQZbgfzMOZAtpwBMRhIdahWiBMqiSdjdcPRjHI56+cXIjZ8r+jU?= =?utf-8?q?2XiyLM5R7sbaEmE6A5ekbS6WYSOtm0i9ri8s4nYkA+fTnMJCli4secM23+BzK8QfO?= =?utf-8?q?Y3S4nnkSWRcOzrDfyvdIqUhUS0F3Vu3xWkWrIZ4cMBM8Okozr4406i24CHnw6l5e8?= =?utf-8?q?tUNxzBXzDaGRsXaja6ngb7T7IsH4l57K3NmtYS0QjMu2ege8sUMjIuKxiBb8txDa7?= =?utf-8?q?HsMzy9OgruWr+RQlyjtZ2vN6OSZ5QVuiKmd0edU8Q9HKg4IMG/8khRIEQJ/UyYTG3?= =?utf-8?q?y0X1EfHgHxtJl7pxdMzSLhs205/h+1UeyPNZzNKoPPyWezBqNxqtz+EqC/q7RtNbM?= =?utf-8?q?UGKTt3XnHquB6/a8ySLoVdBT097JucyU1oQU/lSckgvS+vSzox6zGH5498K1Gh4yV?= =?utf-8?q?/2VykE8pjKYdcWGOg7jse5O/BApzIUf9oJmFBIdPosbxF1UCiM5Y7w3agmXc+wKrD?= =?utf-8?q?oIVtO5MAGRhC/NreFsx532dIN8bIB737WzlFECe849MoixbLjThvtOyUMM+HJXrop?= =?utf-8?q?wchnheng6lZmjGE+/A/vuwAunnlSmAcNCQvW/cDV9Z5X3/yNSZdeLoBS4dBCYFunr?= =?utf-8?q?HJpFSZeqJEa9TUHfPEkOF0dOdzMI28IXVfXT8aMY5ONIP7pfRStwNmTOO5/4fUuvm?= =?utf-8?q?Pn79lzEamLZPOfGraXC9jbmL67kTgXdjuo/H7kq+LgN5pZDDyEi2azyZCk0LtWrMr?= =?utf-8?q?yHCtS2dpAopkfsrocU4aO1iJNJX9dZ9SZP/dKshmwRIuj2+I0GrxekwhVcmJ6j9qM?= =?utf-8?q?13qOW+6EA3Ofbf3nUWxjRykrKVnvLFTyEOkRRicL4hugOqZJZohAc0dCzyTcpA68N?= =?utf-8?q?3L0lR7ppsuk0Q3jGwycJH1QsA6dnWCD6r8hgtw1tDWZz77u4apf1S2iJzFBYKOA9X?= =?utf-8?q?nx9KgST4Ifmf7VwYFmqbc4GW/MrjwFV2/w8wSleJKNqYRGDihDKftVpJR8stOYrIl?= =?utf-8?q?xhfGYp/Wg09sezFxFnBBr1spsZnbaCCoSslHvbFN9NfdcNB4y1su3EisNOMLrY3s3?= =?utf-8?q?Sg5RnY/AVFscpulw+vdY+sjW0eDJrC61pCw5UhbXCe5mOXLPRU1A8tXeAAWKzC9qU?= =?utf-8?q?yYN1qVBbusN5?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c0a5c76-d1c0-4b06-d391-08dafe29e65b X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 16:41:53.9175 (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: o29I3/rJw/setgLiciabldvJfZzgh2bfGaWgNpdYksKs+FupMa06wr1nTXt/Ha8Ib+8mWV+iGa+X+BdNTKQ0Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB8788 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?1755924071479419862?= X-GMAIL-MSGID: =?utf-8?q?1755924071479419862?= This patch adds the documentation for the devicetree bindings to set the volume levels. Signed-off-by: Frieder Schrempf Signed-off-by: Manuel Traut Acked-by: Rob Herring --- .../devicetree/bindings/input/pwm-beeper.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.yaml b/Documentation/devicetree/bindings/input/pwm-beeper.yaml index 24a40f0f77c1..fe1bbc10147b 100644 --- a/Documentation/devicetree/bindings/input/pwm-beeper.yaml +++ b/Documentation/devicetree/bindings/input/pwm-beeper.yaml @@ -28,6 +28,23 @@ properties: beeper-hz: description: bell frequency in Hz + + volume-levels: + description: > + Array of PWM duty cycle values that correspond to + linear volume levels. These need to be in the range of + 0 to 500, while 0 means 0% duty cycle (mute) and 500 + means 50% duty cycle (max volume). + Please note that the actual volume of most beepers is + highly non-linear, which means that low volume levels + are probably somewhere in the range of 1 to 30 (0.1-3% + duty cycle). + + default-volume-level: + description: > + The default volume level (index into the array defined + by the "volume-levels" property). + required: - compatible - pwms @@ -45,4 +62,6 @@ examples: compatible = "pwm-beeper"; pwms = <&pwm0>; amp-supply = <&beeper_amp>; + volume-levels = <0 8 20 40 500>; + default-volume-level = <4>; }; From patchwork Tue Jan 24 16:42:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 47776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2259460wrn; Tue, 24 Jan 2023 08:55:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXurE4quoK1bmdpvRxtzOPMu6nsyNNdzXiQyghPtfLQHqQg5g5pTirkFJnFf6S6YkP23XUO3 X-Received: by 2002:a17:907:3f20:b0:7c0:f7b0:9aed with SMTP id hq32-20020a1709073f2000b007c0f7b09aedmr39511130ejc.55.1674579324634; Tue, 24 Jan 2023 08:55:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674579324; cv=pass; d=google.com; s=arc-20160816; b=fCuexciwQ7N+GQzH6QkYVySKn56G3R40RUUduTY/rDNXbg+iNEM1EHl8L4Svcnxl7+ wziyl6IaUCc0V3P1oCT3cDEsSnbG8ZHk2glF+o3Pk/1kG1OK8/tOuhMpTzBsPiHhrsMx Hb0oYCl0a6jUYSv7mJYKoP2OOleCmx2Yd+5kRS234v5srIwJkTd2FIiiSRbxqwe6ncxQ 8vZ2ELky5w4eAO3OrXDsLrVL4ohgBHgXCMswis6zYASmN3ag0JYP6BM9315VozxSeBjf TER6UocD/ndqpS7c/N9VUKN7XyfBAP7WtW8NgNEj9a9BAtXO55xJcvZTQCotwTqEc3Ze bouA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-disposition:message-id :subject:to:from:date:dkim-signature; bh=IdcH2axOv2c7o0Vt6zlylT4AeahmKORGfip2xDaBbyE=; b=e3Jj0hcpQAtjS1z41HApwiV3yFRlIyQ/tou9wpHpUAynRZU52LHueRTvyMR8RikOBC 1jPRF+08H5omBxyjmOJcsqvfbOzh2XT+XLvW/kvUqxkxTXV1Sp3KprGV5xoaxRTy9EBp h4ELgxghQOj+JMFnkrl/+vvoNEYEg7FFirmbo+4FMIyo6/tsVawpeQTm5+DYZthEPSv/ ooeZLr1QNr7oh3Z7WwtJ6yFLVnIhSiatj4ZZS7yTK402u+K6TplkJRRN0jN/yVdh7K00 XhT/jxSiKaKVPnnMZ5YkI73HMz3Mw7snn+JKfFS/b+p6qKCs43vQWWWaaMwkgt2nPkWK U9sw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=FI1EwIRB; 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 c28-20020a1709063f1c00b0084d37a7d9casi2888977ejj.187.2023.01.24.08.55.00; Tue, 24 Jan 2023 08:55:24 -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=FI1EwIRB; 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 S234452AbjAXQn1 (ORCPT + 99 others); Tue, 24 Jan 2023 11:43:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234307AbjAXQnW (ORCPT ); Tue, 24 Jan 2023 11:43:22 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2112.outbound.protection.outlook.com [40.107.7.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E09E64DBF4 for ; Tue, 24 Jan 2023 08:43:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWU18Zhe2Zo+Qj9zfTGMJWZqOOi6jR21aSx5C7mJKQTjfWSNDiKmy9weef72eK4mfJ2QmGMj9fnmc1FVBlVcoa+iNWE2hw5Hib7eo/erqYUMD1upeQqcx6cjfJbHzAt85DQLQTACGNDjXEvgZDmXUm1H+qb4W9CxCx/aTF0OD32Lkzw0NtC5en5e7W5gUC5gGwLT84NRy5GwUA9g7WgOFEmW0mRIQ62kyI31yZMqRzPpKJRCoFn0SLvE9cXnzvlkwvZJiGVSBfqQZFxCsu9QaR7PCHCdVh/08sVWEXyR9p2zKkoB/EkptjeM7PzZdp1DJQJup22d45mds9DMEGHuYw== 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=IdcH2axOv2c7o0Vt6zlylT4AeahmKORGfip2xDaBbyE=; b=fFUX3H8iYHfh1GWD7LKImQtVwDuZl1Xr9HsCsnsinbxEaXvpf5KlZyTQ9KELpvhdvDJ5obdZQyyN6W/WcvmE35I18U6S/bf3i/l2H8MAXHamldfvkvoDCgwDSFnfcFamf/+a+aaGO0pphfNDbUBYKSu7J1U+sDLDLTHUg8bZ1Sb9z4/C4wUXQMRTGsWO7hVVJZDyOqF1ViRWGUSrvdte9DrX0LZ9UHu/V5WZmaRqU6l1UsmtbpiwpEWL6OqTdrxx1/hldFWtUWNZJ5Lu2ATQtCT+exaAUW5qrDKcwa5NJ0ip8+1rxGLJ5d38L/iLFJFZ164qJDXR/s4yJjnSVVIjXg== 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=IdcH2axOv2c7o0Vt6zlylT4AeahmKORGfip2xDaBbyE=; b=FI1EwIRBbzy5Ic91Ov4L7382uTt6oCnX1snotre5okVdCP6BDhfBghTPt7v/nxujaqlNk/Yfi6ygQShEyxSvSp+IdkzWHq01hh62kBAiymCcGpQRLAaL3PRd/0w7b7zfjIRfa37RevKlCYIk4hYpwHhS8xKBDAvcKmfc6T1A99sP2r9PYp9jLhhXe908tm7xSXxIr4lY/jGjDw5mnZBUO8tfBn9LMVPyTK5rLfYNLW6OM3tKhWQKAXT4TQjz60TfqjmYwCk/BtjIwgOm7ZHhJ8qhOh8T+ZVW1JjxSuEeDrW5di89DXEqm25GfntR+MDS0pTcPiIMz4cw3wfJH3APyQ== 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 PAVPR03MB9848.eurprd03.prod.outlook.com (2603:10a6:102:31c::6) 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 16:42:57 +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 16:42:57 +0000 Date: Tue, 24 Jan 2023 17:42:56 +0100 From: Manuel Traut To: linux-kernel@vger.kernel.org Subject: [PATCH 4/5 v7] input: pwm-beeper: add devicetree bindings to set volume levels Message-ID: Content-Disposition: inline X-ClientProxiedBy: FRYP281CA0018.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10::28) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|PAVPR03MB9848:EE_ X-MS-Office365-Filtering-Correlation-Id: 17546beb-53a8-4b6d-ccb0-08dafe2a0c6f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ao8Vq4+OGKTFDnvySOM7CYys7cyP/eXOmJbfuJhhZ/k1or9ogxdMxCRUJvY+SCIRI8dohg6ykvLds/ooKqFvortkO88/RO4PgIW0lyUYLSkexY0HdX2f/3CDVnkP9R+oFtJkdPP4UsA6lP42bKjST+nci1veNvjs05XFrDvqCLVc7B/+QAD2anuZH7alv8tnXITT/7Ag6q06gCIa0FocDUE0CmvVZL6TVp1sIBaj//Nt03LiZK0eppQ+AlkhScNCRAdFwTBSU7Tz/QzCDRVEKrAeC/BgpPyAeVTC6PVQuAvH9mQ+G0/nf5YPtMbdGONV1K3hUJDmjZQz5n2HcqiMhL3Ex39bvUU3JXq2XFWxzlZiBbkplJjqiD1DXj+46Klwwb51RKsnDksBiklN5Zx0cJ3xfPzZ4ISA0FPMA256EiMyk+dVoqoazkD3Wq1f2tUgI+YH98zbpBmu2cTEMWXpe6eSvza5xW/grVHOD09h+/s2qByF/YJZbGWz6Chky+QFrtp6wde75ykMe5+0ojBcGaDCHi2d2GRuolUYGc6n7K8sA3ixuWf0YqmXyrShrWyw8+MVlHz4vTzn0ki+A+m8wSeXxomoSVIuhJSQUVIU6VSVYb8+SAi5QS3z+Hb622N76xujNTMDI2bsRw11Jt5nKs6xVRy+G4zCpmr/pg6Sp7q++jt8Mw1IvGCodhI2dQj+wht7QalubBDbsUi+ErpSYg== 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)(366004)(396003)(376002)(136003)(346002)(39860400002)(451199015)(38350700002)(38100700002)(83380400001)(41300700001)(86362001)(44832011)(2906002)(8936002)(5660300002)(316002)(6916009)(26005)(6512007)(6506007)(8676002)(186003)(66476007)(66556008)(2616005)(478600001)(52116002)(6486002)(66946007)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/Y8r+G8kbwcRRQ+HHJZqgqz/memg?= =?utf-8?q?7ZvYzJYh/tnRUGvxnoD/8DmGS2wzD9zgfT32O15AEYHigkxQ1Fo2cw6nWNhVjtK+W?= =?utf-8?q?FnPInnilMmmV013hiDeSM2VF+mzcsFjYixqRJjQiiWqPyddWBlsC3hk8K+zq/LtY5?= =?utf-8?q?3GTOyjoXRCHTGMHCG59YpHPK8TrZ4m+O7+M1RFrjFwpouchq5io6u/3pyh7c7hxhF?= =?utf-8?q?M8XyhMc8sS6BCfrQvIBX+4lewKanu5UYFwP6BTMuJ2oUBSKEtel4tYmzuK2VqvP4Q?= =?utf-8?q?cqD4t+dHPudjntAh4E5SHPS71xXzZze0R0P8A0djin9fmqoFyoEAYXGHmXVlhygJq?= =?utf-8?q?638g0+H60hwoN0+n4ofl107FXDkZaflEqll/6+PlYvVuzwt3/KW0peQS5FLcH4n5X?= =?utf-8?q?DpqKRKGUUv9VZaZow9yO5acO+rCCEDtft/0l+uPq6B9XR8F+rRLVfGoSsW4Uuyqw/?= =?utf-8?q?wPSULcSd1yz4mPYejxX6mj6xq8xCVMXBITsMpQHMNW4mIA7V2BSBKPUlurclZM2ZG?= =?utf-8?q?gHUmvsNb2a5DPUtGHTXQ7j0WU1Tz28GP8BihXd7swaAXON7KR41jn+luovwpBmglz?= =?utf-8?q?8JnmkmyBllUKn4mxVQhykBZEMIwsE2yFBOcuwCkNH4WDlMoIsB7iS7ZWLO7T4emwK?= =?utf-8?q?WL2f/IdvHMfZh2Dk0VX0EGTYJVBoUfGYaYyRIEoiybAgAE2Gvucw94ov3vXYcRIbE?= =?utf-8?q?Lrj8AFPethJGrTQ85FNR9G7xgVj3ZurOhVZFV0dXUBhUrm6cNZJQ0vgRvAmlnZjJC?= =?utf-8?q?PC8N0Q18iXDv6gaHKGLGrCc7yd1LjKvLkl+B2irvM0K62sZSYz3ofV5s52sLKb/PI?= =?utf-8?q?IrcbckeaGgjoor6xshl+/bE8i/ADRn2VyiDzWmnEM+FycbMKUVeMkiHdQI77MgPin?= =?utf-8?q?XjcNBiVzyASz9lCH6ioSD/3DhmErb+Cm3xBH4SxpHdnSZrLrM2hqyzvt0XcATsSL7?= =?utf-8?q?hum12k3D57XHCEckW9RfLK/yOVKpQb/pYXe2QOGkeEd+o6wMJEDR8BGq+HLuQCvo4?= =?utf-8?q?I4WfzbUUj43f+mxtdXQhd2kqlmWagtUZg0SM61Ts2BpTa60Q2TcXkKwO1x8hxcF0v?= =?utf-8?q?XvSF5WyoFB/KApbfO3aOXULlMrr6u1p8MeYONnGwUSCJ+lAAgZZ2hS5Xysc13vt/v?= =?utf-8?q?SF8Fcji3zsppfdJc1vn96fqgyy37hqRD0JRUClZZtRtH9BbFED1NSJzwMUzckTO+w?= =?utf-8?q?tMm854YKLZK8wnna3kZqKW9E9drr1AjBlM4hRDvBATGyly67yEm6QnPJm/i42UjH7?= =?utf-8?q?APjgYeOG74kciz5Uy93uFenPROTbm422O6CKF+1vZv+mIZlDtcRmPVfO2XVWS0O0N?= =?utf-8?q?iPUapdZ1UloF0WuTTze3yWJQeG9nodFPXjT6XLol4xdng+0HYfmTZxUbtP06rwoaz?= =?utf-8?q?1uMdAapVCktueOyqjF0l/7UQSq5P5MjDlI2Cn11O4wk6VbtNbXri6/oBQdqYzlAsl?= =?utf-8?q?4b2ULsvrU8XdswUUEdPQXdehGdtXQazyfGpT90U39dCEHoDLIq4GOiLsHQe4rFGdO?= =?utf-8?q?Lpj+p5PBMjMh?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17546beb-53a8-4b6d-ccb0-08dafe2a0c6f X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 16:42:57.8487 (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: 1k/5O+cT291bZS/OJqxd+7Y07/oUdAAbBh8NuLWsiIIgJEDSSTxAEkmnKZenizRgdei72BOJ/0aL3C9ldA5WZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR03MB9848 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?1755923689948971771?= X-GMAIL-MSGID: =?utf-8?q?1755923689948971771?= This patch adds the devicetree bindings to set the volume levels and the default volume level. Signed-off-by: Frieder Schrempf Signed-off-by: Manuel Traut Tested-by: Manuel Traut --- drivers/input/misc/pwm-beeper.c | 58 +++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index fb7b377fee6a..fe543c4151d6 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -182,8 +182,9 @@ static int pwm_beeper_probe(struct platform_device *pdev) struct pwm_beeper *beeper; struct pwm_state state; u32 bell_frequency; - int error; + int error, length; size_t size; + u32 value; beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL); if (!beeper) @@ -229,23 +230,46 @@ 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; + /* determine the number of volume levels */ + length = device_property_read_u32_array(&pdev->dev, "volume-levels", NULL, 0); + if (length <= 0) { + dev_dbg(&pdev->dev, "no volume levels specified, using max volume\n"); + beeper->max_volume = 1; + } else + beeper->max_volume = length; + + /* read volume levels from DT property */ + if (beeper->max_volume > 0) { + size = sizeof(*beeper->volume_levels) * beeper->max_volume; + + beeper->volume_levels = devm_kzalloc(&(pdev->dev), size, + GFP_KERNEL); + if (!beeper->volume_levels) + return -ENOMEM; + + if (length > 0) { + error = device_property_read_u32_array(&pdev->dev, "volume-levels", + beeper->volume_levels, + beeper->max_volume); + + if (error < 0) + return error; + + error = device_property_read_u32(&pdev->dev, "default-volume-level", + &value); + + if (error < 0) { + dev_dbg(&pdev->dev, "no default volume specified, using max volume\n"); + value = beeper->max_volume - 1; + } + } else { + beeper->volume_levels[0] = 500; + value = 0; + } - beeper->volume = beeper->max_volume; + beeper->volume = value; + beeper->max_volume--; + } beeper->input = devm_input_allocate_device(dev); if (!beeper->input) { From patchwork Tue Jan 24 16:44:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 47780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2263966wrn; Tue, 24 Jan 2023 09:03:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYNbZrvIpAlTA8xcSA3mmdEvR6gpfcacLkkW8r8G5HdtGlAK8q0wdbKH/uDRzD0NFaoa5z X-Received: by 2002:a17:907:8b98:b0:84d:44dd:e03a with SMTP id tb24-20020a1709078b9800b0084d44dde03amr33877323ejc.57.1674579807188; Tue, 24 Jan 2023 09:03:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674579807; cv=pass; d=google.com; s=arc-20160816; b=yMyGadEtzlZhSwOzkTbNUhlasZbKfMm+ttJGy178KBC743Upzscrbc0VzE25LBJdZL Gs98KoWbyrBoZCtUHQ+MlQd1n6qw+8o1KZMQbmEch/V2tBCzUua8rV0ImhHPVYDQXtCR p4acau6VJGhG4VRuSWnYNOb1vEwQ4IJ8kdsRdmLOPtXYPdYNhKl7uT+MbRLLYjBO5WKD 03K7YDjDDgBxgRQQXqii2/ZMBo2e7TUfwunZMib3QX143mmc4YFZ3wleR9bkJ7RFGkx1 GSt+0GCK5N31CZK4qaUagjye2daSfgeb/hCiefnqX8JpeIBJuGIxm14DAI/IsLb2gwFW C04w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-disposition:message-id :subject:cc:to:from:date:dkim-signature; bh=MPJNZHYLnRKCBG/xVFcDHq+Eqy5RvEbA+M00/mDWA4A=; b=0czNd/pUvkAkYvYeMmpx6VH90g0qvSRIO1AIA4N66Nmo4aLblsYAXQNQjBUXDeWgCU TG7KxU7mfoCvBwwZoZpceCHZHy1Pfh7qEYuz0BObmsaWkUpINIio70wh6oZ5DdYDt/mg vkp5huvjLN2R35rdS6ZxBtHRY00XalCcQZw3aniVLJ/HeCje8akr8QUGVD+B4BzrdvU+ etJ5odyvdIn0MCol6vSzS+h7iiqCEKRvElnHTKKyq0i86XY0j44hcko3+AfZjQ6WsAow ql29JPQbGj2A+btuAnxeqwQJ37ehJXqXi7XgkS6BwOxWEXXFgyHz2PnfLeYu8xwNqrr2 pIlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=sGWSP621; 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 30-20020a17090600de00b00871a4e8d7c4si2859810eji.767.2023.01.24.09.03.02; Tue, 24 Jan 2023 09:03:27 -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=sGWSP621; 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 S234312AbjAXQoh (ORCPT + 99 others); Tue, 24 Jan 2023 11:44:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233843AbjAXQog (ORCPT ); Tue, 24 Jan 2023 11:44:36 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2138.outbound.protection.outlook.com [40.107.20.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ABF0172B; Tue, 24 Jan 2023 08:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zcu+tPwNzaeX+/SayU5fPOZiGVaVTd4aEjJkia6668se/09B0QlkqXnqj8Fim+20bvZzGOMGxKUEGOCDz++y13udcOZ+4ULZ2WLaO4dL6/CJk4lViAWRbKFhOzQHQg/DJVLDhsJrT2qXcLpqDXSIyq3HxJ4zup8LabR6/3NxqyH6Ew/K+DTvdWgrjuW5n6ZUe+rPORsEUnYO1aUAjrkXS/3ATiP/esfjPvpTwRcvTpS72yXW4pTdSaTH2DhyUqx4D7jirXheJfJsBG2Psx0mfnLJrwHu02r4KiUEjzyWFbTdRNuKkGuGe7LRPX0JMBYZIHH11B1vksV1KJD8xwP9JA== 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=MPJNZHYLnRKCBG/xVFcDHq+Eqy5RvEbA+M00/mDWA4A=; b=ab80QRK48xRAkh/Qmhvx1Mb9dk8S1YSaf9b2ijY21f8tYvup4Xl4tN6RD4aC8zSdrrZAA8X1BJGmIYknNJjktN9ew7kkyKwX4/qScSIr3wibKlNLx584t+M1VxfGWPogSsjkQ3Dhoe7Za8BDjYWBOusdkmIUTU2aqsKq+sC9HNohPqXAYKLDZaUMF3sf3jvoM2KZWC24aPunIeo3/gob0zwTLx84RM8ewzArSa7E28lAnzITi2n3yTz8Mln3kcKLHMqTF85tBig52elB+0pnAK4yqB1LwUGQr8M2oaBFACZfk6OO0Fentg/Ix7HcOZ9HNhbHUcM8L1VV2g9xJ0zYLw== 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=MPJNZHYLnRKCBG/xVFcDHq+Eqy5RvEbA+M00/mDWA4A=; b=sGWSP621tGtfS2Wa3ntyWBpJSr3V7Elll6qLiLip/h5TFi+p9D1NtrS/YACXlyOrnP4Q9ZhTglbmdkq9Bd4igaL6IFuqbEy0Curyedsdw/b5JfTle3EludV9A/D3BRBImiMtcK2a/yTnb02PUiV/yyRXZQDOJuxEvNu2z6p+eQ8AfORmEvKTKH1bWVZdxY8pVLhqbSs+VL1tdCrv5jyjb1B1XcWxAwAxbSrz9DhhVLVMNqAqSd0V7Rx2jndJ/tgIyOgunkodSZLG+c2MB/8WGEIpcKUHsjWW3Fe0vtgbXAyWc1ZGUNpwyWCEUlnQ4GnpyQpGSmWdRfR9DO7NPER99g== 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 PAXPR03MB7981.eurprd03.prod.outlook.com (2603:10a6:102:21b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.28; Tue, 24 Jan 2023 16:44:33 +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 16:44:33 +0000 Date: Tue, 24 Jan 2023 17:44:31 +0100 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Frieder Schrempf , linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 5/5 v7] input: pwm-beeper: handle module unloading properly Message-ID: Content-Disposition: inline X-ClientProxiedBy: FR2P281CA0020.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::7) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|PAXPR03MB7981:EE_ X-MS-Office365-Filtering-Correlation-Id: c9b26b8f-6e43-4bd8-7204-08dafe2a4554 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XaPdC4ffOIqXhad7C4pIxXbSltKuxB3SMn6BwWPFyrNg9u/EBlYjpmVl6gB6ZoFYfo0b3zCPDpxj91NxDICQlZYLh94DrCYIvmTw14UAbQf4MD+nE3puts1PyhDPvVLzgMtWE3eCN8WOYQa9fCYQnh5x/7ARXzEqRESSTXdj3xnAleaHptsiZsm6JNpPrifrIQLik1ZtIcDZKFu7vtkWu2WKZT5AqepbhR1p8/ufP5ZwL9E/3JkNZjRwBEpy9be7/+d2cN9rP9V4U+KerSe0hUsp5DTnR5lYEvpRbit05hTkElrfhBC45oDwgMyve3ZoDMk0MFMgI597lNgpVW5D6mcwMfuEM4Sh+vZyIJMtXS9C5HObuabjrOoFDf/0ZDQdIMU8GTo0Mkv1yCXqaoxnw25VLthACgoji6u8GSCvGY+yl0Ain5DABP+aIoFIqaGHj+VQj8Oq0+WgaS6kOUqdqD06p4XWQGvC4OnTeB0KefbNyRkpYNkei2ajlPUCAgFqVUu6ckP4IoZr8sXD3kW/lZWkpngSl4W8iPhZarVYMCqQZjG65AT61+wMojzBsAY9JL5M68ucd/tareq13tuq5BKi9wX+i7pKst0n2eXgugMaMcHKEG1nZSeEDqXmIAAjzWM0xPs6Z28ylqdSdx/rx6uXXnZJqjCgE06ii7JISKLNNovmewqnU5CPP8bUInz0xr8yToX2pOwV6D44HFwruAfU0z1Be/Ov51g0vY7mOik= 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)(366004)(376002)(346002)(136003)(396003)(39860400002)(451199015)(36756003)(66476007)(44832011)(6916009)(66946007)(4326008)(86362001)(5660300002)(8676002)(8936002)(66556008)(2906002)(38350700002)(38100700002)(316002)(478600001)(52116002)(54906003)(6486002)(6506007)(41300700001)(186003)(83380400001)(2616005)(6512007)(26005)(67856001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fH3HDqNo5XnNQYdgNmiSdQyD5odO?= =?utf-8?q?hdgUvLC128aptqGCH4HEm8AWyvro474409+a5bQ2Xl93JAUwwYfHgsM37eb2KV3im?= =?utf-8?q?WPA7hR+tZmGz+kTXUwUd5z9nZ+EPscYt/mOHNIJbkNLtfIB3XMw55xBs8PK3leE6I?= =?utf-8?q?/kr9+D0E5il62Pj3//8M7zs8wYdnX8IAOCIubupECPMzsZVhifjxS2HtWCQgh8Zsn?= =?utf-8?q?UMH+iD2Ub/7p1d4cuhSOOKDR1qHf884b/+HSb1JxFuefjqXyfc+7mJfkA9GyP1Pwn?= =?utf-8?q?X9aIprFxOYkWzxsQ40dlwKJmYt5J2HGjyHW43llTno5S34rNnK0VwZMYXp63+EFS7?= =?utf-8?q?9QZ4EP+pxrR4zXw9oCw4QfFotzXWnZEcLlVFTO2my9I3c/INCvFjxeyoxu0HCj2Yd?= =?utf-8?q?/kt19XNBmhUzL4S9DYSrsfk5xgUk8V6S4KfHu9bmHAVc3PhmE7fBEQiC6Uy1YFrFF?= =?utf-8?q?G3FKyvk3A9hRAw/NuUriHgv1V0Ngiy1+yak9xWGcQvMClJkj0XvhAvmRlOZrmsUf0?= =?utf-8?q?MlcKQAFcXhFXq5lEaptoPnuq9prOyAKSEFCk+5yEUlbGwDOvfLcBDuL0MV5UdzERj?= =?utf-8?q?UT9B/Y3At3tLyxyZUDFJheOQ1fG4yeWT/z9Y+QaF8hTYlFAz8ebiyEnSfh8qKkDmd?= =?utf-8?q?qTxHHewz/MbWsf25yIdbKlfEXcvzzIsL5f6JptiBcS44PB3eln6kFM8JhJoYhsVn2?= =?utf-8?q?IqZrT7wxWQfBHFBKVQOCfZ0L67jgfk7SqIwcrbYQHajqHGhB59ra+1+KLF5l5Nb5w?= =?utf-8?q?qK4or/hJBaQQMkQgoqwGq+Q33700ezhkflIl5iFJcpFwT9rNjAx+yGLW1KJBdxiOu?= =?utf-8?q?p0FiuFjBMw4YRMMgiuZ4CRWDm7vooIFnkqEIsXD9akXmLBtEW0cmoI/wNAtG6rzW9?= =?utf-8?q?PikaEql4BTp1W5pnPxEFqRrRUGBYu/bmiujOynxMIUfAnPns5vfUpowm9sg4mnVCF?= =?utf-8?q?0vWWUOdblqjQ5oeQ/C1aHpBWK1uOTsiFC2wZBYmVh5hFGj+pWIquXK6uchjW5DnR1?= =?utf-8?q?Kqu9Ae2GHcz+J9DkXxk1yA/DmAiCvj/1COkOcqFZVgiunmT/oTNy4P0xpv3fOp/2e?= =?utf-8?q?mGOnsBkvWi5XB2d+Owx75zcLj9cAa7G+lvhc+777vgrvP4ee/hJATjSIoXrgt5yf1?= =?utf-8?q?QKSr/FJz0dAI7pa6Im4u6J2dkqIQSjNuuJVz55dgjCBaXGaeax0la4dlxrC6jue34?= =?utf-8?q?pBUaooCPFLxAFuoTghnZ4jiqRJvtT0QXc8VE8OV2EEOBLCiWCRrAijzaTYaloHljO?= =?utf-8?q?/lRZZrQe9qKXOb8lzXLsc98MbE+Zmu2j8wpn0d8qHuS0SszZLPkAjv4L/qwBTIpgi?= =?utf-8?q?iwf/uNgbgOzU7A4UDnBLkBjZhZOl56leE8DIcwCU31nzbBoWUYxEAvmxVxALdLaB4?= =?utf-8?q?s/XMsIhnC3hvJmIqmF4zQMDGIQFTZ6snvUkE0CL4kMm3pHHvj1ULcF1FpTXuJHgyE?= =?utf-8?q?j3RJ+A1KMz2Mya1+elR1NYOaJ8Q7RmzR7aPXh+6wyQ3SkM2mPc5vn+OJWrtDshVL7?= =?utf-8?q?1vqRjokcToxP?= X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9b26b8f-6e43-4bd8-7204-08dafe2a4554 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 16:44:33.2683 (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: dzmWVYX/+auwnbYlTratqUOOkxdoc/3QRwJFMEDl9AP6VrzyaV39eO8slhGrcMdNfuSIxzvuFZz6wFi+SzyimQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR03MB7981 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?1755924195426891993?= X-GMAIL-MSGID: =?utf-8?q?1755924195426891993?= 'input: pwm-beeper: add feature to set volume via sysfs' adds device attributes without removing them on error or if the module is unloaded. This change removes the device attributes on module unloading or if registering on the input subsystem fails. If the module will be unloaded and loaded again it fails: [ 1007.918180] sysfs: cannot create duplicate filename '/devices/platform/buzzer/volume' Signed-off-by: Manuel Traut --- drivers/input/misc/pwm-beeper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index fe543c4151d6..8ef2937e8f21 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -300,6 +300,7 @@ static int pwm_beeper_probe(struct platform_device *pdev) error = input_register_device(beeper->input); if (error) { + sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group); dev_err(dev, "Failed to register input device: %d\n", error); return error; } @@ -309,6 +310,17 @@ static int pwm_beeper_probe(struct platform_device *pdev) return 0; } +static int pwm_beeper_remove(struct platform_device *pdev) +{ + struct pwm_beeper *beeper; + + beeper = platform_get_drvdata(pdev); + input_unregister_device(beeper->input); + sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group); + + return 0; +} + static int __maybe_unused pwm_beeper_suspend(struct device *dev) { struct pwm_beeper *beeper = dev_get_drvdata(dev); @@ -354,6 +366,7 @@ MODULE_DEVICE_TABLE(of, pwm_beeper_match); static struct platform_driver pwm_beeper_driver = { .probe = pwm_beeper_probe, + .remove = pwm_beeper_remove, .driver = { .name = "pwm-beeper", .pm = &pwm_beeper_pm_ops,