* GPIO control from ALSA
@ 2016-04-20 8:03 Petr Kulhavy
2016-04-20 8:33 ` Lars-Peter Clausen
0 siblings, 1 reply; 6+ messages in thread
From: Petr Kulhavy @ 2016-04-20 8:03 UTC (permalink / raw)
To: alsa-devel
Hello,
I'm writing a driver for ASoC "sound card" hardware which uses CPU GPIO
to mute/unmute an analogue amplifier and another GPIO to control an
analogue switch for line/mic switching. Is there an abstraction in ALSA
to model this kind of hardware?
Thanks
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GPIO control from ALSA
2016-04-20 8:03 GPIO control from ALSA Petr Kulhavy
@ 2016-04-20 8:33 ` Lars-Peter Clausen
2016-04-20 8:51 ` Petr Kulhavy
0 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-04-20 8:33 UTC (permalink / raw)
To: Petr Kulhavy, alsa-devel
On 04/20/2016 10:03 AM, Petr Kulhavy wrote:
> Hello,
>
> I'm writing a driver for ASoC "sound card" hardware which uses CPU GPIO to
> mute/unmute an analogue amplifier and another GPIO to control an analogue
> switch for line/mic switching. Is there an abstraction in ALSA to model this
> kind of hardware?
There is no abstraction. Use controls and/or DAPM and the standard GPIO API,
if you grep the sources you'll find a few examples of drivers using GPIOs to
mute amplifiers and similar (e.g. qi_lb60).
- Lars
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GPIO control from ALSA
2016-04-20 8:33 ` Lars-Peter Clausen
@ 2016-04-20 8:51 ` Petr Kulhavy
2016-04-20 9:06 ` Lars-Peter Clausen
0 siblings, 1 reply; 6+ messages in thread
From: Petr Kulhavy @ 2016-04-20 8:51 UTC (permalink / raw)
To: Lars-Peter Clausen, alsa-devel
On 20.04.2016 10:33, Lars-Peter Clausen wrote:
> On 04/20/2016 10:03 AM, Petr Kulhavy wrote:
>> Hello,
>>
>> I'm writing a driver for ASoC "sound card" hardware which uses CPU GPIO to
>> mute/unmute an analogue amplifier and another GPIO to control an analogue
>> switch for line/mic switching. Is there an abstraction in ALSA to model this
>> kind of hardware?
> There is no abstraction. Use controls and/or DAPM and the standard GPIO API,
> if you grep the sources you'll find a few examples of drivers using GPIOs to
> mute amplifiers and similar (e.g. qi_lb60).
>
> - Lars
Thanks, Lars, for the good pointers! I will check that out.
Is there also a way to map GPIO to a control which then appears e.g. in
alsamixer? That would be useful for the mic/line selection.
Regards
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GPIO control from ALSA
2016-04-20 8:51 ` Petr Kulhavy
@ 2016-04-20 9:06 ` Lars-Peter Clausen
2016-04-20 9:47 ` Petr Kulhavy
0 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-04-20 9:06 UTC (permalink / raw)
To: Petr Kulhavy, alsa-devel
On 04/20/2016 10:51 AM, Petr Kulhavy wrote:
> On 20.04.2016 10:33, Lars-Peter Clausen wrote:
>> On 04/20/2016 10:03 AM, Petr Kulhavy wrote:
>>> Hello,
>>>
>>> I'm writing a driver for ASoC "sound card" hardware which uses CPU GPIO to
>>> mute/unmute an analogue amplifier and another GPIO to control an analogue
>>> switch for line/mic switching. Is there an abstraction in ALSA to model this
>>> kind of hardware?
>> There is no abstraction. Use controls and/or DAPM and the standard GPIO API,
>> if you grep the sources you'll find a few examples of drivers using GPIOs to
>> mute amplifiers and similar (e.g. qi_lb60).
>>
>> - Lars
>
> Thanks, Lars, for the good pointers! I will check that out.
>
> Is there also a way to map GPIO to a control which then appears e.g. in
> alsamixer? That would be useful for the mic/line selection.
Rather than exposing the GPIO itself you'd expose the logical function of
the GPIO. E.g. in your case a ENUM control that allows to switch between
microphone and capture and in the background this sets the GPIO according to
the selection.
- Lars
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GPIO control from ALSA
2016-04-20 9:06 ` Lars-Peter Clausen
@ 2016-04-20 9:47 ` Petr Kulhavy
2016-04-20 10:39 ` Lars-Peter Clausen
0 siblings, 1 reply; 6+ messages in thread
From: Petr Kulhavy @ 2016-04-20 9:47 UTC (permalink / raw)
To: Lars-Peter Clausen, alsa-devel
On 20.04.2016 11:06, Lars-Peter Clausen wrote:
> On 04/20/2016 10:51 AM, Petr Kulhavy wrote:
>>
>> Thanks, Lars, for the good pointers! I will check that out.
>>
>> Is there also a way to map GPIO to a control which then appears e.g. in
>> alsamixer? That would be useful for the mic/line selection.
> Rather than exposing the GPIO itself you'd expose the logical function of
> the GPIO. E.g. in your case a ENUM control that allows to switch between
> microphone and capture and in the background this sets the GPIO according to
> the selection.
I understand that, my question was more how to hook the enum to a
function rather to a codec register?
Thanks
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GPIO control from ALSA
2016-04-20 9:47 ` Petr Kulhavy
@ 2016-04-20 10:39 ` Lars-Peter Clausen
0 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-04-20 10:39 UTC (permalink / raw)
To: Petr Kulhavy, alsa-devel
On 04/20/2016 11:47 AM, Petr Kulhavy wrote:
>
>
> On 20.04.2016 11:06, Lars-Peter Clausen wrote:
>> On 04/20/2016 10:51 AM, Petr Kulhavy wrote:
>>>
>>> Thanks, Lars, for the good pointers! I will check that out.
>>>
>>> Is there also a way to map GPIO to a control which then appears e.g. in
>>> alsamixer? That would be useful for the mic/line selection.
>> Rather than exposing the GPIO itself you'd expose the logical function of
>> the GPIO. E.g. in your case a ENUM control that allows to switch between
>> microphone and capture and in the background this sets the GPIO according to
>> the selection.
>
> I understand that, my question was more how to hook the enum to a function
> rather to a codec register?
You can use SOC_ENUM_EXT() to create the control. This macro takes a get and
a put callback where you can manipulate the state of the GPIO. And then just
register the control with the card.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-20 10:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20 8:03 GPIO control from ALSA Petr Kulhavy
2016-04-20 8:33 ` Lars-Peter Clausen
2016-04-20 8:51 ` Petr Kulhavy
2016-04-20 9:06 ` Lars-Peter Clausen
2016-04-20 9:47 ` Petr Kulhavy
2016-04-20 10:39 ` Lars-Peter Clausen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.