Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp849837iog; Mon, 13 Jun 2022 14:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrEkdDXEWxZQYwaitcFIHhb1glFfcKpf1sME0iyaC6+fuUOa7JiaKo8Dz+iR8EngdvzVld X-Received: by 2002:a17:906:3e96:b0:711:5a8:5081 with SMTP id a22-20020a1709063e9600b0071105a85081mr1526108ejj.703.1655155584509; Mon, 13 Jun 2022 14:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655155584; cv=none; d=google.com; s=arc-20160816; b=EW6HCfFa18s8mjmMhBd3Mvzadqj+7cQdhmG2iFkk1qc/b+SLOEgYWshGu8uDQSitWb q80enelQ0e30A7aMyK4i1Q6V6p0ThEh9TNA5ssoaiZqacKEKWACxHHnBXGXRtSEH9yW2 nvpOUxEEtqdhGk5eQ/J7/dufpGrXgRAAt0AZMh/VzKVIKSlYnxgH2UWWeU7tQ6AxvL+q DJ0q2gsSFs9HBN0yrjPXicdWhWjGarivko/Q7LEv6nuWbip1+3w4yv7sUchjydUeW9SF ymmhSNnc1wZdnQXju+pWM3b7QKCPI/DfV4Eq41Y2EiqO/m+OsyTBMFi2LH5IKwpnH/zj gw9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3mzLXc3omMOdnceGi72bYvaWi09FowsdxsPXVOOLWCo=; b=UcfXeKOxibWWeAGiBvOvZ+ecrWqt5yBf7Y56SP8hcSWfAeQNfvfZYMH+6TxBwQPrq1 kmI5fECMMWvQWdp1S9j6mYya8G5oFB2ymVhrKs4lseaEAPEMs5W6y2LqWOEPqMChysP/ XlftED2HDI1tq0qEIPLfGKscVtIBACnKggU4ZzUzviAzUBx7bxkpDVkF1ha1lFZMOMxk Ns7q+Fc0QTq6YeqU5qbZbHY7VxNQLXGTc9pXREWb5g1rvWM5LlEh+DsRUmF+/iQeAkT4 OIwSFofPgcirsse3YdGuPRp25sfYBMrEEy7GXF0cHK7nm6fRNUWTM+LtZbz3XfHtLARe xbJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UkGQCIGm; 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 hr2-20020a1709073f8200b0071097667454si9352168ejc.800.2022.06.13.14.25.58; Mon, 13 Jun 2022 14:26:24 -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=UkGQCIGm; 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 S1351777AbiFMVLC (ORCPT + 99 others); Mon, 13 Jun 2022 17:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351783AbiFMVKm (ORCPT ); Mon, 13 Jun 2022 17:10:42 -0400 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B73536E19 for ; Mon, 13 Jun 2022 13:48:25 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-30ce6492a60so10347837b3.8 for ; Mon, 13 Jun 2022 13:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3mzLXc3omMOdnceGi72bYvaWi09FowsdxsPXVOOLWCo=; b=UkGQCIGmy2VA2qNV54XgHFut1lruS44Ok6ioCXsNzw6LyRpNqBzZClI6cA1S7OvMcY Kp8PTojzzJD65eMqBbZ/0ziJq0NYOS6jETD9dqdsU4UjPK+Z84UhGwH6M7KldwNl2q3N 5tACt6+cbeMJpcLCaQEI4AOkuRxogFnBtnqG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3mzLXc3omMOdnceGi72bYvaWi09FowsdxsPXVOOLWCo=; b=Fuzq/jmBQHVJ48g2mNMhJACdl9KOVhnaIunUJptnk72mELyu4dKgJL5MVgpvI0zKu/ siCgThpsS+qqbENMj5Rm8NdpklhV3SPiRZ51YbDkQ7GYyux98x9MFC7CizSNH75L8l3C h458mgR+PyrlxFOCC8yOZ/lCfVq5EkpezimnzYiylLBEiGUeTxdJa8dSQdJU+Xcx3ke7 EtMw7gcdK13Zjq0uESxpgbZnNEODWoeW0jHSy/nlpa0PhrWKXJLOxJMo87ZDZBap36Cb F6dFAygj2pVrMGkTo/ZRJHr329RCZEjz7gLeF4lqTgT/MmyNGGO6witgcsJmSbhyyroT 98wg== X-Gm-Message-State: AJIora8BCGvJYBjLTDYbaQDI3gSuxAknRYCfE9kugaEho5yPomFaCtbd jsvNnhF9sU8jz7sAJVb5JUvW16aZs96wcLBPI0sBfg== X-Received: by 2002:a0d:f882:0:b0:2f4:d830:6fd with SMTP id i124-20020a0df882000000b002f4d83006fdmr1775978ywf.387.1655153304756; Mon, 13 Jun 2022 13:48:24 -0700 (PDT) MIME-Version: 1.0 References: <20220609181106.3695103-1-pmalani@chromium.org> <20220609181106.3695103-6-pmalani@chromium.org> <20220613204544.onfazkv4ciphddm3@notapiano> In-Reply-To: <20220613204544.onfazkv4ciphddm3@notapiano> From: Prashant Malani Date: Mon, 13 Jun 2022 13:48:13 -0700 Message-ID: Subject: Re: [PATCH v2 5/7] drm/bridge: anx7625: Register number of Type C switches To: =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hi N=C3=ADcolas, On Mon, Jun 13, 2022 at 1:45 PM N=C3=ADcolas F. R. A. Prado wrote: > > 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/dr= m/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, stru= ct anx7625_data *ctx) > > +{ > > + struct device_node *of =3D NULL; > > + int ret =3D 0; > > + > > + of =3D of_get_child_by_name(device->of_node, "switches"); > > + if (!of) > > + return -ENODEV; > > + > > + ctx->num_typec_switches =3D of_get_child_count(of); > > + if (ctx->num_typec_switches <=3D 0) > > + return -ENODEV; > > Since the hardware only allows at most 2 switches (based on the dt-bindin= gs), > you should have a define for that limit and check that it isn't exceeded = here. This is already enforced by the DT binding (see the "patternProperties" in patch 4/7, suggested by Krzysztof in the previous version) > > Thanks, > N=C3=ADcolas > > > + > > + 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 =3D anx7625_register_typec_switches(dev, platform); > > + if (ret) > > + dev_info(dev, "Didn't register Type C switches, err: %d\n= ", ret); > > + > > platform->bridge.funcs =3D &anx7625_bridge_funcs; > > platform->bridge.of_node =3D 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/dr= m/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 > >