Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp353607lqt; Thu, 6 Jun 2024 05:53:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfwS1o/js7A30TzQwY8knQXR9ictwWr/HpBJJoCFH0/4WcmC5GF8tQZMtsuCYTgrL0MYy5rpdJQ7emQhAMEIEvDbHiP4xUeVkhvsfJhA== X-Google-Smtp-Source: AGHT+IHCE+NbXle4cQqTVKWYbTje9WvMANifv0ksTWa1M0WQ8jJSxRBKxj9OaTzHg3qK/tHUgEj4 X-Received: by 2002:a17:906:f6d4:b0:a68:fa24:9e82 with SMTP id a640c23a62f3a-a699f67e833mr377145566b.38.1717678433398; Thu, 06 Jun 2024 05:53:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717678433; cv=pass; d=google.com; s=arc-20160816; b=wsgP2SM9AUtVqapfkSqRC4KUhdZRE0sEZeuDNRwGRNXo+6wddAwai5zHJfyBePRzYb xoBOlcZ2U9xtdFpCLvvRQzqEAbvSYVmMY+ZrSnVLt9MMyDuNgPfx6VK5JKBdGAz2rBlh E942HVhmr/+FC5z4vLHu2r2HjQJSosUYtdkjdNfw1xBMbLMePtQamBoOmdMWbrf1aOmc 54tN3M4q63hkGp8XExs7vo+xBuw6vPkgCB5R+T7/y/wWYrBuKxaTQ7s1/GoXWHLfj/J3 jUJtji9eL2sY0ZFO6hsVRcuIMor+C+KvzOLk9SX605Cq2Or/JCZryRlELHEbSbKyxnxO h4tg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=zvI4LJT6aD54nzCBdd9He6NE1PNpLm27EVI6+T7NR8Y=; fh=4tecSHm6pj5jRnm0+FE2UCDr9Ewoz17mEDheHylUAMQ=; b=lcIofYxNUCMjz9WQhNbH+b/S48L1RLggzDm2GVDH6TRrgP+B59Pm5vOGqvyhOa8YID CVExzCCw7og3cKXXPHc4OZF8LZiEZ46VUrlL90KuiiFXbTPTdAEQIxGExbpLwnB1sYKG UW6tukkHrxcZVwTCh8C1CRd3QgRobQ0HZ3+hVdYcdJws8x/MJhQg1xWkcHKz2c9Y+fNK P3bOw1rexXyhp4qxdIkilmOUGm6xYznWynLxJv5Aie04HXvQmsCZsvm1ie6u5aCf+eZU 0th4pkHM3lV7xc9JiaQ3PpIhIHv5BUGcsADKpKemc6tH3LfRAFrNT3NAyLEWjG2FVCAX /ldw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K4Crf0J7; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-204296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c805881e5si67054266b.115.2024.06.06.05.53.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 05:53:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K4Crf0J7; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-204296-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204296-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C3B2A1F254C9 for ; Thu, 6 Jun 2024 12:53:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BF5A195B3F; Thu, 6 Jun 2024 12:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="K4Crf0J7" Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D65D195B1F for ; Thu, 6 Jun 2024 12:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717678424; cv=none; b=TmtQJDplQKQoG1jPT+bR3XyGt8SXxO6GcyTH3ij/EA0zyBlQOQba5uqGdDicwYc3SUBgeNBwmV6v7YYgEjGYKHJ15i3Ya6b8fNd5CNWfs1OJ6ffqdf5iQV/dxcBjKfcEQ1YamfQlpPjHoorNoN9fuyWSWDxNEUGdYJfR4TdkuLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717678424; c=relaxed/simple; bh=+Y1fY3XWJqseXhLzVJOqTW0Y6cEuYRniPkrjrZ4vWRw=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=m54MwyMh3T8bxOTQ7bPZGexDZkGNEh1ji44UuTzi8V1+I+s7t3KpUejlQ2WGrXE96y3oPP6hrWZeoRAtNIAzovPImtE35PFKmDYct3eXk/WKZuwpv24Ccht1ofIF/QyUAhBU35c0qd29un5WVt1jeffpL+5nD9A0lzlyCNUeP2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=K4Crf0J7; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-354dfe54738so755470f8f.3 for ; Thu, 06 Jun 2024 05:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717678420; x=1718283220; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=zvI4LJT6aD54nzCBdd9He6NE1PNpLm27EVI6+T7NR8Y=; b=K4Crf0J76TQqtp4X/F2G2BwHHksgeUNDn4HmpL7gyRbsLC3j98NVdI8PjIbp5h3Eo5 UIaydDRKOOkZqXmKnHR3FCSPbSSX9XC7HnkwSwz4aPDJ3V0hNSAj8tKbSbBDk9ygdh2i xSxRR9uBhQs7MPKh487ToSGN2nKQO1f7YPIi8bPfBm2LLrCTMKZj0s9Dt5jfJ7M9PQVw w2GjGkXA91oMtAW6A0svFrNUGLhCPiqisliNbFobKG7awVcyRqjYpnAIcV4PjpF70quU 3UoeTtX1bJFOLwVs1YZMZVareIiRktMe+SAS63xa4hsOV3dOtckJ/Z0Ve+3jsrSCmT10 cxWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717678420; x=1718283220; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=zvI4LJT6aD54nzCBdd9He6NE1PNpLm27EVI6+T7NR8Y=; b=g6jZrppbSbYsuTJikSLOvg9DTT8FHozEYudPMDOPbzxyu0vvRXLAH6KkRdGDA12soH R5d8heYqyTy7sKHCPsf3HBSbrvbwEHu+akmwNZJgjYMLo7weFrfoZ6SFBr4u00qf8i7Y WbQrETKIE4iid2TVwI0HBBRQzTM+fst+Ws0IzdMXo1J122wzl16rmNzEIjD04KiDd5GM zJ+oD8Xyty9MXj95FeWBW+fmPHNwyAMfZt1xudKuvXq6cIovll/urrpYtnCcSFZHHe76 vcgP2Tp3sXKTght3Fly57rW5R7DKm6531xrCF0qqwH5uKJxMM6W/yQN1b1JjHTl+W1d0 HOFA== X-Forwarded-Encrypted: i=1; AJvYcCUd7QpjMIdn2HqTzE252qrQZV6Bc3XjHg5lYY5oBqqrOR6BIirLr33ntqvMUBRtAM/M6caRhwnCDpGlz6fKi+5QkbUiz3QGBqDkaUJz X-Gm-Message-State: AOJu0YwRkPcTyPSVKXVn9zKmY1APdb1fyAB4MaAABQJehy14suqMPahP xcp7ebNA+P5s8FTbyZZFIMoKqna3PezzJDAvX9+/lXbriEOXk3JVYpKJmfLFJtw= X-Received: by 2002:adf:f803:0:b0:351:dace:3dac with SMTP id ffacd0b85a97d-35e8ef65ae3mr4272994f8f.56.1717678419906; Thu, 06 Jun 2024 05:53:39 -0700 (PDT) Received: from ?IPV6:2a01:e0a:982:cbb0:6d66:dc6b:6c6b:f7aa? ([2a01:e0a:982:cbb0:6d66:dc6b:6c6b:f7aa]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5e96c15sm1493773f8f.75.2024.06.06.05.53.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jun 2024 05:53:39 -0700 (PDT) Message-ID: <8568359e-840a-4fa4-bcbd-a0029e854f69@linaro.org> Date: Thu, 6 Jun 2024 14:53:38 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Neil Armstrong Reply-To: neil.armstrong@linaro.org Subject: Re: [PATCH 2/2] usb: typec-mux: nb7vpq904m: broadcast typec state to next mux To: Dmitry Baryshkov Cc: Heikki Krogerus , Greg Kroah-Hartman , Bjorn Andersson , Luca Weiss , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240527-topic-sm8x50-upstream-retimer-broadcast-mode-v1-0-79ec91381aba@linaro.org> <20240527-topic-sm8x50-upstream-retimer-broadcast-mode-v1-2-79ec91381aba@linaro.org> Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85/3NU3oti3nrIHmHABEB AAHNKk5laWwgQXJtc3Ryb25nIDxuZWlsLmFybXN0cm9uZ0BsaW5hcm8ub3JnPsLAkQQTAQoA OwIbIwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgBYhBInsPQWERiF0UPIoSBa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Czq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 27/05/2024 11:18, Dmitry Baryshkov wrote: > On Mon, May 27, 2024 at 09:45:30AM +0200, Neil Armstrong wrote: >> In the Type-C graph, the nb7vpq904m retimer is in between the USB-C >> connector and the USB3/DP combo PHY, and this PHY also requires the >> USB-C mode events to properly set-up the SuperSpeed Lanes functions >> to setup USB3-only, USB3 + DP Altmode or DP Altmode only on the 4 lanes. >> >> Update the nb7vpq904m retimer to get an optional type-c mux on the next >> endpoint, and broadcast the received mode to it. >> >> Signed-off-by: Neil Armstrong >> --- >> drivers/usb/typec/mux/nb7vpq904m.c | 29 +++++++++++++++++++++++++++-- >> 1 file changed, 27 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c >> index b17826713753..efb10f890fed 100644 >> --- a/drivers/usb/typec/mux/nb7vpq904m.c >> +++ b/drivers/usb/typec/mux/nb7vpq904m.c >> @@ -69,6 +69,7 @@ struct nb7vpq904m { >> >> bool swap_data_lanes; >> struct typec_switch *typec_switch; >> + struct typec_mux *typec_mux; >> >> struct mutex lock; /* protect non-concurrent retimer & switch */ >> >> @@ -275,6 +276,7 @@ static int nb7vpq904m_sw_set(struct typec_switch_dev *sw, enum typec_orientation >> static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_retimer_state *state) >> { >> struct nb7vpq904m *nb7 = typec_retimer_get_drvdata(retimer); >> + struct typec_mux_state mux_state; >> int ret = 0; >> >> mutex_lock(&nb7->lock); >> @@ -292,7 +294,14 @@ static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_re >> >> mutex_unlock(&nb7->lock); >> >> - return ret; >> + if (ret) >> + return ret; >> + >> + mux_state.alt = state->alt; >> + mux_state.data = state->data; >> + mux_state.mode = state->mode; >> + >> + return typec_mux_set(nb7->typec_mux, &mux_state); >> } >> >> static const struct regmap_config nb7_regmap = { >> @@ -411,9 +420,16 @@ static int nb7vpq904m_probe(struct i2c_client *client) >> return dev_err_probe(dev, PTR_ERR(nb7->typec_switch), >> "failed to acquire orientation-switch\n"); >> >> + nb7->typec_mux = fwnode_typec_mux_get(dev->fwnode); >> + if (IS_ERR(nb7->typec_mux)) { >> + ret = dev_err_probe(dev, PTR_ERR(nb7->typec_mux), >> + "Failed to acquire mode-switch\n"); >> + goto err_switch_put; >> + } >> + >> ret = nb7vpq904m_parse_data_lanes_mapping(nb7); >> if (ret) >> - return ret; >> + goto err_mux_put; >> >> ret = regulator_enable(nb7->vcc_supply); >> if (ret) >> @@ -456,6 +472,12 @@ static int nb7vpq904m_probe(struct i2c_client *client) >> gpiod_set_value(nb7->enable_gpio, 0); >> regulator_disable(nb7->vcc_supply); >> >> +err_mux_put: >> + typec_mux_put(nb7->typec_mux); >> + >> +err_switch_put: >> + typec_switch_put(nb7->typec_switch); > > Same comment, typec_switch_put should go to a separate commit. IMHO it > almost begs us to have devm_fwnode_typec_mux_get() and > devm_fwnode_typec_switch_get(). Yep Thx, Neil > >> + >> return ret; >> } >> >> @@ -469,6 +491,9 @@ static void nb7vpq904m_remove(struct i2c_client *client) >> gpiod_set_value(nb7->enable_gpio, 0); >> >> regulator_disable(nb7->vcc_supply); >> + >> + typec_mux_put(nb7->typec_mux); >> + typec_switch_put(nb7->typec_switch); >> } >> >> static const struct i2c_device_id nb7vpq904m_table[] = { >> >> -- >> 2.34.1 >> >