All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH v2 2/5] drm/ast: Fix updating the connector's EDID property
Date: Tue, 7 Jun 2022 10:13:08 +0200	[thread overview]
Message-ID: <9a6c51a1-6634-fd1b-3451-9d0cd0a68e47@suse.de> (raw)
In-Reply-To: <CAMeQTsbfYsqM5V_HT6=SsqJ-Xiegz7R8ZDRdCV=GDDHXJbNBYQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4605 bytes --]

Hi

Am 02.06.22 um 09:24 schrieb Patrik Jakobsson:
> On Tue, May 31, 2022 at 1:15 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> Read the display modes from the connectors DDC helper, which also
>> updates the connector's EDID property. The code for the connector's
>> .get_modes helper is now shared between VGA and SIL164.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>   drivers/gpu/drm/ast/ast_mode.c | 57 ++--------------------------------
>>   1 file changed, 2 insertions(+), 55 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
>> index e19dd2f9b3ce..4ff8ec1c8931 100644
>> --- a/drivers/gpu/drm/ast/ast_mode.c
>> +++ b/drivers/gpu/drm/ast/ast_mode.c
>> @@ -1302,37 +1302,19 @@ static int ast_crtc_init(struct drm_device *dev)
>>
>>   static int ast_vga_connector_helper_get_modes(struct drm_connector *connector)
> 
> Since this function is now generic you could consider removing _vga
> from the name.

It's not fully generic. There are DisplayPort functions that do their 
own thing.

 From how I understand the driver's source code, there's a hardware 
setting to switch between either analog VGA or SIL164-based DVI. Both 
use the same registers. So the get_modes function can be shared.

Best regards
Thomas

> 
> Either way:
> Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
> 
> 
>>   {
>> -       struct ast_vga_connector *ast_vga_connector = to_ast_vga_connector(connector);
>>          struct drm_device *dev = connector->dev;
>>          struct ast_private *ast = to_ast_private(dev);
>> -       struct edid *edid;
>>          int count;
>>
>> -       if (!ast_vga_connector->i2c)
>> -               goto err_drm_connector_update_edid_property;
>> -
>>          /*
>>           * Protect access to I/O registers from concurrent modesetting
>>           * by acquiring the I/O-register lock.
>>           */
>>          mutex_lock(&ast->ioregs_lock);
>> -
>> -       edid = drm_get_edid(connector, &ast_vga_connector->i2c->adapter);
>> -       if (!edid)
>> -               goto err_mutex_unlock;
>> -
>> +       count = drm_connector_helper_get_modes_from_ddc(connector);
>>          mutex_unlock(&ast->ioregs_lock);
>>
>> -       count = drm_add_edid_modes(connector, edid);
>> -       kfree(edid);
>> -
>>          return count;
>> -
>> -err_mutex_unlock:
>> -       mutex_unlock(&ast->ioregs_lock);
>> -err_drm_connector_update_edid_property:
>> -       drm_connector_update_edid_property(connector, NULL);
>> -       return 0;
>>   }
>>
>>   static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = {
>> @@ -1406,43 +1388,8 @@ static int ast_vga_output_init(struct ast_private *ast)
>>    * SIL164 Connector
>>    */
>>
>> -static int ast_sil164_connector_helper_get_modes(struct drm_connector *connector)
>> -{
>> -       struct ast_sil164_connector *ast_sil164_connector = to_ast_sil164_connector(connector);
>> -       struct drm_device *dev = connector->dev;
>> -       struct ast_private *ast = to_ast_private(dev);
>> -       struct edid *edid;
>> -       int count;
>> -
>> -       if (!ast_sil164_connector->i2c)
>> -               goto err_drm_connector_update_edid_property;
>> -
>> -       /*
>> -        * Protect access to I/O registers from concurrent modesetting
>> -        * by acquiring the I/O-register lock.
>> -        */
>> -       mutex_lock(&ast->ioregs_lock);
>> -
>> -       edid = drm_get_edid(connector, &ast_sil164_connector->i2c->adapter);
>> -       if (!edid)
>> -               goto err_mutex_unlock;
>> -
>> -       mutex_unlock(&ast->ioregs_lock);
>> -
>> -       count = drm_add_edid_modes(connector, edid);
>> -       kfree(edid);
>> -
>> -       return count;
>> -
>> -err_mutex_unlock:
>> -       mutex_unlock(&ast->ioregs_lock);
>> -err_drm_connector_update_edid_property:
>> -       drm_connector_update_edid_property(connector, NULL);
>> -       return 0;
>> -}
>> -
>>   static const struct drm_connector_helper_funcs ast_sil164_connector_helper_funcs = {
>> -       .get_modes = ast_sil164_connector_helper_get_modes,
>> +       .get_modes = ast_vga_connector_helper_get_modes, // same as VGA connector
>>   };
>>
>>   static const struct drm_connector_funcs ast_sil164_connector_funcs = {
>> --
>> 2.36.1
>>

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2022-06-07  8:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 11:14 [PATCH v2 0/5] drm/ast: Connector cleanups and polling Thomas Zimmermann
2022-05-31 11:14 ` [PATCH v2 1/5] drm/ast: Support multiple outputs Thomas Zimmermann
2022-06-02  7:24   ` Patrik Jakobsson
2022-06-02 11:01     ` Thomas Zimmermann
2022-05-31 11:14 ` [PATCH v2 2/5] drm/ast: Fix updating the connector's EDID property Thomas Zimmermann
2022-06-02  7:24   ` Patrik Jakobsson
2022-06-07  8:13     ` Thomas Zimmermann [this message]
2022-06-07  9:08       ` Patrik Jakobsson
2022-05-31 11:15 ` [PATCH v2 3/5] drm/ast: Support output polling Thomas Zimmermann
2022-06-02  7:25   ` Patrik Jakobsson
2022-06-02 11:00     ` Thomas Zimmermann
2022-06-07 10:03   ` Jani Nikula
2022-06-07 10:50     ` Thomas Zimmermann
2022-05-31 11:15 ` [PATCH v2 4/5] drm/ast: Fail probing if DCC channel could not be initialized Thomas Zimmermann
2022-06-02  7:25   ` Patrik Jakobsson
2022-06-02  7:42     ` Patrik Jakobsson
2022-06-02  9:32       ` Thomas Zimmermann
2022-06-02 10:34         ` Patrik Jakobsson
2022-05-31 11:15 ` [PATCH v2 5/5] drm/ast: Remove struct ast_{vga,sil164}_connector Thomas Zimmermann
2022-06-02  7:25   ` Patrik Jakobsson
2022-05-31 11:16 ` [PATCH v2 0/5] drm/ast: Connector cleanups and polling Thomas Zimmermann

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=9a6c51a1-6634-fd1b-3451-9d0cd0a68e47@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=patrik.r.jakobsson@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.