Skip to content

Commit

Permalink
BACKPORT: ipts: Cleanup public headers to pass checkpatch
Browse files Browse the repository at this point in the history
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>

(cherry-picked from commit 1fb6e17)
  • Loading branch information
StollD authored and kitakar5525 committed Jan 19, 2020
1 parent 79d32d1 commit 47b71b6
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 125 deletions.
105 changes: 50 additions & 55 deletions include/linux/ipts-binary.h
Original file line number Diff line number Diff line change
@@ -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 <linux/ipts.h>
#include <linux/types.h>
Expand All @@ -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,
Expand All @@ -38,108 +30,111 @@ 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;

#if IPTS_BIN_HEADER_VERSION > 1
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
31 changes: 19 additions & 12 deletions include/linux/ipts-companion.h
Original file line number Diff line number Diff line change
@@ -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 <linux/firmware.h>
#include <linux/ipts-binary.h>

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
121 changes: 66 additions & 55 deletions include/linux/ipts-gfx.h
Original file line number Diff line number Diff line change
@@ -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
14 changes: 11 additions & 3 deletions include/linux/ipts.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 47b71b6

Please sign in to comment.