From: Andrzej Hajda <a.hajda@samsung.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
dri-devel@lists.freedesktop.org
Cc: kernel@collabora.com, "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Dave Airlie" <airlied@redhat.com>,
"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <maxime.ripard@bootlin.com>,
"Sean Paul" <sean@poorly.run>, "Inki Dae" <inki.dae@samsung.com>,
"Seung-Woo Kim" <sw0312.kim@samsung.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3 01/22] drm: Include ddc adapter pointer in struct drm_connector
Date: Fri, 5 Jul 2019 11:44:52 +0200 [thread overview]
Message-ID: <ef458f71-d061-4a8f-c53c-aa325b577d42@samsung.com> (raw)
In-Reply-To: <9e65f3c0-941d-d04c-5745-6b3a2965b990@suse.de>
On 01.07.2019 16:41, Thomas Zimmermann wrote:
> Hi
>
> Am 01.07.19 um 15:27 schrieb Andrzej Pietrasiewicz:
>> Hi Thomas,
>>
>> Thank you for your comments. Please see inline.
>>
>> W dniu 30.06.2019 o 10:12, Thomas Zimmermann pisze:
>>> Hi
>>>
>>> I like the idea, but would prefer a more structured approach.
>>>
>>> Setting connector->ddc before calling drm_sysfs_connector_add() seems
>>> error prone. The dependency is not really clear from the code or
>>> interfaces.
>>>
>>> The other thing is that drivers I mostly work on, ast and mgag200, have
>>> code like this:
>>>
>>> struct ast_i2c_chan {
>>> struct i2c_adapter adapter;
>>> struct drm_device *dev;
>>> struct i2c_algo_bit_data bit;
>>> };
>>>
>>> struct ast_connector {
>>> struct drm_connector base;
>>> struct ast_i2c_chan *i2c;
>>> };
>>>
>>> It already encodes the connection between connector and ddc adapter.
>>>
>>> I suggest to introduce struct drm_i2c_adapter
>>>
>>> struct drm_i2c_adapter {
>>> struct i2c_adapter base;
>>> struct drm_connector *connector;
>>> };
>>>
>>> and convert drivers over to it. Ast would look like this:
>>>
>>> struct ast_i2c_chan {
>>> struct drm_i2c_adapter adapter;
>>> struct i2c_algo_bit_data bit;
>>> };
>>>
>> There are few flavors of these drivers. In some of them
>> the i2c_adapter for ddc is allocated and initialized by
>> the driver, which must provide a place in memory to hold
>> the adapter. ast is an example of this approach.
>>
>> But there are others, such as for example exynos_hdmi.c.
>> It gets its ddc adapter with of_find_i2c_adapter_by_node()
>> and merely stores a pointer to it, while not managing the
>> memory needed to hold the i2c_adapter.
> I see.
>
>> Do you have any idea how to accommodate these various
>> flavors of drivers in the scheme you propose?
> Something like
>
> struct drm_i2c_adapter {
> struct i2c_adapter *adapter;
> struct drm_connector *connector;
> };
>
> with adapter either being allocated dynamically or acquired via
> of_find_i2c_adapter_by_node(); with separate init and finish functions
> for each variant. But it looks like over-abstraction to me. Without
> prototyping the idea, I cannot say if it's worth the effort.
>
> For something more simple, maybe just have a function to attach an i2c
> adapter to a connector:
>
> drm_connector_attach_i2c_adapter(connector, i2c_adapter)
>
> which sets the connector's ddc pointer and creates the sysfs entry if
> the connector's entry is already present.
I am not sure if such function is really necessary. Assigning ddc field
before connector registration seems to be much simpler and quite
standard - many fields are initialized this way.
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
--
Regards
Andrzej
> Best regards
> Thomas
>
>> Andrzej
>>
>>
prev parent reply other threads:[~2019-07-05 9:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 9:46 [PATCH 0/2] Associate ddc adapters with connectors Andrzej Pietrasiewicz
2019-06-25 9:46 ` [PATCH 1/2] drm: Include ddc adapter pointer in struct drm_connector Andrzej Pietrasiewicz
2019-06-25 9:46 ` [PATCH 2/2] drm/exynos: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-06-25 10:03 ` [PATCH 0/2] Associate ddc adapters with connectors Russell King - ARM Linux admin
2019-06-25 10:14 ` Andrzej Pietrasiewicz
2019-06-25 10:16 ` Russell King - ARM Linux admin
2019-06-25 10:24 ` [PATCH v2 " Andrzej Pietrasiewicz
2019-06-25 10:24 ` [PATCH v2 1/2] drm: Include ddc adapter pointer in struct drm_connector Andrzej Pietrasiewicz
2019-06-25 14:21 ` Daniel Vetter
2019-06-25 10:24 ` [PATCH v2 2/2] drm/exynos: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-06-25 13:36 ` [PATCH 0/2] Associate ddc adapters with connectors Emil Velikov
2019-06-25 14:07 ` Daniel Vetter
2019-06-25 14:10 ` Russell King - ARM Linux admin
2019-06-25 14:20 ` Daniel Vetter
2019-06-26 6:50 ` Andrzej Pietrasiewicz
[not found] ` <cover.1561735433.git.andrzej.p@collabora.com>
[not found] ` <d6381c020ea1c848a7044d830bdb0ec9663d1619.1561735433.git.andrzej.p@collabora.com>
[not found] ` <9b03d145-ec50-927c-55a8-dff1cd51d655@suse.de>
[not found] ` <cf1984e4-50af-302d-ef67-9ad530118c29@collabora.com>
[not found] ` <CGME20190701144119epcas1p211ec60b63f3c6ae02392e2ae67f1a4ba@epcas1p2.samsung.com>
[not found] ` <9e65f3c0-941d-d04c-5745-6b3a2965b990@suse.de>
2019-07-05 9:44 ` Andrzej Hajda [this message]
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=ef458f71-d061-4a8f-c53c-aa325b577d42@samsung.com \
--to=a.hajda@samsung.com \
--cc=David1.Zhou@amd.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=andrzej.p@collabora.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=kernel@collabora.com \
--cc=kernel@pengutronix.de \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=p.zabel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=sean@poorly.run \
--cc=shawnguo@kernel.org \
--cc=sw0312.kim@samsung.com \
--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
all inboxes | Powered by JetHome®