Pierre-Louis Bossart | 2385946 | 2019-05-01 10:57:25 -0500 | [diff] [blame] | 1 | /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ |
| 2 | /* Copyright(c) 2015-17 Intel Corporation. */ |
Vinod Koul | 71bb8a1 | 2017-12-14 11:19:43 +0530 | [diff] [blame] | 3 | |
| 4 | #ifndef __SDW_INTEL_LOCAL_H |
| 5 | #define __SDW_INTEL_LOCAL_H |
| 6 | |
| 7 | /** |
Pierre-Louis Bossart | f98f690 | 2019-12-11 19:45:01 -0600 | [diff] [blame] | 8 | * struct sdw_intel_link_res - Soundwire Intel link resource structure, |
| 9 | * typically populated by the controller driver. |
Pierre-Louis Bossart | f98f690 | 2019-12-11 19:45:01 -0600 | [diff] [blame] | 10 | * @mmio_base: mmio base of SoundWire registers |
Vinod Koul | 71bb8a1 | 2017-12-14 11:19:43 +0530 | [diff] [blame] | 11 | * @registers: Link IO registers base |
| 12 | * @shim: Audio shim pointer |
| 13 | * @alh: ALH (Audio Link Hub) pointer |
| 14 | * @irq: Interrupt line |
Vinod Koul | c46302e | 2018-04-26 18:39:05 +0530 | [diff] [blame] | 15 | * @ops: Shim callback ops |
Rander Wang | 4b206d3 | 2019-12-11 19:45:02 -0600 | [diff] [blame] | 16 | * @dev: device implementing hw_params and free callbacks |
Pierre-Louis Bossart | 4a17c44 | 2020-07-16 23:09:40 +0800 | [diff] [blame] | 17 | * @shim_lock: mutex to handle access to shared SHIM registers |
| 18 | * @shim_mask: global pointer to check SHIM register initialization |
Pierre-Louis Bossart | a320f41 | 2020-08-17 23:29:18 +0800 | [diff] [blame] | 19 | * @clock_stop_quirks: mask defining requested behavior on pm_suspend |
Pierre-Louis Bossart | de763fa | 2020-09-01 23:05:55 +0800 | [diff] [blame] | 20 | * @link_mask: global mask needed for power-up/down sequences |
Bard Liao | 4a98a6b | 2020-07-16 23:09:45 +0800 | [diff] [blame] | 21 | * @cdns: Cadence master descriptor |
| 22 | * @list: used to walk-through all masters exposed by the same controller |
Vinod Koul | 71bb8a1 | 2017-12-14 11:19:43 +0530 | [diff] [blame] | 23 | */ |
| 24 | struct sdw_intel_link_res { |
Pierre-Louis Bossart | f98f690 | 2019-12-11 19:45:01 -0600 | [diff] [blame] | 25 | void __iomem *mmio_base; /* not strictly needed, useful for debug */ |
Vinod Koul | 71bb8a1 | 2017-12-14 11:19:43 +0530 | [diff] [blame] | 26 | void __iomem *registers; |
| 27 | void __iomem *shim; |
| 28 | void __iomem *alh; |
| 29 | int irq; |
Vinod Koul | c46302e | 2018-04-26 18:39:05 +0530 | [diff] [blame] | 30 | const struct sdw_intel_ops *ops; |
Rander Wang | 4b206d3 | 2019-12-11 19:45:02 -0600 | [diff] [blame] | 31 | struct device *dev; |
Pierre-Louis Bossart | 4a17c44 | 2020-07-16 23:09:40 +0800 | [diff] [blame] | 32 | struct mutex *shim_lock; /* protect shared registers */ |
| 33 | u32 *shim_mask; |
Pierre-Louis Bossart | a320f41 | 2020-08-17 23:29:18 +0800 | [diff] [blame] | 34 | u32 clock_stop_quirks; |
Pierre-Louis Bossart | de763fa | 2020-09-01 23:05:55 +0800 | [diff] [blame] | 35 | u32 link_mask; |
Bard Liao | 4a98a6b | 2020-07-16 23:09:45 +0800 | [diff] [blame] | 36 | struct sdw_cdns *cdns; |
| 37 | struct list_head list; |
Vinod Koul | 71bb8a1 | 2017-12-14 11:19:43 +0530 | [diff] [blame] | 38 | }; |
| 39 | |
Pierre-Louis Bossart | b6109dd | 2020-06-01 02:20:57 +0800 | [diff] [blame] | 40 | struct sdw_intel { |
| 41 | struct sdw_cdns cdns; |
| 42 | int instance; |
| 43 | struct sdw_intel_link_res *link_res; |
Pierre-Louis Bossart | e4401ab | 2021-08-18 10:49:53 +0800 | [diff] [blame] | 44 | bool startup_done; |
Pierre-Louis Bossart | b6109dd | 2020-06-01 02:20:57 +0800 | [diff] [blame] | 45 | #ifdef CONFIG_DEBUG_FS |
| 46 | struct dentry *debugfs; |
| 47 | #endif |
| 48 | }; |
| 49 | |
Pierre-Louis Bossart | 29a269c | 2021-05-11 13:21:32 +0800 | [diff] [blame] | 50 | int intel_link_startup(struct auxiliary_device *auxdev); |
| 51 | int intel_link_process_wakeen_event(struct auxiliary_device *auxdev); |
| 52 | |
| 53 | struct 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 Bossart | 6d2c666 | 2020-06-01 02:21:02 +0800 | [diff] [blame] | 60 | |
Vinod Koul | 71bb8a1 | 2017-12-14 11:19:43 +0530 | [diff] [blame] | 61 | #endif /* __SDW_INTEL_LOCAL_H */ |