Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp443748lqh; Fri, 31 May 2024 06:20:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1PjK+I9FVLPLjyBcCozWzKzkrrP7w/mQG40FILVKph822lIbY5ooGu0ZvLQC5M0pNtc9aV+h8VPGR/lnE5Rl7mJtWFJbdtrr1Y3QTfA== X-Google-Smtp-Source: AGHT+IGV0soL9trENsbPAC88bm3m5DiF/ahea9gvRiKIuR4A4B/BVCNoESMcfFjGd9NvHXINshqn X-Received: by 2002:a17:902:ce12:b0:1f2:ff7d:ecf1 with SMTP id d9443c01a7336-1f636fefa3emr24872655ad.16.1717161651020; Fri, 31 May 2024 06:20:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717161650; cv=pass; d=google.com; s=arc-20160816; b=FGtwOb6N8pVpI+rzD0CekRRjJW0D4ITPoFp8S2ACr6uWdg5tUYmXD0uevfufJwfUZ0 qJx/tTuS3d+KCxFCZ/QEE8ByGW2haKmR2obU+PiiKZCh8ZWZVBoBlUEP3BP6JbydwXdQ ZYKBYI0jiW3uAD03MM2pauK7QZpm6M2XTXafXamBjeLI+4Gedgm2rbcuEbZANXZIXYr6 etIzJ9JRAwBatsyfT/iWmvP+qOg1KD1In+LFpypgjLdU47ZL0xSZFak0SWRh31dGzegv M4uum/O7CFvsRGq2PyqI9/O6bFBp0h42uz9U9+k810ralWFQ1ibbh8m54kQnKQi3Q5d5 n/mA== 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:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=kW7p+495kaagcNi9JTec3IGLF/Kn4TrnUM2RlI0AJJw=; fh=rBLDj1YFbQ5yyfsFBxlV/5Cye3Fnn7zumKUbbuFMUhw=; b=jPT9O6s9/zlzuW1QUxIwwzfczZ5nJ/luwNWgOW+z3Vi18xHEbFFz6LGDMgsEolRg4o EbPkhXrCSPJi0dyXRgcr8a26Te3Xd9i19wD9lF6BPUIAEfgbFsFj+z2a43OvHNXeuYoi 0Ek5sed6IwWSouxjwQwnJo2a03s5Hg+z0rXbPscTc86aAcGi2he8S+eTLsZVlCL/Uchu UAYaEWnOssAY9CpnDx7XbjUCDJJp5uZyo7Ok+J4IJWX7nR0VH0pKLfHR25eHIb2BcqJW eJasZPhzf3QDa7JQ83j4Ub/KZlohGPUCkFLjS8VAGPYl3mxX38NFDyYh08A6dc+NSqUO Bjqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MRL+4Y7r; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-196873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323ded56si15930985ad.225.2024.05.31.06.20.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 06:20:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196873-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=@linux.dev header.s=key1 header.b=MRL+4Y7r; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-196873-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196873-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 F4105286179 for ; Fri, 31 May 2024 13:20:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D647158D8C; Fri, 31 May 2024 13:20:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MRL+4Y7r" Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 B156F158D62 for ; Fri, 31 May 2024 13:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717161611; cv=none; b=lmzGCeCGFg0OqWAS2fFr2BBnNGbexPw8NNuBEcidY4yKuEd+NllwEp6UzuXsH7vLzvY/AQgPn/Nf+5NiGZvEzsPDYF/6tqvrldVWRNNWFPkCkbABpvIHYYiZded5mNpm7OBKLGXjHnlSg80yCU5cQJPxCGVNdee29DzcoFjXs+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717161611; c=relaxed/simple; bh=+23NoZdbP3sDWrl/C4DDAWtc0doCEz8lA1bAx4ziuI4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=D1Hu8BagSMF8Ouc4kojt4wFJ0b1nom4VXF70llp1GtILzdZFWnHiasyP1yrM79HXqdK9iwyEYHxMgKht/c5OveR2HRqJHf4C2vBMfZyUMnd65mhGQP8sAEn+pxpXwLQAL14xS6p7+L4pteRnB/bbnyk2vHu2PoUQNpUXBau20nc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MRL+4Y7r; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: j-choudhary@ti.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717161607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kW7p+495kaagcNi9JTec3IGLF/Kn4TrnUM2RlI0AJJw=; b=MRL+4Y7rXpq2+L//0TuE1nQaHxgRnVB1gOvWXiVZLdwlPT3yYinVNnndOllqygfGa/WBSf xKxpv2I3JJ987ULBZNWp5r3sO8x3TBfLIv2lKb0vnRWMYuINVTwIrYnngl0Wzu+cBzobfO edbO6ZDp3MwJqBBSu66ufFRJQg1s+BY= X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: dmitry.baryshkov@linaro.org X-Envelope-To: andrzej.hajda@intel.com X-Envelope-To: neil.armstrong@linaro.org X-Envelope-To: rfoss@kernel.org X-Envelope-To: laurent.pinchart@ideasonboard.com X-Envelope-To: mripard@kernel.org X-Envelope-To: sam@ravnborg.org X-Envelope-To: jonas@kwiboo.se X-Envelope-To: jernej.skrabec@gmail.com X-Envelope-To: maarten.lankhorst@linux.intel.com X-Envelope-To: tzimmermann@suse.de X-Envelope-To: airlied@gmail.com X-Envelope-To: daniel@ffwll.ch X-Envelope-To: a-bhatia1@ti.com X-Envelope-To: dri-devel@lists.freedesktop.org Message-ID: Date: Fri, 31 May 2024 21:20:00 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [v4,1/2] drm/bridge: sii902x: Fix mode_valid hook To: Jayesh Choudhary , linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, mripard@kernel.org, sam@ravnborg.org Cc: jonas@kwiboo.se, jernej.skrabec@gmail.com, maarten.lankhorst@linux.intel.com, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, a-bhatia1@ti.com, dri-devel@lists.freedesktop.org References: <20240530092930.434026-2-j-choudhary@ti.com> Content-Language: en-US, en-AU X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng In-Reply-To: <20240530092930.434026-2-j-choudhary@ti.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Hi, On 5/30/24 17:29, 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 move the mode_valid hook to drm_bridge_funcs with proper clock > checks for maximum and minimum pixel clock supported by the bridge. > > Signed-off-by: Jayesh Choudhary Acked-by: Sui Jingfeng > --- > drivers/gpu/drm/bridge/sii902x.c | 32 +++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c > index 2fbeda9025bf..6a6055a4ccf9 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 > + This bridge can drive 2560x1080@75Hz monitor(LG 34BL650), the pixel clock can up to 181250 kHz. I remember that I have tested the native mode with LS2K1000 SoC, and it do works in practice. And there are also has 320x240 panels, maybe it's also usuable with this HDMI transmitter Well, the datasheet mentioned that it supports up to 165 MHz dual-edge and single-edge modes. So I'm not against your patch, just mention it to let you know. > struct sii902x { > struct i2c_client *i2c; > struct regmap *regmap; > @@ -310,17 +318,8 @@ static int sii902x_get_modes(struct drm_connector *connector) > return num; > } > > -static enum drm_mode_status sii902x_mode_valid(struct drm_connector *connector, > - struct drm_display_mode *mode) > -{ > - /* TODO: check mode */ > - > - return MODE_OK; > -} > - > static const struct drm_connector_helper_funcs sii902x_connector_helper_funcs = { > .get_modes = sii902x_get_modes, > - .mode_valid = sii902x_mode_valid, > }; > > static void sii902x_bridge_disable(struct drm_bridge *bridge) > @@ -504,6 +503,20 @@ static int sii902x_bridge_atomic_check(struct drm_bridge *bridge, > return 0; > } > > +static enum drm_mode_status > +sii902x_bridge_mode_valid(struct drm_bridge *bridge, > + const struct drm_display_info *info, > + 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 const struct drm_bridge_funcs sii902x_bridge_funcs = { > .attach = sii902x_bridge_attach, > .mode_set = sii902x_bridge_mode_set, > @@ -516,6 +529,7 @@ static const struct drm_bridge_funcs sii902x_bridge_funcs = { > .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, > .atomic_get_input_bus_fmts = sii902x_bridge_atomic_get_input_bus_fmts, > .atomic_check = sii902x_bridge_atomic_check, > + .mode_valid = sii902x_bridge_mode_valid, > }; > > static int sii902x_mute(struct sii902x *sii902x, bool mute) -- Best regards Sui