blob: cd93a44dba9a132923adb9cea82e774ad9fdb638 [file] [log] [blame]
Pierre-Louis Bossart23859462019-05-01 10:57:25 -05001/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
2/* Copyright(c) 2015-17 Intel Corporation. */
Vinod Koul71bb8a12017-12-14 11:19:43 +05303
4#ifndef __SDW_INTEL_LOCAL_H
5#define __SDW_INTEL_LOCAL_H
6
7/**
Pierre-Louis Bossartf98f6902019-12-11 19:45:01 -06008 * struct sdw_intel_link_res - Soundwire Intel link resource structure,
9 * typically populated by the controller driver.
Pierre-Louis Bossartf98f6902019-12-11 19:45:01 -060010 * @mmio_base: mmio base of SoundWire registers
Vinod Koul71bb8a12017-12-14 11:19:43 +053011 * @registers: Link IO registers base
12 * @shim: Audio shim pointer
13 * @alh: ALH (Audio Link Hub) pointer
14 * @irq: Interrupt line
Vinod Koulc46302e2018-04-26 18:39:05 +053015 * @ops: Shim callback ops
Rander Wang4b206d32019-12-11 19:45:02 -060016 * @dev: device implementing hw_params and free callbacks
Pierre-Louis Bossart4a17c442020-07-16 23:09:40 +080017 * @shim_lock: mutex to handle access to shared SHIM registers
18 * @shim_mask: global pointer to check SHIM register initialization
Pierre-Louis Bossarta320f412020-08-17 23:29:18 +080019 * @clock_stop_quirks: mask defining requested behavior on pm_suspend
Pierre-Louis Bossartde763fa2020-09-01 23:05:55 +080020 * @link_mask: global mask needed for power-up/down sequences
Bard Liao4a98a6b2020-07-16 23:09:45 +080021 * @cdns: Cadence master descriptor
22 * @list: used to walk-through all masters exposed by the same controller
Vinod Koul71bb8a12017-12-14 11:19:43 +053023 */
24struct sdw_intel_link_res {
Pierre-Louis Bossartf98f6902019-12-11 19:45:01 -060025 void __iomem *mmio_base; /* not strictly needed, useful for debug */
Vinod Koul71bb8a12017-12-14 11:19:43 +053026 void __iomem *registers;
27 void __iomem *shim;
28 void __iomem *alh;
29 int irq;
Vinod Koulc46302e2018-04-26 18:39:05 +053030 const struct sdw_intel_ops *ops;
Rander Wang4b206d32019-12-11 19:45:02 -060031 struct device *dev;
Pierre-Louis Bossart4a17c442020-07-16 23:09:40 +080032 struct mutex *shim_lock; /* protect shared registers */
33 u32 *shim_mask;
Pierre-Louis Bossarta320f412020-08-17 23:29:18 +080034 u32 clock_stop_quirks;
Pierre-Louis Bossartde763fa2020-09-01 23:05:55 +080035 u32 link_mask;
Bard Liao4a98a6b2020-07-16 23:09:45 +080036 struct sdw_cdns *cdns;
37 struct list_head list;
Vinod Koul71bb8a12017-12-14 11:19:43 +053038};
39
Pierre-Louis Bossartb6109dd2020-06-01 02:20:57 +080040struct sdw_intel {
41 struct sdw_cdns cdns;
42 int instance;
43 struct sdw_intel_link_res *link_res;
Pierre-Louis Bossarte4401ab2021-08-18 10:49:53 +080044 bool startup_done;
Pierre-Louis Bossartb6109dd2020-06-01 02:20:57 +080045#ifdef CONFIG_DEBUG_FS
46 struct dentry *debugfs;
47#endif
48};
49
Pierre-Louis Bossart29a269c2021-05-11 13:21:32 +080050int intel_link_startup(struct auxiliary_device *auxdev);
51int intel_link_process_wakeen_event(struct auxiliary_device *auxdev);
52
53struct sdw_intel_link_dev {
54 struct auxiliary_device auxdev;
55 struct sdw_intel_link_res link_res;
56};
57
58#define auxiliary_dev_to_sdw_intel_link_dev(auxiliary_dev) \
59 container_of(auxiliary_dev, struct sdw_intel_link_dev, auxdev)
Pierre-Louis Bossart6d2c6662020-06-01 02:21:02 +080060
Vinod Koul71bb8a12017-12-14 11:19:43 +053061#endif /* __SDW_INTEL_LOCAL_H */