2017-09-07 09:39:18

by Hoegeun Kwon

[permalink] [raw]
Subject: [PATCH v2 0/3] drm/exynos/gsc: Support the hardware rotation limits

Hello all,

The gscaler has hardware rotation limits. So this patch set support
the rotate hardware limits of gsc.

Changes for V2:
- Added the interface info in binding document.
- Added clean name of compatible in Exynos dts.
- Added maximum supported picture size hardcoded into driver.

Best regards,
Hoegeun

Hoegeun Kwon (3):
[media] exynos-gsc: Add compatible for Exynos 5250 and 5420 specific
version
ARM: dts: exynos: Add clean name of compatible.
drm/exynos/gsc: Add hardware rotation limits

.../devicetree/bindings/media/exynos5-gsc.txt | 1 +
arch/arm/boot/dts/exynos5250.dtsi | 8 +-
arch/arm/boot/dts/exynos5420.dtsi | 4 +-
drivers/gpu/drm/exynos/exynos_drm_gsc.c | 100 +++++++++++++++------
include/uapi/drm/exynos_drm.h | 2 +
5 files changed, 80 insertions(+), 35 deletions(-)

--
1.9.1


2017-09-07 09:39:24

by Hoegeun Kwon

[permalink] [raw]
Subject: [PATCH v2 2/3] ARM: dts: exynos: Add clean name of compatible.

Exynos 5250 and 5420 have different hardware rotation limits. However,
currently it uses only one compatible - "exynos5-gsc". Since we have
to distinguish between these two, we add different compatible.

Signed-off-by: Hoegeun Kwon <[email protected]>
---
arch/arm/boot/dts/exynos5250.dtsi | 8 ++++----
arch/arm/boot/dts/exynos5420.dtsi | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 8dbeb87..f795c76 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -637,7 +637,7 @@
};

gsc_0: gsc@13e00000 {
- compatible = "samsung,exynos5-gsc";
+ compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
reg = <0x13e00000 0x1000>;
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&pd_gsc>;
@@ -647,7 +647,7 @@
};

gsc_1: gsc@13e10000 {
- compatible = "samsung,exynos5-gsc";
+ compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
reg = <0x13e10000 0x1000>;
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&pd_gsc>;
@@ -657,7 +657,7 @@
};

gsc_2: gsc@13e20000 {
- compatible = "samsung,exynos5-gsc";
+ compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
reg = <0x13e20000 0x1000>;
interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&pd_gsc>;
@@ -667,7 +667,7 @@
};

gsc_3: gsc@13e30000 {
- compatible = "samsung,exynos5-gsc";
+ compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
reg = <0x13e30000 0x1000>;
interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&pd_gsc>;
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index 02d2f89..86afe77 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -658,7 +658,7 @@
};

gsc_0: video-scaler@13e00000 {
- compatible = "samsung,exynos5-gsc";
+ compatible = "samsung,exynos5-gsc", "samsung,exynos5420-gsc";
reg = <0x13e00000 0x1000>;
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clock CLK_GSCL0>;
@@ -668,7 +668,7 @@
};

