Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp710755iog; Wed, 15 Jun 2022 10:33:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vnKqGd5BCs0h4nTLutyROUH2vN9RcAnwqOcQb73pSEITPaPi1Ca0bUJ95a0lAWyn7RqmRy X-Received: by 2002:a63:56:0:b0:3fd:3447:4e7 with SMTP id 83-20020a630056000000b003fd344704e7mr773857pga.566.1655314402673; Wed, 15 Jun 2022 10:33:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655314402; cv=none; d=google.com; s=arc-20160816; b=GExfRryBzyqsztMZutoKrrZpcqgx+hB2UDs5AZrpOdngbOVqRqdS9iBIdluwMs31+K WSUf5C5q8tG7DNiW8j16Uq7Y2MKzs2hhmyinh9vnTfCOW4mVSW/ngr8hdslQuc8W+s4I yZptLgA0t4xMTxWfTfeMMr0YfdRf0ICMH+PmX31cvsjk0LphHqwMZDTi/HjjJgBJLrIc O2zDui91Rpsrv7Jh94+3ONuP4g5kmR1TrGWfcgsOUAd7lK6dNyei1edu7IHtUDq8aFxf 0gCExtp5vbdy5Zt5ER5aYQmBgvS0JCPf58cQKMeTshjMTN+mdge0Oz6A5Yw9hzrpAjmn c7nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yU1gCwo/vpUxCIc57VV4IsZishi0TSmAXrvBQIGpe2U=; b=cmLGcRuNz/56a9gCrSpMAIjFYnpBzldYYDAa9hq0wcfCKEgHdN7gznTIzXMldSZ8ZK O6h50kL3KkYETIofyqTSix15vhQTSwn2by9kVKI/r8HRGdb977NJYpNQcl7cPztI7ddM w/U8Gz7Og8Bd8hoE3Bg/veygqa70zFYevIT0o6oETTTfhBrncdeM3UDL9tU+yeFc2cC9 M4NgG52mGZc+01nPzxFM7Ac/ueczdxytStxDeqBbHKEDuSuASqPRtM2QZ/DpCvJQBCSn mcErMRkx6UWIWuMdSaYU6nTKkFtKpfNJuOn+XXg/xc3vcjavENHiHbS2fyg63cHQOz+2 U6qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R48f0TEr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q1-20020a639801000000b003fc66830016si18791306pgd.878.2022.06.15.10.33.10; Wed, 15 Jun 2022 10:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R48f0TEr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245029AbiFOR3H (ORCPT + 99 others); Wed, 15 Jun 2022 13:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242586AbiFOR3E (ORCPT ); Wed, 15 Jun 2022 13:29:04 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EA3B396B7 for ; Wed, 15 Jun 2022 10:29:01 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id e9so11830261pju.5 for ; Wed, 15 Jun 2022 10:29:01 -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=yU1gCwo/vpUxCIc57VV4IsZishi0TSmAXrvBQIGpe2U=; b=R48f0TErt8niv/gv0d0lSVb6ITUrGLs9Pd30o8jOJZHXeD52Fzw4OHBJ7lzPtQ1FLu wTXzhTC2c8lGmQ/HkwHyMOyoDwMv8eMS97KPLg62tAJyPlPdqaPPN9e5lywZaCofvNb/ 2stqabdAEpTT7j5KWGiwE2SbZRUUlEodPRwkk= 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=yU1gCwo/vpUxCIc57VV4IsZishi0TSmAXrvBQIGpe2U=; b=e11g8cNzfieBuWCcev0qAxf9lCIwUt3J17wqkh9zjCfoW3Tl2bvUN70dYEBg+j28Wm wWHq7ro4b/0sw5lPk9bd57zEH2A7XlphG6uNAzUGk42r/FEiwkS8V6KUasRSAm6rxlCs fU0KDF1lCDtmA12gVujdQtOokh0XzIaoGw/9TnmKdR47i8uFlZsKsT5fhZexxtkqHLjC VTgWa8AM7sW4H7qK2cKoESg8UXkTDBoOb3Bx7LgBND69kAEEe+/74GCXojAUyh2o6KFi l47CEILLT5HbU0IulB6nI7UkosK2usuJGLDZlNuXLfR8hcfzGy5uRu/fATsyuFR2vK1F fsAg== X-Gm-Message-State: AJIora8r0weP99tbLNMCxAtM1ClMXJvzH3sBMlkxH1YgjBTjmyN8QpfC Wdc1+TIRSjsiETzAY90bl/puXxKJGY9aYw== X-Received: by 2002:a17:903:1cd:b0:168:e97b:54be with SMTP id e13-20020a17090301cd00b00168e97b54bemr782149plh.163.1655314140495; Wed, 15 Jun 2022 10:29:00 -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 d10-20020aa7814a000000b005103abd2fdbsm10147433pfn.206.2022.06.15.10.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 10:29:00 -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 , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , 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 v4 5/7] drm/bridge: anx7625: Register number of Type C switches Date: Wed, 15 Jun 2022 17:20:21 +0000 Message-Id: <20220615172129.1314056-6-pmalani@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220615172129.1314056-1-pmalani@chromium.org> References: <20220615172129.1314056-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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: NĂ­colas F. R. A. Prado Tested-by: NĂ­colas F. R. A. Prado Signed-off-by: Prashant Malani --- 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.36.1.476.g0c4daa206d-goog