Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp365600ybl; Tue, 7 Jan 2020 21:25:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxxiXxXUovWeIYCIVwwnkj4P8HA6qJY9YQaBuECW8h0uTCCkaKNuy3kWcZtjel2ib9AghW4 X-Received: by 2002:a05:6808:1c5:: with SMTP id x5mr1767102oic.57.1578461110691; Tue, 07 Jan 2020 21:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578461110; cv=none; d=google.com; s=arc-20160816; b=Y6InD26UTg+y+NTb1lr7vK00bHOroJ1BdcJKV9J8PSiSQVKFFkniG1NcJtjpXaNXZ0 pcXoOuWz5GN4VgLpgMQYnm6AJiyyYutoyWcGgQDZZWHYcYR8dPsPlfbqR+Obvq5ebrkY S6B3dcCjRtKGV0gXqy30+tTAUOIrp94rRhLyiS8g/MOzWskmKWMu8tiR1yu9WVLAa7Jn HrLnc08d9zEtvtC8cprHSulzUZlbChElkMeEJMAAskYiMllL3RiDYrlLpskdodZgerFd kuCsGkP0sjniTgQZNLq87vjWBwx2F9HR8dYWmY4eo7Ob+tIdYFVFfu5fiiKHebRaVWv8 /HxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GZPi5S7C9JBOvDvG9rs8XlkVI4VOHpLwCsMiOaYI8o4=; b=N6qSOQ+nsvEaXaSVAsMq5oPvbV5LwXvP0O60M0GzXGihLphQUFM3LkRYm1doRI6TZg M4qrUPDVPWRO1WcugqXoEzdlgObbY/mspeoBVVSMWyWSvkdOBp1ibHlrb52kMGGv089G veuQ6weDAX5NfM6t2BhycxJEPc/Tn2cGqIGDPUavxJWA4yYWPBWbhTOCWReoDLqAH8cZ CPyfIx2rN0qBAQmppSp9N6VTKeF/8BcXCiZscGh68Fr3xzt/tAyZiLiwLBgm5orWe4PI CojRdyKYVJhgsJ5KesOtqWHM8qKGNLgi/WKvuVMYVjQfyf/yX+dAxPLFjw4xUCG+LrGW oRgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KZ2Fr1SI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si1315876otg.99.2020.01.07.21.24.58; Tue, 07 Jan 2020 21:25:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KZ2Fr1SI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbgAHFYK (ORCPT + 99 others); Wed, 8 Jan 2020 00:24:10 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34134 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbgAHFYH (ORCPT ); Wed, 8 Jan 2020 00:24:07 -0500 Received: by mail-pl1-f196.google.com with SMTP id x17so642638pln.1 for ; Tue, 07 Jan 2020 21:24:07 -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=GZPi5S7C9JBOvDvG9rs8XlkVI4VOHpLwCsMiOaYI8o4=; b=KZ2Fr1SIWZOlOI/MInwohmz1Hb6Xx7Tq+QTxkCat51I7DcfFdbynSqAxDlo/ZrmAzy bzYx04hvPnPCCny7HlSE8qtcQ54XXy3skRRoKWw/srh/+NPKZBDJmkfK0r32EhMKP8As Ki1O01CCcGhKnBDTGVZ2lIeuDq9nZ6XwreZMY= 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=GZPi5S7C9JBOvDvG9rs8XlkVI4VOHpLwCsMiOaYI8o4=; b=ttWuzfrOS/zkZy3DtiYcpL6tvKVsFFYivV5G2+AsbQsRiDxLfOjAXI6xxlEATyM/oP tu1JhLctVt7XhhcPnumcVTkAKx972HxfD1svGF88bRkn/s67kKxDxDStGQMBk0DRti4F MUs/OjtO2izeVSJV+51xhBEHMipcG4vyAbci+qWEFip+VrmPaIgthS8G7bW3L/jBgOoq F66MdviK2Awqfq3D4WVW0od8e9UrDXDTYMuobgz14PZhpqzl0hrs3u1M4J7jbg9Smifk T461oRiOiBrnWrYNoEVh3dTQMD8la8TcGsCyI2pjN9RsfPW8tn5/+8j5MNdZu6JXtcez jVlw== X-Gm-Message-State: APjAAAW8h+dsPfXFhrNl05UHXjncXJ1jASM356jN5tXcEYA35jxg1RHq 3DsuZf5DZySgkkc0egi4UXyLGg== X-Received: by 2002:a17:90a:d789:: with SMTP id z9mr2508178pju.5.1578461047043; Tue, 07 Jan 2020 21:24:07 -0800 (PST) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:d8b7:33af:adcb:b648]) by smtp.gmail.com with ESMTPSA id n24sm387505pff.12.2020.01.07.21.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 21:24:06 -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 Subject: [PATCH v2 4/7] drm/panfrost: Add support for a second regulator for the GPU Date: Wed, 8 Jan 2020 13:23:34 +0800 Message-Id: <20200108052337.65916-5-drinkcat@chromium.org> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog In-Reply-To: <20200108052337.65916-1-drinkcat@chromium.org> References: <20200108052337.65916-1-drinkcat@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some GPUs, namely, the bifrost/g72 part on MT8183, have a second regulator for their SRAM, let's add support for that. Signed-off-by: Nicolas Boichat --- drivers/gpu/drm/panfrost/panfrost_device.c | 21 +++++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 238fb6d54df4732..a0b0a6fef8b4e63 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -102,12 +102,33 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) return ret; } + pfdev->regulator_sram = devm_regulator_get_optional(pfdev->dev, "sram"); + if (IS_ERR(pfdev->regulator_sram)) { + ret = PTR_ERR(pfdev->regulator_sram); + dev_err(pfdev->dev, "failed to get SRAM regulator: %d\n", ret); + goto err; + } + + if (pfdev->regulator_sram) { + ret = regulator_enable(pfdev->regulator_sram); + if (ret < 0) { + dev_err(pfdev->dev, + "failed to enable SRAM regulator: %d\n", ret); + goto err; + } + } + return 0; + +err: + regulator_disable(pfdev->regulator); + return ret; } static void panfrost_regulator_fini(struct panfrost_device *pfdev) { regulator_disable(pfdev->regulator); + regulator_disable(pfdev->regulator_sram); } int panfrost_device_init(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 06713811b92cdf7..a124334d69e7e93 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -60,6 +60,7 @@ struct panfrost_device { struct clk *clock; struct clk *bus_clock; struct regulator *regulator; + struct regulator *regulator_sram; struct reset_control *rstc; struct panfrost_features features; -- 2.24.1.735.g03f4e72817-goog