From patchwork Sun Dec 30 17:48:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 10745151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E72AA1399 for ; Sun, 30 Dec 2018 17:49:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5A02285A6 for ; Sun, 30 Dec 2018 17:49:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9F0C285AD; Sun, 30 Dec 2018 17:49:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74C26285A6 for ; Sun, 30 Dec 2018 17:49:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C9FC89FEA; Sun, 30 Dec 2018 17:49:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9AC5B898A7 for ; Sun, 30 Dec 2018 17:49:01 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id g11-v6so22342234ljk.3 for ; Sun, 30 Dec 2018 09:49:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=1awO/MoKoVwOfNgJEovkQ5ae+K1bPPHX4RXZHhL2kVE=; b=oNdFo/sjWLfDsRYG1QpMyiVfum4Lb0AARdMCPK2wo/Gj5bYlYFqHyAxmKy/t9lGX8B 5UXfYDCyuDa6fBYe7ZGE+yyco8apLi2+L8ZlkEHFEGR73GhSHgpwZ5fCQPv4AI+XXlY7 cCMdP9DuHJb+wi9w2EiGmFUYDuEur3M7lD/84wEC/bC5d2NdzOWPDO3Btd6Tz8rlS61B NfeenjuE5FAm6FNQNGCK2IIhDNMazlfcFEmSFl2xtK2mhXGqrho5cQLxFdPyoQ12wo8w ryAFyKtWeNMTW/EqM5ZkWHQwrn0p9yObagjuWDASEPGqxhCTp8ix1128jWe9F8h8vxbt a60Q== X-Gm-Message-State: AJcUukdLzMVrQZ/vgEF3pPCIJFSBZR/4L5VBbIAo33/X7wQm+ZWYsk1P BY3EMsfSKANqcbZlsTxU3mY= X-Google-Smtp-Source: ALg8bN49pxaqWPQHzlAEBw2HU126+64sYUV11t8VaB+YgtfEGBdCAxOcjtw7mfZBhDTdZVPz8a2TFg== X-Received: by 2002:a2e:2246:: with SMTP id i67-v6mr17082181lji.154.1546192140001; Sun, 30 Dec 2018 09:49:00 -0800 (PST) Received: from jupiter.lan (18.158-248-194.customer.lyse.net. [158.248.194.18]) by smtp.gmail.com with ESMTPSA id q11sm8853170lfc.92.2018.12.30.09.48.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Dec 2018 09:48:59 -0800 (PST) From: Sam Ravnborg To: Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Lechner , Laurent Pinchart , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 03/14] drm: move DRM_SWITCH_POWER defines to drm_device.h Date: Sun, 30 Dec 2018 18:48:27 +0100 Message-Id: <20181230174838.32330-4-sam@ravnborg.org> X-Mailer: git-send-email 2.12.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sam Ravnborg MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Move DRM_SWITCH_POWER out of drmP.h to allow users to get rid of the drmP include. Moved to drm_device.h because drm_device.switch_power_state is the only user. Converted to enum and added sparse kerneldoc comments. Signed-off-by: Sam Ravnborg Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: Daniel Vetter --- include/drm/drmP.h | 5 ----- include/drm/drm_device.h | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index db94ef00940e..9e47c8dc6b87 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -94,11 +94,6 @@ struct dma_buf_attachment; struct pci_dev; struct pci_controller; -#define DRM_SWITCH_POWER_ON 0 -#define DRM_SWITCH_POWER_OFF 1 -#define DRM_SWITCH_POWER_CHANGING 2 -#define DRM_SWITCH_POWER_DYNAMIC_OFF 3 - /* returns true if currently okay to sleep */ static inline bool drm_can_sleep(void) { diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index 2b154ead9efc..d7cedbac66a3 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h @@ -24,6 +24,25 @@ struct inode; struct pci_dev; struct pci_controller; + +/** + * enum drm_switch_power - power state of drm device + */ + +enum switch_power_state { + /** @DRM_SWITCH_POWER_ON: Power state is ON */ + DRM_SWITCH_POWER_ON = 0, + + /** @DRM_SWITCH_POWER_OFF: Power state is OFF */ + DRM_SWITCH_POWER_OFF = 1, + + /** @DRM_SWITCH_POWER_CHANGING: Power state is changing */ + DRM_SWITCH_POWER_CHANGING = 2, + + /** @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended */ + DRM_SWITCH_POWER_DYNAMIC_OFF = 3, +}; + /** * struct drm_device - DRM device structure * @@ -291,7 +310,15 @@ struct drm_device { /** @vma_offset_manager: GEM information */ struct drm_vma_offset_manager *vma_offset_manager; - int switch_power_state; + /** + * @switch_power_state: + * + * Power state of the client. + * Used by drivers supporting the switcheroo driver. + * The state is maintained in the + * &vga_switcheroo_client_ops.set_gpu_state callback + */ + enum switch_power_state switch_power_state; /** * @fb_helper: