Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15883498rwd; Mon, 26 Jun 2023 02:41:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4YgVQBroxQ3R0kLOOViZNt70Pmfalnd9rkgbxA249HNvhn5XZf7eerSC5urw2Yy+y4W7x+ X-Received: by 2002:a2e:a0d7:0:b0:2b5:91fe:916 with SMTP id f23-20020a2ea0d7000000b002b591fe0916mr7115908ljm.1.1687772480902; Mon, 26 Jun 2023 02:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687772480; cv=none; d=google.com; s=arc-20160816; b=em5FU3US4HOAo0VCGqZDF9TDqwTSe4pm35LGthWuRfbfZq9GdbDKaur9tyQ31IBBeI G3KRh5hVrSPU3ibAVuI1Y6RWWQmt6m5ztGOQG8LaUKeLeAXieAlAy+KiyUoSRgAkNkrM k6uPJBnRD2ZaKZhqC12bYT8CZNgN3zbj/a97BeGPpKFl9VlcGlFzfbLYVJUWOtXUcaGY KJw3T1ZNP5JzmihhjSouvOcZhfYRc6YNzVE9H6V7h8/k3+IRXbpGaCqgrLLUvpKxfxGt o2TWNhpJstRxbb/KEZjF6tftH6Mo+wPKD5/j0FBcLsoblRQSZvehns3GTqxLpdIRoIgD 9GzQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0ORpeTODrg3y1sXEchT7nI7KEHrVsBY1TVN71plLjIw=; fh=cKGHk9Gg99im/ndB7neEy6p+gbpnuK/3l3rybi1eZbk=; b=N4on0NW0UJp4D7KZS2qJ86PhU9g3ZVdinS77sZIfvRBdMIfXU8+7NulpVM9zbNipoy u/rgLVzn0jZNqjGvOQKQ1ovum/YNYRcXhXbzaqwolstsQ/PzJFJ4RcZDBkdWYdXhBkc3 GZQynB3kwiLe8YtAQSMgfiWT6EYePwo72dqui+gBAJsBfCTOsdl7jf2TGvA+a3EEH9sn lT1UFQ91EzCGl4mKvI+MIZUX5xMPp+OBd+FrwvNoZRVQ8OopTwGV84gJA1IvGNCR63ks IC06Gw/Aby7N0yN277EucM+6lOdnaTs6yqcdI0O9LsGfCQGFMEoZe02HSJewu0w0z7vd Efrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fffX4gxE; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020aa7c2d2000000b0051bf45b26b4si2457082edp.326.2023.06.26.02.40.56; Mon, 26 Jun 2023 02:41:20 -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=@intel.com header.s=Intel header.b=fffX4gxE; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbjFZJVQ (ORCPT + 99 others); Mon, 26 Jun 2023 05:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjFZJUw (ORCPT ); Mon, 26 Jun 2023 05:20:52 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48B7919F; Mon, 26 Jun 2023 02:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687771118; x=1719307118; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=K9kEmxtQVecdL2apry1t1vkOJkQ2rr9zsviDcNY121c=; b=fffX4gxED4Mu1p3qR5PyImG0dDJHzpPBVISLvL17i+ZjoqsY9rVCtrc4 NqX/ApiNooRshC4NtXwZ7jDuYIyZbUBcr+jOmlxZ2yPWe5zzI17PJK4rT qQ9+QWgZ5bCDM6Yc1nUR9MzpHbYD+YQxZ298KWgtp3Fuwwe42PzziAAHM PgwrPVQHSaCg2AFL5j+0VkDIzTZF9DasbpuBK8JCmbuT8vV2PdW5AB3Bn Z9OYlCiToF2CHz/iVgPAlNCiVfdHvVXlw3CrsE2gW4RKbf/rwopHU09SB BOAzcJVoT1o0/plLbSYwwG/PnfLtvCUqUHl22gRGsfY6Xy3NUOlnbEg5K w==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="447605177" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="447605177" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 02:18:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="860618456" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="860618456" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 26 Jun 2023 02:18:33 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 26 Jun 2023 12:18:32 +0300 Date: Mon, 26 Jun 2023 12:18:32 +0300 From: Heikki Krogerus To: Neil Armstrong Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v3 2/8] soc: qcom: pmic_glink_altmode: handle safe mode when disconnect Message-ID: References: <20230601-topic-sm8550-upstream-type-c-v3-0-22c9973012b6@linaro.org> <20230601-topic-sm8550-upstream-type-c-v3-2-22c9973012b6@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230601-topic-sm8550-upstream-type-c-v3-2-22c9973012b6@linaro.org> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 On Tue, Jun 13, 2023 at 09:55:55AM +0200, Neil Armstrong wrote: > On some Qcom SoCs, the Altmode event mode is set to 0xff when > the Type-C port is disconnected. > > Handle this specific mode and translate it as the SAFE mode. > > Signed-off-by: Neil Armstrong FWIW: Acked-by: Heikki Krogerus > --- > drivers/soc/qcom/pmic_glink_altmode.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c > index df48fbea4b68..007d308e2f15 100644 > --- a/drivers/soc/qcom/pmic_glink_altmode.c > +++ b/drivers/soc/qcom/pmic_glink_altmode.c > @@ -173,6 +173,20 @@ static void pmic_glink_altmode_enable_usb(struct pmic_glink_altmode *altmode, > dev_err(altmode->dev, "failed to switch mux to USB\n"); > } > > +static void pmic_glink_altmode_safe(struct pmic_glink_altmode *altmode, > + struct pmic_glink_altmode_port *port) > +{ > + int ret; > + > + port->state.alt = NULL; > + port->state.data = NULL; > + port->state.mode = TYPEC_STATE_SAFE; > + > + ret = typec_mux_set(port->typec_mux, &port->state); > + if (ret) > + dev_err(altmode->dev, "failed to switch mux to safe mode\n"); > +} > + > static void pmic_glink_altmode_worker(struct work_struct *work) > { > struct pmic_glink_altmode_port *alt_port = work_to_altmode_port(work); > @@ -180,7 +194,9 @@ static void pmic_glink_altmode_worker(struct work_struct *work) > > typec_switch_set(alt_port->typec_switch, alt_port->orientation); > > - if (alt_port->svid == USB_TYPEC_DP_SID) > + if (alt_port->svid == USB_TYPEC_DP_SID && alt_port->mode == 0xff) > + pmic_glink_altmode_safe(altmode, alt_port); > + else if (alt_port->svid == USB_TYPEC_DP_SID) > pmic_glink_altmode_enable_dp(altmode, alt_port, alt_port->mode, > alt_port->hpd_state, alt_port->hpd_irq); > else > > -- > 2.34.1 -- heikki