From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D87D6C77B7D for ; Mon, 15 May 2023 17:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244365AbjEORcU (ORCPT ); Mon, 15 May 2023 13:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242437AbjEORbw (ORCPT ); Mon, 15 May 2023 13:31:52 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17D631434F; Mon, 15 May 2023 10:28:52 -0700 (PDT) Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 7327186065; Mon, 15 May 2023 19:28:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1684171730; bh=crCwT4TX1zO2PVvZj3xRRhcty3U4InjeDBsKxGQdQK4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hofG9PPw5u0+sUKvb8qr6FJwBANMtENxnU9ooEEsqoNDGBic9nJzv+Wkp7agwczJP 2SVjwIp7k908I57wfF9RlvBmQ53uajjlSZfw56l2+MFpt42z1dTkfIOTTOhWZjJDSi VtXxXdh+7hTg/q09vfmgixSjMlLvkyleidFFEra2/xomTjuKIYW4Hnzo6SMUWSRL8Y AziuRrmUvYBg3IjWbhLxhILAT2AFlLJFiewVhEPTt8aZf3kx6hz4dwCEwPr2rPZIm3 HxRnTFuM2WnOT5cD2D4JCOSEbLwkhg4uwRSQTWEwh69AuL+kwshUmliKo6fGYK6LD2 JwvYP4W/xSYyA== Message-ID: Date: Mon, 15 May 2023 19:28:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: AW: AW: [PATCH] Input: pwm-beeper - Support volume setting via sysfs Content-Language: en-US To: Traut Manuel LCPF-CH , "linux-input@vger.kernel.org" Cc: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Dmitry Torokhov , Frieder Schrempf , Thierry Reding , "linux-pwm@vger.kernel.org" References: <20230512185551.183049-1-marex@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org On 5/15/23 17:24, Traut Manuel LCPF-CH wrote: > Hi Marek, Hi, >>> I tend to not change existing user-space interfaces. I would prefer to have an additional event or using sysfs. >> I am increasingly concerned about the race condition between change of volume (via sysfs) and frequency (via SND_TONE) . So I would be banking toward additional event, like SND_TONE_WITH_VOLUME or something along those lines. > > SND_TONE_WITH_VOLUME is also ok from my side. But implementing some locking shall also be possible. > >>>> NOTE: This uses approach similar to [1], except it is much simpler. >>>> [1] >>>> https://patchwork.kernel.org/project/linux-input/cover/20230201152128 >>>> .614439-1-manuel.traut@mt.com/ >>> >>> This one is more complex, because the mapping between duty cycle and volume is not linear. Probably it depends also on the used beeper hardware which values are doing a significant change in volume. Therefore the patchset introduced a mapping between volume levels and duty cycle times in the device-tree to allow user-space applications to control the beeper volume hardware independently. > >> I wonder whether this mapping shouldn't be considered policy and left to userspace to deal with, instead of swamping the kernel or DT with it ? > How could a Linux distribution detect which mapping is required to be installed? > For me it seems to be easier to have the device-specific information in the device-tree. The alternative might be to have volume in 0..65535 range (i.e. the top 16 MSbits) and be done with it, then the PWM subsystem is responsible for mapping this to 0..50% of PWM duty cycle .