From patchwork Mon Jan 30 13:56: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: 50290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2190700wrn; Mon, 30 Jan 2023 05:57:53 -0800 (PST) X-Google-Smtp-Source: AK7set+mRijM6VsfLv6d8zJwU0lIBx5tS9OH2FSUE3ZUx5fXjZNwyXkoxo7/RFpPU+OPSEMEknNp X-Received: by 2002:a17:902:d484:b0:196:8bd6:2398 with SMTP id c4-20020a170902d48400b001968bd62398mr3029500plg.18.1675087073029; Mon, 30 Jan 2023 05:57:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675087073; cv=pass; d=google.com; s=arc-20160816; b=EC3LSDvBzN+6IctD9wn7DeXvnx44Ll5zh4xdkQQYuKPNClWLtWRrh88bzZCBypOZSb Fs02iCUqlgdE0T/dfWSfxOMmULX0cMbo5DWncoXcIcnTcj8Xzf7Vru4uQT9IlV/OVxNT V0Pn5D8iTrJxlq1WkDYsRn3WqL7l24Z5q+oAaRwMt7xT/xDiAhBpb6Bl2hsOPpjfg2Zl 0YAMcb5nqN6Dj/KBgkpNl+G/oxFZunFZVgAj5SwA++1V5mPvEYx32hvZvlVB6nCm0E3W NOtzLu1pqrtniYmbF/jMKIz2RPu5IRwm1vo2zjEhDUqcARPmkvrcU1eCwYMnK/AQGzWG XTwA== 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=JnMXXZbaRT5Boslq9/yO97/ciaZaatrX+ihEoh4DI1k=; b=Umm+g291OWZ6fIXKSdUtuYZhfWl472vtGKfbC9FE39H6b66+jqYQCTetR0LgQYCDmD kEZk7n+STuVZMbjBh+CeDYZAjLzJqbGuSmabIh5wHGZKjLfOaLloTp1GejVu4ChCQOO5 lOuaTAKC5JrJkeQKuc0xK5439a0o9mD0apuWNlP9ihXboAvU8QimD44aTVq3nxzivK5f u7C4qLicGvereRx4wnlBrcGgDnRIFFai8HhFzYQmnB0bhUCB/iH7XIw/1LQG78471twH AHDvUt99me2TkM9NFRYlgltpe1Qvz/Jj1Gc6kDGbGYpIZi1vQtrhi1zpsPei0xyUephW hs5w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=O3Xdaw+i; 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 t24-20020a170902b21800b00188ef2314b2si12348073plr.79.2023.01.30.05.57.40; Mon, 30 Jan 2023 05:57:53 -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=O3Xdaw+i; 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 S236723AbjA3N5Q (ORCPT + 99 others); Mon, 30 Jan 2023 08:57:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236647AbjA3N5G (ORCPT ); Mon, 30 Jan 2023 08:57:06 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2098.outbound.protection.outlook.com [40.107.6.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E45739CC8; Mon, 30 Jan 2023 05:57:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O6whfNWDWFrBv0v/HPGr3qxFFCcM9LzJuFe6LxGLSwx8yozb3BDe45zEMjsnrmnnOwQkuBXpp/biNpEHoCpJscG+cKpE7fM2cYJzn6dRIfdSazxSO/dv8g/MKJHi5fYgntWc9G+1tdy2faICbw6cMs2wn3LW45GrkINKez2kscvhcWQPV3PY+gsSOPCpIIFh5OlXEhOrvuejfOJ8NC1KhAFdEtPwbJ1/dKfCQ08XyokoEh+Hx8V2s3ecyRYfRY2k1rBiWinqMpZLxxmMkiGDheQEtYVjyWrZKyLSpD6d4LmvHg1ZYolIJTaSNZPKrDuAQliO0TYO+4Jp7AuR8Hqc8A== 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=JnMXXZbaRT5Boslq9/yO97/ciaZaatrX+ihEoh4DI1k=; b=MIJEiafJJBInEp6cnPp9GlnaCRJk4IuEEfotlTj9zsD2SFduj3D9LjzjpFyMJhsn1GeMOySFsiCfX63XEGUi9NXdt2pwh4Ld/WcgHk4kRzbbZ0nadjU9P3ZzobCu++5OFeObzakO/1en4zy3sTsZoPYP+idSnD/doLEa6Ox129WRLQ9r2hKbNgcfyB9D9QFolYtSpkJQnT0sq7HBoagl6muISLJq4cuQ//aTlxB1TFp0/eM23wj72o0h5D7JD0+V3MPgtJR4c6hzqLb+KUUh84nSxG13TrWs57NHMFQAZHLIUyYkyl5xcLOwxFoBCfHwIXEDyU5ZivrmYK1BDllXbw== 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=JnMXXZbaRT5Boslq9/yO97/ciaZaatrX+ihEoh4DI1k=; b=O3Xdaw+iJpUYxyPClvDay2Wlq0QsJYSeyp8Pg5hxV2nCW7IK24oSJZcpMsMwfm0XZJNccYpu2abwoA/GXGr0Y1JEL7OYYBf7ECWB/uSNo6IyKlVTcojxmLX5ABxMYPT1ccvi7etdcXHXFFslvJb7vkyRtAHqK7tjCZ+bfbRCu8wlBH0IRIS75pZTmt1U/rEAHFL2IiPq24l5fc2+FEOv5yEp88i2Q89gECw1eIzAfJcYX2N0EDoSwVi14cbpCga9akyVeSM/bMkq4KPokk1FQdRggYA/efKrASmPMHDWh28MUs+YToeQDqNxAzYQAzoD99Bv/qeiZH+GFhODt+zWbA== 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 PAWPR03MB9081.eurprd03.prod.outlook.com (2603:10a6:102:33d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Mon, 30 Jan 2023 13:57:02 +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.036; Mon, 30 Jan 2023 13:57:02 +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 v9 1/4] dt-bindings: input: pwm-beeper: Convert txt bindings to yaml Date: Mon, 30 Jan 2023 14:56:47 +0100 Message-Id: <20230130135650.1407156-2-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130135650.1407156-1-manuel.traut@mt.com> References: <20230130135650.1407156-1-manuel.traut@mt.com> X-ClientProxiedBy: FR2P281CA0155.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:98::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_|PAWPR03MB9081:EE_ X-MS-Office365-Filtering-Correlation-Id: 75d17eec-8258-4155-4efb-08db02c9dcf8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dmoKjL1NLOfXZQ0/eNeGHB5/F70UlAhWRwmjs7npzIX7C0R4N9LSgZYIU5AyVDNx0Oiw5cgYhgwb7qRCb1y4fn0hHrGQ+JMB0n+dcRRidJeDEf9aJEgKxVb1dzkJYC/xWNSkxkwejykd3tXcQCwGZWwpDWUxBWoYtmteuR0/MDYbmc/KvaJhVI0wzKcElrDj4QKYPVozuNAuMKcFuYNoiHQDODldKIV9CJI3E4nqiJPaXZ8QWabw4VS/zl0Sqh9YuqKBWJa2ECxxe2eRhqV3VUs9ovx5WNih7PdjITk2zroOCrjglmzssjD8lV64eCeIY28NT4inrrpeyQZIg6wqRT/FetrLlZcLg6MKNPhSI8UM/OQ7HfWpIPd9a7OSWNMCeJIrYNeYjUOcYPYf6j0tDKlfDj5FQBwCNXjb45XmOXTABteUp5MuRheH82Z4YtPRRe9Kb/5pNavIP7mAXzPv6wULNcIBbzvtvJROy80oADjuNn2f1YSMKgsihNH/fVviZIBuU4rZPwRRuC53A+GF0Lho/VwZkyrrgDMrcIu+4mtn6uFSsKrrCbUz8p+MSb2lpjQla5i6PiLO2bvnmU0et2jljRHjMynvaTWdMcvYfBRwb/HAPc5PWZwBlajllbRfOFAp+EJLR49GZyJ6FBE0Gac143rRIcSKA+CHf7SWlCubdno/nRvKq1b17LyHHqCxE1s+kOel/tbARNMsHSiwAfmLGrIjGGpZLzqG4qCTbDo= 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)(346002)(136003)(396003)(366004)(376002)(39860400002)(451199018)(5660300002)(36756003)(86362001)(44832011)(38100700002)(38350700002)(2906002)(2616005)(966005)(52116002)(6486002)(6512007)(186003)(478600001)(1076003)(26005)(6506007)(83380400001)(54906003)(4326008)(66556008)(66476007)(8676002)(66946007)(6666004)(6916009)(316002)(41300700001)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ERxnyjH76DIUyNgxc3KVXNzotiz+GwnrlsI4CC9kKHqnAB8wIWiyHwo6HNCyPcYv7fjbPKcgQYQ3TP3BdrsxcnQZAB/T5GEM28jUyItImLeX2pUFj+Num6H7/rwQxguLHim4xOff9uPigMlaod5nHEJstJNZChrJDnGetAVDsNmOjFGAz6sJgy5OJkPQpkREHLVoyH+3ZIeZXjaGYDhY0hkt9QqmrbtzgRJjbX9herzmNKa1Zz76Bl0BgeC+MY6mNbMO0DAG1zkY3b+CL0CYhbSv7eVQoY7TMTNkls1BjdGvVMcTrsdicmXB++/vvz2+q9VDrwqqDWwRVHhwQZ/ppBjQiUpGfx2wZE0rcEXdcmsCab3iJ37K0/tSrGNB9XWkyO0ZeWnDa9qd3LXGJO4WnofrKruvjQ90+DK3Wk/2dceZR300nJSv88VvaMS3p9GQXaHwWn1Qla/P+P8AG7AOoXd6LzSGlqXEbDO9pABAYzV3nc/VOWKv6ugQTN/n1jZRFoA4bS1bWdquv/S+qIjWl/QaoIfXE1Ri4qkJkrkKuv4qpqa7j5d/hPe6OsZm+ABLsQHQRWindeiHNOUuFKLOWA7vhd81p6t0wLZOhHLYy+nrHoYZMzUI025TjwLkCWutVB6fNFYAnfpFnB2+xkEfx2iJExWGaWfTPOKJXO8RDIiuJ66SPOXWH2ZXjLos7udtXlg4aYpwttaEsevGl++cdIghOvIR49+KfBvSnNkKRfx84bh0hvzcgp3tuifjyArFJ8GIttqTyeUwHLv25VY3RKI9IAMMcVIDaq9LruIS0TRGUKPC7YsqR/YU5pO4Cs7zBZayF6/BIwZ95AOTxzFL1bg7BHgX5R/mP41nhinUh8lHDhMLhzfrn64QtcidOy7Qv36BxsBvnlFARzHuQsQdg4m2Urc5o7qjx1Iro5xYh4yRPMA5VAhOdGMGfS+fHGoESV96UpGIAfYVpMwXmoCCveMFOzwTsV2pb9pE4GW8ZShXH25654Px578t4yfY/MRydpf8OcMEMbFaojtI+rAJGEvztp1RusYgALM/CqgN+PL/ii/yFz4d+vtYM8ZTzLNU03mJfIHGYJj2M9pk2ayqofz9qbEfJEygZO8nTa6coS6lDqb//ivLvO2TI2ya+AdmevE1QiS+Dwr23rvV9EXWZetI71fb4gU86l9XWTY2z1h5GEbV1Ci3gtoSFdF9r++5dSU2v2pek8uEdCNKu/aaONEd104Cnj/ihmzF4C5nY73lI4W1DHVJMYYc1NWOIrn9mtlr8dpHW3uA9soSJBv50oFcr0+EhYbQD7pSaHsxxpJ7rPPWWoL+WcySJK+sbuT/SNWOcuoi5dNt1X1ZIz4aAA6i7oxdhr4FugAJCiuRhRcFArIddXe7yD6pWxkWGhAPytd4yvB7Y+wQbEN178l96Pv/yLWu/TDBpGj3R5rq1xLMZm+xLIH/0dCAoTFFpwVK4YietmqVrkNBi7i0jvvmYZCuI3N4NHfZ5Ng4JXiNCbeuSyOOBDppTEFLiy/U1+PaboZGT5Ja9MqdP69Ka8/6oaAtaBrrSmJEUmCdGFlQ0Yldg7DoUpHgKnW1VMfKTxQ9 X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75d17eec-8258-4155-4efb-08db02c9dcf8 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 13:57:02.3093 (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: CZIEItxdz3s5R0WZielCuZim+dpnoUJV0ZuGbc3L0/NZEHR/8Y5SYWjhvqfC+009iKTV/brAkXYlN0mD+XmZFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9081 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?1756456102724039185?= X-GMAIL-MSGID: =?utf-8?q?1756456102724039185?= 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 Mon Jan 30 13:56:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 50291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2190703wrn; Mon, 30 Jan 2023 05:57:53 -0800 (PST) X-Google-Smtp-Source: AK7set9QhGTxqqe3d0K2JfhjgV/sY5OtZYXKY7Lx45Oew4CZZaA6NWy9ut7al06ZMDaQR7sPDw6U X-Received: by 2002:a17:902:f201:b0:197:920e:a36 with SMTP id m1-20020a170902f20100b00197920e0a36mr436180plc.9.1675087073412; Mon, 30 Jan 2023 05:57:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675087073; cv=pass; d=google.com; s=arc-20160816; b=Es18zgLrjJgG6Fwj3eTqhfFX9EXkd9VorC/sMBbH9xkqSuRGLK+E/Qycj8+Y1MPgDA pJ3nUBdjioBr+8D5FfQxICKpk6PovxDIKoPf19rxWEdgt0CYwQCwq/bigMZVwqaIBj1D tkZxjId2/+0nhwcQCw7LVF9Q+zCO17JMP2DxmFOEPOs/h2QhgT00crUTuHQUXjQInLYe Y5L9zBrbP84Yl4ZcQNljfLu44aHFGnIwoANMfvMdi9+dTMotOcnYRZQyjow5C7eBcD7l NVkkNMptBeHDBcGnl0nS609yMGpy1IcSq/WdH8QLxIiGAx8h6bvRPFlzgxiZOnRq4r/H hBmg== 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=A0MP0lesqO9QJLuNZuqJ+lowPa1MRxTtgGDfKxG+tTg=; b=nvBTknr3nAkV3YpUxi0/zT0tMDsmp6/aA1zyIRjAhd7fcXSJjf0CdASnVp6J6Cp1Oi OvGknZOIqjIs3c61BRa1gP0LLM381dl9N4xVgWUq38U01A0/L87Xz7qUMQL6MSnqAVbx Z8BZrHvBfcTJQd086sAWmbX6dyfdM7hlxrb8WlY+QSbC2PF2L8AeDen6CynakijR77GQ YnH3UdoI3tAWJbZbeQoZ5tm8SJ9Wv6W1gVjnWnD3f50gFcKhoKgftZo5e2dJlsl5oTu+ ZWFKLjzX8zMPyHoYyJIvWE1+WTh4ACOokX7Rg8aQb/M5eQwCX1HkSQu8LIbpDLd+sCf8 r68A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=QeCfnO5D; 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 c18-20020a170902d49200b00195ee8841efsi15613554plg.368.2023.01.30.05.57.41; Mon, 30 Jan 2023 05:57:53 -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=QeCfnO5D; 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 S236741AbjA3N5T (ORCPT + 99 others); Mon, 30 Jan 2023 08:57:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236725AbjA3N5H (ORCPT ); Mon, 30 Jan 2023 08:57:07 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2098.outbound.protection.outlook.com [40.107.6.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507DF39CC7; Mon, 30 Jan 2023 05:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m24Q1O0NX7EnSIGpXQz/BNVm5QR+z/lrQxVsadUAwKPETIUfMNwzCp0LpFa/7YLe5aBKygKibp+rc+99mrUN+n2K9ku1HTUnawJ4lwiV3nI3533vN2EGHTOGYa0QNoBgcVFVPnYsXgdsIgs3GY/EhVVVmQa2atBjo0eOsYVo6p+adoOhBXGZ2YgxTJzQ3rg1/T6jTUBsKuMVXHWmTLknUXtbdtYkBUSSyPYPltQrVBycaa7ZxNNeiuDjwdof8Tjlu3DM/1X+YbI2tyvZ3uKcnpI1XvKXkR/HIb5iG8ujULWdyf/jYt8axu8bDN7N9IG0cQ/VYnzPhw6O7+a28RhfEQ== 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=A0MP0lesqO9QJLuNZuqJ+lowPa1MRxTtgGDfKxG+tTg=; b=nqmE+oDrrp6DkDiri+vq5GwoiGqBJHbBOeMk5r6VTYtFJlGRvKiFbXsjtT8k2U75Ia2wA51MVoKvN/ChS/PF5SciTo1Yky93p86tKIu6PA4n68ZpFIe37ydG9vZ9El8VI3k/Yvuy4CFEt+C4xDhKYiZOQzwiuqZ9lJXwpOGh9+KCB982+Cu02EskmN9D1FKX5MYl0qwT/ipcdgHc2/+/xh3b+KdFgjWb9kCYcjJY6IDPyV1GKJzIGjiYdIq0jSmY82Wgf+Ouxjtjsb13Y9Q1Oc6+K95gVHLilZ5vzmlscoDJQRxkmGNMmV0ZKVs56Dm9NS7FxJyfmO6Iwg6HQmT59g== 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=A0MP0lesqO9QJLuNZuqJ+lowPa1MRxTtgGDfKxG+tTg=; b=QeCfnO5DeHmp0/nd9tmxtSMOvLsZV04B7Bjq6xmoxyhhRkgyCla4XZDipXJeoKsvxanHJbs90BsgvA9xXuPqYEeAeFhsg2ZpSJxWWwMAIsk8WGi83dmlLIOMJ2+OUy5o3kDcnB+ClxOFQgE6SsA6PuHlIUKn3MhUS288c5VTxiEahyoSSstERbLyAOwYJKtF7USKlJNmkKJZdcnKg+FLR3kdk+rbh8xIKQLEr7DijodfiR3MawIaL+ElzdHyU/xOWaeqsHFBLaQGByIimshHydDTB7pQcxMf111WnO0tvjqENiraG7NRta3IeyvtRQWIbJzEGnf38Z2BTAr/lixamA== 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 PAWPR03MB9081.eurprd03.prod.outlook.com (2603:10a6:102:33d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Mon, 30 Jan 2023 13:57:03 +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.036; Mon, 30 Jan 2023 13:57:03 +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 v9 2/4] input: pwm-beeper: add feature to set volume via sysfs Date: Mon, 30 Jan 2023 14:56:48 +0100 Message-Id: <20230130135650.1407156-3-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130135650.1407156-1-manuel.traut@mt.com> References: <20230130135650.1407156-1-manuel.traut@mt.com> X-ClientProxiedBy: FR2P281CA0158.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:99::11) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|PAWPR03MB9081:EE_ X-MS-Office365-Filtering-Correlation-Id: 8aef2ab4-723f-4c09-1fb6-08db02c9ddc3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cJpQOWVSOnrUOGYzqVrBxsJfDjeeTPdW+MmPVu0/deaNp1FA1du205iRJYldTIVr6w+9t8yF4PKRLVDwEykH5TksxrWHsa1T4Ic3R5sdEI28mVS9/3cvxV4OsjFsTrsQrl5gfzHaCQT1b2Hhf3ZpZ2gIWbRpfZmujpzWtYFv8faVzXNP+odDocvNiPhCi9VqoPvol9x5ZY6xCzj6N5NX7bUTYktEbFNm3MJqu0x/z3ML7KUjQucdZ1G5insinS38dcnvyg3VGfZUQtC+CIOkepcU36YGryV4YbL7mDspPN0v/MIqCqf/OEMLEsjSSDD8W5xSVLTRz24of23RMweXkQrGhNCL3rlUhoXRXal1IyxmNnbxS3954LqFWdYLNRbDN0xz321WZ55PTwMu/NMzseAYPBG/k/zFO8+f7YJa4DuRnUHpL765JGkF/3o3KVGwdqsv+PQNssjxPYDEzqqcXsNQxpnoJKVQVcUzS3EqqqflxlUOHmxOo57K6IHsLyDQaqLsodrbPGOHSGGuLoELizQ6FUH5kc2aOx9WcoBJam5zMZ6qSo9tApmfeDYjBTPBYvzC2QoC9/SxM9LOf+vfoGqfUU97ijKIwNuf5vv2CJG+dh+0Uw5ZF54q28lUcaBDxmtwF72Dn2UArlnXPp5RjSh07sCpVKFb6SLfPtjWjPsrt49q2vWdjjVYjko42EBR5d3R91s2kZcZdqHK/U5dGQ== 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)(346002)(136003)(396003)(366004)(376002)(39860400002)(451199018)(5660300002)(36756003)(86362001)(44832011)(38100700002)(38350700002)(2906002)(2616005)(52116002)(6486002)(6512007)(186003)(478600001)(1076003)(26005)(6506007)(83380400001)(54906003)(4326008)(66556008)(66476007)(8676002)(66946007)(6666004)(6916009)(316002)(41300700001)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QHlaaruGEepZHTVI/QIIxzvC9gUbPBT4EC8SDtZsv9HP7RRH8aepD7U9+KQpfTGUQNWVPUx9fDxFKtzJCoHYRNSOvk7WIoTMjJjOiMbn3lZUvWfd3Fjn2GvILNmX6vxadQ6WW6WGLKjNoqzTPLTceV1kexZrvPEjlMHP00WZ/9j7mf0cLIZST3YpC4+++QaEyhAdvMpNImyu8jOZJxHanXY/ngUWZ0e63iyHaRyTaxVVvaYPU497klK0EWqgBOMF+PHhmP5iVHcWYWHpW4+i0/VBNoKxpSxuv+CKzbz0AItSwelSR0CRNyRwc4Ac0Tl+mQqrG8KfyObSn+JFK3vUcfOoUKnc8c5Wkvv1KuCkUQv9HgvTreAe07Nbp2Q2ViMOZAwH60XKiXHnt5tRAFJxRwxmGq2pMvZw5N+nMiQv2X+oNosoi0JyJ6bEvNMPd148K0Y0XDqn98eHVUp2cq2JocJEum0pzDqEkPE798YA9sM/BGkiWIbV+lj9+oUbEOO8JaoYsDcaDIRxdMuFAPQ63aWuZrjFQXyZ03hnGtJ3WZnpwJgYJNl0bnIYzaWyNAO07Cxsrsx5JbH+wLEbJdcljlsn6K5K8xY2XeNRxF7uM9/ORvUGlZPMTizEQ0iaTWyKnA6x3Ya30yJttpO0gGH+0nW7Q44Dz4aKouchmfxIqjSKX6WdcxGcQr4wVUzMYR9KkTD2dtmdSYQK64FhaM1gChShR8XawCKIOVFE119MKcUTiOgxOIosP6OeUx7yy5uyJE1ritudo/Z470RXFcu0Oza04L/D2wM3fbhIil2xVTO9FFslJu2toCVw7vdePV2dtEye2z9Y9CATnS5chtuKxLNWoj96Df9wEscO9awoDbvRqjeQ8l+hzhzKIkcLmwr3w9t0XW9ByOeOn4kWVW3TCHCr6T7J3Z6ANysrrZkF4vNkzlm/U8GNZ5XU7VWb2eFCsflscM1TbAopXR+H3QdwJMtmbvqHnZLpdvmE3CF7lE3Pe2uMJVyOcsv+m+UqoWgAG/PGN6ABi94kKpSNATn+tapWDHSBuF3KILH3KXAL+hKa9R1wQ9QijWHtdDi0izC/xadpXqBCyPxG2Uo5OhCtwaU4goDGxbHwV00rKy+s7y4rWOQhnIDc3bl2DxXFJ1icnDH72fTy7iyBko6VedtuKPL3JPAHZxc6wXXgDjszc/vNzh6xqpszn9BG2Xpmo1HIQZ5gzjQD0RuIsNsqOaV+HD1NQFFGKGe9Jm0vSYsASEKdDK0Uxb5+9Pi1gX1OZtOhhFOb5oxZg7VKwyp2WvQXabVoxcEkujLEg51pwkZKARe1yOj35ZRWW6k/wrGPMFKUTENRUbyN/CjuhFPrJ/du2FD8EF1aHkNX350QPdOm4BdM2h6FzVm5Z1FjVzfttcpruxHsTgazMzF/zxw48BOMZe6EyxRr0mjK/dJxEpgQlDLsjVYqavS8MyZ2Ld9VY9qovqd5K4Kc2EmwK1zSbr3jGXvV7ymG+HnkwiwWJLi8a8gJZFGm/YvdtNw+EcyAJDjDQDISZzo/zfq1unas4d9H9gqEDfhm4W8HVdmvsyMjodGzfHww+79ahausMLDCDpGR X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8aef2ab4-723f-4c09-1fb6-08db02c9ddc3 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 13:57:03.6228 (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: 1Yiz15/qbilAQgPMBOo6b41FcYW5nKy2MBVW9VtYPuQb5nuS3Fh2XLRELLlCuE9u3P21aAHkwylO+Xk0noLelg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9081 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?1756456103379474452?= X-GMAIL-MSGID: =?utf-8?q?1756456103379474452?= 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 Mon Jan 30 13:56:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 50292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2190727wrn; Mon, 30 Jan 2023 05:57:56 -0800 (PST) X-Google-Smtp-Source: AK7set9w0E3mviASJLVPIvakPl5DANHP78OFRhdlPT/0Rm2HKsN+Hohb5oiJg7oDcoBFlTV0pgH9 X-Received: by 2002:a05:6a20:7f8b:b0:bd:8f4:991b with SMTP id d11-20020a056a207f8b00b000bd08f4991bmr6037266pzj.56.1675087076567; Mon, 30 Jan 2023 05:57:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675087076; cv=pass; d=google.com; s=arc-20160816; b=suvaphMvnL8LUv5/Sy7TjxcZMflEojScwJxc+m4fff3qYuAnDQJDP+IijBrq6lRVMO mCTRJHnkC8+aSsqTFcEfE57iI8XdMXANjglm4TapKxB451GxzwL/5lh9Cp3qYn9C0E0C BK4r3xb8/ZgHO7mAtsFa2ykZNM0Fwie22FUUdXQC4oFl0uTQKif4b4Vza4AMgkaRD0oa qm0IEnZaqfkZJTYP25M+U5tdp45h5vZZkGU7bPAepM9imN9dCyUmBHdT39rg8Xi630j0 WVD27r6MoC7N/5r+A0ORUo9igTgms+toBaSN30zWqbc6REXHIikPEvR8DJ0YwmuBZQJO sFdw== 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=xdmM1EIME/d/UNuEnq5tXxpVUaNzDCS+vZxpVuC/Ekw=; b=E1zS3Em7ufiXWKepS5AP8CUsTqEC7vRd0BLc9X4zayFK29vfWU4uj3+PnlX1uOmb+N /5hW1hHK74vXkB1mSpAN8F0Fv4S3tbxH2iCfAtNkTPzcFE7bQdVUJI+dQ63AIaTPeosM 8XGbRD+SM3zmpVXINUVIeXu93kXGwvngYbPaRiMORdHTKiBiPl117zNca+EIXjAKj5Cb orbE4n77jBaHG/DkU47hEzR2+TqKCCoNux9HviHrge3j8eaU4cYt/iczjTDH0+4kjSDs sdf+Yru397eH4kQfLi4laVnSoWP/Jpo8qf8EHft2QHAUlgf9NvpIHCNMADuJ2r7Mzt3U AtSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=BYwYSutj; 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 o2-20020a639a02000000b004cf1153a948si12440340pge.305.2023.01.30.05.57.43; Mon, 30 Jan 2023 05:57:56 -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=BYwYSutj; 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 S236754AbjA3N5V (ORCPT + 99 others); Mon, 30 Jan 2023 08:57:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236691AbjA3N5I (ORCPT ); Mon, 30 Jan 2023 08:57:08 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2098.outbound.protection.outlook.com [40.107.6.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF76339CD9; Mon, 30 Jan 2023 05:57:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mKm/yF8ZTmy+Guf7FEbcin1dksfbqI1LI/KgL8JukWaiVHDzwmGbrZY90Mn8JLilyYY5Be9bmV/QSK7wf2vgdmAdtuzseeTyrvQrWtZbRWpwZhHVBCAU443io4YZOjo7chlb4A21WFJvRrJBGQmej+4uV0qH3cGVd0MwXWFoLufUm3b2Uowvc5rpzeurdB5+DTF62Qu1RANjKtDfdTHjKV0yuriJIuhxRqc6Q79Qw2SEBnnj0QDYm5lc7WiDhkq9Pz5+rm5vARL2xLvNPbalzlYVQHl3NIWll82ccdJ0iI3uZHIDuCN44TeTPYa8zmKyH3tqehXmu1FCFVLW6tFLYg== 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=xdmM1EIME/d/UNuEnq5tXxpVUaNzDCS+vZxpVuC/Ekw=; b=X/+BNQK0qzSMaZRWfRdNOI9aG/tPpO/U0PAWgSLAnApseHnNPLyajDlaDSy3JXezvWUYO466ROny6w6Hc1ni4kpE6g52Pgwb4ZCMsmyXuxmdYRotSSOTa4pmgzhOW+QdEGZ5dbFDxxJVQe3PqdnUcpQmDvB7I70KtPCkpTL6jcqR9VE1NrrdKLoAyt6Ad1lc9Z/8puyCQlRnT6e+fquebyjWmwiUN2bqv/b3RVzrhgSc2arUXKX5xZ0/N/Ph1aDYdwm6nNWtQVqezFaot79kRAk8g7ZXu35/qwOxVP9amQoeFPtXiWMGPr8UuLyS99XxL6rMr98OaArikSwbGuiSbw== 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=xdmM1EIME/d/UNuEnq5tXxpVUaNzDCS+vZxpVuC/Ekw=; b=BYwYSutjGvtGr6n5BErQhq8zIJB1G076VC/WkB5SjtkaIJx+7lEpSDGZvrbcPeBbD1E7QiMiJLaKXFqUEAhvI/7YfbidCO2It9a1KiQEKsocfjFsP8ABFgAfY57mHV4bzLnTQvaWIq/SA4iJIZ3rZFDvyO796o1ClrfBxk+vB0cS+7BYdNuCFKQiGrs8uGup2OMpGLttQ1NX+k8Qi2swb3HomCSEmqVyjMDhrknTZLUQktuJlrk/EKHxYGnQba0uotyhNqBEk3f8b+MUoMU/DfOP1nMG6jrPZkW43AvUVOInKdvMNb7JEhwsSSjm7tEJQgvI1AKQSCfwv3MKPpHRWw== 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 PAWPR03MB9081.eurprd03.prod.outlook.com (2603:10a6:102:33d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Mon, 30 Jan 2023 13:57:05 +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.036; Mon, 30 Jan 2023 13:57:05 +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 v9 3/4] dt-bindings: input: pwm-beeper: add volume Date: Mon, 30 Jan 2023 14:56:49 +0100 Message-Id: <20230130135650.1407156-4-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130135650.1407156-1-manuel.traut@mt.com> References: <20230130135650.1407156-1-manuel.traut@mt.com> X-ClientProxiedBy: FR2P281CA0075.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::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_|PAWPR03MB9081:EE_ X-MS-Office365-Filtering-Correlation-Id: dc27189e-9dd1-4570-777c-08db02c9deba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8C9EcDG6yFWbIxKCHXUQeap8op5PnehfBeQJjc64PUSsJYv1OOYmzL4oHK3RaL3VH5zk2A0229YO+qKTi9W1L8LUchW7Mw/0+SP3lsMGH1/JwgyCT93OAVQdW9EbohGpdICQb+U0sCoVco9W0M6ojAUp+9mkW/WLGAQetribACeR7TMKQdm+9XU59LAQ0m2docI/ysITvxZj93Kp1VxWoV8QBLvzgs5/nK5h6fp+34j8HanB/+Q2DoY8b98N12dNqelumH2h7NoSYEmyc2WDybw6fO9yNJf1bcJ+08uNYuNUWAVc7RcZHkOu6q1VO8/4zQ6TE6dv/XpuEaAjg44ObpdcVqjBtqzwxG7MD4opY23bq0St0vhJF06boXl6EO5AKjdvmIJEviE55KUKwGnbstLv9EtTLyAtMmDVPn7xKa9w3c9NrAejFzPLS2kTUscdXF9ieDxapxA6HL7LdIPYjE/oXBR00183OW+Oeuoio0WEFNFwECmKQaz7uOqGulSf7iU7kWC+sFSGW/A+isKGBBxIFpKzJP3c8/Z0E7SRQyCdF8GEHE+8l/NOAZvHgbPEmxz/MV9lJbCtuK1YJxT0fWYGV9lRnLWTfrmmQ2KspHhXaDazuzyg19VfCR2pzc0oekV2KXNwJZWUhMKtQ9LUZCf+XbACe3bbeuELioMVrj+eDo6qsRt9YKp6/nC2R0L8o/YegERvWWJXIXFFhXy9Mg== 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)(346002)(136003)(396003)(366004)(376002)(39860400002)(451199018)(5660300002)(36756003)(86362001)(44832011)(38100700002)(38350700002)(2906002)(2616005)(52116002)(6486002)(6512007)(186003)(478600001)(1076003)(26005)(6506007)(54906003)(4326008)(66556008)(66476007)(8676002)(66946007)(6666004)(6916009)(316002)(41300700001)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WRTcQ6QtgqtqGOmGAWCsFVcv8RJkldBpIu5fdbjlb2w6iQKtDvanuSu40biIxF1biVfB2/VxBkNwpIe4Bi7mxwiqqmgaKY5sUNCuTINB+r4hdniGnAj7O/WJ+9OHA7zChpoxiJbaQSsN5hJpayw11zEehaLFVd4CXMaCLBc3o3omIo9qbJQ9WWxAVSvRACvKXYozlF3QY61zfM3D7Y9EvOHNBOo8rzxaTEqGuYF5ah5P1kLRl7yxg+DKX9JugCav7yYAODzuhPIWB5aBNN/01YnRMJOvWEcDrNkWs+JqdDaXOycLJnoMQKMAjHE96CxkwlbDK+s+QGH/HWyD//KP9HlR2t2i/jRv9gk7d1wA7mV0JXv7a1f6YULbyA7q3QG8WqWPQS2P+bwHoXIlWXsyPLt4q7PC5JJsJrJ2DX23nu6+/WXQzqs2nWweheLYSmyq3hMkrKc+3flcIIYAKsSdmysMqa/gCCDaAIxHsZYurLwf7tkLlwhyaAgIQZcVKH3SS6iw0jP+6fBuOsyKhhc5lhELSCWv5Falxw65Yu22kB4lbB4SW8qcSt/vONMHSuodgb+JkAg/eYMLcB6Rk4vKes1FTrSCEFnHakXaEdf8qrbW/aapeJj63ars0TqBJ9ZJvfB3KS5yyhAUSPDVkHK0iY3JLF1rj5axpYuf8bxhCQWP2FW07Dq8FqViu0d8y/mBatGKRjSpLeAmxClWBC9JbIDBoDDaf28a20MwHLrmoVFmM8wuKFS7h4ZqY6UJG85+YBp2FI549OFdScWgMGqT7qvaHB1qvis3QX/UQW/UrrUfdoqG+EADGuWDRKWSIYVJ5LkP8ZvNjAeG2+c8voR4nptolIfHqo3ycs/bLs+NrqfvNZttrKbgFNKCIpD4WBIHGU7E28u2wgB4mNTHYwDSpL2TcDDyI2LRmoeUmp+GBkqWPCRHrjndtUMQ/oEJ92Z6lnI9uVzXrltm6Y8TUPFkCjCy8icWS4b4osfV4Tvr0EptQSFjz1MsPMQ/NnGjKH7cu/J8E4mkwH6atKvdw3JWL+Bum30ridfZDjpBjII3H3zET4zFHpjxtuQwuPI8CwaYBwvB8buSmG5Qai4z8suUq58bj1kV3J1AXWRiIW1BM+dNTTGYmQ8NmKcykaL8+Jt2k/SxiGUau6eMBReGLrXApItfyW+VcaP4WIG9MfC1LY23VJcwqji0Ke0YAV/y9nr3TsxKsqnoGkVGFuw2Y5v92PDVMzTG0WlFBjlidSbPS4PXh5XSVzf+JBZGvXfyqelumrDjwZTpmHV3O4ysRmwgXHr5mC8NPReGL6EGimmDNuZLGy9EX7wXsTq+nPBlbrhdhs7sF6zWogFH5cQ7NjztK6rzCb3yL6IxFRFkiGvjegRB4tIlUzCtEhcINfQJy/VeOW1WAt15KPQfJGeTOShQ/ppIhnezPKVG5trV6Ws3Pi/vBBX/3R2pm2NbMkMZXHGm0NrXd1kHGmg8A6gvBFYwFgLC3sEVu9AVXBXAfAEQmryfvWHTjDIWsycBdePYedJ8TMOxy9i6kvAFDMOO6O6UShmWDdptXqUP0hCJbERs1xrWwLu5jsaO80v3rz6UpQjh X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc27189e-9dd1-4570-777c-08db02c9deba X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 13:57:05.2595 (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: VZmcsZwvFvqwjJo/97naPO85bH5gHR4xXiBpxFmydxl08n3LBXQn3u3966PTDE8IWeSaHw4ATUNkUk97PHD/iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9081 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?1756456106555709133?= X-GMAIL-MSGID: =?utf-8?q?1756456106555709133?= 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..ca9efab7efbf 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 = <0 8 20 40 500>; + default-volume-level = <4>; }; From patchwork Mon Jan 30 13:56:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Traut X-Patchwork-Id: 50293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2190869wrn; Mon, 30 Jan 2023 05:58:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXtoLK9jlGqbWVZyfTEkUWZIrXd/gAkEFhWUDcjHcImdJSObQOXXp4sK98Ls/6OjdpUerENc X-Received: by 2002:a05:6a20:2d0b:b0:b8:2aab:2309 with SMTP id g11-20020a056a202d0b00b000b82aab2309mr57252312pzl.49.1675087099937; Mon, 30 Jan 2023 05:58:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675087099; cv=pass; d=google.com; s=arc-20160816; b=SPwxGw6anWlVeheqSfzfrHk1/3F5lfagksVpdOW4tSkwWuwtdcq6/MJaPPI+s4k81+ +Kp1KEiA2Folzh+YpreBVUGdz2wuVhkM9aoswsyxj010tiovgfq2JcBxN9jBOt3jsB3o qe4KCEMyVXs2Z9kuPQWu5LNiYhH3PDKx+uS3QAlPdF4IYzC9kecwTd4Os/rNspxDf0eg RI3y36cm0QIm0EqBzvTE5c37bq47Lc65Tay7jQFzcuVHD30WFzIl6kUHM4fg+A6ruS0C GQ9/s91gmK8SPtpbthxcaes+Vg5TtaZ8bH0xWLAuUwSk7uUk8EgZ826AnFzbeVOSi3ER zmPA== 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=lU5lR4KqLbCbHm/PIjKvuM2WQNlI/qNO/U6FvcYVC0M=; b=xEX7QmnOHTxrrcO3ZS87+yOS8Z++vibwAHBHKyStKhywwhgoDRShp7N3nUAbs6PTXf sr9zUKcpL1JPrdHEPz8mXugrHGsCap5onnS6J4Ahs5qcIfZjGFFPBBBH/nA3bH4YLT0v p0jflKVqTYX+CpleM525oD2IFSd4e/nuqPd7XvQrT8g4NxwpH8mljS6Gg9PyuSWcYWDt VIWD16x8B9KwP0W9m8VVXdH4fFajwi9M15iM/eyYUT98UBz5NBbAmhm8jtNF9rEVSJLk Yjox8yEzHqALM+3gRtlOrT96gHFsPPFuP4GZ3/KVk1EWGme497HTW46OzvYtKz1KmUuJ aEfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mt.com header.s=selector2 header.b=UDuIqgEK; 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 p13-20020a637f4d000000b0047947d45f57si11768289pgn.745.2023.01.30.05.58.07; Mon, 30 Jan 2023 05:58: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=UDuIqgEK; 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 S236728AbjA3N5d (ORCPT + 99 others); Mon, 30 Jan 2023 08:57:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236705AbjA3N5N (ORCPT ); Mon, 30 Jan 2023 08:57:13 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2099.outbound.protection.outlook.com [40.107.20.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C9F39CE1; Mon, 30 Jan 2023 05:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YyzjX8CcjZSlNXtW855dIZ3HusFVCiPMup2jtVavaNo8ulmF+scHgYzQlR6ltEUlEmoiSn8dFXl7RG/7C9SZ+ER0uGMaD01gX7m4quFnAisuEB+Ep+Nw3U8a3Er41M6DWUo0EqsuF0GnXqf47ShCKHGaGOmsHNe8VSbFPQSfoCpLvUqDoIQCU6g/w11V2ST0Eu/O6CLujO2gc7vx52Mq3Lg81jNTi1ztLsUDJpBISiyYg9wBG5VvK3dpt6D3ge/Aa3Mfe53006aejUkA1AMkp4+94MO4x2qX7X0Jq0jrqAHMjQtmxEqRtA07kTkZKlrsUOBeBBLsAM9Uz6gE+4Tl7w== 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=lU5lR4KqLbCbHm/PIjKvuM2WQNlI/qNO/U6FvcYVC0M=; b=mUtMtC2fRKgbVahcGJt1+m9OLDOj3alpMKPIddtFudNtO6gPLoQrP22dTaFL+8DB98ujJvxlqutYJLGOMWblnH8WerYKv1KCP6tXChoY5zUjozzBjzyn7a+6fH29TK43t0AIWKzlhPSgWL1MdF/QYDl90Cdm9CY2bt64VZFw1iMZX66CDZPEhEG15uHxZZCcF+lNJqFzc8txlLFmj8eSrPaXh64WeU/yoiLhlXWhBbJgMykQsFR7zwPg7jlamSdYuR0kgiDl+3LE1WxG8TaxJBTNiDB55K7HE5+Jfjp6Z0rNrNoydWNvrXk97AG3dkCCaYbzVl6PfX/j/vt9UwcKJw== 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=lU5lR4KqLbCbHm/PIjKvuM2WQNlI/qNO/U6FvcYVC0M=; b=UDuIqgEKUjWEm0/oGRlJt1nJE3E85XekYxPrFikSZu44tm75Jak+KyINSrAfX2FX1EBx+H6EM2mAFFG08/iDRiEOhIoFWtUrXkP+7wmmrYA/NGGXFDD1YvOY5UbMXi25DWo0Tj58sCzoGqSGETCXGw/ZA3znM8q4pP0WCK5mXvOSVRjeIdbzNLkBaYyT3y71NNCHY7h/83GZWtpoPB0RUXeLIyIKrNCJT4sQwSPsVwndvyeo3+SIv+j8VgOduCcB9j673Dn/5uIf2UH7WsF6qQZg+ZXvvza6k2ZGTr9Lmssjl8mgEuh0RbQi7H2eFmHQdOcngSQUG9d+a0cNPVfjNw== 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 PAWPR03MB9081.eurprd03.prod.outlook.com (2603:10a6:102:33d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.33; Mon, 30 Jan 2023 13:57:10 +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.036; Mon, 30 Jan 2023 13:57:10 +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 v9 4/4] input: pwm-beeper: set volume levels by devicetree Date: Mon, 30 Jan 2023 14:56:50 +0100 Message-Id: <20230130135650.1407156-5-manuel.traut@mt.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130135650.1407156-1-manuel.traut@mt.com> References: <20230130135650.1407156-1-manuel.traut@mt.com> X-ClientProxiedBy: FR2P281CA0172.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9f::6) To AS8PR03MB7621.eurprd03.prod.outlook.com (2603:10a6:20b:345::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR03MB7621:EE_|PAWPR03MB9081:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d76efc7-29ea-4c40-8a26-08db02c9e214 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xO3l4LYCXUHKJO53H74OedGb9tUXbYQtumd2D/Ra1LQECYMA3xDwA+CPb0vKX9ZYdQV23sy/VWjhg76KM5fJ2se90Ctyb6ewZscET8TkLAgtkk9tc2qqwIXPubh1VOcNg4/KlOIBNI3R6tWb2LBYvff7HAZ5vLRrILgpgPyn96DOak8aGmsce0tyU9mxCDICyitxD1UOZusyQlPI2vbxR6g444UIr1J6wbhAjdcdbdmLQ18mmDfrdtd//xwtNzvQSWjofby7w7hFrALOzVpDBTAlaBYtPuy46JafoP7DQVcS5cylBnbznVQ1EeMHHJwp14MSkzcHoTnQsAHZ7JGFL04ydeGizClPU1JkzhVTMcjPtC4CEVtXlF2VOHvTEYXge5X/Jbp3ROp7q7HCWcTfprFEVyUpch0bIjqsBFEYUfZVu2yrB/xp7PnhatVGeo/DGBx+mR8Z8TtZzxRdcLQKcY+ppg+22Ww81DhfoOGViYU3TpIqxhMFIMwk852fumakSV8oKbQ6M2EWtUz1L2CaABLXQkrtVOLMQCFNayT77f4fZh9NDtgx4ifkeWYbaGoUqxecXamfBa8I0VAGnmdMfvXlCn+YPMXjwGt0J1BlNVE/l/wODYBBZWIQvprpFZkEjh3/bVr3dm1EYcPcwMHqV0MonOFr8rwwyVECBrxuzUEnjVO4ZAojI5HkepZomzXragVGZX0W72kjOqdqeLy6hQ== 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)(346002)(136003)(396003)(366004)(376002)(39860400002)(451199018)(5660300002)(36756003)(86362001)(44832011)(38100700002)(38350700002)(2906002)(2616005)(52116002)(6486002)(6512007)(186003)(478600001)(1076003)(26005)(6506007)(83380400001)(54906003)(4326008)(66556008)(66476007)(8676002)(66946007)(6666004)(6916009)(316002)(41300700001)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JKy4XGf4wrGYPl/+8lACYhOCl+N2wwYm3kOFzUyCY1v/ehcAoOcnekTD2BWFMzn4hZV79VcNuJTR+kr3n+wgeyXd7DlRYe+ZbPZaOU79EtBR3AkPr++x3a90XdoE1GheY5CAEpnK8PKJIp2xXY7BItNxWDPgsI+KKG9VElyvdn5zkDmFYByaa25aMT/sm9MjSj5HCekBT+0JtBLu4gK31y0l7Cvirn/2uxY22R4XvGH1j0aGwMhksHw7A+UfXe4pc5QEJmCzLPG6nMXqk3os5gTMvSAW1X+pm7IC9OF5S0yQheKLgLNQkfeC/ZuDh4lA8iHRro3OsZMCL3Oj0P9fcQnWEsLmrGYYMMa97dq1ptLMyulr1nz1j+OmqKVdltcx8EXaY4PZuP1HH0CTZWK86gZ2TFkrbfv7LoRgkj/S8mDO0d6Jj/k+V1EpoXFwmN2DfyzfRNB++6P+cym+Ie8i6rMbD1Gm6r61Oyo5/cyexte8uZj8yUTd2pIsT3fQQHv0TEZMmB619aJcEgqj4mzBuuRWngmxPzYeCVfyXy1lwZCRlonH/BXKk/rK7E2UoQwg+T2oxv4htAPGUM6dL3oKcU9CcnO8dPWc1h6qpffErU2raJMymgMOdZ1GkjshHjLLB6DWZj+qIS5yRtUU48NvFsoum0TJKS1ed/qH4azXyQ/RJUvBRcT/l1Y+5SfEt2fm2tly2wPBPGojKiojdl4rOecdgeHToe2kfdFjatGbbR3leGL9rsSgdGoAlSgry6Uc1hd5MrCUCP9fgUtugaoyffKDuhMR0SUV+9yyocxPnRNFciqTfx+BotDZKSFPQvqjemiM2ZdeX92EydB5ZOiZtNBpA+ANVjWhp3LOuB9BUFt3Nziet0HZT6kQTuVmDe4uy6B7TBBW+dh8rCKoxVKiWSv0aSSSnfZkALZ9cQwnIIzFHvLKbBKxHhAuKRnPV4Z6GbO0VXu05IITYe6O4FXBUpK06KuNTaOSEqTLKQo11o/N4fgUsbREMapM7IGTyCXA5vbnLeddUBHsPfR/OvaqKIj0xeA61sKsrShtaU0eVQvwa8ybGtM8dsESoeYBRkgMvjen6N5rdfQpERfO4lttUFHxZo6KBK4wio54x0VltEvaD7MVtlp1DjbHA3XhT0H4zmVXPAhazZTtY4SfDgBSU1Rphg+0KEmDbZ8/Y9QSSo/a/vZ7h4L+I1gw0qz7OV7cZdIhjF+fqLZ8PaRs3u7TW/BT4g7R2XeI0S+wAyfFIqeGLv2lc6Ku+He0Rvq4HoGaUetMLSkJTyYJKhnmZXMASzOKyE50+3VcflQkQVgED6KcyuajF4U2v0ESuoZ1xrIq1v0XNo6tjMRlbEJMq+5X41D07yKUKaRV+Bo7hpnwgmymd/WmAv7ov5V031Az85HFtvLqm8LZNH0b/vd2thb9QPdUitS9TUUaD4RwsYDaAHLsuX85isWbXlgkcX/AppuJxEFDkTfczhPsnPzKrmipcDqwawu8Lu9cHDnOZ3B+ZSxqzqOLKLG+YdaKA1MGVXcdiMgQ8/p0qghpaoaXlOKj69M72G5XelvdtD0ZgWKy7AtbudR3LVAW2oCfl/sTTqhY X-OriginatorOrg: mt.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d76efc7-29ea-4c40-8a26-08db02c9e214 X-MS-Exchange-CrossTenant-AuthSource: AS8PR03MB7621.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 13:57:10.8829 (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: znQfLRlCC/40zxP+sarJlUa2wcVpTS5QhQCMQbbXWDXGqHTlCDy+3UZekTxPxY9Q53/PoUWZx35GHyXtEAQIVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9081 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?1756456131237223885?= X-GMAIL-MSGID: =?utf-8?q?1756456131237223885?= 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) {