ubwcp: debug interface to control multi-tile processing

Provides debugfs node to enable/disable multi-tile processing.

Change-Id: I92e81f5332f0990688c05d7a0d90b8a978d44059
Signed-off-by: Amol Jadi <quic_ajadi@quicinc.com>
This commit is contained in:
Amol Jadi
2023-07-05 17:10:39 -07:00
parent cda03c3582
commit 0702773127
3 changed files with 58 additions and 1 deletions

View File

@@ -342,6 +342,20 @@ void ubwcp_hw_power_vote_status(void __iomem *pwr_ctrl, u8 *vote, u8 *status)
*status = (reg & BIT(31)) >> 31;
}
/* process only one tile at a time */
void ubwcp_hw_single_tile(void __iomem *base, bool en)
{
u32 reg;
reg = UBWCP_REG_READ(base, SPARE);
if (en)
reg |= BIT(15);
else
reg &= ~BIT(15);
UBWCP_REG_WRITE(base, SPARE, reg);
}
EXPORT_SYMBOL(ubwcp_hw_single_tile);
void ubwcp_hw_one_time_init(void __iomem *base)
{
u32 reg;

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __UBWCP_HW_H_
@@ -68,5 +68,6 @@ void ubwcp_hw_one_time_init(void __iomem *base);
int ubwcp_hw_flush(void __iomem *base);
void ubwcp_hw_trace_set(bool value);
void ubwcp_hw_trace_get(bool *value);
void ubwcp_hw_single_tile(void __iomem *base, bool en);
#endif /* __UBWCP_HW_H_ */

View File

@@ -137,6 +137,7 @@ struct ubwcp_driver {
bool write_err_irq_en;
bool decode_err_irq_en;
bool encode_err_irq_en;
bool single_tile_en;
/* ubwcp devices */
struct device *dev; //ubwcp device
@@ -2682,11 +2683,46 @@ static int reg_rw_trace_r_op(void *data, u64 *value)
return 0;
}
static int single_tile_r_op(void *data, u64 *value)
{
struct ubwcp_driver *ubwcp = data;
if (ubwcp->state != UBWCP_STATE_READY)
return -EPERM;
*value = ubwcp->single_tile_en;
return 0;
}
static int single_tile_w_op(void *data, u64 value)
{
struct ubwcp_driver *ubwcp = data;
if (ubwcp->state != UBWCP_STATE_READY)
return -EPERM;
if (ubwcp_power(ubwcp, true))
goto err;
ubwcp_hw_single_tile(ubwcp->base, value);
ubwcp->single_tile_en = value;
if (ubwcp_power(ubwcp, false))
goto err;
return 0;
err:
ubwcp->state = UBWCP_STATE_FAULT;
ERR("state set to fault");
return -1;
}
DEFINE_DEBUGFS_ATTRIBUTE(read_err_fops, read_err_r_op, read_err_w_op, "%d\n");
DEFINE_DEBUGFS_ATTRIBUTE(decode_err_fops, decode_err_r_op, decode_err_w_op, "%d\n");
DEFINE_DEBUGFS_ATTRIBUTE(write_err_fops, write_err_r_op, write_err_w_op, "%d\n");
DEFINE_DEBUGFS_ATTRIBUTE(encode_err_fops, encode_err_r_op, encode_err_w_op, "%d\n");
DEFINE_DEBUGFS_ATTRIBUTE(reg_rw_trace_fops, reg_rw_trace_r_op, reg_rw_trace_w_op, "%d\n");
DEFINE_DEBUGFS_ATTRIBUTE(single_tile_fops, single_tile_r_op, single_tile_w_op, "%d\n");
static void ubwcp_debugfs_init(struct ubwcp_driver *ubwcp)
{
@@ -2733,6 +2769,12 @@ static void ubwcp_debugfs_init(struct ubwcp_driver *ubwcp)
goto err;
}
dfile = debugfs_create_file("single_tile_en", 0644, debugfs_root, ubwcp, &single_tile_fops);
if (IS_ERR_OR_NULL(dfile)) {
ERR("failed to create write_err_irq debugfs file");
goto err;
}
ubwcp->debugfs_root = debugfs_root;
return;