Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp398077rdb; Fri, 17 Nov 2023 01:52:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAtUa/u4wmpTVga4GavpogCuV17G5T4eVZmC9a72gU2zV0Cop118Qa4uSwckPRV7+vEF8q X-Received: by 2002:a17:90b:38d2:b0:282:e109:109 with SMTP id nn18-20020a17090b38d200b00282e1090109mr17675241pjb.47.1700214765243; Fri, 17 Nov 2023 01:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700214765; cv=none; d=google.com; s=arc-20160816; b=p4XR5q3n9byF1xQOsoC53TXuduF0qi44DV5KTD2V9bQYmREp1FGnkLKWlmf06vQUXp OADL7t2sGw6O6JolV00HBd1MjY5aK1B5UVwxbhm4/S7TWIBP0LrXHqT99/gCJPDcL+3o VIACBK1FR/BLYDD4DPbzFxybKAinLSO1BpvTMlzC1xo0livzvR4lC2h5ZKcpsz8ueilr NJ2xG81lZo7Nso+6MyS80ZOZsWHqwDwFsecGPmSF1ar+WxPR8cEjCrbgPrs8cL6m3+0J GAfoiTeK1l2aTAjM/vE+rSmRCb5k9qRrt3BsM8nRRFMJdtvGPmjdI10+QZihlTv3Wr3z VibQ== 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=KNXAgJ7lfggf0Jn2VLSwjN5L1OMtbk29I5XnCkUKsP8=; fh=85CJ5sG8rJZTcyRVXK1+Pdg16foFZDxOpgfDbRWzy7s=; b=nu9oYDTDCoxjrMZMyZ8PU/uW4pTI8lFvpku+3IUOfzoC/ulCN/7VKuRHGHstBhtdbW qgZRj4uWZd2udCRLxb6ROaBWErQ+9mCt+8BnHwl+Hw8x9kBGJ+p6A9uZrt9FOEdLDFP7 ujHwF6WOLrxPnwt/QJG1G9fjf6jpTN62uQXEZ7Ks6OUV8DRgBU+ZvSoNJT+owv2T/q94 3B0+nCZmS1rI1Z2qsVfKBvg+8rFkI4vBV7T1NtyeqcePPROcS5QTwhvQhObsxDAmrrGM sVwmpQZGcBWQ/dEqO8wT7cZtNV9B39F2KBlvDdn7O1YJqP7phe3rXXuELvYD4J+sZSw2 XV4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WdGxFaiU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id x17-20020a17090aca1100b0027cd01b6cb0si1612461pjt.125.2023.11.17.01.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 01:52:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WdGxFaiU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5226882909AC; Fri, 17 Nov 2023 01:52:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345734AbjKQJwa (ORCPT + 99 others); Fri, 17 Nov 2023 04:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbjKQJwa (ORCPT ); Fri, 17 Nov 2023 04:52:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2CDAF for ; Fri, 17 Nov 2023 01:52:26 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5940C433C8; Fri, 17 Nov 2023 09:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700214746; bh=e2z5EMr6FCn2C9zht/MhpP6zwsy6ds3cEVm9SxjeNFQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WdGxFaiUbS/AXp/E94wu62V9kYbiyG4i6SfuldSKbgMqt/WmXPOojCotxb0ygNJDk 7s4eSOU+bxIB2/NMGiHO0SBQTHYEXvZDiDi43EQmmBJUv1Km7JrayqoTrAmr0N9jk8 ZGnq0R+ksber/D9G5ZjQwjkNR5lkC38Yv68cFHeLoet8b/4+Tsp2mMF762CeJZ4pn/ L3kb0cIc5N/htVl0Y1LJ0xwi9KIdaY79Rffm7rh3FOmeucReC0va7D207bkN/VYSwx zY9eCM8zwc4rlyHZ3nVDM3Uc17NcD5LaDIj3PbpBq6VRX03OfLLUZz6Mupbl0NfVFg udyJ1x2mpTOaw== Date: Fri, 17 Nov 2023 10:52:23 +0100 From: Maxime Ripard To: Sui Jingfeng Cc: Dmitry Baryshkov , Phong LE , Neil Armstrong , Sui Jingfeng , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart , Thomas Zimmermann Subject: Re: [PATCH 8/8] drm/bridge: it66121: Allow link this driver as a lib Message-ID: References: <20231114150130.497915-1-sui.jingfeng@linux.dev> <20231114150130.497915-9-sui.jingfeng@linux.dev> <1b59d647-c345-4260-b07b-22abb70ae17a@linux.dev> <7b85d057-3d66-435a-a657-dd69067b6bef@linux.dev> <61f1dc2f-84f8-4f04-8348-7a4470a1276c@linux.dev> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="y4yamxv4wyjgt2qh" Content-Disposition: inline In-Reply-To: <61f1dc2f-84f8-4f04-8348-7a4470a1276c@linux.dev> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, 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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 01:52:42 -0800 (PST) --y4yamxv4wyjgt2qh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 17, 2023 at 01:18:49AM +0800, Sui Jingfeng wrote: >=20 > On 2023/11/16 23:23, Dmitry Baryshkov wrote: > > On Thu, 16 Nov 2023 at 14:08, Sui Jingfeng wro= te: > > >=20 > > > On 2023/11/16 19:53, Sui Jingfeng wrote: > > > > Hi, > > > >=20 > > > >=20 > > > > On 2023/11/16 19:29, Dmitry Baryshkov wrote: > > > > > On Thu, 16 Nov 2023 at 13:18, Sui Jingfeng > > > > > wrote: > > > > > > Hi, > > > > > >=20 > > > > > >=20 > > > > > > On 2023/11/15 00:30, Dmitry Baryshkov wrote: > > > > > > > > + > > > > > > > > + ctx->connector =3D connector; > > > > > > > > + } > > > > > > > >=20 > > > > > > > > if (ctx->info->id =3D=3D ID_IT66121) { > > > > > > > > ret =3D regmap_write_bits(ctx->regmap, > > > > > > > > IT66121_CLK_BANK_REG, > > > > > > > > @@ -1632,16 +1651,13 @@ static const char * const > > > > > > > > it66121_supplies[] =3D { > > > > > > > > "vcn33", "vcn18", "vrf12" > > > > > > > > }; > > > > > > > >=20 > > > > > > > > -static int it66121_probe(struct i2c_client *client) > > > > > > > > +int it66121_create_bridge(struct i2c_client *client, bool > > > > > > > > of_support, > > > > > > > > + bool hpd_support, bool audio_supp= ort, > > > > > > > > + struct drm_bridge **bridge) > > > > > > > > { > > > > > > > > + struct device *dev =3D &client->dev; > > > > > > > > int ret; > > > > > > > > struct it66121_ctx *ctx; > > > > > > > > - struct device *dev =3D &client->dev; > > > > > > > > - > > > > > > > > - if (!i2c_check_functionality(client->adapter, > > > > > > > > I2C_FUNC_I2C)) { > > > > > > > > - dev_err(dev, "I2C check functionality faile= d.\n"); > > > > > > > > - return -ENXIO; > > > > > > > > - } > > > > > > > >=20 > > > > > > > > ctx =3D devm_kzalloc(dev, sizeof(*ctx), GFP_KERN= EL); > > > > > > > > if (!ctx) > > > > > > > > @@ -1649,24 +1665,19 @@ static int it66121_probe(struct i2c= _client > > > > > > > > *client) > > > > > > > >=20 > > > > > > > > ctx->dev =3D dev; > > > > > > > > ctx->client =3D client; > > > > > > > > - ctx->info =3D i2c_get_match_data(client); > > > > > > > > - > > > > > > > > - ret =3D it66121_of_read_bus_width(dev, &ctx->bus_wi= dth); > > > > > > > > - if (ret) > > > > > > > > - return ret; > > > > > > > > - > > > > > > > > - ret =3D it66121_of_get_next_bridge(dev, &ctx->next_= bridge); > > > > > > > > - if (ret) > > > > > > > > - return ret; > > > > > > > > - > > > > > > > > - i2c_set_clientdata(client, ctx); > > > > > > > > mutex_init(&ctx->lock); > > > > > > > >=20 > > > > > > > > - ret =3D devm_regulator_bulk_get_enable(dev, > > > > > > > > ARRAY_SIZE(it66121_supplies), > > > > > > > > - it66121_supplies); > > > > > > > > - if (ret) { > > > > > > > > - dev_err(dev, "Failed to enable power suppli= es\n"); > > > > > > > > - return ret; > > > > > > > > + if (of_support) { > > > > > > > > + ret =3D it66121_of_read_bus_width(dev, > > > > > > > > &ctx->bus_width); > > > > > > > > + if (ret) > > > > > > > > + return ret; > > > > > > > > + > > > > > > > > + ret =3D it66121_of_get_next_bridge(dev, > > > > > > > > &ctx->next_bridge); > > > > > > > > + if (ret) > > > > > > > > + return ret; > > > > > > > > + } else { > > > > > > > > + ctx->bus_width =3D 24; > > > > > > > > + ctx->next_bridge =3D NULL; > > > > > > > > } > > > > > > > A better alternative would be to turn OF calls into fwnode ca= lls and > > > > > > > to populate the fwnode properties. See > > > > > > > drivers/platform/x86/intel/chtwc_int33fe.c for example. > > > > > > Honestly, I don't want to leave any scratch(breadcrumbs). > > > > > > I'm worries about that turn OF calls into fwnode calls will lea= ve > > > > > > something unwanted. > > > > > >=20 > > > > > > Because I am not sure if fwnode calls will make sense in the DT > > > > > > world, while my patch > > > > > > *still* be useful in the DT world. > > > > > fwnode calls work for both DT and non-DT cases. In the DT case th= ey > > > > > work with DT nodes and properties. In the non-DT case, they work = with > > > > > manually populated properties. > > > > >=20 > > > > > > Because the newly introduced it66121_create_bridge() > > > > > > function is a core. I think It's better leave this task to a mo= re > > > > > > advance programmer. > > > > > > if there have use case. It can be introduced at a latter time, > > > > > > probably parallel with > > > > > > the DT. > > > > > >=20 > > > > > > I think DT and/or ACPI is best for integrated devices, but it66= 121 > > > > > > display bridges is > > > > > > a i2c slave device. Personally, I think slave device shouldn't = be > > > > > > standalone. I'm more > > > > > > prefer to turn this driver to support hot-plug, even remove the > > > > > > device on the run time > > > > > > freely when detach and allow reattach. Like the I2C EEPROM devi= ce in > > > > > > the monitor (which > > > > > > contains the EDID, with I2C slave address 0x50). The I2C EEPROM > > > > > > device *also* don't has > > > > > > a corresponding struct device representation in linux kernel. > > > > > It has. See i2c_client::dev. > > > > No, what I mean is that there don't have a device driver for > > > > monitor(display) hardware entity. > > > > And the drm_do_probe_ddc_edid() is the static linked driver, which = is > > > > similar with the idea > > > > this series want to express. > > Because the monitor is not a part of the display pipeline. > >=20 > I think the monitor *is definitely* part of the display pipeline, and it > is the most important part of the entire display pipeline. >=20 > 1) >=20 > DPMS, self-refreshing, display timings, resolutions supported, HDR, DSC, > gsync and freesync etc can be part of whole mode-set. Please consider > what the various ->mode_valid() and -> the atomic_check() are for? >=20 > 2) >=20 > If the monitor is not a part of the display pipeline, then the various > display panels hardware should also not be part of the display pipeline. > Because they are all belong to display category. > the monitor =3D panel + panel drive IC(such as RTD2281CL, HT1622, ssd130x= ). To expand further on that, I guess one of the key difference is that you don't really expect to interact with the EEPROM, you'll only read it, which is fairly different from your bridge. And if someone wanted to instatiate nvmem devices for the various EEPROMs in the monitor, I would very much welcome that change. Maxime --y4yamxv4wyjgt2qh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZVc31wAKCRDj7w1vZxhR xYZpAQDC+NBYUdhGqkywRq2u3ZurPDRJLEi6r6pPCyo4kOgR1wD/YaNMcJ0ZKaji XNixAiiJmE+scOKOyWwoXI53pUQcqQ8= =T/V1 -----END PGP SIGNATURE----- --y4yamxv4wyjgt2qh--