From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755491AbdK2P1i (ORCPT ); Wed, 29 Nov 2017 10:27:38 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:36155 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752795AbdK2P1h (ORCPT ); Wed, 29 Nov 2017 10:27:37 -0500 Date: Wed, 29 Nov 2017 16:27:35 +0100 From: Maxime Ripard To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: wens@csie.org, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, icenowy@aosc.io, linux-sunxi@googlegroups.com Subject: Re: [PATCH 13/17] drm/sun4i: Add DE2 CSC library Message-ID: <20171129152735.i2l6ok7o3gk32rb5@flea.lan> References: <20171127205750.19277-1-jernej.skrabec@siol.net> <20171127205750.19277-14-jernej.skrabec@siol.net> <20171128205550.ls23xy5u4xtdlqgj@flea.home> <5439299.3c0LKkSZrY@jernej-laptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="45y7dld43w2wboas" Content-Disposition: inline In-Reply-To: <5439299.3c0LKkSZrY@jernej-laptop> User-Agent: NeoMutt/20171027 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --45y7dld43w2wboas Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 28, 2017 at 10:43:39PM +0100, Jernej =C5=A0krabec wrote: > Hi! >=20 > Dne torek, 28. november 2017 ob 21:55:50 CET je Maxime Ripard napisal(a): > > On Mon, Nov 27, 2017 at 09:57:46PM +0100, Jernej Skrabec wrote: > > > DE2 have many CSC units - channel input CSC, channel output CSC and > > > mixer output CSC and maybe more. > > >=20 > > > Fortunately, they have all same register layout, only base offsets > > > differs. > > >=20 > > > Add support only for channel output CSC for now. > > >=20 > > > Signed-off-by: Jernej Skrabec > > > --- > > >=20 > > > drivers/gpu/drm/sun4i/Makefile | 2 +- > > > drivers/gpu/drm/sun4i/sun8i_csc.c | 90 > > > +++++++++++++++++++++++++++++++++++++++ > > > drivers/gpu/drm/sun4i/sun8i_csc.h | 36 ++++++++++++++++ > > > 3 files changed, 127 insertions(+), 1 deletion(-) > > > create mode 100644 drivers/gpu/drm/sun4i/sun8i_csc.c > > > create mode 100644 drivers/gpu/drm/sun4i/sun8i_csc.h > > >=20 > > > diff --git a/drivers/gpu/drm/sun4i/Makefile > > > b/drivers/gpu/drm/sun4i/Makefile index 70df480792f9..f82cc69ede72 100= 644 > > > --- a/drivers/gpu/drm/sun4i/Makefile > > > +++ b/drivers/gpu/drm/sun4i/Makefile > > > @@ -9,7 +9,7 @@ sun4i-drm-hdmi-y +=3D sun4i_hdmi_enc.o > > >=20 > > > sun4i-drm-hdmi-y +=3D sun4i_hdmi_i2c.o > > > sun4i-drm-hdmi-y +=3D sun4i_hdmi_tmds_clk.o > > >=20 > > > -sun8i-mixer-y +=3D sun8i_mixer.o sun8i_layer.o sun8i_scaler.o > > > +sun8i-mixer-y +=3D sun8i_mixer.o sun8i_layer.o sun8i_scaler.o=20 > sun8i_csc.o > >=20 > > Please wrap that line. > >=20 > > > sun4i-tcon-y +=3D sun4i_crtc.o > > > sun4i-tcon-y +=3D sun4i_dotclock.o > > >=20 > > > diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c > > > b/drivers/gpu/drm/sun4i/sun8i_csc.c new file mode 100644 > > > index 000000000000..d48c28f8d568 > > > --- /dev/null > > > +++ b/drivers/gpu/drm/sun4i/sun8i_csc.c > > > @@ -0,0 +1,90 @@ > > > +/* > > > + * Copyright (C) Jernej Skrabec > > > + * > > > + * This program is free software; you can redistribute it and/or > > > + * modify it under the terms of the GNU General Public License as > > > + * published by the Free Software Foundation; either version 2 of > > > + * the License, or (at your option) any later version. > > > + */ > > > + > > > +#include "sun8i_csc.h" > > > + > > > +static const u32 ccsc_base[2][2] =3D { > > > + {CCSC00_OFFSET, CCSC01_OFFSET}, > > > + {CCSC10_OFFSET, CCSC11_OFFSET}, > > > +}; > > > + > > > +/* > > > + * Factors are in two's complement format, 10 bits for fractinal par= t. > > > + * First tree values in each line are multiplication factor and last > > > + * value is constant, which is added at the end. > > > + */ > > > +static const u32 yuv2rgb[] =3D { > > > + 0x000004A8, 0x00000000, 0x00000662, 0xFFFC845A, > > > + 0x000004A8, 0xFFFFFE6F, 0xFFFFFCBF, 0x00021DF4, > > > + 0x000004A8, 0x00000813, 0x00000000, 0xFFFBAC4A, > > > +}; > > > + > > > +static const u32 yvu2rgb[] =3D { > > > + 0x000004A8, 0x00000662, 0x00000000, 0xFFFC845A, > > > + 0x000004A8, 0xFFFFFCBF, 0xFFFFFE6F, 0x00021DF4, > > > + 0x000004A8, 0x00000000, 0x00000813, 0xFFFBAC4A, > > > +}; > > > + > > > +static void sun8i_csc_set_coefficients(struct regmap *map, u32 base, > > > + enum sun8i_csc_mode mode) > > > +{ > > > + const u32 *table; > > > + int i, data; > > > + > > > + switch (mode) { > > > + case SUN8I_CSC_MODE_YUV2RGB: > > > + table =3D yuv2rgb; > > > + break; > > > + case SUN8I_CSC_MODE_YVU2RGB: > > > + table =3D yvu2rgb; > > > + break; > > > + default: > > > + WARN(1, "Wrong CSC mode specified."); > >=20 > > A hard warn is a bit overkill here. What about a dev_warn? >=20 > dev_warn requires device, which is not available here and seems a bit ove= rkill=20 > to have it as parameter just to print warning. What about DRM_WARN()? Anything that doesn't make it look like the world just blew up is fine by me :) Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --45y7dld43w2wboas Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAloe0eMACgkQ0rTAlCFN r3SYfA/7BE1DMtdDb7PV/E24W2Nby7DLIAnAaaMsEHXm0QsoBNpkC1CHFYJiPZYp +coxpF8srEAkLAsXxRkyvspJaAfoZIwv4oksjWaQAxwZgcFxfUOtXcYoZVVroNdR D4aY3pcqyE2SGC4L9uTcUjHj5ZZDPCJ0HrWSOE98CX4p7UabAOqKiXSXG+9W4VWL 8XUetaPkbTpyHjpwmLfriQPc9QPRjjSln/a3+V8BrbOxL8cYfy5o4Y1YbM1JgmJb 3JX1cIiK83FJRwaZrwEmYRfcbknFDyelRCk8VsJJZzh9wwPBEP9ugBf7QNkZhgjz +mdyDmc2veXa/vIDpP/CP/WfgYK/slfUoMCKbAAu1+o3fZwycxm8vWMYSLHp/Fv2 GbTxWDft86LaDQLbrR8+V/EOBWs+ihHfkkPuEXcZMrz6jTNjYE3dTXMVz+2ACH17 fSsypeJEAkIR/4kZ6t+06ay/61syCc1lt4ywiD5ReLwi7ahHvNV1tieCfmmdtStn UA07P0IbChFj7rubDDiWW/UyVd7MruT+lcTODkfQclfAGWvvXpM//jai7MjrHXBN PNmN+L7HNbSv4Vcd2Sdzib5TZBIWdJXWfKKg7Ni0jusqJz9NVodod6Slq+jH+YAD N0+r7tt8X2gF08rZnvMjBwAFfItwB/X6HsNmfYaBGSPEJWo30eQ= =glrX -----END PGP SIGNATURE----- --45y7dld43w2wboas--