Skip to content

Commit 0d77676

Browse files
committed
bh_chip: add error logging to therm trip and pgood gpio setups
Enable logging for bh_chip in case there are any errors in setting up the therm trip or pgood gpios. Also remove unused function declaration from bh_chip.h. Signed-off-by: Petra Alexson <[email protected]>
1 parent 3a41d93 commit 0d77676

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

include/tenstorrent/bh_chip.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ int bh_chip_reset_chip(struct bh_chip *chip, bool force_reset);
141141
int therm_trip_gpio_setup(struct bh_chip *chip);
142142
int pgood_gpio_setup(struct bh_chip *chip);
143143

144-
void pgood_fault_work_handler(struct k_work *work);
145-
146144
#ifdef __cplusplus
147145
}
148146
#endif

lib/tenstorrent/bh_chip/bh_chip.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include <tenstorrent/fan_ctrl.h>
1111
#include <tenstorrent/event.h>
1212
#include <zephyr/kernel.h>
13+
#include <zephyr/logging/log.h>
14+
#include <string.h>
15+
16+
LOG_MODULE_REGISTER(bh_chip, CONFIG_TT_BH_CHIP_LOG_LEVEL);
1317

1418
void bh_chip_cancel_bus_transfer_set(struct bh_chip *dev)
1519
{
@@ -126,15 +130,20 @@ int therm_trip_gpio_setup(struct bh_chip *chip)
126130

127131
ret = gpio_pin_configure_dt(&chip->config.therm_trip, GPIO_INPUT);
128132
if (ret != 0) {
133+
LOG_ERR("%s() failed: %d", "gpio_pin_configure_dt", ret);
129134
return ret;
130135
}
131136
gpio_init_callback(&chip->therm_trip_cb, therm_trip_detected,
132137
BIT(chip->config.therm_trip.pin));
133138
ret = gpio_add_callback_dt(&chip->config.therm_trip, &chip->therm_trip_cb);
134139
if (ret != 0) {
140+
LOG_ERR("%s() failed: %d", "gpio_add_callback_dt", ret);
135141
return ret;
136142
}
137143
ret = gpio_pin_interrupt_configure_dt(&chip->config.therm_trip, GPIO_INT_EDGE_TO_ACTIVE);
144+
if (ret != 0) {
145+
LOG_ERR("%s() failed: %d", "gpio_pin_interrupt_configure_dt", ret);
146+
}
138147

139148
return ret;
140149
}
@@ -160,15 +169,19 @@ int pgood_gpio_setup(struct bh_chip *chip)
160169

161170
ret = gpio_pin_configure_dt(&chip->config.pgood, GPIO_INPUT);
162171
if (ret != 0) {
172+
LOG_ERR("%s() failed: %d", "gpio_pin_configure_dt", ret);
163173
return ret;
164174
}
165175
gpio_init_callback(&chip->pgood_cb, pgood_change_detected, BIT(chip->config.pgood.pin));
166176
ret = gpio_add_callback_dt(&chip->config.pgood, &chip->pgood_cb);
167177
if (ret != 0) {
178+
LOG_ERR("%s() failed: %d", "gpio_add_callback_dt", ret);
168179
return ret;
169180
}
170-
171181
ret = gpio_pin_interrupt_configure_dt(&chip->config.pgood, GPIO_INT_EDGE_BOTH);
182+
if (ret != 0) {
183+
LOG_ERR("%s() failed: %d", "gpio_pin_interrupt_configure_dt", ret);
184+
}
172185

173186
return ret;
174187
}

0 commit comments

Comments
 (0)