From patchwork Tue Nov 24 19:38:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 331436 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp796036ilb; Tue, 24 Nov 2020 11:45:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0a7F8lS5HJE74QbNCjptzG9WCHu8NDaylzhz/qssSebX6oMaA/Q4A+ez2u4jiafLyKxAO X-Received: by 2002:a17:90a:348b:: with SMTP id p11mr155180pjb.161.1606247118050; Tue, 24 Nov 2020 11:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606247118; cv=none; d=google.com; s=arc-20160816; b=fe6HxfZ72dg7pvEYs/6xN6NR/7SjSg2rRgws3nCuOOjEzUz4zU6wqwqC124nHTDCjU /dEk/l0BzvURCDgZ6d7RiqwfsILGdY/mZoI+DCJRDEpzhkeqZWQzND+ImZxui8pVYphg SVDyiHIvQaFKPT9K1r2etCx4/IfClvoQGBQOYADNjBT2Mr0CbteTOxGxcqIi/Uwyh6ME I+7VNAjciqfnGCUatxZdl0xb4f0W2fhIx/vexTcH+K5d8lFDjZX+L2CSJScBZ5x7f77C w5CFrqirW5J+DOO7RH1ayP+oKJq3UKswlHWIVwkmUgqmNXXwhlyraWpasX5snBkI/Cgm GV2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to; bh=lIET0ApdhHHLCMhdiLAZAKSVptJ5L9h9n/qzGX9IakQ=; b=iAo7zVR7yUdXeGSmwVumRroVbx6GRsl6/ib8mrQIwRoyOdueJZNvb0KjyCWoBetXHY kYPM+NFxWLOJ1mid5tb4lErptW9anIDsQXvwYm/JpTZ5gYEJcX/PZul7yl04ucgbNNCq mh5UfTZ38kJd0KlW2hwXv1srZDdZQl6KPtVV9A/OkZFkNP6+hzMZ+mOkQYtDiagQp8H2 C50fKNU1euE+ZaGuDG1wnHHhNUc8qFenlGN4yxqboGYDElZEawOKfMdIfz65+aAuHRrj l8Y4S0OmQiKGjnnUzu/nRk8KQyRHS8x/++FdQZgJP3ft+uLd1EXEIBD6iD1NiIs3dO4m P33A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gb7iP7ck; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id r18si2340573pgl.21.2020.11.24.11.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 11:45:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gb7iP7ck; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09A896E5A5; Tue, 24 Nov 2020 19:44:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id BF01F6E573 for ; Tue, 24 Nov 2020 19:44:47 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id r3so5250280wrt.2 for ; Tue, 24 Nov 2020 11:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zo5/Lwn9P0icy9iSQMiRZ8fBf7M+D9k/aTR0H18FKHE=; b=gb7iP7ck2V3gKzU5e5sqITqk23QP+5qxwgoWtBe2q1dZqOic7g/dmzqayRcG3d8J7G DNyBhI81QFKBe+YUSA0U/WP4YRpd0oC65pLVJyJiktRjL0Zyt+oSyl9RytQaUTjj1Tps sEl42k0r8jssq/Zc+d42CpkO0ywLRe+vUKZeEqbaPK6+OHLR0STxljOA78pXBGHZ8J/A gpTRhRuidU6UXpzbxXwwUOEFyg+c/sJaZ7/TJx/JKLXnpDDz3gaXPTC94R4jGKFwKmA8 tcmGTRXBDqqqpInFya2BMsV6iRJF9NiFRMli4rWWxA+752QOxl9gjyyizK97eGc8lz9L IObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zo5/Lwn9P0icy9iSQMiRZ8fBf7M+D9k/aTR0H18FKHE=; b=YQUi8QBgb4tGJZIDnhjwD34b8/fW00xh38WLm/jk2VFq5h5P8rqTT4RFpZWy6trKTk +GUbA/GKHo68/xnIELLUkCeySrSGL2NJJJDwnpHPTiaL8ZZn5mry4Oby9RlGlkODi2PW DCNuJV77lTGBj7FORqwHKKE5ThA+auH5b+ryz6RJcPdSj/+GEDuHTPhE+BrWNZV5B1rW WdP0Wgf2W3AdoABZa4OO1BRNiC7EJD8FjZ4iR2RNpgiyiX2ST2MHkbu4AvUYcNLcVTXz W+PpjihbZ0Mo6PPorvfzI6bVuRIaLnZ515F1W2REVCJEBiOaCNwldHHPX8SOGKncZMyS t7pg== X-Gm-Message-State: AOAM531n/Ag9nHzu+izWmI8IzOX58FGjgg1M+npwHLHzEc3G+FdxWjE7 7GZYFituQ7kanCnK+TX/LYWokA== X-Received: by 2002:a5d:400a:: with SMTP id n10mr88321wrp.362.1606247086496; Tue, 24 Nov 2020 11:44:46 -0800 (PST) Received: from dell.default ([91.110.221.235]) by smtp.gmail.com with ESMTPSA id d134sm200511wmd.8.2020.11.24.11.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 11:44:45 -0800 (PST) From: Lee Jones To: lee.jones@linaro.org Subject: [PATCH 38/40] drm/amd/pm/swsmu/smu11/navi10_ppt: Remove unused 'struct i2c_algorithm navi10_i2c_algo' Date: Tue, 24 Nov 2020 19:38:22 +0000 Message-Id: <20201124193824.1118741-39-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201124193824.1118741-1-lee.jones@linaro.org> References: <20201124193824.1118741-1-lee.jones@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Alex Deucher , Evan Quan , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Fixes the following W=1 kernel build warning(s): Cc: Alex Deucher Cc: "Christian König" Cc: David Airlie Cc: Daniel Vetter Cc: Evan Quan Cc: amd-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Lee Jones --- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 204 ------------------ 1 file changed, 204 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c index ef1a62e86a0ee..59bd7cd3ca8df 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c @@ -2325,210 +2325,6 @@ static int navi10_run_umc_cdr_workaround(struct smu_context *smu) return 0; } -static void navi10_fill_i2c_req(SwI2cRequest_t *req, bool write, - uint8_t address, uint32_t numbytes, - uint8_t *data) -{ - int i; - - req->I2CcontrollerPort = 0; - req->I2CSpeed = 2; - req->SlaveAddress = address; - req->NumCmds = numbytes; - - for (i = 0; i < numbytes; i++) { - SwI2cCmd_t *cmd = &req->SwI2cCmds[i]; - - /* First 2 bytes are always write for lower 2b EEPROM address */ - if (i < 2) - cmd->Cmd = 1; - else - cmd->Cmd = write; - - - /* Add RESTART for read after address filled */ - cmd->CmdConfig |= (i == 2 && !write) ? CMDCONFIG_RESTART_MASK : 0; - - /* Add STOP in the end */ - cmd->CmdConfig |= (i == (numbytes - 1)) ? CMDCONFIG_STOP_MASK : 0; - - /* Fill with data regardless if read or write to simplify code */ - cmd->RegisterAddr = data[i]; - } -} - -static int navi10_i2c_read_data(struct i2c_adapter *control, - uint8_t address, - uint8_t *data, - uint32_t numbytes) -{ - uint32_t i, ret = 0; - SwI2cRequest_t req; - struct amdgpu_device *adev = to_amdgpu_device(control); - struct smu_table_context *smu_table = &adev->smu.smu_table; - struct smu_table *table = &smu_table->driver_table; - - if (numbytes > MAX_SW_I2C_COMMANDS) { - dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", - numbytes, MAX_SW_I2C_COMMANDS); - return -EINVAL; - } - - memset(&req, 0, sizeof(req)); - navi10_fill_i2c_req(&req, false, address, numbytes, data); - - mutex_lock(&adev->smu.mutex); - /* Now read data starting with that address */ - ret = smu_cmn_update_table(&adev->smu, SMU_TABLE_I2C_COMMANDS, 0, &req, - true); - mutex_unlock(&adev->smu.mutex); - - if (!ret) { - SwI2cRequest_t *res = (SwI2cRequest_t *)table->cpu_addr; - - /* Assume SMU fills res.SwI2cCmds[i].Data with read bytes */ - for (i = 0; i < numbytes; i++) - data[i] = res->SwI2cCmds[i].Data; - - dev_dbg(adev->dev, "navi10_i2c_read_data, address = %x, bytes = %d, data :", - (uint16_t)address, numbytes); - - print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, - 8, 1, data, numbytes, false); - } else - dev_err(adev->dev, "navi10_i2c_read_data - error occurred :%x", ret); - - return ret; -} - -static int navi10_i2c_write_data(struct i2c_adapter *control, - uint8_t address, - uint8_t *data, - uint32_t numbytes) -{ - uint32_t ret; - SwI2cRequest_t req; - struct amdgpu_device *adev = to_amdgpu_device(control); - - if (numbytes > MAX_SW_I2C_COMMANDS) { - dev_err(adev->dev, "numbytes requested %d is over max allowed %d\n", - numbytes, MAX_SW_I2C_COMMANDS); - return -EINVAL; - } - - memset(&req, 0, sizeof(req)); - navi10_fill_i2c_req(&req, true, address, numbytes, data); - - mutex_lock(&adev->smu.mutex); - ret = smu_cmn_update_table(&adev->smu, SMU_TABLE_I2C_COMMANDS, 0, &req, true); - mutex_unlock(&adev->smu.mutex); - - if (!ret) { - dev_dbg(adev->dev, "navi10_i2c_write(), address = %x, bytes = %d , data: ", - (uint16_t)address, numbytes); - - print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_NONE, - 8, 1, data, numbytes, false); - /* - * According to EEPROM spec there is a MAX of 10 ms required for - * EEPROM to flush internal RX buffer after STOP was issued at the - * end of write transaction. During this time the EEPROM will not be - * responsive to any more commands - so wait a bit more. - */ - msleep(10); - - } else - dev_err(adev->dev, "navi10_i2c_write- error occurred :%x", ret); - - return ret; -} - -static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap, - struct i2c_msg *msgs, int num) -{ - uint32_t i, j, ret, data_size, data_chunk_size, next_eeprom_addr = 0; - uint8_t *data_ptr, data_chunk[MAX_SW_I2C_COMMANDS] = { 0 }; - - for (i = 0; i < num; i++) { - /* - * SMU interface allows at most MAX_SW_I2C_COMMANDS bytes of data at - * once and hence the data needs to be spliced into chunks and sent each - * chunk separately - */ - data_size = msgs[i].len - 2; - data_chunk_size = MAX_SW_I2C_COMMANDS - 2; - next_eeprom_addr = (msgs[i].buf[0] << 8 & 0xff00) | (msgs[i].buf[1] & 0xff); - data_ptr = msgs[i].buf + 2; - - for (j = 0; j < data_size / data_chunk_size; j++) { - /* Insert the EEPROM dest addess, bits 0-15 */ - data_chunk[0] = ((next_eeprom_addr >> 8) & 0xff); - data_chunk[1] = (next_eeprom_addr & 0xff); - - if (msgs[i].flags & I2C_M_RD) { - ret = navi10_i2c_read_data(i2c_adap, - (uint8_t)msgs[i].addr, - data_chunk, MAX_SW_I2C_COMMANDS); - - memcpy(data_ptr, data_chunk + 2, data_chunk_size); - } else { - - memcpy(data_chunk + 2, data_ptr, data_chunk_size); - - ret = navi10_i2c_write_data(i2c_adap, - (uint8_t)msgs[i].addr, - data_chunk, MAX_SW_I2C_COMMANDS); - } - - if (ret) { - num = -EIO; - goto fail; - } - - next_eeprom_addr += data_chunk_size; - data_ptr += data_chunk_size; - } - - if (data_size % data_chunk_size) { - data_chunk[0] = ((next_eeprom_addr >> 8) & 0xff); - data_chunk[1] = (next_eeprom_addr & 0xff); - - if (msgs[i].flags & I2C_M_RD) { - ret = navi10_i2c_read_data(i2c_adap, - (uint8_t)msgs[i].addr, - data_chunk, (data_size % data_chunk_size) + 2); - - memcpy(data_ptr, data_chunk + 2, data_size % data_chunk_size); - } else { - memcpy(data_chunk + 2, data_ptr, data_size % data_chunk_size); - - ret = navi10_i2c_write_data(i2c_adap, - (uint8_t)msgs[i].addr, - data_chunk, (data_size % data_chunk_size) + 2); - } - - if (ret) { - num = -EIO; - goto fail; - } - } - } - -fail: - return num; -} - -static u32 navi10_i2c_func(struct i2c_adapter *adap) -{ - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; -} - - -static const struct i2c_algorithm navi10_i2c_algo = { - .master_xfer = navi10_i2c_xfer, - .functionality = navi10_i2c_func, -}; - static ssize_t navi10_get_gpu_metrics(struct smu_context *smu, void **table) {