Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1733082lqg; Mon, 4 Mar 2024 01:53:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhT07MdQ+6KRsQxdqtZYJYULFZMYJENct3X+cpiIfHy55/ibDSlJ0Ll4e57AZp1Pl4kk+5dW/o3QP67bsyksPFbcXVEOzKuMEMsF/Eqw== X-Google-Smtp-Source: AGHT+IGut8kXNXpp5AbaOv/7ssRDIpMBx3NkaRltwiAt2/0rRzPcgZnfW9PrULnWAVqhXLXVRaI2 X-Received: by 2002:a05:6a21:3391:b0:1a1:4f7c:2f6a with SMTP id yy17-20020a056a21339100b001a14f7c2f6amr2213747pzb.19.1709545997168; Mon, 04 Mar 2024 01:53:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709545997; cv=pass; d=google.com; s=arc-20160816; b=w6Bj5RPGqYRncyOiW7msfe0Gxa8PtBaRgCmj3tVWNhrgvvv9eXN0y/08AjOkwPzOwL Be+SxlGH4H8jzyRz5QCq7w1YlibC44aYlvAcXC1zquH4knuu7cbr+vCV4JfvGxQ2HNCB XF/TAdOq1cns73FclbnI51W7/ICKMO+H4kMyOnig8TFMNO0WNFygXWASqRnhcFs7hjyq bol87nL8P7HJpA+T70KUPRBwOdnXtR3zBXNSUPVXCvNhJrYqXsF+2mXoo5IZsH74enIg YEnVogX+Mv3Rrs0lP2pk2xnysShFKB5IUePYrKjdLUy/+7WMvbb9mIqJ324/3SLLkrGF iLeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=hx8/Hsvcr26lKZm0DtuzO5aNbidCutGEeUVS79P8xjM=; fh=VNaLx5krl5H25Okkezz+nYe6UXEM+W8dlWGvD5HmnnA=; b=Gg9VA5DJ5XRSIBjfP+g0TRPc9Qsfc5PMeE863TjePI4HW7+zS56cegmn6nNlddaVdE J3hryD87hcfpwo1sSKAfLDsHdZT46M1V8ADmJgWxymK8EdNGaYqiAoAPVmmHdxSRMYzk LlotJyXxjJNpaLLxWOBfK7pTN5VpuuvFxe5bN/ZCwA/4Kp0SqPiS8/m7GTsPLlNWUUHE +UW/rF5Ywb05zXExdK9N5ahl1HwohtrS2FMvUAF2FzRdjk4HmKzCJn+t67U+5P3oc/W6 i66OEEGHDYqFCe9KBavmTteQrRxAQ6Rgw34eWQtgV5L6napqB7fMlFF3Pe1uX3qf0gxq YcRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LLItQcx8; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-90357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n7-20020a170902f60700b001db608107d8si8202480plg.203.2024.03.04.01.53.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:53:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LLItQcx8; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-90357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D5E0F28124C for ; Mon, 4 Mar 2024 09:53:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29EE8219E2; Mon, 4 Mar 2024 09:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LLItQcx8" Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (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 44AD7224D6 for ; Mon, 4 Mar 2024 09:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545928; cv=none; b=a2dTgkekPjYa9VrlkCDos4Bb0CaCLpgWr9/dWpaPhAJ4VbAAsriBvFNBL7wu3+YdDt5Ln6WN5gcoGuolRp5V0Qkw/vjyCWqtgHvomQ+K8LnQLK9Pgf5t6PejCZJ6ZSfwaVM4GBfbzUWetWSpciEUe7+/nI5AsxXRqr5lpuu1V+Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709545928; c=relaxed/simple; bh=7zhw6Zih7M1ulHr1+pXMmEbdpTGGIap6zKSkMv/zTyM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nwYusuhgzeCSa0E8GwfpBrNOelyy9XtU+Eqvj7inYgHohwF7gqf0hc3gVcDAyQfI2cvbJFzGshPH1Pl7/fdYZidEOdQKBDyTE9rNP/DZrK+m2PjSgWfHfKRY91lpQjB8J3XaB975shXQKfXxwl02nAopGYkVLjpOTBsUOTPl48g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=LLItQcx8; arc=none smtp.client-ip=209.85.166.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7c810b04bc0so177958939f.2 for ; Mon, 04 Mar 2024 01:52:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709545925; x=1710150725; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hx8/Hsvcr26lKZm0DtuzO5aNbidCutGEeUVS79P8xjM=; b=LLItQcx80TApUtMo+lCUiyAngyGtWvdbmmNVOFE41Pz7dfDK7gR8RUp/+Nt+Htaslp fn1zmtNVgVNENKBx/YHCb+VbkYSCdhPrH7ZA+ho/W9Ep/a2c+Ti4h2G6btC+eHEZkArO axpCuYZW+8/HS9PBZvgPnkmaLsXXuF8zyqIZg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709545925; x=1710150725; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hx8/Hsvcr26lKZm0DtuzO5aNbidCutGEeUVS79P8xjM=; b=iUS5OCetM6JFH6PXaCOfSfMbwkI0GTkxq7FKzWHrX7ftA2kjJEF+DKq+E66upVh6Y1 kdeMy8soihW6YG7q7fjnmu1o7vhHJOcnMxlbPo8zHtTFWjBNYGq4fyjjoauHs9XW3cGX T2eYVU9nrBiJ0dNj/2qQ3qVefowfyxh69Y5HKhW+JJHNKm/0ij8Qn8Rpdq7iNqUnmTea uLJKYsHgAMOw+W2YRJ35XMu0GppVcXcyeb8h2UDXgegJHyqSS58aB1pVfRxfPS8PFOxj BmdnHtLRQwvP+aIsW2uDKZNITpF9l4CUYOW5A6bq9YiEY9I/Q9PDT3E2Jr/YjVgsKNCI +P5w== X-Forwarded-Encrypted: i=1; AJvYcCWtUzlKLPV+Tgwl4/qLrJHemiRVlgE5trkRGpqQdbGSyVrmB+RDx41dn5LCLSmAN7mb0EYji+HBgzW9s1ChlUtmbfm8Q+KWwoqK0+K2 X-Gm-Message-State: AOJu0YwEYMIjwl/jYnInpF97P2BnFU3F1UkrnS0MUbhuC1TYgNFtU33d j9JUrdYUABmRR89fw6MQhzMset3snWp/Jaca4u29fu3IfrI1hqpa2hpl89o2BjlKJPMDdjc4/nH hCA4lfSZH2lRvzqNvKRY4gg5y5xZTyWH+9oXL X-Received: by 2002:a92:c569:0:b0:365:c6ae:c40e with SMTP id b9-20020a92c569000000b00365c6aec40emr10789756ilj.0.1709545925353; Mon, 04 Mar 2024 01:52:05 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240304031945.250763-1-kuro.chung@ite.com.tw> <20240304031945.250763-2-kuro.chung@ite.com.tw> In-Reply-To: <20240304031945.250763-2-kuro.chung@ite.com.tw> From: Pin-yen Lin Date: Mon, 4 Mar 2024 17:51:54 +0800 Message-ID: Subject: Re: [PATCH v2 1/1] UPSTREAM: drm/bridge: it6505: fix hibernate to resume no display issue To: kuro Cc: Kenneth Haung , Andrzej Hajda , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , "open list:DRM DRIVERS" , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Kuro, On Mon, Mar 4, 2024 at 11:08=E2=80=AFAM kuro wrote: > > From: kuro chung > > ITE added a FIFO reset bit for input video. When system power resume, > the TTL input of it6505 may get some noise before video signal stable > and the hardware function reset is required. > But the input FIFO reset will also trigger error interrupts of output mod= ule rising. > Thus, it6505 have to wait a period can clear those expected error interru= pts > caused by manual hardware reset in one interrupt handler calling to avoid= interrupt looping. > > Signed-off-by: Allen Chen > (cherry picked from commit Iaa3cd9da92a625496f579d87d0ab74ca9c4937c4) > > BUG=3DNone > TEST=3DNone > > Change-Id: Iaa3cd9da92a625496f579d87d0ab74ca9c4937c4 Again, please remove the gerrit-specific lines like "BUG=3D", "Change-Id", and the "cherry picked from commit ...". > --- > drivers/gpu/drm/bridge/ite-it6505.c | 54 ++++++++++++++++++++++++----- > 1 file changed, 45 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge= /ite-it6505.c > index b53da9bb65a16..e592e14a48578 100644 > --- a/drivers/gpu/drm/bridge/ite-it6505.c > +++ b/drivers/gpu/drm/bridge/ite-it6505.c > @@ -1318,6 +1318,8 @@ static void it6505_video_reset(struct it6505 *it650= 5) > it6505_set_bits(it6505, REG_DATA_MUTE_CTRL, EN_VID_MUTE, EN_VID_M= UTE); > it6505_set_bits(it6505, REG_INFOFRAME_CTRL, EN_VID_CTRL_PKT, 0x00= ); > it6505_set_bits(it6505, REG_RESET_CTRL, VIDEO_RESET, VIDEO_RESET)= ; > + it6505_set_bits(it6505, REG_VID_BUS_CTRL1, TX_FIFO_RESET, 0x02); > + it6505_set_bits(it6505, REG_VID_BUS_CTRL1, TX_FIFO_RESET, 0x00); > it6505_set_bits(it6505, REG_501_FIFO_CTRL, RST_501_FIFO, RST_501_= FIFO); > it6505_set_bits(it6505, REG_501_FIFO_CTRL, RST_501_FIFO, 0x00); > it6505_set_bits(it6505, REG_RESET_CTRL, VIDEO_RESET, 0x00); > @@ -2480,10 +2482,6 @@ static void it6505_irq_video_fifo_error(struct it6= 505 *it6505) > struct device *dev =3D &it6505->client->dev; > > DRM_DEV_DEBUG_DRIVER(dev, "video fifo overflow interrupt"); > - it6505->auto_train_retry =3D AUTO_TRAIN_RETRY; > - flush_work(&it6505->link_works); > - it6505_stop_hdcp(it6505); > - it6505_video_reset(it6505); > } > > static void it6505_irq_io_latch_fifo_overflow(struct it6505 *it6505) > @@ -2491,10 +2489,6 @@ static void it6505_irq_io_latch_fifo_overflow(stru= ct it6505 *it6505) > struct device *dev =3D &it6505->client->dev; > > DRM_DEV_DEBUG_DRIVER(dev, "IO latch fifo overflow interrupt"); > - it6505->auto_train_retry =3D AUTO_TRAIN_RETRY; > - flush_work(&it6505->link_works); > - it6505_stop_hdcp(it6505); > - it6505_video_reset(it6505); > } > > static bool it6505_test_bit(unsigned int bit, const unsigned int *addr) > @@ -2502,6 +2496,46 @@ static bool it6505_test_bit(unsigned int bit, cons= t unsigned int *addr) > return 1 & (addr[bit / BITS_PER_BYTE] >> (bit % BITS_PER_BYTE)); > } > > +static bool it6505_is_video_error_int(const int *int_status) > +{ > + if ((it6505_test_bit(BIT_INT_VID_FIFO_ERROR, (unsigned int *)int_= status)) || (it6505_test_bit(BIT_INT_IO_FIFO_OVERFLOW, (unsigned int *)int_= status))) > + return 1; > + return 0; > +} > + > +static void it6505_irq_video_error_handler(struct it6505 *it6505) > +{ > + struct device *dev =3D &it6505->client->dev; > + int int_status[3] =3D {0}; > + int reg_0d; > + int i; > + > + it6505->auto_train_retry =3D AUTO_TRAIN_RETRY; > + flush_work(&it6505->link_works); > + it6505_stop_hdcp(it6505); > + it6505_video_reset(it6505); > + > + DRM_DEV_DEBUG_DRIVER(dev, "Video Error reset wait video..."); > + > + for (i =3D 0; i < 10; i++) { > + usleep_range(10000, 11000); > + int_status[2] =3D it6505_read(it6505, INT_STATUS_03); > + reg_0d =3D it6505_read(it6505, REG_SYSTEM_STS); > + it6505_write(it6505, INT_STATUS_03, int_status[2]); > + > + DRM_DEV_DEBUG_DRIVER(dev, "reg08 =3D 0x%02x", int_status[= 2]); > + DRM_DEV_DEBUG_DRIVER(dev, "reg0D =3D 0x%02x", reg_0d); > + > + if ((reg_0d & VIDEO_STB) && (reg_0d >=3D 0)) > + break; > + > + if (it6505_is_video_error_int(int_status)) { > + it6505_video_reset(it6505); > + DRM_DEV_DEBUG_DRIVER(dev, "Video Error reset wait= video (%d)", i); > + } > + } > +} > + > static irqreturn_t it6505_int_threaded_handler(int unused, void *data) > { > struct it6505 *it6505 =3D data; > @@ -2522,7 +2556,7 @@ static irqreturn_t it6505_int_threaded_handler(int = unused, void *data) > { BIT_INT_VID_FIFO_ERROR, it6505_irq_video_fifo_error }, > { BIT_INT_IO_FIFO_OVERFLOW, it6505_irq_io_latch_fifo_over= flow }, > }; > - int int_status[3], i; > + int int_status[3], i, reg_0d; > > if (it6505->enable_drv_hold || !it6505->powered) > return IRQ_HANDLED; > @@ -2550,6 +2584,8 @@ static irqreturn_t it6505_int_threaded_handler(int = unused, void *data) > if (it6505_test_bit(irq_vec[i].bit, (unsigned int= *)int_status)) > irq_vec[i].handler(it6505); > } > + if (it6505_is_video_error_int(int_status)) > + it6505_irq_video_error_handler(it6505); > } > > pm_runtime_put_sync(dev); > -- > 2.25.1 > Did you check my comments in v1? Please reply if you don't agree with those comments. By the way, some mails are bounced back because of the address changes. Please refer to the MAINTINERS file on the latest kernel (not ChromeOS v5.15 downstream branch) for the contacts. Regards, Pin-yen