Skip to content

Commit 971d8e1

Browse files
amd-sukhatrialexdeucher
authored andcommitted
drm/amdgpu: clean unused functions of uvd/vcn/vce
Some of the functions pointers of amdgpu_ip_funcs are not used and are left commented out. Hence this cleans those up which arent used. Cc: Leo Liu <[email protected]> Signed-off-by: Sunil Khatri <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent afb634a commit 971d8e1

File tree

3 files changed

+0
-551
lines changed

3 files changed

+0
-551
lines changed

drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c

Lines changed: 0 additions & 274 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,104 +1462,6 @@ static void uvd_v7_0_enc_ring_emit_wreg(struct amdgpu_ring *ring,
14621462
amdgpu_ring_write(ring, val);
14631463
}
14641464

1465-
#if 0
1466-
static bool uvd_v7_0_is_idle(void *handle)
1467-
{
1468-
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1469-
1470-
return !(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK);
1471-
}
1472-
1473-
static int uvd_v7_0_wait_for_idle(struct amdgpu_ip_block *ip_block)
1474-
{
1475-
unsigned i;
1476-
struct amdgpu_device *adev = ip_block->adev;
1477-
1478-
for (i = 0; i < adev->usec_timeout; i++) {
1479-
if (uvd_v7_0_is_idle(handle))
1480-
return 0;
1481-
}
1482-
return -ETIMEDOUT;
1483-
}
1484-
1485-
#define AMDGPU_UVD_STATUS_BUSY_MASK 0xfd
1486-
static bool uvd_v7_0_check_soft_reset(struct amdgpu_ip_block *ip_block)
1487-
{
1488-
struct amdgpu_device *adev = ip_block->adev;
1489-
u32 srbm_soft_reset = 0;
1490-
u32 tmp = RREG32(mmSRBM_STATUS);
1491-
1492-
if (REG_GET_FIELD(tmp, SRBM_STATUS, UVD_RQ_PENDING) ||
1493-
REG_GET_FIELD(tmp, SRBM_STATUS, UVD_BUSY) ||
1494-
(RREG32_SOC15(UVD, ring->me, mmUVD_STATUS) &
1495-
AMDGPU_UVD_STATUS_BUSY_MASK))
1496-
srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
1497-
SRBM_SOFT_RESET, SOFT_RESET_UVD, 1);
1498-
1499-
if (srbm_soft_reset) {
1500-
adev->uvd.inst[ring->me].srbm_soft_reset = srbm_soft_reset;
1501-
return true;
1502-
} else {
1503-
adev->uvd.inst[ring->me].srbm_soft_reset = 0;
1504-
return false;
1505-
}
1506-
}
1507-
1508-
static int uvd_v7_0_pre_soft_reset(struct amdgpu_ip_block *ip_block)
1509-
{
1510-
struct amdgpu_device *adev = ip_block->adev;
1511-
1512-
if (!adev->uvd.inst[ring->me].srbm_soft_reset)
1513-
return 0;
1514-
1515-
uvd_v7_0_stop(adev);
1516-
return 0;
1517-
}
1518-
1519-
static int uvd_v7_0_soft_reset(struct amdgpu_ip_block *ip_block)
1520-
{
1521-
struct amdgpu_device *adev = ip_block->adev;
1522-
u32 srbm_soft_reset;
1523-
1524-
if (!adev->uvd.inst[ring->me].srbm_soft_reset)
1525-
return 0;
1526-
srbm_soft_reset = adev->uvd.inst[ring->me].srbm_soft_reset;
1527-
1528-
if (srbm_soft_reset) {
1529-
u32 tmp;
1530-
1531-
tmp = RREG32(mmSRBM_SOFT_RESET);
1532-
tmp |= srbm_soft_reset;
1533-
dev_info(adev->dev, "SRBM_SOFT_RESET=0x%08X\n", tmp);
1534-
WREG32(mmSRBM_SOFT_RESET, tmp);
1535-
tmp = RREG32(mmSRBM_SOFT_RESET);
1536-
1537-
udelay(50);
1538-
1539-
tmp &= ~srbm_soft_reset;
1540-
WREG32(mmSRBM_SOFT_RESET, tmp);
1541-
tmp = RREG32(mmSRBM_SOFT_RESET);
1542-
1543-
/* Wait a little for things to settle down */
1544-
udelay(50);
1545-
}
1546-
1547-
return 0;
1548-
}
1549-
1550-
static int uvd_v7_0_post_soft_reset(struct amdgpu_ip_block *ip_block)
1551-
{
1552-
struct amdgpu_device *adev = ip_block->adev;
1553-
1554-
if (!adev->uvd.inst[ring->me].srbm_soft_reset)
1555-
return 0;
1556-
1557-
mdelay(5);
1558-
1559-
return uvd_v7_0_start(adev);
1560-
}
1561-
#endif
1562-
15631465
static int uvd_v7_0_set_interrupt_state(struct amdgpu_device *adev,
15641466
struct amdgpu_irq_src *source,
15651467
unsigned type,
@@ -1609,176 +1511,6 @@ static int uvd_v7_0_process_interrupt(struct amdgpu_device *adev,
16091511
return 0;
16101512
}
16111513

1612-
#if 0
1613-
static void uvd_v7_0_set_sw_clock_gating(struct amdgpu_device *adev)
1614-
{
1615-
uint32_t data, data1, data2, suvd_flags;
1616-
1617-
data = RREG32_SOC15(UVD, ring->me, mmUVD_CGC_CTRL);
1618-
data1 = RREG32_SOC15(UVD, ring->me, mmUVD_SUVD_CGC_GATE);
1619-
data2 = RREG32_SOC15(UVD, ring->me, mmUVD_SUVD_CGC_CTRL);
1620-
1621-
data &= ~(UVD_CGC_CTRL__CLK_OFF_DELAY_MASK |
1622-
UVD_CGC_CTRL__CLK_GATE_DLY_TIMER_MASK);
1623-
1624-
suvd_flags = UVD_SUVD_CGC_GATE__SRE_MASK |
1625-
UVD_SUVD_CGC_GATE__SIT_MASK |
1626-
UVD_SUVD_CGC_GATE__SMP_MASK |
1627-
UVD_SUVD_CGC_GATE__SCM_MASK |
1628-
UVD_SUVD_CGC_GATE__SDB_MASK;
1629-
1630-
data |= UVD_CGC_CTRL__DYN_CLOCK_MODE_MASK |
1631-
(1 << REG_FIELD_SHIFT(UVD_CGC_CTRL, CLK_GATE_DLY_TIMER)) |
1632-
(4 << REG_FIELD_SHIFT(UVD_CGC_CTRL, CLK_OFF_DELAY));
1633-
1634-
data &= ~(UVD_CGC_CTRL__UDEC_RE_MODE_MASK |
1635-
UVD_CGC_CTRL__UDEC_CM_MODE_MASK |
1636-
UVD_CGC_CTRL__UDEC_IT_MODE_MASK |
1637-
UVD_CGC_CTRL__UDEC_DB_MODE_MASK |
1638-
UVD_CGC_CTRL__UDEC_MP_MODE_MASK |
1639-
UVD_CGC_CTRL__SYS_MODE_MASK |
1640-
UVD_CGC_CTRL__UDEC_MODE_MASK |
1641-
UVD_CGC_CTRL__MPEG2_MODE_MASK |
1642-
UVD_CGC_CTRL__REGS_MODE_MASK |
1643-
UVD_CGC_CTRL__RBC_MODE_MASK |
1644-
UVD_CGC_CTRL__LMI_MC_MODE_MASK |
1645-
UVD_CGC_CTRL__LMI_UMC_MODE_MASK |
1646-
UVD_CGC_CTRL__IDCT_MODE_MASK |
1647-
UVD_CGC_CTRL__MPRD_MODE_MASK |
1648-
UVD_CGC_CTRL__MPC_MODE_MASK |
1649-
UVD_CGC_CTRL__LBSI_MODE_MASK |
1650-
UVD_CGC_CTRL__LRBBM_MODE_MASK |
1651-
UVD_CGC_CTRL__WCB_MODE_MASK |
1652-
UVD_CGC_CTRL__VCPU_MODE_MASK |
1653-
UVD_CGC_CTRL__JPEG_MODE_MASK |
1654-
UVD_CGC_CTRL__JPEG2_MODE_MASK |
1655-
UVD_CGC_CTRL__SCPU_MODE_MASK);
1656-
data2 &= ~(UVD_SUVD_CGC_CTRL__SRE_MODE_MASK |
1657-
UVD_SUVD_CGC_CTRL__SIT_MODE_MASK |
1658-
UVD_SUVD_CGC_CTRL__SMP_MODE_MASK |
1659-
UVD_SUVD_CGC_CTRL__SCM_MODE_MASK |
1660-
UVD_SUVD_CGC_CTRL__SDB_MODE_MASK);
1661-
data1 |= suvd_flags;
1662-
1663-
WREG32_SOC15(UVD, ring->me, mmUVD_CGC_CTRL, data);
1664-
WREG32_SOC15(UVD, ring->me, mmUVD_CGC_GATE, 0);
1665-
WREG32_SOC15(UVD, ring->me, mmUVD_SUVD_CGC_GATE, data1);
1666-
WREG32_SOC15(UVD, ring->me, mmUVD_SUVD_CGC_CTRL, data2);
1667-
}
1668-
1669-
static void uvd_v7_0_set_hw_clock_gating(struct amdgpu_device *adev)
1670-
{
1671-
uint32_t data, data1, cgc_flags, suvd_flags;
1672-
1673-
data = RREG32_SOC15(UVD, ring->me, mmUVD_CGC_GATE);
1674-
data1 = RREG32_SOC15(UVD, ring->me, mmUVD_SUVD_CGC_GATE);
1675-
1676-
cgc_flags = UVD_CGC_GATE__SYS_MASK |
1677-
UVD_CGC_GATE__UDEC_MASK |
1678-
UVD_CGC_GATE__MPEG2_MASK |
1679-
UVD_CGC_GATE__RBC_MASK |
1680-
UVD_CGC_GATE__LMI_MC_MASK |
1681-
UVD_CGC_GATE__IDCT_MASK |
1682-
UVD_CGC_GATE__MPRD_MASK |
1683-
UVD_CGC_GATE__MPC_MASK |
1684-
UVD_CGC_GATE__LBSI_MASK |
1685-
UVD_CGC_GATE__LRBBM_MASK |
1686-
UVD_CGC_GATE__UDEC_RE_MASK |
1687-
UVD_CGC_GATE__UDEC_CM_MASK |
1688-
UVD_CGC_GATE__UDEC_IT_MASK |
1689-
UVD_CGC_GATE__UDEC_DB_MASK |
1690-
UVD_CGC_GATE__UDEC_MP_MASK |
1691-
UVD_CGC_GATE__WCB_MASK |
1692-
UVD_CGC_GATE__VCPU_MASK |
1693-
UVD_CGC_GATE__SCPU_MASK |
1694-
UVD_CGC_GATE__JPEG_MASK |
1695-
UVD_CGC_GATE__JPEG2_MASK;
1696-
1697-
suvd_flags = UVD_SUVD_CGC_GATE__SRE_MASK |
1698-
UVD_SUVD_CGC_GATE__SIT_MASK |
1699-
UVD_SUVD_CGC_GATE__SMP_MASK |
1700-
UVD_SUVD_CGC_GATE__SCM_MASK |
1701-
UVD_SUVD_CGC_GATE__SDB_MASK;
1702-
1703-
data |= cgc_flags;
1704-
data1 |= suvd_flags;
1705-
1706-
WREG32_SOC15(UVD, ring->me, mmUVD_CGC_GATE, data);
1707-
WREG32_SOC15(UVD, ring->me, mmUVD_SUVD_CGC_GATE, data1);
1708-
}
1709-
1710-
static void uvd_v7_0_set_bypass_mode(struct amdgpu_device *adev, bool enable)
1711-
{
1712-
u32 tmp = RREG32_SMC(ixGCK_DFS_BYPASS_CNTL);
1713-
1714-
if (enable)
1715-
tmp |= (GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK |
1716-
GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK);
1717-
else
1718-
tmp &= ~(GCK_DFS_BYPASS_CNTL__BYPASSDCLK_MASK |
1719-
GCK_DFS_BYPASS_CNTL__BYPASSVCLK_MASK);
1720-
1721-
WREG32_SMC(ixGCK_DFS_BYPASS_CNTL, tmp);
1722-
}
1723-
1724-
1725-
static int uvd_v7_0_set_clockgating_state(void *handle,
1726-
enum amd_clockgating_state state)
1727-
{
1728-
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1729-
bool enable = (state == AMD_CG_STATE_GATE);
1730-
struct amdgpu_ip_block *ip_block;
1731-
1732-
ip_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_UVD);
1733-
if (!ip_block)
1734-
return -EINVAL;
1735-
1736-
uvd_v7_0_set_bypass_mode(adev, enable);
1737-
1738-
if (!(adev->cg_flags & AMD_CG_SUPPORT_UVD_MGCG))
1739-
return 0;
1740-
1741-
if (enable) {
1742-
/* disable HW gating and enable Sw gating */
1743-
uvd_v7_0_set_sw_clock_gating(adev);
1744-
} else {
1745-
/* wait for STATUS to clear */
1746-
if (uvd_v7_0_wait_for_idle(ip_block))
1747-
return -EBUSY;
1748-
1749-
/* enable HW gates because UVD is idle */
1750-
/* uvd_v7_0_set_hw_clock_gating(adev); */
1751-
}
1752-
1753-
return 0;
1754-
}
1755-
1756-
static int uvd_v7_0_set_powergating_state(void *handle,
1757-
enum amd_powergating_state state)
1758-
{
1759-
/* This doesn't actually powergate the UVD block.
1760-
* That's done in the dpm code via the SMC. This
1761-
* just re-inits the block as necessary. The actual
1762-
* gating still happens in the dpm code. We should
1763-
* revisit this when there is a cleaner line between
1764-
* the smc and the hw blocks
1765-
*/
1766-
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1767-
1768-
if (!(adev->pg_flags & AMD_PG_SUPPORT_UVD))
1769-
return 0;
1770-
1771-
WREG32_SOC15(UVD, ring->me, mmUVD_POWER_STATUS, UVD_POWER_STATUS__UVD_PG_EN_MASK);
1772-
1773-
if (state == AMD_PG_STATE_GATE) {
1774-
uvd_v7_0_stop(adev);
1775-
return 0;
1776-
} else {
1777-
return uvd_v7_0_start(adev);
1778-
}
1779-
}
1780-
#endif
1781-
17821514
static int uvd_v7_0_set_clockgating_state(void *handle,
17831515
enum amd_clockgating_state state)
17841516
{
@@ -1796,12 +1528,6 @@ const struct amd_ip_funcs uvd_v7_0_ip_funcs = {
17961528
.prepare_suspend = uvd_v7_0_prepare_suspend,
17971529
.suspend = uvd_v7_0_suspend,
17981530
.resume = uvd_v7_0_resume,
1799-
.is_idle = NULL /* uvd_v7_0_is_idle */,
1800-
.wait_for_idle = NULL /* uvd_v7_0_wait_for_idle */,
1801-
.check_soft_reset = NULL /* uvd_v7_0_check_soft_reset */,
1802-
.pre_soft_reset = NULL /* uvd_v7_0_pre_soft_reset */,
1803-
.soft_reset = NULL /* uvd_v7_0_soft_reset */,
1804-
.post_soft_reset = NULL /* uvd_v7_0_post_soft_reset */,
18051531
.set_clockgating_state = uvd_v7_0_set_clockgating_state,
18061532
.set_powergating_state = NULL /* uvd_v7_0_set_powergating_state */,
18071533
};

0 commit comments

Comments
 (0)