* [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
@ 2018-02-09 14:23 Carlo Caione
2018-02-09 14:50 ` Andy Shevchenko
2018-02-15 9:11 ` Carlo Caione
0 siblings, 2 replies; 7+ messages in thread
From: Carlo Caione @ 2018-02-09 14:23 UTC (permalink / raw)
To: linux, bardliao, oder_chiou, alsa-devel, linux-kernel, andy.shevchenko
Cc: Carlo Caione
From: Carlo Caione <carlo@endlessm.com>
On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
the rt5645 driver to enable the jack detection also on non-DT platforms.
Method (_CRS, 0, NotSerialized)
{
Name (SBUF, ResourceTemplate ()
{
I2cSerialBusV2 (0x001A, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C2",
0x00, ResourceConsumer, , Exclusive,
)
GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x0000,
"\\_SB.GPO3", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x004F
}
GpioIo (Shared, PullDefault, 0x0000, 0x0000, IoRestrictionInputOnly,
"\\_SB.GPO3", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x004F
}
})
Return (SBUF) /* \_SB_.PCI0.I2C2.RTK2._CRS.SBUF */
}
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Carlo Caione <carlo@endlessm.com>
---
Changelog:
v2:
- s/ACPI_HANDLE/has_acpi_companion/
---
sound/soc/codecs/rt5645.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 8f140c8b93ac..8e3d1e4ddb63 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3764,6 +3764,13 @@ static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
return 0;
}
+static const struct acpi_gpio_params hp_detect_gpios = { 1, 0, false };
+
+static const struct acpi_gpio_mapping cht_rt5645_gpios[] = {
+ { "hp-detect-gpios", &hp_detect_gpios, 1 },
+ {},
+};
+
static int rt5645_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -3779,6 +3786,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
if (rt5645 == NULL)
return -ENOMEM;
+ if (has_acpi_companion(&i2c->dev))
+ if (devm_acpi_dev_add_driver_gpios(&i2c->dev, cht_rt5645_gpios))
+ dev_dbg(&i2c->dev, "Failed to add driver gpios\n");
+
rt5645->i2c = i2c;
i2c_set_clientdata(i2c, rt5645);
--
2.14.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
2018-02-09 14:23 [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO Carlo Caione
@ 2018-02-09 14:50 ` Andy Shevchenko
2018-02-15 9:11 ` Carlo Caione
1 sibling, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2018-02-09 14:50 UTC (permalink / raw)
To: Carlo Caione
Cc: Linux Upstreaming Team, Bard Liao, Oder Chiou,
ALSA Development Mailing List, Linux Kernel Mailing List,
Carlo Caione
On Fri, Feb 9, 2018 at 4:23 PM, Carlo Caione <carlo@caione.org> wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
> the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
> the rt5645 driver to enable the jack detection also on non-DT platforms.
>
> Method (_CRS, 0, NotSerialized)
> {
> Name (SBUF, ResourceTemplate ()
> {
> I2cSerialBusV2 (0x001A, ControllerInitiated, 0x00061A80,
> AddressingMode7Bit, "\\_SB.PCI0.I2C2",
> 0x00, ResourceConsumer, , Exclusive,
> )
> GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x0000,
> "\\_SB.GPO3", 0x00, ResourceConsumer, ,
> )
> { // Pin list
> 0x004F
> }
> GpioIo (Shared, PullDefault, 0x0000, 0x0000, IoRestrictionInputOnly,
> "\\_SB.GPO3", 0x00, ResourceConsumer, ,
> )
> { // Pin list
> 0x004F
> }
> })
> Return (SBUF) /* \_SB_.PCI0.I2C2.RTK2._CRS.SBUF */
> }
>
Sorry everyone, hit reply only to Carlo, but everything he addressed
here is like I proposed.
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Carlo Caione <carlo@endlessm.com>
> ---
>
> Changelog:
>
> v2:
> - s/ACPI_HANDLE/has_acpi_companion/
> ---
> sound/soc/codecs/rt5645.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
> index 8f140c8b93ac..8e3d1e4ddb63 100644
> --- a/sound/soc/codecs/rt5645.c
> +++ b/sound/soc/codecs/rt5645.c
> @@ -3764,6 +3764,13 @@ static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
> return 0;
> }
>
> +static const struct acpi_gpio_params hp_detect_gpios = { 1, 0, false };
> +
> +static const struct acpi_gpio_mapping cht_rt5645_gpios[] = {
> + { "hp-detect-gpios", &hp_detect_gpios, 1 },
> + {},
> +};
> +
> static int rt5645_i2c_probe(struct i2c_client *i2c,
> const struct i2c_device_id *id)
> {
> @@ -3779,6 +3786,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
> if (rt5645 == NULL)
> return -ENOMEM;
>
> + if (has_acpi_companion(&i2c->dev))
> + if (devm_acpi_dev_add_driver_gpios(&i2c->dev, cht_rt5645_gpios))
> + dev_dbg(&i2c->dev, "Failed to add driver gpios\n");
> +
> rt5645->i2c = i2c;
> i2c_set_clientdata(i2c, rt5645);
>
> --
> 2.14.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
@ 2018-02-09 14:50 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2018-02-09 14:50 UTC (permalink / raw)
To: Carlo Caione
Cc: Oder Chiou, ALSA Development Mailing List,
Linux Kernel Mailing List, Carlo Caione, Bard Liao,
Linux Upstreaming Team
On Fri, Feb 9, 2018 at 4:23 PM, Carlo Caione <carlo@caione.org> wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
> the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
> the rt5645 driver to enable the jack detection also on non-DT platforms.
>
> Method (_CRS, 0, NotSerialized)
> {
> Name (SBUF, ResourceTemplate ()
> {
> I2cSerialBusV2 (0x001A, ControllerInitiated, 0x00061A80,
> AddressingMode7Bit, "\\_SB.PCI0.I2C2",
> 0x00, ResourceConsumer, , Exclusive,
> )
> GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x0000,
> "\\_SB.GPO3", 0x00, ResourceConsumer, ,
> )
> { // Pin list
> 0x004F
> }
> GpioIo (Shared, PullDefault, 0x0000, 0x0000, IoRestrictionInputOnly,
> "\\_SB.GPO3", 0x00, ResourceConsumer, ,
> )
> { // Pin list
> 0x004F
> }
> })
> Return (SBUF) /* \_SB_.PCI0.I2C2.RTK2._CRS.SBUF */
> }
>
Sorry everyone, hit reply only to Carlo, but everything he addressed
here is like I proposed.
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Carlo Caione <carlo@endlessm.com>
> ---
>
> Changelog:
>
> v2:
> - s/ACPI_HANDLE/has_acpi_companion/
> ---
> sound/soc/codecs/rt5645.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
> index 8f140c8b93ac..8e3d1e4ddb63 100644
> --- a/sound/soc/codecs/rt5645.c
> +++ b/sound/soc/codecs/rt5645.c
> @@ -3764,6 +3764,13 @@ static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
> return 0;
> }
>
> +static const struct acpi_gpio_params hp_detect_gpios = { 1, 0, false };
> +
> +static const struct acpi_gpio_mapping cht_rt5645_gpios[] = {
> + { "hp-detect-gpios", &hp_detect_gpios, 1 },
> + {},
> +};
> +
> static int rt5645_i2c_probe(struct i2c_client *i2c,
> const struct i2c_device_id *id)
> {
> @@ -3779,6 +3786,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
> if (rt5645 == NULL)
> return -ENOMEM;
>
> + if (has_acpi_companion(&i2c->dev))
> + if (devm_acpi_dev_add_driver_gpios(&i2c->dev, cht_rt5645_gpios))
> + dev_dbg(&i2c->dev, "Failed to add driver gpios\n");
> +
> rt5645->i2c = i2c;
> i2c_set_clientdata(i2c, rt5645);
>
> --
> 2.14.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
2018-02-09 14:23 [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO Carlo Caione
@ 2018-02-15 9:11 ` Carlo Caione
2018-02-15 9:11 ` Carlo Caione
1 sibling, 0 replies; 7+ messages in thread
From: Carlo Caione @ 2018-02-15 9:11 UTC (permalink / raw)
To: open list
Cc: Linux Upstreaming Team, bardliao, oder_chiou, alsa-devel,
Andy Shevchenko, Carlo Caione, Hans De Goede
On Fri, Feb 9, 2018 at 2:23 PM, Carlo Caione <carlo@caione.org> wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
> the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
> the rt5645 driver to enable the jack detection also on non-DT platforms.
Please do not merge this yet, I'll submit a V3 soon.
Hans pointed out that on some BayTrail there is indeed an extra GPIO
but it is used to enable the external speaker amplifier. Better to
guard this by a quirk.
Cheers,
--
Carlo Caione
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
@ 2018-02-15 9:11 ` Carlo Caione
0 siblings, 0 replies; 7+ messages in thread
From: Carlo Caione @ 2018-02-15 9:11 UTC (permalink / raw)
To: open list
Cc: oder_chiou, alsa-devel, Hans De Goede, Andy Shevchenko,
Carlo Caione, bardliao, Linux Upstreaming Team
On Fri, Feb 9, 2018 at 2:23 PM, Carlo Caione <carlo@caione.org> wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
> the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
> the rt5645 driver to enable the jack detection also on non-DT platforms.
Please do not merge this yet, I'll submit a V3 soon.
Hans pointed out that on some BayTrail there is indeed an extra GPIO
but it is used to enable the external speaker amplifier. Better to
guard this by a quirk.
Cheers,
--
Carlo Caione
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
2018-02-15 9:11 ` Carlo Caione
@ 2018-02-15 9:17 ` Hans de Goede
-1 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2018-02-15 9:17 UTC (permalink / raw)
To: Carlo Caione, open list
Cc: Linux Upstreaming Team, bardliao, oder_chiou, alsa-devel,
Andy Shevchenko, Carlo Caione
Hi,
On 15-02-18 10:11, Carlo Caione wrote:
> On Fri, Feb 9, 2018 at 2:23 PM, Carlo Caione <carlo@caione.org> wrote:
>> From: Carlo Caione <carlo@endlessm.com>
>>
>> On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
>> the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
>> the rt5645 driver to enable the jack detection also on non-DT platforms.
>
> Please do not merge this yet, I'll submit a V3 soon.
> Hans pointed out that on some BayTrail there is indeed an extra GPIO
> but it is used to enable the external speaker amplifier. Better to
> guard this by a quirk.
Thank you Carlo, note that the tablet I was talking about is a rt5651 based
tablet, but yes you never know for what reasons someone will put an extra
GPIO in the resources table, so guarding this with a quirk seems like a good
idea.
Regards,
Hans
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO
@ 2018-02-15 9:17 ` Hans de Goede
0 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2018-02-15 9:17 UTC (permalink / raw)
To: Carlo Caione, open list
Cc: oder_chiou, alsa-devel, Andy Shevchenko, Carlo Caione, bardliao,
Linux Upstreaming Team
Hi,
On 15-02-18 10:11, Carlo Caione wrote:
> On Fri, Feb 9, 2018 at 2:23 PM, Carlo Caione <carlo@caione.org> wrote:
>> From: Carlo Caione <carlo@endlessm.com>
>>
>> On at least one notebook (ECS EF20EA) the 'hp-detect' GPIO is defined in
>> the DSDT table by the ACPI GpioIo resources in _CRS. Add this mapping to
>> the rt5645 driver to enable the jack detection also on non-DT platforms.
>
> Please do not merge this yet, I'll submit a V3 soon.
> Hans pointed out that on some BayTrail there is indeed an extra GPIO
> but it is used to enable the external speaker amplifier. Better to
> guard this by a quirk.
Thank you Carlo, note that the tablet I was talking about is a rt5651 based
tablet, but yes you never know for what reasons someone will put an extra
GPIO in the resources table, so guarding this with a quirk seems like a good
idea.
Regards,
Hans
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-02-15 9:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 14:23 [PATCH v2] ASoC: rt5645: Introduce mapping for ACPI-defined GPIO Carlo Caione
2018-02-09 14:50 ` Andy Shevchenko
2018-02-09 14:50 ` Andy Shevchenko
2018-02-15 9:11 ` Carlo Caione
2018-02-15 9:11 ` Carlo Caione
2018-02-15 9:17 ` Hans de Goede
2018-02-15 9:17 ` Hans de Goede
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.