diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
commit | abf7dba7c4f77d781f6df50fefb19a64c5dc331f (patch) | |
tree | 38648731b502d5aec508f3b33f6616190e598eb6 /include | |
parent | 07c4dd3435aa387d3b58f4e941dc516513f14507 (diff) | |
parent | b23220fe054e92f616b82450fae8cd3ab176cc60 (diff) |
Merge tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH:
"Here is the "big" char and misc driver patches for 4.18-rc1.
It's not a lot of stuff here, but there are some highlights:
- coreboot driver updates
- soundwire driver updates
- android binder updates
- fpga big sync, mostly documentation
- lots of minor driver updates
All of these have been in linux-next for a while with no reported
issues"
* tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (81 commits)
vmw_balloon: fixing double free when batching mode is off
MAINTAINERS: Add driver-api/fpga path
fpga: clarify that unregister functions also free
documentation: fpga: move fpga-region.txt to driver-api
documentation: fpga: add bridge document to driver-api
documentation: fpga: move fpga-mgr.txt to driver-api
Documentation: fpga: move fpga overview to driver-api
fpga: region: kernel-doc fixes
fpga: bridge: kernel-doc fixes
fpga: mgr: kernel-doc fixes
fpga: use SPDX
fpga: region: change api, add fpga_region_create/free
fpga: bridge: change api, don't use drvdata
fpga: manager: change api, don't use drvdata
fpga: region: don't use drvdata in common fpga code
Drivers: hv: vmbus: Removed an unnecessary cast from void *
ver_linux: Drop redundant calls to system() to test if file is readable
ver_linux: Move stderr redirection from function parameter to function body
misc: IBM Virtual Management Channel Driver (VMC)
rpmsg: Correct support for MODULE_DEVICE_TABLE()
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/coresight.h | 13 | ||||
-rw-r--r-- | include/linux/fpga/altera-pr-ip-core.h | 13 | ||||
-rw-r--r-- | include/linux/fpga/fpga-bridge.h | 9 | ||||
-rw-r--r-- | include/linux/fpga/fpga-mgr.h | 23 | ||||
-rw-r--r-- | include/linux/fpga/fpga-region.h | 13 | ||||
-rw-r--r-- | include/linux/hyperv.h | 26 | ||||
-rw-r--r-- | include/linux/nubus.h | 2 | ||||
-rw-r--r-- | include/linux/nvmem-provider.h | 11 | ||||
-rw-r--r-- | include/linux/soundwire/sdw.h | 332 | ||||
-rw-r--r-- | include/linux/soundwire/sdw_intel.h | 14 | ||||
-rw-r--r-- | include/linux/uio_driver.h | 4 | ||||
-rw-r--r-- | include/sound/soc-dai.h | 23 |
12 files changed, 433 insertions, 50 deletions
diff --git a/include/linux/coresight.h b/include/linux/coresight.h index d950dad5056a..c265e0468414 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h | |||
@@ -1,13 +1,6 @@ | |||
1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | * | 2 | /* |
3 | * This program is free software; you can redistribute it and/or modify | 3 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
4 | * it under the terms of the GNU General Public License version 2 and | ||
5 | * only version 2 as published by the Free Software Foundation. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | */ | 4 | */ |
12 | 5 | ||
13 | #ifndef _LINUX_CORESIGHT_H | 6 | #ifndef _LINUX_CORESIGHT_H |
diff --git a/include/linux/fpga/altera-pr-ip-core.h b/include/linux/fpga/altera-pr-ip-core.h index 3810a9033f49..7d4664730d60 100644 --- a/include/linux/fpga/altera-pr-ip-core.h +++ b/include/linux/fpga/altera-pr-ip-core.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * Driver for Altera Partial Reconfiguration IP Core | 3 | * Driver for Altera Partial Reconfiguration IP Core |
3 | * | 4 | * |
@@ -5,18 +6,6 @@ | |||
5 | * | 6 | * |
6 | * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation | 7 | * Based on socfpga-a10.c Copyright (C) 2015-2016 Altera Corporation |
7 | * by Alan Tull <atull@opensource.altera.com> | 8 | * by Alan Tull <atull@opensource.altera.com> |
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms and conditions of the GNU General Public License, | ||
11 | * version 2, as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along with | ||
19 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | */ | 9 | */ |
21 | 10 | ||
22 | #ifndef _ALT_PR_IP_CORE_H | 11 | #ifndef _ALT_PR_IP_CORE_H |
diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h index 3694821a6d2d..ce550fcf6360 100644 --- a/include/linux/fpga/fpga-bridge.h +++ b/include/linux/fpga/fpga-bridge.h | |||
@@ -62,8 +62,11 @@ int of_fpga_bridge_get_to_list(struct device_node *np, | |||
62 | struct fpga_image_info *info, | 62 | struct fpga_image_info *info, |
63 | struct list_head *bridge_list); | 63 | struct list_head *bridge_list); |
64 | 64 | ||
65 | int fpga_bridge_register(struct device *dev, const char *name, | 65 | struct fpga_bridge *fpga_bridge_create(struct device *dev, const char *name, |
66 | const struct fpga_bridge_ops *br_ops, void *priv); | 66 | const struct fpga_bridge_ops *br_ops, |
67 | void fpga_bridge_unregister(struct device *dev); | 67 | void *priv); |
68 | void fpga_bridge_free(struct fpga_bridge *br); | ||
69 | int fpga_bridge_register(struct fpga_bridge *br); | ||
70 | void fpga_bridge_unregister(struct fpga_bridge *br); | ||
68 | 71 | ||
69 | #endif /* _LINUX_FPGA_BRIDGE_H */ | 72 | #endif /* _LINUX_FPGA_BRIDGE_H */ |
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h index 3c6de23aabdf..eec7c2478b0d 100644 --- a/include/linux/fpga/fpga-mgr.h +++ b/include/linux/fpga/fpga-mgr.h | |||
@@ -1,20 +1,9 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | /* | 2 | /* |
2 | * FPGA Framework | 3 | * FPGA Framework |
3 | * | 4 | * |
4 | * Copyright (C) 2013-2016 Altera Corporation | 5 | * Copyright (C) 2013-2016 Altera Corporation |
5 | * Copyright (C) 2017 Intel Corporation | 6 | * Copyright (C) 2017 Intel Corporation |
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms and conditions of the GNU General Public License, | ||
9 | * version 2, as published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along with | ||
17 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | 7 | */ |
19 | #ifndef _LINUX_FPGA_MGR_H | 8 | #ifndef _LINUX_FPGA_MGR_H |
20 | #define _LINUX_FPGA_MGR_H | 9 | #define _LINUX_FPGA_MGR_H |
@@ -170,9 +159,11 @@ struct fpga_manager *fpga_mgr_get(struct device *dev); | |||
170 | 159 | ||
171 | void fpga_mgr_put(struct fpga_manager *mgr); | 160 | void fpga_mgr_put(struct fpga_manager *mgr); |
172 | 161 | ||
173 | int fpga_mgr_register(struct device *dev, const char *name, | 162 | struct fpga_manager *fpga_mgr_create(struct device *dev, const char *name, |
174 | const struct fpga_manager_ops *mops, void *priv); | 163 | const struct fpga_manager_ops *mops, |
175 | 164 | void *priv); | |
176 | void fpga_mgr_unregister(struct device *dev); | 165 | void fpga_mgr_free(struct fpga_manager *mgr); |
166 | int fpga_mgr_register(struct fpga_manager *mgr); | ||
167 | void fpga_mgr_unregister(struct fpga_manager *mgr); | ||
177 | 168 | ||
178 | #endif /*_LINUX_FPGA_MGR_H */ | 169 | #endif /*_LINUX_FPGA_MGR_H */ |
diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h index b6520318ab9c..d7071cddd727 100644 --- a/include/linux/fpga/fpga-region.h +++ b/include/linux/fpga/fpga-region.h | |||
@@ -1,3 +1,5 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | |||
1 | #ifndef _FPGA_REGION_H | 3 | #ifndef _FPGA_REGION_H |
2 | #define _FPGA_REGION_H | 4 | #define _FPGA_REGION_H |
3 | 5 | ||
@@ -14,7 +16,6 @@ | |||
14 | * @info: FPGA image info | 16 | * @info: FPGA image info |
15 | * @priv: private data | 17 | * @priv: private data |
16 | * @get_bridges: optional function to get bridges to a list | 18 | * @get_bridges: optional function to get bridges to a list |
17 | * @groups: optional attribute groups. | ||
18 | */ | 19 | */ |
19 | struct fpga_region { | 20 | struct fpga_region { |
20 | struct device dev; | 21 | struct device dev; |
@@ -24,7 +25,6 @@ struct fpga_region { | |||
24 | struct fpga_image_info *info; | 25 | struct fpga_image_info *info; |
25 | void *priv; | 26 | void *priv; |
26 | int (*get_bridges)(struct fpga_region *region); | 27 | int (*get_bridges)(struct fpga_region *region); |
27 | const struct attribute_group **groups; | ||
28 | }; | 28 | }; |
29 | 29 | ||
30 | #define to_fpga_region(d) container_of(d, struct fpga_region, dev) | 30 | #define to_fpga_region(d) container_of(d, struct fpga_region, dev) |
@@ -34,7 +34,12 @@ struct fpga_region *fpga_region_class_find( | |||
34 | int (*match)(struct device *, const void *)); | 34 | int (*match)(struct device *, const void *)); |
35 | 35 | ||
36 | int fpga_region_program_fpga(struct fpga_region *region); | 36 | int fpga_region_program_fpga(struct fpga_region *region); |
37 | int fpga_region_register(struct device *dev, struct fpga_region *region); | 37 | |
38 | int fpga_region_unregister(struct fpga_region *region); | 38 | struct fpga_region |
39 | *fpga_region_create(struct device *dev, struct fpga_manager *mgr, | ||
40 | int (*get_bridges)(struct fpga_region *)); | ||
41 | void fpga_region_free(struct fpga_region *region); | ||
42 | int fpga_region_register(struct fpga_region *region); | ||
43 | void fpga_region_unregister(struct fpga_region *region); | ||
39 | 44 | ||
40 | #endif /* _FPGA_REGION_H */ | 45 | #endif /* _FPGA_REGION_H */ |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 192ed8fbc403..11b5612dc066 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -163,6 +163,7 @@ static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi) | |||
163 | * 2 . 4 (Windows 8) | 163 | * 2 . 4 (Windows 8) |
164 | * 3 . 0 (Windows 8 R2) | 164 | * 3 . 0 (Windows 8 R2) |
165 | * 4 . 0 (Windows 10) | 165 | * 4 . 0 (Windows 10) |
166 | * 5 . 0 (Newer Windows 10) | ||
166 | */ | 167 | */ |
167 | 168 | ||
168 | #define VERSION_WS2008 ((0 << 16) | (13)) | 169 | #define VERSION_WS2008 ((0 << 16) | (13)) |
@@ -170,10 +171,11 @@ static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi) | |||
170 | #define VERSION_WIN8 ((2 << 16) | (4)) | 171 | #define VERSION_WIN8 ((2 << 16) | (4)) |
171 | #define VERSION_WIN8_1 ((3 << 16) | (0)) | 172 | #define VERSION_WIN8_1 ((3 << 16) | (0)) |
172 | #define VERSION_WIN10 ((4 << 16) | (0)) | 173 | #define VERSION_WIN10 ((4 << 16) | (0)) |
174 | #define VERSION_WIN10_V5 ((5 << 16) | (0)) | ||
173 | 175 | ||
174 | #define VERSION_INVAL -1 | 176 | #define VERSION_INVAL -1 |
175 | 177 | ||
176 | #define VERSION_CURRENT VERSION_WIN10 | 178 | #define VERSION_CURRENT VERSION_WIN10_V5 |
177 | 179 | ||
178 | /* Make maximum size of pipe payload of 16K */ | 180 | /* Make maximum size of pipe payload of 16K */ |
179 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) | 181 | #define MAX_PIPE_DATA_PAYLOAD (sizeof(u8) * 16384) |
@@ -570,7 +572,14 @@ struct vmbus_channel_initiate_contact { | |||
570 | struct vmbus_channel_message_header header; | 572 | struct vmbus_channel_message_header header; |
571 | u32 vmbus_version_requested; | 573 | u32 vmbus_version_requested; |
572 | u32 target_vcpu; /* The VCPU the host should respond to */ | 574 | u32 target_vcpu; /* The VCPU the host should respond to */ |
573 | u64 interrupt_page; | 575 | union { |
576 | u64 interrupt_page; | ||
577 | struct { | ||
578 | u8 msg_sint; | ||
579 | u8 padding1[3]; | ||
580 | u32 padding2; | ||
581 | }; | ||
582 | }; | ||
574 | u64 monitor_page1; | 583 | u64 monitor_page1; |
575 | u64 monitor_page2; | 584 | u64 monitor_page2; |
576 | } __packed; | 585 | } __packed; |
@@ -585,6 +594,19 @@ struct vmbus_channel_tl_connect_request { | |||
585 | struct vmbus_channel_version_response { | 594 | struct vmbus_channel_version_response { |
586 | struct vmbus_channel_message_header header; | 595 | struct vmbus_channel_message_header header; |
587 | u8 version_supported; | 596 | u8 version_supported; |
597 | |||
598 | u8 connection_state; | ||
599 | u16 padding; | ||
600 | |||
601 | /* | ||
602 | * On new hosts that support VMBus protocol 5.0, we must use | ||
603 | * VMBUS_MESSAGE_CONNECTION_ID_4 for the Initiate Contact Message, | ||
604 | * and for subsequent messages, we must use the Message Connection ID | ||
605 | * field in the host-returned Version Response Message. | ||
606 | * | ||
607 | * On old hosts, we should always use VMBUS_MESSAGE_CONNECTION_ID (1). | ||
608 | */ | ||
609 | u32 msg_conn_id; | ||
588 | } __packed; | 610 | } __packed; |
589 | 611 | ||
590 | enum vmbus_channel_state { | 612 | enum vmbus_channel_state { |
diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 6e8200215321..eba50b057f6f 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h | |||
@@ -163,7 +163,7 @@ void nubus_seq_write_rsrc_mem(struct seq_file *m, | |||
163 | unsigned char *nubus_dirptr(const struct nubus_dirent *nd); | 163 | unsigned char *nubus_dirptr(const struct nubus_dirent *nd); |
164 | 164 | ||
165 | /* Declarations relating to driver model objects */ | 165 | /* Declarations relating to driver model objects */ |
166 | int nubus_bus_register(void); | 166 | int nubus_parent_device_register(void); |
167 | int nubus_device_register(struct nubus_board *board); | 167 | int nubus_device_register(struct nubus_board *board); |
168 | int nubus_driver_register(struct nubus_driver *ndrv); | 168 | int nubus_driver_register(struct nubus_driver *ndrv); |
169 | void nubus_driver_unregister(struct nubus_driver *ndrv); | 169 | void nubus_driver_unregister(struct nubus_driver *ndrv); |
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index f89598bc4e1c..24def6ad09bb 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h | |||
@@ -77,6 +77,9 @@ struct nvmem_device *devm_nvmem_register(struct device *dev, | |||
77 | 77 | ||
78 | int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); | 78 | int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); |
79 | 79 | ||
80 | int nvmem_add_cells(struct nvmem_device *nvmem, | ||
81 | const struct nvmem_cell_info *info, | ||
82 | int ncells); | ||
80 | #else | 83 | #else |
81 | 84 | ||
82 | static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) | 85 | static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) |
@@ -99,6 +102,14 @@ static inline int | |||
99 | devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) | 102 | devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) |
100 | { | 103 | { |
101 | return nvmem_unregister(nvmem); | 104 | return nvmem_unregister(nvmem); |
105 | |||
106 | } | ||
107 | |||
108 | static inline int nvmem_add_cells(struct nvmem_device *nvmem, | ||
109 | const struct nvmem_cell_info *info, | ||
110 | int ncells) | ||
111 | { | ||
112 | return -ENOSYS; | ||
102 | } | 113 | } |
103 | 114 | ||
104 | #endif /* CONFIG_NVMEM */ | 115 | #endif /* CONFIG_NVMEM */ |
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index e91fdcf41049..962971e6a9c7 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h | |||
@@ -23,9 +23,24 @@ struct sdw_slave; | |||
23 | #define SDW_MASTER_DEV_NUM 14 | 23 | #define SDW_MASTER_DEV_NUM 14 |
24 | 24 | ||
25 | #define SDW_NUM_DEV_ID_REGISTERS 6 | 25 | #define SDW_NUM_DEV_ID_REGISTERS 6 |
26 | /* frame shape defines */ | ||
26 | 27 | ||
28 | /* | ||
29 | * Note: The maximum row define in SoundWire spec 1.1 is 23. In order to | ||
30 | * fill hole with 0, one more dummy entry is added | ||
31 | */ | ||
32 | #define SDW_FRAME_ROWS 24 | ||
33 | #define SDW_FRAME_COLS 8 | ||
34 | #define SDW_FRAME_ROW_COLS (SDW_FRAME_ROWS * SDW_FRAME_COLS) | ||
35 | |||
36 | #define SDW_FRAME_CTRL_BITS 48 | ||
27 | #define SDW_MAX_DEVICES 11 | 37 | #define SDW_MAX_DEVICES 11 |
28 | 38 | ||
39 | #define SDW_VALID_PORT_RANGE(n) (n <= 14 && n >= 1) | ||
40 | |||
41 | #define SDW_DAI_ID_RANGE_START 100 | ||
42 | #define SDW_DAI_ID_RANGE_END 200 | ||
43 | |||
29 | /** | 44 | /** |
30 | * enum sdw_slave_status - Slave status | 45 | * enum sdw_slave_status - Slave status |
31 | * @SDW_SLAVE_UNATTACHED: Slave is not attached with the bus. | 46 | * @SDW_SLAVE_UNATTACHED: Slave is not attached with the bus. |
@@ -61,6 +76,30 @@ enum sdw_command_response { | |||
61 | SDW_CMD_FAIL_OTHER = 4, | 76 | SDW_CMD_FAIL_OTHER = 4, |
62 | }; | 77 | }; |
63 | 78 | ||
79 | /** | ||
80 | * enum sdw_stream_type: data stream type | ||
81 | * | ||
82 | * @SDW_STREAM_PCM: PCM data stream | ||
83 | * @SDW_STREAM_PDM: PDM data stream | ||
84 | * | ||
85 | * spec doesn't define this, but is used in implementation | ||
86 | */ | ||
87 | enum sdw_stream_type { | ||
88 | SDW_STREAM_PCM = 0, | ||
89 | SDW_STREAM_PDM = 1, | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * enum sdw_data_direction: Data direction | ||
94 | * | ||
95 | * @SDW_DATA_DIR_RX: Data into Port | ||
96 | * @SDW_DATA_DIR_TX: Data out of Port | ||
97 | */ | ||
98 | enum sdw_data_direction { | ||
99 | SDW_DATA_DIR_RX = 0, | ||
100 | SDW_DATA_DIR_TX = 1, | ||
101 | }; | ||
102 | |||
64 | /* | 103 | /* |
65 | * SDW properties, defined in MIPI DisCo spec v1.0 | 104 | * SDW properties, defined in MIPI DisCo spec v1.0 |
66 | */ | 105 | */ |
@@ -341,11 +380,92 @@ struct sdw_slave_intr_status { | |||
341 | }; | 380 | }; |
342 | 381 | ||
343 | /** | 382 | /** |
344 | * struct sdw_slave_ops - Slave driver callback ops | 383 | * sdw_reg_bank - SoundWire register banks |
384 | * @SDW_BANK0: Soundwire register bank 0 | ||
385 | * @SDW_BANK1: Soundwire register bank 1 | ||
386 | */ | ||
387 | enum sdw_reg_bank { | ||
388 | SDW_BANK0, | ||
389 | SDW_BANK1, | ||
390 | }; | ||
391 | |||
392 | /** | ||
393 | * struct sdw_bus_conf: Bus configuration | ||
394 | * | ||
395 | * @clk_freq: Clock frequency, in Hz | ||
396 | * @num_rows: Number of rows in frame | ||
397 | * @num_cols: Number of columns in frame | ||
398 | * @bank: Next register bank | ||
399 | */ | ||
400 | struct sdw_bus_conf { | ||
401 | unsigned int clk_freq; | ||
402 | unsigned int num_rows; | ||
403 | unsigned int num_cols; | ||
404 | unsigned int bank; | ||
405 | }; | ||
406 | |||
407 | /** | ||
408 | * struct sdw_prepare_ch: Prepare/De-prepare Data Port channel | ||
409 | * | ||
410 | * @num: Port number | ||
411 | * @ch_mask: Active channel mask | ||
412 | * @prepare: Prepare (true) /de-prepare (false) channel | ||
413 | * @bank: Register bank, which bank Slave/Master driver should program for | ||
414 | * implementation defined registers. This is always updated to next_bank | ||
415 | * value read from bus params. | ||
416 | * | ||
417 | */ | ||
418 | struct sdw_prepare_ch { | ||
419 | unsigned int num; | ||
420 | unsigned int ch_mask; | ||
421 | bool prepare; | ||
422 | unsigned int bank; | ||
423 | }; | ||
424 | |||
425 | /** | ||
426 | * enum sdw_port_prep_ops: Prepare operations for Data Port | ||
427 | * | ||
428 | * @SDW_OPS_PORT_PRE_PREP: Pre prepare operation for the Port | ||
429 | * @SDW_OPS_PORT_PREP: Prepare operation for the Port | ||
430 | * @SDW_OPS_PORT_POST_PREP: Post prepare operation for the Port | ||
431 | */ | ||
432 | enum sdw_port_prep_ops { | ||
433 | SDW_OPS_PORT_PRE_PREP = 0, | ||
434 | SDW_OPS_PORT_PREP = 1, | ||
435 | SDW_OPS_PORT_POST_PREP = 2, | ||
436 | }; | ||
437 | |||
438 | /** | ||
439 | * struct sdw_bus_params: Structure holding bus configuration | ||
440 | * | ||
441 | * @curr_bank: Current bank in use (BANK0/BANK1) | ||
442 | * @next_bank: Next bank to use (BANK0/BANK1). next_bank will always be | ||
443 | * set to !curr_bank | ||
444 | * @max_dr_freq: Maximum double rate clock frequency supported, in Hz | ||
445 | * @curr_dr_freq: Current double rate clock frequency, in Hz | ||
446 | * @bandwidth: Current bandwidth | ||
447 | * @col: Active columns | ||
448 | * @row: Active rows | ||
449 | */ | ||
450 | struct sdw_bus_params { | ||
451 | enum sdw_reg_bank curr_bank; | ||
452 | enum sdw_reg_bank next_bank; | ||
453 | unsigned int max_dr_freq; | ||
454 | unsigned int curr_dr_freq; | ||
455 | unsigned int bandwidth; | ||
456 | unsigned int col; | ||
457 | unsigned int row; | ||
458 | }; | ||
459 | |||
460 | /** | ||
461 | * struct sdw_slave_ops: Slave driver callback ops | ||
462 | * | ||
345 | * @read_prop: Read Slave properties | 463 | * @read_prop: Read Slave properties |
346 | * @interrupt_callback: Device interrupt notification (invoked in thread | 464 | * @interrupt_callback: Device interrupt notification (invoked in thread |
347 | * context) | 465 | * context) |
348 | * @update_status: Update Slave status | 466 | * @update_status: Update Slave status |
467 | * @bus_config: Update the bus config for Slave | ||
468 | * @port_prep: Prepare the port with parameters | ||
349 | */ | 469 | */ |
350 | struct sdw_slave_ops { | 470 | struct sdw_slave_ops { |
351 | int (*read_prop)(struct sdw_slave *sdw); | 471 | int (*read_prop)(struct sdw_slave *sdw); |
@@ -353,6 +473,11 @@ struct sdw_slave_ops { | |||
353 | struct sdw_slave_intr_status *status); | 473 | struct sdw_slave_intr_status *status); |
354 | int (*update_status)(struct sdw_slave *slave, | 474 | int (*update_status)(struct sdw_slave *slave, |
355 | enum sdw_slave_status status); | 475 | enum sdw_slave_status status); |
476 | int (*bus_config)(struct sdw_slave *slave, | ||
477 | struct sdw_bus_params *params); | ||
478 | int (*port_prep)(struct sdw_slave *slave, | ||
479 | struct sdw_prepare_ch *prepare_ch, | ||
480 | enum sdw_port_prep_ops pre_ops); | ||
356 | }; | 481 | }; |
357 | 482 | ||
358 | /** | 483 | /** |
@@ -406,6 +531,93 @@ int sdw_handle_slave_status(struct sdw_bus *bus, | |||
406 | * SDW master structures and APIs | 531 | * SDW master structures and APIs |
407 | */ | 532 | */ |
408 | 533 | ||
534 | /** | ||
535 | * struct sdw_port_params: Data Port parameters | ||
536 | * | ||
537 | * @num: Port number | ||
538 | * @bps: Word length of the Port | ||
539 | * @flow_mode: Port Data flow mode | ||
540 | * @data_mode: Test modes or normal mode | ||
541 | * | ||
542 | * This is used to program the Data Port based on Data Port stream | ||
543 | * parameters. | ||
544 | */ | ||
545 | struct sdw_port_params { | ||
546 | unsigned int num; | ||
547 | unsigned int bps; | ||
548 | unsigned int flow_mode; | ||
549 | unsigned int data_mode; | ||
550 | }; | ||
551 | |||
552 | /** | ||
553 | * struct sdw_transport_params: Data Port Transport Parameters | ||
554 | * | ||
555 | * @blk_grp_ctrl_valid: Port implements block group control | ||
556 | * @num: Port number | ||
557 | * @blk_grp_ctrl: Block group control value | ||
558 | * @sample_interval: Sample interval | ||
559 | * @offset1: Blockoffset of the payload data | ||
560 | * @offset2: Blockoffset of the payload data | ||
561 | * @hstart: Horizontal start of the payload data | ||
562 | * @hstop: Horizontal stop of the payload data | ||
563 | * @blk_pkg_mode: Block per channel or block per port | ||
564 | * @lane_ctrl: Data lane Port uses for Data transfer. Currently only single | ||
565 | * data lane is supported in bus | ||
566 | * | ||
567 | * This is used to program the Data Port based on Data Port transport | ||
568 | * parameters. All these parameters are banked and can be modified | ||
569 | * during a bank switch without any artifacts in audio stream. | ||
570 | */ | ||
571 | struct sdw_transport_params { | ||
572 | bool blk_grp_ctrl_valid; | ||
573 | unsigned int port_num; | ||
574 | unsigned int blk_grp_ctrl; | ||
575 | unsigned int sample_interval; | ||
576 | unsigned int offset1; | ||
577 | unsigned int offset2; | ||
578 | unsigned int hstart; | ||
579 | unsigned int hstop; | ||
580 | unsigned int blk_pkg_mode; | ||
581 | unsigned int lane_ctrl; | ||
582 | }; | ||
583 | |||
584 | /** | ||
585 | * struct sdw_enable_ch: Enable/disable Data Port channel | ||
586 | * | ||
587 | * @num: Port number | ||
588 | * @ch_mask: Active channel mask | ||
589 | * @enable: Enable (true) /disable (false) channel | ||
590 | */ | ||
591 | struct sdw_enable_ch { | ||
592 | unsigned int port_num; | ||
593 | unsigned int ch_mask; | ||
594 | bool enable; | ||
595 | }; | ||
596 | |||
597 | /** | ||
598 | * struct sdw_master_port_ops: Callback functions from bus to Master | ||
599 | * driver to set Master Data ports. | ||
600 | * | ||
601 | * @dpn_set_port_params: Set the Port parameters for the Master Port. | ||
602 | * Mandatory callback | ||
603 | * @dpn_set_port_transport_params: Set transport parameters for the Master | ||
604 | * Port. Mandatory callback | ||
605 | * @dpn_port_prep: Port prepare operations for the Master Data Port. | ||
606 | * @dpn_port_enable_ch: Enable the channels of Master Port. | ||
607 | */ | ||
608 | struct sdw_master_port_ops { | ||
609 | int (*dpn_set_port_params)(struct sdw_bus *bus, | ||
610 | struct sdw_port_params *port_params, | ||
611 | unsigned int bank); | ||
612 | int (*dpn_set_port_transport_params)(struct sdw_bus *bus, | ||
613 | struct sdw_transport_params *transport_params, | ||
614 | enum sdw_reg_bank bank); | ||
615 | int (*dpn_port_prep)(struct sdw_bus *bus, | ||
616 | struct sdw_prepare_ch *prepare_ch); | ||
617 | int (*dpn_port_enable_ch)(struct sdw_bus *bus, | ||
618 | struct sdw_enable_ch *enable_ch, unsigned int bank); | ||
619 | }; | ||
620 | |||
409 | struct sdw_msg; | 621 | struct sdw_msg; |
410 | 622 | ||
411 | /** | 623 | /** |
@@ -426,6 +638,9 @@ struct sdw_defer { | |||
426 | * @xfer_msg: Transfer message callback | 638 | * @xfer_msg: Transfer message callback |
427 | * @xfer_msg_defer: Defer version of transfer message callback | 639 | * @xfer_msg_defer: Defer version of transfer message callback |
428 | * @reset_page_addr: Reset the SCP page address registers | 640 | * @reset_page_addr: Reset the SCP page address registers |
641 | * @set_bus_conf: Set the bus configuration | ||
642 | * @pre_bank_switch: Callback for pre bank switch | ||
643 | * @post_bank_switch: Callback for post bank switch | ||
429 | */ | 644 | */ |
430 | struct sdw_master_ops { | 645 | struct sdw_master_ops { |
431 | int (*read_prop)(struct sdw_bus *bus); | 646 | int (*read_prop)(struct sdw_bus *bus); |
@@ -437,6 +652,11 @@ struct sdw_master_ops { | |||
437 | struct sdw_defer *defer); | 652 | struct sdw_defer *defer); |
438 | enum sdw_command_response (*reset_page_addr) | 653 | enum sdw_command_response (*reset_page_addr) |
439 | (struct sdw_bus *bus, unsigned int dev_num); | 654 | (struct sdw_bus *bus, unsigned int dev_num); |
655 | int (*set_bus_conf)(struct sdw_bus *bus, | ||
656 | struct sdw_bus_params *params); | ||
657 | int (*pre_bank_switch)(struct sdw_bus *bus); | ||
658 | int (*post_bank_switch)(struct sdw_bus *bus); | ||
659 | |||
440 | }; | 660 | }; |
441 | 661 | ||
442 | /** | 662 | /** |
@@ -449,9 +669,15 @@ struct sdw_master_ops { | |||
449 | * @bus_lock: bus lock | 669 | * @bus_lock: bus lock |
450 | * @msg_lock: message lock | 670 | * @msg_lock: message lock |
451 | * @ops: Master callback ops | 671 | * @ops: Master callback ops |
672 | * @port_ops: Master port callback ops | ||
673 | * @params: Current bus parameters | ||
452 | * @prop: Master properties | 674 | * @prop: Master properties |
675 | * @m_rt_list: List of Master instance of all stream(s) running on Bus. This | ||
676 | * is used to compute and program bus bandwidth, clock, frame shape, | ||
677 | * transport and port parameters | ||
453 | * @defer_msg: Defer message | 678 | * @defer_msg: Defer message |
454 | * @clk_stop_timeout: Clock stop timeout computed | 679 | * @clk_stop_timeout: Clock stop timeout computed |
680 | * @bank_switch_timeout: Bank switch timeout computed | ||
455 | */ | 681 | */ |
456 | struct sdw_bus { | 682 | struct sdw_bus { |
457 | struct device *dev; | 683 | struct device *dev; |
@@ -461,14 +687,118 @@ struct sdw_bus { | |||
461 | struct mutex bus_lock; | 687 | struct mutex bus_lock; |
462 | struct mutex msg_lock; | 688 | struct mutex msg_lock; |
463 | const struct sdw_master_ops *ops; | 689 | const struct sdw_master_ops *ops; |
690 | const struct sdw_master_port_ops *port_ops; | ||
691 | struct sdw_bus_params params; | ||
464 | struct sdw_master_prop prop; | 692 | struct sdw_master_prop prop; |
693 | struct list_head m_rt_list; | ||
465 | struct sdw_defer defer_msg; | 694 | struct sdw_defer defer_msg; |
466 | unsigned int clk_stop_timeout; | 695 | unsigned int clk_stop_timeout; |
696 | u32 bank_switch_timeout; | ||
467 | }; | 697 | }; |
468 | 698 | ||
469 | int sdw_add_bus_master(struct sdw_bus *bus); | 699 | int sdw_add_bus_master(struct sdw_bus *bus); |
470 | void sdw_delete_bus_master(struct sdw_bus *bus); | 700 | void sdw_delete_bus_master(struct sdw_bus *bus); |
471 | 701 | ||
702 | /** | ||
703 | * sdw_port_config: Master or Slave Port configuration | ||
704 | * | ||
705 | * @num: Port number | ||
706 | * @ch_mask: channels mask for port | ||
707 | */ | ||
708 | struct sdw_port_config { | ||
709 | unsigned int num; | ||
710 | unsigned int ch_mask; | ||
711 | }; | ||
712 | |||
713 | /** | ||
714 | * sdw_stream_config: Master or Slave stream configuration | ||
715 | * | ||
716 | * @frame_rate: Audio frame rate of the stream, in Hz | ||
717 | * @ch_count: Channel count of the stream | ||
718 | * @bps: Number of bits per audio sample | ||
719 | * @direction: Data direction | ||
720 | * @type: Stream type PCM or PDM | ||
721 | */ | ||
722 | struct sdw_stream_config { | ||
723 | unsigned int frame_rate; | ||
724 | unsigned int ch_count; | ||
725 | unsigned int bps; | ||
726 | enum sdw_data_direction direction; | ||
727 | enum sdw_stream_type type; | ||
728 | }; | ||
729 | |||
730 | /** | ||
731 | * sdw_stream_state: Stream states | ||
732 | * | ||
733 | * @SDW_STREAM_ALLOCATED: New stream allocated. | ||
734 | * @SDW_STREAM_CONFIGURED: Stream configured | ||
735 | * @SDW_STREAM_PREPARED: Stream prepared | ||
736 | * @SDW_STREAM_ENABLED: Stream enabled | ||
737 | * @SDW_STREAM_DISABLED: Stream disabled | ||
738 | * @SDW_STREAM_DEPREPARED: Stream de-prepared | ||
739 | * @SDW_STREAM_RELEASED: Stream released | ||
740 | */ | ||
741 | enum sdw_stream_state { | ||
742 | SDW_STREAM_ALLOCATED = 0, | ||
743 | SDW_STREAM_CONFIGURED = 1, | ||
744 | SDW_STREAM_PREPARED = 2, | ||
745 | SDW_STREAM_ENABLED = 3, | ||
746 | SDW_STREAM_DISABLED = 4, | ||
747 | SDW_STREAM_DEPREPARED = 5, | ||
748 | SDW_STREAM_RELEASED = 6, | ||
749 | }; | ||
750 | |||
751 | /** | ||
752 | * sdw_stream_params: Stream parameters | ||
753 | * | ||
754 | * @rate: Sampling frequency, in Hz | ||
755 | * @ch_count: Number of channels | ||
756 | * @bps: bits per channel sample | ||
757 | */ | ||
758 | struct sdw_stream_params { | ||
759 | unsigned int rate; | ||
760 | unsigned int ch_count; | ||
761 | unsigned int bps; | ||
762 | }; | ||
763 | |||
764 | /** | ||
765 | * sdw_stream_runtime: Runtime stream parameters | ||
766 | * | ||
767 | * @name: SoundWire stream name | ||
768 | * @params: Stream parameters | ||
769 | * @state: Current state of the stream | ||
770 | * @type: Stream type PCM or PDM | ||
771 | * @m_rt: Master runtime | ||
772 | */ | ||
773 | struct sdw_stream_runtime { | ||
774 | char *name; | ||
775 | struct sdw_stream_params params; | ||
776 | enum sdw_stream_state state; | ||
777 | enum sdw_stream_type type; | ||
778 | struct sdw_master_runtime *m_rt; | ||
779 | }; | ||
780 | |||
781 | struct sdw_stream_runtime *sdw_alloc_stream(char *stream_name); | ||
782 | void sdw_release_stream(struct sdw_stream_runtime *stream); | ||
783 | int sdw_stream_add_master(struct sdw_bus *bus, | ||
784 | struct sdw_stream_config *stream_config, | ||
785 | struct sdw_port_config *port_config, | ||
786 | unsigned int num_ports, | ||
787 | struct sdw_stream_runtime *stream); | ||
788 | int sdw_stream_add_slave(struct sdw_slave *slave, | ||
789 | struct sdw_stream_config *stream_config, | ||
790 | struct sdw_port_config *port_config, | ||
791 | unsigned int num_ports, | ||
792 | struct sdw_stream_runtime *stream); | ||
793 | int sdw_stream_remove_master(struct sdw_bus *bus, | ||
794 | struct sdw_stream_runtime *stream); | ||
795 | int sdw_stream_remove_slave(struct sdw_slave *slave, | ||
796 | struct sdw_stream_runtime *stream); | ||
797 | int sdw_prepare_stream(struct sdw_stream_runtime *stream); | ||
798 | int sdw_enable_stream(struct sdw_stream_runtime *stream); | ||
799 | int sdw_disable_stream(struct sdw_stream_runtime *stream); | ||
800 | int sdw_deprepare_stream(struct sdw_stream_runtime *stream); | ||
801 | |||
472 | /* messaging and data APIs */ | 802 | /* messaging and data APIs */ |
473 | 803 | ||
474 | int sdw_read(struct sdw_slave *slave, u32 addr); | 804 | int sdw_read(struct sdw_slave *slave, u32 addr); |
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h index 4b37528f592d..2b9573b8aedd 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h | |||
@@ -5,17 +5,31 @@ | |||
5 | #define __SDW_INTEL_H | 5 | #define __SDW_INTEL_H |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * struct sdw_intel_ops: Intel audio driver callback ops | ||
9 | * | ||
10 | * @config_stream: configure the stream with the hw_params | ||
11 | */ | ||
12 | struct sdw_intel_ops { | ||
13 | int (*config_stream)(void *arg, void *substream, | ||
14 | void *dai, void *hw_params, int stream_num); | ||
15 | }; | ||
16 | |||
17 | /** | ||
8 | * struct sdw_intel_res - Soundwire Intel resource structure | 18 | * struct sdw_intel_res - Soundwire Intel resource structure |
9 | * @mmio_base: mmio base of SoundWire registers | 19 | * @mmio_base: mmio base of SoundWire registers |
10 | * @irq: interrupt number | 20 | * @irq: interrupt number |
11 | * @handle: ACPI parent handle | 21 | * @handle: ACPI parent handle |
12 | * @parent: parent device | 22 | * @parent: parent device |
23 | * @ops: callback ops | ||
24 | * @arg: callback arg | ||
13 | */ | 25 | */ |
14 | struct sdw_intel_res { | 26 | struct sdw_intel_res { |
15 | void __iomem *mmio_base; | 27 | void __iomem *mmio_base; |
16 | int irq; | 28 | int irq; |
17 | acpi_handle handle; | 29 | acpi_handle handle; |
18 | struct device *parent; | 30 | struct device *parent; |
31 | const struct sdw_intel_ops *ops; | ||
32 | void *arg; | ||
19 | }; | 33 | }; |
20 | 34 | ||
21 | void *sdw_intel_init(acpi_handle *parent_handle, struct sdw_intel_res *res); | 35 | void *sdw_intel_init(acpi_handle *parent_handle, struct sdw_intel_res *res); |
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 3c85c81b0027..6c5f2074e14f 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #ifndef _UIO_DRIVER_H_ | 14 | #ifndef _UIO_DRIVER_H_ |
15 | #define _UIO_DRIVER_H_ | 15 | #define _UIO_DRIVER_H_ |
16 | 16 | ||
17 | #include <linux/device.h> | ||
17 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
18 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
19 | 20 | ||
@@ -68,12 +69,13 @@ struct uio_port { | |||
68 | 69 | ||
69 | struct uio_device { | 70 | struct uio_device { |
70 | struct module *owner; | 71 | struct module *owner; |
71 | struct device *dev; | 72 | struct device dev; |
72 | int minor; | 73 | int minor; |
73 | atomic_t event; | 74 | atomic_t event; |
74 | struct fasync_struct *async_queue; | 75 | struct fasync_struct *async_queue; |
75 | wait_queue_head_t wait; | 76 | wait_queue_head_t wait; |
76 | struct uio_info *info; | 77 | struct uio_info *info; |
78 | spinlock_t info_lock; | ||
77 | struct kobject *map_dir; | 79 | struct kobject *map_dir; |
78 | struct kobject *portio_dir; | 80 | struct kobject *portio_dir; |
79 | }; | 81 | }; |
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 8ad11669e4d8..3ddb575eed54 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h | |||
@@ -170,6 +170,8 @@ struct snd_soc_dai_ops { | |||
170 | unsigned int rx_num, unsigned int *rx_slot); | 170 | unsigned int rx_num, unsigned int *rx_slot); |
171 | int (*set_tristate)(struct snd_soc_dai *dai, int tristate); | 171 | int (*set_tristate)(struct snd_soc_dai *dai, int tristate); |
172 | 172 | ||
173 | int (*set_sdw_stream)(struct snd_soc_dai *dai, | ||
174 | void *stream, int direction); | ||
173 | /* | 175 | /* |
174 | * DAI digital mute - optional. | 176 | * DAI digital mute - optional. |
175 | * Called by soc-core to minimise any pops. | 177 | * Called by soc-core to minimise any pops. |
@@ -358,4 +360,25 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) | |||
358 | return dev_get_drvdata(dai->dev); | 360 | return dev_get_drvdata(dai->dev); |
359 | } | 361 | } |
360 | 362 | ||
363 | /** | ||
364 | * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation | ||
365 | * @dai: DAI | ||
366 | * @stream: STREAM | ||
367 | * @direction: Stream direction(Playback/Capture) | ||
368 | * SoundWire subsystem doesn't have a notion of direction and we reuse | ||
369 | * the ASoC stream direction to configure sink/source ports. | ||
370 | * Playback maps to source ports and Capture for sink ports. | ||
371 | * | ||
372 | * This should be invoked with NULL to clear the stream set previously. | ||
373 | * Returns 0 on success, a negative error code otherwise. | ||
374 | */ | ||
375 | static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, | ||
376 | void *stream, int direction) | ||
377 | { | ||
378 | if (dai->driver->ops->set_sdw_stream) | ||
379 | return dai->driver->ops->set_sdw_stream(dai, stream, direction); | ||
380 | else | ||
381 | return -ENOTSUPP; | ||
382 | } | ||
383 | |||
361 | #endif | 384 | #endif |