From: Jason-JH Lin <jason-jh.lin@mediatek.com>
To: CK Hu <ck.hu@mediatek.com>,
Chun-Kuang Hu <chunkuang.hu@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: Rex-BC Chen <rex-bc.chen@mediatek.com>,
Singo Chang <singo.chang@mediatek.com>,
<dri-devel@lists.freedesktop.org>,
<linux-mediatek@lists.infradead.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
zheng-yan.chen <zheng-yan.chen@mediatek.com>
Subject: Re: [PATCH RESEND v3 7/9] drm/mediatek: Add gamma lut support for mt8195
Date: Wed, 14 Sep 2022 09:48:00 +0800 [thread overview]
Message-ID: <33dc31dc290f40e7202e8cd363816d14d8d0596f.camel@mediatek.com> (raw)
In-Reply-To: <916f87cd706fef3bad919fe1dbee810af5980d5c.camel@mediatek.com>
Hi CK,
Thanks for the reviews.
On Mon, 2022-09-12 at 18:00 +0800, CK Hu wrote:
> Hi, Jason:
>
> On Mon, 2022-09-12 at 09:30 +0800, Jason-JH.Lin wrote:
> > From: "zheng-yan.chen" <zheng-yan.chen@mediatek.com>
> >
> > Since the previous gamma_set_common() function is designed for
> > 9bit-to-10bit conversion, which is not feasible for the
> > 10bit-to-12bit conversion in mt8195.
> >
> > 1. Update the function to fit the need of mt8195.
> > 2. Add gamma driver data for mt8195.
> >
> > Signed-off-by: zheng-yan.chen <zheng-yan.chen@mediatek.com>
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 57 ++++++++++++++++---
> > --
> > --
> > 1 file changed, 40 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > index 45da2b6206c8..d706f76fd30e 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > @@ -23,6 +23,7 @@
> > #define DISP_GAMMA_SIZE 0x0030
> > #define DISP_GAMMA_BANK 0x0100
> > #define DISP_GAMMA_LUT 0x0700
> > +#define DISP_GAMMA_LUT1 0x0b00
> >
> > #define LUT_10BIT_MASK 0x03ff
> > #define LUT_SIZE_DEFAULT 512 /* for setting
> > gamma lut from AAL */
> > @@ -82,9 +83,8 @@ void mtk_gamma_set_common(struct device *dev,
> > void
> > __iomem *regs, struct drm_crt
> > u8 shift_bits;
> > unsigned int i, j, reg, bank_num;
> > struct drm_color_lut *lut;
> > - void __iomem *lut_base;
> > - u32 word, mask;
> > - u32 diff[3] = {0};
> > + void __iomem *lut_base, *lut1_base;
> > + u32 word, word1, mask;
> >
> > if (gamma && gamma->data) {
> > lut_diff = gamma->data->lut_diff;
> > @@ -102,27 +102,41 @@ void mtk_gamma_set_common(struct device *dev,
> > void __iomem *regs, struct drm_crt
> > reg = reg | GAMMA_LUT_EN;
> > writel(reg, regs + DISP_GAMMA_CFG);
> > lut_base = regs + DISP_GAMMA_LUT;
> > + lut1_base = regs + DISP_GAMMA_LUT1;
> > lut = (struct drm_color_lut *)state->gamma_lut->data;
> > for (j = 0; j < bank_num; j++) {
> > writel(j, regs + DISP_GAMMA_BANK);
> > for (i = 0; i < bank_size; i++) {
> > - if (!lut_diff || (i % 2 == 0)) {
> > - word = (((lut[i].red >>
> > shift_bits) & mask) << 20) +
> > - (((lut[i].green >>
> > shift_bits) & mask) << 10) +
> > - ((lut[i].blue >>
> > shift_bits) & mask);
> > + struct drm_color_lut input;
> > +
> > + input.red = (lut[i].red >> shift_bits)
> > & mask;
> > + input.green = (lut[i].green >>
> > shift_bits) & mask;
> > + input.blue = (lut[i].blue >>
> > shift_bits) & mask;
> > + if (!lut_diff || i % 2 == 0) {
> > + word = (lut_bits == 12) ?
>
> Move lut_bits modification to the patch "drm/mediatek: Add gamma
> support different lut_bits for other SoC".
OK, I'll move this.
>
> > + (input.red +
> > (input.green << 12)) :
> > + ((input.red << 20) +
> > (input.green << 10) +
> > + input.blue);
> > + word1 = input.blue;
> > } else {
> > - diff[0] = (lut[i].red >>
> > shift_bits) -
> > - (lut[i - 1].red >>
> > shift_bits);
> > - diff[1] = (lut[i].green >>
> > shift_bits) -
> > - (lut[i - 1].green >>
> > shift_bits);
> > - diff[2] = (lut[i].blue >>
> > shift_bits) -
> > - (lut[i - 1].blue >>
> > shift_bits);
> > -
> > - word = ((diff[0] & mask) << 20)
> > +
> > - ((diff[1] & mask) <<
> > 10) +
> > - (diff[2] & mask);
> > + struct drm_color_lut diff;
> > +
> > + diff.red = input.red -
> > + ((lut[i - 1].red >>
> > shift_bits) & mask);
> > + diff.green = input.green -
> > + ((lut[i - 1].green
> > > > shift_bits & mask));
> >
> > + diff.blue = input.blue -
> > + ((lut[i - 1].blue
> > > > shift_bits) & mask);
> >
> > +
> > + word = (lut_bits == 12) ?
>
> Ditto.
OK, I'll move this.
>
> > + (input.red +
> > (input.green << 12)) :
> > + (diff.red << 20) +
> > (diff.green << 10) + diff.blue;
> > + word1 = input.blue;
> > }
> > +
> > writel(word, (lut_base + i * 4));
> > + if (lut_bits == 12)
>
> Ditto.
Because only mt8195 has lut1_base register, so I'll declare bool
12bit_mode = (lut_bits == 12) ? true : false; instead and move this to
the patch "drm/mediatek: Add gamma support different lut_bits for other
SoC".
Regards,
Jason-JH.Lin
>
> Regards,
> CK
>
> > + writel(word1, (lut1_base + i *
> > 4));
> > }
> > }
> > }
> > @@ -237,11 +251,20 @@ static const struct mtk_disp_gamma_data
> > mt8183_gamma_driver_data = {
> > .lut_bits = 10,
> > };
> >
> > +static const struct mtk_disp_gamma_data mt8195_gamma_driver_data =
> > {
> > + .lut_diff = true,
> > + .lut_size = 512,
> > + .lut_bits = 10,
> > + .bank_size = 256,
> > +};
> > +
> > static const struct of_device_id mtk_disp_gamma_driver_dt_match[]
> > =
> > {
> > { .compatible = "mediatek,mt8173-disp-gamma",
> > .data = &mt8173_gamma_driver_data},
> > { .compatible = "mediatek,mt8183-disp-gamma",
> > .data = &mt8183_gamma_driver_data},
> > + { .compatible = "mediatek,mt8195-disp-gamma",
> > + .data = &mt8195_gamma_driver_data},
> > {},
> > };
> > MODULE_DEVICE_TABLE(of, mtk_disp_gamma_driver_dt_match);
>
>
--
Jason-JH Lin <jason-jh.lin@mediatek.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-09-14 2:30 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-12 1:29 [PATCH RESEND v3 0/9] Add gamma lut support for mt8195 Jason-JH.Lin
2022-09-12 1:29 ` [PATCH RESEND v3 1/9] dt-bindings: mediatek: modify item formatting for gamma Jason-JH.Lin
2022-09-18 9:59 ` Krzysztof Kozlowski
2022-09-12 1:29 ` [PATCH RESEND v3 2/9] dt-bindings: mediatek: Add gamma compatible for mt8195 Jason-JH.Lin
2022-09-18 9:59 ` Krzysztof Kozlowski
2022-09-12 1:30 ` [PATCH RESEND v3 3/9] drm/mediatek: Adjust mtk_drm_gamma_set_common parameters Jason-JH.Lin
2022-09-12 2:48 ` CK Hu
2022-09-14 1:10 ` Jason-JH Lin
2022-09-12 1:30 ` [PATCH RESEND v3 4/9] drm/mediatek: Add gamma support different lut_size for other SoC Jason-JH.Lin
2022-09-12 3:14 ` CK Hu
2022-09-14 1:14 ` Jason-JH Lin
2022-09-12 1:30 ` [PATCH RESEND v3 5/9] drm/mediatek: Add gamma support different lut_bits " Jason-JH.Lin
2022-09-12 3:40 ` CK Hu
2022-09-14 1:17 ` Jason-JH Lin
2022-09-12 1:30 ` [PATCH RESEND v3 6/9] drm/mediatek: Add gamma support different bank_size " Jason-JH.Lin
2022-09-12 5:12 ` CK Hu
2022-09-14 1:28 ` Jason-JH Lin
2023-04-26 12:06 ` AngeloGioacchino Del Regno
2022-09-12 1:30 ` [PATCH RESEND v3 7/9] drm/mediatek: Add gamma lut support for mt8195 Jason-JH.Lin
2022-09-12 10:00 ` CK Hu
2022-09-14 1:48 ` Jason-JH Lin [this message]
2022-09-12 1:30 ` [PATCH RESEND v3 8/9] drm/mediatek: Add clear RELAY_MODE bit to set gamma Jason-JH.Lin
2022-09-12 2:26 ` CK Hu
2022-09-14 1:26 ` Jason-JH Lin
2022-09-12 1:30 ` [PATCH RESEND v3 9/9] arm64: dts: Modify gamma compatible for mt8195 Jason-JH.Lin
2023-04-26 11:43 ` [PATCH RESEND v3 0/9] Add gamma lut support " AngeloGioacchino Del Regno
2023-04-27 15:15 ` AngeloGioacchino Del Regno
2023-04-28 6:45 ` Jason-JH Lin (林睿祥)
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=33dc31dc290f40e7202e8cd363816d14d8d0596f.camel@mediatek.com \
--to=jason-jh.lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=ck.hu@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=rex-bc.chen@mediatek.com \
--cc=robh+dt@kernel.org \
--cc=singo.chang@mediatek.com \
--cc=zheng-yan.chen@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).