Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp656573rdf; Tue, 21 Nov 2023 12:32:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IEq79h5hg9y9SCKSQz+lP68OtP/dTe0dp0CWxMOsspwbPIM5AMK+FK3p/vGWQvIpMUc96Lv X-Received: by 2002:a9d:761a:0:b0:6d4:73d3:11b0 with SMTP id k26-20020a9d761a000000b006d473d311b0mr466244otl.16.1700598727557; Tue, 21 Nov 2023 12:32:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700598727; cv=none; d=google.com; s=arc-20160816; b=U1S2dSMcXDUq8SIc60GwsfBKwWuaq2r5VbLvA0iBI+E4mwUbLMcOtRehsHKv3Sg+dL 4ceK7bzMhemCKOXcSm47vCvEqCKjcAhkEzfIaoXlTZ33QyD4nq9ZXotEvQFuuDvnkLj6 5Qvu4LZbat/jLxOCA/SKFwiW+ziju+kctBgTBH5Xjg7ss3cFpxYieEJagxMsWs1TrjuX LdpGK2gbwmnMIoyNhbKb4I0zyQ6BooOqqDkvFsLMdeOpnZg2I/4UoBYoO/juAZ7+tlMR hhSNQ53bjbNLmj6gvwM8JfzAY6KhRhk2u36G0lPhGbscsqiQrPiAi3GnqGJXOAGJ5Sgg 6CTw== 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=H6pUSylQ57QDAnOYu4uoAZWK5eAYHbB7ZTMJQDUS70M=; fh=A3blBdamKtq5kPtlpYpz4l6zGyY+ur9G2hKXzMhYY3Y=; b=M8vLXdIx3RTDyUMssXaZB/45xdJlM1+dxhBL9UgvJfhIOo3g5Ao/SYIfeKfcSYvZ93 WxAO8uU3JyeWClEVwhVzGgRm/dotHBGp+AbtXCpYVlZzbp4RyjaBSQqo4knMKk894pZX EoNlAoBqVbMr6ATd/RGkXJnCtLCNCBv+kdQ3rLwrOzjjKixtysmTLDmE2bKak8aztNH/ j3x/snQX0gppn3p5JdDTWMPDjBn40k+fZHjTHwvbR7b4ohQkzunuRY1pNHS8gtof6lbN 0os/2qVaLQP+G9PdAO7RL9Ied+SxqM7CVY/Y4XO77IqYwpmL9Ec6ywiqYB/bJXvtQgf9 CjQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fCCR6+pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cl20-20020a056a02099400b005c1b313a127si11647827pgb.660.2023.11.21.12.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 12:32:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fCCR6+pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 13268801B7BB; Tue, 21 Nov 2023 12:32:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbjKUUcE (ORCPT + 99 others); Tue, 21 Nov 2023 15:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234476AbjKUUbw (ORCPT ); Tue, 21 Nov 2023 15:31:52 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1EC11FF6 for ; Tue, 21 Nov 2023 12:29:33 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-507a5f2193bso167914e87.1 for ; Tue, 21 Nov 2023 12:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700598569; x=1701203369; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H6pUSylQ57QDAnOYu4uoAZWK5eAYHbB7ZTMJQDUS70M=; b=fCCR6+pbo1xyY31e4mJ4cQXLs2L4HGXuHsCeD8RpJ4hj4cwx1nXW4hRhytYk81PBda wfmGjdEilXAxS699atHxZIdWrI5R9sVkCOwQR1OrBdPFeFG+h6i7R1bJipwEl7VfJ94D YTFykVcMwgeGntOEeCSW0Ktil4bI0i0o4PCYJz2hOpv36I+JVbro64MVO2Gf2E1+chth rNf+Ri48jKkc+dfkZQL/JRg1wvo8meRfxNmEsig0u5h6OPs0DLUC164A7au+KP/3sZ1X D9H8i07ZhFb5uGbRkM06vTp0MyEeBrW4pzBmr8DmFwSWUooIynKUnfZTzPNsRzGcEEUd 5ftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700598569; x=1701203369; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H6pUSylQ57QDAnOYu4uoAZWK5eAYHbB7ZTMJQDUS70M=; b=R1pma95GX7z8JMQLo6AM7eIk/pWI+u52CRBwEFtV4LUp86adLtkm9sXLWBauEPahvD zLXwHiuRJknpsAFwVNxU8onmm9j4R57V5Y7C3kKPraNuyGXZA+B/U4QjPM00kue/KnK1 jIJoCJltIk90K/OrFQ1l+h3tvb7i67h0+zF2IQMJe0a0fp/cMtpyEjKpozHSMZy7Jfhj v5X2xSxy2ZxrRkude13NiranUohCkxET4eYIWV7OYfRIznFyq/Y6bbrr3DTHDZrDFw2i 8cJl+DwXiJmVi6vZVpEnKbxKiiYO9NzTdXRHqtwHLlM+v97xXOZNCx7WWuqzfBAH9PMW 5A6Q== X-Gm-Message-State: AOJu0YyeQTk/xi1Wm65yBd4hNehfDodcUHxShqIALUD6n+Yy4yeo7F0B mSnb9fa+SwhJNsxu0c2EYmwmJQ== X-Received: by 2002:a05:6512:3708:b0:50a:6fb8:a0c0 with SMTP id z8-20020a056512370800b0050a6fb8a0c0mr114755lfr.19.1700598568810; Tue, 21 Nov 2023 12:29:28 -0800 (PST) Received: from eriador.lan (dzdqv0yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::8a5]) by smtp.gmail.com with ESMTPSA id h4-20020a056512350400b0050ab6112af2sm286287lfs.65.2023.11.21.12.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 12:29:28 -0800 (PST) From: Dmitry Baryshkov To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Gross , Bjorn Andersson , Konrad Dybcio , Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Gross , Heikki Krogerus , Greg Kroah-Hartman Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v2 2/2] usb: typec: tcpm: Parse Accessory Mode information Date: Tue, 21 Nov 2023 22:27:00 +0200 Message-ID: <20231121202925.2481471-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231121202925.2481471-1-dmitry.baryshkov@linaro.org> References: <20231121202925.2481471-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 12:32:06 -0800 (PST) Some of the boards supported by the TCPM drivers can support USB-C Accessory Modes (Analog Audio, Debug). Parse information about supported modes from the device tree. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/tcpm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 6e843c511b85..ba2926846269 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -6114,6 +6114,7 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, { const char *opmode_str; int ret; + int mode; u32 mw, frs_current; if (!fwnode) @@ -6132,6 +6133,14 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, if (ret < 0) return ret; + mode = 0; + + if (fwnode_property_read_bool(fwnode, "accessory-mode-audio")) + port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_AUDIO; + + if (fwnode_property_read_bool(fwnode, "accessory-mode-debug")) + port->typec_caps.accessory[mode++] = TYPEC_ACCESSORY_DEBUG; + port->port_type = port->typec_caps.type; port->pd_supported = !fwnode_property_read_bool(fwnode, "pd-disable"); -- 2.42.0