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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB398C433EF for ; Fri, 8 Oct 2021 12:38:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D2CD60F93 for ; Fri, 8 Oct 2021 12:38:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8D2CD60F93 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 715A96E0DA; Fri, 8 Oct 2021 12:38:29 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id E84146E0C6; Fri, 8 Oct 2021 12:38:27 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="226397565" X-IronPort-AV: E=Sophos;i="5.85,357,1624345200"; d="diff'?scan'208";a="226397565" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2021 05:38:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,357,1624345200"; d="diff'?scan'208";a="624724638" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 08 Oct 2021 05:38:21 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 08 Oct 2021 15:38:21 +0300 Date: Fri, 8 Oct 2021 15:38:21 +0300 From: Heikki Krogerus To: Bjorn Andersson Cc: Prashant Malani , Doug Anderson , Laurent Pinchart , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm , LKML , Abhinav Kumar , Stephen Boyd , Kuogee Hsieh , dri-devel , Vara Reddy , freedreno , Enric Balletbo i Serra , Benson Leung Subject: Re: [RFC] drm/msm/dp: Allow attaching a drm_panel Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="d5CDzt0vLc4LIaGn" Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --d5CDzt0vLc4LIaGn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Thu, Oct 07, 2021 at 09:15:12AM -0700, Bjorn Andersson wrote: > The one thing that I still don't understand though is, if the typec_mux > is used by the typec controller to inform _the_ mux about the function > to be used, what's up with the complexity in typec_mux_match()? This is > what lead me to believe that typec_mux was enabling/disabling individual > altmodes, rather just flipping the physical switch at the bottom. Ah, typec_mux_match() is a mess. I'm sorry about that. I think most of the code in that function is not used by anybody. If I remember correctly, all that complexity is attempting to solve some hypothetical corner case(s). Probable a case where we have multiple muxes per port to deal with. I think it would probable be best to clean the function to the bare minimum by keeping only the parts that are actually used today (attached). thanks, -- heikki --d5CDzt0vLc4LIaGn Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mux.diff" diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index c8340de0ed495..44f168c9bd9bf 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -193,56 +193,15 @@ static int mux_fwnode_match(struct device *dev, const void *fwnode) static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id, void *data) { - const struct typec_altmode_desc *desc = data; struct device *dev; - bool match; - int nval; - u16 *val; - int ret; - int i; /* - * Check has the identifier already been "consumed". If it - * has, no need to do any extra connection identification. + * The connection identifier will be needed with device graph (OF graph). + * Device graph is not supported by this code yet, so bailing out. */ - match = !id; - if (match) - goto find_mux; - - /* Accessory Mode muxes */ - if (!desc) { - match = fwnode_property_present(fwnode, "accessory"); - if (match) - goto find_mux; - return NULL; - } - - /* Alternate Mode muxes */ - nval = fwnode_property_count_u16(fwnode, "svid"); - if (nval <= 0) - return NULL; - - val = kcalloc(nval, sizeof(*val), GFP_KERNEL); - if (!val) - return ERR_PTR(-ENOMEM); - - ret = fwnode_property_read_u16_array(fwnode, "svid", val, nval); - if (ret < 0) { - kfree(val); - return ERR_PTR(ret); - } - - for (i = 0; i < nval; i++) { - match = val[i] == desc->svid; - if (match) { - kfree(val); - goto find_mux; - } - } - kfree(val); - return NULL; + if (id) + return ERR_PTR(-ENOTSUPP); -find_mux: dev = class_find_device(&typec_mux_class, NULL, fwnode, mux_fwnode_match); --d5CDzt0vLc4LIaGn--