From patchwork Fri Nov 3 23:03:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13445248 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A14F1250E8 for ; Fri, 3 Nov 2023 23:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MqFCrl22" Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B647AD50 for ; Fri, 3 Nov 2023 16:04:19 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2c5087d19a6so34810871fa.0 for ; Fri, 03 Nov 2023 16:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699052658; x=1699657458; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BbnyjLnhACt82EK09moKdpQ9JIR1p/S627vZZk1uJi8=; b=MqFCrl22wo3o/1UEeWNLQ3b905qhFCwrDokbToxZ9HVgOyOPsHnc+nNOPltI+F531M RUWP4xBMU4fkvhCkQCffkDx4VB1r66ZMAjPNbiBpGcfp7/xKfARNOHfN4ER9jHEwmTe7 7/Kmn8q+Jfyg0xGc56pD4nSAxuEnArv2GDzbl/zR8BjlNL5v1dtOV531ajNmPJqzNoNY BZ4X66tLWn/lcWufko7EiOlmcqXGaN3NXkCFxmwVT5xYAQjMF+1AHcOd/ywo5W4SP4hH pyLQvo4Hkg/yAp3Us9bl/xj04l/yK/gJGKgWTP9iW/Zn6wfb8dCHm0F8zPn0udzfVdXd Xy7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699052658; x=1699657458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BbnyjLnhACt82EK09moKdpQ9JIR1p/S627vZZk1uJi8=; b=YIulBt5naMgGzeTT05JiJfTdfwrxZZli26Y0EzVQ8M2U8enhZhRXJgQ2+lq7rDs4YT n4dzpgC2aPulhubCM5hNl8VhcBj7mbiXIqZ8N5Eo7f5iBVgbCo7YnV3yt8+KP9oIO7FW mKniadLyvVQVHiu4pAJrcED40aaeEzvZsX0hbAeZgtNpuW3fWkSiUbm2Y3stYS0Zjt9O cz77pHOCTVnB1esBmwmLXvyiSJdRyTSqKQhwijoxwwPCq/Sg9Pt/PGqJFygN/Kgeoo/p smvZFCkVyMzO3xPeDzOaDlRaiMq70Ig0WYxUlL88x6C9XdRAdPqeT2vuij5j6CuXs1o7 9qQg== X-Gm-Message-State: AOJu0YyfGHzDvALKijlaKdExMTOfHgaEFs7FGjaLuWbobIdlBc5E9Gyf 2wdqsYMNZ7fuHdRZ2Q3ajdsABA== X-Google-Smtp-Source: AGHT+IFqLlK/VkY8KRBbE5SnY0oiABjf4RxnnYmH4Ttg9LlJ/9dJpbi7xVLHM1tu4o89tmLTxoXKkA== X-Received: by 2002:ac2:47fb:0:b0:507:b8e1:76f0 with SMTP id b27-20020ac247fb000000b00507b8e176f0mr15445608lfp.22.1699052657967; Fri, 03 Nov 2023 16:04:17 -0700 (PDT) Received: from eriador.lan (dzdqv0yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::8a5]) by smtp.gmail.com with ESMTPSA id s16-20020ac24650000000b00504211d2a7bsm329919lfo.297.2023.11.03.16.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 16:04:17 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Heikki Krogerus , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH v6 3/6] usb: typec: nb7vpq904m: switch to DRM_AUX_BRIDGE Date: Sat, 4 Nov 2023 01:03:06 +0200 Message-ID: <20231103230414.1483428-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231103230414.1483428-1-dmitry.baryshkov@linaro.org> References: <20231103230414.1483428-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Switch to using the new DRM_AUX_BRIDGE helper to create the transparent DRM bridge device instead of handcoding corresponding functionality. Reviewed-by: Heikki Krogerus Acked-by: Greg Kroah-Hartman Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/mux/Kconfig | 2 +- drivers/usb/typec/mux/nb7vpq904m.c | 44 ++---------------------------- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig index 65da61150ba7..07395161dd30 100644 --- a/drivers/usb/typec/mux/Kconfig +++ b/drivers/usb/typec/mux/Kconfig @@ -40,7 +40,7 @@ config TYPEC_MUX_NB7VPQ904M tristate "On Semiconductor NB7VPQ904M Type-C redriver driver" depends on I2C depends on DRM || DRM=n - select DRM_PANEL_BRIDGE if DRM + select DRM_AUX_BRIDGE if DRM_BRIDGE select REGMAP_I2C help Say Y or M if your system has a On Semiconductor NB7VPQ904M Type-C diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c index cda206cf0c38..b17826713753 100644 --- a/drivers/usb/typec/mux/nb7vpq904m.c +++ b/drivers/usb/typec/mux/nb7vpq904m.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -70,8 +70,6 @@ struct nb7vpq904m { bool swap_data_lanes; struct typec_switch *typec_switch; - struct drm_bridge bridge; - struct mutex lock; /* protect non-concurrent retimer & switch */ enum typec_orientation orientation; @@ -297,44 +295,6 @@ static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_re return ret; } -#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE) -static int nb7vpq904m_bridge_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) -{ - struct nb7vpq904m *nb7 = container_of(bridge, struct nb7vpq904m, bridge); - struct drm_bridge *next_bridge; - - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) - return -EINVAL; - - next_bridge = devm_drm_of_get_bridge(&nb7->client->dev, nb7->client->dev.of_node, 0, 0); - if (IS_ERR(next_bridge)) { - dev_err(&nb7->client->dev, "failed to acquire drm_bridge: %pe\n", next_bridge); - return PTR_ERR(next_bridge); - } - - return drm_bridge_attach(bridge->encoder, next_bridge, bridge, - DRM_BRIDGE_ATTACH_NO_CONNECTOR); -} - -static const struct drm_bridge_funcs nb7vpq904m_bridge_funcs = { - .attach = nb7vpq904m_bridge_attach, -}; - -static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7) -{ - nb7->bridge.funcs = &nb7vpq904m_bridge_funcs; - nb7->bridge.of_node = nb7->client->dev.of_node; - - return devm_drm_bridge_add(&nb7->client->dev, &nb7->bridge); -} -#else -static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7) -{ - return 0; -} -#endif - static const struct regmap_config nb7_regmap = { .max_register = 0x1f, .reg_bits = 8, @@ -461,7 +421,7 @@ static int nb7vpq904m_probe(struct i2c_client *client) gpiod_set_value(nb7->enable_gpio, 1); - ret = nb7vpq904m_register_bridge(nb7); + ret = drm_aux_bridge_register(dev); if (ret) goto err_disable_gpio;