gsc_1: video-scaler@13e10000 {
- compatible = "samsung,exynos5-gsc";
+ compatible = "samsung,exynos5-gsc", "samsung,exynos5420-gsc";
reg = <0x13e10000 0x1000>;
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clock CLK_GSCL1>;
--
1.9.1

2017-09-07 09:39:21

by Hoegeun Kwon

[permalink] [raw]
Subject: [PATCH v2 1/3] [media] exynos-gsc: Add compatible for Exynos 5250 and 5420 specific version

Exynos 5250 and 5420 have different hardware rotation limits.
Since we have to distinguish between these two, we add different
compatible(samsung,exynos5250-gsc and samsung,exynos5420-gsc).

Signed-off-by: Hoegeun Kwon <[email protected]>
---
Documentation/devicetree/bindings/media/exynos5-gsc.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/exynos5-gsc.txt b/Documentation/devicetree/bindings/media/exynos5-gsc.txt
index 26ca25b..daa56d5 100644
--- a/Documentation/devicetree/bindings/media/exynos5-gsc.txt
+++ b/Documentation/devicetree/bindings/media/exynos5-gsc.txt
@@ -5,6 +5,7 @@ G-Scaler is used for scaling and color space conversion on EXYNOS5 SoCs.
Required properties:
- compatible: should be "samsung,exynos5-gsc" (for Exynos 5250, 5420 and
5422 SoCs) or "samsung,exynos5433-gsc" (Exynos 5433)
+ or "samsung,exynos5250-gsc" or "samsung,exynos5420-gsc"
- reg: should contain G-Scaler physical address location and length.
- interrupts: should contain G-Scaler interrupt number

--
1.9.1

2017-09-07 09:40:16

by Hoegeun Kwon

[permalink] [raw]
Subject: [PATCH v2 3/3] drm/exynos/gsc: Add hardware rotation limits

The gscaler has hardware rotation limits that need to be hardcoded
into driver. Distinguish them and add them to the property list.

The hardware rotation limits are related to the cropped source size.
When swap occurs, use rot_max size instead of crop_max size.

Also the scaling limits are related to pos size, use pos size to check
the limits.

Signed-off-by: Hoegeun Kwon <[email protected]>
---
drivers/gpu/drm/exynos/exynos_drm_gsc.c | 100 +++++++++++++++++++++++---------
include/uapi/drm/exynos_drm.h | 2 +
2 files changed, 73 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 0506b2b..590a645 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -150,6 +150,15 @@ struct gsc_context {
bool suspended;
};

+/*
+ * struct gsc_driverdata - per device type driver data for init time.
+ *
+ * @rot_max: rotation max resolution.
+ */
+struct gsc_driverdata {
+ struct drm_exynos_sz rot_max;
+};
+
/* 8-tap Filter Coefficient */
static const int h_coef_8t[GSC_COEF_RATIO][GSC_COEF_ATTR][GSC_COEF_H_8T] = {
{ /* Ratio <= 65536 (~8:8) */
@@ -1401,6 +1410,23 @@ static int gsc_ippdrv_check_property(struct device *dev,
bool swap;
int i;

+ config = &property->config[EXYNOS_DRM_OPS_DST];
+
+ /* check for degree */
+ switch (config->degree) {
+ case EXYNOS_DRM_DEGREE_90:
+ case EXYNOS_DRM_DEGREE_270:
+ swap = true;
+ break;
+ case EXYNOS_DRM_DEGREE_0:
+ case EXYNOS_DRM_DEGREE_180:
+ swap = false;
+ break;
+ default:
+ DRM_ERROR("invalid degree.\n");
+ goto err_property;
+ }
+
for_each_ipp_ops(i) {
if ((i == EXYNOS_DRM_OPS_SRC) &&
(property->cmd == IPP_CMD_WB))
@@ -1416,21 +1442,6 @@ static int gsc_ippdrv_check_property(struct device *dev,
goto err_property;
}

- /* check for degree */
- switch (config->degree) {
- case EXYNOS_DRM_DEGREE_90:
- case EXYNOS_DRM_DEGREE_270:
- swap = true;
- break;
- case EXYNOS_DRM_DEGREE_0:
- case EXYNOS_DRM_DEGREE_180:
- swap = false;
- break;
- default:
- DRM_ERROR("invalid degree.\n");
- goto err_property;
- }
-
/* check for buffer bound */
if ((pos->x + pos->w > sz->hsize) ||
(pos->y + pos->h > sz->vsize)) {
@@ -1438,21 +1449,27 @@ static int gsc_ippdrv_check_property(struct device *dev,
goto err_property;
}

+ /*
+ * The rotation hardware limits are related to the cropped
+ * source size. So use rot_max size to check the limits when
+ * swap happens. And also the scaling limits are related to pos
+ * size, use pos size to check the limits.
+ */
/* check for crop */
if ((i == EXYNOS_DRM_OPS_SRC) && (pp->crop)) {
if (swap) {
if ((pos->h < pp->crop_min.hsize) ||
- (sz->vsize > pp->crop_max.hsize) ||
+ (pos->h > pp->rot_max.hsize) ||
(pos->w < pp->crop_min.vsize) ||
- (sz->hsize > pp->crop_max.vsize)) {
+ (pos->w > pp->rot_max.vsize)) {
DRM_ERROR("out of crop size.\n");
goto err_property;
}
} else {
if ((pos->w < pp->crop_min.hsize) ||
- (sz->hsize > pp->crop_max.hsize) ||
+ (pos->w > pp->crop_max.hsize) ||
(pos->h < pp->crop_min.vsize) ||
- (sz->vsize > pp->crop_max.vsize)) {
+ (pos->h > pp->crop_max.vsize)) {
DRM_ERROR("out of crop size.\n");
goto err_property;
}
@@ -1463,17 +1480,17 @@ static int gsc_ippdrv_check_property(struct device *dev,
if ((i == EXYNOS_DRM_OPS_DST) && (pp->scale)) {
if (swap) {
if ((pos->h < pp->scale_min.hsize) ||
- (sz->vsize > pp->scale_max.hsize) ||
+ (pos->h > pp->scale_max.hsize) ||
(pos->w < pp->scale_min.vsize) ||
- (sz->hsize > pp->scale_max.vsize)) {
+ (pos->w > pp->scale_max.vsize)) {
DRM_ERROR("out of scale size.\n");
goto err_property;
}
} else {
if ((pos->w < pp->scale_min.hsize) ||
- (sz->hsize > pp->scale_max.hsize) ||
+ (pos->w > pp->scale_max.hsize) ||
(pos->h < pp->scale_min.vsize) ||
- (sz->vsize > pp->scale_max.vsize)) {
+ (pos->h > pp->scale_max.vsize)) {
DRM_ERROR("out of scale size.\n");
goto err_property;
}
@@ -1657,6 +1674,27 @@ static void gsc_ippdrv_stop(struct device *dev, enum drm_exynos_ipp_cmd cmd)
gsc_write(cfg, GSC_ENABLE);
}

+static struct gsc_driverdata gsc_exynos5250_drvdata = {
+ .rot_max = { 2048, 2048 },
+};
+
+static struct gsc_driverdata gsc_exynos5420_drvdata = {
+ .rot_max = { 2016, 2016 },
+};
+
+static const struct of_device_id exynos_drm_gsc_of_match[] = {
+ {
+ .compatible = "samsung,exynos5250-gsc",
+ .data = &gsc_exynos5250_drvdata,
+ },
+ {
+ .compatible = "samsung,exynos5420-gsc",
+ .data = &gsc_exynos5420_drvdata,
+ },
+ { },
+};
+MODULE_DEVICE_TABLE(of, exynos_drm_gsc_of_match);
+
static int gsc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1670,12 +1708,22 @@ static int gsc_probe(struct platform_device *pdev)
return -ENOMEM;

if (dev->of_node) {
+ const struct of_device_id *match;
+ struct gsc_driverdata *driver_data;
+
ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
"samsung,sysreg");
if (IS_ERR(ctx->sysreg)) {
dev_warn(dev, "failed to get system register.\n");
ctx->sysreg = NULL;
}
+
+ match = of_match_node(exynos_drm_gsc_of_match, dev->of_node);
+ if (!match)
+ return -ENODEV;
+
+ driver_data = (struct gsc_driverdata *)match->data;
+ ctx->ippdrv.prop_list.rot_max = driver_data->rot_max;
}

/* clock control */
@@ -1784,12 +1832,6 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev)
SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
};

-static const struct of_device_id exynos_drm_gsc_of_match[] = {
- { .compatible = "samsung,exynos5-gsc" },
- { },
-};
-MODULE_DEVICE_TABLE(of, exynos_drm_gsc_of_match);
-
struct platform_driver gsc_driver = {
.probe = gsc_probe,
.remove = gsc_remove,
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index cb3e9f9..d5d5518 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -192,6 +192,7 @@ enum drm_exynos_planer {
* @crop_max: crop max resolution.
* @scale_min: scale min resolution.
* @scale_max: scale max resolution.
+ * @rot_max: rotation max resolution.
*/
struct drm_exynos_ipp_prop_list {
__u32 version;
@@ -210,6 +211,7 @@ struct drm_exynos_ipp_prop_list {
struct drm_exynos_sz crop_max;
struct drm_exynos_sz scale_min;
struct drm_exynos_sz scale_max;
+ struct drm_exynos_sz rot_max;
};

/**
--
1.9.1

2017-09-07 11:27:52

by Marek Szyprowski

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ARM: dts: exynos: Add clean name of compatible.

Hi Hoegeun,

On 2017-09-07 11:39, Hoegeun Kwon wrote:
> Exynos 5250 and 5420 have different hardware rotation limits. However,
> currently it uses only one compatible - "exynos5-gsc". Since we have
> to distinguish between these two, we add different compatible.
>
> Signed-off-by: Hoegeun Kwon <[email protected]>

The new values (5250/5420 specific) should replace old exynos5-gsc,
there is no
point providing both in dts.

> ---
> arch/arm/boot/dts/exynos5250.dtsi | 8 ++++----
> arch/arm/boot/dts/exynos5420.dtsi | 4 ++--
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
> index 8dbeb87..f795c76 100644
> --- a/arch/arm/boot/dts/exynos5250.dtsi
> +++ b/arch/arm/boot/dts/exynos5250.dtsi
> @@ -637,7 +637,7 @@
> };
>
> gsc_0: gsc@13e00000 {
> - compatible = "samsung,exynos5-gsc";
> + compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
> reg = <0x13e00000 0x1000>;
> interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
> power-domains = <&pd_gsc>;
> @@ -647,7 +647,7 @@
> };
>
> gsc_1: gsc@13e10000 {
> - compatible = "samsung,exynos5-gsc";
> + compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
> reg = <0x13e10000 0x1000>;
> interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> power-domains = <&pd_gsc>;
> @@ -657,7 +657,7 @@
> };
>
> gsc_2: gsc@13e20000 {
> - compatible = "samsung,exynos5-gsc";
> + compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
> reg = <0x13e20000 0x1000>;
> interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
> power-domains = <&pd_gsc>;
> @@ -667,7 +667,7 @@
> };
>
> gsc_3: gsc@13e30000 {
> - compatible = "samsung,exynos5-gsc";
> + compatible = "samsung,exynos5-gsc", samsung,exynos5250-gsc";
> reg = <0x13e30000 0x1000>;
> interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
> power-domains = <&pd_gsc>;
> diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
> index 02d2f89..86afe77 100644
> --- a/arch/arm/boot/dts/exynos5420.dtsi
> +++ b/arch/arm/boot/dts/exynos5420.dtsi
> @@ -658,7 +658,7 @@
> };
>
> gsc_0: video-scaler@13e00000 {
> - compatible = "samsung,exynos5-gsc";
> + compatible = "samsung,exynos5-gsc", "samsung,exynos5420-gsc";
> reg = <0x13e00000 0x1000>;
> interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&clock CLK_GSCL0>;
> @@ -668,7 +668,7 @@
> };
>
> gsc_1: video-scaler@13e10000 {
> - compatible = "samsung,exynos5-gsc";
> + compatible = "samsung,exynos5-gsc", "samsung,exynos5420-gsc";
> reg = <0x13e10000 0x1000>;
> interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&clock CLK_GSCL1>;

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

2017-09-07 11:30:32

by Marek Szyprowski

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] drm/exynos/gsc: Add hardware rotation limits

Hi Hoegeun,

On 2017-09-07 11:39, Hoegeun Kwon wrote:
> The gscaler has hardware rotation limits that need to be hardcoded
> into driver. Distinguish them and add them to the property list.
>
> The hardware rotation limits are related to the cropped source size.
> When swap occurs, use rot_max size instead of crop_max size.
>
> Also the scaling limits are related to pos size, use pos size to check
> the limits.
>
> Signed-off-by: Hoegeun Kwon <[email protected]>
> ---
> drivers/gpu/drm/exynos/exynos_drm_gsc.c | 100 +++++++++++++++++++++++---------
> include/uapi/drm/exynos_drm.h | 2 +
> 2 files changed, 73 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> index 0506b2b..590a645 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
> @@ -150,6 +150,15 @@ struct gsc_context {
> bool suspended;
> };
>
> +/*
> + * struct gsc_driverdata - per device type driver data for init time.
> + *
> + * @rot_max: rotation max resolution.
> + */
> +struct gsc_driverdata {
> + struct drm_exynos_sz rot_max;
> +};
> +
> /* 8-tap Filter Coefficient */
> static const int h_coef_8t[GSC_COEF_RATIO][GSC_COEF_ATTR][GSC_COEF_H_8T] = {
> { /* Ratio <= 65536 (~8:8) */
> @@ -1401,6 +1410,23 @@ static int gsc_ippdrv_check_property(struct device *dev,
> bool swap;
> int i;
>
> + config = &property->config[EXYNOS_DRM_OPS_DST];
> +
> + /* check for degree */
> + switch (config->degree) {
> + case EXYNOS_DRM_DEGREE_90:
> + case EXYNOS_DRM_DEGREE_270:
> + swap = true;
> + break;
> + case EXYNOS_DRM_DEGREE_0:
> + case EXYNOS_DRM_DEGREE_180:
> + swap = false;
> + break;
> + default:
> + DRM_ERROR("invalid degree.\n");
> + goto err_property;
> + }
> +
> for_each_ipp_ops(i) {
> if ((i == EXYNOS_DRM_OPS_SRC) &&
> (property->cmd == IPP_CMD_WB))
> @@ -1416,21 +1442,6 @@ static int gsc_ippdrv_check_property(struct device *dev,
> goto err_property;
> }
>
> - /* check for degree */
> - switch (config->degree) {
> - case EXYNOS_DRM_DEGREE_90:
> - case EXYNOS_DRM_DEGREE_270:
> - swap = true;
> - break;
> - case EXYNOS_DRM_DEGREE_0:
> - case EXYNOS_DRM_DEGREE_180:
> - swap = false;
> - break;
> - default:
> - DRM_ERROR("invalid degree.\n");
> - goto err_property;
> - }
> -
> /* check for buffer bound */
> if ((pos->x + pos->w > sz->hsize) ||
> (pos->y + pos->h > sz->vsize)) {
> @@ -1438,21 +1449,27 @@ static int gsc_ippdrv_check_property(struct device *dev,
> goto err_property;
> }
>
> + /*
> + * The rotation hardware limits are related to the cropped
> + * source size. So use rot_max size to check the limits when
> + * swap happens. And also the scaling limits are related to pos
> + * size, use pos size to check the limits.
> + */
> /* check for crop */
> if ((i == EXYNOS_DRM_OPS_SRC) && (pp->crop)) {
> if (swap) {
> if ((pos->h < pp->crop_min.hsize) ||
> - (sz->vsize > pp->crop_max.hsize) ||
> + (pos->h > pp->rot_max.hsize) ||
> (pos->w < pp->crop_min.vsize) ||
> - (sz->hsize > pp->crop_max.vsize)) {
> + (pos->w > pp->rot_max.vsize)) {
> DRM_ERROR("out of crop size.\n");
> goto err_property;
> }
> } else {
> if ((pos->w < pp->crop_min.hsize) ||
> - (sz->hsize > pp->crop_max.hsize) ||
> + (pos->w > pp->crop_max.hsize) ||
> (pos->h < pp->crop_min.vsize) ||
> - (sz->vsize > pp->crop_max.vsize)) {
> + (pos->h > pp->crop_max.vsize)) {
> DRM_ERROR("out of crop size.\n");
> goto err_property;
> }
> @@ -1463,17 +1480,17 @@ static int gsc_ippdrv_check_property(struct device *dev,
> if ((i == EXYNOS_DRM_OPS_DST) && (pp->scale)) {
> if (swap) {
> if ((pos->h < pp->scale_min.hsize) ||
> - (sz->vsize > pp->scale_max.hsize) ||
> + (pos->h > pp->scale_max.hsize) ||
> (pos->w < pp->scale_min.vsize) ||
> - (sz->hsize > pp->scale_max.vsize)) {
> + (pos->w > pp->scale_max.vsize)) {
> DRM_ERROR("out of scale size.\n");
> goto err_property;
> }
> } else {
> if ((pos->w < pp->scale_min.hsize) ||
> - (sz->hsize > pp->scale_max.hsize) ||
> + (pos->w > pp->scale_max.hsize) ||
> (pos->h < pp->scale_min.vsize) ||
> - (sz->vsize > pp->scale_max.vsize)) {
> + (pos->h > pp->scale_max.vsize)) {
> DRM_ERROR("out of scale size.\n");
> goto err_property;
> }
> @@ -1657,6 +1674,27 @@ static void gsc_ippdrv_stop(struct device *dev, enum drm_exynos_ipp_cmd cmd)
> gsc_write(cfg, GSC_ENABLE);
> }
>
> +static struct gsc_driverdata gsc_exynos5250_drvdata = {
> + .rot_max = { 2048, 2048 },
> +};
> +
> +static struct gsc_driverdata gsc_exynos5420_drvdata = {
> + .rot_max = { 2016, 2016 },
> +};
> +
> +static const struct of_device_id exynos_drm_gsc_of_match[] = {
> + {
> + .compatible = "samsung,exynos5250-gsc",
> + .data = &gsc_exynos5250_drvdata,
> + },
> + {
> + .compatible = "samsung,exynos5420-gsc",
> + .data = &gsc_exynos5420_drvdata,
> + },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, exynos_drm_gsc_of_match);
> +
> static int gsc_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -1670,12 +1708,22 @@ static int gsc_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> if (dev->of_node) {
> + const struct of_device_id *match;
> + struct gsc_driverdata *driver_data;
> +
> ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
> "samsung,sysreg");
> if (IS_ERR(ctx->sysreg)) {
> dev_warn(dev, "failed to get system register.\n");
> ctx->sysreg = NULL;
> }
> +
> + match = of_match_node(exynos_drm_gsc_of_match, dev->of_node);
> + if (!match)
> + return -ENODEV;
> +
> + driver_data = (struct gsc_driverdata *)match->data;

Please check of_device_get_match_data() kernel function. There is no
need to open code
driver variant matching here with of_match_node().

> + ctx->ippdrv.prop_list.rot_max = driver_data->rot_max;
> }
>
> /* clock control */
> @@ -1784,12 +1832,6 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev)
> SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
> };
>
> -static const struct of_device_id exynos_drm_gsc_of_match[] = {
> - { .compatible = "samsung,exynos5-gsc" },
> - { },
> -};
> -MODULE_DEVICE_TABLE(of, exynos_drm_gsc_of_match);
> -
> struct platform_driver gsc_driver = {
> .probe = gsc_probe,
> .remove = gsc_remove,
> diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
> index cb3e9f9..d5d5518 100644
> --- a/include/uapi/drm/exynos_drm.h
> +++ b/include/uapi/drm/exynos_drm.h
> @@ -192,6 +192,7 @@ enum drm_exynos_planer {
> * @crop_max: crop max resolution.
> * @scale_min: scale min resolution.
> * @scale_max: scale max resolution.
> + * @rot_max: rotation max resolution.
> */
> struct drm_exynos_ipp_prop_list {
> __u32 version;
> @@ -210,6 +211,7 @@ struct drm_exynos_ipp_prop_list {
> struct drm_exynos_sz crop_max;
> struct drm_exynos_sz scale_min;
> struct drm_exynos_sz scale_max;
> + struct drm_exynos_sz rot_max;
> };
>
> /**

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

2017-09-08 02:48:31

by Hoegeun Kwon

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ARM: dts: exynos: Add clean name of compatible.

On 09/07/2017 08:27 PM, Marek Szyprowski wrote:
> Hi Hoegeun,
>
> On 2017-09-07 11:39, Hoegeun Kwon wrote:
>> Exynos 5250 and 5420 have different hardware rotation limits. However,
>> currently it uses only one compatible - "exynos5-gsc". Since we have
>> to distinguish between these two, we add different compatible.
>>
>> Signed-off-by: Hoegeun Kwon <[email protected]>
>
> The new values (5250/5420 specific) should replace old exynos5-gsc,
> there is no
> point providing both in dts.
>

Hi Marek,

Thanks for your review.

I used both compatibles to not modify v4l2.
But v4l2 will also be fixed, so 'exynos5-gsc' will be removed.

And also, Thanks for your comment for of_device_get_match_data() of
patch(3/3).

Best regards,
Hoegeun

>> ---
>> arch/arm/boot/dts/exynos5250.dtsi | 8 ++++----
>> arch/arm/boot/dts/exynos5420.dtsi | 4 ++--
>> 2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/exynos5250.dtsi
>> b/arch/arm/boot/dts/exynos5250.dtsi
>> index 8dbeb87..f795c76 100644
>> --- a/arch/arm/boot/dts/exynos5250.dtsi
>> +++ b/arch/arm/boot/dts/exynos5250.dtsi
>> @@ -637,7 +637,7 @@
>> };
>> gsc_0: gsc@13e00000 {
>> - compatible = "samsung,exynos5-gsc";
>> + compatible = "samsung,exynos5-gsc",
>> samsung,exynos5250-gsc";
>> reg = <0x13e00000 0x1000>;
>> interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
>> power-domains = <&pd_gsc>;
>> @@ -647,7 +647,7 @@
>> };
>> gsc_1: gsc@13e10000 {
>> - compatible = "samsung,exynos5-gsc";
>> + compatible = "samsung,exynos5-gsc",
>> samsung,exynos5250-gsc";
>> reg = <0x13e10000 0x1000>;
>> interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
>> power-domains = <&pd_gsc>;
>> @@ -657,7 +657,7 @@
>> };
>> gsc_2: gsc@13e20000 {
>> - compatible = "samsung,exynos5-gsc";
>> + compatible = "samsung,exynos5-gsc",
>> samsung,exynos5250-gsc";
>> reg = <0x13e20000 0x1000>;
>> interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
>> power-domains = <&pd_gsc>;
>> @@ -667,7 +667,7 @@
>> };
>> gsc_3: gsc@13e30000 {
>> - compatible = "samsung,exynos5-gsc";
>> + compatible = "samsung,exynos5-gsc",
>> samsung,exynos5250-gsc";
>> reg = <0x13e30000 0x1000>;
>> interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
>> power-domains = <&pd_gsc>;
>> diff --git a/arch/arm/boot/dts/exynos5420.dtsi
>> b/arch/arm/boot/dts/exynos5420.dtsi
>> index 02d2f89..86afe77 100644
>> --- a/arch/arm/boot/dts/exynos5420.dtsi
>> +++ b/arch/arm/boot/dts/exynos5420.dtsi
>> @@ -658,7 +658,7 @@
>> };
>> gsc_0: video-scaler@13e00000 {
>> - compatible = "samsung,exynos5-gsc";
>> + compatible = "samsung,exynos5-gsc",
>> "samsung,exynos5420-gsc";
>> reg = <0x13e00000 0x1000>;
>> interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
>> clocks = <&clock CLK_GSCL0>;
>> @@ -668,7 +668,7 @@
>> };
>> gsc_1: video-scaler@13e10000 {
>> - compatible = "samsung,exynos5-gsc";
>> + compatible = "samsung,exynos5-gsc",
>> "samsung,exynos5420-gsc";
>> reg = <0x13e10000 0x1000>;
>> interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
>> clocks = <&clock CLK_GSCL1>;
>
> Best regards

2017-09-09 19:58:28

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ARM: dts: exynos: Add clean name of compatible.

Hi Hoegeun,

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.13 next-20170908]
[cannot apply to drm-exynos/exynos-drm/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Hoegeun-Kwon/drm-exynos-gsc-Support-the-hardware-rotation-limits/20170910-015155
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm-at91_dt_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

>> Error: arch/arm/boot/dts/exynos5250.dtsi:640.40-41 syntax error
FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (1.10 kB)
.config.gz (22.55 kB)
Download all attachments

2017-09-13 02:31:19

by Hoegeun Kwon

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ARM: dts: exynos: Add clean name of compatible.

On 09/10/2017 04:57 AM, kbuild test robot wrote:
> Hi Hoegeun,
>
> [auto build test ERROR on robh/for-next]
> [also build test ERROR on v4.13 next-20170908]
> [cannot apply to drm-exynos/exynos-drm/for-next]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url: https://github.com/0day-ci/linux/commits/Hoegeun-Kwon/drm-exynos-gsc-Support-the-hardware-rotation-limits/20170910-015155
> base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
> config: arm-at91_dt_defconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm
>
> All errors (new ones prefixed by >>):
>
>>> Error: arch/arm/boot/dts/exynos5250.dtsi:640.40-41 syntax error
> FATAL ERROR: Unable to parse input tree

Thank you for your check.

This problem was caused by typos.
ver3 has been modified.

Best regards,
Hoegeun

>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation