diff mbox

[v3,3/3] ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

Message ID 1446832486-32319-4-git-send-email-plaes@plaes.org (mailing list archive)
State New, archived
Headers show

Commit Message

Priit Laes Nov. 6, 2015, 5:54 p.m. UTC
Gemei G9 has internal speakers and headphone jack. Audio switching
from internal speakers to headphones is automatically handled by
extra FT2012Q audio amplifier chip that works out of the box.

Signed-off-by: Priit Laes <plaes@plaes.org>
---
Changes since v2:
 - Dropped routing property.

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Chen-Yu Tsai Nov. 9, 2015, 3:59 a.m. UTC | #1
On Sat, Nov 7, 2015 at 1:54 AM, Priit Laes <plaes@plaes.org> wrote:
> Gemei G9 has internal speakers and headphone jack. Audio switching
> from internal speakers to headphones is automatically handled by
> extra FT2012Q audio amplifier chip that works out of the box.

Nice that it works out of the box. The FEX file does mention:

audio_pa_ctrl   = port:PH15<1><default><default><0>

So either it is floating or pulled up by default? Since it works
now I don't see any reason to block it. On the other hand once
that binding is introduced it would be nice to add it for power
management reasons.

Acked-by: Chen-Yu Tsai <wens@csie.org>

> Signed-off-by: Priit Laes <plaes@plaes.org>
> ---
> Changes since v2:
>  - Dropped routing property.
>
>  arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts b/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> index 16c1a67..1d73a98 100644
> --- a/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> +++ b/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> @@ -65,12 +65,15 @@
>  /*
>   * TODO:
>   *   2x cameras via CSI
> - *   audio
> + *   audio input
>   *   AXP battery management
>   *   NAND
>   *   OTG
>   *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
>   */
> +&codec {
> +       status = "okay";
> +};
>
>  &cpu0 {
>         cpu-supply = <&reg_dcdc2>;
> --
> 2.6.3
>
Priit Laes Nov. 12, 2015, 6:53 p.m. UTC | #2
On Mon, 2015-11-09 at 11:59 +0800, Chen-Yu Tsai wrote:
> On Sat, Nov 7, 2015 at 1:54 AM, Priit Laes <plaes@plaes.org> wrote:
> > Gemei G9 has internal speakers and headphone jack. Audio switching
> > from internal speakers to headphones is automatically handled by
> > extra FT2012Q audio amplifier chip that works out of the box.
> 
> Nice that it works out of the box. The FEX file does mention:
> 
> audio_pa_ctrl   = port:PH15<1><default><default><0>

Nice catch.

Setting it low mutes audio, and setting it back high unmutes.



> So either it is floating or pulled up by default? Since it works
> now I don't see any reason to block it. On the other hand once
> that binding is introduced it would be nice to add it for power
> management reasons.

Should I just add comment about it or do something like this:

&codec {
  status = "okay";
  /*
   * TODO: Add codec_ext_pwr_pin to turn off external audio AMP
   &pio {
     codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
       allwinner,pins = "PH15";
       allwinner,function = "gpio_out";
       allwinner,drive = <SUN4I_PINCTRL_10_MA>;
       allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
     }
   }
   */
}


> 
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> 
> > Signed-off-by: Priit Laes <plaes@plaes.org>
> > ---
> > Changes since v2:
> >  - Dropped routing property.
> > 
> >  arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> > b/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> > index 16c1a67..1d73a98 100644
> > --- a/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> > +++ b/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
> > @@ -65,12 +65,15 @@
> >  /*
> >   * TODO:
> >   *   2x cameras via CSI
> > - *   audio
> > + *   audio input
> >   *   AXP battery management
> >   *   NAND
> >   *   OTG
> >   *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
> >   */
> > +&codec {
> > +       status = "okay";
> > +};
> > 
> >  &cpu0 {
> >         cpu-supply = <&reg_dcdc2>;
> > --
> > 2.6.3
> > 
>
Maxime Ripard Nov. 19, 2015, 4:09 p.m. UTC | #3
Hi,

On Thu, Nov 12, 2015 at 08:53:19PM +0200, Priit Laes wrote:
> On Mon, 2015-11-09 at 11:59 +0800, Chen-Yu Tsai wrote:
> > On Sat, Nov 7, 2015 at 1:54 AM, Priit Laes <plaes@plaes.org> wrote:
> > > Gemei G9 has internal speakers and headphone jack. Audio switching
> > > from internal speakers to headphones is automatically handled by
> > > extra FT2012Q audio amplifier chip that works out of the box.
> > 
> > Nice that it works out of the box. The FEX file does mention:
> > 
> > audio_pa_ctrl   = port:PH15<1><default><default><0>
> 
> Nice catch.
> 
> Setting it low mutes audio, and setting it back high unmutes.

Then you just volunteered yourself to fix the FIXME in the driver ;)

> > So either it is floating or pulled up by default? Since it works
> > now I don't see any reason to block it. On the other hand once
> > that binding is introduced it would be nice to add it for power
> > management reasons.
> 
> Should I just add comment about it or do something like this:
> 
> &codec {
>   status = "okay";
>   /*
>    * TODO: Add codec_ext_pwr_pin to turn off external audio AMP
>    &pio {
>      codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
>        allwinner,pins = "PH15";
>        allwinner,function = "gpio_out";
>        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
>        allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
>      }
>    }
>    */
> }

More like

&pio {
	codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
		allwinner,pins = "PH15";
		allwinner,function = "gpio_out";
		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
	};
};

&codec {
	/* This pin is used to turn off the GPIO amp pin */
	pinctrl-names = "default";
	pinctrl-0 <&codec_ext_pwr_pin>;
	status = "okay";
};

Of course, that's a temporary measure, and you should actually use
that GPIO to enable / disable the Amplifier when you are playing
sound. It shouldn't be that hard with ASoC.

Maxime
Chen-Yu Tsai Nov. 20, 2015, 2:56 a.m. UTC | #4
On Fri, Nov 20, 2015 at 12:09 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Thu, Nov 12, 2015 at 08:53:19PM +0200, Priit Laes wrote:
>> On Mon, 2015-11-09 at 11:59 +0800, Chen-Yu Tsai wrote:
>> > On Sat, Nov 7, 2015 at 1:54 AM, Priit Laes <plaes@plaes.org> wrote:
>> > > Gemei G9 has internal speakers and headphone jack. Audio switching
>> > > from internal speakers to headphones is automatically handled by
>> > > extra FT2012Q audio amplifier chip that works out of the box.
>> >
>> > Nice that it works out of the box. The FEX file does mention:
>> >
>> > audio_pa_ctrl   = port:PH15<1><default><default><0>
>>
>> Nice catch.
>>
>> Setting it low mutes audio, and setting it back high unmutes.
>
> Then you just volunteered yourself to fix the FIXME in the driver ;)
>

Hans seems to have a patch for this in his sunxi-wip branch.
I haven't looked at it though.

ChenYu

>> > So either it is floating or pulled up by default? Since it works
>> > now I don't see any reason to block it. On the other hand once
>> > that binding is introduced it would be nice to add it for power
>> > management reasons.
>>
>> Should I just add comment about it or do something like this:
>>
>> &codec {
>>   status = "okay";
>>   /*
>>    * TODO: Add codec_ext_pwr_pin to turn off external audio AMP
>>    &pio {
>>      codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
>>        allwinner,pins = "PH15";
>>        allwinner,function = "gpio_out";
>>        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
>>        allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
>>      }
>>    }
>>    */
>> }
>
> More like
>
> &pio {
>         codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
>                 allwinner,pins = "PH15";
>                 allwinner,function = "gpio_out";
>                 allwinner,drive = <SUN4I_PINCTRL_10_MA>;
>                 allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
>         };
> };
>
> &codec {
>         /* This pin is used to turn off the GPIO amp pin */
>         pinctrl-names = "default";
>         pinctrl-0 <&codec_ext_pwr_pin>;
>         status = "okay";
> };
>
> Of course, that's a temporary measure, and you should actually use
> that GPIO to enable / disable the Amplifier when you are playing
> sound. It shouldn't be that hard with ASoC.
>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
Hans de Goede Nov. 20, 2015, 8:23 a.m. UTC | #5
Hi,

