From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Chen-Yu Tsai <wenst@chromium.org>, Adam Ford <aford173@gmail.com>
Cc: dri-devel@lists.freedesktop.org, Marek Vasut <marex@denx.de>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>, Jonas Karlman <jonas@kwiboo.se>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
aford@beaconembedded.com,
Jernej Skrabec <jernej.skrabec@gmail.com>,
linux-kernel@vger.kernel.org,
Jagan Teki <jagan@amarulasolutions.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
dario.binacchi@amarulasolutions.com
Subject: Re: [PATCH V2 4/6] drm: bridge: samsung-dsim: Dynamically configure DPHY timing
Date: Mon, 24 Apr 2023 11:47:09 +0200 [thread overview]
Message-ID: <ceee0290-211b-a675-2ba5-9342ee27fc49@samsung.com> (raw)
In-Reply-To: <CAGXv+5H34ojUAPWWpF+-=XpdF6Jj_Q7nqiPg3TEKVNXu4F6JAQ@mail.gmail.com>
On 24.04.2023 11:44, Chen-Yu Tsai wrote:
> On Mon, Apr 24, 2023 at 5:31 PM Adam Ford <aford173@gmail.com> wrote:
>> On Mon, Apr 24, 2023 at 1:12 AM Chen-Yu Tsai <wenst@chromium.org> wrote:
>>> On Sun, Apr 23, 2023 at 8:13 PM Adam Ford <aford173@gmail.com> wrote:
>>>> The DPHY timings are currently hard coded. Since the input
>>>> clock can be variable, the phy timings need to be variable
>>>> too. Add an additional variable to the driver data to enable
>>>> this feature to prevent breaking boards that don't support it.
>>>>
>>>> The phy_mipi_dphy_get_default_config function configures the
>>>> DPHY timings in pico-seconds, and a small macro converts those
>>>> timings into clock cycles based on the pixel clock rate.
>>>>
>>>> Signed-off-by: Adam Ford <aford173@gmail.com>
>>>> ---
>>>> drivers/gpu/drm/bridge/samsung-dsim.c | 79 +++++++++++++++++++++++----
>>>> include/drm/bridge/samsung-dsim.h | 1 +
>>>> 2 files changed, 70 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
>>>> index 5b6e7825b92f..f165483d5044 100644
>>>> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
>>>> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
>>>> @@ -18,9 +18,7 @@
>>>> #include <linux/media-bus-format.h>
>>>> #include <linux/of_device.h>
>>>> #include <linux/phy/phy.h>
>>>> -
>>>> #include <video/mipi_display.h>
>>>> -
>>>> #include <drm/bridge/samsung-dsim.h>
>>>> #include <drm/drm_panel.h>
>>>> #include <drm/drm_print.h>
>>>> @@ -218,6 +216,8 @@
>>>>
>>>> #define OLD_SCLK_MIPI_CLK_NAME "pll_clk"
>>>>
>>>> +#define PS_TO_CYCLE(PS, MHz) DIV64_U64_ROUND_CLOSEST(((PS) * (MHz)), 1000000000000ULL)
>>>> +
>>>> static const char *const clk_names[5] = {
>>>> "bus_clk",
>>>> "sclk_mipi",
>>>> @@ -487,6 +487,7 @@ static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = {
>>>> .m_min = 64,
>>>> .m_max = 1023,
>>>> .vco_min = 1050,
>>>> + .dynamic_dphy = 1,
>>>> };
>>>>
>>>> static const struct samsung_dsim_driver_data *
>>>> @@ -698,13 +699,50 @@ static void samsung_dsim_set_phy_ctrl(struct samsung_dsim *dsi)
>>>> const struct samsung_dsim_driver_data *driver_data = dsi->driver_data;
>>>> const unsigned int *reg_values = driver_data->reg_values;
>>>> u32 reg;
>>>> + struct drm_display_mode *m = &dsi->mode;
>>>> + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
>>>> + struct phy_configure_opts_mipi_dphy cfg;
>>>> + int clk_prepare, lpx, clk_zero, clk_post, clk_trail;
>>>> + int hs_exit, hs_prepare, hs_zero, hs_trail;
>>>> + unsigned long long clock_in_hz = m->clock * 1000;
>>>>
>>>> if (driver_data->has_freqband)
>>>> return;
>>>>
>>>> + /* The dynamic_phy has the ability to adjust PHY Timing settings */
>>>> + if (driver_data->dynamic_dphy) {
>>>> + phy_mipi_dphy_get_default_config(clock_in_hz, bpp, dsi->lanes, &cfg);
>>> This requires adding "select GENERIC_PHY_MIPI_DPHY" to DRM_SAMSUNG_DSIM,
>>> otherwise with CONFIG_DRM_SAMSUNG_DSIM=m:
>>>
>>> ERROR: modpost: "phy_mipi_dphy_get_default_config"
>>> [drivers/gpu/drm/bridge/samsung-dsim.ko] undefined!
>>> make[5]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
>>> make[4]: *** [Makefile:1978: modpost] Error 2
>>> make[3]: *** [Makefile:357: __build_one_by_one] Error 2
>>>
>>> I'm sure there'll be a similar error if CONFIG_DRM_SAMSUNG_DSIM=y.
>> That's interesting, I didn't come across that.
>> What did you use for a starting point when you applied the patches?
>> I want to see if I can replicate it.
> next-20230421. My config is pretty much tailored to the Hummingbird Pulse.
> Device drivers for other hardware or things that I can't enable are all
> disabled. For example I don't have PHY_MIXEL_MIPI_DPHY enabled.
>
> Maybe you have some other bridge or phy that selects it enabled?
I've observed similar issue while building exynos_defconfig for arm 32bit.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2023-04-24 9:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 12:12 [PATCH V2 0/6] drm: bridge: samsung-dsim: Support variable clocking Adam Ford
2023-04-23 12:12 ` [PATCH V2 1/6] drm: bridge: samsung-dsim: fix blanking packet size calculation Adam Ford
2023-04-24 9:03 ` Jagan Teki
2023-04-24 9:47 ` Adam Ford
2023-05-03 16:35 ` Jagan Teki
2023-05-04 7:14 ` Lucas Stach
2023-04-23 12:12 ` [PATCH V2 2/6] drm: bridge: samsung-dsim: Fix PMS Calculator on imx8m[mnp] Adam Ford
2023-04-24 6:53 ` Lucas Stach
2023-04-23 12:12 ` [PATCH V2 3/6] drm: bridge: samsung-dsim: Fetch pll-clock-frequency automatically Adam Ford
2023-04-23 12:12 ` [PATCH V2 4/6] drm: bridge: samsung-dsim: Dynamically configure DPHY timing Adam Ford
2023-04-24 6:12 ` Chen-Yu Tsai
2023-04-24 9:31 ` Adam Ford
2023-04-24 9:44 ` Chen-Yu Tsai
2023-04-24 9:47 ` Marek Szyprowski [this message]
2023-04-24 9:50 ` Adam Ford
2023-04-24 12:48 ` Adam Ford
2023-04-23 12:12 ` [PATCH V2 5/6] drm: bridge: samsung-dsim: Support non-burst mode Adam Ford
2023-04-24 8:25 ` Marek Szyprowski
2023-04-24 10:00 ` Adam Ford
2023-04-28 12:31 ` Marek Szyprowski
2023-04-28 13:35 ` Adam Ford
2023-04-28 14:04 ` Marek Szyprowski
2023-04-28 14:09 ` Adam Ford
2023-04-23 12:12 ` [PATCH V2 6/6] drm: bridge: samsung-dsim: Let blanking calcuation work in " Adam Ford
2023-04-24 7:20 ` [PATCH V2 0/6] drm: bridge: samsung-dsim: Support variable clocking Chen-Yu Tsai
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=ceee0290-211b-a675-2ba5-9342ee27fc49@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=aford173@gmail.com \
--cc=aford@beaconembedded.com \
--cc=andrzej.hajda@intel.com \
--cc=dario.binacchi@amarulasolutions.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=wenst@chromium.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 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®