From nobody Sun Sep 28 17:36:46 2025 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF2311D63C0 for ; Sun, 5 Jan 2025 23:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736118028; cv=none; b=ngYMAuM+G3oP4BdLZfNTswdZm5Q2w4zNGikiA7H14kK78B6V4IvDfYcDd+kAiwgmiftn+uSHwb5rlIEsMzfpUHwBjFYbR4+bvsY+ZKWtUP0y/9bTTLmp0IOjcxOWL0Mwgu+l1WFc2y/Q7JpSXDs/gKQyWEJAMGdPRUJeTM7WxrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736118028; c=relaxed/simple; bh=jZgQ8jsx9IvUwfG9AGdf5L+CCi3TiGpXqyw83nnGk6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LarIZY1ivnOxRdY+ztmtQlq57VDlJNDCbjHaej39yub6ue46d7O7TQTckgjbDzxLtOF8IbpmmzuDNeQvs7LmA0siVCkfMMLBukoEFv4EpfXvOkEuU862Qm1CeQ5clzfB6Y9TvnVr+oMOUY3EGkk1ipEvEaznYcizPHRx3gXEQTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=z8E1nqYc; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="z8E1nqYc" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-540218726d5so14355797e87.2 for ; Sun, 05 Jan 2025 15:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736118023; x=1736722823; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GKrjgKCnZKreaXJ2E0ycjM5Ra7ABafmAz9pY9R2DnqQ=; b=z8E1nqYcRynPefkGYD9wlZ/qRsgwXB8GeZtMxHCHDbqYuPfqRTjA0V8kyoX2kZ3fb+ U9MhhN0C8oR3kxN7cGY6dcn9gOocMypzjZLtH4QBUyV/63fOTwxYKU59f65T9ztYMTwF V0UySoqNLoBv4M4vVctjD0S9Kn1yGIsFJhz1zNnLUElJX5bpcPZuonbz2FwuU4e2TtRX 0mjGfcTDw9vkx+OsLQwmWDK31UQ0sX99vfKzdfZUGBBeSwe8BEv/lIpwWB86p40IX4n/ LyL90XgalUwVVJR7c7YBwcwzX2UrGKRDC0g9/zCS1XOjr0UfmhWJ7uSThKedURNtJ3XN gemQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736118023; x=1736722823; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GKrjgKCnZKreaXJ2E0ycjM5Ra7ABafmAz9pY9R2DnqQ=; b=M13CjbL5ATxjBDYTEvLWIh6RSdwvVz9OFCEOH11wR1XaNpx5IjC1MFKSQbRyJUkH0F j0x0zFS40h76hW+z+70MMH4O94bBDvQKZBubqMPtVkhF6cUxT6tPQbyax0e7qgo7J4NB zIZac9y3xfCzesARVIaX+2D76uUqvC65YGpH440RrdEHyLYLGgY4TFysTQr7VPUIusXH YZXStDiEvPj1H67RbTMe5/zlQq2cBfZ29OB9Z06364+pfW30TO1H/4SKd4dAMTrWMYTa exg0ueZMxuh85RVeQppMhxqTz+sw0Kc8xKrtKlCIDgtOZ3p/TbxkrbE/GC7Egt0S/Vb5 GoMA== X-Forwarded-Encrypted: i=1; AJvYcCX+CEmQF/g1EHdSXwQoFPSYMtbrotIYE8HDXc4J87VSl0R1GnAyaqFf0HvXWU0HMAyU4WS6ngc86gJjG+U=@vger.kernel.org X-Gm-Message-State: AOJu0YwzAMVxd4aYzgyoW/huBQsersnL0ffPIDe7LPwvMj2/86aeL7XH 9TmEgceNO/N2PNv9yuCmlO27r1vaEUe4GSfdqSobh2TA0toG2n8eqEOoPOzJtS4= X-Gm-Gg: ASbGncvwnu1PXHJm09DiVSb2N8dmi4u2V1/KWA8RZfCpY/A8mt9frREmzdyc2Nhy810 GX2vPhaPU7MN5NIKxrV9LtYgg0Wkx2tp1ncEBiFueyIp0NYgoE1Vx1M3jQvMeMhgZoNenkgiw6q vp6YXOe3aCuN0mYn4I28FRDgI+QKaGzZvazrzJXnvXohFbWncP5dzWGlhrHPaeSj/Vqw2wfgk3v 5Xcwu/bWudhk/NMdjPbF0dqkl/sJTSMzaR0ddLtjJM/nQ13mOaeUkTj3Cont7sk X-Google-Smtp-Source: AGHT+IGJxgfPUfQOhY6Li6RsbogVRq6RGnpuosjAEzvi+7xDTfLNkIU+jZvZPDSUtn8b1BLQ/xPk1w== X-Received: by 2002:a05:6512:308d:b0:541:3587:9d4d with SMTP id 2adb3069b0e04-54229524687mr16678010e87.7.1736118021787; Sun, 05 Jan 2025 15:00:21 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54223821583sm4614034e87.203.2025.01.05.15.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 15:00:20 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 01:00:13 +0200 Subject: [PATCH v3 1/2] drm/nouveau: incorporate I2C TV encoder drivers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250106-nouveau-encoder-slave-v3-1-1d37d2f2c67f@linaro.org> References: <20250106-nouveau-encoder-slave-v3-0-1d37d2f2c67f@linaro.org> In-Reply-To: <20250106-nouveau-encoder-slave-v3-0-1d37d2f2c67f@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , "James E.J. Bottomley" , Helge Deller , Danilo Krummrich Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Laurent Pinchart X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11380; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=jZgQ8jsx9IvUwfG9AGdf5L+CCi3TiGpXqyw83nnGk6k=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnew8AeOvmqiw012/pef6mfb5OTHNE+HIxXeW9q M7jUMaP4waJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3sPAAAKCRCLPIo+Aiko 1Z7HB/94O6lnA3X34i1T37/4WFh3a6vXNePjVpGOVHZUgDVX51HAXJRB5qtjZXqJOraVoIZJnJA gDBXHK0qgxJTpG56n+/W8BB3gQB/7fKbeasmx7RWZGx8Li9vuokRbxX3rucMLnbeUMv5WshCu3R Ameoh6Gp8rsW7a8PTMfPc/ieOlDBpFXXUf5za26g7HYtQMDRqsb3DsEsZaUWM5YZeAVR+hXRYSU IsNQXIM4vb/SHEIHKKX+HNuaLAY0raV+kZDl06lyBYdxVIeDTmggxLDeLoYLZ/eGOirgBV7zoX8 PkMoYwRJScTslSlHAdzEn+Bd6MdXz/iu/hDXKYjpKjpD6m5P X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Chrontel CH7006 and Silicon Image sil164 drivers use drm_encoder_slave interface which is being used only by the nouveau driver. It doesn't make sense to keep this interface inside the DRM subsystem. In preparation to moving this set of helpers to the nouveau driver, move the only two I2C driver that use that interface to the nouveau driver too. Suggested-by: Laurent Pinchart Signed-off-by: Dmitry Baryshkov --- arch/arm/configs/multi_v7_defconfig | 4 ++-- arch/parisc/configs/generic-32bit_defconfig | 4 ++-- arch/parisc/configs/generic-64bit_defconfig | 4 ++-- drivers/gpu/drm/i2c/Kconfig | 18 --------------= ---- drivers/gpu/drm/i2c/Makefile | 6 ------ drivers/gpu/drm/nouveau/Kconfig | 18 ++++++++++++++= ++++ drivers/gpu/drm/nouveau/dispnv04/Kbuild | 2 ++ drivers/gpu/drm/nouveau/dispnv04/dfp.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/i2c/Kbuild | 5 +++++ .../gpu/drm/{ =3D> nouveau/dispnv04}/i2c/ch7006_drv.c | 0 .../gpu/drm/{ =3D> nouveau/dispnv04}/i2c/ch7006_mode.c | 0 .../gpu/drm/{ =3D> nouveau/dispnv04}/i2c/ch7006_priv.h | 7 ++++--- .../gpu/drm/{ =3D> nouveau/dispnv04}/i2c/sil164_drv.c | 3 ++- drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 2 +- .../gpu/drm/nouveau/include/dispnv04}/i2c/ch7006.h | 4 ++-- .../gpu/drm/nouveau/include/dispnv04}/i2c/sil164.h | 4 ++-- 16 files changed, 43 insertions(+), 40 deletions(-) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v= 7_defconfig index 758276027dbcd0d444dac995745076b4e33457ff..4b100ddb0c54cb8f8ba81758c2f= 59d24f0fe82e9 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -713,10 +713,10 @@ CONFIG_VIDEO_ADV7604_CEC=3Dy CONFIG_VIDEO_ML86V7667=3Dm CONFIG_IMX_IPUV3_CORE=3Dm CONFIG_DRM=3Dy -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set CONFIG_DRM_I2C_NXP_TDA998X=3Dm CONFIG_DRM_NOUVEAU=3Dm +# CONFIG_DRM_NOUVEAU_CH7006 is not set +# CONFIG_DRM_NOUVEAU_SIL164 is not set CONFIG_DRM_EXYNOS=3Dm CONFIG_DRM_EXYNOS_FIMD=3Dy CONFIG_DRM_EXYNOS_MIXER=3Dy diff --git a/arch/parisc/configs/generic-32bit_defconfig b/arch/parisc/conf= igs/generic-32bit_defconfig index 5ce258f3fffaf0e3aac5f8f5450dd65bad305879..f5fffc24c3bc5baf0d77b845e3a= c77fae49b276e 100644 --- a/arch/parisc/configs/generic-32bit_defconfig +++ b/arch/parisc/configs/generic-32bit_defconfig @@ -132,11 +132,11 @@ CONFIG_I2C=3Dy CONFIG_HWMON=3Dm CONFIG_DRM=3Dm CONFIG_DRM_DISPLAY_DP_AUX_CEC=3Dy -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set CONFIG_DRM_RADEON=3Dm CONFIG_DRM_NOUVEAU=3Dm # CONFIG_DRM_NOUVEAU_BACKLIGHT is not set +# CONFIG_DRM_NOUVEAU_CH7006 is not set +# CONFIG_DRM_NOUVEAU_SIL164 is not set CONFIG_DRM_VGEM=3Dm CONFIG_DRM_UDL=3Dm CONFIG_DRM_MGAG200=3Dm diff --git a/arch/parisc/configs/generic-64bit_defconfig b/arch/parisc/conf= igs/generic-64bit_defconfig index 19a804860ed5b355f82396c2314bd0d8f3fb768a..704f68fbf960fb865206c8f8ab1= 751c9f0db6de3 100644 --- a/arch/parisc/configs/generic-64bit_defconfig +++ b/arch/parisc/configs/generic-64bit_defconfig @@ -193,11 +193,11 @@ CONFIG_MEDIA_SUPPORT=3Dm CONFIG_AGP=3Dy CONFIG_AGP_PARISC=3Dy CONFIG_DRM=3Dy -# CONFIG_DRM_I2C_CH7006 is not set -# CONFIG_DRM_I2C_SIL164 is not set CONFIG_DRM_RADEON=3Dy CONFIG_DRM_NOUVEAU=3Dm # CONFIG_DRM_NOUVEAU_BACKLIGHT is not set +# CONFIG_DRM_NOUVEAU_CH7006 is not set +# CONFIG_DRM_NOUVEAU_SIL164 is not set CONFIG_DRM_MGAG200=3Dm CONFIG_FB=3Dy CONFIG_FB_PM2=3Dm diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig index 6f19e1c35e30b0e595c1a60628a6b8cf313fcabc..d5200f67958e68a8ec73401f1d3= b79cbe0aa303d 100644 --- a/drivers/gpu/drm/i2c/Kconfig +++ b/drivers/gpu/drm/i2c/Kconfig @@ -2,24 +2,6 @@ menu "I2C encoder or helper chips" depends on DRM && DRM_KMS_HELPER && I2C =20 -config DRM_I2C_CH7006 - tristate "Chrontel ch7006 TV encoder" - default m if DRM_NOUVEAU - help - Support for Chrontel ch7006 and similar TV encoders, found - on some nVidia video cards. - - This driver is currently only useful if you're also using - the nouveau driver. - -config DRM_I2C_SIL164 - tristate "Silicon Image sil164 TMDS transmitter" - default m if DRM_NOUVEAU - help - Support for sil164 and similar single-link (or dual-link - when used in pairs) TMDS transmitters, used in some nVidia - video cards. - config DRM_I2C_NXP_TDA998X tristate "NXP Semiconductors TDA998X HDMI encoder" default m if DRM_TILCDC diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile index a962f6f085686674ed33010345730db776815ebe..31fd35527d99d7eb23851d29017= 5a3ff0c756772 100644 --- a/drivers/gpu/drm/i2c/Makefile +++ b/drivers/gpu/drm/i2c/Makefile @@ -1,10 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ch7006-y :=3D ch7006_drv.o ch7006_mode.o -obj-$(CONFIG_DRM_I2C_CH7006) +=3D ch7006.o - -sil164-y :=3D sil164_drv.o -obj-$(CONFIG_DRM_I2C_SIL164) +=3D sil164.o - tda998x-y :=3D tda998x_drv.o obj-$(CONFIG_DRM_I2C_NXP_TDA998X) +=3D tda998x.o obj-$(CONFIG_DRM_I2C_NXP_TDA9950) +=3D tda9950.o diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kcon= fig index ce840300578d8a4011c448b61caf830cef3805bf..ac76c0787010396af5eda901581= d9894ccda43d0 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig @@ -109,3 +109,21 @@ config DRM_NOUVEAU_GSP_DEFAULT help Say Y here if you want to use the GSP codepaths by default on Turing and Ampere GPUs. + +config DRM_NOUVEAU_CH7006 + tristate "Chrontel ch7006 TV encoder" + depends on DRM_NOUVEAU + default m + help + Support for Chrontel ch7006 and similar TV encoders. + + This driver is currently only useful if you're also using + the nouveau driver. + +config DRM_NOUVEAU_SIL164 + tristate "Silicon Image sil164 TMDS transmitter" + depends on DRM_NOUVEAU + default m + help + Support for sil164 and similar single-link (or dual-link + when used in pairs) TMDS transmitters. diff --git a/drivers/gpu/drm/nouveau/dispnv04/Kbuild b/drivers/gpu/drm/nouv= eau/dispnv04/Kbuild index 975c4e2269366d57e928eedbbbc669d24744379f..949802882ebd53c15e124c218a0= 92af9693d36bc 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/Kbuild +++ b/drivers/gpu/drm/nouveau/dispnv04/Kbuild @@ -10,3 +10,5 @@ nouveau-y +=3D dispnv04/overlay.o nouveau-y +=3D dispnv04/tvmodesnv17.o nouveau-y +=3D dispnv04/tvnv04.o nouveau-y +=3D dispnv04/tvnv17.o + +include $(src)/dispnv04/i2c/Kbuild diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouve= au/dispnv04/dfp.c index 504c421aa176ef3d944592a0109cb72e21fd47b7..25fa41edcb3c75a1f8d6ae42617= c76640baa27b4 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c @@ -35,7 +35,7 @@ #include "hw.h" #include "nvreg.h" =20 -#include +#include =20 #include =20 diff --git a/drivers/gpu/drm/nouveau/dispnv04/i2c/Kbuild b/drivers/gpu/drm/= nouveau/dispnv04/i2c/Kbuild new file mode 100644 index 0000000000000000000000000000000000000000..3fddfc97bcb399ef3821c6065e5= 868363883ac74 --- /dev/null +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/Kbuild @@ -0,0 +1,5 @@ +ch7006-y :=3D dispnv04/i2c/ch7006_drv.o dispnv04/i2c/ch7006_mode.o +obj-$(CONFIG_DRM_NOUVEAU_CH7006) +=3D ch7006.o + +sil164-y :=3D dispnv04/i2c/sil164_drv.o +obj-$(CONFIG_DRM_NOUVEAU_SIL164) +=3D sil164.o diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/nouveau/dis= pnv04/i2c/ch7006_drv.c similarity index 100% rename from drivers/gpu/drm/i2c/ch7006_drv.c rename to drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_drv.c diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/nouveau/di= spnv04/i2c/ch7006_mode.c similarity index 100% rename from drivers/gpu/drm/i2c/ch7006_mode.c rename to drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_mode.c diff --git a/drivers/gpu/drm/i2c/ch7006_priv.h b/drivers/gpu/drm/nouveau/di= spnv04/i2c/ch7006_priv.h similarity index 98% rename from drivers/gpu/drm/i2c/ch7006_priv.h rename to drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_priv.h index 052bdc48a339df47073ab305f224f96c8630d66c..d7a91e17510f7ea6bd2f087078d= ee73f85de53ee 100644 --- a/drivers/gpu/drm/i2c/ch7006_priv.h +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_priv.h @@ -24,12 +24,13 @@ * */ =20 -#ifndef __DRM_I2C_CH7006_PRIV_H__ -#define __DRM_I2C_CH7006_PRIV_H__ +#ifndef __NOUVEAU_I2C_CH7006_PRIV_H__ +#define __NOUVEAU_I2C_CH7006_PRIV_H__ =20 #include #include -#include + +#include =20 typedef int64_t fixed; #define fixed1 (1LL << 32) diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/nouveau/dis= pnv04/i2c/sil164_drv.c similarity index 99% rename from drivers/gpu/drm/i2c/sil164_drv.c rename to drivers/gpu/drm/nouveau/dispnv04/i2c/sil164_drv.c index c17afa025d9d917892055f8e8765d5f9e6259003..ca488f52a84a02773dac4a270b6= 3544901a0e232 100644 --- a/drivers/gpu/drm/i2c/sil164_drv.c +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/sil164_drv.c @@ -30,7 +30,8 @@ #include #include #include -#include + +#include =20 struct sil164_priv { struct sil164_encoder_params config; diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c b/drivers/gpu/drm/no= uveau/dispnv04/tvnv04.c index d3014027a8122be499b85459b038fdcce5800720..4ffd8af6bf8bff6f688f87ffede= 7a815bfc0789c 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c @@ -32,7 +32,7 @@ #include "hw.h" #include =20 -#include +#include =20 static struct nvkm_i2c_bus_probe nv04_tv_encoder_info[] =3D { { diff --git a/include/drm/i2c/ch7006.h b/drivers/gpu/drm/nouveau/include/dis= pnv04/i2c/ch7006.h similarity index 97% rename from include/drm/i2c/ch7006.h rename to drivers/gpu/drm/nouveau/include/dispnv04/i2c/ch7006.h index 5305b9797f938626c8f6c464ddc9bf424a39b4a0..1a6fa405f85b2a0d0f9a4d1c786= defc527fa1d3b 100644 --- a/include/drm/i2c/ch7006.h +++ b/drivers/gpu/drm/nouveau/include/dispnv04/i2c/ch7006.h @@ -24,8 +24,8 @@ * */ =20 -#ifndef __DRM_I2C_CH7006_H__ -#define __DRM_I2C_CH7006_H__ +#ifndef __NOUVEAU_I2C_CH7006_H__ +#define __NOUVEAU_I2C_CH7006_H__ =20 /** * struct ch7006_encoder_params diff --git a/include/drm/i2c/sil164.h b/drivers/gpu/drm/nouveau/include/dis= pnv04/i2c/sil164.h similarity index 96% rename from include/drm/i2c/sil164.h rename to drivers/gpu/drm/nouveau/include/dispnv04/i2c/sil164.h index ddf248693c8be8809777723c272f82af8d334c99..b86750d7abe1c2e7142eac32898= 398475fd42531 100644 --- a/include/drm/i2c/sil164.h +++ b/drivers/gpu/drm/nouveau/include/dispnv04/i2c/sil164.h @@ -24,8 +24,8 @@ * */ =20 -#ifndef __DRM_I2C_SIL164_H__ -#define __DRM_I2C_SIL164_H__ +#ifndef __NOUVEAU_I2C_SIL164_H__ +#define __NOUVEAU_I2C_SIL164_H__ =20 /** * struct sil164_encoder_params --=20 2.39.5 From nobody Sun Sep 28 17:36:46 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8720C1D61BC for ; Sun, 5 Jan 2025 23:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736118032; cv=none; b=R3ViQDBMNIwezKkbS9p7M2Xje60wwoLIIgyFe32airMF1ysyOdyl47zms+YiBIRMD9RB0nyVJjkbUWkMpDoOBjS0YvhmDRQtpOwzlEVcLdbaRX7CwLe+3DGQ3iaIX6Ae0q5VZ9AzhEnF/A4/3D6DShC5uhrxfYTgeSJw4fJ1v2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736118032; c=relaxed/simple; bh=5GwJPys9GzZMtV3mVaB8UggNMioJ7exi5D+YVS6dg3U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=adUkPAE4JkSps156OZRsOhQ2cf6kGYkJYO9yZ7Ff7U0fPnC4PrUrTDhZQ7XfL8uEkKSjEP0y8vSwSZSX6YXTSEZjB1iJqmaGCDmsvQjRpREyPdhoE51euxsQP9vhSjXV24awFUCT9Jg5IVAfpAloNsMtMvgbJpAu3wb6Z5yWY5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=BwExweUo; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BwExweUo" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53e3a227b82so12811389e87.0 for ; Sun, 05 Jan 2025 15:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736118024; x=1736722824; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=SqFp9oEdnNDKOyuZj8QnSw2xBwNslvKmM9i/zZ7uRZM=; b=BwExweUocuxg9Ea3zC35rcNrA+Ie8DeKSuk6RCeRH8vibkUQXgQ8KWv6Tjm4zAFQn5 HrYhGiNbZv+pobs1xIZt8vUL0DGhxSYwsFLaEhfXurgA6G0mGGlBw91kkRy1Ozn/D0zi cbdKhxKQCube2I5vFR8IS/qCaCdB7P4KZquqp9/5Osbxy2Lj2V22EyozpKq1iHCiviTy dD1aJsdhLMt3orGzD+2Mc96QYBIHfo1GmsAoSFSK4IbzfEg8aWM1ODBo4rWO6sJl6IhL N55H2CRd9BtrsoZwjncw8Ie/jxepRUI7nn/yRTCf8Cr5EzexDamzXlw3DpOGBTxsVyqG lBZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736118024; x=1736722824; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SqFp9oEdnNDKOyuZj8QnSw2xBwNslvKmM9i/zZ7uRZM=; b=mTwSRyKJYK1F1W3FycVUoIer6/N0BTHiLQSw5WSWu09a4XX5DWzUECyMOxQiZbKmHY z4e27z1xOco7GEJ9N1pxn2ROjpNp93y1L5EBcGeQtRaUz2+23dNDwGRpYqPsHT7I/oSr 6u70JsIuVo72FNQ2rgx8ypKJW6wfDBfbCaGGiEw8WMnFho3toD7tcrDkFGSDifmBIUhZ kPVdGKBxnRBunYg8Nwd4LTXH2NHlok97shN3/ldFczUSxMISUgbVLLHbWcUHuEKSd8eW 4b+xzZ9clOVG1Y1xx9jAs+WoNJLG5hJnpKtewV3/OnQb3ithyVzu4+vSIpbhK0KAsIOh bSwQ== X-Forwarded-Encrypted: i=1; AJvYcCW0ceZFE2Ya4svRNI1mBlcS3BEOmKVFF9i/UX9uRfN3tCpGjmsomRMza798/pVPxcube0WRWr+/9cdeQgQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8RHHEc0LGrQHaQRf0yKgVYQfUYJgl+hAv+piqp7rqkiCk5TWO islBUPrU9be40nM2c4tD/f4YeX3ubC/4lnUc4nfPj+22SLDy+KD1tzQvY384Wgw= X-Gm-Gg: ASbGncvjOAvfY/YXgSQh4X3TPtcZtAi5xCkw6OPuVRuRn0AU1TzrMmFKjScg6QPuoao l/Tx4wBemgJOmaveS9VYSE8m3pG6Vpq7/cDIoaaIJPUp3qSAnvFwa3Rrlzg7JDcOK6iotKHnYcU 0K5Z+AOpjU0k2L+24Uj3WtdSCjWf+6j+6y+JMl5vbBKo9CexAFhwwbNuE+KFa5v1WDvEw/LblgV plqsHA1IXcFmd3PWsbBrk+4+vfrnvd0e1HgjcwreTzK6VEQ0qerLWWLbJUapMo9 X-Google-Smtp-Source: AGHT+IH3mfFnzwiN3//AFgnNq+GU0NQheb5OAmQLdsv0LVvHOf8yxrwk11QmVVxwnpJVM3WQ49gebw== X-Received: by 2002:a05:6512:68e:b0:540:3566:5397 with SMTP id 2adb3069b0e04-54229530300mr18402689e87.22.1736118024299; Sun, 05 Jan 2025 15:00:24 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54223821583sm4614034e87.203.2025.01.05.15.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 15:00:23 -0800 (PST) From: Dmitry Baryshkov Date: Mon, 06 Jan 2025 01:00:14 +0200 Subject: [PATCH v3 2/2] drm/nouveau: vendor in drm_encoder_slave API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250106-nouveau-encoder-slave-v3-2-1d37d2f2c67f@linaro.org> References: <20250106-nouveau-encoder-slave-v3-0-1d37d2f2c67f@linaro.org> In-Reply-To: <20250106-nouveau-encoder-slave-v3-0-1d37d2f2c67f@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , "James E.J. Bottomley" , Helge Deller , Danilo Krummrich Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Laurent Pinchart X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=39492; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=5GwJPys9GzZMtV3mVaB8UggNMioJ7exi5D+YVS6dg3U=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnew8AUCvH66qLq0Jg7U+I0XsPzVsfo8U0MH2kh QY+lTmdgiuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ3sPAAAKCRCLPIo+Aiko 1b24CACNjv0ubCDoewHUosinLmwGRam7jSUZxrsGDKjHW6H1115Gw606w4+jT3utyWO4zxI2EC4 eA6fyxQxQ4AT03etQY3I0yiyQ4GE/Hxban1CCYm3FsIScCxEyssMuultKF9KAsD3UKWTiiSPDtB 67di/TOb/7iPJoaGxcW7Qfjh64O/2d2ZhvEQxEOzm0PJHsB6Yl+9vtUVxRE4/C+58gXm6FCYDsb RfAH95514femZHzBA4PDzkejdOD0+Ul0xmqCWORCmKzJ+G1GjhXFoJaq+lsixGs7nnR8h8sPN0P woIn5zITk9YNCr8H6TIjXNNVXuUzG2NdEncIIBD1mVZLep/y X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Nouveau driver is the only user of the drm_encoder_slave API. Rework necessary bits of drm_encoder_slave into the nouveau_i2c_encoder API and drop drm_encoder_slave.c from the DRM KMS helper. Suggested-by: Laurent Pinchart Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/Makefile | 1 - drivers/gpu/drm/nouveau/dispnv04/Kbuild | 1 + drivers/gpu/drm/nouveau/dispnv04/dfp.c | 15 +-- drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_drv.c | 30 ++--- drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_mode.c | 8 +- drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_priv.h | 4 +- drivers/gpu/drm/nouveau/dispnv04/i2c/sil164_drv.c | 30 ++--- .../dispnv04/nouveau_i2c_encoder.c} | 95 +++++----------- drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 22 ++-- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 +- .../drm/nouveau/include/dispnv04/i2c/encoder_i2c.h | 121 +++++++++--------= ---- drivers/gpu/drm/nouveau/nouveau_connector.c | 10 +- drivers/gpu/drm/nouveau/nouveau_encoder.h | 13 +-- 13 files changed, 147 insertions(+), 207 deletions(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 19fb370fbc56772077973c864df71e4b8e0bf99b..85af94bb907d6cdbad7078e2667= 426e479b1069f 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -135,7 +135,6 @@ drm_kms_helper-y :=3D \ drm_atomic_state_helper.o \ drm_crtc_helper.o \ drm_damage_helper.o \ - drm_encoder_slave.o \ drm_flip_work.o \ drm_format_helper.o \ drm_gem_atomic_helper.o \ diff --git a/drivers/gpu/drm/nouveau/dispnv04/Kbuild b/drivers/gpu/drm/nouv= eau/dispnv04/Kbuild index 949802882ebd53c15e124c218a092af9693d36bc..4c7bc6bb81b325ac22286372b0a= 3e4f1390e78be 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/Kbuild +++ b/drivers/gpu/drm/nouveau/dispnv04/Kbuild @@ -6,6 +6,7 @@ nouveau-y +=3D dispnv04/dac.o nouveau-y +=3D dispnv04/dfp.o nouveau-y +=3D dispnv04/disp.o nouveau-y +=3D dispnv04/hw.o +nouveau-y +=3D dispnv04/nouveau_i2c_encoder.o nouveau-y +=3D dispnv04/overlay.o nouveau-y +=3D dispnv04/tvmodesnv17.o nouveau-y +=3D dispnv04/tvnv04.o diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouve= au/dispnv04/dfp.c index 25fa41edcb3c75a1f8d6ae42617c76640baa27b4..c724bacc67f87d89ce9e8497ba2= eb990ab98a584 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c @@ -171,7 +171,7 @@ static struct drm_encoder *get_tmds_slave(struct drm_en= coder *encoder) list_for_each_entry(slave, &dev->mode_config.encoder_list, head) { struct dcb_output *slave_dcb =3D nouveau_encoder(slave)->dcb; =20 - if (slave_dcb->type =3D=3D DCB_OUTPUT_TMDS && get_slave_funcs(slave) && + if (slave_dcb->type =3D=3D DCB_OUTPUT_TMDS && get_encoder_i2c_funcs(slav= e) && slave_dcb->tmdsconf.slave_addr =3D=3D dcb->tmdsconf.slave_addr) return slave; } @@ -473,8 +473,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) /* Init external transmitters */ slave_encoder =3D get_tmds_slave(encoder); if (slave_encoder) - get_slave_funcs(slave_encoder)->mode_set( - slave_encoder, &nv_encoder->mode, &nv_encoder->mode); + get_encoder_i2c_funcs(slave_encoder)->mode_set(slave_encoder, + &nv_encoder->mode, + &nv_encoder->mode); =20 helper->dpms(encoder, DRM_MODE_DPMS_ON); =20 @@ -614,8 +615,8 @@ static void nv04_dfp_destroy(struct drm_encoder *encode= r) { struct nouveau_encoder *nv_encoder =3D nouveau_encoder(encoder); =20 - if (get_slave_funcs(encoder)) - get_slave_funcs(encoder)->destroy(encoder); + if (get_encoder_i2c_funcs(encoder)) + get_encoder_i2c_funcs(encoder)->destroy(encoder); =20 drm_encoder_cleanup(encoder); kfree(nv_encoder); @@ -649,8 +650,8 @@ static void nv04_tmds_slave_init(struct drm_encoder *en= coder) if (type < 0) return; =20 - drm_i2c_encoder_init(dev, to_encoder_slave(encoder), - &bus->i2c, &info[type].dev); + nouveau_i2c_encoder_init(dev, to_encoder_i2c(encoder), + &bus->i2c, &info[type].dev); } =20 static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs =3D { diff --git a/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_drv.c b/drivers/gp= u/drm/nouveau/dispnv04/i2c/ch7006_drv.c index fcb0fcd6c89718bc8613ab63482ccc005ace079b..296a14b5484042faa484eb8d124= 7ab9eee937471 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_drv.c @@ -47,14 +47,14 @@ static void ch7006_encoder_destroy(struct drm_encoder *= encoder) drm_property_destroy(encoder->dev, priv->scale_property); =20 kfree(priv); - to_encoder_slave(encoder)->slave_priv =3D NULL; + to_encoder_i2c(encoder)->encoder_i2c_priv =3D NULL; =20 - drm_i2c_encoder_destroy(encoder); + nouveau_i2c_encoder_destroy(encoder); } =20 static void ch7006_encoder_dpms(struct drm_encoder *encoder, int mode) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); struct ch7006_state *state =3D &priv->state; =20 @@ -71,7 +71,7 @@ static void ch7006_encoder_dpms(struct drm_encoder *enco= der, int mode) =20 static void ch7006_encoder_save(struct drm_encoder *encoder) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); =20 ch7006_dbg(client, "\n"); @@ -81,7 +81,7 @@ static void ch7006_encoder_save(struct drm_encoder *encod= er) =20 static void ch7006_encoder_restore(struct drm_encoder *encoder) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); =20 ch7006_dbg(client, "\n"); @@ -116,7 +116,7 @@ static void ch7006_encoder_mode_set(struct drm_encoder = *encoder, struct drm_display_mode *drm_mode, struct drm_display_mode *adjusted_mode) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); struct ch7006_encoder_params *params =3D &priv->params; struct ch7006_state *state =3D &priv->state; @@ -179,7 +179,7 @@ static void ch7006_encoder_mode_set(struct drm_encoder = *encoder, static enum drm_connector_status ch7006_encoder_detect(struct drm_encoder = *encoder, struct drm_connector *connector) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); struct ch7006_state *state =3D &priv->state; int det; @@ -285,7 +285,7 @@ static int ch7006_encoder_set_property(struct drm_encod= er *encoder, struct drm_property *property, uint64_t val) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); struct ch7006_state *state =3D &priv->state; struct drm_mode_config *conf =3D &encoder->dev->mode_config; @@ -370,7 +370,7 @@ static int ch7006_encoder_set_property(struct drm_encod= er *encoder, return 0; } =20 -static const struct drm_encoder_slave_funcs ch7006_encoder_funcs =3D { +static const struct nouveau_i2c_encoder_funcs ch7006_encoder_funcs =3D { .set_config =3D ch7006_encoder_set_config, .destroy =3D ch7006_encoder_destroy, .dpms =3D ch7006_encoder_dpms, @@ -437,7 +437,7 @@ static int ch7006_resume(struct device *dev) =20 static int ch7006_encoder_init(struct i2c_client *client, struct drm_device *dev, - struct drm_encoder_slave *encoder) + struct nouveau_i2c_encoder *encoder) { struct ch7006_priv *priv; int i; @@ -448,8 +448,8 @@ static int ch7006_encoder_init(struct i2c_client *clien= t, if (!priv) return -ENOMEM; =20 - encoder->slave_priv =3D priv; - encoder->slave_funcs =3D &ch7006_encoder_funcs; + encoder->encoder_i2c_priv =3D priv; + encoder->encoder_i2c_funcs =3D &ch7006_encoder_funcs; =20 priv->norm =3D TV_NORM_PAL; priv->select_subconnector =3D DRM_MODE_SUBCONNECTOR_Automatic; @@ -495,7 +495,7 @@ static const struct dev_pm_ops ch7006_pm_ops =3D { .resume =3D ch7006_resume, }; =20 -static struct drm_i2c_encoder_driver ch7006_driver =3D { +static struct nouveau_i2c_encoder_driver ch7006_driver =3D { .i2c_driver =3D { .probe =3D ch7006_probe, .remove =3D ch7006_remove, @@ -516,12 +516,12 @@ static struct drm_i2c_encoder_driver ch7006_driver = =3D { =20 static int __init ch7006_init(void) { - return drm_i2c_encoder_register(THIS_MODULE, &ch7006_driver); + return i2c_add_driver(&ch7006_driver.i2c_driver); } =20 static void __exit ch7006_exit(void) { - drm_i2c_encoder_unregister(&ch7006_driver); + i2c_del_driver(&ch7006_driver.i2c_driver); } =20 int ch7006_debug; diff --git a/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_mode.c b/drivers/g= pu/drm/nouveau/dispnv04/i2c/ch7006_mode.c index 6afe6d0ee6306db57c3e3bafe2bf1b0b1b49aea5..e58d94451959a2afc01f570ea62= 0d8e6721cb7af 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_mode.c +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_mode.c @@ -198,7 +198,7 @@ const struct ch7006_mode *ch7006_lookup_mode(struct drm= _encoder *encoder, =20 void ch7006_setup_levels(struct drm_encoder *encoder) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); uint8_t *regs =3D priv->state.regs; const struct ch7006_tv_norm_info *norm =3D &ch7006_tv_norms[priv->norm]; @@ -229,7 +229,7 @@ void ch7006_setup_levels(struct drm_encoder *encoder) =20 void ch7006_setup_subcarrier(struct drm_encoder *encoder) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); struct ch7006_state *state =3D &priv->state; const struct ch7006_tv_norm_info *norm =3D &ch7006_tv_norms[priv->norm]; @@ -253,7 +253,7 @@ void ch7006_setup_subcarrier(struct drm_encoder *encode= r) =20 void ch7006_setup_pll(struct drm_encoder *encoder) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); uint8_t *regs =3D priv->state.regs; const struct ch7006_mode *mode =3D priv->mode; @@ -324,7 +324,7 @@ void ch7006_setup_power_state(struct drm_encoder *encod= er) =20 void ch7006_setup_properties(struct drm_encoder *encoder) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); struct ch7006_priv *priv =3D to_ch7006_priv(encoder); struct ch7006_state *state =3D &priv->state; const struct ch7006_tv_norm_info *norm =3D &ch7006_tv_norms[priv->norm]; diff --git a/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_priv.h b/drivers/g= pu/drm/nouveau/dispnv04/i2c/ch7006_priv.h index d7a91e17510f7ea6bd2f087078dee73f85de53ee..5ad5157a2c027f20269a8d09621= cb21daea3e7ac 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_priv.h +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/ch7006_priv.h @@ -27,9 +27,9 @@ #ifndef __NOUVEAU_I2C_CH7006_PRIV_H__ #define __NOUVEAU_I2C_CH7006_PRIV_H__ =20 -#include #include =20 +#include #include =20 typedef int64_t fixed; @@ -100,7 +100,7 @@ struct ch7006_priv { }; =20 #define to_ch7006_priv(x) \ - ((struct ch7006_priv *)to_encoder_slave(x)->slave_priv) + ((struct ch7006_priv *)to_encoder_i2c(x)->encoder_i2c_priv) =20 extern int ch7006_debug; extern char *ch7006_tv_norm; diff --git a/drivers/gpu/drm/nouveau/dispnv04/i2c/sil164_drv.c b/drivers/gp= u/drm/nouveau/dispnv04/i2c/sil164_drv.c index ca488f52a84a02773dac4a270b63544901a0e232..ec8ffeddefa9f13a84dfa76d2fb= 13a1090e959a5 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/i2c/sil164_drv.c +++ b/drivers/gpu/drm/nouveau/dispnv04/i2c/sil164_drv.c @@ -27,10 +27,10 @@ #include =20 #include -#include #include #include =20 +#include #include =20 struct sil164_priv { @@ -42,7 +42,7 @@ struct sil164_priv { }; =20 #define to_sil164_priv(x) \ - ((struct sil164_priv *)to_encoder_slave(x)->slave_priv) + ((struct sil164_priv *)to_encoder_i2c(x)->encoder_i2c_priv) =20 #define sil164_dbg(client, format, ...) do { \ if (drm_debug_enabled(DRM_UT_KMS)) \ @@ -222,7 +222,7 @@ sil164_encoder_dpms(struct drm_encoder *encoder, int mo= de) bool on =3D (mode =3D=3D DRM_MODE_DPMS_ON); bool duallink =3D (on && encoder->crtc->mode.clock > 165000); =20 - sil164_set_power_state(drm_i2c_encoder_get_client(encoder), on); + sil164_set_power_state(nouveau_i2c_encoder_get_client(encoder), on); =20 if (priv->duallink_slave) sil164_set_power_state(priv->duallink_slave, duallink); @@ -233,7 +233,7 @@ sil164_encoder_save(struct drm_encoder *encoder) { struct sil164_priv *priv =3D to_sil164_priv(encoder); =20 - sil164_save_state(drm_i2c_encoder_get_client(encoder), + sil164_save_state(nouveau_i2c_encoder_get_client(encoder), priv->saved_state); =20 if (priv->duallink_slave) @@ -246,7 +246,7 @@ sil164_encoder_restore(struct drm_encoder *encoder) { struct sil164_priv *priv =3D to_sil164_priv(encoder); =20 - sil164_restore_state(drm_i2c_encoder_get_client(encoder), + sil164_restore_state(nouveau_i2c_encoder_get_client(encoder), priv->saved_state); =20 if (priv->duallink_slave) @@ -278,7 +278,7 @@ sil164_encoder_mode_set(struct drm_encoder *encoder, struct sil164_priv *priv =3D to_sil164_priv(encoder); bool duallink =3D adjusted_mode->clock > 165000; =20 - sil164_init_state(drm_i2c_encoder_get_client(encoder), + sil164_init_state(nouveau_i2c_encoder_get_client(encoder), &priv->config, duallink); =20 if (priv->duallink_slave) @@ -292,7 +292,7 @@ static enum drm_connector_status sil164_encoder_detect(struct drm_encoder *encoder, struct drm_connector *connector) { - struct i2c_client *client =3D drm_i2c_encoder_get_client(encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(encoder); =20 if (sil164_read(client, SIL164_DETECT) & SIL164_DETECT_HOTPLUG_STAT) return connector_status_connected; @@ -331,10 +331,10 @@ sil164_encoder_destroy(struct drm_encoder *encoder) i2c_unregister_device(priv->duallink_slave); =20 kfree(priv); - drm_i2c_encoder_destroy(encoder); + nouveau_i2c_encoder_destroy(encoder); } =20 -static const struct drm_encoder_slave_funcs sil164_encoder_funcs =3D { +static const struct nouveau_i2c_encoder_funcs sil164_encoder_funcs =3D { .set_config =3D sil164_encoder_set_config, .destroy =3D sil164_encoder_destroy, .dpms =3D sil164_encoder_dpms, @@ -394,7 +394,7 @@ sil164_detect_slave(struct i2c_client *client) static int sil164_encoder_init(struct i2c_client *client, struct drm_device *dev, - struct drm_encoder_slave *encoder) + struct nouveau_i2c_encoder *encoder) { struct sil164_priv *priv; struct i2c_client *slave_client; @@ -403,8 +403,8 @@ sil164_encoder_init(struct i2c_client *client, if (!priv) return -ENOMEM; =20 - encoder->slave_priv =3D priv; - encoder->slave_funcs =3D &sil164_encoder_funcs; + encoder->encoder_i2c_priv =3D priv; + encoder->encoder_i2c_funcs =3D &sil164_encoder_funcs; =20 slave_client =3D sil164_detect_slave(client); if (!IS_ERR(slave_client)) @@ -419,7 +419,7 @@ static const struct i2c_device_id sil164_ids[] =3D { }; MODULE_DEVICE_TABLE(i2c, sil164_ids); =20 -static struct drm_i2c_encoder_driver sil164_driver =3D { +static struct nouveau_i2c_encoder_driver sil164_driver =3D { .i2c_driver =3D { .probe =3D sil164_probe, .driver =3D { @@ -435,13 +435,13 @@ static struct drm_i2c_encoder_driver sil164_driver = =3D { static int __init sil164_init(void) { - return drm_i2c_encoder_register(THIS_MODULE, &sil164_driver); + return i2c_add_driver(&sil164_driver.i2c_driver); } =20 static void __exit sil164_exit(void) { - drm_i2c_encoder_unregister(&sil164_driver); + i2c_del_driver(&sil164_driver.i2c_driver); } =20 MODULE_AUTHOR("Francisco Jerez "); diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/nouveau/= dispnv04/nouveau_i2c_encoder.c similarity index 54% rename from drivers/gpu/drm/drm_encoder_slave.c rename to drivers/gpu/drm/nouveau/dispnv04/nouveau_i2c_encoder.c index e464429d32df6e2eeb541d92c5a486b4ee7a21ec..e2bf99c433366b48b2b090073eb= 14d9e0eb82f7b 100644 --- a/drivers/gpu/drm/drm_encoder_slave.c +++ b/drivers/gpu/drm/nouveau/dispnv04/nouveau_i2c_encoder.c @@ -26,10 +26,10 @@ =20 #include =20 -#include +#include =20 /** - * drm_i2c_encoder_init - Initialize an I2C slave encoder + * nouveau_i2c_encoder_init - Initialize an I2C slave encoder * @dev: DRM device. * @encoder: Encoder to be attached to the I2C device. You aren't * required to have called drm_encoder_init() before. @@ -40,7 +40,7 @@ * * Create an I2C device on the specified bus (the module containing its * driver is transparently loaded) and attach it to the specified - * &drm_encoder_slave. The @slave_funcs field will be initialized with + * &nouveau_i2c_encoder. The @encoder_i2c_funcs field will be initialized = with * the hooks provided by the slave driver. * * If @info.platform_data is non-NULL it will be used as the initial @@ -49,14 +49,14 @@ * Returns 0 on success or a negative errno on failure, in particular, * -ENODEV is returned when no matching driver is found. */ -int drm_i2c_encoder_init(struct drm_device *dev, - struct drm_encoder_slave *encoder, - struct i2c_adapter *adap, - const struct i2c_board_info *info) +int nouveau_i2c_encoder_init(struct drm_device *dev, + struct nouveau_i2c_encoder *encoder, + struct i2c_adapter *adap, + const struct i2c_board_info *info) { struct module *module =3D NULL; struct i2c_client *client; - struct drm_i2c_encoder_driver *encoder_drv; + struct nouveau_i2c_encoder_driver *encoder_drv; int err =3D 0; =20 request_module("%s%s", I2C_MODULE_PREFIX, info->type); @@ -73,16 +73,16 @@ int drm_i2c_encoder_init(struct drm_device *dev, goto fail_unregister; } =20 - encoder->bus_priv =3D client; + encoder->i2c_client =3D client; =20 - encoder_drv =3D to_drm_i2c_encoder_driver(to_i2c_driver(client->dev.drive= r)); + encoder_drv =3D to_nouveau_i2c_encoder_driver(to_i2c_driver(client->dev.d= river)); =20 err =3D encoder_drv->encoder_init(client, dev, encoder); if (err) goto fail_module_put; =20 if (info->platform_data) - encoder->slave_funcs->set_config(&encoder->base, + encoder->encoder_i2c_funcs->set_config(&encoder->base, info->platform_data); =20 return 0; @@ -93,90 +93,53 @@ int drm_i2c_encoder_init(struct drm_device *dev, i2c_unregister_device(client); return err; } -EXPORT_SYMBOL(drm_i2c_encoder_init); =20 /** - * drm_i2c_encoder_destroy - Unregister the I2C device backing an encoder + * nouveau_i2c_encoder_destroy - Unregister the I2C device backing an enco= der * @drm_encoder: Encoder to be unregistered. * * This should be called from the @destroy method of an I2C slave * encoder driver once I2C access is no longer needed. */ -void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder) +void nouveau_i2c_encoder_destroy(struct drm_encoder *drm_encoder) { - struct drm_encoder_slave *encoder =3D to_encoder_slave(drm_encoder); - struct i2c_client *client =3D drm_i2c_encoder_get_client(drm_encoder); + struct nouveau_i2c_encoder *encoder =3D to_encoder_i2c(drm_encoder); + struct i2c_client *client =3D nouveau_i2c_encoder_get_client(drm_encoder); struct module *module =3D client->dev.driver->owner; =20 i2c_unregister_device(client); - encoder->bus_priv =3D NULL; + encoder->i2c_client =3D NULL; =20 module_put(module); } -EXPORT_SYMBOL(drm_i2c_encoder_destroy); +EXPORT_SYMBOL(nouveau_i2c_encoder_destroy); =20 /* * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs: */ =20 -static inline const struct drm_encoder_slave_funcs * -get_slave_funcs(struct drm_encoder *enc) +bool nouveau_i2c_encoder_mode_fixup(struct drm_encoder *encoder, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) { - return to_encoder_slave(enc)->slave_funcs; -} - -void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode) -{ - get_slave_funcs(encoder)->dpms(encoder, mode); -} -EXPORT_SYMBOL(drm_i2c_encoder_dpms); - -bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - if (!get_slave_funcs(encoder)->mode_fixup) + if (!get_encoder_i2c_funcs(encoder)->mode_fixup) return true; =20 - return get_slave_funcs(encoder)->mode_fixup(encoder, mode, adjusted_mode); -} -EXPORT_SYMBOL(drm_i2c_encoder_mode_fixup); - -void drm_i2c_encoder_prepare(struct drm_encoder *encoder) -{ - drm_i2c_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); -} -EXPORT_SYMBOL(drm_i2c_encoder_prepare); - -void drm_i2c_encoder_commit(struct drm_encoder *encoder) -{ - drm_i2c_encoder_dpms(encoder, DRM_MODE_DPMS_ON); -} -EXPORT_SYMBOL(drm_i2c_encoder_commit); - -void drm_i2c_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - get_slave_funcs(encoder)->mode_set(encoder, mode, adjusted_mode); + return get_encoder_i2c_funcs(encoder)->mode_fixup(encoder, mode, adjusted= _mode); } -EXPORT_SYMBOL(drm_i2c_encoder_mode_set); =20 -enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encod= er, - struct drm_connector *connector) +enum drm_connector_status nouveau_i2c_encoder_detect(struct drm_encoder *e= ncoder, + struct drm_connector *connector) { - return get_slave_funcs(encoder)->detect(encoder, connector); + return get_encoder_i2c_funcs(encoder)->detect(encoder, connector); } -EXPORT_SYMBOL(drm_i2c_encoder_detect); =20 -void drm_i2c_encoder_save(struct drm_encoder *encoder) +void nouveau_i2c_encoder_save(struct drm_encoder *encoder) { - get_slave_funcs(encoder)->save(encoder); + get_encoder_i2c_funcs(encoder)->save(encoder); } -EXPORT_SYMBOL(drm_i2c_encoder_save); =20 -void drm_i2c_encoder_restore(struct drm_encoder *encoder) +void nouveau_i2c_encoder_restore(struct drm_encoder *encoder) { - get_slave_funcs(encoder)->restore(encoder); + get_encoder_i2c_funcs(encoder)->restore(encoder); } -EXPORT_SYMBOL(drm_i2c_encoder_restore); diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c b/drivers/gpu/drm/no= uveau/dispnv04/tvnv04.c index 4ffd8af6bf8bff6f688f87ffede7a815bfc0789c..c61ab083f62e063a31d94f68e55= 6fb8e7d8458d1 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c @@ -99,7 +99,7 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int= mode) =20 NVWriteRAMDAC(dev, 0, NV_PRAMDAC_PLL_COEFF_SELECT, state->pllsel); =20 - get_slave_funcs(encoder)->dpms(encoder, mode); + get_encoder_i2c_funcs(encoder)->dpms(encoder, mode); } =20 static void nv04_tv_bind(struct drm_device *dev, int head, bool bind) @@ -158,7 +158,7 @@ static void nv04_tv_mode_set(struct drm_encoder *encode= r, regp->tv_vskew =3D 1; regp->tv_vsync_delay =3D 1; =20 - get_slave_funcs(encoder)->mode_set(encoder, mode, adjusted_mode); + get_encoder_i2c_funcs(encoder)->mode_set(encoder, mode, adjusted_mode); } =20 static void nv04_tv_commit(struct drm_encoder *encoder) @@ -178,7 +178,7 @@ static void nv04_tv_commit(struct drm_encoder *encoder) =20 static void nv04_tv_destroy(struct drm_encoder *encoder) { - get_slave_funcs(encoder)->destroy(encoder); + get_encoder_i2c_funcs(encoder)->destroy(encoder); drm_encoder_cleanup(encoder); =20 kfree(encoder->helper_private); @@ -191,11 +191,11 @@ static const struct drm_encoder_funcs nv04_tv_funcs = =3D { =20 static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs =3D { .dpms =3D nv04_tv_dpms, - .mode_fixup =3D drm_i2c_encoder_mode_fixup, + .mode_fixup =3D nouveau_i2c_encoder_mode_fixup, .prepare =3D nv04_tv_prepare, .commit =3D nv04_tv_commit, .mode_set =3D nv04_tv_mode_set, - .detect =3D drm_i2c_encoder_detect, + .detect =3D nouveau_i2c_encoder_detect, }; =20 int @@ -226,8 +226,8 @@ nv04_tv_create(struct drm_connector *connector, struct = dcb_output *entry) NULL); drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs); =20 - nv_encoder->enc_save =3D drm_i2c_encoder_save; - nv_encoder->enc_restore =3D drm_i2c_encoder_restore; + nv_encoder->enc_save =3D nouveau_i2c_encoder_save; + nv_encoder->enc_restore =3D nouveau_i2c_encoder_restore; =20 encoder->possible_crtcs =3D entry->heads; encoder->possible_clones =3D 0; @@ -235,14 +235,14 @@ nv04_tv_create(struct drm_connector *connector, struc= t dcb_output *entry) nv_encoder->or =3D ffs(entry->or) - 1; =20 /* Run the slave-specific initialization */ - ret =3D drm_i2c_encoder_init(dev, to_encoder_slave(encoder), - &bus->i2c, - &nv04_tv_encoder_info[type].dev); + ret =3D nouveau_i2c_encoder_init(dev, to_encoder_i2c(encoder), + &bus->i2c, + &nv04_tv_encoder_info[type].dev); if (ret < 0) goto fail_cleanup; =20 /* Attach it to the specified connector. */ - get_slave_funcs(encoder)->create_resources(encoder, connector); + get_encoder_i2c_funcs(encoder)->create_resources(encoder, connector); drm_connector_attach_encoder(connector, encoder); =20 return 0; diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/no= uveau/dispnv04/tvnv17.c index 3ecb101d23e949b753b873d24eec01ad6fe7f5d6..50326691444322f282729e108b4= ab88bd9cbc14a 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c @@ -779,7 +779,7 @@ static const struct drm_encoder_helper_funcs nv17_tv_he= lper_funcs =3D { .detect =3D nv17_tv_detect, }; =20 -static const struct drm_encoder_slave_funcs nv17_tv_slave_funcs =3D { +static const struct nouveau_i2c_encoder_funcs nv17_tv_encoder_i2c_funcs = =3D { .get_modes =3D nv17_tv_get_modes, .mode_valid =3D nv17_tv_mode_valid, .create_resources =3D nv17_tv_create_resources, @@ -818,7 +818,7 @@ nv17_tv_create(struct drm_connector *connector, struct = dcb_output *entry) drm_encoder_init(dev, encoder, &nv17_tv_funcs, DRM_MODE_ENCODER_TVDAC, NULL); drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs); - to_encoder_slave(encoder)->slave_funcs =3D &nv17_tv_slave_funcs; + to_encoder_i2c(encoder)->encoder_i2c_funcs =3D &nv17_tv_encoder_i2c_funcs; =20 tv_enc->base.enc_save =3D nv17_tv_save; tv_enc->base.enc_restore =3D nv17_tv_restore; diff --git a/include/drm/drm_encoder_slave.h b/drivers/gpu/drm/nouveau/incl= ude/dispnv04/i2c/encoder_i2c.h similarity index 59% rename from include/drm/drm_encoder_slave.h rename to drivers/gpu/drm/nouveau/include/dispnv04/i2c/encoder_i2c.h index 49172166a164474f43e4afb2eeeb3cde8ae7c61a..edbe8b57ac193c007280ba46dcb= 0a12357540eb5 100644 --- a/include/drm/drm_encoder_slave.h +++ b/drivers/gpu/drm/nouveau/include/dispnv04/i2c/encoder_i2c.h @@ -24,8 +24,8 @@ * */ =20 -#ifndef __DRM_ENCODER_SLAVE_H__ -#define __DRM_ENCODER_SLAVE_H__ +#ifndef __NOUVEAU_ENCODER_I2C_H__ +#define __NOUVEAU_ENCODER_I2C_H__ =20 #include =20 @@ -33,7 +33,7 @@ #include =20 /** - * struct drm_encoder_slave_funcs - Entry points exposed by a slave encode= r driver + * struct nouveau_i2c_encoder_funcs - Entry points exposed by a I2C encode= r driver * * Most of its members are analogous to the function pointers in * &drm_encoder_helper_funcs and they can optionally be used to @@ -41,7 +41,7 @@ * @set_property) will typically be wrapped around and only be called * if the encoder is the currently selected one for the connector. */ -struct drm_encoder_slave_funcs { +struct nouveau_i2c_encoder_funcs { /** * @set_config: Initialize any encoder-specific modesetting parameters. * The meaning of the @params parameter is implementation dependent. It @@ -58,24 +58,23 @@ struct drm_encoder_slave_funcs { void (*destroy)(struct drm_encoder *encoder); =20 /** - * @dpms: Analogous to &drm_encoder_helper_funcs @dpms callback. Wrapped - * by drm_i2c_encoder_dpms(). + * @dpms: Analogous to &drm_encoder_helper_funcs @dpms callback. */ void (*dpms)(struct drm_encoder *encoder, int mode); =20 /** - * @save: Save state. Wrapped by drm_i2c_encoder_save(). + * @save: Save state. Wrapped by nouveau_i2c_encoder_save(). */ void (*save)(struct drm_encoder *encoder); =20 /** - * @restore: Restore state. Wrapped by drm_i2c_encoder_restore(). + * @restore: Restore state. Wrapped by nouveau_i2c_encoder_restore(). */ void (*restore)(struct drm_encoder *encoder); =20 /** * @mode_fixup: Analogous to &drm_encoder_helper_funcs @mode_fixup - * callback. Wrapped by drm_i2c_encoder_mode_fixup(). + * callback. Wrapped by nouveau_i2c_encoder_mode_fixup(). */ bool (*mode_fixup)(struct drm_encoder *encoder, const struct drm_display_mode *mode, @@ -88,7 +87,7 @@ struct drm_encoder_slave_funcs { struct drm_display_mode *mode); /** * @mode_set: Analogous to &drm_encoder_helper_funcs @mode_set - * callback. Wrapped by drm_i2c_encoder_mode_set(). + * callback. */ void (*mode_set)(struct drm_encoder *encoder, struct drm_display_mode *mode, @@ -96,7 +95,7 @@ struct drm_encoder_slave_funcs { =20 /** * @detect: Analogous to &drm_encoder_helper_funcs @detect - * callback. Wrapped by drm_i2c_encoder_detect(). + * callback. Wrapped by nouveau_i2c_encoder_detect(). */ enum drm_connector_status (*detect)(struct drm_encoder *encoder, struct drm_connector *connector); @@ -120,54 +119,60 @@ struct drm_encoder_slave_funcs { }; =20 /** - * struct drm_encoder_slave - Slave encoder struct + * struct nouveau_i2c_encoder - I2C encoder struct * - * A &drm_encoder_slave has two sets of callbacks, @slave_funcs and the + * A &nouveau_i2c_encoder has two sets of callbacks, @encoder_i2c_funcs an= d the * ones in @base. The former are never actually called by the common * CRTC code, it's just a convenience for splitting the encoder * functions in an upper, GPU-specific layer and a (hopefully) * GPU-agnostic lower layer: It's the GPU driver responsibility to - * call the slave methods when appropriate. + * call the nouveau_i2c_encoder methods when appropriate. * - * drm_i2c_encoder_init() provides a way to get an implementation of + * nouveau_i2c_encoder_init() provides a way to get an implementation of * this. */ -struct drm_encoder_slave { +struct nouveau_i2c_encoder { /** * @base: DRM encoder object. */ struct drm_encoder base; =20 /** - * @slave_funcs: Slave encoder callbacks. + * @encoder_i2c_funcs: I2C encoder callbacks. */ - const struct drm_encoder_slave_funcs *slave_funcs; + const struct nouveau_i2c_encoder_funcs *encoder_i2c_funcs; =20 /** - * @slave_priv: Slave encoder private data. + * @encoder_i2c_priv: I2C encoder private data. */ - void *slave_priv; + void *encoder_i2c_priv; =20 /** - * @bus_priv: Bus specific data. + * @i2c_client: corresponding I2C client structure */ - void *bus_priv; + struct i2c_client *i2c_client; }; -#define to_encoder_slave(x) container_of((x), struct drm_encoder_slave, ba= se) =20 -int drm_i2c_encoder_init(struct drm_device *dev, - struct drm_encoder_slave *encoder, - struct i2c_adapter *adap, - const struct i2c_board_info *info); +#define to_encoder_i2c(x) container_of((x), struct nouveau_i2c_encoder, ba= se) =20 +int nouveau_i2c_encoder_init(struct drm_device *dev, + struct nouveau_i2c_encoder *encoder, + struct i2c_adapter *adap, + const struct i2c_board_info *info); + +static inline const struct nouveau_i2c_encoder_funcs * +get_encoder_i2c_funcs(struct drm_encoder *enc) +{ + return to_encoder_i2c(enc)->encoder_i2c_funcs; +} =20 /** - * struct drm_i2c_encoder_driver + * struct nouveau_i2c_encoder_driver * * Describes a device driver for an encoder connected to the GPU through a= n I2C * bus. */ -struct drm_i2c_encoder_driver { +struct nouveau_i2c_encoder_driver { /** * @i2c_driver: I2C device driver description. */ @@ -175,67 +180,41 @@ struct drm_i2c_encoder_driver { =20 /** * @encoder_init: Callback to allocate any per-encoder data structures - * and to initialize the @slave_funcs and (optionally) @slave_priv + * and to initialize the @encoder_i2c_funcs and (optionally) @encoder_i2c= _priv * members of @encoder. */ int (*encoder_init)(struct i2c_client *client, struct drm_device *dev, - struct drm_encoder_slave *encoder); + struct nouveau_i2c_encoder *encoder); =20 }; -#define to_drm_i2c_encoder_driver(x) container_of((x), \ - struct drm_i2c_encoder_driver, \ + +#define to_nouveau_i2c_encoder_driver(x) container_of((x), \ + struct nouveau_i2c_encoder_driver, \ i2c_driver) =20 /** - * drm_i2c_encoder_get_client - Get the I2C client corresponding to an enc= oder + * nouveau_i2c_encoder_get_client - Get the I2C client corresponding to an= encoder * @encoder: The encoder */ -static inline struct i2c_client *drm_i2c_encoder_get_client(struct drm_enc= oder *encoder) +static inline struct i2c_client *nouveau_i2c_encoder_get_client(struct drm= _encoder *encoder) { - return (struct i2c_client *)to_encoder_slave(encoder)->bus_priv; + return to_encoder_i2c(encoder)->i2c_client; } =20 -/** - * drm_i2c_encoder_register - Register an I2C encoder driver - * @owner: Module containing the driver. - * @driver: Driver to be registered. - */ -static inline int drm_i2c_encoder_register(struct module *owner, - struct drm_i2c_encoder_driver *driver) -{ - return i2c_register_driver(owner, &driver->i2c_driver); -} - -/** - * drm_i2c_encoder_unregister - Unregister an I2C encoder driver - * @driver: Driver to be unregistered. - */ -static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_drive= r *driver) -{ - i2c_del_driver(&driver->i2c_driver); -} - -void drm_i2c_encoder_destroy(struct drm_encoder *encoder); - +void nouveau_i2c_encoder_destroy(struct drm_encoder *encoder); =20 /* * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs: */ =20 -void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode); -bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); -void drm_i2c_encoder_prepare(struct drm_encoder *encoder); -void drm_i2c_encoder_commit(struct drm_encoder *encoder); -void drm_i2c_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); -enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encod= er, - struct drm_connector *connector); -void drm_i2c_encoder_save(struct drm_encoder *encoder); -void drm_i2c_encoder_restore(struct drm_encoder *encoder); +bool nouveau_i2c_encoder_mode_fixup(struct drm_encoder *encoder, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode); +enum drm_connector_status nouveau_i2c_encoder_detect(struct drm_encoder *e= ncoder, + struct drm_connector *connector); +void nouveau_i2c_encoder_save(struct drm_encoder *encoder); +void nouveau_i2c_encoder_restore(struct drm_encoder *encoder); =20 =20 #endif diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/= nouveau/nouveau_connector.c index 8d5c9c74cbb90927036cee75f173f687617f14ec..63e160f09f311006ed9193301b5= b1e7817b871e1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -797,8 +797,10 @@ nouveau_connector_set_property(struct drm_connector *c= onnector, property, value); if (ret) { if (nv_encoder && nv_encoder->dcb->type =3D=3D DCB_OUTPUT_TV) - return get_slave_funcs(encoder)->set_property( - encoder, connector, property, value); + return get_encoder_i2c_funcs(encoder)->set_property(encoder, + connector, + property, + value); return ret; } =20 @@ -1015,7 +1017,7 @@ nouveau_connector_get_modes(struct drm_connector *con= nector) nouveau_connector_detect_depth(connector); =20 if (nv_encoder->dcb->type =3D=3D DCB_OUTPUT_TV) - ret =3D get_slave_funcs(encoder)->get_modes(encoder, connector); + ret =3D get_encoder_i2c_funcs(encoder)->get_modes(encoder, connector); =20 if (nv_connector->type =3D=3D DCB_CONNECTOR_LVDS || nv_connector->type =3D=3D DCB_CONNECTOR_LVDS_SPWG || @@ -1100,7 +1102,7 @@ nouveau_connector_mode_valid(struct drm_connector *co= nnector, max_clock =3D 350000; break; case DCB_OUTPUT_TV: - return get_slave_funcs(encoder)->mode_valid(encoder, mode); + return get_encoder_i2c_funcs(encoder)->mode_valid(encoder, mode); case DCB_OUTPUT_DP: return nv50_dp_mode_valid(nv_encoder, mode, NULL); default: diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/no= uveau/nouveau_encoder.h index 333042fc493faec360b8d9713ab687836b986431..dce8e5d9d4964842adcc7725ae4= e12a36c4beb5a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_encoder.h +++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h @@ -31,7 +31,8 @@ =20 #include #include -#include + +#include =20 #include "dispnv04/disp.h" =20 @@ -43,7 +44,7 @@ struct nouveau_connector; struct nvkm_i2c_port; =20 struct nouveau_encoder { - struct drm_encoder_slave base; + struct nouveau_i2c_encoder base; =20 struct dcb_output *dcb; struct nvif_outp outp; @@ -137,7 +138,7 @@ find_encoder(struct drm_connector *connector, int type); =20 static inline struct nouveau_encoder *nouveau_encoder(struct drm_encoder *= enc) { - struct drm_encoder_slave *slave =3D to_encoder_slave(enc); + struct nouveau_i2c_encoder *slave =3D to_encoder_i2c(enc); =20 return container_of(slave, struct nouveau_encoder, base); } @@ -147,12 +148,6 @@ static inline struct drm_encoder *to_drm_encoder(struc= t nouveau_encoder *enc) return &enc->base.base; } =20 -static inline const struct drm_encoder_slave_funcs * -get_slave_funcs(struct drm_encoder *enc) -{ - return to_encoder_slave(enc)->slave_funcs; -} - /* nouveau_dp.c */ enum nouveau_dp_status { NOUVEAU_DP_NONE, --=20 2.39.5