All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	Martin Cerveny
	<M.Cerveny-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org>
Cc: hjc-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	kishon-l0cyMroinI0@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	Jose.Abreu-HKixBCOQz3hWk0Htik3J/w@public.gmane.org,
	algea.cao-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	airlied-cv59FeDIM0c@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	zhengyang-TNX95d0MmH7DzftRWevZcw@public.gmane.org
Subject: Re: [2/9] phy: add Rockchip Innosilicon hdmi phy
Date: Fri, 09 Feb 2018 11:06:49 +0100	[thread overview]
Message-ID: <313a1fb7-9ecf-ff94-d9b8-6ec63e80b058@samsung.com> (raw)
In-Reply-To: <2860925.eKDKvHpOYg@phil>

On 09.02.2018 10:24, Heiko Stuebner wrote:
> Hi Martin,
>
> Am Montag, 5. Februar 2018, 22:32:08 CET schrieb Martin Cerveny:
>> On Mon, 5 Feb 2018, Heiko Stuebner wrote:
>>> From: Zheng Yang <zhengyang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>>>
>>> Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229
>>> and rk3328 socs from Rockchip.
>>>
>>> Signed-off-by: Zheng Yang <zhengyang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>>> Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
>>> ---
>>> +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
>>> +static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
>>> +{
>>> +	int bus_width = phy_get_bus_width(inno->phy);
>>> +	u32 tmdsclk;
>>> +
>>> +	switch (bus_width) {
>>> +	case 4:
>>> +		tmdsclk = rate / 2;
>>> +		break;
>>> +	case 5:
>>> +		tmdsclk = rate * 5 / 8;
>>> +		break;
>>> +	case 6:
>>> +		tmdsclk = rate * 3 / 4;
>>> +		break;
>>> +	case 10:
>>> +		tmdsclk = rate * 5 / 4;
>>> +		break;
>>> +	case 12:
>>> +		tmdsclk = rate * 3 / 2;
>>> +		break;
>>> +	case 16:
>>> +		tmdsclk = rate * 2;
>>> +		break;
>>> +	default:
>>> +		tmdsclk = rate;
>>> +	}
>>> +
>>> +	return tmdsclk;
>>> +}
>> Please corrects integer overflow 
>> like https://github.com/mcerveny/rockchip-linux/commit/b4bc703f2dca4e5115b22155920d2277671a9f00
> thanks for finding that possible issue. I've adapted the phy driver
> in a similar way (using u64 though) and will include that change in the
> next version.

Btw, wouldn't be simpler to just use:
switch (bus_width) {
case 4:
case 5:
case 6:
case 10:
case 12:
case 16:
    return (u64)rate * bus_width / 8;
default:
    return rate;
}

Regards
Andrzej

>
>
> Thanks
> Heiko
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: a.hajda@samsung.com (Andrzej Hajda)
To: linux-arm-kernel@lists.infradead.org
Subject: [2/9] phy: add Rockchip Innosilicon hdmi phy
Date: Fri, 09 Feb 2018 11:06:49 +0100	[thread overview]
Message-ID: <313a1fb7-9ecf-ff94-d9b8-6ec63e80b058@samsung.com> (raw)
In-Reply-To: <2860925.eKDKvHpOYg@phil>

