From mboxrd@z Thu Jan 1 00:00:00 1970 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 E47DBC433EF for ; Wed, 22 Jun 2022 17:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356156AbiFVRk3 (ORCPT ); Wed, 22 Jun 2022 13:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232837AbiFVRk2 (ORCPT ); Wed, 22 Jun 2022 13:40:28 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F2832DA86 for ; Wed, 22 Jun 2022 10:40:27 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id h9-20020a17090a648900b001ecb8596e43so132163pjj.5 for ; Wed, 22 Jun 2022 10:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+phphPSX2QRUw0tjQuAYChy3WBtYC3d4W2KVy+eHtGw=; b=oD8jiOaOWh5aqMxI3+gxdJly1kokltURo4J1pPYbZk4EQWQSqhUbX8BiVTxv/Eq74y ldo3TY+Sc/j8kQWCNanxJhYAwnNIFG/RfJlT6XBI11a5JjkLFCTkahcKakMZshxzO/o/ DtXpoJVT34o9NFA2J/MfAvlhQdQje0V42K2rc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+phphPSX2QRUw0tjQuAYChy3WBtYC3d4W2KVy+eHtGw=; b=G/ZSMTiWLrrNMPxPVcG+MNx7gxUIP3hH4NQ7AxhOhA+4nicFznf+kBCoJzSRqLDZhP NnWNEfz0fbvt5VFMMoD5LwAaZfWO96l3IvvL4uc/j2LJmhmx2OWoEQdYQiQjhivSYkob WEcMARbCNvtcPsGmLpHgEmTsBZW1L8kFeskwaOKBcZPqS+1NDM5Tqd7l8qsaUf5GznV2 mhVb1YRCYeCO1MIRMCfgRQSPlM43bKMKb93o4fOS5L2YJejyK9ZfqBCCx47RwYm1CH4o rCeklrBIIUXs5T+Ch7azbggt7soSUqA+XhzEpWxBUhvCDL31sl6aCkqXtuCQFk83RT2W t74w== X-Gm-Message-State: AJIora+B6lZ5v6bLY9yqiQyM9+fmQKf9BalprraP7xEaYM1ob1EK9Fz7 v/zwbvnqkYhy+Y2rbfTaKNE+kQ== X-Google-Smtp-Source: AGRyM1ssKkK+844r5lhZX3MDfkPyWSoqQhMfsDXY150pJ//UPfwP33OcS6jm3l8TWfGyzoyNVJQXEQ== X-Received: by 2002:a17:90a:d148:b0:1ea:4e16:545b with SMTP id t8-20020a17090ad14800b001ea4e16545bmr51326528pjw.132.1655919627126; Wed, 22 Jun 2022 10:40:27 -0700 (PDT) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id l17-20020a17090b079100b001ece55aec38sm35470pjz.30.2022.06.22.10.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jun 2022 10:40:26 -0700 (PDT) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, swboyd@chromium.org, heikki.krogerus@linux.intel.com, Prashant Malani , AngeloGioacchino Del Regno , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Allen Chen , Andrzej Hajda , Daniel Vetter , David Airlie , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), Greg Kroah-Hartman , Hsin-Yi Wang , Jernej Skrabec , Jonas Karlman , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Krzysztof Kozlowski , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Pin-Yen Lin , Robert Foss , Rob Herring , Sam Ravnborg , Thomas Zimmermann , Xin Ji Subject: [PATCH v5 3/9] drm/bridge: anx7625: Register number of Type C switches Date: Wed, 22 Jun 2022 17:34:32 +0000 Message-Id: <20220622173605.1168416-4-pmalani@chromium.org> X-Mailer: git-send-email 2.37.0.rc0.104.g0611611a94-goog In-Reply-To: <20220622173605.1168416-1-pmalani@chromium.org> References: <20220622173605.1168416-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Parse the "switches" node, if available, and count and store the number of Type-C switches within it. Since we currently don't do anything with this info, no functional changes are expected from this change. This patch sets a foundation for the actual registering of Type-C switches with the Type-C connector class framework. Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: NĂ­colas F. R. A. Prado Tested-by: NĂ­colas F. R. A. Prado Signed-off-by: Prashant Malani --- Changes since v4: - Added Reviewed-by tags. - Patch moved to 3/9 position (since Patch v4 1/7 and 2/7 were applied to usb-next). Changes since v3: - No changes. Changes since v2: - Move ret variable to Patch v3 6/7. - Make error print a dev_dbg, since it is noisy. - Added Reviewed-by and Tested-by tags. Changes since v1: - No changes. drivers/gpu/drm/bridge/analogix/anx7625.c | 18 ++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 1 + 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 53a5da6c49dd..e3d4c2738b8c 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2581,6 +2581,20 @@ static void anx7625_runtime_disable(void *data) pm_runtime_disable(data); } +static int anx7625_register_typec_switches(struct device *device, struct anx7625_data *ctx) +{ + struct device_node *of = of_get_child_by_name(device->of_node, "switches"); + + if (!of) + return -ENODEV; + + ctx->num_typec_switches = of_get_child_count(of); + if (ctx->num_typec_switches <= 0) + return -ENODEV; + + return 0; +} + static int anx7625_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -2686,6 +2700,10 @@ static int anx7625_i2c_probe(struct i2c_client *client, if (platform->pdata.intp_irq) queue_work(platform->workqueue, &platform->work); + ret = anx7625_register_typec_switches(dev, platform); + if (ret) + dev_dbg(dev, "Didn't register Type C switches, err: %d\n", ret); + platform->bridge.funcs = &anx7625_bridge_funcs; platform->bridge.of_node = client->dev.of_node; if (!anx7625_of_panel_on_aux_bus(&client->dev)) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index e257a84db962..d5cbca708842 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -473,6 +473,7 @@ struct anx7625_data { struct drm_connector *connector; struct mipi_dsi_device *dsi; struct drm_dp_aux aux; + int num_typec_switches; }; #endif /* __ANX7625_H__ */ -- 2.37.0.rc0.104.g0611611a94-goog