lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 6 Feb 2013 11:01:55 -0800
From:	Olof Johansson <olof@...om.net>
To:	sw0312.kim@...sung.com
Cc:	Sean Paul <seanpaul@...omium.org>,
	Stephen Warren <swarren@...dotorg.org>,
	Tomasz Stanislawski <t.stanislaws@...sung.com>,
	"kgene.kim" <kgene.kim@...sung.com>,
	devicetree-discuss@...ts.ozlabs.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	dri-devel@...ts.freedesktop.org,
	Tomasz Figa <tomasz.figa@...il.com>,
	linux-samsung-soc@...r.kernel.org,
	Sylwester Nawrocki <sylvester.nawrocki@...il.com>,
	Olof Johansson <olofj@...omium.org>,
	linux-arm-kernel@...ts.infradead.org,
	RAHUL SHARMA <rahul.sharma@...sung.com>
Subject: Re: [PATCH v3 1/3] drm/exynos: Get HDMI version from device tree

On Tue, Feb 5, 2013 at 6:56 PM, 김승우 <sw0312.kim@...sung.com> wrote:
>
>
> On 2013년 02월 06일 09:56, Sean Paul wrote:
>> On Tue, Feb 5, 2013 at 4:42 PM, Stephen Warren <swarren@...dotorg.org> wrote:
>>> On 02/05/2013 05:37 PM, Sean Paul wrote:
>>>> On Tue, Feb 5, 2013 at 4:22 PM, Stephen Warren <swarren@...dotorg.org> wrote:
>>>>> n 02/05/2013 04:42 PM, Sean Paul wrote:
>>>>>> Use the compatible string in the device tree to determine which
>>>>>> registers/functions to use in the HDMI driver. Also changes the
>>>>>> references from v13 to 4210 and v14 to 4212 to reflect the IP
>>>>>> block version instead of the HDMI version.
>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/drm/exynos/hdmi.txt b/Documentation/devicetree/bindings/drm/exynos/hdmi.txt
>>>>>
>>>>> Binding looks sane to me.
>>>>>
>>>>>> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
>>>>>
>>>>>>  #ifdef CONFIG_OF
>>>>>>  static struct of_device_id hdmi_match_types[] = {
>>>>>>       {
>>>>>> -             .compatible = "samsung,exynos5-hdmi",
>>>>>> -             .data   = (void *)HDMI_TYPE14,
>>>>>> +             .compatible = "samsung,exynos4-hdmi",
>>>>>>       }, {
>>>>>>               /* end node */
>>>>>>       }
>>>>>
>>>>> Why not fill in all the "base" compatible values there (I think you need
>>>>> this anyway so that DTs don't all have to be compatible with
>>>>> samsung,exynos4-hdmi), with .data containing the HDMI_VER_EXYNOS*
>>>>> values, then ...
>>>>>
>>>>
>>>> At the moment, all DTs have to be compatible with exynos4-hdmi since
>>>> it provides the base for the current driver. The driver uses 4210 and
>>>> 4212 to differentiate between different register addresses and
>>>> features, but most things are just exynos4-hdmi compatible.
>>>
>>> The DT nodes should include only the compatible values that the HW is
>>> actually compatible with. If the HW isn't compatible with exynos4-hdmi,
>>> that value shouldn't be in the compatible property, but instead whatever
>>> the "base" value that the HW really is compatible with. The driver can
>>> support multiple "base" compatible values from this table.
>>>
>>
>> All devices that use this driver are compatible, at some level, with
>> exynos4-hdmi, so I think its usage is correct here.
>>
>>>>>> @@ -2218,17 +2217,18 @@ static int hdmi_probe(struct platform_device *pdev)
>>>>>
>>>>>> +
>>>>>> +     if (of_device_is_compatible(dev->of_node, "samsung,exynos4210-hdmi"))
>>>>>> +             hdata->version |= HDMI_VER_EXYNOS4210;
>>>>>> +     if (of_device_is_compatible(dev->of_node, "samsung,exynos4212-hdmi"))
>>>>>> +             hdata->version |= HDMI_VER_EXYNOS4212;
>>>>>> +     if (of_device_is_compatible(dev->of_node, "samsung,exynos5250-hdmi"))
>>>>>> +             hdata->version |= HDMI_VER_EXYNOS5250;
>>>>>
>>>>> Instead of that, do roughly:
>>>>>
>>>>>     match = of_match_device(hdmi_match_types, &pdev->dev);
>>>>>     if (match)
>>>>>         hdata->version |= (int)match->data;
>>>>>
>>>>> That way, it's all table-based. Any future additions to
>>>>> hdmi_match_types[] won't require another if statement to be added to
>>>>> probe().
>>>>
>>>> I don't think it's that easy. of_match_device returns the first match
>>>> from the device table, so I'd still need to iterate through the
>>>> matches. I could still break this out into a table, but I don't think
>>>> of_match_device is the right way to probe it.
>>>
>>> You shouldn't have to iterate over multiple matches. of_match_device()
>>> is supposed to return the match for the first entry in the compatible
>>> property, then if there was no match, move on to looking at the next
>>> entry in the compatible property, etc. In practice, I think it's still
>>> not implemented quite correctly for this, but you can make it work by
>>> putting the newest compatible value first in the match table.
>>
>> I think the only way that works is if you hardcode the compatible
>> versions in the driver, like this:
>>
>> static struct of_device_id hdmi_match_types[] = {
>>         {
>>                 .compatible = "samsung,exynos5250-hdmi",
>>                 .data = (void *)(HDMI_VER_EXYNOS5250 | HDMI_VER_EXYNOS4212);
>>         }, {
>>                 .compatible = "samsung,exynos4212-hdmi",
>>                 .data = (void *)HDMI_VER_EXYNOS4212;
>>         }, {
>>                 .compatible = "samsung,exynos4210-hdmi",
>>                 .data = (void *)HDMI_VER_EXYNOS4210;
>>         }, {
>>                 /* end node */
>>         }
>> };
>
> Actually, I can't understand why there is HDMI_VER_EXYNOS5250 because it
> is not used anywhere in your patch. I'm not sure I missed something from
> your v2 patch thread, but to me, just hdmi version or hdmi ip version
> can be used as data field of struct of_device_id as like your v2 patch
> set. and then of_match_device() can be used without | in data field.
>
> If I have missed some point from v2 thread, please let me know.


Exactly. I think that's causing some of this confusion. It'd be easier
to just leave any 5250 reference out of this patch. The _only_ place
5250 should be used now is in the 5250 dtsi file, as the most specific
compatible field. Compatible there should be, in order:

5250, 4212, 4

(or maybe not 4 at all, if the driver can't successfully drive the
hardware in degraded mode using the HDMI 1.3 register maps, etc).

... But there's no need to reference it in the driver. It might be
useful in the future to set some quirk or feature bits, but until then
it's just there in case.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