Received: by 2002:ac2:5042:0:0:0:0:0 with SMTP id a2csp2921841lfm; Mon, 22 Jun 2020 00:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuvwCErn44RqYtmDZaOXGLhbKYq+uAWUYzsQv7TiM25aFGmizsD9TqgMsTVKMP9oBVJD3X X-Received: by 2002:a25:bd47:: with SMTP id p7mr25199541ybm.39.1592809305264; Mon, 22 Jun 2020 00:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592809305; cv=none; d=google.com; s=arc-20160816; b=mdO2tZ2cKgSaJtohEyyeTjnonwopl26XKK87njpQ1y7JaYeGWHEd3zgyQcvLPo9AyJ ti0XHeiM+AsWl2UGdANgXHuoeTOKR5+mv18dDY15OY/zq3TGPRwOg+aG8cS93/UMChAg II8JDjzpAqyz43OIBQIPsMgMOW/AJbk3FHt5gJUYcZlJuaDaGeUejbz9iO5RXfPRJbos 6zI+XB3sVQ0GXRWpfGBA9en/xO2eXJGtkwk0i/hC42WfzDtn+b8ZwojUZdpcFs8Z6dW3 uDztlgFBkw10bnFmYEUUGuNq41OzJq9LhWsOwzHp/lxHcV+vudTnA/dSxGl4eLiqPjQn GuBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=qE7MnJzIUPJQ2Xtcb9UhT2awC/LiS5wH/YSy3mubpoA=; b=dIVRz76xcCOrwVa/0Y4dTRDIexS4T/hxErMMBhjSP6d1XLSHEQ80XUP1n95HNaGCRq Qy2818IOjkBvbPObYefLt0wLeDvoFlx5NRzjYHDEIFc8nvMwPUBht1KP0MRnNUIkpfbF aQD6Beo/Tko6aIW2judNxAMmE2LM0ZMyT4HbnI0ihD2RDYBk1cyD4apFG5GfAPn2rFw9 yJnyk3ZxBBOkegP6EgaKbPt6X1kSOgum15G9dgBi74iIWP30ib6f6ANzic197gSFuUx2 7Kz/FlSuMNBBlS0vTiW/akCRWMDN9VVih35J0mFHh7e4xntaTFW218s3uihWFjyTeVSo 0Wtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f123si13601536ybg.424.2020.06.22.00.01.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jun 2020 00:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:38312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnGSe-0008Vy-LJ for alex.bennee@linaro.org; Mon, 22 Jun 2020 03:01:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnGSF-0008St-70 for qemu-arm@nongnu.org; Mon, 22 Jun 2020 03:01:19 -0400 Received: from 10.mo177.mail-out.ovh.net ([46.105.73.133]:33617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnGSD-00046l-1T for qemu-arm@nongnu.org; Mon, 22 Jun 2020 03:01:18 -0400 Received: from player734.ha.ovh.net (unknown [10.108.42.82]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id B42F813123C for ; Mon, 22 Jun 2020 09:01:13 +0200 (CEST) Received: from kaod.org (lfbn-tou-1-921-245.w86-210.abo.wanadoo.fr [86.210.152.245]) (Authenticated sender: clg@kaod.org) by player734.ha.ovh.net (Postfix) with ESMTPSA id EB30E1372A9F4; Mon, 22 Jun 2020 07:01:05 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-106R0062547f419-40b9-4bb2-ac8c-1091180729f0,D5B34DF2F1998B4AFDB97B5973F1BB92C24DD330) smtp.auth=clg@kaod.org Subject: Re: [PATCH v4 7/8] hw/misc/pca9552: Trace GPIO change events To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20200620225854.31160-1-f4bug@amsat.org> <20200620225854.31160-8-f4bug@amsat.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Mon, 22 Jun 2020 09:01:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200620225854.31160-8-f4bug@amsat.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 6285054758826249131 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrudekuddguddtfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeevrogurhhitggpnfgvpgfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepgeeihfekfeduiefhhfdvleduheduleekgedtieelgfehfffhveeikeduhfffgeehnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkpheptddrtddrtddrtddpkeeirddvuddtrdduhedvrddvgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdqrghrmhesnhhonhhgnhhurdhorhhg Received-SPF: pass client-ip=46.105.73.133; envelope-from=clg@kaod.org; helo=10.mo177.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/22 03:01:14 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , Corey Minyard , qemu-arm@nongnu.org, Joel Stanley , Peter Maydell Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: 2TyOdHUsT5Yl On 6/21/20 12:58 AM, Philippe Mathieu-Daudé wrote: > Emit a trace event when a GPIO change its state. I understand now why you need 'pin_status'. We could compute 'pin_status' and 'pin_changed' in routine pca9552_update_pin_input() when updating the PCA9552_INPUT0/1 register values and pass them to pca9552_display_pins_status() or something like that. Maybe add two different display routines also. > > Example booting obmc-phosphor-image: > > $ qemu-system-arm -M witherspoon-bmc -trace pca9552_gpio_change > 1592690552.687372:pca9552_gpio_change pca1 GPIO id:0 status: 0 -> 1 > 1592690552.690169:pca9552_gpio_change pca1 GPIO id:1 status: 0 -> 1 > 1592690552.691673:pca9552_gpio_change pca1 GPIO id:2 status: 0 -> 1 > 1592690552.696886:pca9552_gpio_change pca1 GPIO id:3 status: 0 -> 1 > 1592690552.698614:pca9552_gpio_change pca1 GPIO id:13 status: 0 -> 1 > 1592690552.699833:pca9552_gpio_change pca1 GPIO id:14 status: 0 -> 1 > 1592690552.700842:pca9552_gpio_change pca1 GPIO id:15 status: 0 -> 1 > 1592690683.841921:pca9552_gpio_change pca1 GPIO id:14 status: 1 -> 0 > 1592690683.861660:pca9552_gpio_change pca1 GPIO id:14 status: 0 -> 1 > 1592690684.371460:pca9552_gpio_change pca1 GPIO id:14 status: 1 -> 0 > 1592690684.882115:pca9552_gpio_change pca1 GPIO id:14 status: 0 -> 1 > 1592690685.391411:pca9552_gpio_change pca1 GPIO id:14 status: 1 -> 0 > 1592690685.901391:pca9552_gpio_change pca1 GPIO id:14 status: 0 -> 1 > 1592690686.411678:pca9552_gpio_change pca1 GPIO id:14 status: 1 -> 0 > 1592690686.921279:pca9552_gpio_change pca1 GPIO id:14 status: 0 -> 1 > > We notice the GPIO #14 (front-power LED) starts to blink. > > This LED is described in the witherspoon device-tree [*]: > > front-power { > retain-state-shutdown; > default-state = "keep"; > gpios = <&pca0 14 GPIO_ACTIVE_LOW>; > }; > > [*] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts?id=b1f9be9392f0#n140 > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/misc/pca9552.c | 15 +++++++++++++++ > hw/misc/trace-events | 1 + > 2 files changed, 16 insertions(+) > > diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c > index f0d435e310..85557b78d9 100644 > --- a/hw/misc/pca9552.c > +++ b/hw/misc/pca9552.c > @@ -60,6 +60,21 @@ static void pca9552_display_pins_status(PCA9552State *s) > buf[i] = '\0'; > trace_pca9552_gpio_status(s->description, buf); > } > + if (trace_event_get_state_backends(TRACE_PCA9552_GPIO_CHANGE)) { > + for (i = 0; i < s->nr_leds; i++) { > + if (extract32(pins_changed, i, 1)) { > + unsigned new_state = extract32(pins_status, i, 1); > + > + /* > + * We display the state using the PCA logic ("active-high"). > + * This is not the state of the LED, which signal might be > + * wired "active-low" on the board. > + */ > + trace_pca9552_gpio_change(s->description, i, > + !new_state, new_state); > + } > + } > + } > } > > static void pca9552_update_pin_input(PCA9552State *s) > diff --git a/hw/misc/trace-events b/hw/misc/trace-events > index 7630e59652..805d2110e0 100644 > --- a/hw/misc/trace-events > +++ b/hw/misc/trace-events > @@ -209,3 +209,4 @@ grlib_apb_pnp_read(uint64_t addr, uint32_t value) "APB PnP read addr:0x%03"PRIx6 > > # pca9552.c > pca9552_gpio_status(const char *description, const char *buf) "%s GPIOs 0-15 [%s]" > +pca9552_gpio_change(const char *description, unsigned id, unsigned prev_state, unsigned current_state) "%s GPIO id:%u status: %u -> %u" >