[PATCH] drm: Add downclock quirk for Samsung LTN121AT10-301

Alex Deucher alexdeucher at gmail.com
Tue May 29 14:23:49 PDT 2012


On Tue, May 29, 2012 at 4:33 PM, Sean Paul <seanpaul at chromium.org> wrote:
> On Tue, May 29, 2012 at 10:43 AM, Alex Deucher <alexdeucher at gmail.com> wrote:
>> On Mon, May 28, 2012 at 1:20 PM, Sean Paul <seanpaul at chromium.org> wrote:
>>> On Wed, Jan 18, 2012 at 10:06 AM, Sean Paul <seanpaul at chromium.org> wrote:
>>>> Add a quirk which adds a new downclocked mode to the EDID of Samsung
>>>> LTN121AT10-301 panels. This allows the intel driver to apply downclocking
>>>> and save power.
>>>>
>>>
>>> Is there any feedback on the patch? I'd like to get it merged if possible.
>>
>> This seems like something that should be specific to the intel driver
>> rather than risking problems with this monitor on other drivers.
>>
>
> Thanks for the feedback, Alex. I had originally put this in the intel
> driver, but moved it since it was a nasty hack. Furthermore, it was
> less obvious that the mode was available, since it was hidden to all
> layers above i915. The panel is just fine with the lower refresh rate,
> so it shouldn't have any issues with other drivers.

Well it doesn't really seem like a quirk per se, the monitor works
just fine without it.  You are basically just adding an arbitrary new
user defined mode that happens to work on the monitor.  Seems like you
should just be adding the mode with xrandr or equivalent.

Alex

>
> Sean
>
>
>> Alex
>>
>>>
>>> Thanks,
>>>
>>> Sean
>>>
>>>> Signed-off-by: Sean Paul <seanpaul at chromium.org>
>>>> ---
>>>>  drivers/gpu/drm/drm_edid.c |   47 ++++++++++++++++++++++++++++++++++++++++++++
>>>>  1 files changed, 47 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>>>> index 7425e5c..e2e3d9b 100644
>>>> --- a/drivers/gpu/drm/drm_edid.c
>>>> +++ b/drivers/gpu/drm/drm_edid.c
>>>> @@ -65,6 +65,8 @@
>>>>  #define EDID_QUIRK_FIRST_DETAILED_PREFERRED    (1 << 5)
>>>>  /* use +hsync +vsync for detailed mode */
>>>>  #define EDID_QUIRK_DETAILED_SYNC_PP            (1 << 6)
>>>> +/* the panel supports, but does not include a lower clocked mode for lvds */
>>>> +#define EDID_QUIRK_ADD_DOWNCLOCK_MODE          (1 << 7)
>>>>
>>>>  struct detailed_mode_closure {
>>>>        struct drm_connector *connector;
>>>> @@ -119,6 +121,18 @@ static struct edid_quirk {
>>>>        /* Samsung SyncMaster 22[5-6]BW */
>>>>        { "SAM", 596, EDID_QUIRK_PREFER_LARGE_60 },
>>>>        { "SAM", 638, EDID_QUIRK_PREFER_LARGE_60 },
>>>> +
>>>> +       /* Samsung TFT-LCD LTN121AT10-301 */
>>>> +       { "SEC", 0x3142, EDID_QUIRK_ADD_DOWNCLOCK_MODE },
>>>> +};
>>>> +
>>>> +static struct downclock_rate {
>>>> +       char *vendor;
>>>> +       int product_id;
>>>> +       int clock;
>>>> +} downclock_rate_list[] = {
>>>> +       /* Samsung TFT-LCD LTN121AT10-301 */
>>>> +       { "SEC", 0x3142, 56428},
>>>>  };
>>>>
>>>>  /*** DDC fetch and block validation ***/
>>>> @@ -481,6 +495,36 @@ static void edid_fixup_preferred(struct drm_connector *connector,
>>>>        preferred_mode->type |= DRM_MODE_TYPE_PREFERRED;
>>>>  }
>>>>
>>>> +static int edid_add_downclock(struct drm_connector *connector,
>>>> +                              struct edid *edid)
>>>> +{
>>>> +       struct drm_display_mode *t, *cur_mode, *downclock_mode;
>>>> +       struct downclock_rate *rate;
>>>> +       int i;
>>>> +
>>>> +       for (i = 0; i < ARRAY_SIZE(downclock_rate_list); i++) {
>>>> +               rate = &downclock_rate_list[i];
>>>> +
>>>> +               if (edid_vendor(edid, rate->vendor) &&
>>>> +                   (EDID_PRODUCT_ID(edid) == rate->product_id))
>>>> +                       break;
>>>> +       }
>>>> +       if (i == ARRAY_SIZE(downclock_rate_list))
>>>> +               return 0;
>>>> +
>>>> +       list_for_each_entry_safe(cur_mode, t, &connector->probed_modes, head) {
>>>> +               if (!(cur_mode->type & DRM_MODE_TYPE_PREFERRED))
>>>> +                       continue;
>>>> +
>>>> +               downclock_mode = drm_mode_duplicate(connector->dev, cur_mode);
>>>> +               downclock_mode->type &= ~DRM_MODE_TYPE_PREFERRED;
>>>> +               downclock_mode->clock = rate->clock;
>>>> +               drm_mode_probed_add(connector, downclock_mode);
>>>> +               return 1;
>>>> +       }
>>>> +       return 0;
>>>> +}
>>>> +
>>>>  struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
>>>>                                           int hsize, int vsize, int fresh)
>>>>  {
>>>> @@ -1554,6 +1598,9 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
>>>>        if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
>>>>                edid_fixup_preferred(connector, quirks);
>>>>
>>>> +       if (quirks & EDID_QUIRK_ADD_DOWNCLOCK_MODE)
>>>> +               num_modes += edid_add_downclock(connector, edid);
>>>> +
>>>>        drm_add_display_info(edid, &connector->display_info);
>>>>
>>>>        return num_modes;
>>>> --
>>>> 1.7.7.3
>>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list