From: Sui Jingfeng <sui.jingfeng@linux.dev>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Phong LE <ple@baylibre.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Maxime Ripard <mripard@kernel.org>,
Sui Jingfeng <suijingfeng@loongson.cn>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: Re: [PATCH 8/8] drm/bridge: it66121: Allow link this driver as a lib
Date: Thu, 16 Nov 2023 19:18:18 +0800 [thread overview]
Message-ID: <1b59d647-c345-4260-b07b-22abb70ae17a@linux.dev> (raw)
In-Reply-To: <CAA8EJprQq3aDhzE+yKGZ2-nsuHWcptzMvApsyOi9D63PgeiZ3w@mail.gmail.com>
Hi,
On 2023/11/15 00:30, Dmitry Baryshkov wrote:
>> +
>> + ctx->connector = connector;
>> + }
>>
>> if (ctx->info->id == ID_IT66121) {
>> ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
>> @@ -1632,16 +1651,13 @@ static const char * const it66121_supplies[] = {
>> "vcn33", "vcn18", "vrf12"
>> };
>>
>> -static int it66121_probe(struct i2c_client *client)
>> +int it66121_create_bridge(struct i2c_client *client, bool of_support,
>> + bool hpd_support, bool audio_support,
>> + struct drm_bridge **bridge)
>> {
>> + struct device *dev = &client->dev;
>> int ret;
>> struct it66121_ctx *ctx;
>> - struct device *dev = &client->dev;
>> -
>> - if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
>> - dev_err(dev, "I2C check functionality failed.\n");
>> - return -ENXIO;
>> - }
>>
>> ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
>> if (!ctx)
>> @@ -1649,24 +1665,19 @@ static int it66121_probe(struct i2c_client *client)
>>
>> ctx->dev = dev;
>> ctx->client = client;
>> - ctx->info = i2c_get_match_data(client);
>> -
>> - ret = it66121_of_read_bus_width(dev, &ctx->bus_width);
>> - if (ret)
>> - return ret;
>> -
>> - ret = it66121_of_get_next_bridge(dev, &ctx->next_bridge);
>> - if (ret)
>> - return ret;
>> -
>> - i2c_set_clientdata(client, ctx);
>> mutex_init(&ctx->lock);
>>
>> - ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(it66121_supplies),
>> - it66121_supplies);
>> - if (ret) {
>> - dev_err(dev, "Failed to enable power supplies\n");
>> - return ret;
>> + if (of_support) {
>> + ret = it66121_of_read_bus_width(dev, &ctx->bus_width);
>> + if (ret)
>> + return ret;
>> +
>> + ret = it66121_of_get_next_bridge(dev, &ctx->next_bridge);
>> + if (ret)
>> + return ret;
>> + } else {
>> + ctx->bus_width = 24;
>> + ctx->next_bridge = NULL;
>> }
> A better alternative would be to turn OF calls into fwnode calls 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 leave something unwanted.
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. Because the newly introduced it66121_create_bridge()
function is a core. I think It's better leave this task to a more advance programmer.
if there have use case. It can be introduced at a latter time, probably parallel with
the DT.
I think DT and/or ACPI is best for integrated devices, but it66121 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 device 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.
so I still think It is best to make this drivers functional as a static lib, but I want
to hear you to say more. Why it would be a *better* alternative to turn OF calls into
fwnode calls? what are the potential benefits?
next prev parent reply other threads:[~2023-11-16 11:18 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 15:01 [PATCH 0/8] Allow link the it66121 display bridge driver as a lib Sui Jingfeng
2023-11-14 15:01 ` [PATCH 1/8] drm/bridge: it66121: Use dev replace ctx->dev in the it66121_probe() Sui Jingfeng
2023-11-14 16:01 ` Dmitry Baryshkov
2023-11-14 15:01 ` [PATCH 2/8] drm/bridge: it66121: Add bridge_to_it66121() helper and use it Sui Jingfeng
2023-11-14 16:01 ` Dmitry Baryshkov
2023-11-14 15:01 ` [PATCH 3/8] drm/bridge: it66121: Add a helper function to read bus width Sui Jingfeng
2023-11-14 16:03 ` Dmitry Baryshkov
2023-11-14 15:01 ` [PATCH 4/8] drm/bridge: it66121: Add a helper function to get the next bridge Sui Jingfeng
2023-11-14 16:05 ` Dmitry Baryshkov
2023-11-23 5:25 ` Sui Jingfeng
2023-11-23 7:54 ` Dmitry Baryshkov
2023-11-14 15:01 ` [PATCH 5/8] drm/bridge: it66121: Add a helper function to read chip id Sui Jingfeng
2023-11-14 16:06 ` Dmitry Baryshkov
2023-11-16 12:18 ` Sui Jingfeng
2023-11-16 13:00 ` Dmitry Baryshkov
2023-11-16 18:29 ` Sui Jingfeng
2023-11-16 22:00 ` Dmitry Baryshkov
2023-11-23 5:37 ` Sui Jingfeng
2023-11-23 7:48 ` Dmitry Baryshkov
2023-11-23 13:03 ` Sui Jingfeng
2023-11-14 15:01 ` [PATCH 6/8] drm/bridge: it66121: Add a helper to initialize the DRM bridge structure Sui Jingfeng
2023-11-14 16:10 ` Dmitry Baryshkov
2023-11-14 15:01 ` [PATCH 7/8] drm/bridge: it66121: Add another implementation for getting match data Sui Jingfeng
2023-11-14 16:00 ` Dmitry Baryshkov
2023-11-14 15:01 ` [PATCH 8/8] drm/bridge: it66121: Allow link this driver as a lib Sui Jingfeng
2023-11-14 16:30 ` Dmitry Baryshkov
2023-11-16 9:14 ` Sui Jingfeng
2023-11-16 9:30 ` Dmitry Baryshkov
2023-11-16 10:12 ` Sui Jingfeng
2023-11-16 11:19 ` Dmitry Baryshkov
2023-11-23 5:05 ` Sui Jingfeng
2023-11-23 8:08 ` Dmitry Baryshkov
2023-11-23 13:39 ` Neil Armstrong
2023-11-23 16:20 ` Sui Jingfeng
2023-11-23 15:41 ` Sui Jingfeng
2023-11-23 16:06 ` Dmitry Baryshkov
2023-11-23 16:29 ` Sui Jingfeng
2023-11-23 17:04 ` Sui Jingfeng
2023-11-23 17:39 ` Dmitry Baryshkov
2023-11-23 17:52 ` Sui Jingfeng
2023-11-24 7:38 ` Maxime Ripard
2023-11-24 7:51 ` Sui Jingfeng
2023-11-24 8:13 ` Maxime Ripard
2023-11-24 8:48 ` Sui Jingfeng
2023-11-25 2:30 ` Sui Jingfeng
2023-11-16 10:29 ` Sui Jingfeng
2023-11-16 11:11 ` Dmitry Baryshkov
2023-11-16 11:15 ` Jani Nikula
2023-11-16 11:18 ` Sui Jingfeng [this message]
2023-11-16 11:29 ` Dmitry Baryshkov
2023-11-16 11:53 ` Sui Jingfeng
2023-11-16 12:07 ` Sui Jingfeng
2023-11-16 15:23 ` Dmitry Baryshkov
2023-11-16 17:18 ` Sui Jingfeng
2023-11-17 9:52 ` Maxime Ripard
2023-11-17 4:24 ` Sui Jingfeng
2023-11-17 9:03 ` Dmitry Baryshkov
2023-11-17 17:14 ` Sui Jingfeng
2023-11-20 8:23 ` Neil Armstrong
2023-11-17 17:35 ` Sui Jingfeng
2023-11-20 10:06 ` Dmitry Baryshkov
2023-11-17 12:13 ` Maxime Ripard
2023-11-15 13:02 ` kernel test robot
2023-11-20 9:08 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b59d647-c345-4260-b07b-22abb70ae17a@linux.dev \
--to=sui.jingfeng@linux.dev \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=ple@baylibre.com \
--cc=suijingfeng@loongson.cn \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox