Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp870974iog; Mon, 13 Jun 2022 15:00:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sGQVI4i0nWYyhxlaRR8PljDBQNpV2lq5ZLtLzAlLADt5zAad3CiucXgbcnpJJ1oJna5Rcv X-Received: by 2002:a17:902:ebd1:b0:162:224f:abbb with SMTP id p17-20020a170902ebd100b00162224fabbbmr1365995plg.160.1655157625574; Mon, 13 Jun 2022 15:00:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655157625; cv=none; d=google.com; s=arc-20160816; b=M/19xiENjRkoO6hNXRO5T6mM29huVsPervAdOS30JaGM/UEUg5HELF+ICoaeR1Wf7G cPVdxnV+jI8igC/h1HOVF9qsSOBo6/8CQgTpX+MUh6wisVGZUBdPMBpeJHeAdXBUniH3 tKgYXcE+RL6147sGbR66AejTdarx0obG/wUFezROVrjQEQJG3uLuNfhwJJyKB7XqE6ZA Fs515Ji78pAj801ZPb/KzLirTO6jlCkR9WEMHDXVFgfWyvizCxEMxFYWvUdd8LEhPkUQ F/alVbg6SDtonn4zSqYgrHU4OOLgEUV4NwMMR1JhQTbJ5cJm29dKyI8O0TaCTBK5KCEy GSJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qgsqJhr9z4mNNeEUgwjNfIbHAf1OZsE0TKavYMMP9xA=; b=LVGfq7IGXrfBhJMN6H/4UZfGGWEac0tHlXojaEfNrL5RPqLU37z7bvm66NAWwv5vfu ZvRjlk5hMzunR2JBTuST2wrsNhQCO8Z7ae82fJ9nOeCLdEmFNZ4MMNbBj8SmK9DrGY05 nHXgzGnYQg4LxbXe3u7o02DwHsiWVcQbG0IaBDLg2KQbKk8JS0ttrFbME3ZE2WuwUmNI 0WuHXAbBxusqxTztUVt+MDEmO3Bai1Akqj8Cb18oq5aTXZ42aEbGCOASSuuWgH/jfXI8 A4lXK/QNiJPnkUj7bLnSqtfdPnWKwCZHI8YRn7LnlDmc1zS5tZp5t4Q7BYmMwiQp3eGN VBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DcAGmXiV; 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=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a056a00141100b0051c2af24938si12443648pfu.190.2022.06.13.15.00.12; Mon, 13 Jun 2022 15:00:25 -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=@collabora.com header.s=mail header.b=DcAGmXiV; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351886AbiFMVJc (ORCPT + 99 others); Mon, 13 Jun 2022 17:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352209AbiFMVIz (ORCPT ); Mon, 13 Jun 2022 17:08:55 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 911C763EA; Mon, 13 Jun 2022 13:45:53 -0700 (PDT) Received: from notapiano (pool-98-113-53-228.nycmny.fios.verizon.net [98.113.53.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id AFDF26601687; Mon, 13 Jun 2022 21:45:48 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655153151; bh=76l2K+RJmkAuO2v5NyKzYT+03z3iePDevHfvs6kxmQI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DcAGmXiVIvfR1sb6fH0ApTBH/2EDbc1qlwYo7fFe/ScWAWddiZOHu+nJ0iP9DhgWb lo4bfdOXKOpXmyg5UL+p0FkRvYRgpvkk8u03ypVw0YaA4MjJjsNwdxD+DF6N8cWhbU ARken95M84md1y30O6794PnEoyG9VMMQVjFqy6WzT8d+vcWg1aX0TBDHBHcjtj3j0G QFB+8AaqfCEE++kUGPoURJHTMTjAGxyYeq/c/whkqXwzHHN19w4+Z4Dn8+56JG5EfU 2Un4wKv+rnBUy0g0q2TYoSukw35/S1Dh8yUEw1HvCSj1vMKwzCcUZ+7w0MMxJJsom7 S0zGaOI3UQuLw== Date: Mon, 13 Jun 2022 16:45:44 -0400 From: =?utf-8?B?TsOtY29sYXMgRi4gUi4gQS4=?= Prado To: Prashant Malani Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, bleung@chromium.org, swboyd@chromium.org, heikki.krogerus@linux.intel.com, Andrzej Hajda , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:DRM DRIVERS" , Greg Kroah-Hartman , Hsin-Yi Wang , Jernej Skrabec , Jonas Karlman , =?utf-8?B?Sm9zw6kgRXhww7NzaXRv?= , Krzysztof Kozlowski , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Pin-Yen Lin , Robert Foss , Rob Herring , Sam Ravnborg , Thomas Zimmermann , Tzung-Bi Shih , Xin Ji Subject: Re: [PATCH v2 5/7] drm/bridge: anx7625: Register number of Type C switches Message-ID: <20220613204544.onfazkv4ciphddm3@notapiano> References: <20220609181106.3695103-1-pmalani@chromium.org> <20220609181106.3695103-6-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220609181106.3695103-6-pmalani@chromium.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi Prashant, On Thu, Jun 09, 2022 at 06:09:44PM +0000, Prashant Malani wrote: > 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. > > Signed-off-by: Prashant Malani > --- > > Changes since v1: > - No changes. > > drivers/gpu/drm/bridge/analogix/anx7625.c | 20 ++++++++++++++++++++ > drivers/gpu/drm/bridge/analogix/anx7625.h | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > index 53a5da6c49dd..07ed44c6b839 100644 > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c > @@ -2581,6 +2581,22 @@ 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 = NULL; > + int ret = 0; > + > + 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; Since the hardware only allows at most 2 switches (based on the dt-bindings), you should have a define for that limit and check that it isn't exceeded here. Thanks, N?colas > + > + return ret; > +} > + > static int anx7625_i2c_probe(struct i2c_client *client, > const struct i2c_device_id *id) > { > @@ -2686,6 +2702,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_info(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 >