1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2021, IBM Corp. */
3 
4 #ifndef __KCS_BMC_CONSUMER_H__
5 #define __KCS_BMC_CONSUMER_H__
6 
7 #include <linux/irqreturn.h>
8 
9 #include "kcs_bmc.h"
10 
11 struct kcs_bmc_driver_ops {
12 	int (*add_device)(struct kcs_bmc_device *kcs_bmc);
13 	int (*remove_device)(struct kcs_bmc_device *kcs_bmc);
14 };
15 
16 struct kcs_bmc_driver {
17 	struct list_head entry;
18 
19 	const struct kcs_bmc_driver_ops *ops;
20 };
21 
22 struct kcs_bmc_client_ops {
23 	irqreturn_t (*event)(struct kcs_bmc_client *client);
24 };
25 
26 struct kcs_bmc_client {
27 	const struct kcs_bmc_client_ops *ops;
28 
29 	struct kcs_bmc_device *dev;
30 };
31 
32 void kcs_bmc_register_driver(struct kcs_bmc_driver *drv);
33 void kcs_bmc_unregister_driver(struct kcs_bmc_driver *drv);
34 
35 int kcs_bmc_enable_device(struct kcs_bmc_device *kcs_bmc, struct kcs_bmc_client *client);
36 void kcs_bmc_disable_device(struct kcs_bmc_device *kcs_bmc, struct kcs_bmc_client *client);
37 
38 void kcs_bmc_update_event_mask(struct kcs_bmc_device *kcs_bmc, u8 mask, u8 events);
39 
40 u8 kcs_bmc_read_data(struct kcs_bmc_device *kcs_bmc);
41 void kcs_bmc_write_data(struct kcs_bmc_device *kcs_bmc, u8 data);
42 u8 kcs_bmc_read_status(struct kcs_bmc_device *kcs_bmc);
43 void kcs_bmc_write_status(struct kcs_bmc_device *kcs_bmc, u8 data);
44 void kcs_bmc_update_status(struct kcs_bmc_device *kcs_bmc, u8 mask, u8 val);
45 #endif
46