On 09.02.2018 10:24, Heiko Stuebner wrote:
> Hi Martin,
>
> Am Montag, 5. Februar 2018, 22:32:08 CET schrieb Martin Cerveny:
>> On Mon, 5 Feb 2018, Heiko Stuebner wrote:
>>> From: Zheng Yang <zhengyang@rock-chips.com>
>>>
>>> Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229
>>> and rk3328 socs from Rockchip.
>>>
>>> Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
>>> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
>>> ---
>>> +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
>>> +static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
>>> +{
>>> +	int bus_width = phy_get_bus_width(inno->phy);
>>> +	u32 tmdsclk;
>>> +
>>> +	switch (bus_width) {
>>> +	case 4:
>>> +		tmdsclk = rate / 2;
>>> +		break;
>>> +	case 5:
>>> +		tmdsclk = rate * 5 / 8;
>>> +		break;
>>> +	case 6:
>>> +		tmdsclk = rate * 3 / 4;
>>> +		break;
>>> +	case 10:
>>> +		tmdsclk = rate * 5 / 4;
>>> +		break;
>>> +	case 12:
>>> +		tmdsclk = rate * 3 / 2;
>>> +		break;
>>> +	case 16:
>>> +		tmdsclk = rate * 2;
>>> +		break;
>>> +	default:
>>> +		tmdsclk = rate;
>>> +	}
>>> +
>>> +	return tmdsclk;
>>> +}
>> Please corrects integer overflow 
>> like https://github.com/mcerveny/rockchip-linux/commit/b4bc703f2dca4e5115b22155920d2277671a9f00
> thanks for finding that possible issue. I've adapted the phy driver
> in a similar way (using u64 though) and will include that change in the
> next version.

Btw, wouldn't be simpler to just use:
switch (bus_width) {
case 4:
case 5:
case 6:
case 10:
case 12:
case 16:
??? return (u64)rate * bus_width / 8;
default:
??? return rate;
}

Regards
Andrzej

>
>
> Thanks
> Heiko
>
>
>

  reply	other threads:[~2018-02-09 10:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 14:34 [PATCH 0/9] drm/rockchip: hdmi support for rk3328 Heiko Stuebner
2018-02-05 14:34 ` Heiko Stuebner
2018-02-05 14:34 ` [PATCH 7/9] drm/rockchip: dw_hdmi: allow including external phys Heiko Stuebner
2018-02-05 14:34   ` Heiko Stuebner
     [not found] ` <20180205143435.4723-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2018-02-05 14:34   ` [PATCH 1/9] dt-bindings: add binding for Rockchip hdmi phy using an Innosilicon IP Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
     [not found]     ` <20180205143435.4723-2-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2018-02-09  2:34       ` Rob Herring
2018-02-09  2:34         ` Rob Herring
2018-02-05 14:34   ` [PATCH 2/9] phy: add Rockchip Innosilicon hdmi phy Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
     [not found]     ` <20180205143435.4723-3-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2018-02-05 21:32       ` [2/9] " Martin Cerveny
2018-02-05 21:32         ` Martin Cerveny
2018-02-09  9:24         ` Heiko Stuebner
2018-02-09  9:24           ` Heiko Stuebner
2018-02-09 10:06           ` Andrzej Hajda [this message]
2018-02-09 10:06             ` Andrzej Hajda
2018-02-09 10:10             ` Heiko Stuebner
2018-02-09 10:10               ` Heiko Stuebner
2018-02-05 14:34   ` [PATCH 3/9] drm/bridge: dw-hdmi: allow overriding of phy-type reading Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
2018-02-05 14:34   ` [PATCH 4/9] drm/bridge: dw-hdmi: export hotplug functions Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
2018-02-05 14:34   ` [PATCH 5/9] drm/rockchip: dw_hdmi: Allow outputs that don't need output switching Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
2018-02-05 14:34   ` [PATCH 6/9] dt-bindings: allow optional phys in Rockchip dw_hdmi binding Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
2018-02-05 14:34   ` [PATCH 8/9] drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data object Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner
2018-02-05 14:34   ` [PATCH 9/9] drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328 Heiko Stuebner
2018-02-05 14:34     ` Heiko Stuebner

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=313a1fb7-9ecf-ff94-d9b8-6ec63e80b058@samsung.com \
    --to=a.hajda-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=Jose.Abreu-HKixBCOQz3hWk0Htik3J/w@public.gmane.org \
    --cc=Laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
    --cc=M.Cerveny-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=algea.cao-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=hjc-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=zhengyang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    /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.