blob: beaf6c9804eb9269b366765ffea9bcf16e48d9c2 [file] [log] [blame]
Vinod Koul2f52a512017-12-14 11:19:41 +05301// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2// Copyright(c) 2015-17 Intel Corporation.
3
4#ifndef __SDW_CADENCE_H
5#define __SDW_CADENCE_H
6
7/**
8 * struct sdw_cdns - Cadence driver context
9 * @dev: Linux device
10 * @bus: Bus handle
11 * @instance: instance number
Sanyog Kale956baa12017-12-14 11:19:42 +053012 * @response_buf: SoundWire response buffer
13 * @tx_complete: Tx completion
14 * @defer: Defer pointer
Vinod Koul2f52a512017-12-14 11:19:41 +053015 * @registers: Cadence registers
16 * @link_up: Link status
Sanyog Kale956baa12017-12-14 11:19:42 +053017 * @msg_count: Messages sent on bus
Vinod Koul2f52a512017-12-14 11:19:41 +053018 */
19struct sdw_cdns {
20 struct device *dev;
21 struct sdw_bus bus;
22 unsigned int instance;
23
Sanyog Kale956baa12017-12-14 11:19:42 +053024 u32 response_buf[0x80];
25 struct completion tx_complete;
26 struct sdw_defer *defer;
27
Vinod Koul2f52a512017-12-14 11:19:41 +053028 void __iomem *registers;
29
30 bool link_up;
Sanyog Kale956baa12017-12-14 11:19:42 +053031 unsigned int msg_count;
Vinod Koul2f52a512017-12-14 11:19:41 +053032};
33
34#define bus_to_cdns(_bus) container_of(_bus, struct sdw_cdns, bus)
35
36/* Exported symbols */
37
Sanyog Kale956baa12017-12-14 11:19:42 +053038int sdw_cdns_probe(struct sdw_cdns *cdns);
39extern struct sdw_master_ops sdw_cdns_master_ops;
40
Vinod Koul2f52a512017-12-14 11:19:41 +053041irqreturn_t sdw_cdns_irq(int irq, void *dev_id);
42irqreturn_t sdw_cdns_thread(int irq, void *dev_id);
43
44int sdw_cdns_init(struct sdw_cdns *cdns);
Sanyog Kale956baa12017-12-14 11:19:42 +053045int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns);
46
Vinod Koul2f52a512017-12-14 11:19:41 +053047
48#endif /* __SDW_CADENCE_H */