On 2015/12/4 22:10, Igor Mammedov wrote:
> On Mon, 16 Nov 2015 21:23:07 +0800
> shannon.z...@linaro.org wrote:
> 
>> From: Shannon Zhao <shannon.z...@linaro.org>
>>
>> Here GPIO pin 3 is used for Power Button, add _E03 in ACPI DSDT table.
>>
>> Signed-off-by: Shannon Zhao <zhaoshengl...@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.z...@linaro.org>
>> Tested-by: Wei Huang <w...@redhat.com>
>> ---
>>  hw/arm/virt-acpi-build.c | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
>> index b25c90b..12c9e8b 100644
>> --- a/hw/arm/virt-acpi-build.c
>> +++ b/hw/arm/virt-acpi-build.c
>> @@ -337,6 +337,19 @@ static void acpi_dsdt_add_gpio(Aml *scope, const 
>> MemMapEntry *gpio_memmap,
>>      aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
>>                                    AML_EXCLUSIVE, gpio_irq));
>>      aml_append(dev, aml_name_decl("_CRS", crs));
>> +
>> +    Aml *aei = aml_resource_template();
>> +    /* Pin 3 for power button */
>> +    int32_t pin_num[1] = {3};
>> +    aml_append(aei, aml_gpio_int(AML_CONSUMER_PRODUCER, AML_EDGE,
>> +                                 AML_ACTIVE_HIGH, AML_EXCLUSIVE, 
>> AML_PULL_UP, 0,
>> +                                 pin_num, 1, "GPO0", NULL));
>> +    aml_append(dev, aml_name_decl("_AEI", aei));
>> +
>> +    /* _E03 is handle for power button */
>> +    Aml *method = aml_method("_E03", 0);
>> +    aml_append(method, aml_notify(aml_name("PWRB"), aml_int(0x80)));
> you use "PWRB" here the second time, perhaps it would be better to use macro
> #define ACPI_POWER_BUTTON_DEVICE "PWRB"
> 
Sure, thanks!

-- 
Shannon


Reply via email to