Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1049422ybm; Wed, 27 May 2020 14:55:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBxftKHzN/bmw14YipcSf8RYxbT3+/DoufAjxnkcEemJvCsoc+Hz947SpN6IifDVGVBODl X-Received: by 2002:a17:906:fac8:: with SMTP id lu8mr334921ejb.432.1590616406683; Wed, 27 May 2020 14:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590616406; cv=none; d=google.com; s=arc-20160816; b=McFszpaBWGEcvl6Zzf87F07oPYEhOuU+qxD0ov8bLJ4A6aTpN1Hl+/BT/fSm0w0uwm fiNKGe6Yg/iHJr8XE6yqGLh33yd7m6rGHhqzQ6mG1moNGCrLncqdy5e01sgH/qa7OYBT zpMDXwpci8tWbhCUNg9j75td1ktBBBbCSAw6F4GFALTARyME3ibY6tkuyN4uOpCJ/f8q c6Sii4XdPlExcdVH0jbvQ4B/N7YJK9FWOc4n+JiHaK4uzDRriN6MtfLsSke8EW7jKg9J pkWeo6+w/p0rmlchLYN1mASMISwhdwHQr7g/RZ29HpDUkql7z5aqmj5I7qgtzVsP5psJ JkDg== 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:dkim-signature; bh=YQuZyoxBv8vu549NTT4wHZ6thTXny0W7gxB64WBauFs=; b=xek6icqa9bTo2xCFaYYwviI4/wWOHO4//iW5DIM8tg+W8EKV3RGKd2ovH72Nrjja7Z 6DX6BOHIBLX0ZAVd9AqtkA37pUkH8BH5wivk/FdT9yhCVHvkW1GbropD0SoDbz5f44MY C6s44v2X8tt/rui6PXsli36iwnOy499Y/qGqHrvfEIgCI3rIVrliEspw+Y0v7LFXGFYO XOhA8HmrIoi+PA+IMQMxnkSpl5exdqvi7UFmjl1D+lYrWoXqY9jyrBAkTghatyHa5TUT EQwqaUEqTiKpC8r/Ubqv28Nmdm3MIzr2kl74huW+CSts1s+4mX56WMA9AhhizQb1pRry TBpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=NAT2GKyH; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jp4khL+i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si1622277ejx.725.2020.05.27.14.53.04; Wed, 27 May 2020 14:53:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=NAT2GKyH; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=jp4khL+i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388978AbgE0Pzt (ORCPT + 98 others); Wed, 27 May 2020 11:55:49 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:44459 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390256AbgE0PvI (ORCPT ); Wed, 27 May 2020 11:51:08 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id BD9C55820F2; Wed, 27 May 2020 11:51:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:51:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=YQuZyoxBv8vu5 49NTT4wHZ6thTXny0W7gxB64WBauFs=; b=NAT2GKyHhhBLeBhG4ns9/NmJBhPLO sdVW3NsynoM49ui3KNkpPlTlNRg0pCpkKmaq2+eCVoWanpqMUuWBsAolNbHamtbh yCcLtyK+fh34lVmy4lAxIigmiS+o4c/xzSozirZofcDn3S3crebxeRTYjvorZbZc xmgYF/O3H/JlntrNKTvdToFIaxXGpZQ8QUJLzvFCvh1nY+Jh86LlWDwThDK+ECat gXHetG9ZsHUweLz/xGH+XJHU6ynhgAnLvwk+TKQH0ugorCvGqB9EzxN46oupC2es hlCYOxbUocp+CT+zLzaT+ELmYMWs0WiyCblpnuUGy91hY2CLoMbkoserQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=YQuZyoxBv8vu549NTT4wHZ6thTXny0W7gxB64WBauFs=; b=jp4khL+i DXon+XPeDxE4OcA9K0rOLM5/LJzKGub5nvlL7HC5oVJHyAQyLFqkxZiq49Nc3QHQ /hEHiTfp79Q746Oyjek+P+A4HeRpcrIAkXInMpKkrxZ5nV7vAFz5hceBEa26960T YT56KoKaoFccmiyDtcDEdiNX+eXk7cR4LMc6ORTx30CQiEI58Jt+xHVPnmfSBAR3 qmKM7zNcCswd2sPJBRf6AFhux4xx+MBqp5eNjTScygLEJfhN8yac3VEtg+t3m3/I RAMTqJV2yKwI/zrbvqlzdPke+g12+wUxfl4mJj1EO/ZP5uysuusP9xnU5mPnovBo koTEAu/DeUMKlw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepgeekne curfgrrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 5A5EF30618B7; Wed, 27 May 2020 11:51:06 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Maxime Ripard Subject: [PATCH v3 069/105] drm/vc4: hdmi: Move structure to header Date: Wed, 27 May 2020 17:48:39 +0200 Message-Id: <4c4da3823e4d1a8189e96a59a79451fff372f70b.1590594512.git-series.maxime@cerno.tech> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: 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 We will need to share the vc4_hdmi and related structures with multiple files, so let's create a header for it. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 76 +------------------------------- drivers/gpu/drm/vc4/vc4_hdmi.h | 86 +++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 75 deletions(-) create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.h diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 38fe942a327b..41573fca5a40 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -49,87 +49,13 @@ #include #include "media/cec.h" #include "vc4_drv.h" +#include "vc4_hdmi.h" #include "vc4_regs.h" #define HSM_CLOCK_FREQ 163682864 #define CEC_CLOCK_FREQ 40000 #define CEC_CLOCK_DIV (HSM_CLOCK_FREQ / CEC_CLOCK_FREQ) -/* HDMI audio information */ -struct vc4_hdmi_audio { - struct snd_soc_card card; - struct snd_soc_dai_link link; - struct snd_soc_dai_link_component cpu; - struct snd_soc_dai_link_component codec; - struct snd_soc_dai_link_component platform; - int samplerate; - int channels; - struct snd_dmaengine_dai_dma_data dma_data; - struct snd_pcm_substream *substream; -}; - -/* General HDMI hardware state. */ -struct vc4_hdmi { - struct platform_device *pdev; - - struct drm_encoder *encoder; - struct drm_connector *connector; - - struct vc4_hdmi_audio audio; - - struct i2c_adapter *ddc; - void __iomem *hdmicore_regs; - void __iomem *hd_regs; - int hpd_gpio; - bool hpd_active_low; - - struct cec_adapter *cec_adap; - struct cec_msg cec_rx_msg; - bool cec_tx_ok; - bool cec_irq_was_rx; - - struct clk *pixel_clock; - struct clk *hsm_clock; - - struct debugfs_regset32 hdmi_regset; - struct debugfs_regset32 hd_regset; -}; - -#define HDMI_READ(offset) readl(vc4->hdmi->hdmicore_regs + offset) -#define HDMI_WRITE(offset, val) writel(val, vc4->hdmi->hdmicore_regs + offset) -#define HD_READ(offset) readl(vc4->hdmi->hd_regs + offset) -#define HD_WRITE(offset, val) writel(val, vc4->hdmi->hd_regs + offset) - -/* VC4 HDMI encoder KMS struct */ -struct vc4_hdmi_encoder { - struct vc4_encoder base; - bool hdmi_monitor; - bool limited_rgb_range; -}; - -static inline struct vc4_hdmi_encoder * -to_vc4_hdmi_encoder(struct drm_encoder *encoder) -{ - return container_of(encoder, struct vc4_hdmi_encoder, base.base); -} - -/* VC4 HDMI connector KMS struct */ -struct vc4_hdmi_connector { - struct drm_connector base; - - /* Since the connector is attached to just the one encoder, - * this is the reference to it so we can do the best_encoder() - * hook. - */ - struct drm_encoder *encoder; -}; - -static inline struct vc4_hdmi_connector * -to_vc4_hdmi_connector(struct drm_connector *connector) -{ - return container_of(connector, struct vc4_hdmi_connector, base); -} - static const struct debugfs_reg32 hdmi_regs[] = { VC4_REG32(VC4_HDMI_CORE_REV), VC4_REG32(VC4_HDMI_SW_RESET_CONTROL), diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h new file mode 100644 index 000000000000..5ec5d1f6b1e6 --- /dev/null +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -0,0 +1,86 @@ +#ifndef _VC4_HDMI_H_ +#define _VC4_HDMI_H_ + +#include +#include +#include +#include + +#include "vc4_drv.h" + +/* HDMI audio information */ +struct vc4_hdmi_audio { + struct snd_soc_card card; + struct snd_soc_dai_link link; + struct snd_soc_dai_link_component cpu; + struct snd_soc_dai_link_component codec; + struct snd_soc_dai_link_component platform; + int samplerate; + int channels; + struct snd_dmaengine_dai_dma_data dma_data; + struct snd_pcm_substream *substream; +}; + +/* General HDMI hardware state. */ +struct vc4_hdmi { + struct platform_device *pdev; + + struct drm_encoder *encoder; + struct drm_connector *connector; + + struct vc4_hdmi_audio audio; + + struct i2c_adapter *ddc; + void __iomem *hdmicore_regs; + void __iomem *hd_regs; + int hpd_gpio; + bool hpd_active_low; + + struct cec_adapter *cec_adap; + struct cec_msg cec_rx_msg; + bool cec_tx_ok; + bool cec_irq_was_rx; + + struct clk *pixel_clock; + struct clk *hsm_clock; + + struct debugfs_regset32 hdmi_regset; + struct debugfs_regset32 hd_regset; +}; + +#define HDMI_READ(offset) readl(vc4->hdmi->hdmicore_regs + offset) +#define HDMI_WRITE(offset, val) writel(val, vc4->hdmi->hdmicore_regs + offset) +#define HD_READ(offset) readl(vc4->hdmi->hd_regs + offset) +#define HD_WRITE(offset, val) writel(val, vc4->hdmi->hd_regs + offset) + +/* VC4 HDMI encoder KMS struct */ +struct vc4_hdmi_encoder { + struct vc4_encoder base; + bool hdmi_monitor; + bool limited_rgb_range; +}; + +static inline struct vc4_hdmi_encoder * +to_vc4_hdmi_encoder(struct drm_encoder *encoder) +{ + return container_of(encoder, struct vc4_hdmi_encoder, base.base); +} + +/* VC4 HDMI connector KMS struct */ +struct vc4_hdmi_connector { + struct drm_connector base; + + /* Since the connector is attached to just the one encoder, + * this is the reference to it so we can do the best_encoder() + * hook. + */ + struct drm_encoder *encoder; +}; + +static inline struct vc4_hdmi_connector * +to_vc4_hdmi_connector(struct drm_connector *connector) +{ + return container_of(connector, struct vc4_hdmi_connector, base); +} + +#endif /* _VC4_HDMI_H_ */ -- git-series 0.9.1