From patchwork Sun Sep 3 21:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB4DCA0FE3 for ; Sun, 3 Sep 2023 21:41:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348922AbjICVl6 (ORCPT ); Sun, 3 Sep 2023 17:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348737AbjICVl5 (ORCPT ); Sun, 3 Sep 2023 17:41:57 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA6DE6 for ; Sun, 3 Sep 2023 14:41:53 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-500c6ff99acso2066268e87.1 for ; Sun, 03 Sep 2023 14:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777312; x=1694382112; 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=GmanXIAkjDsl+T2r62TPHvRC1u8K+rB0oi8RTwEBesA=; b=xJaeyPxHFUdk6qhXVl9pcYwGIj6ry212IshkgrOmUj8Bpt76gTqX0EVkMPzv92CxBS /IhjvH5xnYEh/XXSKV58i57VQ5FmNCr3kkNkaJze34nn/Bzwwlgn2FaOYXzuZA/nZM1i G5ntCFOlvmedXZ/pM5Zwdq9lKeImg+wpNUQrLDN/HQ8WBL9Q1quW+/3Uh6ldZFo7kQie DhjPGSx0zL3hKimS08w0KfGPgdLvG6TbWS+f3oJz7BusF2FJq0UMNmYA98k6HMNe8MAl J9b5wxVt7bccJM1U4RmlhuVPBvpTgujRq82kTQ7kXcykveAYquERpExSxMtiGOQNQTGX mEsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777312; x=1694382112; 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=GmanXIAkjDsl+T2r62TPHvRC1u8K+rB0oi8RTwEBesA=; b=Ppm7/7DOpRLfMMl8Sh8vUwfUjUmQUzbVG546te5NfS2xpXghnRv0b0QspZYaQxSq7h sz2cbEBBKrJdLWaeJi9QaL5Cebbx1tkugviRUltfq86c0iSW+x/RBGwpX5LySaiigbIS XyetLWCSNfOV8XGWHF6i+O06xo2UR60kSr8MWk+D8Xoy/Mlqx2XN6cXw9MBZ8mc7Kotj NeEC06WUnkOXff4HXdrs4SatZu5/a8LhvuRcr+AjUZppSNIPok+arvsW40sceRojNayA j36kig4WuSFQKK67HL5yBKR7E/XWa5HOkOp0vK+upugTZ68APiRrj++YCgG8TVdxFhiX /q6A== X-Gm-Message-State: AOJu0YxHudIVtOOkWvQtFQ5GfdBE17L8Ss3+diABoSUxVpySbohPDs5u XI9ciFd77UAbHEs4XjepgNvyrg== X-Google-Smtp-Source: AGHT+IEGo/yjWy7nXfptqRFFQBffjwaXXQ9l9Ri/i3/adG+D2/r7RCm9m7rFgxFD5xaJpRnQWqoXxw== X-Received: by 2002:a05:6512:2215:b0:500:bf44:b2b3 with SMTP id h21-20020a056512221500b00500bf44b2b3mr2690899lfu.21.1693777311904; Sun, 03 Sep 2023 14:41:51 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:51 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, Won Chung Subject: [RFC PATCH v1 01/12] Revert "drm/sysfs: Link DRM connectors to corresponding Type-C connectors" Date: Mon, 4 Sep 2023 00:41:39 +0300 Message-Id: <20230903214150.2877023-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The kdev->fwnode pointer is never set in drm_sysfs_connector_add(), so dev_fwnode() checks never succeed, making the respective commit NOP. And if drm_sysfs_connector_add() is modified to set kdev->fwnode, it breaks drivers already using components (as it was pointed at [1]), resulting in a deadlock. Lockdep trace is provided below. Granted these two issues, it seems impractical to fix this commit in any sane way. Revert it instead. [1] https://lore.kernel.org/dri-devel/Y24bcYJKGy%2Fgd5fV@phenom.ffwll.local/ ============================================ WARNING: possible recursive locking detected 6.5.0-rc6-next-20230816-10542-g090e2ca9feae-dirty #713 Tainted: G W -------------------------------------------- kworker/u16:0/11 is trying to acquire lock: ffffce0f54bea490 (component_mutex){+.+.}-{3:3}, at: __component_add+0x64/0x170 but task is already holding lock: ffffce0f54bea490 (component_mutex){+.+.}-{3:3}, at: __component_add+0x64/0x170 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(component_mutex); lock(component_mutex); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by kworker/u16:0/11: #0: ffff5b7680008d38 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x14c/0x51c #1: ffff8000800abde0 (deferred_probe_work){+.+.}-{0:0}, at: process_one_work+0x14c/0x51c #2: ffff5b76837a2908 (&dev->mutex){....}-{3:3}, at: __device_attach+0x38/0x188 #3: ffffce0f54bea490 (component_mutex){+.+.}-{3:3}, at: __component_add+0x64/0x170 #4: ffffce0f54bdeb40 (drm_connector_list_iter){.+.+}-{0:0}, at: drm_modeset_register_all+0x80/0x9c #5: ffff5b76866ad0d0 (&connector->mutex){+.+.}-{3:3}, at: drm_connector_register.part.0+0x28/0x104 stack backtrace: CPU: 6 PID: 11 Comm: kworker/u16:0 Tainted: G W 6.5.0-rc6-next-20230816-10542-g090e2ca9feae-dirty #713 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) Workqueue: events_unbound deferred_probe_work_func Call trace: dump_backtrace+0x98/0xf0 show_stack+0x18/0x24 dump_stack_lvl+0x60/0xac dump_stack+0x18/0x24 print_deadlock_bug+0x254/0x340 __lock_acquire+0x105c/0x1ebc lock_acquire+0x1ec/0x314 __lock_acquire+0x105c/0x1ebc lock_acquire+0x1ec/0x314 __mutex_lock+0xa0/0x77c mutex_lock_nested+0x24/0x30 __component_add+0x64/0x170 component_add+0x14/0x20 drm_sysfs_connector_add+0x144/0x1a0 drm_connector_register.part.0+0x5c/0x104 drm_connector_register_all+0x84/0x160 drm_modeset_register_all+0x80/0x9c drm_dev_register+0x120/0x238 msm_drm_bind+0x550/0x6e0 try_to_bring_up_aggregate_device+0x164/0x1d0 __component_add+0xa8/0x170 component_add+0x14/0x20 dsi_dev_attach+0x20/0x2c dsi_host_attach+0x9c/0x144 devm_mipi_dsi_attach+0x34/0xb4 lt9611uxc_attach_dsi.isra.0+0x84/0xfc lt9611uxc_probe+0x5ac/0x66c i2c_device_probe+0x148/0x290 really_probe+0x148/0x2ac __driver_probe_device+0x78/0x12c driver_probe_device+0x3c/0x160 __device_attach_driver+0xb8/0x138 bus_for_each_drv+0x80/0xdc __device_attach+0x9c/0x188 device_initial_probe+0x14/0x20 bus_probe_device+0xac/0xb0 deferred_probe_work_func+0x8c/0xc8 process_one_work+0x1ec/0x51c worker_thread+0x1ec/0x3e4 kthread+0x120/0x124 ret_from_fork+0x10/0x20 Fixes: c5c51b242062 ("drm/sysfs: Link DRM connectors to corresponding Type-C connectors") Cc: Won Chung Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_sysfs.c | 40 ------------------------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index b169b3e44a92..06662cc8d3f4 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -11,14 +11,12 @@ */ #include -#include #include #include #include #include #include #include -#include #include #include @@ -98,34 +96,6 @@ static char *drm_devnode(const struct device *dev, umode_t *mode) return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); } -static int typec_connector_bind(struct device *dev, - struct device *typec_connector, void *data) -{ - int ret; - - ret = sysfs_create_link(&dev->kobj, &typec_connector->kobj, "typec_connector"); - if (ret) - return ret; - - ret = sysfs_create_link(&typec_connector->kobj, &dev->kobj, "drm_connector"); - if (ret) - sysfs_remove_link(&dev->kobj, "typec_connector"); - - return ret; -} - -static void typec_connector_unbind(struct device *dev, - struct device *typec_connector, void *data) -{ - sysfs_remove_link(&typec_connector->kobj, "drm_connector"); - sysfs_remove_link(&dev->kobj, "typec_connector"); -} - -static const struct component_ops typec_connector_ops = { - .bind = typec_connector_bind, - .unbind = typec_connector_unbind, -}; - static CLASS_ATTR_STRING(version, S_IRUGO, "drm 1.1.0 20060810"); /** @@ -394,16 +364,9 @@ int drm_sysfs_connector_add(struct drm_connector *connector) connector->kdev = kdev; - if (dev_fwnode(kdev)) { - r = component_add(kdev, &typec_connector_ops); - if (r) - drm_err(dev, "failed to add component to create link to typec connector\n"); - } - if (connector->ddc) return sysfs_create_link(&connector->kdev->kobj, &connector->ddc->dev.kobj, "ddc"); - return 0; err_free: @@ -419,9 +382,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) if (connector->ddc) sysfs_remove_link(&connector->kdev->kobj, "ddc"); - if (dev_fwnode(connector->kdev)) - component_del(connector->kdev, &typec_connector_ops); - DRM_DEBUG("removing \"%s\" from sysfs\n", connector->name); From patchwork Sun Sep 3 21:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D225C88CB2 for ; Sun, 3 Sep 2023 21:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348909AbjICVl6 (ORCPT ); Sun, 3 Sep 2023 17:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348915AbjICVl5 (ORCPT ); Sun, 3 Sep 2023 17:41:57 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A01DED for ; Sun, 3 Sep 2023 14:41:54 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50087d47d4dso1455478e87.1 for ; Sun, 03 Sep 2023 14:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777313; x=1694382113; 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=Ma99b4LHGq53HSGcZQ6vjRnRZEGnePGsfNP3DlvaRh0=; b=MYOlbi+JGeJYtrISEHYVNAZ7NpZm2f81saVxar4AyapqsYeo9BDcG1/09r2DRXNEwr mbf6atiwzL2s0ypbJJ/s/IfiyvbdNhMmfBynyy9zq4Rf7vF/UKwNGdUfTRKiv76gxCL4 mE9f/P4GWaSqWgWg8Blc4HJR9dojKiw2um+uyr3Q+NCLydXKm/qP+nrucUF+8gcc0LUa //eAsXd+bWEEnLFNEWZPuifwc6Em2sPC2YYH2qyga5l+JI3cHzbKS9tuyVzYtX/3wrA1 q6UYZNGQK1DVXTysf21XRs667gV4bf/tno9hwUtOQSBCWQKZUkQZU+7gjOhnFIxAnByJ oXJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777313; x=1694382113; 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=Ma99b4LHGq53HSGcZQ6vjRnRZEGnePGsfNP3DlvaRh0=; b=bNpadbHi78jKvVQ2ipqgssHb0gEvTVt6Ey3S16siRc9IZGth8F7eOG9S19FaiT5MN6 CLiuSTgw4/07NcxaqmilszCBOKyoy9cBA7fZJUQPQzIWL4/BFtQHqh8Kz9I1lyN+lvM5 TeKDaC5+yBu0PU5+2YUmk75gxISqC3xrYoH1PqSFtKms07/BTwon2pmuF+lUzPokV2n4 DJ+tYG2sUIjgWbTYeUQB0Fd37ld+Vuc62+Yh6zXX9wfHOCrcMrkVSCY7p1r38axmhVxq OzZEhhFcTlo4IEhGFRYbqBGv+I2wc3dTHNLPLZ9wvSHh9uZzj72MSVX4SmnF4+NKEciB p+Fw== X-Gm-Message-State: AOJu0YzlqqDPF3Of1DfvHFML0nfLZlE2oWGU0/mjOf+TLL5s20SlyaFl hyEeX+HMoQ4OQmxaDCUXm5/c/A== X-Google-Smtp-Source: AGHT+IHJVW1SRXqtDqVwoMB9XSCNYSPZYNLw0l5nqazh953B3y2RWKaTYGlv3/IkcL42Y/AtV9dO0g== X-Received: by 2002:a05:6512:44c:b0:4fd:d517:fbcd with SMTP id y12-20020a056512044c00b004fdd517fbcdmr4553861lfk.6.1693777312712; Sun, 03 Sep 2023 14:41:52 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:52 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 02/12] drm/sysfs: link DRM connector device to the connector's fw nodes Date: Mon, 4 Sep 2023 00:41:40 +0300 Message-Id: <20230903214150.2877023-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Setup the of_node and fwnode fields for the DRM connector device, making respective links to appear in /sys. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 06662cc8d3f4..cb926d95ef0e 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -345,6 +345,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector) kdev->class = drm_class; kdev->type = &drm_sysfs_device_connector; kdev->parent = dev->primary->kdev; + kdev->of_node = to_of_node(connector->fwnode); + kdev->fwnode = connector->fwnode; kdev->groups = connector_dev_groups; kdev->release = drm_sysfs_release; dev_set_drvdata(kdev, connector); From patchwork Sun Sep 3 21:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373342 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 591EECA0FE3 for ; Sun, 3 Sep 2023 21:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349056AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348932AbjICVl6 (ORCPT ); Sun, 3 Sep 2023 17:41:58 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26765D9 for ; Sun, 3 Sep 2023 14:41:55 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5008d16cc36so1418782e87.2 for ; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777313; x=1694382113; 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=f4CGlwIh3CaiNYfDE8T4/N3NKVw9L1KuLHleXxMGA8k=; b=sL37z1nSxapwX1ACyQwJD5J17vIMjGOlYzI20UASAIey8kqRxI4mjpOLunNTr0u6KK jvpNqVkjoqjPTMONMwLwlzQKkafFdk3xRAB7v7F2C71kjfWv3RZAq0uwdXFBRgW5Ablu 5qEtusCHwgTRJX0jw35/YtTrrnm483NhEudimhX/Y9mY6b1ypxLsOGIV2NXg1locgBn2 GT8LylBHFPlCJAw9wBeuHQ564qtXwoDgreruE+BCcep2hASO7HKsC8zNooFIvAMa6b7z 9wXUeRsY+cFjE1kA3IgrV4pnlZhjm+i9W7t1RIK5ziozF2te0A0ydoVmTyp2VCrfh/M7 rszA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777313; x=1694382113; 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=f4CGlwIh3CaiNYfDE8T4/N3NKVw9L1KuLHleXxMGA8k=; b=G3og09Eh7OCq5jqBRwTfOwGikP/FH+h91cN07fVz4OzEVaYqEwAgFX1AnrxZGJffJw lsh1nqbv7dvO20/sbt60yAn/f655IpwqLdveMronvH4OH0QajKJoWt9FIoATpfSxrTUu jiyGYHKxpRtiAuqtyAzAsoLImqU3hsUR03Ie8wHCMPuLP3lmVTlAmz+sDCBQ97+hDaMP 8HMDdF5ESaP84wVUmwNzJKlFyGOByhISmwEQ0mK7hKPto9D4ZL1e28okn9Q2VWvJi/Gt 26XXFubjzY1XQIKMR1BZDFjSSxGFV4ZS6jGBZQDy0p0n3tl9nFplE6/7bBsscixMwBDZ u7lw== X-Gm-Message-State: AOJu0YwNPTpJ4S3/F/55c1BCJR+dMHjKG4hslxdWQyunH2CKyr9NmQEc nBnNcLLL/rNoSKKRE80X+6dwow== X-Google-Smtp-Source: AGHT+IHZcZHwPmZz/G9GJYrJdaFt/yh7kFkMispc1XECmMNIp6Mo7eyJQIJfgGNG8gZdXS8BoslEpA== X-Received: by 2002:a05:6512:3444:b0:4fb:911b:4e19 with SMTP id j4-20020a056512344400b004fb911b4e19mr3890157lfr.35.1693777313473; Sun, 03 Sep 2023 14:41:53 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:53 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 03/12] drm/connector: extend PATH property to covert Type-C case Date: Mon, 4 Sep 2023 00:41:41 +0300 Message-Id: <20230903214150.2877023-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Userspace needs to identify whether the DisplayPort connector is a native one or it is wrapped into the USB-C port. Moreover the userspace might need to point user to the exact location of this Type-C port on the laptop case. Existing USB-C altmode implementations (i915, amdgpu) have used the DRM_MODE_CONNECTOR_DisplayPort even for such ports. To keep backwards compatibility we can not change this to DRM_MODE_CONNECTOR_USB. Therefore the kernel needs some other way to represent this information. To facilitate this, reuse the 'PATH' property, which was used to describe the DP port in the DP MST configuration. Use either 'typec:portN' to point out to the Type-C port class device, or just 'typec:' if the corresponding port can not be identified. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_connector.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 05fc29a54801..a326782e936e 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1185,10 +1185,14 @@ static const u32 dp_colorspaces = * never read back the value of "DPMS" because it can be incorrect. * PATH: * Connector path property to identify how this sink is physically - * connected. Used by DP MST. This should be set by calling - * drm_connector_set_path_property(), in the case of DP MST with the - * path property the MST manager created. Userspace cannot change this + * connected. This should be set by calling + * drm_connector_set_path_property(). Userspace cannot change this * property. + * In the case of DP MST this is equal to the path property the MST + * manager created. It is equal to 'mst:baseID-port-port...'. + * In the case of DP USB-C connector this is equal to the 'typec:portN', + * pointing to the corresponding Type-C port device or just 'typec' if the + * corresponding Type-C port can not be identified. * TILE: * Connector tile group property to indicate how a set of DRM connector * compose together into one logical screen. This is used by both high-res From patchwork Sun Sep 3 21:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E68EBC83F2D for ; Sun, 3 Sep 2023 21:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347043AbjICVmV (ORCPT ); Sun, 3 Sep 2023 17:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349002AbjICVmD (ORCPT ); Sun, 3 Sep 2023 17:42:03 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF5E6E6 for ; Sun, 3 Sep 2023 14:41:55 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5007616b756so1449267e87.3 for ; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777314; x=1694382114; 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=rp5vM1gl9RU86RuI50kxi2LQD61SiuVQj5J5+OGEdj8=; b=LzKuaU5Io7ERItKEqZSokMqcg2iAa7++TcfdkS0yu+CR7wFonJYS7+ZdKr9DSYx/yi 86mmet212rmoU5Dw9VVnk7lhIeLnn0zaNTGymvSvzYzWAA4XOeWgPSdV/z/2Kqak2aZ9 NbOyn1woZTbkezEHcfieOJxq2Cc1qlXvrJrNNQ1QNB+y0G+02m8O98romojdQ6SNA6yY tezO6y6hXQA986TSsp4iXyKAA+FVwWGyTFqhhqUKreX1L/XTG2Ke8yAaZWsJU9r08Kve 3ygwAjaBFUJBequ0/hBMcHsCJmbBviNfoNfReeogrLaEqJQxJit6I+6BT/IGngECh0g0 t9ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777314; x=1694382114; 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=rp5vM1gl9RU86RuI50kxi2LQD61SiuVQj5J5+OGEdj8=; b=RUVYqfRIZ0eTen+zbrbopI5agwmG96PsFqAwJr7OQbOd29Gf2P+LURf9BWITlFzwbS aeTgfSO94T0QvikVkQEwrPqBe2eb+WhRii59o0Fu/QzGjfY8NQC6qlSWd5VHBRBO/h+N 29dJ2VzawaKo1OiwKgjPHzRceuU8NcfBm/UJf/gJW+Vrn+YgXV784HA/DDhlMlkD7bfA g8S3ghRap9tZUKWOTqTAa5ShwMgGJawSUxXpI9AHG+pV+GNyaWFrVggtFTxo7Q4Qdx5x 7XAusWUtsa4pX4Q/Or+wgOKB99YZ0jvZ/kSYryZCGmaSqHEHSgQ7U6R1TXX7379/tkZX n5cQ== X-Gm-Message-State: AOJu0YwjH5AKJZ6XwCLIKLwi7RxUdMpkRi7PBOW1AKp9N6sy/NMhx/uj GCX6zrFMIYGuqLFHBxs+sym5ug== X-Google-Smtp-Source: AGHT+IGDQQbfVXjBOtsl8V14iEcrDkjhs9AHs4yCZXqJ/byBpZFqNkhX6ECkcKXY9MxCWwyt+uunZA== X-Received: by 2002:a05:6512:711:b0:4fe:5860:7abf with SMTP id b17-20020a056512071100b004fe58607abfmr4579227lfs.13.1693777314266; Sun, 03 Sep 2023 14:41:54 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:53 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 04/12] drm/bridge-connector: set the PATH property for the connector Date: Mon, 4 Sep 2023 00:41:42 +0300 Message-Id: <20230903214150.2877023-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In order to properly identify connectors (in particular, DisplayPort connectors wrapped into USB-C) allow bridge drivers to specify the value to be used for connector's PATH property. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_bridge_connector.c | 12 ++++++++++++ include/drm/drm_bridge.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index bf73960c2c2a..008d730e1c2f 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -331,6 +331,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, struct drm_connector *connector; struct i2c_adapter *ddc = NULL; struct drm_bridge *bridge, *panel_bridge = NULL; + const char *path = NULL; int connector_type; int ret; @@ -377,6 +378,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node)); #endif + if (bridge->path) + path = bridge->path; + if (bridge->ddc) ddc = bridge->ddc; @@ -405,6 +409,14 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; + if (path) { + drm_object_attach_property(&connector->base, + drm->mode_config.path_property, + 0); + + drm_connector_set_path_property(connector, path); + } + if (panel_bridge) drm_panel_bridge_set_orientation(connector, panel_bridge); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index c339fc85fd07..98e9d76474f4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -753,6 +753,13 @@ struct drm_bridge { * before the peripheral. */ bool pre_enable_prev_first; + /** + * @path: the 'path' of the bridge. For bridges at the end of this + * chain this is used to set the 'PATH' property of the connector. + * This string is not freed manually, so one either should use a static + * string here or a devres-allocated one. + */ + const char *path; /** * @ddc: Associated I2C adapter for DDC access, if any. */ From patchwork Sun Sep 3 21:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A83BCA0FFD for ; Sun, 3 Sep 2023 21:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349641AbjICVmU (ORCPT ); Sun, 3 Sep 2023 17:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349006AbjICVmD (ORCPT ); Sun, 3 Sep 2023 17:42:03 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B56ED for ; Sun, 3 Sep 2023 14:41:56 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-500bb392ab7so1457648e87.1 for ; Sun, 03 Sep 2023 14:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777315; x=1694382115; 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=xxzYLYfsMsF6kZIITXju1taC/sMkbxWNFfavaK+QQhU=; b=ol2cmF1Ocr6XjMIqA//EXbkHdrd4tbITPgQ9dfba3zCGi4O/YeaSmYsvRpLvXvbew0 CaJTC2FwS5lXnQkMTf0uNTAI2CZJ7ZrC38V2ZqxxC2DYN6DakeUYsAGoZZzH0LcHTQOq i0HCP32Xn4Yf8+AlwQraR/f1hPjJ9yRz4sueO2Pa/HETpcJYWOnN0wTENILYyYgWWcDR /OKTfsZs/GTZK3EhuFZxpRKx61Jog+I9Duyr3lKsNynpwQB86pRIdyaZn94yq9Z+X7H9 Uk0VnJdkGBThj7gVbDQb2WtTX7Yift/0qgnXnpDtoNyq6qTG7ZgzsYQ/s5vVhWgAEA7C tjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777315; x=1694382115; 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=xxzYLYfsMsF6kZIITXju1taC/sMkbxWNFfavaK+QQhU=; b=j4DZ1mwcXlmvQGuEQdmkjh+PRtuhmjxGN15SH4GoYfmQJVUe4KgnE0FwKHYMUfCkgr syF/PlLT8Vcgh7LTC5a/y4muxNDnXtxFMSgcnXQ0nfpcM+7K0CyfadBDDIv+xRpnndzD gnn3hA0cs/PWb0S4OZdtaf8Z1a9tmk/NZOIF5yvtUytPDY8PaeaUqf1pa4WwY8abC8df yesLlLCIFnewbWEZ/UAJut7Eh2FHePNQZWHlvs6bqYw9/wXcbkM5w6ZCysXRTQ6wYY03 KADMcUdhTvCaIbH2y671+ySn2XhsLAIRgGoDIQMJioHSZiMO4nPEhlwNs7l8ADolOfrH 1nrw== X-Gm-Message-State: AOJu0Yw/R9wNw/vW8jLrovtWxUAdjrbMAruOo9PZ1Pcjbeu0qHKIyZAb LmvGT4oSfuV+J9HwPBTLrMPAOg== X-Google-Smtp-Source: AGHT+IHkhutnflS0UUIMoJstZXZDY/ceuTUjBBh2pmrIlmKpCCqxCMZjLAzGe9MmdoJHda/q0FEUHw== X-Received: by 2002:a19:4f4f:0:b0:500:a1e4:fc44 with SMTP id a15-20020a194f4f000000b00500a1e4fc44mr4968258lfk.61.1693777315009; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:54 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 05/12] drm/bridge: remove conditionals around devicetree pointers Date: Mon, 4 Sep 2023 00:41:43 +0300 Message-Id: <20230903214150.2877023-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Remove ifdef CONFIG_OF around the drm_bridge::of_node field. This follow the correponding change to struct device we had since 2.6.39. Having conditional around the of_node pointers turns out to make driver code use ugly #ifdef blocks. Drop the conditionals and remove the #ifdef blocks from the affected drivers. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/panel.c | 2 -- drivers/gpu/drm/drm_bridge_connector.c | 2 -- include/drm/drm_bridge.h | 2 -- 3 files changed, 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 9316384b4474..7f41525f7a6e 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -302,9 +302,7 @@ struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, panel_bridge->panel = panel; panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs; -#ifdef CONFIG_OF panel_bridge->bridge.of_node = panel->dev->of_node; -#endif panel_bridge->bridge.ops = DRM_BRIDGE_OP_MODES; panel_bridge->bridge.type = connector_type; diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 008d730e1c2f..ca255609fb08 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -372,11 +372,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (!drm_bridge_get_next_bridge(bridge)) connector_type = bridge->type; -#ifdef CONFIG_OF if (!drm_bridge_get_next_bridge(bridge) && bridge->of_node) connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node)); -#endif if (bridge->path) path = bridge->path; diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 98e9d76474f4..afa1de791075 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -716,10 +716,8 @@ struct drm_bridge { struct drm_encoder *encoder; /** @chain_node: used to form a bridge chain */ struct list_head chain_node; -#ifdef CONFIG_OF /** @of_node: device node pointer to the bridge */ struct device_node *of_node; -#endif /** @list: to keep track of all added bridges */ struct list_head list; /** From patchwork Sun Sep 3 21:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AE73CA0FF8 for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349104AbjICVmF (ORCPT ); Sun, 3 Sep 2023 17:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349021AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82838106 for ; Sun, 3 Sep 2023 14:41:57 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-500aed06ffcso1304710e87.0 for ; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777315; x=1694382115; 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=OQcAPcnsh/PX6lyiVXrbFZsnqyLcpAkILp56uQTeTQw=; b=UjTEXxmFUGnIujn1SJgYcThCVEVbqbKDQ9fn5cOi3aS41aGLUt/77MYmqIvuDVPy9I eg6aEROrqc61eZttTIdT8Duii6Ft9LiS0027egPMOibMVg8FbUkU6yG4ZDAXj/NgIji+ Hrta5vkPm711oqUtlMm+zPSuP7MwLY1kTZflViuLGduARZRS/94ulKaC5/VHbZUtxro1 Itx3HNTB+9IwuvFO9sVY/MhO07CEnrXax8l51OxudEfjvNdcq4/in6LpVBN+aavs39xj E2rPwzk2bOi5/iYDeVCkaYOd1kmRW9xIgkPDA7OcOHAzYGmYO7ERRkJYo8oTrSxhX2LX Ib1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777315; x=1694382115; 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=OQcAPcnsh/PX6lyiVXrbFZsnqyLcpAkILp56uQTeTQw=; b=T7UAY7t75F1VNy9J4vPnLel63Ifrl8N/GdAG9+MWNK1LV9pZMqgA4KILlwX+MK5gTM FJdUlH1Pxuu0GS/v+ukB2feJRtF5pIc0vsFMa9lYd3qB13zYsyp2FSB0kDrvcwIJBUlE 6UpvqSRMowyqTm5gGzEJZQKBBCsg8DWqDW4RuzR9sfRfPz2L9fJhbD+UKR0HY6BhATv/ EBvkdnSTXjbMKr1wCsmzGh+DSBtq/UJ7sXxRAhzK/4Y54PNyYv05sI2EwOqyhdPOKeIo CsrorEsDRMERHMHp3XTG2+6McsafFPTZHtp+GuPPfjE+irTNsUW7INMj+vhoXvFdetK8 C0og== X-Gm-Message-State: AOJu0Yw5LxbfX/Ze82FqAquvMvfXaGXqNDAHgNvYyz1C1Z54Uihjqg0W uxZ68repbK5Yk7juxEDGL8+yew== X-Google-Smtp-Source: AGHT+IFpEl+oUE18/qsarFYaU8IntNTWUpC/nioDioEjFcJUMzzHif7+zO1awGEwu6H7kQPHIzxz/g== X-Received: by 2002:a05:6512:2814:b0:4f8:62a6:8b2 with SMTP id cf20-20020a056512281400b004f862a608b2mr6629124lfb.46.1693777315799; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:55 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 06/12] soc: qcom: pmic_glink_altmode: fix DRM connector type Date: Mon, 4 Sep 2023 00:41:44 +0300 Message-Id: <20230903214150.2877023-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org During discussions regarding USB-C vs native DisplayPort it was pointed out that other implementations (i915, AMD) are using DRM_MODE_CONNECTOR_DisplayPort for both native and USB-C-wrapped DP output. Follow this example and make the pmic_glink_altmode driver also report DipslayPort connector rather than the USB one. Cc: Simon Ser Acked-by: Bjorn Andersson --- drivers/soc/qcom/pmic_glink_altmode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index d05e0d6edf49..974c14d1e0bf 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -465,7 +465,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs; alt_port->bridge.of_node = to_of_node(fwnode); alt_port->bridge.ops = DRM_BRIDGE_OP_HPD; - alt_port->bridge.type = DRM_MODE_CONNECTOR_USB; + alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; ret = devm_drm_bridge_add(dev, &alt_port->bridge); if (ret) From patchwork Sun Sep 3 21:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4ED4C83F2C for ; Sun, 3 Sep 2023 21:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348987AbjICVmG (ORCPT ); Sun, 3 Sep 2023 17:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348918AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 274E510F for ; Sun, 3 Sep 2023 14:41:58 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50087d47d4dso1455522e87.1 for ; Sun, 03 Sep 2023 14:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777316; x=1694382116; 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=mQu1z4f66ZLko+rKDaNEqwlYcOO6KOPqUNdRGmTYflk=; b=yoQftoDDcczedWpEq5MPT7EbuHO3OQRoQ0GhNSJBMxufi3KntbCaG03nOnSCAaxDB8 r84VlqXhzFLTwgbI599qxvakCtQgkp/aL9EnSMQFsdqLkmoNaNvGcO2t9SIU7OSZDUQs uyj1C6+RlHWcBHaSv4P2bz7jD6YSSDRSUo6bZnvPX/oVRYOyI3jobnRqgwwShuKLNJhU iSJnfHkg8z8NT2m1nwPybfNwNLaY566Bybvu/PCjtwqwHot5UCABnqYKa0bHw01ByAVL Xj41PUI77GyELjwHISUDLoltehhd94u/kBv5JHRmc/3m/IKMBCFjDBCiLobVNy7rsc5y Sj8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777316; x=1694382116; 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=mQu1z4f66ZLko+rKDaNEqwlYcOO6KOPqUNdRGmTYflk=; b=PLE3sYYBsz5DBaNsX3mXVSnC2SrfLzkqGNpNlVUiTNwLJzV6eNZ7BoVsV9SO1696CN oHIbblnuHBkInsc8WPaEwqFoAWxbxYj/JMBv7SotzhqNJSKXNBRNeYLVeOVrgygJIt2M MMaluGVGNu37a6QYEB+4Lo7IVNSvNEwbqHpZQto8LbRJNziOxRjCacvQ60j/eyRpN51l 5Tt0Vn2c+iyM8ToISwvMxXnFlSmn2dVNV3tdUL0/OwI0ajInIEjGgfEWcey7RESYLKDg ezKDZ+7vikiuX2q0RsO5HbS+0ygokpfVWWN54KqGf4zfPKn4UD6W3aiQCfRkAFzPmZMV 18Jw== X-Gm-Message-State: AOJu0YxUqnrAHCrbo+jqR8CVnNLXuKXB5O4V70arnH//NGsVNCmo/G3e PH3hU5EO3sakQOZKtAsZlsaR0g== X-Google-Smtp-Source: AGHT+IExVQuQX3Gj81jbZ+R6ySGMUAgWZnxuPMcXW9RME/R1Qx0IzJskMS/e3HZRFl9o1BgsPXmohw== X-Received: by 2002:a05:6512:34d0:b0:4fe:85c:aeba with SMTP id w16-20020a05651234d000b004fe085caebamr5162568lfr.21.1693777316523; Sun, 03 Sep 2023 14:41:56 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:56 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 07/12] soc: qcom: pmic_glink_altmode: report that this is a Type-C connector Date: Mon, 4 Sep 2023 00:41:45 +0300 Message-Id: <20230903214150.2877023-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Set the bridge's path property to point out that this connector is wrapped into the Type-C port. We can not really identify the exact Type-C port because it is registered separately, by another driver, which is not mandatory and the corresponding device is not even present on some of platforms, like sc8180x or sm8350. Thus we use the shortened version of the PATH, which includes just the 'typec:' part. Signed-off-by: Dmitry Baryshkov Acked-by: Bjorn Andersson --- drivers/soc/qcom/pmic_glink_altmode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index 974c14d1e0bf..a5b72046caaa 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -466,6 +466,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, alt_port->bridge.of_node = to_of_node(fwnode); alt_port->bridge.ops = DRM_BRIDGE_OP_HPD; alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + alt_port->bridge.path = "typec:"; ret = devm_drm_bridge_add(dev, &alt_port->bridge); if (ret) From patchwork Sun Sep 3 21:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373344 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C48FCA0FF3 for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349265AbjICVmG (ORCPT ); Sun, 3 Sep 2023 17:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349063AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3442110 for ; Sun, 3 Sep 2023 14:41:58 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-500cd6261fdso1521695e87.3 for ; Sun, 03 Sep 2023 14:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777317; x=1694382117; 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=SWHSZWaKhvE1MjysmoYq2syAfT9CG/PqkkscIEqVNT4=; b=OFGjRw15uVSbGAp4yu9zzgtzGPg8+T2glIgwMKBNEypXFfvXXOMCnXcBGmXfmdDOzO 846sonlFk704L2Ont7y+SWa0ldpFMcmfi1KaqGgBo9Ys5Sb0WiaOqIM+x+DpTMldQ47Q XX1CO0+/O3bNgKf7pOJv//hNpwgjyxsV0k69x+awp/1KtBj+SBhnl1l7LoUGoab88l4L XsOuZkzMTTWzgLk0fgjlPPC66W9V7bQi1pM2e8nwJKYSeFf+tDEveGjtCDi94zRlcFBw OfPz+/YXry+rIC48tGl97KlcSfbSrzjxOuszKPovZvpEr1vzMtnNAicxd1dCPj7jTYM7 y9wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777317; x=1694382117; 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=SWHSZWaKhvE1MjysmoYq2syAfT9CG/PqkkscIEqVNT4=; b=Uq3mpyFROjWbGpyeZHm2CIhUn4VjDj0aCWklJvZMsLvrWHcLr2IW6sAjLCavRpqRYc Ex2tXRIkjAXOVpg4R8iP3pXkK20eLg7VjcQdawRg/xsVGAjw/GfN8gjZuAYTcoIvLA6o rP4zSI+RrSX2ulDH4e8L9gFBkKaNvZ6ppnFQ19sE8/TvjK92ocK9XqR9Tymu2Kxkfuvf YzV92jG6mPXYSO5HbYvrD42R2BxAy1JxYE/DrYXxeEtPS35jZrLKFy/F1UszgKs69gZf kBOvz5ZOGYdzkx6rN4lxA4Yjl0mom3QwJHHHvWf2BoyW/d7jPX+dbK3gCwfjQIzJyY4a LCDQ== X-Gm-Message-State: AOJu0YzJevl1VmI8JrN7/TBNsY5pCeH+OJIItJEtJi1FVdZn7cBkhd1c xUBO7GhGWgiFoFwfW6P4PoZEMg== X-Google-Smtp-Source: AGHT+IHdP+cCSWTvD+87l9JrZmPVTmSpURuy7YzU/9ihGfD9uR1Aa2DcxlQZlNBD7Tvco0iNQQ5Pmw== X-Received: by 2002:a05:6512:2247:b0:500:7dcc:621 with SMTP id i7-20020a056512224700b005007dcc0621mr6544464lfu.31.1693777317228; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:56 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 08/12] usb: typec: support generating Type-C port names for userspace Date: Mon, 4 Sep 2023 00:41:46 +0300 Message-Id: <20230903214150.2877023-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We need a way to generate and return the Type-C port device names. For example, it is going to be used by the DRM to provide PATH property for DisplayPort connectors. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/class.c | 14 ++++++++++++++ include/linux/usb/typec.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 9c1dbf3c00e0..7394a2ecef6f 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -2327,6 +2327,20 @@ void typec_unregister_port(struct typec_port *port) } EXPORT_SYMBOL_GPL(typec_unregister_port); +/** + * typec_port_get_name - Get USB Type-C Port name + * @port: The port to describe + * + * Returns a name of the passed USB Type-C port on success or NULL when the + * port has not been enumerated yet. The resulting string should be freed by + * the caller. + */ +char *typec_port_get_name(struct typec_port *port) +{ + return kasprintf(GFP_KERNEL, "typec:%s", dev_name(&port->dev)); +} +EXPORT_SYMBOL_GPL(typec_port_get_name); + static int __init typec_init(void) { int ret; diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 8fa781207970..4aa9c9378383 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -303,6 +303,8 @@ struct typec_plug *typec_register_plug(struct typec_cable *cable, struct typec_plug_desc *desc); void typec_unregister_plug(struct typec_plug *plug); +char *typec_port_get_name(struct typec_port *port); + void typec_set_data_role(struct typec_port *port, enum typec_data_role role); void typec_set_pwr_role(struct typec_port *port, enum typec_role role); void typec_set_vconn_role(struct typec_port *port, enum typec_role role); From patchwork Sun Sep 3 21:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C710CCA0FFA for ; Sun, 3 Sep 2023 21:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349137AbjICVmS (ORCPT ); Sun, 3 Sep 2023 17:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349128AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93E9A11D for ; Sun, 3 Sep 2023 14:41:59 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5007c8308c3so1310849e87.0 for ; Sun, 03 Sep 2023 14:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777318; x=1694382118; 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=k1gyG4EA+KF88AUvqDVJpMyc5ibJn0KvVHVwRSeTDTM=; b=UHecZlFu28oyM1EdwF5xu4mbh3c2hb9MD1AU+tQzl8OtnJ90IX3AnYpsaXP5H/9n+K 7RSSHsOk6xIOwWDE4bzOUWVpuwqj4GACfNrd9MPwiQGsouwn9HIoabmEZiv31jSd1KrL uH23NUO7LadsBKSRoVYdeINOieKFf8Bho2p5Vo7JqZ3cT5Ev0sLvodGS/LF7wv5huys8 xPfGsgB9scNjYQbe3XUeXoj51Oh2/YtvW2bmycHFSM6JDAfHrhk2JqaNa2ftxlwZdEOY q255uEOuw3G3ki2y9VodbHLknRoerdOIWj9YaEAZaymp4DGlP7RHW0bVu2DXodZvkzvx nbsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777318; x=1694382118; 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=k1gyG4EA+KF88AUvqDVJpMyc5ibJn0KvVHVwRSeTDTM=; b=X3Sr/Ow6P6X5y39YC+dMABW1etIT3ywS525QZQIqEEBVL1HFXg4foACqwa0/HoCkHL zQV7hcM/KEELfER39realsHhu51BPjTd+hERXLKhaWpxmhgrVPvO5XV0bJ20U3aiFXXS x1BVwRgcj9x9sz8bHpoL0xx2FZVJdFWfw8TEd1QxYMmJdg0aWRwdiHc5EyPWittKnQ0q 1AX475QlHtbFneCRf9jz5Y5k3+ZAwLV/ED+3MtMgo4Y3wPVX+Xt1eKPwi9i16L43KJ7Q C1/JikNjz0Vdptzq5IuH7eqivLHFn+WlfDnNQh0t2LEr4DTVSJ0plMxepKspSsVEdaAn 8TSg== X-Gm-Message-State: AOJu0Yx3bjM5JhcNCyHN5/PYbYdpyj9sarV0n+MjoSwNuiZ+tKede5oJ N1lgAPAML82Lerk1m/WfthFuhQ== X-Google-Smtp-Source: AGHT+IFeimZforUo3xm2aTW6r+gvYdhOH4RX08O1w99CKPaCyS3lubUtNJ5cXMhhp/mnVE4/u6CHlg== X-Received: by 2002:a05:6512:3b8a:b0:4f8:7055:6f7e with SMTP id g10-20020a0565123b8a00b004f870556f7emr6244283lfv.44.1693777317966; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:57 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 09/12] usb: typec: tcpm: support generating Type-C port names for userspace Date: Mon, 4 Sep 2023 00:41:47 +0300 Message-Id: <20230903214150.2877023-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We need a way to generate and return the Type-C port device names. For example, it is going to be used by the DRM to provide PATH property for DisplayPort connectors. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/tcpm.c | 14 ++++++++++++++ include/linux/usb/tcpm.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index d962f67c95ae..9709b56a3046 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5539,6 +5539,20 @@ bool tcpm_port_is_toggling(struct tcpm_port *port) } EXPORT_SYMBOL_GPL(tcpm_port_is_toggling); +/** + * tcpm_port_get_name - get the name of the corresponding USB Type-C port + * @port: TCPM port instance + * + * Returns a name of the USB Type-C port correponding to the passed TCPM port + * instance on success or NULL when the port has not been enumerated yet. The + * resulting string should be freed by the caller. + */ +char *tcpm_port_get_name(struct tcpm_port *port) +{ + return typec_port_get_name(port->typec_port); +} +EXPORT_SYMBOL_GPL(tcpm_port_get_name); + static void tcpm_enable_frs_work(struct kthread_work *work) { struct tcpm_port *port = container_of(work, struct tcpm_port, enable_frs); diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index ab7ca872950b..623c34788680 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -161,6 +161,8 @@ struct tcpm_port; struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc); void tcpm_unregister_port(struct tcpm_port *port); +char *tcpm_port_get_name(struct tcpm_port *port); + void tcpm_vbus_change(struct tcpm_port *port); void tcpm_cc_change(struct tcpm_port *port); void tcpm_sink_frs(struct tcpm_port *port); From patchwork Sun Sep 3 21:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 571B8C88CB2 for ; Sun, 3 Sep 2023 21:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349116AbjICVmS (ORCPT ); Sun, 3 Sep 2023 17:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349137AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53CA8126 for ; Sun, 3 Sep 2023 14:42:00 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4ff8f2630e3so1429712e87.1 for ; Sun, 03 Sep 2023 14:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777318; x=1694382118; 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=+Fl8gZia3d8uGRSMrCOuo+xZGwzdrHyhk9K+cL7FZyc=; b=WTpHh5M9kY04howTyEB8GN/GLm/GKC1zwGchyEUCNR7tihUUiXkVO83OSwPoA89lbE WlpYyvcDBWvWB6vsQlANHsA8Enpx+lSFlswXgAT9BAOY9oeMeDOn6z+NMZM23+S4XkPU YOOPgUg2ZMC8dl6oEVqE0lqbXCNtD8D6KPmpjYDJNyGOrXayYg9o8hJgD5xLkS64qCf8 sEIkZNXYcS9Irzhb/k/Sv+AYigXMFbdLBbzIP5ZT4y3x8KUqxW6SFhgA9eDLK2vJBfw/ C7taRXEotxCJt5eBv/IYqro7O6fODj1/nNKu161429SNm0BkFuViFeKxtKKbEdhEBCrY uAuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777318; x=1694382118; 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=+Fl8gZia3d8uGRSMrCOuo+xZGwzdrHyhk9K+cL7FZyc=; b=ECb/fYo+8g4ScoTNSNpiaxKu1wLqz4BKuLoHKsVXJKYa3PLJKn0YPES7cvSaNU/Tgj +EaXb7Y32FGdzy6zphWiSHE1331VnB4C/57MzZyZ2fW7yfREVpUfjrrTtSigvPD32DFH u3WucOE/KDv3ucdRqfPjCcMja5Sz1zEcnX5O9jHU5lLhqjZJyZeVx950yCrktfU2yA46 HxEzsjLhkV6bzPq6+nV96mws+kju+NEw7bahl4KNLmOSNK8fkWi5Gi7Fy71tbRluJvlu UYuLFstWTyCUT/gqDvtsfX70Uw0Q2/vB+5uU5nChf4GqV4O/BxKESFOGU7Kvru1lEg63 EUeg== X-Gm-Message-State: AOJu0YzFSZEH93/W1W13zSpRdZ2/hg2+tFa9G9KPoKD3idQEhpNAxmCP 3OuIv4Jrrkq2rUgKypWLIg8s8g== X-Google-Smtp-Source: AGHT+IFB7g1NLcGbFTo55gFtReAERXtRLC3wSNcCmU3/Hx6wGeI5ha18iUymtWlOuu8WNDnb4g6j1g== X-Received: by 2002:a05:6512:446:b0:500:9bbf:da17 with SMTP id y6-20020a056512044600b005009bbfda17mr4134008lfk.51.1693777318743; Sun, 03 Sep 2023 14:41:58 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:58 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 10/12] usb: typec: qcom: implement proper error path in probe() Date: Mon, 4 Sep 2023 00:41:48 +0300 Message-Id: <20230903214150.2877023-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Implement proper error path in the qcom_pmic_typec_probe(). This makes sure that we properly disable hardware blocks and do not leak memory. Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver") Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index 581199d37b49..ceda594a8d56 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -258,15 +258,22 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port, tcpm->tcpm_port); if (ret) - goto fwnode_remove; + goto tcpm_unregister_port; ret = qcom_pmic_typec_pdphy_start(tcpm->pmic_typec_pdphy, tcpm->tcpm_port); if (ret) - goto fwnode_remove; + goto typec_stop; return 0; + +typec_stop: + qcom_pmic_typec_port_stop(tcpm->pmic_typec_port); + +tcpm_unregister_port: + tcpm_unregister_port(tcpm->tcpm_port); + fwnode_remove: fwnode_remove_software_node(tcpm->tcpc.fwnode); From patchwork Sun Sep 3 21:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9BA4CA0FE9 for ; Sun, 3 Sep 2023 21:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349063AbjICVmQ (ORCPT ); Sun, 3 Sep 2023 17:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349150AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38C30130 for ; Sun, 3 Sep 2023 14:42:01 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4fe15bfb1adso1471727e87.0 for ; Sun, 03 Sep 2023 14:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777319; x=1694382119; 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=6Z9KfdzRz+e1f0Dn+tIMZYjzQ2uNwluev0VEi7a5dtY=; b=bLiNoc2xYPP7AyRYDhGdrqngyBpzEC0olw884TRdE1gasT/b2exvR9K4qCWnr5YBtF 6MIXCjqUqo2JQ1i3JdI4YHxA47N1EEtd+084xcuIFWZ7tDNlkeyTnolh84j1PO5waMDq NhvmZQ4lJ5YFo50avGCVH25BTBJv5TkopOHljmsTkpi6dunjR/FADyOG5H5qvMF5Cppr EcoY7lYQMM8vpMFnHIR56G8H8SKp69NNZ5RVhYFrO7sGaTkataeHWNx6CApbmdTT7qYR 4T9lMCOh4CoUBVtiJL+k89UnTiPWyZ7EO4bL7/lSr/7W5aQO6ueBUsYZXL6AD98la6BZ 5z/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777319; x=1694382119; 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=6Z9KfdzRz+e1f0Dn+tIMZYjzQ2uNwluev0VEi7a5dtY=; b=Vld9g/VUPPpwQg4YODjZGYtWM7mtG206MPmz+UJdm+qP1GnbPar79P2JdI6CI+/ilY VUiyd6Z7afTJrfCYYRZW0ioWbH0UyfS0+2yzovuNyPe21EyvHYZBwjEaeJcfX+pH4xbe iMy6v63L0Rwk4gEAcIvpOkJ3uH/mCCqEzpgT2d9PNymnPEwljiGSinzf8hLSlrxC5StO RksCEoIJchdurmAjLdxMHZ6b8WO16tJq3Z+llvdSkF9BCL8bvWzl+xHrZaHhZZhOgxcK PA22V8j68Sr2Hm0c7dpkK/bhI67wZBQOjS6kvou0lpc+rjum6ZjEiwnWcpsb4Ea6ri/I wZWg== X-Gm-Message-State: AOJu0YyukYFtmIVm1JBHmGHtP6YD7wPFGIY6VcSqvmkA26nlNfoCl77y GtxCipZ9pGQ9qhgQndaCAysUsw== X-Google-Smtp-Source: AGHT+IEMobz+Krc+0cqSQPSTTEZbkkDAuHF3uHKlCMRtDr3G2ANxRagameLnEyWRzywcqzd4HevbIQ== X-Received: by 2002:a05:6512:ac3:b0:4f9:5a87:1028 with SMTP id n3-20020a0565120ac300b004f95a871028mr6541101lfu.30.1693777319560; Sun, 03 Sep 2023 14:41:59 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:59 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 11/12] usb: typec: qcom: extract DRM bridge functionality to separate file Date: Mon, 4 Sep 2023 00:41:49 +0300 Message-Id: <20230903214150.2877023-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In order to simplify source code and to reduce the amount of ifdefs in the C files, extract the DRM bridge functionality to the separate file. Suggested-by: Heikki Krogerus Suggested-by: Bryan O'Donoghue Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/qcom/Makefile | 4 ++ drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 40 +++---------------- .../usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c | 38 ++++++++++++++++++ .../usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h | 20 ++++++++++ 4 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h diff --git a/drivers/usb/typec/tcpm/qcom/Makefile b/drivers/usb/typec/tcpm/qcom/Makefile index dc1e8832e197..6d01ec97c9fd 100644 --- a/drivers/usb/typec/tcpm/qcom/Makefile +++ b/drivers/usb/typec/tcpm/qcom/Makefile @@ -4,3 +4,7 @@ obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom_pmic_tcpm.o qcom_pmic_tcpm-y += qcom_pmic_typec.o \ qcom_pmic_typec_port.o \ qcom_pmic_typec_pdphy.o + +ifneq ($(CONFIG_DRM),) + qcom_pmic_tcpm-y += qcom_pmic_typec_drm.o +endif diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index ceda594a8d56..b9d4856101c7 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -18,8 +18,7 @@ #include #include -#include - +#include "qcom_pmic_typec_drm.h" #include "qcom_pmic_typec_pdphy.h" #include "qcom_pmic_typec_port.h" @@ -34,9 +33,9 @@ struct pmic_typec { struct tcpc_dev tcpc; struct pmic_typec_pdphy *pmic_typec_pdphy; struct pmic_typec_port *pmic_typec_port; + struct pmic_typec_drm *pmic_typec_drm; bool vbus_enabled; struct mutex lock; /* VBUS state serialization */ - struct drm_bridge bridge; }; #define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc) @@ -150,35 +149,6 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } -#if IS_ENABLED(CONFIG_DRM) -static int qcom_pmic_typec_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) -{ - return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; -} - -static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { - .attach = qcom_pmic_typec_attach, -}; - -static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) -{ - tcpm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; -#ifdef CONFIG_OF - tcpm->bridge.of_node = of_get_child_by_name(tcpm->dev->of_node, "connector"); -#endif - tcpm->bridge.ops = DRM_BRIDGE_OP_HPD; - tcpm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; - - return devm_drm_bridge_add(tcpm->dev, &tcpm->bridge); -} -#else -static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) -{ - return 0; -} -#endif - static int qcom_pmic_typec_probe(struct platform_device *pdev) { struct pmic_typec *tcpm; @@ -241,9 +211,9 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); - ret = qcom_pmic_typec_init_drm(tcpm); - if (ret) - return ret; + tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev); + if (IS_ERR(tcpm->pmic_typec_drm)) + return PTR_ERR(tcpm->pmic_typec_drm); tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); if (!tcpm->tcpc.fwnode) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c new file mode 100644 index 000000000000..e202eb7b52db --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#include + +#include + +struct pmic_typec_drm { + struct drm_bridge bridge; +}; + +static int qcom_pmic_typec_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; +} + +static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { + .attach = qcom_pmic_typec_attach, +}; + +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +{ + struct pmic_typec_drm *tcpm_drm; + + tcpm_drm = devm_kzalloc(dev, sizeof(*tcpm_drm), GFP_KERNEL); + if (!tcpm_drm) + return ERR_PTR(-ENOMEM); + + tcpm_drm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; + tcpm_drm->bridge.of_node = of_get_child_by_name(dev->of_node, "connector"); + tcpm_drm->bridge.ops = DRM_BRIDGE_OP_HPD; + tcpm_drm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + + return ERR_PTR(devm_drm_bridge_add(dev, &tcpm_drm->bridge)); +} diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h new file mode 100644 index 000000000000..01f4bb71346b --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#ifndef __QCOM_PMIC_DRM_H__ +#define __QCOM_PMIC_DRM_H__ + +struct pmic_typec_drm; + +#if IS_ENABLED(CONFIG_DRM) +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev); +#else +static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +{ + return NULL; +} +#endif + +#endif /* __QCOM_PMIC_DRM_H__ */ From patchwork Sun Sep 3 21:41:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13373346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5C9ECA0FFD for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349071AbjICVmJ (ORCPT ); Sun, 3 Sep 2023 17:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349257AbjICVmF (ORCPT ); Sun, 3 Sep 2023 17:42:05 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FF7CC for ; Sun, 3 Sep 2023 14:42:01 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-50098cc8967so1329963e87.1 for ; Sun, 03 Sep 2023 14:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777320; x=1694382120; 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=VRU3YcmHhtMgrEwiKr0jiCPmTZjWFsu5C3QySeLjrFk=; b=THFkBtld5ZsUEWb6H7JLFiGSPRQ+dD2nTuY9ZyosTxdnMQYrFpMp996995G4SsnEOz mxkG6hcuNZC1NM94capcIUbsN2NWauNTEZQn56ShrcMvd2rsWkuct8PwtmO7xnVJQ3xN J6zAH3jpoNu/dPEW6LYdWUQ5JqOHYXDRjyN1T0P/Oi3IxUDOTPsdnpEzJb3mAImzsHAZ vOMzaxYVA0fAD+52jn5f+yfeoIeKkGm6XTgbuPPdUZIctJCOhKszdt+MeE23/o4hezBT BXJLu2R+Vn4wtKxbgD22lxYH18rs7QX2uJpSFk6sf6t14Yr85rS9e7bE9ltN5Vf5X2n8 yLCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777320; x=1694382120; 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=VRU3YcmHhtMgrEwiKr0jiCPmTZjWFsu5C3QySeLjrFk=; b=DPzDJ8hAiYst2usUNFtDil70dUcZSWqwrqfNuUCJC4VlmeQ1k0+Oe+hxYIzc7vYUCL fgbMlXows90/EmGhHSWBRyQ5tGLUnXTMDbsaTMc38PF+O4LA6Ay4WedD0a38LyvhLwT2 KHrZs04Ouq0qChpWiCMIVX0eUR+Ftcj100jTnN9sI7WOJMbFNVXVU0UulqoSmmmwiP9h gP3enKxa6WTz5YAAGAJpKUsW+gl11LezJ1wTmapoLuic5ND3r7SD2fDGS4mPDDPmMoaB Nz/NK/B5+Wlyj6C4i1WJTQ2CugnC94Srht5+8JjqZiMvkze9TlUrC7f60z1GgzyiKX2n vYQA== X-Gm-Message-State: AOJu0Yz/necL/oYCA7Z4nwA4Ym/XovgwzXB0EBbFTOTO3IgmECPay7er //8S+cZfASLNyraZ2+mPoQ0O6w== X-Google-Smtp-Source: AGHT+IFsqgNhsNbkZVa3cNm+AdNIgulADr18z4rrsHYsJZU44KXFgwMqPl+5UxHTsBskue63qdvb8w== X-Received: by 2002:a05:6512:3b26:b0:4fb:caed:95c3 with SMTP id f38-20020a0565123b2600b004fbcaed95c3mr5991678lfv.53.1693777320290; Sun, 03 Sep 2023 14:42:00 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:59 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 12/12] usb: typec: qcom: define the bridge's path Date: Mon, 4 Sep 2023 00:41:50 +0300 Message-Id: <20230903214150.2877023-13-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In order to notify the userspace about the DRM connector's USB-C port, export the corresponding port's name as the bridge's path field. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 11 +++++++---- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c | 4 +++- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h | 6 ++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index b9d4856101c7..452dc6437861 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -156,6 +156,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const struct pmic_typec_resources *res; struct regmap *regmap; + char *tcpm_name; u32 base[2]; int ret; @@ -211,10 +212,6 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); - tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev); - if (IS_ERR(tcpm->pmic_typec_drm)) - return PTR_ERR(tcpm->pmic_typec_drm); - tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); if (!tcpm->tcpc.fwnode) return -EINVAL; @@ -225,6 +222,12 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) goto fwnode_remove; } + tcpm_name = tcpm_port_get_name(tcpm->tcpm_port); + tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev, tcpm_name); + kfree(tcpm_name); + if (IS_ERR(tcpm->pmic_typec_drm)) + return PTR_ERR(tcpm->pmic_typec_drm); + ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port, tcpm->tcpm_port); if (ret) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c index e202eb7b52db..7bd7f4bf3539 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c @@ -21,7 +21,8 @@ static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { .attach = qcom_pmic_typec_attach, }; -struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev, + const char *path) { struct pmic_typec_drm *tcpm_drm; @@ -33,6 +34,7 @@ struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) tcpm_drm->bridge.of_node = of_get_child_by_name(dev->of_node, "connector"); tcpm_drm->bridge.ops = DRM_BRIDGE_OP_HPD; tcpm_drm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + tcpm_drm->bridge.path = devm_kstrdup(dev, path, GFP_KERNEL); return ERR_PTR(devm_drm_bridge_add(dev, &tcpm_drm->bridge)); } diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h index 01f4bb71346b..259c047265f7 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h @@ -9,9 +9,11 @@ struct pmic_typec_drm; #if IS_ENABLED(CONFIG_DRM) -struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev); +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev, + const char *path); #else -static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev, + const char *path) { return NULL; }