From patchwork Fri Feb 7 05:26:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 205069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 591BFC3F68F for ; Fri, 7 Feb 2020 05:26:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30FEC2253D for ; Fri, 7 Feb 2020 05:26:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="jehEAPOl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726573AbgBGF0y (ORCPT ); Fri, 7 Feb 2020 00:26:54 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40906 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbgBGF0y (ORCPT ); Fri, 7 Feb 2020 00:26:54 -0500 Received: by mail-pg1-f195.google.com with SMTP id z7so513877pgk.7 for ; Thu, 06 Feb 2020 21:26:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CIn5sKN4KiBio0RDhfFCPXTE80uz5ajGK0muKh5dKSI=; b=jehEAPOlDHxOIf658U57Pz+Lxc9WjB5npjsc5eIfdKKIgLI6wIasqGvVPkiVpdJQ0G Hzpf9s+Mrm6ErGv53ZanL5Ar8j551dwPz09ideYJ5ExThnUtNvN841ZIU2L4qTBXCsLw CUJvrrL1JkluseTv3rUysxVHovsnV10a4Qg0g= 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=CIn5sKN4KiBio0RDhfFCPXTE80uz5ajGK0muKh5dKSI=; b=a7YTkOu0AMf4nU8Ti+vyO/FRhY0elG3+V6i1egRcqsPDaVILflo1Jpa70qp/t7LHdu GLI2qRy3++wCYx3/c3ytON6NdrFLw4O9j98p/KDpQVl8ZbJMOyrt+slneNfoblUFtPZp 2UOC3V26VsCV//A1zr3+QJa9xf6Pv55nWwSxkuN0IlKljeWEXaZU+hUJqg6GZmmQzf/A z1uRrsaBcAOgL8CAgmFesJ8/W/LReBns0vfMa32ZjsHBIHYLsjWdVyUpbTXwo3GniMcL Y4PindHo66FDa0rBlxT1Cav0HXsidOXqPEV2VhRdnhyqcnpHvh52R3bVkb3lVjSz243H Jkjg== X-Gm-Message-State: APjAAAWnZdZ5ynHP/XlZSzJIk0dwbZDx5ep8ytmUXuG9sQEYerx0R0p0 vCBIKonOT1rby0NonVATocROFLCE1LI= X-Google-Smtp-Source: APXvYqx5i7f7z7/eMVnpdL5X2gaY4KuXn3Lv/gF5m1NmEIhVV0KooOh59/YHin0f3dnQN5ufHFD66g== X-Received: by 2002:a63:5558:: with SMTP id f24mr7314186pgm.92.1581053213363; Thu, 06 Feb 2020 21:26:53 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id i66sm1174485pfg.85.2020.02.06.21.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 21:26:52 -0800 (PST) From: Nicolas Boichat To: Rob Herring Cc: David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, hsinyi@chromium.org, ulf.hansson@linaro.org Subject: [PATCH v4 1/7] dt-bindings: gpu: mali-bifrost: Add Mediatek MT8183 Date: Fri, 7 Feb 2020 13:26:21 +0800 Message-Id: <20200207052627.130118-2-drinkcat@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200207052627.130118-1-drinkcat@chromium.org> References: <20200207052627.130118-1-drinkcat@chromium.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Define a compatible string for the Mali Bifrost GPU found in Mediatek's MT8183 SoCs. Signed-off-by: Nicolas Boichat Reviewed-by: Alyssa Rosenzweig --- v4: - Add power-domain-names description (kept Alyssa's reviewed-by as the change is minor) v3: - No change .../bindings/gpu/arm,mali-bifrost.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml index 4ea6a8789699709..0d93b3981445977 100644 --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml @@ -17,6 +17,7 @@ properties: items: - enum: - amlogic,meson-g12a-mali + - mediatek,mt8183-mali - realtek,rtd1619-mali - rockchip,px30-mali - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable @@ -62,6 +63,30 @@ allOf: minItems: 2 required: - resets + - if: + properties: + compatible: + contains: + const: mediatek,mt8183-mali + then: + properties: + sram-supply: true + power-domains: + description: + List of phandle and PM domain specifier as documented in + Documentation/devicetree/bindings/power/power_domain.txt + minItems: 3 + maxItems: 3 + power-domain-names: + items: + - const: core0 + - const: core1 + - const: 2d + + required: + - sram-supply + - power-domains + - power-domains-names examples: - | From patchwork Fri Feb 7 05:26:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 205068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B15DC2D0B1 for ; Fri, 7 Feb 2020 05:27:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3143F22522 for ; Fri, 7 Feb 2020 05:27:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EfIrgn8K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726465AbgBGF1D (ORCPT ); Fri, 7 Feb 2020 00:27:03 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34420 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726899AbgBGF1B (ORCPT ); Fri, 7 Feb 2020 00:27:01 -0500 Received: by mail-pl1-f196.google.com with SMTP id j7so535073plt.1 for ; Thu, 06 Feb 2020 21:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6xpmN6rVRpQ9+/BKl26/gWkRoJrUlmctwTSJRjJCc9M=; b=EfIrgn8KJTdEPRV6t2D01u2C1tbZ2N5L+zz7+zq66y1iSVivuP8DBp9QrRPb2KxMeQ /ektvloYsjEAqIXPfLcxnAAUqVeqhAJibeu5lQbfMyCx5VI1xcyHGPq//k6mqcmQ0gfS CPinmVfCOSlqIHxC/KFn8Uqs9YBoRyqsFwy9g= 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=6xpmN6rVRpQ9+/BKl26/gWkRoJrUlmctwTSJRjJCc9M=; b=DP7dbQLjkV6xKkk9UWca5QFVV0fjEGdUfNETDgTbvJH/iPgtkMAwHVBFIOCSnbsrEI EGFN/gIVM+INMd4dNziQdkxqw7DrDb6U05idxs0mNyMcFYs0nW+vfQ2psKzKk9/jHMeh sF+bLl6O5oqDF/HhY989C7qs42sEtI1USuLv4/l4OviVCRSHxNUyx/NxoHWeDiPAwJTg bvh4JDzearXzS3E0h5uxX6GhZIQfUzh/PgDInoEOg0LaW1H3Q69eb2B7vuBq2twPhw+X VFPXUuypEgsDFc0Dnsfc0xsMmYgxtYsvs2rIh2WciHXHS1UoeaplUbxjJv/6iFGw+QMr fa1w== X-Gm-Message-State: APjAAAUThOGyASXhX+uLtEHEb6Z6SgRhGEB2GROK4KbYHnpSpXUYhGmo 2MbQSP5/3WgH9EdfIMbIxOOSQQ== X-Google-Smtp-Source: APXvYqzX299A08Kcu0qlzSD8JRvc5zkotFDW+fzSDBqKgJ0Ds/rXQnBQim49TnwlSOj3Rct3QjyFZg== X-Received: by 2002:a17:902:b682:: with SMTP id c2mr8017343pls.127.1581053219763; Thu, 06 Feb 2020 21:26:59 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id i66sm1174485pfg.85.2020.02.06.21.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 21:26:59 -0800 (PST) From: Nicolas Boichat To: Rob Herring Cc: David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, hsinyi@chromium.org, ulf.hansson@linaro.org Subject: [PATCH v4 3/7] drm/panfrost: Improve error reporting in panfrost_gpu_power_on Date: Fri, 7 Feb 2020 13:26:23 +0800 Message-Id: <20200207052627.130118-4-drinkcat@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200207052627.130118-1-drinkcat@chromium.org> References: <20200207052627.130118-1-drinkcat@chromium.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org It is useful to know which component cannot be powered on. Signed-off-by: Nicolas Boichat Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig --- Was useful when trying to probe Bifrost GPU, to understand what issue we are facing. v4: - No change v3: - Rebased on https://patchwork.kernel.org/patch/11325689/ drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c index 460fc190de6e815..856f2fd1fa8ed27 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c @@ -308,17 +308,20 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev) gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present); ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO, val, val == pfdev->features.l2_present, 100, 1000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu L2"); gpu_write(pfdev, SHADER_PWRON_LO, pfdev->features.shader_present); - ret |= readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, + ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, val, val == pfdev->features.shader_present, 100, 1000); + if (ret) + dev_err(pfdev->dev, "error powering up gpu shader"); gpu_write(pfdev, TILER_PWRON_LO, pfdev->features.tiler_present); - ret |= readl_relaxed_poll_timeout(pfdev->iomem + TILER_READY_LO, + ret = readl_relaxed_poll_timeout(pfdev->iomem + TILER_READY_LO, val, val == pfdev->features.tiler_present, 100, 1000); - if (ret) - dev_err(pfdev->dev, "error powering up gpu"); + dev_err(pfdev->dev, "error powering up gpu tiler"); } void panfrost_gpu_power_off(struct panfrost_device *pfdev) From patchwork Fri Feb 7 05:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 205067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBA84C3B183 for ; Fri, 7 Feb 2020 05:27:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C42E222464 for ; Fri, 7 Feb 2020 05:27:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="leq9iVWF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727048AbgBGF1K (ORCPT ); Fri, 7 Feb 2020 00:27:10 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:52274 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727005AbgBGF1J (ORCPT ); Fri, 7 Feb 2020 00:27:09 -0500 Received: by mail-pj1-f66.google.com with SMTP id ep11so431759pjb.2 for ; Thu, 06 Feb 2020 21:27:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1OPawnjFjdppk48OdmcnT2/7I2TyhqjSstM3nsHqEyQ=; b=leq9iVWFFwWc9SzvLj2OAYbrGFc+oehb6yV09Pzq1ffNBybAnHS5RyCURmnyFsX0im YaWhNs+Nl6tLggbvcAWNUCDzNlX5w06vGsu5yjYtf3DlLPTZoJsvQlAbq2Zxlqv3EFxL 1QJBK5hAfU+PS0NW8uNLYDPFvg60Kt9nVRxiI= 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=1OPawnjFjdppk48OdmcnT2/7I2TyhqjSstM3nsHqEyQ=; b=ght88BJWefYxWFH10ljGTM2beU9XkVkvNPMARYGailBOoO1/qQIubSjloq6FCtELxW zQV0YBioWUUWpkNJCXpdTJfjF7anRZCPkH8pPBnUllqu/ksCj1JPC6DulXSft6VK5fXU eyPinP9dv1/lU5cD+Zz2mtZjaWUQFmIfOzo7jpmxPfFJ9rdYBR5k9W2gIvOGeTGjtASE LxLLpb1rX2jTD/FXXtqwnCDWh19BQJ3diYlpr3Lo/V0wCuZT7XqHiCg23potNZ0aWW35 tLQCb6fQBEEkB+AYBhfB85dzrMRzIgWBjeeog0+yP995RuuAQROByhIWGyqGKZPtupeT EcYQ== X-Gm-Message-State: APjAAAVYtuJhIdG5cICLyDCiXm4gkyimK3dzKPWlmW6ReJnpq8g/1ZN0 FX9ZqD4jTTJweX4p326EVpH6eA== X-Google-Smtp-Source: APXvYqxjKyDt1CleJdBxolsoRem+PmuvkMQG1Lq12fr6aeZNGLxW0nPVgS7A8TQfu34JJoOQ5pUshQ== X-Received: by 2002:a17:90a:36af:: with SMTP id t44mr1758975pjb.25.1581053229151; Thu, 06 Feb 2020 21:27:09 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id i66sm1174485pfg.85.2020.02.06.21.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 21:27:08 -0800 (PST) From: Nicolas Boichat To: Rob Herring Cc: David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, hsinyi@chromium.org, ulf.hansson@linaro.org Subject: [PATCH v4 6/7] RFC: drm/panfrost: Add mt8183-mali compatible string Date: Fri, 7 Feb 2020 13:26:26 +0800 Message-Id: <20200207052627.130118-7-drinkcat@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200207052627.130118-1-drinkcat@chromium.org> References: <20200207052627.130118-1-drinkcat@chromium.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org For testing only, the driver doesn't really work yet, AFAICT. Signed-off-by: Nicolas Boichat --- v4: - Add power domain names. v3: - Match mt8183-mali instead of bifrost, as we require special handling for the 2 regulators and 3 power domains. drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index a6e162236d67fdf..497c375932ad589 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -667,6 +667,15 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +const char * const mediatek_mt8183_supplies[] = { "mali", "sram" }; +const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "2d" }; +static const struct panfrost_compatible mediatek_mt8183_data = { + .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies), + .supply_names = mediatek_mt8183_supplies, + .num_pm_domains = 3, + .pm_domain_names = mediatek_mt8183_pm_domains, +}; + static const struct of_device_id dt_match[] = { { .compatible = "arm,mali-t604", .data = &default_data, }, { .compatible = "arm,mali-t624", .data = &default_data, }, @@ -677,6 +686,8 @@ static const struct of_device_id dt_match[] = { { .compatible = "arm,mali-t830", .data = &default_data, }, { .compatible = "arm,mali-t860", .data = &default_data, }, { .compatible = "arm,mali-t880", .data = &default_data, }, + { .compatible = "mediatek,mt8183-mali", + .data = &mediatek_mt8183_data }, {} }; MODULE_DEVICE_TABLE(of, dt_match); From patchwork Fri Feb 7 05:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 205066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3C50C3F68F for ; Fri, 7 Feb 2020 05:27:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBF4124125 for ; Fri, 7 Feb 2020 05:27:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mP91Qror" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727117AbgBGF1O (ORCPT ); Fri, 7 Feb 2020 00:27:14 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:32770 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727047AbgBGF1N (ORCPT ); Fri, 7 Feb 2020 00:27:13 -0500 Received: by mail-pg1-f193.google.com with SMTP id 6so531989pgk.0 for ; Thu, 06 Feb 2020 21:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6xiAuePiYUDaMhCwdUVnLN02q98KdUMo0qYM9SWCYvk=; b=mP91QrorHLWCX9Rh9X47DtclzQQKLoeO9iO3IvXmxidLSUWEYCmZG3ZEgKr0pSJKnb TWUxVRkDGv77ATkUUhec/xYpUXI0QkVwwC+ITTb2N+nslPjJNvFbiuP+FOKJww+18Phh gk+CCiFxNbG3t97x3izZOi0kxZeRlTzW3NCIg= 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=6xiAuePiYUDaMhCwdUVnLN02q98KdUMo0qYM9SWCYvk=; b=TB7+qTKPedADY9ab2ouTN0hDmaco2vALB++04qL+7TGG32Mk3onyGQ5fR0iv8lnYyf kT+wnMvDMe//Pa/olAJlwU82BygO2fQ1q2kWw0LDA3pdAKl/bv4uhqvJaX2+T+KiK29x 4j4CxWsdAb5WkcYUBxYArFB458WHxGxCvr5RwRdtZ5VWambCApN0YK4XPsdJlykNNU9A V6FsgnscVo/hDzCnRBpVYCpC+sBsAQTU8erZMdo36Ig6TLf0uDHiNqdxyyP2s2+exAIl bavlXje6WXsJL7Af5PZPYJ4o3knrfePkNmsSTutRCNS6zObdzqIqMK/ULtp5K7Qjvtab LYOw== X-Gm-Message-State: APjAAAVLeNdOJiyusILeQbf03nc/pEmgtb2xrrbH/Fgv5wFwbgtBLwpj gtNimbWHIdmB9MFqBlCgc98kylOnWIA= X-Google-Smtp-Source: APXvYqzDh18JECBJPN5an/ZENhGDbzmt0zN9l3Znxmk+TvBwf8M3GApG6PLEhVwrfyAvj4N2hDOdew== X-Received: by 2002:a63:2266:: with SMTP id t38mr7950990pgm.145.1581053232225; Thu, 06 Feb 2020 21:27:12 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id i66sm1174485pfg.85.2020.02.06.21.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 21:27:11 -0800 (PST) From: Nicolas Boichat To: Rob Herring Cc: David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, hsinyi@chromium.org, ulf.hansson@linaro.org Subject: [PATCH v4 7/7] RFC: drm/panfrost: devfreq: Add support for 2 regulators Date: Fri, 7 Feb 2020 13:26:27 +0800 Message-Id: <20200207052627.130118-8-drinkcat@chromium.org> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog In-Reply-To: <20200207052627.130118-1-drinkcat@chromium.org> References: <20200207052627.130118-1-drinkcat@chromium.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The Bifrost GPU on MT8183 uses 2 regulators (core and SRAM) for devfreq, and provides OPP table with 2 sets of voltages. TODO: This is incomplete as we'll need add support for setting a pair of voltages as well. Signed-off-by: Nicolas Boichat --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 17 +++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbfccb..9c0987a3d71c597 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -79,6 +79,21 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; + /* If we have 2 regulator, we need an OPP table with 2 voltages. */ + if (pfdev->comp->num_supplies > 1) { + pfdev->devfreq.dev_opp_table = + dev_pm_opp_set_regulators(dev, + pfdev->comp->supply_names, + pfdev->comp->num_supplies); + if (IS_ERR(pfdev->devfreq.dev_opp_table)) { + ret = PTR_ERR(pfdev->devfreq.dev_opp_table); + pfdev->devfreq.dev_opp_table = NULL; + dev_err(dev, + "Failed to init devfreq opp table: %d\n", ret); + return ret; + } + } + ret = dev_pm_opp_of_add_table(dev); if (ret == -ENODEV) /* Optional, continue without devfreq */ return 0; @@ -119,6 +134,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) if (pfdev->devfreq.cooling) devfreq_cooling_unregister(pfdev->devfreq.cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + if (pfdev->devfreq.dev_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.dev_opp_table); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index c30c719a805940a..5009a8b7c853ea1 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -110,6 +110,7 @@ struct panfrost_device { struct { struct devfreq *devfreq; struct thermal_cooling_device *cooling; + struct opp_table *dev_opp_table; ktime_t busy_time; ktime_t idle_time; ktime_t time_last_update;