Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp417763lqb; Fri, 24 May 2024 02:21:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXdSsfAajCfiu7ipgY+6tsv0t8agiwSnFw36CwXyu40f5X9QMZVDJD1dNb4waTiYHzl+JKggo2tj1gjBfnL2IrQFU+C86bJ9uaUD4ECw== X-Google-Smtp-Source: AGHT+IEW33VQGwkMLvkbBVs7tPgAnQ+p1ywivzpMi4RjqmLM1BgzHtdzAB839j9oDA+Tat4bheal X-Received: by 2002:a17:906:e258:b0:a59:8cd2:5b2c with SMTP id a640c23a62f3a-a62646cd7d5mr110939266b.39.1716542502721; Fri, 24 May 2024 02:21:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716542502; cv=pass; d=google.com; s=arc-20160816; b=qd7JHRkaOvSXy/I14XedwtsisjZiHcZKoxZVZz3/Pymjeb2ldL/02BktLOmd+Th6A4 GUcn+yzEIKhPAvfnrNhJfAryFJt7dYeMMwsaNZez/PamokpUql0fMD4rCz8aCAfYjkwC WY0kr3myM69SjHkbQuHV2t3OdHUEjemSMByslatwj9cEbjvatY8uRhMXgaRV2j+V65g9 iPzxg5tKISzxDgQJbZho7dgwILsqj8maq00mLFvqAozECRHpGGEZ5uM3Rr8icQX98/F7 HEsCVEOs5PWMLMXHO9hv/yfCsJT8f41rNQdr2AYgIWa6Zty5T7gFdIaK/5YYfwZnlyXv W/WQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=9VqLXE+M4Ctnqzc9Y53bENjNOA1O/XSeTL4zdOP7UAI=; fh=RmIVLsQdHeX4l4ftzzuIntYxOwIDADRmQN67Vk3AdiQ=; b=EQVyBn9LVwnVc4ZvbBkgO5UnBAsHCKlaWW8uGgiqkISk3ip55lnP1p8rP5fjXlDKE3 VwoBk05sjeqgEF9DYI0+p2hw+jQAp/OuTdYlr0CVnf5ijFh9tSeEvgyYcaNhYc0Wzy2Y 0jLBfrYIwJo90j0R/eldiRQHAVjkw7V/HFSFugIwNSzhbgDkSRCbSn27iTttAMNswNq1 vmo1OWHCjUcjjTO+SuV8oECDNZTmNhbSihoTQy2R7bdSwQqLJB255m1yDBZvj28Rb3Cq iMJ+ZaeN1Gs1E8u5rb89mESFwnp/Cl6RyW++rUNtWiek0pdDpW2QCAfx2xFh7WcFPhNA IBYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=I+g0mjhl; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-188547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188547-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cd928c4si59707066b.810.2024.05.24.02.21.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 02:21:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=I+g0mjhl; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-188547-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188547-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com 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 74EAF1F23065 for ; Fri, 24 May 2024 09:21:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03E4684FB7; Fri, 24 May 2024 09:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="I+g0mjhl" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C31A84E07 for ; Fri, 24 May 2024 09:21:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542494; cv=none; b=P5QM0hI7+R8roOVRQ4Fk5X6vJFe57Yymy9ynHc1/EejD2n24SJUrX2AgUz1mjcyTaegZ+gbk62hlJJ6mvOW2owNPeuLbQK/NV6wtNn6bwzOK1mFuyYt+e7TGpAQC6M8rZE9Gi0GHC3gMW0ELli7amhyGIXNzvvCGvFVEhmgeVeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542494; c=relaxed/simple; bh=493YyYNAt34zY9+wCw+vzraAA49WoXc6FaYbUn31VLo=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=AM8so2uTYA5YilRrejFZ2xX3md9W+t2Zh65PFpzMZNySMklZZBFzZ6RkhrRqu00aMGfS50DPYwwXVeIQGrn9SsZDbr3RkoyAKJI/smkh0SVwBMJWc5IpAjiN5x3R6drZnZ2NlSTSCfsOqEqRPiDs5oPfhm2pAQmZAqn9+hiEeH8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=I+g0mjhl; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44O9L9Ga035918; Fri, 24 May 2024 04:21:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1716542469; bh=9VqLXE+M4Ctnqzc9Y53bENjNOA1O/XSeTL4zdOP7UAI=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=I+g0mjhlTv4elitGkb1VXIeuQ3/kJDCrThpt7PZl4luKQ5qDv7Qdy407GdUCwvman ZFPnsKgbZLRwTqD5/hJPQQsNmyjbrp+FHCVzItkJbfDXFcTvFBx71K8qja8c1SiIG8 EANAxb7A45wy5b61UGPstSKK6FAda13ojjRzVCdA= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44O9L9EP045284 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 May 2024 04:21:09 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 24 May 2024 04:21:09 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 24 May 2024 04:21:09 -0500 Received: from [172.24.227.102] (jayesh-hp-probook-440-g8-notebook-pc.dhcp.ti.com [172.24.227.102] (may be forged)) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44O9L46u039745; Fri, 24 May 2024 04:21:05 -0500 Message-ID: <442d1323-b6d3-4a50-aaea-ef32dfc08741@ti.com> Date: Fri, 24 May 2024 14:51:03 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] drm/bridge: sii902x: Fix mode_valid hook To: Sam Ravnborg CC: , , , , , , , , , , , , , References: <20240524073305.107293-1-j-choudhary@ti.com> <20240524073305.107293-2-j-choudhary@ti.com> <20240524081824.GA615138@ravnborg.org> Content-Language: en-US From: Jayesh Choudhary In-Reply-To: <20240524081824.GA615138@ravnborg.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Hello Sam, On 24/05/24 13:48, Sam Ravnborg wrote: > Hi Jayesh, > > On Fri, May 24, 2024 at 01:03:04PM +0530, Jayesh Choudhary wrote: >> Currently, mode_valid hook returns all mode as valid and it is >> defined only in drm_connector_helper_funcs. With the introduction of >> 'DRM_BRIDGE_ATTACH_NO_CONNECTOR', connector is not initialized in >> bridge_attach call for cases when the encoder has this flag enabled. >> So add the mode_valid hook in drm_bridge_funcs as well with proper >> clock checks for maximum and minimum pixel clock supported by the >> bridge. >> >> Signed-off-by: Jayesh Choudhary >> --- >> drivers/gpu/drm/bridge/sii902x.c | 38 ++++++++++++++++++++++++++++++-- >> 1 file changed, 36 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c >> index 2fbeda9025bf..ef7c3ab3386c 100644 >> --- a/drivers/gpu/drm/bridge/sii902x.c >> +++ b/drivers/gpu/drm/bridge/sii902x.c >> @@ -163,6 +163,14 @@ >> >> #define SII902X_AUDIO_PORT_INDEX 3 >> >> +/* >> + * The maximum resolution supported by the HDMI bridge is 1080p@60Hz >> + * and 1920x1200 requiring a pixel clock of 165MHz and the minimum >> + * resolution supported is 480p@60Hz requiring a pixel clock of 25MHz >> + */ >> +#define SII902X_MIN_PIXEL_CLOCK_KHZ 25000 >> +#define SII902X_MAX_PIXEL_CLOCK_KHZ 165000 >> + >> struct sii902x { >> struct i2c_client *i2c; >> struct regmap *regmap; >> @@ -310,12 +318,26 @@ static int sii902x_get_modes(struct drm_connector *connector) >> return num; >> } >> >> +static enum >> +drm_mode_status sii902x_validate(struct sii902x *sii902x, >> + const struct drm_display_mode *mode) >> +{ >> + if (mode->clock < SII902X_MIN_PIXEL_CLOCK_KHZ) >> + return MODE_CLOCK_LOW; >> + >> + if (mode->clock > SII902X_MAX_PIXEL_CLOCK_KHZ) >> + return MODE_CLOCK_HIGH; >> + >> + return MODE_OK; >> +} >> + >> static enum drm_mode_status sii902x_mode_valid(struct drm_connector *connector, >> struct drm_display_mode *mode) >> { >> - /* TODO: check mode */ >> + struct sii902x *sii902x = connector_to_sii902x(connector); >> + const struct drm_display_mode *mod = mode; >> >> - return MODE_OK; >> + return sii902x_validate(sii902x, mod); >> } >> >> static const struct drm_connector_helper_funcs sii902x_connector_helper_funcs = { >> @@ -499,11 +521,22 @@ static int sii902x_bridge_atomic_check(struct drm_bridge *bridge, >> * There might be flags negotiation supported in future but >> * set the bus flags in atomic_check statically for now. >> */ >> + >> bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; > > If you spin a v2 then drop the above change as you delete the line again > in the next patch. > > Sam While splitting the patches, I must have messed up. I will quickly send v3 with this fixed. Thanks, Jayesh