Skip to content

Conversation

@ExtremeGTX
Copy link
Contributor

@ExtremeGTX ExtremeGTX commented Nov 5, 2022

Driver for ili9342c display controller
Tested on m5stack Core Basic using sample/subsys/display/lvgl

@ExtremeGTX ExtremeGTX changed the title Add support for ili9342c display controller drivers: display: ili9xxx: Add support for ili9342c display controller Nov 5, 2022
@ExtremeGTX ExtremeGTX removed the platform: ITE ITE label Nov 5, 2022
@ExtremeGTX ExtremeGTX removed the platform: ITE ITE label Nov 5, 2022
@diegoherranz
Copy link
Contributor

I was about to submit a nearly identical pull request. I'll try to review yours and provide comments.
Thanks!

Copy link
Contributor

@diegoherranz diegoherranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a look and provided some comments. Let me know if you have any questions.
Thanks!

@ExtremeGTX
Copy link
Contributor Author

@diegoherranz Thank you for the review comments 👍, I have fixed all of them, and also retested orientation modes.
I don't like the use of #ifdef in there, but I don't have the other ili9xxx chips to play around with these values.

@diegoherranz
Copy link
Contributor

@diegoherranz Thank you for the review comments 👍, I have fixed all of them, and also retested orientation modes. I don't like the use of #ifdef in there, but I don't have the other ili9xxx chips to play around with these values.

Thanks for making these changes. I haven't forgotten about this one, simply I haven't had time to re-review it lately. I will as soon as possible.

jfischer-no
jfischer-no previously approved these changes Feb 15, 2023
@ExtremeGTX
Copy link
Contributor Author

@galak @jfischer-no since there is always a time difference between me and you, could you please Approve and merge?
When I force push to rebase on the latest main, Github dismisses the review.

jfischer-no
jfischer-no previously approved these changes Feb 21, 2023
@ExtremeGTX
Copy link
Contributor Author

@carlescufi @jfischer-no @MaureenHelm what is the way forward ?

jfischer-no
jfischer-no previously approved these changes Feb 23, 2023
@diegoherranz
Copy link
Contributor

diegoherranz commented Feb 27, 2023

Just one comment. I tested this again today after the rebase and there are fewer warnings than last time I tested it, but it's still complaining about the unused quirks (those for the display controller models not in use). In my case, I'm using ili9342c, so it complains about the others:

zephyr/drivers/display/display_ili9xxx.c:435:68: warning: 'ili9488_quirks' defined but not used [-Wunused-const-variable=]
  435 | static const struct ili9xxx_quirks ili9340_quirks, ili9341_quirks, ili9488_quirks = {
      |                                                                    ^~~~~~~~~~~~~~
zephyr/drivers/display/display_ili9xxx.c:435:52: warning: 'ili9341_quirks' defined but not used [-Wunused-const-variable=]
  435 | static const struct ili9xxx_quirks ili9340_quirks, ili9341_quirks, ili9488_quirks = {
      |                                                    ^~~~~~~~~~~~~~
zephyr/drivers/display/display_ili9xxx.c:435:36: warning: 'ili9340_quirks' defined but not used [-Wunused-const-variable=]
  435 | static const struct ili9xxx_quirks ili9340_quirks, ili9341_quirks, ili9488_quirks = {

The code in display_ili9xxx.c is:

static const struct ili9xxx_quirks ili9340_quirks, ili9341_quirks, ili9488_quirks = {
	.cmd_set = CMD_SET_1,
};

static const struct ili9xxx_quirks ili9342c_quirks = {
	.cmd_set = CMD_SET_2,
};

Should we do something like?

#ifdef CONFIG_ILI9340
static const struct ili9xxx_quirks ili9340_quirks = {
	.cmd_set = CMD_SET_1,
};
#endif

#ifdef CONFIG_ILI9341
static const struct ili9xxx_quirks ili9341_quirks = {
	.cmd_set = CMD_SET_1,
};
#endif

#ifdef CONFIG_ILI9342C
static const struct ili9xxx_quirks ili9342c_quirks = {
	.cmd_set = CMD_SET_2,
};
#endif

#ifdef CONFIG_ILI9488
static const struct ili9xxx_quirks ili9488_quirks = {
	.cmd_set = CMD_SET_1,
};
#endif

Or even create one single structure and assign the .cmd_set using the defines? Probably finding a better name for ili9xxx_quirks_in_use:

static const struct ili9xxx_quirks ili9xxx_quirks_in_use = {
        #if defined(CONFIG_ILI9340) || defined(CONFIG_ILI9341) || defined(CONFIG_ILI9488)
 	.cmd_set = CMD_SET_1,
        #elif defined(CONFIG_ILI9342C)
        .cmd_set = CMD_SET_2,
        #endif
};

[...]
									       \
	static const struct ili9xxx_config ili9xxx_config_##n = {              \
		.quirks = &ili9xxx_quirks_in_use,  
[...]

Really keen on seeing this merged :)

Thanks!

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment. I tested this again today after the rebase and there are fewer warnings than last time I tested it, but it's still complaining about the unused quirks (those for the display controller models not in use)

Build warnings need to be addressed. Is there anything in-tree (i.e., sample or test) that builds this driver?

Comment on lines +71 to +84
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can simplify with DT_INST_PROP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ili9xxx drivers doesn't include DT_DRV_COMPAT value. so I chose to follow the other variants.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults need justification in the description

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults are the manufacturer defaults as mentioned in datasheet.

This driver implement basic functions of ili9342c controller
which comes mostly with IPS displays.

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
@ExtremeGTX
Copy link
Contributor Author

@diegoherranz
I went with the first way so if a system has 2 displays with different controllers will be able to enable both driver instances.
The problem with the 2nd solution is when CONFIG_ILI9340 and CONFIG_ILI9342c are defined at the same time.

@MaureenHelm asking for including this driver in (sample/test) or maybe a board like other ili9xxx drivers.
So, Do you @diegoherranz have a devkit where we can add so it compiles this driver in CI ? right now there isn't any config in Zephyr tree which enables this driver.

@diegoherranz
Copy link
Contributor

I went with the first way so if a system has 2 displays with different controllers will be able to enable both driver instances.
The problem with the 2nd solution is when CONFIG_ILI9340 and CONFIG_ILI9342c are defined at the same time.

Cool. It builds without warning to me now (and it works), using a ili9342c screen.

Do you @diegoherranz have a devkit where we can add so it compiles this driver in CI ? right now there isn't any config in Zephyr tree which enables this driver

I do but it is a proprietary/personal board. I don't mind sharing its board folder (DTS, defconfig, etc.), but not sure if that's OK to include in zephyr, not being a publicly available board. Just let me know.

Thanks!

@MaureenHelm
Copy link
Member

Another alternative would be to add display to tests/drivers/build_all

Add a blank test to cover building drivers that are in drivers/display/

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
@carlescufi carlescufi merged commit 8300e67 into zephyrproject-rtos:main May 19, 2023
@ExtremeGTX ExtremeGTX deleted the ili9342_driver branch May 22, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Devicetree Binding PR modifies or adds a Device Tree binding area: Display platform: ITE ITE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants