Skip to contentSkip to conversation

drm/komeda: Add new product "D32" support

PATCH Superseded james qian wang (Arm Technology China) 1 participant 3 messages Jul 9, 2019

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover drm/komeda: Add new product "D32" support

This series enables new product "D32" support

James Qian Wang (Arm Technology China) (2):
drm/komeda: Update the chip identify
drm/komeda: Enable new product D32 support

 .../drm/arm/display/include/malidp_product.h  |  3 +-
 .../arm/display/komeda/d71/d71_component.c    |  2 +-
 .../gpu/drm/arm/display/komeda/d71/d71_dev.c  | 70 +++++++++++++------
 .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 13 ++++
 .../gpu/drm/arm/display/komeda/komeda_dev.c   | 62 ++++++++--------
 .../gpu/drm/arm/display/komeda/komeda_dev.h   | 14 +---
 .../gpu/drm/arm/display/komeda/komeda_drv.c   | 10 +--
 7 files changed, 104 insertions(+), 70 deletions(-)

--
2.20.1

#1 lore raw

PATCH 1/2 drm/komeda: Update the chip identify

1. Drop komeda-CORE product id comparison and put it into the d71_identify
2. Update pipeline node DT-binding:
*. Skip the needless pipeline DT node.
*. Return fail if the essential pipeline DT node was missing.

With these changes, for one family chips no need to change the DT.

---
 .../gpu/drm/arm/display/komeda/d71/d71_dev.c  | 27 ++++++--
 .../gpu/drm/arm/display/komeda/komeda_dev.c   | 62 ++++++++++---------
 .../gpu/drm/arm/display/komeda/komeda_dev.h   | 14 +----
 .../gpu/drm/arm/display/komeda/komeda_drv.c   |  9 +--
 4 files changed, 60 insertions(+), 52 deletions(-)
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +22 -5
index 7e7c9e935eaf..e383a781c9e9 100644
@@ -578,10 +578,27 @@ static const struct komeda_dev_funcs d71_chip_funcs = {
 const struct komeda_dev_funcs *
 d71_identify(u32 __iomem *reg_base, struct komeda_chip_info *chip)
 {
-	chip->arch_id	= malidp_read32(reg_base, GLB_ARCH_ID);
-	chip->core_id	= malidp_read32(reg_base, GLB_CORE_ID);
-	chip->core_info	= malidp_read32(reg_base, GLB_CORE_INFO);
-	chip->bus_width	= D71_BUS_WIDTH_16_BYTES;
+	const struct komeda_dev_funcs *funcs;
+	u32 product_id;
 
-	return &d71_chip_funcs;
+	chip->core_id = malidp_read32(reg_base, GLB_CORE_ID);
+
+	product_id = MALIDP_CORE_ID_PRODUCT_ID(chip->core_id);
+
+	switch (product_id) {
+	case MALIDP_D71_PRODUCT_ID:
+		funcs = &d71_chip_funcs;
+		break;
+	default:
+		funcs = NULL;
+		DRM_ERROR("Unsupported product: 0x%x\n", product_id);
+	}
+
+	if (funcs) {
+		chip->arch_id	= malidp_read32(reg_base, GLB_ARCH_ID);
+		chip->core_info	= malidp_read32(reg_base, GLB_CORE_INFO);
+		chip->bus_width	= D71_BUS_WIDTH_16_BYTES;
+	}
+
+	return funcs;
 }
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +34 -28

114 lines not on this page · raw message

drivers/gpu/drm/arm/display/komeda/komeda_dev.h +3 -11
index c70cc25d246f..f91a113b0fde 100644
@@ -51,11 +51,6 @@
 
 #define KOMEDA_WARN_EVENTS	KOMEDA_ERR_CSCE
 
-/* malidp device id */
-enum {
-	MALI_D71 = 0,
-};
-
 /* pipeline DT ports */
 enum {
 	KOMEDA_OF_PORT_OUTPUT		= 0,
@@ -69,12 +64,6 @@ struct komeda_chip_info {
 	u32 bus_width;
 };
 
-struct komeda_product_data {
-	u32 product_id;
-	const struct komeda_dev_funcs *(*identify)(u32 __iomem *reg,
-					     struct komeda_chip_info *info);
-};
-
 struct komeda_dev;
 
 struct komeda_events {
@@ -219,6 +208,9 @@ komeda_product_match(struct komeda_dev *mdev, u32 target)
 	return MALIDP_CORE_ID_PRODUCT_ID(mdev->chip.core_id) == target;
 }
 
+typedef const struct komeda_dev_funcs *
+(*komeda_identify_func)(u32 __iomem *reg, struct komeda_chip_info *chip);
+
 const struct komeda_dev_funcs *
 d71_identify(u32 __iomem *reg, struct komeda_chip_info *chip);
 
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +1 -8
index d6c2222c5d33..b7a1097c45c4 100644
@@ -123,15 +123,8 @@ static int komeda_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct komeda_product_data komeda_products[] = {
-	[MALI_D71] = {
-		.product_id = MALIDP_D71_PRODUCT_ID,
-		.identify = d71_identify,
-	},
-};
-
 static const struct of_device_id komeda_of_match[] = {
-	{ .compatible = "arm,mali-d71", .data = &komeda_products[MALI_D71], },
+	{ .compatible = "arm,mali-d71", .data = d71_identify, },
 	{},
 };
 

--
2.20.1

#2 lore raw

PATCH 2/2 drm/komeda: Enable new product D32 support

In reply to james qian wang (Arm Technology China)

D32 is simple version of D71, the difference is:
- Only has one pipeline
- Drop the periph block and merge it to GCU

---
 .../drm/arm/display/include/malidp_product.h  |  3 +-
 .../arm/display/komeda/d71/d71_component.c    |  2 +-
 .../gpu/drm/arm/display/komeda/d71/d71_dev.c  | 43 ++++++++++++-------
 .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 13 ++++++
 .../gpu/drm/arm/display/komeda/komeda_drv.c   |  1 +
 5 files changed, 44 insertions(+), 18 deletions(-)
drivers/gpu/drm/arm/display/include/malidp_product.h +2 -1
index 1053b11352eb..16a8a2c22c42 100644
@@ -18,7 +18,8 @@
 #define MALIDP_CORE_ID_STATUS(__core_id)     (((__u32)(__core_id)) & 0xFF)
 
 /* Mali-display product IDs */
-#define MALIDP_D71_PRODUCT_ID   0x0071
+#define MALIDP_D71_PRODUCT_ID	0x0071
+#define MALIDP_D32_PRODUCT_ID	0x0032
 
 union komeda_config_id {
 	struct {
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +1 -1
index a68954bb594a..593f8b7e9bb6 100644
@@ -1178,7 +1178,7 @@ static int d71_timing_ctrlr_init(struct d71_dev *d71,
 
 	ctrlr = to_ctrlr(c);
 
-	ctrlr->supports_dual_link = true;
+	ctrlr->supports_dual_link = d71->supports_dual_link;
 	ctrlr->supports_vrr = true;
 	set_range(&ctrlr->vfp_range, 0, 0x3FF);
 
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +27 -16

72 lines not on this page · raw message

drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h +13 -0
index 2d5e6d00b42c..da6bd535836d 100644
@@ -71,6 +71,19 @@
 #define GCU_CONTROL_MODE(x)	((x) & 0x7)
 #define GCU_CONTROL_SRST	BIT(16)
 
+/* GCU_CONFIGURATION registers */
+#define GCU_CONFIGURATION_ID0	0x100
+#define GCU_CONFIGURATION_ID1	0x104
+
+/* GCU configuration */
+#define GCU_MAX_LINE_SIZE(x)	((x) & 0xFFFF)
+#define GCU_MAX_NUM_LINES(x)	((x) >> 16)
+#define GCU_NUM_RICH_LAYERS(x)	((x) & 0x7)
+#define GCU_NUM_PIPELINES(x)	(((x) >> 3) & 0x7)
+#define GCU_NUM_SCALERS(x)	(((x) >> 6) & 0x7)
+#define GCU_DISPLAY_SPLIT_EN(x)	(((x) >> 16) & 0x1)
+#define GCU_DISPLAY_TBU_EN(x)	(((x) >> 17) & 0x1)
+
 /* GCU opmode */
 #define INACTIVE_MODE		0
 #define TBU_CONNECT_MODE	1
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +1 -0
index b7a1097c45c4..ad38bbc7431e 100644
@@ -125,6 +125,7 @@ static int komeda_platform_remove(struct platform_device *pdev)
 
 static const struct of_device_id komeda_of_match[] = {
 	{ .compatible = "arm,mali-d71", .data = d71_identify, },
+	{ .compatible = "arm,mali-d32", .data = d71_identify, },
 	{},
 };
 

--
2.20.1