Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1582946 > unrolled thread

Re: [PATCH v3 0/3] input: pwm-beeper: add feature to set volume level

Started byFrieder Schrempf <frieder.schrempf@exceet.de>
First post2017-02-16 22:20 +0100
Last post2017-02-17 11:10 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 0/3] input: pwm-beeper: add feature to set volume level Frieder Schrempf <frieder.schrempf@exceet.de> - 2017-02-16 22:20 +0100
    Re: [PATCH v3 0/3] input: pwm-beeper: add feature to set volume level David Lechner <david@lechnology.com> - 2017-02-16 22:50 +0100
      Re: [PATCH v3 0/3] input: pwm-beeper: add feature to set volume level Frieder Schrempf <frieder.schrempf@exceet.de> - 2017-02-17 11:10 +0100

#1582946 — Re: [PATCH v3 0/3] input: pwm-beeper: add feature to set volume level

FromFrieder Schrempf <frieder.schrempf@exceet.de>
Date2017-02-16 22:20 +0100
SubjectRe: [PATCH v3 0/3] input: pwm-beeper: add feature to set volume level
Message-ID<tbBD4-3zv-9@gated-at.bofh.it>
Hello David,

On 20.01.2017 20:11, David Lechner wrote:
> On 01/19/2017 03:37 PM, Dmitry Torokhov wrote:
>> On Thu, Jan 19, 2017 at 04:24:07PM +0100, Frieder Schrempf wrote:
>>> 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 number of volume levels available and their values can
>>> be specified via device tree (similar to pwm-backlight).
>>>
>>> The volume adjustment is done by changing the duty cycle of
>>> the pwm signal.
>>
>> I wonder how this all will mesh up with beepers that have dedicated
>> amplifiers (support is being added by David Lechner).
>
> This will work very well with it. I fact, it is a feature I would like
> to have but I was not sure about a good way to implement it. Please Cc:
> me on future revisions of this series and I will be glad to test it.

I have just send v4.
>
> One thing that would be nice would be for a more generic way to change
> the volume from userspace. Having a sysfs attribute on the platform
> device will work, but it requires very specific knowledge from any
> userspace program that wants to control the volume. Would it be possible
> to add an alsa mixer volume control or something like that?

An alsa mixer control for the pwm-beeper volume sounds nice, but 
unfortunately I have no idea how one would implement this, or if this is 
even possible.
>

[toc] | [next] | [standalone]


#1582960

FromDavid Lechner <david@lechnology.com>
Date2017-02-16 22:50 +0100
Message-ID<tbC65-3M4-11@gated-at.bofh.it>
In reply to#1582946
On 02/16/2017 03:15 PM, Frieder Schrempf wrote:
> Hello David,
>
> On 20.01.2017 20:11, David Lechner wrote:
>> On 01/19/2017 03:37 PM, Dmitry Torokhov wrote:
>>> On Thu, Jan 19, 2017 at 04:24:07PM +0100, Frieder Schrempf wrote:
>>>> 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 number of volume levels available and their values can
>>>> be specified via device tree (similar to pwm-backlight).
>>>>
>>>> The volume adjustment is done by changing the duty cycle of
>>>> the pwm signal.
>>>
>>> I wonder how this all will mesh up with beepers that have dedicated
>>> amplifiers (support is being added by David Lechner).
>>
>> This will work very well with it. I fact, it is a feature I would like
>> to have but I was not sure about a good way to implement it. Please Cc:
>> me on future revisions of this series and I will be glad to test it.
>
> I have just send v4.
>>
>> One thing that would be nice would be for a more generic way to change
>> the volume from userspace. Having a sysfs attribute on the platform
>> device will work, but it requires very specific knowledge from any
>> userspace program that wants to control the volume. Would it be possible
>> to add an alsa mixer volume control or something like that?
>
> An alsa mixer control for the pwm-beeper volume sounds nice, but
> unfortunately I have no idea how one would implement this, or if this is
> even possible.
>>


I know it is possible because I have done it. ;-)

https://github.com/ev3dev/lego-linux-drivers/blob/master/evb/evb_sound.c

The driver in the link above does PCM playback using PWM. But, it also 
included an input device similar to pwm-beeper and it includes an ALSA 
volume control specifically for the beeper.

[toc] | [prev] | [next] | [standalone]


#1583286

FromFrieder Schrempf <frieder.schrempf@exceet.de>
Date2017-02-17 11:10 +0100
Message-ID<tbNEe-2WR-19@gated-at.bofh.it>
In reply to#1582960
On 16.02.2017 22:44, David Lechner wrote:
> On 02/16/2017 03:15 PM, Frieder Schrempf wrote:
>> Hello David,
>>
>> On 20.01.2017 20:11, David Lechner wrote:
>>> On 01/19/2017 03:37 PM, Dmitry Torokhov wrote:
>>>> On Thu, Jan 19, 2017 at 04:24:07PM +0100, Frieder Schrempf wrote:
>>>>> 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 number of volume levels available and their values can
>>>>> be specified via device tree (similar to pwm-backlight).
>>>>>
>>>>> The volume adjustment is done by changing the duty cycle of
>>>>> the pwm signal.
>>>>
>>>> I wonder how this all will mesh up with beepers that have dedicated
>>>> amplifiers (support is being added by David Lechner).
>>>
>>> This will work very well with it. I fact, it is a feature I would like
>>> to have but I was not sure about a good way to implement it. Please Cc:
>>> me on future revisions of this series and I will be glad to test it.
>>
>> I have just send v4.
>>>
>>> One thing that would be nice would be for a more generic way to change
>>> the volume from userspace. Having a sysfs attribute on the platform
>>> device will work, but it requires very specific knowledge from any
>>> userspace program that wants to control the volume. Would it be possible
>>> to add an alsa mixer volume control or something like that?
>>
>> An alsa mixer control for the pwm-beeper volume sounds nice, but
>> unfortunately I have no idea how one would implement this, or if this is
>> even possible.
>>>
>
>
> I know it is possible because I have done it. ;-)
>
> https://github.com/ev3dev/lego-linux-drivers/blob/master/evb/evb_sound.c
>
> The driver in the link above does PCM playback using PWM. But, it also
> included an input device similar to pwm-beeper and it includes an ALSA
> volume control specifically for the beeper.

Aha, thanks. Doesn't look too complicated. I think I will play with this 
a bit, when I have time. So maybe the sysfs volume control can be 
replaced with a proper volume mixer control at some point.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web