On 20-11-15 03:56, Chen-Yu Tsai wrote:
> On Fri, Nov 20, 2015 at 12:09 AM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
>> Hi,
>>
>> On Thu, Nov 12, 2015 at 08:53:19PM +0200, Priit Laes wrote:
>>> On Mon, 2015-11-09 at 11:59 +0800, Chen-Yu Tsai wrote:
>>>> On Sat, Nov 7, 2015 at 1:54 AM, Priit Laes <plaes@plaes.org> wrote:
>>>>> Gemei G9 has internal speakers and headphone jack. Audio switching
>>>>> from internal speakers to headphones is automatically handled by
>>>>> extra FT2012Q audio amplifier chip that works out of the box.
>>>>
>>>> Nice that it works out of the box. The FEX file does mention:
>>>>
>>>> audio_pa_ctrl   = port:PH15<1><default><default><0>
>>>
>>> Nice catch.
>>>
>>> Setting it low mutes audio, and setting it back high unmutes.
>>
>> Then you just volunteered yourself to fix the FIXME in the driver ;)
>>
>
> Hans seems to have a patch for this in his sunxi-wip branch.
> I haven't looked at it though.

Right, I needed support for the pa pin on one of my own tablets, and
there things just did not work without it.

Note this patch is ready for upstream submission, I just did not get
around to submitting it yet (I wrote it Tuesday evening).

Regards,

Hans


>
> ChenYu
>
>>>> So either it is floating or pulled up by default? Since it works
>>>> now I don't see any reason to block it. On the other hand once
>>>> that binding is introduced it would be nice to add it for power
>>>> management reasons.
>>>
>>> Should I just add comment about it or do something like this:
>>>
>>> &codec {
>>>    status = "okay";
>>>    /*
>>>     * TODO: Add codec_ext_pwr_pin to turn off external audio AMP
>>>     &pio {
>>>       codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
>>>         allwinner,pins = "PH15";
>>>         allwinner,function = "gpio_out";
>>>         allwinner,drive = <SUN4I_PINCTRL_10_MA>;
>>>         allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
>>>       }
>>>     }
>>>     */
>>> }
>>
>> More like
>>
>> &pio {
>>          codec_ext_pwr_pin: codec_ext_pwr_pin@0 {
>>                  allwinner,pins = "PH15";
>>                  allwinner,function = "gpio_out";
>>                  allwinner,drive = <SUN4I_PINCTRL_10_MA>;
>>                  allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
>>          };
>> };
>>
>> &codec {
>>          /* This pin is used to turn off the GPIO amp pin */
>>          pinctrl-names = "default";
>>          pinctrl-0 <&codec_ext_pwr_pin>;
>>          status = "okay";
>> };
>>
>> Of course, that's a temporary measure, and you should actually use
>> that GPIO to enable / disable the Amplifier when you are playing
>> sound. It shouldn't be that hard with ASoC.
>>
>> Maxime
>>
>> --
>> Maxime Ripard, Free Electrons
>> Embedded Linux, Kernel and Android engineering
>> http://free-electrons.com
diff mbox

Patch

diff --git a/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts b/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
index 16c1a67..1d73a98 100644
--- a/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
+++ b/arch/arm/boot/dts/sun4i-a10-gemei-g9.dts
@@ -65,12 +65,15 @@ 
 /*
  * TODO:
  *   2x cameras via CSI
- *   audio
+ *   audio input
  *   AXP battery management
  *   NAND
  *   OTG
  *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
  */
+&codec {
+	status = "okay";
+};
 
 &cpu0 {
 	cpu-supply = <&reg_dcdc2>;