From nobody Tue Feb 10 14:32:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) client-ip=209.85.221.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599771278; cv=none; d=zohomail.com; s=zohoarc; b=dMwRJWvfijP8fHYUjGd4pDob1WYhfssk1I5vnAdOewwcWMYG1XZC2djIgmwoI8DSf+1lRyIWNrFRNB+I46bnueLblEmyhkWjmaKSdWu7JswT78CdlGpjBueWnTchOp4WY5pfVzpPPwNI3cAKPcpIr2ckJmIfCA4e1NUPrW0ob/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599771278; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pr3IdxupnoTag8g+l9d/z4aY7eG0d/P7ZaZKT2cQb14=; b=Xe+rY/gAd8Rqr0+itBf9n3UoYBrL9x0pegJNln/HzD856WNpciAet/nZrPUlFqjjop5Sp5WVDuh3o6IRmTx6dgE/ZRPm2oFV5RUb9jhA/ea/CZ6kVgSYlF2K9h581X7xRyJQbMt9gpcLxsv4H1Gw9KqNn38bFpqGhnpbX0tFCOQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.zohomail.com with SMTPS id 1599771278748459.04997347319147; Thu, 10 Sep 2020 13:54:38 -0700 (PDT) Received: by mail-wr1-f68.google.com with SMTP id o5so8593295wrn.13 for ; Thu, 10 Sep 2020 13:54:38 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id t1sm5089317wmi.16.2020.09.10.13.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 13:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pr3IdxupnoTag8g+l9d/z4aY7eG0d/P7ZaZKT2cQb14=; b=XMJ8XoJvNLl+l/3ThwTUrJhBW/ats7GMT8TS3AGtudRW2cEklhfmlxFBeAgDr3Pzh9 X0RV2MTmz5xq1c6r195QWwKzW334K3xv2WtBCkGn0RbzJ4D4pWirWo/rV9aORCpZtOWI a9cSmkR8QNpZdfBz3pMDdY5sewQe2X+Xhnceqmcy+lE4wtx7X4h2VZQY7KUteac7hGdJ Skhxzq5CdUvVBJVP6uPjF4bzG6KlWXv50HNLeWsPcF89rH3viTwSI2sXhp/77fpnJCdj GOk8qX1qBsJxDwv/mAGQ1fLTUTgBcLGz67ePVf+L7z/3gxow7lr+g7YKhLrFZyKm8oJl xUGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pr3IdxupnoTag8g+l9d/z4aY7eG0d/P7ZaZKT2cQb14=; b=lrVclHmK7NkirDcd3+pCdGKlDIzdavfoMMpA/rgEov67cadnEnKPrXPJjuZjWwUqtA BqBsyef0iSXzZ7K/tK26sKCoHp21MbJRTOIhjyosJkKjo5RxxWuaLtfNxEjkiNFF6uk3 QcZqiMDudOM3xKKuCM92t5rNzgcgAAg7wPfW7ckF6mHpPl6f5/Bj7gfoqo6SoAJ1tm4b gIp8tYT4yP5mdgtDo3dXUTLPNChM2+/qF0Im8Ku4g/eE7dt0l/xdtm/ZQD/7jcVHARNj mZtusPUMXH5oO+S1DxuimwMsUxzm+OwqaT2whCs715LQMJiRHYe+duTs81+eLQwHoz1F DfcA== X-Gm-Message-State: AOAM533NgUID0tAQdLWpqf42P25kiWT7LNZXl1jQ5maHtqPHQq06ELOk wypnqOaWpKPW18JNqjBv8m4= X-Google-Smtp-Source: ABdhPJyYEhLk0L+LnTwtisIRLRf3X/QyUVGGGaYFyN+gRx0E9MwrlbIDeDtZpAWA5R0JrOolmp4QGg== X-Received: by 2002:adf:8b48:: with SMTP id v8mr10930209wra.21.1599771276760; Thu, 10 Sep 2020 13:54:36 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , Luc Michel , Andrzej Zaborowski , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Joel Stanley , Peter Maydell , Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Jeffery , qemu-arm@nongnu.org, Richard Henderson Subject: [PATCH v5 4/7] hw/arm/aspeed: Add the 3 front LEDs drived by the PCA9552 #1 Date: Thu, 10 Sep 2020 22:54:26 +0200 Message-Id: <20200910205429.727766-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200910205429.727766-1-f4bug@amsat.org> References: <20200910205429.727766-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) 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:gre= en intensity 0% -> 100% 1592693373.997632:led_change_intensity LED desc:'front-power-3' color:gre= en 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:gre= en intensity 100% -> 0% 1592693500.312041:led_change_intensity LED desc:'front-power-3' color:gre= en intensity 0% -> 100% 1592693500.821254:led_change_intensity LED desc:'front-power-3' color:gre= en intensity 100% -> 0% 1592693501.331517:led_change_intensity LED desc:'front-power-3' color:gre= en intensity 0% -> 100% 1592693501.841367:led_change_intensity LED desc:'front-power-3' color:gre= en intensity 100% -> 0% 1592693502.350839:led_change_intensity LED desc:'front-power-3' color:gre= en intensity 0% -> 100% 1592693502.861134:led_change_intensity LED desc:'front-power-3' color:gre= en intensity 100% -> 0% 1592693503.371090:led_change_intensity LED desc:'front-power-3' color:gre= en 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=C3=A9 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) =20 static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc) { + static const struct { + unsigned gpio_id; + LEDColor color; + const char *description; + bool gpio_polarity; + } pca1_leds[] =3D { + {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 =3D &bmc->soc; uint8_t *eeprom_buf =3D g_malloc0(8 * 1024); DeviceState *dev; + LEDState *led; =20 /* Bus 3: TODO bmp280@77 */ /* Bus 3: TODO max31785@52 */ @@ -534,6 +546,14 @@ static void witherspoon_bmc_i2c_init(AspeedMachineStat= e *bmc) aspeed_i2c_get_bus(&soc->i2c, 3), &error_fatal); =20 + for (size_t i =3D 0; i < ARRAY_SIZE(pca1_leds); i++) { + led =3D 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", 0x= 4c); i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x= 4c); =20 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 =20 config MPS2 bool --=20 2.26.2