From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8083DC43387 for ; Wed, 19 Dec 2018 07:26:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5057021841 for ; Wed, 19 Dec 2018 07:26:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dIdFDUZJ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="IgtuiAXL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5057021841 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To:MIME-Version: Date:Message-ID:From:To:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1oieHlhDPT0wzxthELcF8IO56vqMunbmDno038dZKQU=; b=dIdFDUZJp94+Zf v0gBwFKlWEyJrEkQcUcGox72f6nUTeRWBPYGtY0fvo4qzLU9iFTXSe5c9IIdv4NgyWsLeCoDb8fd9 EZ4HFe+xy8D4y7pygpf3T3z8tR+cNsvg4qmqd74NLCpLwhQHZ+4+0PTET37eO2pNA1L445zusWMFB BWM5zeRkks5Artsms5p2r7yAQRfiOP9qXSj5/lCOemYXEPTBHQv334qXKuSX/YOyU9flDFcOh6kIl IdxMnTrEapgxZbc+pFgq4aHCc14tf9Mud1esp1Ql9VWGosKoYjh9g8h2/3nWNdm/ZpXs9AO9nEtEn vfqPSiSIUD+7G1QBFFBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZWFQ-0000Pl-Tp; Wed, 19 Dec 2018 07:26:28 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZWFM-0000OV-BK for linux-amlogic@lists.infradead.org; Wed, 19 Dec 2018 07:26:26 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181219072611euoutp021fb6f54542fa15cef2aa6b772f431f80~xqzBz10Dq1838118381euoutp02D for ; Wed, 19 Dec 2018 07:26:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181219072611euoutp021fb6f54542fa15cef2aa6b772f431f80~xqzBz10Dq1838118381euoutp02D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1545204371; bh=XZydJTJNuch+LWR+5h+n55h9EDe/Pg6GeJts+TEWxZo=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=IgtuiAXLKzWSxnzi9kThEV53nG6jO2L1AVBXxoL7b7nrdUweBU0cHQc8L6tSQTEzw R/tXRwyx2Wub1cZLRTj1QyIjFfnk90jNjfCVWbiqqeutEmS2R89tQI200GxElqwgZX EVgkUn3cNDj9vCRuJlHc6y9B1g5zz3ysqoxb5MvM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181219072610eucas1p2f59c9423e16bbbdb9f2dbaf55605fcd2~xqzBFKxcf1353813538eucas1p2A; Wed, 19 Dec 2018 07:26:10 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 01.C7.04294.292F91C5; Wed, 19 Dec 2018 07:26:10 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20181219072610eucas1p27da804d4d3c86dd60a6aeee9e75bc90d~xqzAS-Sud1354313543eucas1p2x; Wed, 19 Dec 2018 07:26:10 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181219072609eusmtrp28ef0db4cd819cfe5a89254683a7a6abd~xqzAEY4EK0347203472eusmtrp2W; Wed, 19 Dec 2018 07:26:09 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-97-5c19f29270ed Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D8.37.04284.192F91C5; Wed, 19 Dec 2018 07:26:09 +0000 (GMT) Received: from [106.120.43.17] (unknown [106.120.43.17]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20181219072609eusmtip1c9d871f58697fe453f800fabacd1a3aa~xqy-ioI2q0318403184eusmtip1i; Wed, 19 Dec 2018 07:26:09 +0000 (GMT) Subject: Re: [PATCH RFC v2 5/8] drm/bridge: dw-hdmi: support dynamically get input/out color info To: Neil Armstrong , architt@codeaurora.org, Laurent.pinchart@ideasonboard.com, Philipp Zabel , Sandy Huang , =?UTF-8?Q?Heiko_St=c3=bcbner?= , maxime.ripard@bootlin.com From: Andrzej Hajda Message-ID: <3cd791c0-8a7b-a3d1-09fa-5ddf0ea9c380@samsung.com> Date: Wed, 19 Dec 2018 08:26:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181130134301.17963-6-narmstrong@baylibre.com> Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIKsWRmVeSWpSXmKPExsWy7djPc7qTPknGGGw5p27R1PGW1eLK1/ds Fv8fvWa1mDup1qJz4hJ2iwWzuS0u75rDZvHg5X5Gi0N90RZ3751gsVjfou/A7fH+Riu7x7w1 1R6X+3qZPGZ3zGT1uN99nMlj85J6j/6/Bh5/Z+1n8dh+bR6zx+dNcgFcUVw2Kak5mWWpRfp2 CVwZC15fYis4plbxZst9pgbGV/JdjJwcEgImEmv+rGPtYuTiEBJYwShxZft/RgjnC6PEl0fr WSCcz4wSh94eYIdpufzqJ1TLckaJk/dWQbW8ZZQ40XkGrEpYIFni6L7dzCAJEYEWJonvM54y gySYBXoZJTpWx4PYbAKaEn8332QDsXkF7CSeHnzGBGKzCKhK3Ni3AiwuKhAh0XF/NVSNoMTJ mU9YQGxOAVuJx8/2sUHMlJfY/nYO1HxxiVtP5jNBnPqWXeLjfCcI20ViyvtjUHFhiVfHt0C9 IyPxfydMfb1E08wrYEdLCHQAfbN4ORtEwlri8PGLQD9zAC3QlFi/Sx8i7Cix99IvsLCEAJ/E jbeCECfwSUzaNp0ZIswr0dEmBFGtKHH/7FZmCFtcYumFr2wTGJVmIXlsFpJnZiF5ZhbC3gWM LKsYxVNLi3PTU4uN8lLL9YoTc4tL89L1kvNzNzECE9rpf8e/7GDc9SfpEKMAB6MSD2+HgmSM EGtiWXFl7iFGCQ5mJRHeS9FAId6UxMqq1KL8+KLSnNTiQ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Jv+VvayznzFIUPxajM/LV1/Qfz4j4Pi7Bdtqf/LHrzLfrw9EXTp1xfpPTf+Ngv 9b8fLWou3PqWt/nikR2ypze1eXI4FKvuerVCvJn7c6RLOruVy0wlluKMREMt5qLiRABZZveE +AIAAA== X-CMS-MailID: 20181219072610eucas1p27da804d4d3c86dd60a6aeee9e75bc90d X-Msg-Generator: CA X-RootMTR: 20181130134411epcas3p2dc841f297a16ae25f17323c766a386d6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181130134411epcas3p2dc841f297a16ae25f17323c766a386d6 References: <20181130134301.17963-1-narmstrong@baylibre.com> <20181130134301.17963-6-narmstrong@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181218_232624_523032_F17C0CCD X-CRM114-Status: GOOD ( 21.50 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Zheng Yang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org On 30.11.2018 14:42, Neil Armstrong wrote: > From: Zheng Yang > > To get input/output bus_format/enc_format dynamically, this patch > introduce following funstion in plat_data: > - get_input_bus_format > - get_output_bus_format > - get_enc_in_encoding > - get_enc_out_encoding It seems fishy. On one side description says about dynamic resolution of formats and encodings. On the other side these functions as only argument takes platform_data which should be rather static. Where is this "dynamic" thing? The only usage of these callbacks I have found in next patches is also not dynamic, the functions just return some static value. Moreover function takes void* argument, which is again something suspicious, why cannot you pass know structure? And finally encoding usually should depend on display mode, it should not depend only static data. What kind of problems do you want to solve here? Regards Andrzej > > Signed-off-by: Zheng Yang > Signed-off-by: Neil Armstrong > --- > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 28 +++++++++++++++++------ > include/drm/bridge/dw_hdmi.h | 5 ++++ > 2 files changed, 26 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > index 4a9a24e854db..bd564ffdf18b 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > @@ -1810,6 +1810,7 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) > static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) > { > int ret; > + void *data = hdmi->plat_data->phy_data; > > hdmi_disable_overflow_interrupts(hdmi); > > @@ -1821,10 +1822,13 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) > dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); > } > > - if ((hdmi->vic == 6) || (hdmi->vic == 7) || > - (hdmi->vic == 21) || (hdmi->vic == 22) || > - (hdmi->vic == 2) || (hdmi->vic == 3) || > - (hdmi->vic == 17) || (hdmi->vic == 18)) > + if (hdmi->plat_data->get_enc_out_encoding) > + hdmi->hdmi_data.enc_out_encoding = > + hdmi->plat_data->get_enc_out_encoding(data); > + else if ((hdmi->vic == 6) || (hdmi->vic == 7) || > + (hdmi->vic == 21) || (hdmi->vic == 22) || > + (hdmi->vic == 2) || (hdmi->vic == 3) || > + (hdmi->vic == 17) || (hdmi->vic == 18)) > hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_601; > else > hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_709; > @@ -1833,21 +1837,31 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) > hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; > > /* TOFIX: Get input format from plat data or fallback to RGB888 */ > - if (hdmi->plat_data->input_bus_format) > + if (hdmi->plat_data->get_input_bus_format) > + hdmi->hdmi_data.enc_in_bus_format = > + hdmi->plat_data->get_input_bus_format(data); > + else if (hdmi->plat_data->input_bus_format) > hdmi->hdmi_data.enc_in_bus_format = > hdmi->plat_data->input_bus_format; > else > hdmi->hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_RGB888_1X24; > > /* TOFIX: Get input encoding from plat data or fallback to none */ > - if (hdmi->plat_data->input_bus_encoding) > + if (hdmi->plat_data->get_enc_in_encoding) > + hdmi->hdmi_data.enc_in_encoding = > + hdmi->plat_data->get_enc_in_encoding(data); > + else if (hdmi->plat_data->input_bus_encoding) > hdmi->hdmi_data.enc_in_encoding = > hdmi->plat_data->input_bus_encoding; > else > hdmi->hdmi_data.enc_in_encoding = V4L2_YCBCR_ENC_DEFAULT; > > /* TOFIX: Default to RGB888 output format */ > - hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; > + if (hdmi->plat_data->get_output_bus_format) > + hdmi->hdmi_data.enc_out_bus_format = > + hdmi->plat_data->get_output_bus_format(data); > + else > + hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; > > hdmi->hdmi_data.pix_repet_factor = 0; > hdmi->hdmi_data.hdcp_enable = 0; > diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h > index 7a02744ce0bc..2e797f782c51 100644 > --- a/include/drm/bridge/dw_hdmi.h > +++ b/include/drm/bridge/dw_hdmi.h > @@ -142,6 +142,11 @@ struct dw_hdmi_plat_data { > int (*configure_phy)(struct dw_hdmi *hdmi, > const struct dw_hdmi_plat_data *pdata, > unsigned long mpixelclock); > + > + unsigned long (*get_input_bus_format)(void *data); > + unsigned long (*get_output_bus_format)(void *data); > + unsigned long (*get_enc_in_encoding)(void *data); > + unsigned long (*get_enc_out_encoding)(void *data); > }; > > struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic