From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC15EC43461 for ; Fri, 11 Sep 2020 20:03:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBAE021D79 for ; Fri, 11 Sep 2020 20:03:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=greensocs.com header.i=@greensocs.com header.b="EFdCCxQv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBAE021D79 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=greensocs.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGpGM-0006nK-F3 for qemu-devel@archiver.kernel.org; Fri, 11 Sep 2020 16:03:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGp9b-0004l4-M1; Fri, 11 Sep 2020 15:56:15 -0400 Received: from beetle.greensocs.com ([5.135.226.135]:32992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGp9Y-0003lk-NA; Fri, 11 Sep 2020 15:56:15 -0400 Received: from [172.17.10.18] (unknown [172.17.10.18]) by beetle.greensocs.com (Postfix) with ESMTPSA id 0516921C1F; Fri, 11 Sep 2020 19:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greensocs.com; s=mail; t=1599854170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j3Jp32DOmEUKD+UFTzD+kq3uK4vmAci16OFio8uGAN0=; b=EFdCCxQvy3oXZTU8J0FIGvNRpmvl6DOjgbz27CdJoafXmobvVOmaqpHmynSCBBt5OJ2Fad t8XGWPCyP6xeZ3yGzRmsSzu6Pm9xW5I/at0Ec8zDnpmvAWy+oUukeEmFPZBcrBKKUJVe5Y uU3GqpEHk7NxJeO7aAgvxISzLHml3/0= Subject: Re: [PATCH v5 4/7] hw/arm/aspeed: Add the 3 front LEDs drived by the PCA9552 #1 To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20200910205429.727766-1-f4bug@amsat.org> <20200910205429.727766-5-f4bug@amsat.org> From: Luc Michel Message-ID: <2b47f80b-0c4a-5715-af55-19c93c31e30a@greensocs.com> Date: Fri, 11 Sep 2020 21:57:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200910205429.727766-5-f4bug@amsat.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=5.135.226.135; envelope-from=luc.michel@greensocs.com; helo=beetle.greensocs.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/11 15:41:15 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-2.469, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , Eduardo Habkost , Andrew Jeffery , Richard Henderson , qemu-arm@nongnu.org, =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Paolo Bonzini , Joel Stanley Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 9/10/20 10:54 PM, Philippe Mathieu-Daudé wrote: > The Witherspoon has 3 LEDs connected to a PCA9552. Add them. > The names and reset values are taken from: > https://github.com/open-power/witherspoon-xml/blob/master/witherspoon.xml > > Example booting obmc-phosphor-image: > > $ qemu-system-arm -M witherspoon-bmc -trace led_change_intensity > 1592693373.997015:led_change_intensity LED desc:'front-fault-4' color:green intensity 0% -> 100% > 1592693373.997632:led_change_intensity LED desc:'front-power-3' color:green intensity 0% -> 100% > 1592693373.998239:led_change_intensity LED desc:'front-id-5' color:green intensity 0% -> 100% > 1592693500.291805:led_change_intensity LED desc:'front-power-3' color:green intensity 100% -> 0% > 1592693500.312041:led_change_intensity LED desc:'front-power-3' color:green intensity 0% -> 100% > 1592693500.821254:led_change_intensity LED desc:'front-power-3' color:green intensity 100% -> 0% > 1592693501.331517:led_change_intensity LED desc:'front-power-3' color:green intensity 0% -> 100% > 1592693501.841367:led_change_intensity LED desc:'front-power-3' color:green intensity 100% -> 0% > 1592693502.350839:led_change_intensity LED desc:'front-power-3' color:green intensity 0% -> 100% > 1592693502.861134:led_change_intensity LED desc:'front-power-3' color:green intensity 100% -> 0% > 1592693503.371090:led_change_intensity LED desc:'front-power-3' color:green intensity 0% -> 100% > > We notice the front-power LED starts to blink at a ~2Hz rate. > > Reviewed-by: Richard Henderson > Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Luc Michel > --- > hw/arm/aspeed.c | 20 ++++++++++++++++++++ > hw/arm/Kconfig | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c > index 8bfb1c79ddc..83e322ea983 100644 > --- a/hw/arm/aspeed.c > +++ b/hw/arm/aspeed.c > @@ -20,6 +20,7 @@ > #include "hw/i2c/smbus_eeprom.h" > #include "hw/misc/pca9552.h" > #include "hw/misc/tmp105.h" > +#include "hw/misc/led.h" > #include "hw/qdev-properties.h" > #include "qemu/log.h" > #include "sysemu/block-backend.h" > @@ -521,9 +522,20 @@ static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc) > > static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc) > { > + static const struct { > + unsigned gpio_id; > + LEDColor color; > + const char *description; > + bool gpio_polarity; > + } pca1_leds[] = { > + {13, LED_COLOR_GREEN, "front-fault-4", GPIO_POLARITY_ACTIVE_LOW}, > + {14, LED_COLOR_GREEN, "front-power-3", GPIO_POLARITY_ACTIVE_LOW}, > + {15, LED_COLOR_GREEN, "front-id-5", GPIO_POLARITY_ACTIVE_LOW}, > + }; > AspeedSoCState *soc = &bmc->soc; > uint8_t *eeprom_buf = g_malloc0(8 * 1024); > DeviceState *dev; > + LEDState *led; > > /* Bus 3: TODO bmp280@77 */ > /* Bus 3: TODO max31785@52 */ > @@ -534,6 +546,14 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc) > aspeed_i2c_get_bus(&soc->i2c, 3), > &error_fatal); > > + for (size_t i = 0; i < ARRAY_SIZE(pca1_leds); i++) { > + led = led_create_simple(OBJECT(bmc), > + pca1_leds[i].gpio_polarity, > + pca1_leds[i].color, > + pca1_leds[i].description); > + qdev_connect_gpio_out(dev, pca1_leds[i].gpio_id, > + qdev_get_gpio_in(DEVICE(led), 0)); > + } > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c); > > diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig > index bc3a423940b..06ba1c355b1 100644 > --- a/hw/arm/Kconfig > +++ b/hw/arm/Kconfig > @@ -394,6 +394,7 @@ config ASPEED_SOC > select TMP105 > select TMP421 > select UNIMP > + select LED > > config MPS2 > bool >