summaryrefslogtreecommitdiff
path: root/tools/src/tps6598x.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/tps6598x.h')
-rw-r--r--tools/src/tps6598x.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/src/tps6598x.h b/tools/src/tps6598x.h
new file mode 100644
index 0000000..9e6d26a
--- /dev/null
+++ b/tools/src/tps6598x.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: MIT */
+
+#ifndef TPS6598X_H
+#define TPS6598X_H
+
+#include "i2c.h"
+#include "types.h"
+
+typedef struct tps6598x_dev tps6598x_dev_t;
+
+tps6598x_dev_t *tps6598x_init(const char *adt_path, i2c_dev_t *i2c);
+void tps6598x_shutdown(tps6598x_dev_t *dev);
+
+int tps6598x_command(tps6598x_dev_t *dev, const char *cmd, const u8 *data_in, size_t len_in,
+ u8 *data_out, size_t len_out);
+int tps6598x_powerup(tps6598x_dev_t *dev);
+
+#define CD3218B12_IRQ_WIDTH 9
+
+typedef struct tps6598x_irq_state {
+ u8 int_mask1[CD3218B12_IRQ_WIDTH];
+ bool valid;
+} tps6598x_irq_state_t;
+
+int tps6598x_disable_irqs(tps6598x_dev_t *dev, tps6598x_irq_state_t *state);
+int tps6598x_restore_irqs(tps6598x_dev_t *dev, tps6598x_irq_state_t *state);
+
+#endif