On Fri, Apr 08, 2022 at 12:46:04AM +0900, Akihiko Odaki wrote:
> On 2022/04/08 0:09, Mark Brown wrote:
> > Why not use DAPM for the jack? Note that normally the jack is part of
> > the machine driver not the CODEC - there's no way the CODEC can know how
> > it's been wired in on any given system.
> It seems it is an unsual case where the codec knows the source of the jack.
> RT5682 has interrupts and registers for the jack; see e.g.
> rt5682_button_detect in sound/soc/codecs/rt5682.c for details.
That bit is very common but there's still machine specific aspects - is
the required hardware wired up, if it is wired up how exactly are things
wired (separate microphone jack, headset jack, one of many jacks?). A
lot of the machine driver part of things is about labeling things so
that it can be displayed in a way that's easy to connect to the physical
system. Generally the machine driver would define a jack and then
connect the CODEC to it.
On 2022/04/08 1:00, Mark Brown wrote:
> On Fri, Apr 08, 2022 at 12:46:04AM +0900, Akihiko Odaki wrote:
>> On 2022/04/08 0:09, Mark Brown wrote:
>
>>> Why not use DAPM for the jack? Note that normally the jack is part of
>>> the machine driver not the CODEC - there's no way the CODEC can know how
>>> it's been wired in on any given system.
>
>> It seems it is an unsual case where the codec knows the source of the jack.
>> RT5682 has interrupts and registers for the jack; see e.g.
>> rt5682_button_detect in sound/soc/codecs/rt5682.c for details.
>
> That bit is very common but there's still machine specific aspects - is
> the required hardware wired up, if it is wired up how exactly are things
> wired (separate microphone jack, headset jack, one of many jacks?). A
> lot of the machine driver part of things is about labeling things so
> that it can be displayed in a way that's easy to connect to the physical
> system. Generally the machine driver would define a jack and then
> connect the CODEC to it.
Whether the required hardware wired is told from the user of the codec
via jack's type specified with snd_soc_card_jack_new(). The other
details live in the codec.