1faae6e39SAndrew Jeffery /* SPDX-License-Identifier: GPL-2.0 */ 2faae6e39SAndrew Jeffery /* Copyright (c) 2021, IBM Corp. */ 3faae6e39SAndrew Jeffery 4faae6e39SAndrew Jeffery #ifndef __KCS_BMC_CONSUMER_H__ 5faae6e39SAndrew Jeffery #define __KCS_BMC_CONSUMER_H__ 6faae6e39SAndrew Jeffery 7faae6e39SAndrew Jeffery #include <linux/irqreturn.h> 8faae6e39SAndrew Jeffery 9d4e7ac68SAndrew Jeffery #include "kcs_bmc.h" 10faae6e39SAndrew Jeffery 117cafff99SAndrew Jeffery struct kcs_bmc_driver_ops { 127cafff99SAndrew Jeffery int (*add_device)(struct kcs_bmc_device *kcs_bmc); 137cafff99SAndrew Jeffery int (*remove_device)(struct kcs_bmc_device *kcs_bmc); 147cafff99SAndrew Jeffery }; 157cafff99SAndrew Jeffery 167cafff99SAndrew Jeffery struct kcs_bmc_driver { 177cafff99SAndrew Jeffery struct list_head entry; 187cafff99SAndrew Jeffery 197cafff99SAndrew Jeffery const struct kcs_bmc_driver_ops *ops; 207cafff99SAndrew Jeffery }; 217cafff99SAndrew Jeffery 22faae6e39SAndrew Jeffery struct kcs_bmc_client_ops { 23faae6e39SAndrew Jeffery irqreturn_t (*event)(struct kcs_bmc_client *client); 24faae6e39SAndrew Jeffery }; 25faae6e39SAndrew Jeffery 26d4e7ac68SAndrew Jeffery struct kcs_bmc_client { 27d4e7ac68SAndrew Jeffery const struct kcs_bmc_client_ops *ops; 28d4e7ac68SAndrew Jeffery 29d4e7ac68SAndrew Jeffery struct kcs_bmc_device *dev; 30d4e7ac68SAndrew Jeffery }; 31d4e7ac68SAndrew Jeffery 327cafff99SAndrew Jeffery void kcs_bmc_register_driver(struct kcs_bmc_driver *drv); 337cafff99SAndrew Jeffery void kcs_bmc_unregister_driver(struct kcs_bmc_driver *drv); 347cafff99SAndrew Jeffery 35d4e7ac68SAndrew Jeffery int kcs_bmc_enable_device(struct kcs_bmc_device *kcs_bmc, struct kcs_bmc_client *client); 36d4e7ac68SAndrew Jeffery void kcs_bmc_disable_device(struct kcs_bmc_device *kcs_bmc, struct kcs_bmc_client *client); 37d4e7ac68SAndrew Jeffery 38*28651e6cSAndrew Jeffery void kcs_bmc_update_event_mask(struct kcs_bmc_device *kcs_bmc, u8 mask, u8 events); 39*28651e6cSAndrew Jeffery 40d4e7ac68SAndrew Jeffery u8 kcs_bmc_read_data(struct kcs_bmc_device *kcs_bmc); 41d4e7ac68SAndrew Jeffery void kcs_bmc_write_data(struct kcs_bmc_device *kcs_bmc, u8 data); 42d4e7ac68SAndrew Jeffery u8 kcs_bmc_read_status(struct kcs_bmc_device *kcs_bmc); 43d4e7ac68SAndrew Jeffery void kcs_bmc_write_status(struct kcs_bmc_device *kcs_bmc, u8 data); 44d4e7ac68SAndrew Jeffery void kcs_bmc_update_status(struct kcs_bmc_device *kcs_bmc, u8 mask, u8 val); 45faae6e39SAndrew Jeffery #endif 46