From patchwork Wed Feb 1 15:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 51416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp340799wrn; Wed, 1 Feb 2023 07:26:04 -0800 (PST) X-Google-Smtp-Source: AK7set82rb4eETd7/zX1Mve6haouFqr87mAr39AnaaI6ZxuUqsD2LqP7xCF8pGq3dbQAfgZesraQ X-Received: by 2002:a50:9f47:0:b0:49e:351d:37 with SMTP id b65-20020a509f47000000b0049e351d0037mr2921501edf.8.1675265163973; Wed, 01 Feb 2023 07:26:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675265163; cv=pass; d=google.com; s=arc-20160816; b=qnU4Xs6WA1z6Qe88c3f6Oa3J5aamomfr1i4Lr8hrFHYzcT7Q69eZpjzPNYd6Y3EOaU fr5vUCI8bj1S8WNuUgGYRR+Cow2mVjj8JM49VhV4WLqXrvtB+MsOeuxolc+NgGCsf8BY rbdRIg8knuA1kzX56F/Ga68gNtzySEVTlet45MuXr0BIfrCoRh5yLxcB9RNRaFS7sTI0 yoQOs0xWy7urTGPOUyGnyyaaGx443E5GHaN8ofNkCU28YbyPFmE4pmk0y19K3TBa0ojH mt1wyp+HHj1/PqHWUB3tTpzYEhcbiI46DMTzas4jCINK8h5JftwoETt6b0JosfG2+RGO e2Fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P3FvxhoeHgs6ySwdhG6dAKt75icVF7WewSQykfDpa1w=; b=seI9HoMs0h3YYD/b7daV2eeDldDcVY4gbx3jl2fberIkVTjU/g8IRLFMKqGhJPrAIL k4voLajmLQ9c2aZQdMKyyQn0Uij41XZcOK2PUpdAEldyiNW7Xk2gLl/tRf/usieZS/gJ u76cxig7a9ydBaH91Ltpl1JZ5nKJZ/9fTaJdCbseMWOOrUoEJRb67lDPZFXrfkn+orRs AiWPz99+q/zyVLmUOlm8tjysj4l0YrmPKa69Ai01mMm61kXoPfu/ntWWwrxGBro4ZCec J9Ajc2wqHan5lNZnjlY0qm0FO8i0eE6yv2VQn/deedAtZ13bF6lZqEuVKqWLgL2CMpla VUEg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=aVm71yme; 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 e2-20020a056402148200b004a26f3db290si5380030edv.133.2023.02.01.07.25.40; Wed, 01 Feb 2023 07:26:03 -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=aVm71yme; 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 S232340AbjBAPWV (ORCPT + 99 others); Wed, 1 Feb 2023 10:22:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232113AbjBAPWC (ORCPT ); Wed, 1 Feb 2023 10:22:02 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2132.outbound.protection.outlook.com [40.107.247.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 637513AAE; Wed, 1 Feb 2023 07:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=huoYRYIfxhTjIcxycCKkQOdBcbTkYZ0DydXRGzyFBDEyLs9juuk2R5GkM0+l3Ykq9sBxQOdkm8ldscPMLNqt+amrCVGa4H/7lj2TxDkZ7HGo4T1tmzJ7H5uNI/7bc55rV3mfoAiH1PWyh3/hLosn3DIoP9M05P7vaUOdaaCjmicPyxFm49daODFOVqDQmsyRauyTskvPbzuDL8Zvvo6mKUoumfE60X/dA6ZNliM8PstE0QyjEkO/qxBTEAFWyPElaQPnNOQv4tSLYVl9zw52IMEiClD4WPsm227uJq/maVZ+Pznxk7l9NmW5GoL5YRrgM79hU5b3r3FsdOK1jBs3nw== 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=P3FvxhoeHgs6ySwdhG6dAKt75icVF7WewSQykfDpa1w=; b=WZm7mfs61FqLHIMUR6kdrOh7MCY5lEhsisg2rzHwkrSGLM70IRpqrjWVWUI3MqAGe/IV62kyTS4srfD/AHzrpISOsw10ZMr5HMNSPUUVuCfr/p03xfTJt6NNxaL7s6G4Z3Rt4niOLOv91gxFiRKMS0vNjDhzN8c5WV1zL74QO9R6L1WF/d1oHkMTdSKqv6z1r8TWLJlWz2IEcEnSFBHOoSuyn3uHumyZaK6OqkJshUTvoPLM1gjN5FMCi4cfcXbrpUn7feprDIQhh0+ch/HCCRX3CpcB5DbHxM6rpaDOQ5+lE4ukVKBZT6kGxoCnXf5UHDsgHfxz4gadEOkAafM5Rw== 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=P3FvxhoeHgs6ySwdhG6dAKt75icVF7WewSQykfDpa1w=; b=aVm71ymeNcecHcdAPZ0wFV86NNYyNJqGlyLdIFHBdFeaTu0+ac4lYvMRtGHlUo/4dNDHjZoZB4qUw71Ko+WlzN5FnGT8CulLRb0MUhpg3uXS8XcfuYjSl6YZ9o4sPO6pAfJ4JKvOKL6ftLOGWWCnN1PCS8fdq2FdiZTU+RXdxJpG8i1L7gYNVvEnnPEf/i8+8ifRhYmMsx0YBOQpXt3Ddxbm1YsiQVg1NYoxiNrh822xKCIENwL1NCmoeewdxiJ32Te+7WmtgaIYhHDBDwHWKQzkl3DO8RKOuUi5HGkK375K0zLs0ovc27/jL1kbkDgfF/YIZFtBYaqjQh52NpKj+Q== 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 AM9PR03MB7380.eurprd03.prod.outlook.com (2603:10a6:20b:26b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.22; Wed, 1 Feb 2023 15:21:32 +0000 Received: from AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225]) by AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225%9]) with mapi id 15.20.6043.038; Wed, 1 Feb 2023 15:21:32 +0000 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Manuel Traut , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Frieder Schrempf , linux-input@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring Subject: [PATCH v10 1/4] dt-bindings: input: pwm-beeper: Convert txt bindings to yaml Date: Wed, 1 Feb 2023 16:21:25 +0100 Message-Id: <20230201152128.614439-2-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201152128.614439-1-manuel.traut@mt.com> References: <20230201152128.614439-1-manuel.traut@mt.com> X-ClientProxiedBy: FR3P281CA0123.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::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_|AM9PR03MB7380:EE_ X-MS-Office365-Filtering-Correlation-Id: f425ea3d-be0c-44a8-73b9-08db0467ffb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jmul3Mhjrn7j9WB4XdbwQ1zKfTzquW5a39068F5HX9e5CmCO+wxiQPnJ9akJWn7/0WkR5tZs68CruSKI92a/dIhPIbcnV627mKHt+wdFHlUjsVF16faB55yJK8AJ3NSHMtfV94L43IWTxKxZ0GwAaIJ8mwIZIuGmmxB83LY7Pt7iJl0XCOV6RLZfHOuU8X9LeiEc1P8fO9UNpxkzNQMNPTzrMrop7h77n+eKXlQ85CaHAfoHZdDGwrR+JEEIy8fuD0hffK5jKVQtNUUCYetOu55T16vfEQTMNh8zujisYEnvvku1heXAocNl7SzjhoIXcArLW8A6YMfmVM4HaHeVOFinPBR9bTh7tomRApLhXf/IWivvHwmXOD6/3NOu6QYuStP7Epbpq2hoZSGUucC9vZDMadQNQM8KigTufaz0cvLNvFMQhTzVoAnuXhzwhojQkbCXjh4CBRMu1S5OFiw70zKdwsK5KnOup8yK9WDzWY4xponXftWAz6KYx4LkVGBC/jResG/62/P+kp9V3XP2Vc53Qw0FH3voHAsXYqQ2mSiXInzaFUAY8fA/HFqX14Fqi0NMZ9cAenklXxDKWon+dzi4bi3bKhkDnauj9eoWcS7P40limdJvB1FP4W+DZHDfX5jHtBgTnLSpshqHCuXpSo/I/RDdKCaoWmv3s0yekGGec47mVs/JhNW3CEgDxJwEUjoqhMSv5gy+4FJRdrvzzfyVQZ5kZaXYVn35Rv494T8= 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:(13230025)(366004)(396003)(136003)(39860400002)(346002)(376002)(451199018)(38350700002)(38100700002)(54906003)(36756003)(86362001)(5660300002)(4326008)(6916009)(8676002)(8936002)(316002)(66476007)(66946007)(41300700001)(66556008)(44832011)(2616005)(83380400001)(2906002)(966005)(6486002)(52116002)(478600001)(186003)(26005)(6512007)(1076003)(6666004)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z0mOy9B95NrK3m3KpFdvsdFUDNxUeI0MN5Aw6xQq5iDRT1pPu3Eu5ul96fJf1ur3jWtTK0fjdOyqDHZqlKRTFqQcNMMuSDkekZ6Oi4EZKaoiQZPPUnVAlpdwVY4iSftP0FQ7YzQRiBVQu7AB0AiNrWIVMoo1AvfALIjuU/Wm2+IQc5DWHteertsQ7F2hlBD74IbRSc7UN3YAqlXLl7wPyU5JoVNfkbpOlrQRK3qGbEOOTYvaNvxq4bMqEimRYgUCMqc0srrEBIyoFKYTXgfif5yhVYLpKTNt5o6IEgVwOkaulErADOVEcNrRYOrGOzzm1exPgOGDvh8yFUVGi3dDYIyRg+NYfndHeEogEzdfCV6O3YzNr5dhBgoQjYJSGmUnBbKozuxS1z0jJRf9xSA4YIWjNT98pGjZxAxkjWt42kE9+jrILxREiOSRADGYO91ZXiY+71nCGcviJOxniL/QLKOfy0/AGb/76YZgLqPurfQHN82ZgalyDv8MgnfEjYKkhcnqp7dz9TQtJNn/UrsOx2/h/Qvl8NiA3iXrkLC0dB0C9W63ihO8YDt5GcYefQZvRL2V3m/SDGXdfkCrJfFbPJ6sM/qVl+KoroYiqV7UiB54ZKIOc26JnSY5s+riXVjm40P5ywhV2o5oDh5J4FdBc4qv2h1rfQoUfdI3YjlBlFmhnYJcufx7L6SQXXov/LusdvhDJ1KgwOb6O0wOARIOOUXRDUuV7XOMsdnosHewH9q3reyaZC3IV79ApYHvcSgKesF6JJjgFzPaMpdauAgLEQGWxbYlFZQAXUBgRuYex9Q7SKFJ7zQ7cBWiKMRfZXkvxvRcJWvXM3i7+0TnklHL09gVzd5Qc/T1g645GqHL6QC8QfRmKcENDjCmav2Z87OQ8XW5spb9LdQdHQQP9yyTg6ofUIEx+N93XWiqrL8gE+h/dAS2mhYrJ0VLNKcktDlkow8/0jYkq+7ZWWCtFMNIKPt1ZdDllcvDyhvDXE7XPRBbsIAVpjHikljtGM5VrU4ltp3WBZDZUWUREGJf9wissuyxIH4SazDlieMvkLkdNE6bDub/GR1i+eq85osK9u1+FrH/6ZWvmEaH07+b7p/8qO09ffumbWcX+zrT45NzELF4ti5d2opFtPJYrbJOUu3nA20F1KWoUd0bhARWYjdecqofyp7d3s02oeiiaxG/BOOEsqapTTjtVOd+kxaVfAPqrQ2GKtdyGqL+6Yz/FIArePvJg6GBMSHkgeC9l5lapP7qrS21w7HuA+/kKXLkTWVG1GTCjy7YGyPHEXyeediLaTRfEnrVbLA7leNk3OILhLWT53BU2piIPp23G46M9H3KGQYiI1nHYfwl2EkpY88UlAQTgVFSdwkL+83SAwTrgyqpKYAe97T1E2yAfVx+gxTDYFn/EKk6VWIBdiNisTtz9Z3p33ULrRdTWvSgCNmX7h1NwlXQLu451O365JbQDrnsQEgc19vAqX5ha7D5YMdNoMQoe8n0Kjnw49mXKB8ywv2W4iunoTFU1737yV7s0Q2KTptC0cZZzO/fFP0gIN1Yji5NW+kC0xDtkx5kmkpGuGnoHbZvzHSbNSJIwfBgiYhw X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: f425ea3d-be0c-44a8-73b9-08db0467ffb8 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 15:21:32.2415 (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: ybNu4s1h42DvoRFYS5TvxWH2pLfqZ02dU3WP9Hl/w6TAnwOIy37snlfDiOddtk3ry4i1SHr9O1rMunhro9DfKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7380 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?1756642844428926203?= X-GMAIL-MSGID: =?utf-8?q?1756642844428926203?= Converts txt binding to new YAML format. Signed-off-by: Manuel Traut Reviewed-by: Rob Herring --- .../devicetree/bindings/input/pwm-beeper.txt | 24 ------------ .../devicetree/bindings/input/pwm-beeper.yaml | 39 +++++++++++++++++++ 2 files changed, 39 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..1ebc3a46d934 --- /dev/null +++ b/Documentation/devicetree/bindings/input/pwm-beeper.yaml @@ -0,0 +1,39 @@ +# 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 + +maintainers: + - Dmitry Torokhov + +description: Registers a PWM device as beeper. + +properties: + compatible: + const: pwm-beeper + + pwms: + maxItems: 1 + + amp-supply: + description: > + regulator that acts as an amplifier for the beeper + + beeper-hz: + description: bell frequency in Hz + +required: + - compatible + - pwms + +additionalProperties: false + +examples: + - | + beeper { + compatible = "pwm-beeper"; + pwms = <&pwm0>; + }; From patchwork Wed Feb 1 15:21:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 51417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp341327wrn; Wed, 1 Feb 2023 07:27:05 -0800 (PST) X-Google-Smtp-Source: AK7set+w/AkTYfg4QisQXEk5G/G/L/y1Qg0rLFhhP9aNEbieemZWCUpBrdERxYzQL/nAdpyYXd85 X-Received: by 2002:a17:907:1c98:b0:88a:f42f:579c with SMTP id nb24-20020a1709071c9800b0088af42f579cmr3562953ejc.77.1675265225707; Wed, 01 Feb 2023 07:27:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675265225; cv=pass; d=google.com; s=arc-20160816; b=oTL1FNX1JT/g+1rTzaRN9Iz4rT+IiG/1i+VC1BnEmXjiQjwCIy6wa7KbrEOtkKeiEJ otAqO9gzqpSLnhHw2aT3pQxHI2pLpXN991at+UQOeYEY/Hpc//fnswysewKdU6KsRWjC 6s8LhBD0ItvfSdk7e/N3Er3AKxjHAEIiwunKmwdrfrs2KgPTkxmBJC9jzU4/t7mr2i8P 8sbx9Ea4MOBN1mU5HLC/iRmA5boBbAkzB99foWUxkZne4u1QEj8eBBHdJA0hE5p0c43e E85ZFSZop2pTigCti2qfqIwJAPg+Fqgg33LwmhFQThxMocNVmpirf+sWZJmmuxsGcmyk tHnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=crUJHiJokFpnPaMI1nKp4vlD+6cLp1Ih68n/v7APZVA=; b=Ib+k5nPFIl6/aYcriT2fzpNUR0aWe9nkTcWq9jR0CfJqYtRAU5WAFV+dgBpqDncLii XLcaowff9xxCeC6qngpiAZO01LQ1tW33U8bTUvQ317sX2tswiltG/h7HarBk1x/Zzs9p Ud9+sH+YVoiaaHL4cFvXBS4zWNfLKmctTlit326tSflXTNK0uc16+ILAc64CHhkWnhpB bbHo0VelWDsFIt0yT86ThEvbuQ2Abmq8GE4CG4Dj46jKWz2nwDtS6yHO//advW3VjmuZ j+YsMjucGf7trhOUbWsIvOwHTRCWzi49cuA1SovQomTOnON4a/qHoWSnJLUix97v+bBA wjOw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b="S/Yj2Khh"; 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 19-20020a170906005300b007c0c0cb9f25si25332722ejg.3.2023.02.01.07.26.41; Wed, 01 Feb 2023 07:27:05 -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="S/Yj2Khh"; 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 S232391AbjBAPWh (ORCPT + 99 others); Wed, 1 Feb 2023 10:22:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232338AbjBAPWV (ORCPT ); Wed, 1 Feb 2023 10:22:21 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2132.outbound.protection.outlook.com [40.107.247.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464617164A; Wed, 1 Feb 2023 07:22:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOCvVi5aI1kL/nu1j/9Y1kH+v8dlQVwd7TGnkpd97oZ/5V9OsnCyZQw0Fbh3QD4JuuZJCA66g8VJ+Z8RWZiPVS0oEuNwjnCg6vEzJF6pIKOW2Ph2z108vUU/0JpFcZ4Wr/8t3xuX6ZIYXgS5TufAu47U4Fr84VIsoRIiXKZJ6UmjCfPeAKXSGG5aMMVJPhWnpxjhqaql1W+MCghtzQi1A1swncmJotuTEkCTxELyO++IFHDO+t4GhypX4Max9va32q5J3LtbUJ2HIuQ4giS4rvD24/FykoeaaOmwiY1Zj9lgKd+A441ihWB4SbUwCxBVt3ya8iJLRRfuHQBeuNRSmg== 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=crUJHiJokFpnPaMI1nKp4vlD+6cLp1Ih68n/v7APZVA=; b=ChoPf5yj7kN0k5j98rRyl43zMloFWIERVgk2w9fdh+aIUfR/0omg4w4C7iQ7ZJgRd6r8VYvNWpHKzEK4eF0acnPvRFxcyMSDZOwp1ZTxrwDb94OoOBkFqiA7krz+1rxzJRJfteDuvJQyblLC9R9pr8W0qlCko1qvb9mxy73/bv1MzGdM0cEK6YU297eVDBcLoNlomR8Q6x0cir2XykYyTDYyfNy4fbsr6GZf0STBhrYBt87sbWSFW9K2vAkl+Zp33b+ZDrkowb9k/gL+V4cSOFlLBGdMC7e0NBHgJqr7ZBUycMrudnGOykzq2gkDQpTtYqB0Zp/NFt7FYUVQ4NyU/Q== 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=crUJHiJokFpnPaMI1nKp4vlD+6cLp1Ih68n/v7APZVA=; b=S/Yj2KhhK6U6JQM9AZvDEqzkGD7oT0klXZqhg1ZBhxni7Ys2t2CotFTCIZvl2r/EupUdptB+P6G+wIZcXVKMCyCwoUY3hX+tE8B970plIiir3rb/YXKlGmo10xiXoUBOghuQCI+xurkpeRfJFmbsf1DhscgH5tm71hZpMo8RTTACVsbirMJ02kVKU4FgXFG8Z+6rZFUoFCS2KmWttypK7nrh3Or90zPQ2MshlkgyaH67YLHLbGN7vgK+MCOCzhD5d5alH05TNdwwhy6+5zgB2PVsTLhze50uvfrbw97MG3sZrh3joLGROUGBKZIgJBba+ZnTWfSw32LFjjPhgg0MYg== 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 AM9PR03MB7380.eurprd03.prod.outlook.com (2603:10a6:20b:26b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.22; Wed, 1 Feb 2023 15:21: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%9]) with mapi id 15.20.6043.038; Wed, 1 Feb 2023 15:21:33 +0000 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Frieder Schrempf , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Manuel Traut , linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v10 2/4] input: pwm-beeper: add feature to set volume via sysfs Date: Wed, 1 Feb 2023 16:21:26 +0100 Message-Id: <20230201152128.614439-3-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201152128.614439-1-manuel.traut@mt.com> References: <20230201152128.614439-1-manuel.traut@mt.com> X-ClientProxiedBy: FR3P281CA0133.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::20) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|AM9PR03MB7380:EE_ X-MS-Office365-Filtering-Correlation-Id: c3eb1c62-dc54-40b1-f8ab-08db04680074 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xz/y03TaTf4ZbiOXJafkQNZMh6UjPDWiLudTLthr2+jSAHjyswtFFQTFjHvr93ZDfHOXnQEBjztIOE1w8l3WFVyPJdYpcoQMoDuj4Hso2y/zMw8YlXs5CjYir2zXGQWQxIZTOeoK/wkDTS/q55HKfrd6NSLrBQYUGLlV5RaIH2+daKJbo7mt/KMorHVqIFdM+Wd2FrYHGBxnahdXRAb2fUBCA/grWsUXXLzmmW+EQXag2CpRb3ri65zspdkr9SDZQoq/E2NnQa5AcDTMz4I+s6oROooKu0Se0vnfhLc3vS0C5PaErv5XLUz9lCAlzwxkbsGauPPQ7kKpmr4noDKaWUuqK9LZJ6CK1fC8NROwRK0hHL+G/B6kOgBctzC0B0RbCd4+Rheh00zsyD56e1WYObb+ik1Y1dFPvGXD/PAfQkbp4fdW58De4HKa7SnPq7mtKZ1sfw1+GYGmxI7l58IlKEw/RTwuFQsRXQ52HYPX1geFukY7J9AwJYPZs/S+nyYl6ojB7UO3igxS3btOGJHUH11bnAY+Zg98+3ZJfq8ESc+twfkjneGqXbEV4Hb5sgyC4xddb37AcSRpqsJK97I/D5zNub/NYtttzLmYVz6mOZ8HZBqQFXOjPWxUDFNLEz8qr2cVSOQfoxi9/JtBHbPJquiSR8hM33lWP3F7iNHiFQQ3dpS7eT4XJtORgOuwB75J3rbjJzYiL3l7j2v4/PLxww== 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:(13230025)(366004)(396003)(136003)(39860400002)(346002)(376002)(451199018)(38350700002)(38100700002)(54906003)(36756003)(86362001)(5660300002)(4326008)(6916009)(8676002)(8936002)(316002)(66476007)(66946007)(41300700001)(66556008)(44832011)(2616005)(83380400001)(2906002)(6486002)(52116002)(478600001)(186003)(26005)(6512007)(1076003)(6666004)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cNIJARCy5G0zUNH2hTz4Dp+Sb7QmP8lxEEu6Kfbr8BTjPDRKdg7+l+nuee8fadcY1YhtmRkb2Z9hl2rcS04xzdHr5iPb90XKPOYGf1p4gDTabu8PQYKNjVkZOg99d8t2h3vQYLrXUTXLE3nzhz02kEu6RU2Rh/S8UzGLqr0rnJ6efz8QhuUYd7QGjhkm87TjNltnZPUVa+HqJMuWNE755PLf62TJus4wXlVvZ0W5Yo2ruGNj0xf/EioKJEgHYp6hhQyM2AhCUrgEtpVYAW4na/jUZfOGKfQLrGvCOCVAiYpD+S4DuY4HSzDIs1C1IvImhRHJGkiAWeOvbv52mpmHE+kPbLQZiZ9YnroLJOsCM8boAHje0aUoMkW7ryFw1EcUNIx+psB/b+R/b7XiTSReyo62IvxB6IMz0zuMONDKGphQzfQXe5fM79pHJwacYGdaGvXtwsP7VgDnGnmw1o7JB4/x1sUwgTUEWqOw/CXAUjFhJobjEBle5ILSDLIAabmA2kuHMHV2gt7/iba5AM7fnDnmMmHey85zAfzRC7lR81Gee09TkiYz+LtGuxP/YmPJ2sDQj3QXvJurH1CQ5Rkon4b33kWkjVijW5P/ShwfUbKpmKjwm5ecqdwyob7bEf8mkzE8t5xZAWJ2bcfo4ecAyg/p70XPLs+LJUFGHxwBgS1rGQ5dwqTT+UTHxds1gSuW3y4pWJTtAAt7ALM5INNJnNXL0YOnmsYvG1s7e+QA4YPNdQIyxfG39bZTG7Wyz7Tr72d7wh7tXKInE0ZCwVxyYT38jQblQuZuIpj2NMyCiFx2E8PttkCT38vKdG5DTPuVcgBco/Ok9Mjo7T5kws7DcOhLQ7cAacsfN1fCRFgomTO74aDZ85igYcR9evKiiHxYnaj6b6twk/hhZMOV1kICTc/w+xLbKtt6c0PMW/K2wLYgon0Gd1PQyH10NsqcCo2O2jyecbcywpEVYjm1/nve3RpQXsNBk0cnkSSaQ8HQE4G5fWt+plh+4pdpRpSAwol7hB5POyQAMsnJO2N4+7JUeaRV6zF171YmY+nonkFUx0erlFFAtho0yFWkOrXZQ2/JWQjfdo1S3zC1YDlypFMccajc7w0wWquha4RFXaiDH1w8N7XpWfAPYFk7pxQqkH7yOiyh+vPz5R7YggSSWku3+PT/8RcrO6zci3eTv+a8fPt/seCtTFZqUT1K35doho0/pUlXnK7s/chR1Q1QR03GImCezo6jQCbdStDuW9c/AwyXWGW0QGuHZqoPMuPk9PLz2g7ZOO6lbERN3FnAynOmDHtDcMk4Vi7dWIwNcSQkGLC5brJzXLE/noFI0jTgOFf3X7j4x7pZT5Kq948ADedXeSq599GXRqkzZlyq3uO9cqVhecCVf+cLHzDrNXz4iY5qa+MDS4cMvV8P6iSsnnD7WtgRO0PIhBurgnGuxPVZ4CGRkqpisiiQk+UyinIhHVu5NqoG5/5LZwrxsnIWDJnoiiLlXZgqCJIDmG8uRUkx0d5CWdEqTpXDDPWMacQozEgjxkxoDvgg+8zIbWTLZtvvuAfQEkVoCVISuM3mckGGwpKsWBbOxbDs1sLvh8eIeCR+ X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3eb1c62-dc54-40b1-f8ab-08db04680074 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 15:21:33.5082 (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: GmLXvO5HeiEwnOd4MnTDkI+Recg/UMKEO+u2f8CYh/gbSTEZkz4EByRkb0bmB/AKFvywWGWlKxoEzL8COLvLDw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7380 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?1756642909149464727?= X-GMAIL-MSGID: =?utf-8?q?1756642909149464727?= From: Frieder Schrempf 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. Add a 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 | 96 ++++++++++++++++++- 2 files changed, 112 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..d2a22516f31d --- /dev/null +++ b/Documentation/ABI/testing/sysfs-devices-pwm-beeper @@ -0,0 +1,17 @@ +What: /sys/devices/.../pwm-beeper/volume +Date: January 2023 +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 2023 +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..214d3fa0a06d 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,7 @@ 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] = 80; + beeper->volume_levels[2] = 200; + beeper->volume_levels[3] = 400; + beeper->volume_levels[4] = 5000; + + 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,8 +267,15 @@ 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) { + sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group); dev_err(dev, "Failed to register input device: %d\n", error); return error; } @@ -203,6 +285,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); @@ -248,6 +341,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, From patchwork Wed Feb 1 15:21:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 51418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp342881wrn; Wed, 1 Feb 2023 07:30:18 -0800 (PST) X-Google-Smtp-Source: AK7set/RrTXzH5FexkC5kMTigTysfJJIuVzUflq3Cym2lQbxidr6H6BvItI9E46SONZjXGjXgjTT X-Received: by 2002:a17:906:a1c5:b0:88b:bf70:2e79 with SMTP id bx5-20020a170906a1c500b0088bbf702e79mr2745530ejb.30.1675265418112; Wed, 01 Feb 2023 07:30:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675265418; cv=pass; d=google.com; s=arc-20160816; b=HpcJqkAFYj9KhsX6bmBJeZcn4CLyP2a3rneGLQ4mRaBefJGuPsyU+2PNPGF4zWYPPS 4d+RnTS8SoKYJKbJXelRHUif0zP3s0s9cebixZZUxGsFFXy6LxKeCJ7SGt/iT0rYNFVq 8cOKJuPSjMqJHD3Nw+iA20x1+t9W86b8/ZFEK3QusBQZCbSixFqE/+Sv+HAdQrnlvtHr kevA6/bKiIy0rwEzZtO24/VU3mAoYswlfJeerbPUvKmJ9TJmzZQOedkQ5RLaFYp+qJ6Y glNoDJw4JZqmzFVgaOcKCOLXwJL5IBc4R57u1e5ALrGpreKMrmy6BL+903uPmp7q36YN IDxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qTdZ5C7RCOVyP/DTdWFPwfIV3CK1R6n0RqlQ8pzvLog=; b=vQ0L1l0PxlNuxnedJ9o4slQam1Dq19ky25WM2nQSBDKjglpORwJ7dYGFyES2D/WfsI xygdlgMvxQTkE5ttirxWtRnuv7c0kc6Y2vWs6Kpjg6V+78nfx2LRaGFB0hBc4shmBwE4 U2VI51ZHTiQmAg23aJ2L6wzaLMc8KfVj3ItEPJTykYk7Rd1W/FdaH8b722TPdZFCRGjP Dr0iyPzFH5e9D+LlI+CpHpQCmalsm5xlHBZsMeEsUeIsaSJezqaEgUco4PYAM/ynI6BY iD62gmTAP202EYcy2C5SQFrqM5Pj28uHT6V86RE7lfdJJbJVDsQk9xGrUYkTT68ZAiIB x0Wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=WOlQJLYM; 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 we6-20020a170907234600b00883ec4c63e2si13040669ejb.645.2023.02.01.07.29.53; Wed, 01 Feb 2023 07:30:18 -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=WOlQJLYM; 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 S231811AbjBAPXF (ORCPT + 99 others); Wed, 1 Feb 2023 10:23:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232550AbjBAPWr (ORCPT ); Wed, 1 Feb 2023 10:22:47 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2132.outbound.protection.outlook.com [40.107.247.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A185728DB; Wed, 1 Feb 2023 07:22:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FAMAVq8wkjY++rzWR2xaARPN9PiTXyZ3Bn49u6U4MToiovvnriIVF/UgUqOePurcXlcE5PFvdzp0+/fRwWUM4N/32YvYqfUOc0kbMUQiT0FSoEA5f4u1qrOpA2XSepXfPmpltQvHPpkSQRtAUK1+M7POvVfyggxzkyFbGvnx1S0eWRYZqXq9KW8nTFUDqs8EIIeAygmyFXGayv5hy9YPNQ3XZ0AQ8pGFIot6dzZh6E5j4IJiPwc4A2psAWQqeUSeexJ/1mJoycjiWvZgoIZwS5sYevmWdK8Aye7qsfRZ7ozJ/94poP4SN1Pvmo0rKHfVqZXqBP1TK03k2vVk0+LWcQ== 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=qTdZ5C7RCOVyP/DTdWFPwfIV3CK1R6n0RqlQ8pzvLog=; b=j+efktiixUuc1uhLZHEF8J6ZDUxSRDY/eYIOZmayHDXtFdgtJBpcInYc1DvnC3r3SobooHTniRUECe8DoPfHMmmCaGBX+nL7xRmtZWjmrt8aMacsxYskQWaYHrDxExs517WyeIfyn60GnKAC5cw86ok1hKhunYOLFYsoYU7HQIrSwmlpOLYhq/4qc8NdxByfYnZvGzQPeE5pOMegtU/ZpGOtBotRuwrnFHXJ+sFBkQm5vqNoaF93fGroPfcaxi/B0q9a9qwbW2k5oQ89/KQSSUWQgELKSHRFB4e3zQ5a+ctsFbvOHYSwa/JzHcX59rYfc9gdPQ+ZDKkGRvRaPeKdgA== 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=qTdZ5C7RCOVyP/DTdWFPwfIV3CK1R6n0RqlQ8pzvLog=; b=WOlQJLYMI+0FALBNoqEzhzFg1hI4JZcEei0k2Y8XwGRmrqB/xXajrIkXYk81wD4fZRhBOKgCdo0PbHtHTHxTTfOr9igKT1EuTgMudhmGtc3d77WKohDnREpJ37LGZcA7QfyksU7yHAW5L/3G/M+cEwCdf6pIf+CSWakp7kdMdz84g9JQbh9ZIf1B+bCs6ifAd09tbbqUbPE5if8aGN9ihn1jdpv5j1J3lHVIqdtl5lblnDrNLMvvzhiXIoE9VC00U24rVsTfevN0ZZzXd0VRA84e+aX8JfVJ1gPL4FjC2Qvs5vPAFLmqmQ/OsfK6FtOk4ShXBJWgUAxzZnETTGyRYQ== 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 AM9PR03MB7380.eurprd03.prod.outlook.com (2603:10a6:20b:26b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.22; Wed, 1 Feb 2023 15:21:34 +0000 Received: from AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225]) by AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225%9]) with mapi id 15.20.6043.038; Wed, 1 Feb 2023 15:21:34 +0000 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Manuel Traut , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Frieder Schrempf , linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v10 3/4] dt-bindings: input: pwm-beeper: add volume Date: Wed, 1 Feb 2023 16:21:27 +0100 Message-Id: <20230201152128.614439-4-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201152128.614439-1-manuel.traut@mt.com> References: <20230201152128.614439-1-manuel.traut@mt.com> X-ClientProxiedBy: FR3P281CA0121.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::8) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|AM9PR03MB7380:EE_ X-MS-Office365-Filtering-Correlation-Id: 1eb83871-209d-4888-c9d5-08db04680116 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WsidGTpYwNdFrb1goZh4nDR3tBGTNl8f0Gu2Q+mnib8yzrEFXktRz6Sdsoc+V4KRdwdII/xFYpioVqqyx3pGf8WvoRiIGQg9NMu/Y8C2pQB7bFCUGheLzCVzSZydCLEBLi+cP/qkT0W7yeNeBAr+NisanC/1X10eXYWOsr61P9ztDJ/ylL4q6gAkvPfIYbAgT0ztMx8k8Eb456kHPKNLXx/ujLZ9OmWRksPY9N7myVS7HuYkmcQVrsOefZPWkckgIo2K268+9wH7DsFHba0kuPsF1inQGkSM3MdagiiQGcytCN+9JAAQrojRHZOjVAQyftOcS+3srgWHzFrtkOCKR5nrnU2Aw9ZW+LyoUf40VwbA2kEwrzHBLUE0+MrOZbiBFUzRKI5+S4uEaMJ+mK9dBk9vNxV/lA7yr6YBtiEoJvJ45lCQS8v4dgw9/X7lpKDGqPpNdDEDLpgSUvhDXZXqedTl+8QjUbUoHL0VESf5cWSui7hKH0fgBhlR9b6o669zfBCQUx5RR8/BCaTkpOgIF0GpFAGctAV1hztOhVtRU94m4thXKYPzGXm/WIHVCSD9TUu0fHRa9lFZLG2VHx5U/PUfHD2HcS+GT6MqKNYZnONdJcAjs13M4iXnbjgMK3tYRYBu5/NHx/g6GuKx/JiF05TkOobs1oxxBinpGJUnLeDZFewaHFVvhVCIfWMKgS1uxBlkJ0b3LBQolNKmsrXdjQ== 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:(13230025)(366004)(396003)(136003)(39860400002)(346002)(376002)(451199018)(38350700002)(38100700002)(54906003)(36756003)(40140700001)(86362001)(5660300002)(4326008)(6916009)(8676002)(8936002)(316002)(66476007)(66946007)(41300700001)(66556008)(44832011)(2616005)(2906002)(6486002)(52116002)(478600001)(186003)(26005)(6512007)(1076003)(6666004)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: y5CJ74pRbRNoueSVIfZZCMcLdo13shVKKGc0Q+2zk8kPs6wUW7jRemoPtlWFkSn0sGnmYuSlSVsOtlTg2KarbwFPCcWNovMnzfg3s5bFUzrLUB7a5qT1e7qCQr4T5mHsN/Po2NiM+ntkaqkAYnQHpnb1aWvk+OrezMJp4TV2n+ZhAH2xCR5xs7ataLsj2EdZ/vofT7qkwJqS+eavPCaqTjtNlhTiuhyUngMmtYqK03BMCapGJTDU7/pF7nnDGrGxs4xq6GYHcFMAIAViy3sn+dX5HcM7UiW8KAor2wZFulYe8cROmDHZ0PAqZtSieYGdFogXF6dG22GXPwH8863SuRXFp71i0H+HFZfqRGCS/vHbf/3QC0UDjWMsw5mtiqBXEdQDcyhnFgxe7pGakjIhzp66u6jdc6v1b+fvXodvum7UKZ9YyjtVVB2tNFT+gdiF+zOjX0QsMiNu8Mt5kSKoSuWrm5IIRdRE7/qATixMIk2wrYbnk7RJxGMZlA51MHDIIFg+RuvzNpY9eN03pL6p9Yao2tajOt9i7WDDSpY/I+jpK+oSv/2a4Jxaf9caje4smUpSfslEXYHeFBG/PB2n2T9W6fM+EgNIglhY9ltzH0abHFKBy+rJ2FjtRkaJAO2EfBbc+MsEf+6My0BuiP3gpGtOEszATEoiJ1DjAk0Yv6ZynR2YDqS05LZ/Bg2jHhUyo5VLNuXK2ngYx/Im/GeMHLL6PV1K6Gj7QyANkevq++665lw9UD8pIdCgBNZSSsaVfgOKa16XkL5A5cAmB8BdQ1pJgxBkkLzeG3LSiL0PoMOLMLj1Jdh+ydRaTcXEcvWKfalkgK8eMO2V63/4u6qim08Cj5rFLhv0/8yIbdJkGcsK0gsnEkIR/ih48viufHoMkFZubpn/N6z9tckw0oQ9bzN8dAubc5EJDjGvs331ZqHyl4zflvKKLvaLRtxP9bOWPtrOJdAja84Hx8BPRe1aTgvWwO2USztj42DXOCGIWc0x623FJ9pSiQliA3rF08XDG3+h2ztrAs1Ldg7TmuWEcBIOvVGA7mUsGln0HpiLPxtFbgME0l/Auac39+HKDy7b71AVpifq3XAYmuAqHiAVYjt2bdlxzCb4Yvu6sVhNnWe+CE4OZuXiWMt0s8JbN8EPbcshAWzcVXm9D+5j9ojw7luQyYfBgBLbd0BLX0y4PR24lZZKFxM93wpohEJGw0LOFIkepZBx3VIfHIxsJ90yVzMIb3JjAac6v57L5S92P7wJRYUgS3lb7TPVp34ehnd/KRVbeRvqW7csVolKJkNVQfiDsN4+tDPTcZg62MBK1VDrNyPhWuZPT+NKD3yFlmQ7lRlezq/Y74z8AxRpiDQoF/jIxjUB00MClalEyYBZN6evRNG/bwF4zEtVofST2ha22k3y5bf/GvxxKlbWQ4jyL399yb5PzCe93pI93pqQ1x+P8/skPCIgXie55UXqp7I56BcaxEmGJMkTt2B/ebjmDc71MEzaQADBTarKvVhBgNWgUpYnyc/t0o0f/3SDkUJxLpODIL0F6j4mfwzJfROQRp/cC236KK61y4eAAsiAlRlX6HUX2k41KRKd1tfWXLmX X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1eb83871-209d-4888-c9d5-08db04680116 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 15:21:34.5375 (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: TMuKn+2Pa40GQeI8rNmtqEAsYMcFNfrSAaeh8FT0JRLaJ8B3zb69CzxemPtKbs9A7F1YS8WKmMUeqCblhwtJbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7380 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?1756643110838175788?= X-GMAIL-MSGID: =?utf-8?q?1756643110838175788?= Adds an array of supported volume levels and a default volume level. Signed-off-by: Manuel Traut --- .../devicetree/bindings/input/pwm-beeper.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.yaml b/Documentation/devicetree/bindings/input/pwm-beeper.yaml index 1ebc3a46d934..6599e28ba5e6 100644 --- a/Documentation/devicetree/bindings/input/pwm-beeper.yaml +++ b/Documentation/devicetree/bindings/input/pwm-beeper.yaml @@ -25,6 +25,21 @@ properties: beeper-hz: description: bell frequency in Hz + volume-levels-bp: + description: > + Array of PWM duty cycle values that correspond to + linear volume levels. These need to be in the range of + 0 to 5000, while 0 means 0% duty cycle (mute) and 5000 + 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 10 to 300 (0.1-3% + duty cycle). + + default-volume-level-bp: + description: > + The default volume level. + required: - compatible - pwms @@ -36,4 +51,6 @@ examples: beeper { compatible = "pwm-beeper"; pwms = <&pwm0>; + volume-levels-bp = <0 80 200 400 5000>; + default-volume-level-bp = <80>; }; From patchwork Wed Feb 1 15:21:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 51419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp343898wrn; Wed, 1 Feb 2023 07:31:48 -0800 (PST) X-Google-Smtp-Source: AK7set991Kn5iXOOLuceypvrPMf2hNjD5dF/u3BG5oPX8zrYXJUrdp/Q02fPYnjChToEpvZPcfUt X-Received: by 2002:a17:906:184a:b0:886:50d:be8d with SMTP id w10-20020a170906184a00b00886050dbe8dmr2981806eje.13.1675265508449; Wed, 01 Feb 2023 07:31:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675265508; cv=pass; d=google.com; s=arc-20160816; b=KNZl93BVamWKSluGSK/90b3xLdkycfoM7uytIRIaHoaHUpBEUr58kesbp9O3PdiMSJ PmmrxRWOuUbbIgsqjSq78LARhalFOVPYtdddTadUZImUP7tnsbNxphXOyd6uv7NTlURW sKVMn4r47QMOXJZrE+lnjKnPARNY3EzBOsqfm0wG78S/yjta9yDxkE5zdv0DeIYhri1j AoM6kUBgRhckTUlgqqJYJSodKltTsSf2lM30QsBwa+O4PLYULdQ1FKupvCRpQz/d4BLx TQxcVWNpcDF6bp1W4T6MGHbBKup3YA+uT9HSHdnOhZ+w/q+4kWyo70s2m5hfwozd3jCq Vscw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6RtcZgibdLmaBEk4+G+xsLnM253T6SNgGtNlHbB1GvU=; b=OkiNn37K0lAz51FcQC90x2wIQb8wTlVliEBiNqnJ3WmIOt3ci9/YFu7+ux2C/3lsyc 5/XP61VPOdm87ynx4Oh4WpqLMxpn4QlMgrMwPkPYtRT7Fqb1prb4DO53nUfb2992/eTt JmL6qBibimDR6xwfWfPVbi350RXJV9eMvgM7igotjA51YAdOOHHM/H47f56a3qVBOGhL 1Je9IXRjgn37Rg8rrOypuubrdbKlfqgI+mN6XeleMp+fIIzi7E7c8eU+/Ul44tnZaP1u X/h8vO2qjuMTS01BHrq85z57tx2YCpiElk47gjSmWAOPzzSdWfqbfxlMvtoGjEK2gaZ3 HNwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=EuUirJWA; 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 v19-20020a17090610d300b0086f3e470d23si24105200ejv.723.2023.02.01.07.31.25; Wed, 01 Feb 2023 07:31:48 -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=EuUirJWA; 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 S232165AbjBAPXs (ORCPT + 99 others); Wed, 1 Feb 2023 10:23:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbjBAPXV (ORCPT ); Wed, 1 Feb 2023 10:23:21 -0500 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2132.outbound.protection.outlook.com [40.107.247.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E6F66F91; Wed, 1 Feb 2023 07:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HTbbE+u8a+baN7mhRzOoiz4r2YV6PGi5pKdAIn7eT5DTND7mdeJccPyY5CdFJ698Vb4tEfrxGwde9wFPHU/xsYCG4DV6GCb75ErLoYlnouuy1Ab6Qv9lCxo6VFb640OWBLNSsbzy5vI+dzWROl6zjHdCe5jjjxJragpg3lD8ONVkd3GITQkLYlIXDI7IVtiWJUXP2Li+nX5eeF1LxA1HuVFRNlZqCPE4ASoetHGKVb7Fb6hXm8bUNPGOHVEU+Kh1g1H6Hjm0LV9AO8oDSfTQF6kS/Hx8yiNv/ncokPrnktw0owux+Eo/yjGKQO90IGrbSV2LeRyJlpY08uwOnZh/dA== 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=6RtcZgibdLmaBEk4+G+xsLnM253T6SNgGtNlHbB1GvU=; b=Uk6yo18TCFaKf6UNts6ICtiCeAJ82o7ytWLLKbjFyTRJ9TXoWbwVF94gxJcDzGybqOvfMqoPwBw9hWvTqnh5PMAhTPDK7uuYwi7HuyFe9fuVKZLxbXk/1xKMxp4Sz+YPFut/t4UXI4AXxKODyPybMnhBNaDfXvWqdxmLtVC5aRMSiiNW4iW9VDNq3hlSX97uEywAbY7RHr4Mnd+6QbXUPVjOmfgudIGiaOmo/7cruGUrFKmApr98RbJro6Dotdyz8Zi/hMpmulD57ZxxTzrl9iIy7lg5Ei7wnJU/5HGSMxMk6Llie1XutHGPtKAWdKem4vaiXjPtXgyXHQbevNk75Q== 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=6RtcZgibdLmaBEk4+G+xsLnM253T6SNgGtNlHbB1GvU=; b=EuUirJWAYhhoI7/L3gnL3bJckgFJuljfaJ4MrNQNgw/CYb64FwwS2ZrlkLroPe5siP94u6hRyRt+z2XF7488ly427AgP+HxW7PnP7I8+94jwIz9/f+RsMX9vGhlLEaoca2kLk1DODCExTMbkSoXmF3TT0UEfWQ+ix7bm52llr2waiZULe4YKGeC6uHstWiVS1uVdIYch0/YJy2zhmlVZ6DvQBzlOliSE2T5bg5xWitQarcGEyniY5DHyqrAVdk+c1EJj5NGOdc3dc15rp+Nmbcu2UqYQBqy9WQLRdsRGaDRSkkmXhoqPvtMk88MDiJpQZFLRTO5t0kVgypSt3PvHiQ== 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 AM9PR03MB7380.eurprd03.prod.outlook.com (2603:10a6:20b:26b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.22; Wed, 1 Feb 2023 15:21:40 +0000 Received: from AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225]) by AS8PR03MB7621.eurprd03.prod.outlook.com ([fe80::b42f:82f8:24cb:a225%9]) with mapi id 15.20.6043.038; Wed, 1 Feb 2023 15:21:40 +0000 From: Manuel Traut To: linux-kernel@vger.kernel.org Cc: Frieder Schrempf , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Manuel Traut , linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v10 4/4] input: pwm-beeper: set volume levels by devicetree Date: Wed, 1 Feb 2023 16:21:28 +0100 Message-Id: <20230201152128.614439-5-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201152128.614439-1-manuel.traut@mt.com> References: <20230201152128.614439-1-manuel.traut@mt.com> X-ClientProxiedBy: FR0P281CA0055.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::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_|AM9PR03MB7380:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dc5e311-2e35-441c-1980-08db04680496 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xsl0KsVt/O7vxH8S6BH1V9+mdOT2FI7oBNK7FbaaPMMTBC0HKFpKMAaax1LsAN8VT4DdZK5QGs6ESW0ETEE81UkQgenyyZuH2Cjzb5+nlExjNS3LgpaoPJa9SPZoNX0KnkRTjZ4TQIJT906yTGuiUFCFWNifuZA5CN+ahV+5gVxFUv7ubmZ7NdmCF2OO62ukemBuBOEFJCVvRKABl+tMa1DGtId/7Hve8pl3IpBPO4hJcpZ1KM2t555gwCOIdz/Z/C82TZS+jvcU83XPob2aQb7YoNIklxomgnCxjENT00I4CZNwtLyymYf0uLdKz9Ive5k4D26VNrxmAquScMbVghMMN6DLrqv3II4E1oqUpuR2wy1Ov8yaVX82YTNKYl+rQ04iPCVnRmCzVthG6wo31/PLIJ3fWdBGsfeG+7za0SJCGv1PnFbfNncfpVfoN8KjN49RwmQ8xZ3pIoLSqEMrKjr5rZWDhz6jHoMwGqeUReYqgK8kq8XEXEgqpNA3rMW3eLEmGHc+uMauYnKmFkZ3u3QYFz3e+n6aT2plFAHNam2/FYDDhJKtIS8L6YTOHe3KqrbtZDlhK706FijTL0P3g0UKLL46KajZ6nSkMe3SkKvnniur03LMBhdFfPvZHMPCvjOLnAkIl9+L4c9zUnHxFcbT3wp/wyFdLgFvyiPRR1CabTuLnOIXLy5k7yIXWn/Wwl9kQBV0RtLblvk4dQH9kA== 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:(13230025)(366004)(396003)(136003)(39860400002)(346002)(376002)(451199018)(38350700002)(38100700002)(54906003)(36756003)(86362001)(5660300002)(4326008)(6916009)(8676002)(8936002)(316002)(66476007)(66946007)(41300700001)(66556008)(44832011)(2616005)(83380400001)(2906002)(6486002)(52116002)(478600001)(186003)(26005)(6512007)(1076003)(6666004)(6506007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r2KZPZPFNtBcJqTxdmirO68wgps/QyCHOSSSLfeiE5em5v87y+oyRHaPYrNhiHVvZ1A8Lh0D1wqM90NFoRV3R2DvznpTzDvrIa2+3yxAynAB5/WzB//UZ28RAawVghfQ39HCP5Oq6uhGZpTVOvc9/vYo6MxrHlectZ0q2spBnGYeQ/yuh7EbTquX7DFmj3fRrQjrh0KOa6VfDxoxWnABkC1Z3IPKy5gIZy7qR/pbWVScE6nfndOgrygv8EHi0NrOjShBQrtjCUgYnhVWne+LMIHpZM0ItCw4xZ2hjcqFmnukBxpJd15PmcJ8+IoldkQpt8sCF3wHwegwixczQv9sYGuYct/chXCmuWsDUsYwil9fbfb3BoXymyUVC1870nqGIvFJhmMBT/IK7nZqU11JZjthMbzI8UgE0FECwj908DkvHB6EtGNubXZNjkGv9mjpJ/PU5J4Hv6FTIdaEmGoEu4Hgy00j/WaP14gwmBlGkUxthtL3nnZHp5AhZ6fnAeABAyirKDLHGU8+NgxbRpES7J+GMO+wzupjnAE6lizVUn6zslVT2tZwLH+WVMrOMZXhDxzNb61pLLIaGsP2kwF85B/+vsGsM3WKAQvlWkUueUId0zfZHgUv1plOB7sns5yAWABiIuaO8n+xJBtH5GpK48HW49MaeFbCBSGH44xJAvBWl3nS2kD5iotVaia00NQzhp8MsPoQ8QX5GUcQIERGZ8c18FOgJ8Leej0hoZ6gyqTlFSZaMUIiHTmTz4o4pklnTCL8PXJUojRZh/AxTURhrN6Z5NA/8ujhZyR6X9yTN3ZEl+xFgSuWJqLFPb4FQDJsEV6yobPkzw5gH9GIlPQ4PveXuGyBZv+3iiLjRoIhVio1r0qLdTY8jyQE4X/6G7eeqB9cEP6ln2siYPZUyAbgivFM/MTr757cH2uZp0H/NpUBFsxOvJwgzRTumKq9e/mbV7Nl/v7MSe+PWRoGxm+flj+DaWEvcsjm46a3KTtTtSE0AgeUnSMVZbdr3JQgJ2shhGpP/cm6n9JwoYeE+5+zBdUqnr029D8G/Tb0IGr5iCTw47YcwfeJr8BblvGV2xFKCkqtJnrsFAuyRQpqd7RJsomO6k4FadgO7u3E3/QKKU/36x6hrwBOxX0MGvN19e0vaCPb/O4khXz3TuIq1oW/DISPXqTwcQHWFZDB33NtcTWvp6qfdihu4oXKChOIWgTbU5SNpTxKdqN7+Sns4k5IwOsdLVhGRauGkdARFptM8vw6B/N3cH55uJOqUhRA96Rk/uq4PJfuke8DLqNzcmBYDZrpELZ1+OgepveZ55Wg+VEFMSOIF93beMk+ikRkkBDLlHNbvLzDAhcBGkwIWNQ+xKySEsFJ1CwCPiEJugPCo4CiUdtqaJQ9rnrNMzwUVDbdDVzVycUvPo+Fhk3VOYRCTfl0d/0Qt1O63TTjCE2Jsqbx19sLcAk4hYA1HVnVfpkcsS0zrcmIhMR3B9EGm3BFVMkc+rNNyspceueyXLHmuFSTo95i4Zq4dh9oKP0sfaO+X6SfTdGNHWGG1LrN/ITpqsv8JpTAKyMMOiDcigsf7AqSZ2BZfixYV59Sgf/IQzzU X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dc5e311-2e35-441c-1980-08db04680496 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 15:21:40.3974 (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: qs+b0Dc/OLi/sEb5eUQh9Gu3msg5s/iSc8SyDCa+AKQeTEQZhtlkHsDZ5ZT3Qzz8ICeAKfYlwsZJE3QqWcl8rw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7380 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?1756643206163856002?= X-GMAIL-MSGID: =?utf-8?q?1756643206163856002?= From: Frieder Schrempf Add devicetree bindings to define supported 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 | 73 +++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index 214d3fa0a06d..fc367a249490 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c @@ -93,7 +93,7 @@ static int pwm_beeper_on(struct pwm_beeper *beeper, unsigned long period) state.enabled = true; state.period = period; - pwm_set_relative_duty_cycle(&state, beeper->volume_levels[beeper->volume], 1000); + pwm_set_relative_duty_cycle(&state, beeper->volume_levels[beeper->volume], 10000); error = pwm_apply_state(beeper->pwm, &state); if (error) @@ -181,8 +181,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, i, length; size_t size; + u32 value; beeper = devm_kzalloc(dev, sizeof(*beeper), GFP_KERNEL); if (!beeper) @@ -228,23 +229,59 @@ 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] = 80; - beeper->volume_levels[2] = 200; - beeper->volume_levels[3] = 400; - beeper->volume_levels[4] = 5000; + /* determine the number of volume levels */ + length = device_property_read_u32_array(&pdev->dev, "volume-levels-bp", 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-bp", + beeper->volume_levels, + beeper->max_volume); + + if (error < 0) + return error; + + error = device_property_read_u32(&pdev->dev, "default-volume-level-bp", + &value); + + if (error < 0) { + dev_dbg(&pdev->dev, "no default volume specified, using max volume\n"); + value = beeper->max_volume - 1; + } else { + for (i = 0; i < length; i++) { + if (beeper->volume_levels[i] == value) { + value = i; + break; + } + } + if (value != i) { + dev_dbg(&pdev->dev, + "default-volume-level-bp %d invalid, using %d\n", + value, beeper->max_volume - 1); + value = beeper->max_volume - 1; + } + } + } else { + beeper->volume_levels[0] = 5000; + value = 0; + } - beeper->volume = beeper->max_volume; + beeper->volume = value; + beeper->max_volume--; + } beeper->input = devm_input_allocate_device(dev); if (!beeper->input) {