devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason-JH Lin <jason-jh.lin@mediatek.com>
To: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.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>
Cc: CK Hu <ck.hu@mediatek.com>,
	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>
Subject: Re: [PATCH v3 4/9] drm/mediatek: Add gamma support different lut_size for other SoC
Date: Wed, 14 Sep 2022 09:35:58 +0800	[thread overview]
Message-ID: <cd08cc1ed6765970ba0ad8590bebf7de651e68e3.camel@mediatek.com> (raw)
In-Reply-To: <97ac2b35-bb3b-360a-4078-f72146136a7f@collabora.com>

Hi Angelo,

Thanks for the reviews.

On Mon, 2022-09-12 at 12:24 +0200, AngeloGioacchino Del Regno wrote:
> Il 11/09/22 17:37, Jason-JH.Lin ha scritto:
> > 1. Add mtk_drm_gamma_get_lut_size() and remove MTK_LUT_SIZE macro.
> > 2. Add lut_size to gamma driver data for different SoC.
> > 
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> > ---
> >   drivers/gpu/drm/mediatek/mtk_disp_drv.h     |  1 +
> >   drivers/gpu/drm/mediatek/mtk_disp_gamma.c   | 22
> > +++++++++++++++++++--
> >   drivers/gpu/drm/mediatek/mtk_drm_crtc.c     |  4 ++--
> >   drivers/gpu/drm/mediatek/mtk_drm_crtc.h     |  1 -
> >   drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  9 +++++++++
> >   5 files changed, 32 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > index a83e5fbc8724..6a05bb56e693 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > @@ -51,6 +51,7 @@ void mtk_gamma_clk_disable(struct device *dev);
> >   void mtk_gamma_config(struct device *dev, unsigned int w,
> >   		      unsigned int h, unsigned int vrefresh,
> >   		      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
> > +unsigned int mtk_gamma_get_lut_size(struct device *dev);
> >   void mtk_gamma_set(struct device *dev, struct drm_crtc_state
> > *state);
> >   void mtk_gamma_set_common(struct device *dev, void __iomem *regs,
> > struct drm_crtc_state *state);
> >   void mtk_gamma_start(struct device *dev);
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > index f54a6a618348..e69d0b205b9a 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > @@ -24,10 +24,12 @@
> >   #define DISP_GAMMA_LUT				0x0700
> >   
> >   #define LUT_10BIT_MASK				0x03ff
> > +#define LUT_SIZE_DEFAULT			512 /* for setting
> > gamma lut from AAL */
> >   
> >   struct mtk_disp_gamma_data {
> >   	bool has_dither;
> >   	bool lut_diff;
> > +	u16 lut_size;
> >   };
> >   
> >   /*
> > @@ -54,18 +56,32 @@ void mtk_gamma_clk_disable(struct device *dev)
> >   	clk_disable_unprepare(gamma->clk);
> >   }
> >   
> > +unsigned int mtk_gamma_get_size(struct device *dev)
> > +{
> > +	struct mtk_disp_gamma *gamma = dev_get_drvdata(dev);
> > +	unsigned int lut_size = LUT_SIZE_DEFAULT;
> > +
> > +	if (gamma && gamma->data)
> > +		lut_size = gamma->data->lut_size;
> > +
> > +	return lut_size;
> > +}
> > +
> >   void mtk_gamma_set_common(struct device *dev, void __iomem *regs,
> > struct drm_crtc_state *state)
> >   {
> >   	struct mtk_disp_gamma *gamma = dev_get_drvdata(dev);
> >   	bool lut_diff = false;
> > +	u16 lut_size = LUT_SIZE_DEFAULT;
> 
> This makes us get a double assignment in case gamma->data is
> populated.
> 
> >   	unsigned int i, reg;
> >   	struct drm_color_lut *lut;
> >   	void __iomem *lut_base;
> >   	u32 word;
> >   	u32 diff[3] = {0};
> >   
> > -	if (gamma && gamma->data)
> > +	if (gamma && gamma->data) {
> >   		lut_diff = gamma->data->lut_diff;
> > +		lut_size = gamma->data->lut_size;
> > +	}
> 
> ...you can avoid it like that:
> 
> } else {
> 	lut_size = LUT_SIZE_DEFAULT;
> }
> 
> 
> Regards,
> Angelo
> 
OK, I'll fix it, but I'll move the gamma priv data handling to the
mtk_gamma_set.

Regards,
Jason-JH.Lin

> 
-- 
Jason-JH Lin <jason-jh.lin@mediatek.com>


  parent reply	other threads:[~2022-09-14  1:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220911153734.24243-1-jason-jh.lin@mediatek.com>
     [not found] ` <20220911153734.24243-4-jason-jh.lin@mediatek.com>
2022-09-12 10:12   ` [PATCH v3 3/9] drm/mediatek: Adjust mtk_drm_gamma_set_common parameters AngeloGioacchino Del Regno
2022-09-14  1:29     ` Jason-JH Lin
     [not found] ` <20220911153734.24243-5-jason-jh.lin@mediatek.com>
2022-09-11 21:10   ` [PATCH v3 4/9] drm/mediatek: Add gamma support different lut_size for other SoC kernel test robot
2022-09-12 10:24   ` AngeloGioacchino Del Regno
2022-09-14  1:33     ` Jason-JH Lin
2022-09-14  1:35     ` Jason-JH Lin [this message]
     [not found] ` <20220911153734.24243-6-jason-jh.lin@mediatek.com>
2022-09-12 10:25   ` [PATCH v3 5/9] drm/mediatek: Add gamma support different lut_bits " AngeloGioacchino Del Regno
2022-09-14  1:36     ` Jason-JH Lin
     [not found] ` <20220911153734.24243-9-jason-jh.lin@mediatek.com>
2022-09-12 10:26   ` [PATCH v3 8/9] drm/mediatek: Add clear RELAY_MODE bit to set gamma AngeloGioacchino Del Regno
2022-09-14  1:37     ` 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=cd08cc1ed6765970ba0ad8590bebf7de651e68e3.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 \
    /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).