From patchwork Mon Nov 16 13:23:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 56687 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1546192lbb; Mon, 16 Nov 2015 12:51:13 -0800 (PST) X-Received: by 10.129.13.213 with SMTP id 204mr41524517ywn.281.1447707070585; Mon, 16 Nov 2015 12:51:10 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i129si25123837ywc.15.2015.11.16.12.51.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Nov 2015 12:51:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dkim=fail header.i=@linaro_org.20150623.gappssmtp.com Received: from localhost ([::1]:49241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyQk1-0004a0-Uu for patch@linaro.org; Mon, 16 Nov 2015 15:51:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyJlt-0008VG-09 for qemu-devel@nongnu.org; Mon, 16 Nov 2015 08:24:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyJlp-0008AM-4T for qemu-devel@nongnu.org; Mon, 16 Nov 2015 08:24:37 -0500 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:33898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyJlo-0008AE-UG for qemu-devel@nongnu.org; Mon, 16 Nov 2015 08:24:33 -0500 Received: by wmvv187 with SMTP id v187so176114254wmv.1 for ; Mon, 16 Nov 2015 05:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HF2mFex19OaTGrFshSlX/zoSUOHHW66ad8Vz5aEgzpw=; b=HC8ujKQI2e/c8fhpLzRDTBoDN+tXxey5TnZeoVo2N7P3Ap0Kg9UjnU5PZjddTSxJGj 6RhfnGBGxnC5A4oUiphmG9XjAN+O5Dw7iaYL7VQvmtN6p6GkUCkRgSXYvHphAklm/MHC 1cKw6t4cotHw3oL4G0M8qhNmEwXM8FidHuarkvrhyPlernNbfxD1HDle4yp7QhOtlOzj MSBKLpPSenmZtInHO7TIe/jr7D+QdgiJWXG6UCxqDrqj+gkMF5zxx1YcStCtNEZXRHBQ MpSqqBTAXHJU+B3R245iqOI28nMKknR5kbRzKX0G0nlPHE1zFVyKO5HNDbUrJtN87RzH dKDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HF2mFex19OaTGrFshSlX/zoSUOHHW66ad8Vz5aEgzpw=; b=L6Vd4vH6P9i3wa1Y1AJ8Px9F4FlPhkHxNMVqQwDZwqR+KyaHWuAwCVvNSZpqw3d35E zxT8rSBoIb3HafC05pQqG7DM2tzi2nzprCyT/4WseypMRPre3wJn8url7YLhwg+HgjzN tdS6auFEUr3lSA/lX5x6BlQSv4JB1k4q6gnOtKDLkqLHXT7cCi0OoEpFYzC/RLJObi7d +J57PuA3YX9Shg5AfDcHcTmdFixnDhlHPW3JveVGTTQwEWtsSXP0PmRnYTiL17lmX4mQ ljpIZfPv4+ePTVrDjjWX05q22czwpAyGEC3A1gbsF248AW/DY+GLQgDptOBTQlpLJDiU wuGA== X-Gm-Message-State: ALoCoQmqaNGDC3TbpkVrCB5rTBYEHIn9h2lmzVmrN/O0tPIz7UARgobcqh+Z3L8Ir8u598o2xMop X-Received: by 10.194.84.4 with SMTP id u4mr37034353wjy.149.1447680272335; Mon, 16 Nov 2015 05:24:32 -0800 (PST) Received: from localhost ([78.129.130.236]) by smtp.gmail.com with ESMTPSA id w67sm18599841wmw.17.2015.11.16.05.24.30 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 16 Nov 2015 05:24:31 -0800 (PST) From: shannon.zhao@linaro.org To: qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com, imammedo@redhat.com, wei@redhat.com Date: Mon, 16 Nov 2015 21:23:09 +0800 Message-Id: <1447680189-2128-9-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447680189-2128-1-git-send-email-shannon.zhao@linaro.org> References: <1447680189-2128-1-git-send-email-shannon.zhao@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::231 Cc: zhaoshenglong@huawei.com, qemu-devel@nongnu.org, graeme.gregory@linaro.org, peter.huangpeng@huawei.com Subject: [Qemu-devel] [PATCH v3 8/8] hw/arm/virt: Add gpio-keys node for Poweroff using DT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Shannon Zhao Add a gpio-keys node. This is used for Poweroff for the systems which use DT not ACPI. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Tested-by: Wei Huang --- hw/arm/virt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.1.0 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index cb1d45b..3394262 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -561,6 +561,7 @@ static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic) pl061_dev = sysbus_create_simple("pl061", base, pic[irq]); + uint32_t phandle = qemu_fdt_alloc_phandle(vbi->fdt); nodename = g_strdup_printf("/pl061@%" PRIx64, base); qemu_fdt_add_subnode(vbi->fdt, nodename); qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg", @@ -573,6 +574,20 @@ static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic) GIC_FDT_IRQ_FLAGS_LEVEL_HI); qemu_fdt_setprop_cell(vbi->fdt, nodename, "clocks", vbi->clock_phandle); qemu_fdt_setprop_string(vbi->fdt, nodename, "clock-names", "apb_pclk"); + qemu_fdt_setprop_cell(vbi->fdt, nodename, "phandle", phandle); + + qemu_fdt_add_subnode(vbi->fdt, "/gpio-keys"); + qemu_fdt_setprop_string(vbi->fdt, "/gpio-keys", "compatible", "gpio-keys"); + qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys", "#size-cells", 0); + qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys", "#address-cells", 1); + qemu_fdt_setprop(vbi->fdt, "/gpio-keys", "autorepeat", NULL, 0); + + qemu_fdt_add_subnode(vbi->fdt, "/gpio-keys/poweroff"); + qemu_fdt_setprop_string(vbi->fdt, "/gpio-keys/poweroff", + "label", "GPIO Key Poweroff"); + qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys/poweroff", "linux,code", 116); + qemu_fdt_setprop_cells(vbi->fdt, "/gpio-keys/poweroff", + "gpios", phandle, 3, 0); /* connect powerdown request */ qemu_register_powerdown_notifier(&virt_system_powerdown_notifier);