From 47b71b6ce2e59c375808a5f7f6768540b57bca2e Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Mon, 28 Oct 2019 01:46:48 +0100 Subject: [PATCH] BACKPORT: ipts: Cleanup public headers to pass checkpatch Signed-off-by: Dorian Stoll (cherry-picked from commit 1fb6e1722904edd84e4c229cb688859fb172cffa) --- include/linux/ipts-binary.h | 105 ++++++++++++++-------------- include/linux/ipts-companion.h | 31 +++++---- include/linux/ipts-gfx.h | 121 ++++++++++++++++++--------------- include/linux/ipts.h | 14 +++- 4 files changed, 146 insertions(+), 125 deletions(-) diff --git a/include/linux/ipts-binary.h b/include/linux/ipts-binary.h index 3b85f59ee2a06..98b54d74ff888 100644 --- a/include/linux/ipts-binary.h +++ b/include/linux/ipts-binary.h @@ -1,21 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * - * Intel Precise Touch & Stylus binary spec - * Copyright (c) 2016 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. + * Intel Precise Touch & Stylus + * Copyright (c) 2016 Intel Corporation * */ -#ifndef _INTEL_IPTS_BINARY_H_ -#define _INTEL_IPTS_BINARY_H_ +#ifndef IPTS_BINARY_H +#define IPTS_BINARY_H #include #include @@ -27,7 +19,7 @@ // we support 16 output buffers (1:feedback, 15:HID) #define MAX_NUM_OUTPUT_BUFFERS 16 -typedef enum { +enum ipts_bin_res_type { IPTS_BIN_KERNEL, IPTS_BIN_RO_DATA, IPTS_BIN_RW_DATA, @@ -38,9 +30,9 @@ typedef enum { IPTS_BIN_ALLOCATION_LIST, IPTS_BIN_COMMAND_BUFFER_PACKET, IPTS_BIN_TAG, -} ipts_bin_res_type_t; +}; -typedef struct ipts_bin_header { +struct ipts_bin_header { char str[4]; u32 version; @@ -48,98 +40,101 @@ typedef struct ipts_bin_header { u32 gfxcore; u32 revid; #endif -} ipts_bin_header_t; +}; -typedef struct ipts_bin_alloc { +struct ipts_bin_alloc { u32 handle; u32 reserved; -} ipts_bin_alloc_t; +}; -typedef struct ipts_bin_alloc_list { +struct ipts_bin_alloc_list { u32 num; - ipts_bin_alloc_t alloc[]; -} ipts_bin_alloc_list_t; + struct ipts_bin_alloc alloc[]; +}; -typedef struct ipts_bin_cmdbuf { +struct ipts_bin_cmdbuf { u32 size; char data[]; -} ipts_bin_cmdbuf_t; +}; -typedef struct ipts_bin_res { +struct ipts_bin_res { u32 handle; - ipts_bin_res_type_t type; + enum ipts_bin_res_type type; u32 initialize; u32 aligned_size; u32 size; char data[]; -} ipts_bin_res_t; +}; -typedef enum { +enum ipts_bin_io_buffer_type { IPTS_INPUT, IPTS_OUTPUT, IPTS_CONFIGURATION, IPTS_CALIBRATION, IPTS_FEATURE, -} ipts_bin_io_buffer_type_t; +}; -typedef struct ipts_bin_io_header { +struct ipts_bin_io_header { char str[10]; u16 type; -} ipts_bin_io_header_t; +}; -typedef struct ipts_bin_res_list { +struct ipts_bin_res_list { u32 num; - ipts_bin_res_t res[]; -} ipts_bin_res_list_t; + struct ipts_bin_res res[]; +}; -typedef struct ipts_bin_patch { +struct ipts_bin_patch { u32 index; u32 reserved1[2]; u32 alloc_offset; u32 patch_offset; u32 reserved2; -} ipts_bin_patch_t; +}; -typedef struct ipts_bin_patch_list { +struct ipts_bin_patch_list { u32 num; - ipts_bin_patch_t patch[]; -} ipts_bin_patch_list_t; + struct ipts_bin_patch patch[]; +}; -typedef struct ipts_bin_guc_wq_info { +struct ipts_bin_guc_wq_info { u32 batch_offset; u32 size; char data[]; -} ipts_bin_guc_wq_info_t; +}; -typedef struct ipts_bin_bufid_patch { +struct ipts_bin_bufid_patch { u32 imm_offset; u32 mem_offset; -} ipts_bin_bufid_patch_t; +}; -typedef enum { +enum ipts_bin_data_file_flags { IPTS_DATA_FILE_FLAG_NONE = 0, IPTS_DATA_FILE_FLAG_SHARE = 1, IPTS_DATA_FILE_FLAG_ALLOC_CONTIGUOUS = 2, -} ipts_bin_data_file_flags_t; +}; -typedef struct ipts_bin_data_file_info { +struct ipts_bin_data_file_info { u32 io_buffer_type; u32 flags; char file_name[MAX_IOCL_FILE_NAME_LEN]; -} ipts_bin_data_file_info_t; +}; -typedef struct ipts_bin_fw_info { +struct ipts_bin_fw_info { char fw_name[MAX_IOCL_FILE_NAME_LEN]; - s32 vendor_output; // output index. -1 for no use + + // output index. -1 for no use + s32 vendor_output; + u32 num_of_data_files; - ipts_bin_data_file_info_t data_file[]; -} ipts_bin_fw_info_t; + struct ipts_bin_data_file_info data_file[]; +}; -typedef struct ipts_bin_fw_list { +struct ipts_bin_fw_list { u32 num_of_fws; - ipts_bin_fw_info_t fw_info[]; -} ipts_bin_fw_list_t; + struct ipts_bin_fw_info fw_info[]; +}; #pragma pack() -#endif // _INTEL_IPTS_BINARY_H_ +#endif // IPTS_BINARY_H diff --git a/include/linux/ipts-companion.h b/include/linux/ipts-companion.h index 6d831c401524a..de31f5e0b186b 100644 --- a/include/linux/ipts-companion.h +++ b/include/linux/ipts-companion.h @@ -1,22 +1,29 @@ -#ifndef _INTEL_IPTS_COMPANION_H_ -#define _INTEL_IPTS_COMPANION_H_ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * + * Intel Precise Touch & Stylus + * Copyright (c) 2016 Intel Corporation + * Copyright (c) 2019 Dorian Stoll + * + */ + +#ifndef IPTS_COMPANION_H +#define IPTS_COMPANION_H #include #include -typedef struct ipts_companion ipts_companion_t; - -typedef int (*ipts_fw_handler_t)(ipts_companion_t *, const struct firmware **, - const char *, struct device *); - struct ipts_companion { - ipts_fw_handler_t firmware_request; - ipts_bin_fw_info_t **firmware_config; + int (*firmware_request)(struct ipts_companion *companion, + const struct firmware **fw, + const char *name, struct device *device); + + struct ipts_bin_fw_info **firmware_config; void *data; const char *name; }; -int ipts_add_companion(ipts_companion_t *companion); -int ipts_remove_companion(ipts_companion_t *companion); +int ipts_add_companion(struct ipts_companion *companion); +int ipts_remove_companion(struct ipts_companion *companion); -#endif // _INTEL_IPTS_COMPANION_H_ +#endif // IPTS_COMPANION_H diff --git a/include/linux/ipts-gfx.h b/include/linux/ipts-gfx.h index 316a1f6865821..cb9d98fe96e4b 100644 --- a/include/linux/ipts-gfx.h +++ b/include/linux/ipts-gfx.h @@ -1,75 +1,86 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * - * GFX interface to support Intel Precise Touch & Stylus - * Copyright (c) 2016 Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. + * Intel Precise Touch & Stylus + * Copyright (c) 2016 Intel Corporation * */ -#ifndef _INTEL_IPTS_GFX_H_ -#define _INTEL_IPTS_GFX_H_ +#ifndef IPTS_GFX_H +#define IPTS_GFX_H enum { IPTS_INTERFACE_V1 = 1, }; -#define IPTS_BUF_FLAG_CONTIGUOUS 0x01 +#define IPTS_BUF_FLAG_CONTIGUOUS 0x01 -#define IPTS_NOTIFY_STA_BACKLIGHT_OFF 0x00 -#define IPTS_NOTIFY_STA_BACKLIGHT_ON 0x01 +#define IPTS_NOTIFY_STA_BACKLIGHT_OFF 0x00 +#define IPTS_NOTIFY_STA_BACKLIGHT_ON 0x01 -typedef struct intel_ipts_mapbuffer { - u32 size; - u32 flags; - void *gfx_addr; - void *cpu_addr; - u64 buf_handle; - u64 phy_addr; -} intel_ipts_mapbuffer_t; +struct ipts_mapbuffer { + u32 size; + u32 flags; + void *gfx_addr; + void *cpu_addr; + u64 buf_handle; + u64 phy_addr; +}; -typedef struct intel_ipts_wq_info { +struct ipts_wq_info { u64 db_addr; u64 db_phy_addr; u32 db_cookie_offset; u32 wq_size; u64 wq_addr; u64 wq_phy_addr; - u64 wq_head_addr; // head of wq is managed by GPU - u64 wq_head_phy_addr; // head of wq is managed by GPU - u64 wq_tail_addr; // tail of wq is managed by CSME - u64 wq_tail_phy_addr; // tail of wq is managed by CSME -} intel_ipts_wq_info_t; - -typedef struct intel_ipts_ops { - int (*get_wq_info)(uint64_t gfx_handle, intel_ipts_wq_info_t *wq_info); - int (*map_buffer)(uint64_t gfx_handle, intel_ipts_mapbuffer_t *mapbuffer); + + // head of wq is managed by GPU + u64 wq_head_addr; + u64 wq_head_phy_addr; + + // tail of wq is managed by CSME + u64 wq_tail_addr; + u64 wq_tail_phy_addr; +}; + +struct ipts_ops { + int (*get_wq_info)(uint64_t gfx_handle, + struct ipts_wq_info *wq_info); + int (*map_buffer)(uint64_t gfx_handle, + struct ipts_mapbuffer *mapbuffer); int (*unmap_buffer)(uint64_t gfx_handle, uint64_t buf_handle); -} intel_ipts_ops_t; - -typedef struct intel_ipts_callback { - void (*workload_complete)(void *data); - void (*notify_gfx_status)(u32 status, void *data); -} intel_ipts_callback_t; - -typedef struct intel_ipts_connect { - struct device *client; // input : client device for PM setup - intel_ipts_callback_t ipts_cb; // input : callback addresses - void *data; // input : callback data - u32 if_version; // input : interface version - u32 gfx_version; // output : gfx version - u64 gfx_handle; // output : gfx handle - intel_ipts_ops_t ipts_ops; // output : gfx ops for IPTS -} intel_ipts_connect_t; - -int intel_ipts_connect(intel_ipts_connect_t *ipts_connect); -void intel_ipts_disconnect(uint64_t gfx_handle); - -#endif // _INTEL_IPTS_GFX_H_ +}; + +struct ipts_callback { + void (*workload_complete)(void *data); + void (*notify_gfx_status)(u32 status, void *data); +}; + +struct ipts_connect { + // input: Client device for PM setup + struct device *client; + + // input: Callback addresses + struct ipts_callback ipts_cb; + + // input: Callback data + void *data; + + // input: interface version + u32 if_version; + + // output: GFX version + u32 gfx_version; + + // output: GFX handle + u64 gfx_handle; + + // output: GFX ops for IPTS + struct ipts_ops ipts_ops; +}; + +int ipts_connect(struct ipts_connect *ipts_connect); +void ipts_disconnect(uint64_t gfx_handle); + +#endif // IPTS_GFX_H diff --git a/include/linux/ipts.h b/include/linux/ipts.h index 4149ab2362cbc..e26e56ec50a4a 100644 --- a/include/linux/ipts.h +++ b/include/linux/ipts.h @@ -1,7 +1,15 @@ -#ifndef _INTEL_IPTS_IPTS_H_ -#define _INTEL_IPTS_IPTS_H_ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * + * Intel Precise Touch & Stylus + * Copyright (c) 2016 Intel Corporation + * + */ + +#ifndef IPTS_H +#define IPTS_H #define MAX_IOCL_FILE_NAME_LEN 80 #define MAX_IOCL_FILE_PATH_LEN 256 -#endif // _INTEL_IPTS_IPTS_H_ +#endif // IPTS_H