20
20
#include "hw/i2c/smbus_eeprom.h"
21
21
#include "hw/misc/pca9552.h"
22
22
#include "hw/misc/tmp105.h"
23
+ #include "hw/misc/led.h"
23
24
#include "hw/qdev-properties.h"
24
25
#include "qemu/log.h"
25
26
#include "sysemu/block-backend.h"
@@ -525,9 +526,20 @@ static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc)
525
526
526
527
static void witherspoon_bmc_i2c_init (AspeedMachineState * bmc )
527
528
{
529
+ static const struct {
530
+ unsigned gpio_id ;
531
+ LEDColor color ;
532
+ const char * description ;
533
+ bool gpio_polarity ;
534
+ } pca1_leds [] = {
535
+ {13 , LED_COLOR_GREEN , "front-fault-4" , GPIO_POLARITY_ACTIVE_LOW },
536
+ {14 , LED_COLOR_GREEN , "front-power-3" , GPIO_POLARITY_ACTIVE_LOW },
537
+ {15 , LED_COLOR_GREEN , "front-id-5" , GPIO_POLARITY_ACTIVE_LOW },
538
+ };
528
539
AspeedSoCState * soc = & bmc -> soc ;
529
540
uint8_t * eeprom_buf = g_malloc0 (8 * 1024 );
530
541
DeviceState * dev ;
542
+ LEDState * led ;
531
543
532
544
/* Bus 3: TODO bmp280@77 */
533
545
/* Bus 3: TODO max31785@52 */
@@ -538,6 +550,14 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
538
550
aspeed_i2c_get_bus (& soc -> i2c , 3 ),
539
551
& error_fatal );
540
552
553
+ for (size_t i = 0 ; i < ARRAY_SIZE (pca1_leds ); i ++ ) {
554
+ led = led_create_simple (OBJECT (bmc ),
555
+ pca1_leds [i ].gpio_polarity ,
556
+ pca1_leds [i ].color ,
557
+ pca1_leds [i ].description );
558
+ qdev_connect_gpio_out (dev , pca1_leds [i ].gpio_id ,
559
+ qdev_get_gpio_in (DEVICE (led ), 0 ));
560
+ }
541
561
i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 4 ), "tmp423" , 0x4c );
542
562
i2c_slave_create_simple (aspeed_i2c_get_bus (& soc -> i2c , 5 ), "tmp423" , 0x4c );
543
563
0 commit comments