Re: State of affairs with Ilitek 9341 support

2023-12-22 Thread Dillon Min
On Mon, 11 Dec 2023 at 21:19, Andy Shevchenko
 wrote:
>
> On Fri, Dec 08, 2023 at 09:18:20PM +0100, Noralf Trønnes wrote:
> > On 12/8/23 17:00, Andy Shevchenko wrote:
> > > Included authors and latest (non-white-space) contributors to the drivers
> > > in question along with relevant mailing list and respective (active in the
> > > area) maintainers.
> > >
> > > I already had risen the question in times when 4th (sic!) driver for the 
> > > same
> > > hardware was about to be pulled into upstream that we have to somehow 
> > > reduce
> > > the code base and unify device properties.
> > >
> > > So, the main question here "What is the plan and where are we now?"
> > >
> > > I admit that fbtft case is special as it supports, in particular, platform
> > > device (parallel interface) and also well established in the embedded 
> > > world.
> > > What about the rest?
> > >
> > > N.B. Besides the fact that panel drivers are too OF-centric, which is bad
> > > practice for the new kernel code in general and has to be stopped. I.o.w.
> > > seeing of_property_*() or alike in the driver after ca. 2020 should be
> > > immediate NAK unless it's very well justified why it may not be used on
> > > non-OF systems.
>
> Noralf, thanks for your response, my comments below.
>
> TBH I would also like to hear from maintainers, because it seems they got
> an additional burden for no benefit.
>
> > Last year drivers/gpu/drm/tiny/panel-mipi-dbi.c was added to support all
> > MIPI DBI compatible (ili9341) SPI displays.
> > It loads the initialisation commands from a firmware file. For more info
> > see https://github.com/notro/panel-mipi-dbi/wiki.
> >
> > When I started on fbtft in 2013 I didn't know about MIPI DBI so I made
> > some common bus access functions and one driver per controller and that
> > driver had an initialisation sequence to match the panel I had. Then I
> > discovered that displays using the same controller could have different
> > init sequences so I added a Device Tree  property that could
> > override the driver init.
> >
> > In 2015 fbtft was added to drivers/staging, but later that year fbdev
> > was closed for new drivers so it was a dead end.
> >
> > I started to work on porting fbtft to DRM and almost 2 years later
> > support for the MI0283QT panel (ILI9341) was added.
> > I had now learned about MIPI DBI so a library to handle that was added.
> > I had asked on the Device Tree ML about the  property and I was
> > told that I couldn't have that which meant that I couldn't get away with
> > having just one driver for the MIPI DBI compatible display panels as I
> > was first hoping for.
> >
> > I was aware that there was a challenge going from fbtft to DRM because
> > in fbtft there is support for all panel setups using the 
> > property, but in DRM every panel needed support in a driver. So I
> > started to look at adding Device Tree properties to describe the setup
> > for one controller. This would make it easy to describe a new panel in
> > Device Tree for a supported controller. Maxime Ripard came up with the
> > idea to have the controller initialisation commands in a firmware file
> > which meant that we could get away with having just one driver for all
> > MIPI DBI SPI panels (which is the vast majority of these SPI pixel
> > upload panels).
> >
> > This meant that SPI support could be removed from all the MIPI DBI
> > compatible controllers in fbtft
>
> I believe it can't. Otherwise we _must_ provide the DT (device property)
> parser that uses what is provided for fbtft SPI to be enabled in the other
> driver.
>
> > since there's now a solution for them in
> > DRM. The drivers themselves must stay since they also have parallel bus
> > support which is lacking in DRM. My plan was to wait for panel-mipi-dbi
> > to hit an LTS and then either prepare patches to remove MIPI DBI SPI
> > support from fbtft or at least send an email to staging about the new
> > driver.
>
> > Unfortunately my health problems got worse and many plans went
> > out the window.
>
> Oh, sad to hear this, hope you will get better sooner than later!
>
> > ILI9341 DRM drivers
> >
> > - drivers/gpu/drm/tiny/mi0283qt.c
> >   This was the first driver added for the MI0283QT panel series
> >
> > - drivers/gpu/drm/tiny/ili9341.c
> >   Later ili9341 based panels was decided to be added to a controller
> >   specific driver.
>
> Why was it appeared in the first place? :-(
>
> > - drivers/gpu/drm/tiny/panel-mipi-dbi.c
> >   Generic MIPI DBI SPI driver that loads init commands from a firmware
> >   file. It uses of_property_read_string_index() and
> >   of_get_drm_panel_display_mode(). I don't know if it's possible to make
> >   device_property_*() versions of those.
>
> Everything like this is possible, just somebody needs to fulfill that.
> And as I said, new OF-centric code, has to be NAKed by default.
>
> > - drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> >   This driver supports the MIPI DPI (RGB) interface on the controller.
> >   

Re: [PATCH v4 0/3] Add ilitek ili9341 panel driver

2021-08-05 Thread Dillon Min
Hi Andy

Thanks for your question.

On Thu, 5 Aug 2021 at 18:16, Andy Shevchenko  wrote:
>
> On Sat, Jul 24, 2021 at 6:46 AM  wrote:
> >
> > From: Dillon Min 
> >
> > Since the st,sf-tc240t-9370-t dts binding already exist in 
> > stm32f429-disco.dts
> > but, the panel driver didn't get accepted from mainline. it's time to submit
> > patch fot it.
> >
> > This driver can support two different interface by different dts bindings:
> > - spi+dpi, use spi to configure register, dpi for graphic data.
> >   st,sf-tc240t-9370-t
> > - only spi, just like tiny/ili9341.c (actually, this part is copy from tiny)
> >   adafruit,yx240qv29
>
> ...
>
> > I was submited the first patch last year, you can find it at [1].
>
> submitted

Thanks.

>
> > this patch has one major difference from that one, which is replace the low
> > level communication way, from spi_sync() to mipi_dbi_{command,
> > command_stackbuf}() interface, referred from Linus's patch [2].
>
> Can you shed a light on the road map here.

Personally, I'd like to merge tiny/mi0283qt.c, tiny/ili9341.c(already
done) into this driver later
(keep original author, copyright, dts compatible string).
then remove these two drivers under tiny, but it's up to Sam and
Laurent agreement.

For long term, just like Peter suggested, let all panel based on
ili9xxx with single-dbi or dbi & dpi interface to be supported by
single ilitek-ili9xxx.c, something like panel/panel-simple.c
 (panel/panel-ilitek-ili9322c, tiny/ili9225.c, tiny/ili9486.c,
tiny/mi0283qt.c, etc).
it's also needs maintainers permission.

> I have the SPI panel (tiny) based on the ILI9341 and I'm using
> actually mi0283qt driver. With yours we will have 3 (three!) drivers
> for the same chip. I really do not want this. Without road map on the
> prospective of these all drivers, NAK.

Yes, it will make users confused if there are three different drivers
for the same chip.
I'll continue to work on this driver.

Thanks again for point this out.

Best Regards
Dillon

>
> --
> With Best Regards,
> Andy Shevchenko


Re: [PATCH v4 2/3] ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding

2021-08-05 Thread Dillon Min
Hi Linus

Thanks.

On Thu, 5 Aug 2021 at 17:11, Linus Walleij  wrote:
>
> On Sat, Jul 24, 2021 at 5:44 AM  wrote:
>
> > From: Dillon Min 
> >
> > Since the compatible string defined from ilitek,ili9341.yaml is
> > "st,sf-tc240t-9370-t", "ilitek,ili9341"
> >
> > so, append "ilitek,ili9341" to avoid the below dtbs_check warning.
> >
> > arch/arm/boot/dts/stm32f429-disco.dt.yaml: display@1: compatible:
> > ['st,sf-tc240t-9370-t'] is too short
> >
> > Fixes: a726e2f000ec ("ARM: dts: stm32: enable ltdc binding with ili9341, 
> > gyro l3gd20 on stm32429-disco board")
> > Signed-off-by: Dillon Min 
> > Reported-by: kernel test robot 
> > ---
> > v4: no change.
>
> Reviewed-by: Linus Walleij 
>
> Please funnel this patch through the STM and ARM SoC tree.

Sure, I will let Alex know. Thanks for your help on this driver.

Hi Alex,
Should I send v5 with Linus's Reviewed-by tag on this patch? thanks.

Best Regards
Dillon

>
> Yours,
> Linus Walleij


Re: [PATCH v4 0/3] Add ilitek ili9341 panel driver

2021-08-05 Thread Dillon Min
Hi All

Just a gentle ping, thanks.

Best regards.
Dillon

On Sat, 24 Jul 2021 at 11:44,  wrote:
>
> From: Dillon Min 
>
> Since the st,sf-tc240t-9370-t dts binding already exist in stm32f429-disco.dts
> but, the panel driver didn't get accepted from mainline. it's time to submit
> patch fot it.
>
> This driver can support two different interface by different dts bindings:
> - spi+dpi, use spi to configure register, dpi for graphic data.
>   st,sf-tc240t-9370-t
> - only spi, just like tiny/ili9341.c (actually, this part is copy from tiny)
>   adafruit,yx240qv29
>
> I was submited the first patch last year, you can find it at [1].
> this patch has one major difference from that one, which is replace the low
> level communication way, from spi_sync() to mipi_dbi_{command,
> command_stackbuf}() interface, referred from Linus's patch [2].
>
> both the two dpi/dbi interface was tested on stm32f429-disco board, if anyone
> want to verify this patch, you need apply the clk patch for this board first,
> you can get it from [3].
>
> [1] "drm/panel: Add ilitek ili9341 panel driver"
> https://lore.kernel.org/lkml/1590378348-8115-7-git-send-email-dillon.min...@gmail.com/
>
> [2] "drm/panel: s6e63m0: Switch to DBI abstraction for SPI"
> https://lore.kernel.org/dri-devel/20210611214243.669892-1-linus.wall...@linaro.org/
>
> [3]
> https://lore.kernel.org/lkml/1590378348-8115-6-git-send-email-dillon.min...@gmail.com/
>
> v4:
> - fix m68k-allmodconfig build error which reported by lkp, thanks.
> - add Copyright 2018 David Lechner .
> v3 link:
> https://lore.kernel.org/lkml/1627013203-23099-1-git-send-email-dillon.min...@gmail.com/
>
> v3:
> - add Fixes tags.
> - collect reviewed-by tags from linus and jagan.
> - replace DRM_ERROR() with dev_err() or drm_err().
> - remove kernel-doc markers from struct ili9341_config{}.
> - reorder include headers.
> - remove the struct device *dev from struct ili9341{}.
> - restructure the ili9341_probe() function, add two ili9341_{dbi,dpi)_probe()
>   to make it more readable according to jagan's suggestion, thanks.
>
> for the full drm driver exist in drm/panel need Sam and Laurent's feedback.
> so, not cover this part at this time, will be update later.
>
> v2 link:
> https://lore.kernel.org/lkml/1626853288-31223-1-git-send-email-dillon.min...@gmail.com/
>
> v2:
> - replace vcc regulator to bulk regulators in driver, from linus suggestion.
> - fix dtbs_check warnings on ili9341 dts binding check.
> - add bulk regulation node in ilitek,ili9341.yaml.
> v1 link:
> https://lore.kernel.org/lkml/1626430843-23823-1-git-send-email-dillon.min...@gmail.com/
>
> Dillon Min (3):
>   dt-bindings: display: panel: Add ilitek ili9341 panel bindings
>   ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding
>   drm/panel: Add ilitek ili9341 panel driver
>
>  .../bindings/display/panel/ilitek,ili9341.yaml |  78 ++
>  arch/arm/boot/dts/stm32f429-disco.dts  |   2 +-
>  drivers/gpu/drm/panel/Kconfig  |  12 +
>  drivers/gpu/drm/panel/Makefile |   1 +
>  drivers/gpu/drm/panel/panel-ilitek-ili9341.c   | 792 
> +
>  5 files changed, 884 insertions(+), 1 deletion(-)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
>  create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
>
> --
> 1.9.1
>


Re: [PATCH v2 3/3] drm/panel: Add ilitek ili9341 panel driver

2021-07-22 Thread Dillon Min
Hi Noralf,

On Thu, 22 Jul 2021 at 15:03, Noralf Trønnes  wrote:
>
>
>
> Den 22.07.2021 04.07, skrev Dillon Min:
> > Hi Noralf
> >
> > Thanks for your time to review my patch.
> >
> > On Thu, 22 Jul 2021 at 01:42, Noralf Trønnes  wrote:
> >>
> >>
> >>
> >> Den 21.07.2021 09.41, skrev dillon.min...@gmail.com:
> >>> From: Dillon Min 
> >>>
> >>> This driver combine tiny/ili9341.c mipi_dbi_interface driver
> >>> with mipi_dpi_interface driver, can support ili9341 with serial
> >>> mode or parallel rgb interface mode by register configuration.
> >>>
> >>> Cc: Linus Walleij 
> >>> Signed-off-by: Dillon Min 
> >>> ---
> >>
> >>> +static const struct of_device_id ili9341_of_match[] = {
> >>> + {
> >>> + .compatible = "st,sf-tc240t-9370-t",
> >>> + .data = _stm32f429_disco_data,
> >>> + },
> >>> + {
> >>> + /* porting from tiny/ili9341.c
> >>> +  * for original mipi dbi compitable
> >>> +  */
> >>> + .compatible = "adafruit,yx240qv29",
> >>
> >> I don't understand this, now there will be 2 drivers that support the
> >> same display?
> >
> > There is no reason to create two drivers to support the same display.
> >
> > To support only-dbi and dbi+dpi panel at drm/panel or drm/tiny both
> > fine with me.
> >
> >>
> >> AFAICT drm/tiny/ili9341.c is just copied into this driver, is the plan
> >> to remove the tiny/ driver? If so I couldn't see this mentioned anywhere.
> >
> > Yes, I'd like to merge the code from drm/tiny/ili9341.c to this driver
> > (to make a single driver to support different bus).
> >
> > I have two purpose to extend the feature drm/tiny/ili9341.c
> >
> > - keep compatible = "adafruit,yx240qv29", add bus mode dts bindings 
> > (panel_bus)
> >   to define the interface which host wants to use. such as
> > panel_bus="dbi" or "rgb"
> >   or "i80" for this case, i will add dpi code to drm/tiny/ili9341.c.
> >
> > - merge tiny/ili9341.c to this driver,remove drm/tiny/ili9341.c, add
> > new dts compatible
> >   string to support other interfaces. just like what i'm doing now.
> >
> > I have no idea about your plan on drm/tiny drivers, actually some of
> > these panels under
> > the diny folder can support both dbi and dbi+dpi (much faster, need
> > more pins). no
> > doubt the requirement to support dpi is always there.
> >
> > What is your preference?
> >
>
> I have no plans for tiny/, it's just a place to put tiny DRM drivers of
> all sorts.

Thanks for clarifying.

>
> Whether or not to have "full" DRM drivers in panel/ is up to Sam and
> Laurent I guess, currently there's only drm_panel drivers in there. I
> have no objections to doing that though.
>
> I just wanted to make sure we don't have 2 drivers for the same display.

Sure, agree with you, sorry for not mentioning it in the cover letter.
I'm waiting for Sam and Laurent's feedback, then submit v3 after that.

Best regards.
Dillon

>
> Noralf.
>
> > Thanks & Regards
> > Dillon
> >
> >>
> >> Noralf.
> >>
> >>> + .data = NULL,
> >>> + },
> >>> +};
> >>> +MODULE_DEVICE_TABLE(of, ili9341_of_match);


Re: [PATCH v2 3/3] drm/panel: Add ilitek ili9341 panel driver

2021-07-21 Thread Dillon Min
Hi Noralf

Thanks for your time to review my patch.

On Thu, 22 Jul 2021 at 01:42, Noralf Trønnes  wrote:
>
>
>
> Den 21.07.2021 09.41, skrev dillon.min...@gmail.com:
> > From: Dillon Min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
> >
> > Cc: Linus Walleij 
> > Signed-off-by: Dillon Min 
> > ---
>
> > +static const struct of_device_id ili9341_of_match[] = {
> > + {
> > + .compatible = "st,sf-tc240t-9370-t",
> > + .data = _stm32f429_disco_data,
> > + },
> > + {
> > + /* porting from tiny/ili9341.c
> > +  * for original mipi dbi compitable
> > +  */
> > + .compatible = "adafruit,yx240qv29",
>
> I don't understand this, now there will be 2 drivers that support the
> same display?

There is no reason to create two drivers to support the same display.

To support only-dbi and dbi+dpi panel at drm/panel or drm/tiny both
fine with me.

>
> AFAICT drm/tiny/ili9341.c is just copied into this driver, is the plan
> to remove the tiny/ driver? If so I couldn't see this mentioned anywhere.

Yes, I'd like to merge the code from drm/tiny/ili9341.c to this driver
(to make a single driver to support different bus).

I have two purpose to extend the feature drm/tiny/ili9341.c

- keep compatible = "adafruit,yx240qv29", add bus mode dts bindings (panel_bus)
  to define the interface which host wants to use. such as
panel_bus="dbi" or "rgb"
  or "i80" for this case, i will add dpi code to drm/tiny/ili9341.c.

- merge tiny/ili9341.c to this driver,remove drm/tiny/ili9341.c, add
new dts compatible
  string to support other interfaces. just like what i'm doing now.

I have no idea about your plan on drm/tiny drivers, actually some of
these panels under
the diny folder can support both dbi and dbi+dpi (much faster, need
more pins). no
doubt the requirement to support dpi is always there.

What is your preference?

Thanks & Regards
Dillon

>
> Noralf.
>
> > + .data = NULL,
> > + },
> > +};
> > +MODULE_DEVICE_TABLE(of, ili9341_of_match);


Re: [PATCH v2 3/3] drm/panel: Add ilitek ili9341 panel driver

2021-07-21 Thread Dillon Min
Hi Sam,

Thanks for your time on my code review.

On Thu, 22 Jul 2021 at 00:56, Sam Ravnborg  wrote:
>
> Hi Dillon,
>
> On Wed, Jul 21, 2021 at 03:41:28PM +0800, dillon.min...@gmail.com wrote:
> > From: Dillon Min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
> >
> > Cc: Linus Walleij 
> > Signed-off-by: Dillon Min 
>
> I have not looked at the driver before, sorry for being late.
> A few nits in the following.

That's fine. thanks.

>
> Sam
>
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
>
> Spaces between blocks of includes.
> So linux/* goes in one block, video/* in next block, drm/* in the last
> block.
> Sort alphabetically in each block.

I will add this change to v3. thanks.

>
> > +
> > +/**
> > + * struct ili9341_config - the system specific ILI9341 configuration
> > + * @max_spi_speed: 1000
> > + */
> Unless you plan to pull this into our kernel-doc there is really no need
> for a kernel-doc marker. On the other hand W=1 builds will tell if you
> missed something. So there are arguments both ways.

This driver was following the drm/panel/panel-ilitek-ili9322.c style,
I didn't realize the /** ... */ is the kernel-doc marker before. just because
W=1 report some warnings, so i add all this marker to struct ili9341_config

I will remove all the kernel-doc markers, and try to build with W=1
again, thanks.

>
> > +struct ili9341_config {
> > + u32 max_spi_speed;
> > + /** @mode: the drm display mode */
> > + const struct drm_display_mode mode;
> > + /** @ca: TODO: need comments for this register */
> > + u8 ca[ILI9341_CA_LEN];
> > + /** @power_b: TODO: need comments for this register */
> > + u8 power_b[ILI9341_POWER_B_LEN];
> > + /** @power_seq: TODO: need comments for this register */
> > + u8 power_seq[ILI9341_POWER_SEQ_LEN];
> > + /** @dtca: TODO: need comments for this register */
> > + u8 dtca[ILI9341_DTCA_LEN];
> > + /** @dtcb: TODO: need comments for this register */
> > + u8 dtcb[ILI9341_DTCB_LEN];
> > + /** @power_a: TODO: need comments for this register */
> > + u8 power_a[ILI9341_POWER_A_LEN];
> > + /** @frc: Frame Rate Control (In Normal Mode/Full Colors) (B1h) */
> > + u8 frc[ILI9341_FRC_LEN];
> > + /** @prc: TODO: need comments for this register */
> > + u8 prc;
> > + /** @dfc_1: B6h DISCTRL (Display Function Control) */
> > + u8 dfc_1[ILI9341_DFC_1_LEN];
> > + /** @power_1: Power Control 1 (C0h) */
> > + u8 power_1;
> > + /** @power_2: Power Control 2 (C1h) */
> > + u8 power_2;
> > + /** @vcom_1: VCOM Control 1(C5h) */
> > + u8 vcom_1[ILI9341_VCOM_1_LEN];
> > + /** @vcom_2: VCOM Control 2(C7h) */
> > + u8 vcom_2;
> > + /** @address_mode: Memory Access Control (36h) */
> > + u8 address_mode;
> > + /** @g3amma_en: TODO: need comments for this register */
> > + u8 g3amma_en;
> > + /** @rgb_interface: RGB Interface Signal Control (B0h) */
> > + u8 rgb_interface;
> > + /** @dfc_2: refer to dfc_1 */
> > + u8 dfc_2[ILI9341_DFC_2_LEN];
> > + /** @column_addr: Column Address Set (2Ah) */
> > + u8 column_addr[ILI9341_COLUMN_ADDR_LEN];
> > + /** @page_addr: Page Address Set (2Bh) */
> > + u8 page_addr[ILI9341_PAGE_ADDR_LEN];
> > + /** @interface: Interface Control (F6h) */
> > + u8 interface[ILI9341_INTERFACE_LEN];
> > + /** @pixel_format: This command sets the pixel format for the RGB */
> > + /* image data used by
> > +  */
> > + u8 pixel_format;
> > + /** @gamma_curve: This command is used to select the desired Gamma */
> > + /* curve for the
> > +  */
> Make this a single comment block.

Okay.

>
> > + u8 gamma_curve;
> > + /** @pgamma: Positive Gamma Correction (E0h) */
> > + u8 pgamma[ILI9341_PGAMMA_LEN];
> > + /** @ngamma: Negative Gamma Correction (E1h) */
> > + u8 ngamma[ILI9341_NGAMMA_LEN];
> > +};
> > +
> > +struct ili9341 {
> > + struct devic

Re: [PATCH v2 3/3] drm/panel: Add ilitek ili9341 panel driver

2021-07-21 Thread Dillon Min
Hi Jagan

Thanks for your time to review my code.

On Wed, 21 Jul 2021 at 23:48, Jagan Teki  wrote:
>
> On Wed, Jul 21, 2021 at 1:11 PM  wrote:
> >
> > From: Dillon Min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
> >
> > Cc: Linus Walleij 
> > Signed-off-by: Dillon Min 
> > ---
> > changes in v2:
> > - replace vcc regulator to three bulk regulators(vci, vddi, vddi-led)
> >   according to linus suggestion, thanks.
> >
> >  drivers/gpu/drm/panel/Kconfig|  12 +
> >  drivers/gpu/drm/panel/Makefile   |   1 +
> >  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 778 
> > +++
> >  3 files changed, 791 insertions(+)
> >  create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> >
> > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> > index ef87d92cdf49..eb34b8d1b19a 100644
> > --- a/drivers/gpu/drm/panel/Kconfig
> > +++ b/drivers/gpu/drm/panel/Kconfig
> > @@ -124,6 +124,18 @@ config DRM_PANEL_ILITEK_IL9322
> >   Say Y here if you want to enable support for Ilitek IL9322
> >   QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
> >
> > +config DRM_PANEL_ILITEK_ILI9341
> > +   tristate "Ilitek ILI9341 240x320 QVGA panels"
> > +   depends on OF && SPI
> > +   depends on DRM_KMS_HELPER
> > +   depends on DRM_KMS_CMA_HELPER
> > +   depends on BACKLIGHT_CLASS_DEVICE
> > +   select DRM_MIPI_DBI
> > +   help
> > + Say Y here if you want to enable support for Ilitek IL9341
> > + QVGA (240x320) RGB panels. support serial & parallel rgb
> > + interface.
> > +
> >  config DRM_PANEL_ILITEK_ILI9881C
> > tristate "Ilitek ILI9881C-based panels"
> > depends on OF
> > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> > index cae4d976c069..0ecde184665d 100644
> > --- a/drivers/gpu/drm/panel/Makefile
> > +++ b/drivers/gpu/drm/panel/Makefile
> > @@ -11,6 +11,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += 
> > panel-elida-kd35t133.o
> >  obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
> >  obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += 
> > panel-feiyang-fy07024di26a30d.o
> >  obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
> > +obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
> >  obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
> >  obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
> >  obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
> > diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
> > b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> > new file mode 100644
> > index ..717b0b930e2f
> > --- /dev/null
> > +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> > @@ -0,0 +1,778 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Ilitek ILI9341 TFT LCD drm_panel driver.
> > + *
> > + * This panel can be configured to support:
> > + * - 16-bit parallel RGB interface
> > + * - 18-bit parallel RGB interface
> > + * - 4-line serial spi interface
> > + *
> > + * Copyright (C) 2021 Dillon Min 
> > + * Derived from drivers/drm/gpu/panel/panel-ilitek-ili9322.c
> > + * the reuse of DBI abstraction part referred from Linus's patch
> > + * "drm/panel: s6e63m0: Switch to DBI abstraction for SPI"
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define ILI9341_RGB_INTERFACE  0xb0   /* RGB Interface Signal Control */
> > +#define ILI9341_FRC0xb1   /* Frame Rate Control register */
> > +#define ILI9341_DFC0xb6   /* Display Function Control register 
> > */
> > +#define ILI9341_POWER1 0xc0   /* Power Control 1 register */
> > +#define ILI9341_POWER2 0xc1   /* Power Control 2 register */
> > +#define ILI9341_VCOM1  0xc5   /* VCOM Control 1 register */
> > +#defi

Re: [PATCH v2 3/3] drm/panel: Add ilitek ili9341 panel driver

2021-07-21 Thread Dillon Min
On Wed, 21 Jul 2021 at 22:02, Linus Walleij  wrote:
>
> On Wed, Jul 21, 2021 at 9:41 AM  wrote:
>
> > From: Dillon Min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
> >
> > Cc: Linus Walleij 
> > Signed-off-by: Dillon Min 
> > ---
> > changes in v2:
> > - replace vcc regulator to three bulk regulators(vci, vddi, vddi-led)
> >   according to linus suggestion, thanks.
>
> This is a really nice driver.

Thanks, all the code here is inspired by your recent patches.
Really appreciate your time to help me.

Thanks & Regards
Dillon

>
> Reviewed-by: Linus Walleij 
>
> Yours,
> Linus Walleij


Re: [PATCH v2 2/3] ARM: dts: stm32: fix dtbs_check warning on ili9341 dts binding

2021-07-21 Thread Dillon Min
Hi Alex,

I suppose you will going to review this patch,
I forgot to add the Fixes tag in v2, just add it.
I will submit v3 to add this tag in case necessary.

Thanks, Best Regards.
Dillon

On Wed, 21 Jul 2021 at 15:41,  wrote:
>
> From: Dillon Min 
>
> Since the compatible string defined from ilitek,ili9341.yaml is
> "st,sf-tc240t-9370-t", "ilitek,ili9341"
>
> so, append "ilitek,ili9341" to avoid below dtbs_check warning.
>
> arch/arm/boot/dts/stm32f429-disco.dt.yaml: display@1: compatible:
> ['st,sf-tc240t-9370-t'] is too short
>

It's should be a Fixes tag here.

Fixes: a726e2f000ec ("ARM: dts: stm32: enable ltdc binding with
ili9341, gyro l3gd20 on stm32429-disco board")

> Signed-off-by: Dillon Min 
> Reported-by: kernel test robot 
> ---
>  arch/arm/boot/dts/stm32f429-disco.dts | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/stm32f429-disco.dts 
> b/arch/arm/boot/dts/stm32f429-disco.dts
> index 075ac57d0bf4..6435e099c632 100644
> --- a/arch/arm/boot/dts/stm32f429-disco.dts
> +++ b/arch/arm/boot/dts/stm32f429-disco.dts
> @@ -192,7 +192,7 @@
>
> display: display@1{
> /* Connect panel-ilitek-9341 to ltdc */
> -   compatible = "st,sf-tc240t-9370-t";
> +   compatible = "st,sf-tc240t-9370-t", "ilitek,ili9341";
> reg = <1>;
> spi-3wire;
> spi-max-frequency = <1000>;
> --
> 2.7.4
>


Re: [PATCH 1/2] dt-bindings: display: panel: Add ilitek ili9341 panel bindings

2021-07-21 Thread Dillon Min
Hi Kernel test robot,

Thanks for your time to test my patch.

I did the dtbs_check on my side, and got the same warnings.

But I guess these warnings do not come from this submission,
So, I will not be going to fix it at this time, but will at other
submissions
to fix these, add arm,armv7m-nvic.yaml ... to describe compatibles, etc.

by the way, i did find a warning from the stm32f429-disco.dts and fixt it
in "[PATCH v2 2/3] ARM: dts: stm32: fix dtbs_check warning on ili9341
dts binding",

the warning:
arch/arm/boot/dts/stm32f429-disco.dt.yaml: display@1: compatible:
['st,sf-tc240t-9370-t'] is too short

my make command:
make ARCH=arm dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml

Best regards
thanks

Dillon

On Tue, 20 Jul 2021 at 14:12, kernel test robot  wrote:

> Hi,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on robh/for-next]
> [also build test WARNING on linus/master v5.14-rc2 next-20210719]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url:
> https://github.com/0day-ci/linux/commits/dillon-minfei-gmail-com/Add-ilitek-ili9341-panel-driver/20210718-103113
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
> for-next
> compiler: arm-linux-gnueabi-gcc (GCC) 10.3.0
> reproduce: make ARCH=arm dtbs_check
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
>
>
> dtcheck warnings: (new ones prefixed by >>)
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0:
> /interrupt-controller@e000e100: failed to match any schema with
> compatible: ['arm,armv7m-nvic']
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0: /timer@e000e010: failed
> to match any schema with compatible: ['arm,armv7m-systick']
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0: /soc/i2c@40005c00
> /stmpe811@41: failed to match any schema with compatible: ['st,stmpe811']
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0: /soc/i2c@40005c00
> /stmpe811@41/stmpe_touchscreen: failed to match any schema with
> compatible: ['st,stmpe-ts']
>arch/arm/boot/dts/stm32f429-disco.dt.yaml: l3gd20@0:
> 'spi-max-frequency' does not match any of the regexes: 'pinctrl-[0-9]+'
> From schema:
> Documentation/devicetree/bindings/iio/st,st-sensors.yaml
> >> arch/arm/boot/dts/stm32f429-disco.dt.yaml: display@1: compatible:
> ['st,sf-tc240t-9370-t'] is too short
> From schema:
> Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0: /soc/crc@40023000:
> failed to match any schema with compatible: ['st,stm32f4-crc']
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0: /soc/rcc@40023800:
> failed to match any schema with compatible: ['st,stm32f42xx-rcc',
> 'st,stm32-rcc']
>arch/arm/boot/dts/stm32f429-disco.dt.yaml:0:0: /soc/rcc@40023800:
> failed to match any schema with compatible: ['st,stm32f42xx-rcc',
> 'st,stm32-rcc']
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
>


Re: [PATCH 1/2] dt-bindings: display: panel: Add ilitek ili9341 panel bindings

2021-07-21 Thread Dillon Min
Hi Linus,

Thanks for your detailed reply.

On Sun, 18 Jul 2021 at 08:17, Linus Walleij 
wrote:

> Hi Dillon,
>
> thanks for your patch!
>
> On Fri, Jul 16, 2021 at 12:20 PM  wrote:
>
> > From: Dillon Min 
> >
> > Add documentation for "ilitek,ili9341" panel.
> >
> > Signed-off-by: Dillon Min 
>
> > +  dc-gpios:
> > +maxItems: 1
> > +description: Display data/command selection (D/CX)
>
> This is a DBI feature so mention in the description that this is a
> DBI panel.
>

Okay, I will add the DBI panel to v2.


>
> > +  spi-3wire: true
> > +
> > +  spi-max-frequency:
> > +const: 1000
> > +
> > +  port: true
> > +
> > +additionalProperties: false
>
> Please add regulator supplies for the power lines, it's fine
> not to implement code handling them in the driver but they
> should be in the bindings.
>
> For the ili9341 it should be
>
>   vci-supply:
> description: Analog voltage supply (2.5 .. 3.3V)
>
>   vddi-supply:
> description: Voltage supply for interface logic (1.65 .. 3.3 V)
>
>   vddi-led-supply:
> description: Voltage supply for the LED driver (1.65 .. 3.3 V)
>
>
Thanks so much, I will add it to v2.


> Yours,
> Linus Walleij
>


Re: [PATCH 2/2] drm/panel: Add ilitek ili9341 panel driver

2021-07-21 Thread Dillon Min
Hi Linus,

Thanks for your detailed review.

On Sun, 18 Jul 2021 at 08:31, Linus Walleij 
wrote:

> Hi Dillon,
>
> thanks for your patch!
>
> On Fri, Jul 16, 2021 at 12:20 PM  wrote:
>
> > From: Dillon Min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
> >
> > Signed-off-by: Dillon Min 
>
> Nice!
>
> > +config DRM_PANEL_ILITEK_ILI9341
> > +   tristate "Ilitek ILI9341 240x320 QVGA panels"
> > +   depends on OF && SPI
> > +   depends on DRM_KMS_HELPER
> > +   depends on DRM_KMS_CMA_HELPER
> (...)
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
>
> Hm now there is a (partial) KMS driver in the panel driver, kinda, sorta.
> Is this the right split? I'm not the best with DRM infrastructure,
> just asking.
>

I tried to remove one of these two headers, but got compile errors:

linux/drivers/gpu/drm/panel/panel-ilitek-ili9341.c:719:3: error: implicit
declaration of function 'drm_atomic_helper_shutdown' [-Werror
=implicit-function-declaration]
  719 |   drm_atomic_helper_shutdown(drm);
  |   ^~
or

linux/drivers/gpu/drm/panel/panel-ilitek-ili9341.c:562:16: error:
'drm_gem_simple_display_pipe_prepare_fb' undeclared here (not in a function)
  562 |  .prepare_fb = drm_gem_simple_display_pipe_prepare_fb,
  |^~

Actually, these two headers are merged from tiny/ili9341.c to support only-
DBI interface, I'm
not sure whether the maintainers will ask me to remove (tiny/ili9341.c)
code from this patch.
If so, I will remove these headers.

But, It's a little strange to support different interfaces from different
drivers.


> > +struct ili9341_config {
> > +   u32 max_spi_speed;
> > +   /** @mode: the drm display mode */
> > +   const struct drm_display_mode mode;
> > +   /* @ca: TODO: need comments for this register */
> > +   u8 ca[ILI9341_CA_LEN];
>
> These are all in the datasheet but I guess you plan to add these
> TODOs later. (It's fine I suppose, the driver is already very nice.)
>

Yes, I didn't get detailed information about these registers from this
panel datasheet, so leave TODOs here.


> > +   struct regulator *vcc;
>
> Use the right name of the pin for the regulator. I guess this is actually
> vci. I would implement all three regulators and get them as bulk.
> See e.g. drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
> for an example on how to get and enable several regulators
> using bulk.
>
> The regulator framework will provide dummy regulators if you
> didn't define some of them so it is fine to just provide one or two.
>
>
Really appreciate your suggestion, will add to v2.


> Yours,
> Linus Walleij
>


Re: [PATCH 2/4] i2c: stm32f4: Fix stmpe811 get xyz data timeout issue

2021-06-01 Thread Dillon Min
Hi Patrice, Pierre-Yves, Alain

On Tue, Jun 1, 2021 at 7:43 PM Patrice CHOTARD
 wrote:
>
> Hi Dillon
>
> On 5/14/21 1:02 PM, dillon.min...@gmail.com wrote:
> > From: Dillon Min 
> >
> > As stm32f429's internal flash is 2Mbytes and compiled kernel
> > image bigger than 2Mbytes, so we have to load kernel image
> > to sdram on stm32f429-disco board which has 8Mbytes sdram space.
> >
> > based on above context, as you knows kernel running on external
> > sdram is more slower than internal flash. besides, we need read 4
> > bytes to get touch screen xyz(x, y, pressure) coordinate data in
> > stmpe811 interrupt.
> >
> > so, in stm32f4_i2c_handle_rx_done, as i2c read slower than running
> > in xip mode, have to adjust 'STOP/START bit set position' from last
> > two bytes to last one bytes. else, will get i2c timeout in reading
> > touch screen coordinate.
> >
> > to not bring in side effect, introduce IIC_LAST_BYTE_POS to support xip
> > kernel or zImage.
> >
> > Fixes: 62817fc8d282 ("i2c: stm32f4: add driver")
> > Link: 
> > https://lore.kernel.org/lkml/1591709203-12106-5-git-send-email-dillon.min...@gmail.com/
> > Signed-off-by: Dillon Min 
> > ---
> >  drivers/i2c/busses/i2c-stm32f4.c | 12 +---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-stm32f4.c 
> > b/drivers/i2c/busses/i2c-stm32f4.c
> > index 4933fc8ce3fd..2e41231b9037 100644
> > --- a/drivers/i2c/busses/i2c-stm32f4.c
> > +++ b/drivers/i2c/busses/i2c-stm32f4.c
> > @@ -93,6 +93,12 @@
> >  #define STM32F4_I2C_MAX_FREQ 46U
> >  #define HZ_TO_MHZ100
> >
> > +#if !defined(CONFIG_MMU) && !defined(CONFIG_XIP_KERNEL)
> > +#define IIC_LAST_BYTE_POS 1
> > +#else
> > +#define IIC_LAST_BYTE_POS 2
> > +#endif
> > +
> >  /**
> >   * struct stm32f4_i2c_msg - client specific data
> >   * @addr: 8-bit slave addr, including r/w bit
> > @@ -439,7 +445,7 @@ static void stm32f4_i2c_handle_rx_done(struct 
> > stm32f4_i2c_dev *i2c_dev)
> >   int i;
> >
> >   switch (msg->count) {
> > - case 2:
> > + case IIC_LAST_BYTE_POS:
> >   /*
> >* In order to correctly send the Stop or Repeated Start
> >* condition on the I2C bus, the STOP/START bit has to be set
> > @@ -454,7 +460,7 @@ static void stm32f4_i2c_handle_rx_done(struct 
> > stm32f4_i2c_dev *i2c_dev)
> >   else
> >   stm32f4_i2c_set_bits(reg, STM32F4_I2C_CR1_START);
> >
> > - for (i = 2; i > 0; i--)
> > + for (i = IIC_LAST_BYTE_POS; i > 0; i--)
> >   stm32f4_i2c_read_msg(i2c_dev);
> >
> >   reg = i2c_dev->base + STM32F4_I2C_CR2;
> > @@ -463,7 +469,7 @@ static void stm32f4_i2c_handle_rx_done(struct 
> > stm32f4_i2c_dev *i2c_dev)
> >
> >   complete(_dev->complete);
> >   break;
> > - case 3:
> > + case (IIC_LAST_BYTE_POS+1):
> >   /*
> >* In order to correctly generate the NACK pulse after the 
> > last
> >* received data byte, we have to enable NACK before reading 
> > N-2
> >
>
> I tested this patch on STM32F429-Disco, it fixes the issue described by 
> Dillon.
> But i think it's not a good idea to make usage of #if !defined(CONFIG_MMU) && 
> !defined(CONFIG_XIP_KERNEL)
> inside the driver code.

Hi Patrice,
Thanks for your time.

How about introducing a dts node for this purpose.
like
stm32-i2c,last-byte-pos = <1>;
or
stm32-i2c,last-byte-pos = <2>;

if not set, the default value is 2

Best Regards
Dillon

>
> Pierre-Yves, Alain, as i am not I2C expert, can you have a look at this patch 
> and propose another solution
> to fix the original issue described by Dillon ?
>
> Thanks
> Patrice


Re: [PATCH 0/4] Fix the i2c/clk bug of stm32 mcu platform

2021-05-31 Thread Dillon Min
Hi Patrice

On Mon, May 31, 2021 at 10:58 PM Patrice CHOTARD
 wrote:
>
> Hi Dillon
>
> On 5/31/21 4:29 PM, Dillon Min wrote:
> > Hi Patrice
> >
> > On Mon, May 31, 2021 at 9:51 PM Patrice CHOTARD
> >  wrote:
> >>
> >>
> >>
> >> On 5/31/21 3:38 PM, Dillon Min wrote:
> >>> Hi Patrice
> >>>
> >>> Thanks for your time to test my patch.
> >>>
> >>> On Mon, May 31, 2021 at 9:20 PM Patrice CHOTARD
> >>>  wrote:
> >>>>
> >>>> Hi Dillon
> >>>>
> >>>>
> >>>>
> >>>> On 5/14/21 1:02 PM, dillon.min...@gmail.com wrote:
> >>>>> From: Dillon Min 
> >>>>>
> >>>>> This seriese fix three i2c/clk bug for stm32 f4/f7
> >>>>> - kernel runing in sdram, i2c driver get data timeout
> >>>>> - ltdc clk turn off after kernel console active
> >>>>> - kernel hang in set ltdc clock rate
> >>>>>
> >>>>> clk bug found on stm32f429/f469-disco board
> >>>>>
> >>>>> Hi Patrice:
> >>>>> below is the guide to verify the patch:
> >>>>>
> >>>>> setup test env with following files(link at below 'files link'):
> >>>>> [1] u-boot-dtb.bin
> >>>>> [2] rootfs zip file (used in kernel initramfs)
> >>>>> [3] u-boot's mkimage to create itb file
> >>>>> [4] kernel config file
> >>>>> [5] my itb with-or-without i2c patch
> >>>>>
> >>>>> This patch based on kernel commit:
> >>>>> 88b06399c9c766c283e070b022b5ceafa4f63f19
> >>>>>
> >>>>> Note:
> >>>>> panel-ilitek-ili9341.c is the driver which was submitted last year, but 
> >>>>> not
> >>>>> get accepted. it's used to setup touch screen calibration, then test 
> >>>>> i2c.
> >>>>>
> >>>>> create itb file(please correct path of 'data'):
> >>>>> ./mkimage -f stm32.its stm32.itb
> >>>>>
> >>>>> HW setup:
> >>>>> console:
> >>>>>PA9, PA10
> >>>>>usart0
> >>>>>serial@40011000
> >>>>>115200 8n1
> >>>>>
> >>>>> -- flash u-boot.bin to stm32f429-disco on PC
> >>>>> $ sudo openocd -f board/stm32f429discovery.cfg -c \
> >>>>>   '{PATH-TO-YOUR-UBOOT}/u-boot-dtb.bin 0x0800 exit reset'
> >>>>>
> >>>>> -- setup kernel load bootargs at u-boot
> >>>>> U-Boot > setenv bootargs 'console=tty0 console=ttySTM0,115200
> >>>>> root=/dev/ram rdinit=/linuxrc loglevel=8 
> >>>>> fbcon=rotate:2'
> >>>>> U-Boot > loady;bootm
> >>>>> (download stm32.dtb or your kernel with itb format, or download zImage, 
> >>>>> dtb)
> >>>>>
> >>>>
> >>>>
> >>>> Thanks for these informations
> >>>> I was able to load and boot DTB and uImage directly in SDRAM as you 
> >>>> suggested,
> >>>> i saw Linux logo and kernel log on the STM32F429-disco display,
> >>>> but i can't reach the login.
> >>>>
> >>>> The last kernel log i got is :
> >>>>
> >>>> Starting kernel ...
> >>>>
> >>>> [0.00] Booting Linux on physical CPU 0x0
> >>>> [0.00] Linux version 5.13.0-rc1-00082-g9dbbd5cb6240-dirty 
> >>>> (nxp11987@lmecxl0573.lme1
> >>>> [0.00] CPU: ARMv7-M [410fc241] revision 1 (ARMv7M), cr=
> >>>> [0.00] CPU: unknown data cache, unknown instruction cache
> >>>> [0.00] OF: fdt: Machine model: STMicroelectronics 
> >>>> STM32F429i-DISCO board
> >>>> [0.00] Zone ranges:
> >>>> [0.00]   Normal   [mem 0x9000-0x907f]
> >>>> [0.00] Movable zone start for each node
> >>>> [0.00] Early memory node ranges
> >>>>
> >>>> [...]
> >>>>
> >>>> [2.637564] printk: console [ttySTM0] enabled
> >>>> [2.747984] panel-ilitek-ili9341 spi0.1: get optional vcc failed
> >>>> [ 

Re: [PATCH 1/4] drm/panel: Add ilitek ili9341 panel driver

2021-05-31 Thread Dillon Min
Hi Patrice

On Mon, May 31, 2021 at 9:39 PM Dillon Min  wrote:
>
> On Mon, May 31, 2021 at 9:15 PM Patrice CHOTARD
>  wrote:
> >
> > Hi Dillon
> >
> > When trying to applying this patch using "git am --3 "  i got this 
> > error :
> >
> > error: cannot convert from y to UTF-8
> > fatal: could not parse patch
> >
> > Whereas i got no similar error with the other patch 2/3 and 4.
> >
> > I find a way to apply it anyway.
>
> Sorry for the inconvenience, I will double verify the 'git am' process
> on this patch later.

I can't reproduce this on my side.

fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$ git --version
git version 2.7.4
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$ git am --3
../miss-c/v1/0001-drm-panel-Add-ilitek-ili9341-panel-driver.patch
Applying: drm/panel: Add ilitek ili9341 panel driver
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$ git am --3
../miss-c/v1/0002-i2c-stm32f4-Fix-stmpe811-get-xyz-data-timeout-issue.patch
Applying: i2c: stm32f4: Fix stmpe811 get xyz data timeout issue
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$ git am --3
../miss-c/v1/0003-clk-stm32-Fix-stm32f429-s-ltdc-driver-hang-in-set-cl.patch
Applying: clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$ git am --3
../miss-c/v1/0004-clk-stm32-Fix-ltdc-s-clock-turn-off-by-clk_disable_u.patch
Applying: clk: stm32: Fix ltdc's clock turn off by
clk_disable_unused() after kernel startup
fmin@fmin-OptiPlex-7060:~/work/kernel/up/linux$ git log
commit bbd74144f015b7a81d728f4c942925c74b415b97
Author: Dillon Min 
Date:   Fri May 14 18:18:45 2021 +0800

clk: stm32: Fix ltdc's clock turn off by clk_disable_unused()
after kernel startup

stm32's clk driver register two ltdc gate clk to clk core by
clk_hw_register_gate() and clk_hw_register_composite()

first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver

both of them point to the same offset of stm32's RCC register. after
kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]'
is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.

Fixes: daf2d117cbca ("clk: stm32f4: Add lcd-tft clock")
Signed-off-by: Dillon Min 
Acked-by: Stephen Boyd 
Link: 
https://lore.kernel.org/linux-arm-kernel/1590564453-24499-7-git-send-email-dillon.min...@gmail.com/

commit 9923957735ad0ae3e9da7f35f9bf83d6882499c6
Author: Dillon Min 
Date:   Fri May 14 18:15:06 2021 +0800

clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate

This is due to misuse ‘PLL_VCO_SAI' and'PLL_SAI' in clk-stm32f4.c
'PLL_SAI' is 2, 'PLL_VCO_SAI' is 7(defined in
include/dt-bindings/clock/stm32fx-clock.h).

'post_div' point to 'post_div_data[]', 'post_div->pll_num'
is PLL_I2S or PLL_SAI.

'clks[PLL_VCO_SAI]' has valid 'struct clk_hw* ' return
from stm32f4_rcc_register_pll() but, at line 1777 of
driver/clk/clk-stm32f4.c, use the 'clks[post_div->pll_num]',
equal to 'clks[PLL_SAI]', this is invalid array member at that time.

Fixes: 517633ef630e ("clk: stm32f4: Add post divisor for I2S & SAI PLLs")
Signed-off-by: Dillon Min 
Acked-by: Stephen Boyd 
Link: 
https://lore.kernel.org/linux-arm-kernel/1590564453-24499-6-git-send-email-dillon.min...@gmail.com/

commit eeade16ed602079c9f469692a543ff00fd527a1c
Author: Dillon Min 
Date:   Fri May 14 17:29:47 2021 +0800

i2c: stm32f4: Fix stmpe811 get xyz data timeout issue

As stm32f429's internal flash is 2Mbytes and compiled kernel
image bigger than 2Mbytes, so we have to load kernel image
to sdram on stm32f429-disco board which has 8Mbytes sdram space.

based on above context, as you knows kernel running on external
sdram is more slower than internal flash. besides, we need read 4
bytes to get touch screen xyz(x, y, pressure) coordinate data in
stmpe811 interrupt.

so, in stm32f4_i2c_handle_rx_done, as i2c read slower than running
in xip mode, have to adjust 'STOP/START bit set position' from last
two bytes to last one bytes. else, will get i2c timeout in reading
touch screen coordinate.

to not bring in side effect, introduce IIC_LAST_BYTE_POS to support xip
kernel or zImage.

Fixes: 62817fc8d282 ("i2c: stm32f4: add driver")
Link: 
https://lore.kernel.org/lkml/1591709203-12106-5-git-send-email-dillon.min...@gmail.com/
Signed-off-by: Dillon Min 

commit 8de9a39

Re: [PATCH 0/4] Fix the i2c/clk bug of stm32 mcu platform

2021-05-31 Thread Dillon Min
Hi Patrice

On Mon, May 31, 2021 at 9:51 PM Patrice CHOTARD
 wrote:
>
>
>
> On 5/31/21 3:38 PM, Dillon Min wrote:
> > Hi Patrice
> >
> > Thanks for your time to test my patch.
> >
> > On Mon, May 31, 2021 at 9:20 PM Patrice CHOTARD
> >  wrote:
> >>
> >> Hi Dillon
> >>
> >>
> >>
> >> On 5/14/21 1:02 PM, dillon.min...@gmail.com wrote:
> >>> From: Dillon Min 
> >>>
> >>> This seriese fix three i2c/clk bug for stm32 f4/f7
> >>> - kernel runing in sdram, i2c driver get data timeout
> >>> - ltdc clk turn off after kernel console active
> >>> - kernel hang in set ltdc clock rate
> >>>
> >>> clk bug found on stm32f429/f469-disco board
> >>>
> >>> Hi Patrice:
> >>> below is the guide to verify the patch:
> >>>
> >>> setup test env with following files(link at below 'files link'):
> >>> [1] u-boot-dtb.bin
> >>> [2] rootfs zip file (used in kernel initramfs)
> >>> [3] u-boot's mkimage to create itb file
> >>> [4] kernel config file
> >>> [5] my itb with-or-without i2c patch
> >>>
> >>> This patch based on kernel commit:
> >>> 88b06399c9c766c283e070b022b5ceafa4f63f19
> >>>
> >>> Note:
> >>> panel-ilitek-ili9341.c is the driver which was submitted last year, but 
> >>> not
> >>> get accepted. it's used to setup touch screen calibration, then test i2c.
> >>>
> >>> create itb file(please correct path of 'data'):
> >>> ./mkimage -f stm32.its stm32.itb
> >>>
> >>> HW setup:
> >>> console:
> >>>PA9, PA10
> >>>usart0
> >>>serial@40011000
> >>>115200 8n1
> >>>
> >>> -- flash u-boot.bin to stm32f429-disco on PC
> >>> $ sudo openocd -f board/stm32f429discovery.cfg -c \
> >>>   '{PATH-TO-YOUR-UBOOT}/u-boot-dtb.bin 0x0800 exit reset'
> >>>
> >>> -- setup kernel load bootargs at u-boot
> >>> U-Boot > setenv bootargs 'console=tty0 console=ttySTM0,115200
> >>> root=/dev/ram rdinit=/linuxrc loglevel=8 
> >>> fbcon=rotate:2'
> >>> U-Boot > loady;bootm
> >>> (download stm32.dtb or your kernel with itb format, or download zImage, 
> >>> dtb)
> >>>
> >>
> >>
> >> Thanks for these informations
> >> I was able to load and boot DTB and uImage directly in SDRAM as you 
> >> suggested,
> >> i saw Linux logo and kernel log on the STM32F429-disco display,
> >> but i can't reach the login.
> >>
> >> The last kernel log i got is :
> >>
> >> Starting kernel ...
> >>
> >> [0.00] Booting Linux on physical CPU 0x0
> >> [0.00] Linux version 5.13.0-rc1-00082-g9dbbd5cb6240-dirty 
> >> (nxp11987@lmecxl0573.lme1
> >> [0.00] CPU: ARMv7-M [410fc241] revision 1 (ARMv7M), cr=
> >> [0.00] CPU: unknown data cache, unknown instruction cache
> >> [0.00] OF: fdt: Machine model: STMicroelectronics STM32F429i-DISCO 
> >> board
> >> [0.00] Zone ranges:
> >> [0.00]   Normal   [mem 0x9000-0x907f]
> >> [0.00] Movable zone start for each node
> >> [0.00] Early memory node ranges
> >>
> >> [...]
> >>
> >> [2.637564] printk: console [ttySTM0] enabled
> >> [2.747984] panel-ilitek-ili9341 spi0.1: get optional vcc failed
> >> [2.758986] spi_stm32 40015000.spi: driver initialized
> >> [2.795733] i2c /dev entries driver
> >> [2.849955] stmpe-i2c 0-0041: stmpe811 detected, chip id: 0x811
> >> [2.922030] stmpe-ts stmpe-ts: DMA mask not set
> >> [2.965729] input: stmpe-ts as 
> >> /devices/platform/soc/40005c00.i2c/i2c-0/0-0041/stmpe-ts0
> >> [2.991570] stm32f4-i2c 40005c00.i2c: STM32F4 I2C driver registered
> >> [3.058262] [drm] Initialized stm 1.0.0 20170330 for 
> >> 40016800.display-controller on min0
> >> [3.665951] panel-ilitek-ili9341 spi0.1: initialized display rgb 
> >> interface
> >> [3.765208] Console: switching to colour frame buffer device 30x40
> >> [4.014269] stm32-display 40016800.display-controller: [drm] fb0: 
> >> stmdrmfb frame buffere
> >> [4.212737] Freeing unused kernel memory: 324K
>

Re: [PATCH 1/4] drm/panel: Add ilitek ili9341 panel driver

2021-05-31 Thread Dillon Min
On Mon, May 31, 2021 at 9:15 PM Patrice CHOTARD
 wrote:
>
> Hi Dillon
>
> When trying to applying this patch using "git am --3 "  i got this 
> error :
>
> error: cannot convert from y to UTF-8
> fatal: could not parse patch
>
> Whereas i got no similar error with the other patch 2/3 and 4.
>
> I find a way to apply it anyway.

Sorry for the inconvenience, I will double verify the 'git am' process
on this patch later.

Thanks.

Best Regards
Dillon

>
> Patrice
>
>
> On 5/14/21 1:02 PM, dillon.min...@gmail.com wrote:
> > From: Dillon Min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
> >
> > Reviewed-by: Linus Walleij 
> > Link: 
> > https://lore.kernel.org/lkml/1590378348-8115-7-git-send-email-dillon.min...@gmail.com/
> > Signed-off-by: Dillon Min 
> > ---
> >  drivers/gpu/drm/panel/Kconfig|   12 +
> >  drivers/gpu/drm/panel/Makefile   |1 +
> >  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 1285 
> > ++
> >  3 files changed, 1298 insertions(+)
> >  create mode 100755 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> >
> > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> > index 4894913936e9..e4babba17864 100644
> > --- a/drivers/gpu/drm/panel/Kconfig
> > +++ b/drivers/gpu/drm/panel/Kconfig
> > @@ -123,6 +123,18 @@ config DRM_PANEL_ILITEK_IL9322
> > Say Y here if you want to enable support for Ilitek IL9322
> > QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
> >
> > +config DRM_PANEL_ILITEK_ILI9341
> > + tristate "Ilitek ILI9341 240x320 QVGA panels"
> > + depends on OF && SPI
> > + depends on DRM_KMS_HELPER
> > + depends on DRM_KMS_CMA_HELPER
> > + depends on BACKLIGHT_CLASS_DEVICE
> > + select DRM_MIPI_DBI
> > + help
> > +   Say Y here if you want to enable support for Ilitek IL9341
> > +   QVGA (240x320) RGB panels. support serial & parallel rgb
> > +   interface.
> > +
> >  config DRM_PANEL_ILITEK_ILI9881C
> >   tristate "Ilitek ILI9881C-based panels"
> >   depends on OF
> > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> > index cae4d976c069..0ecde184665d 100644
> > --- a/drivers/gpu/drm/panel/Makefile
> > +++ b/drivers/gpu/drm/panel/Makefile
> > @@ -11,6 +11,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += 
> > panel-elida-kd35t133.o
> >  obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
> >  obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += 
> > panel-feiyang-fy07024di26a30d.o
> >  obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
> > +obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
> >  obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
> >  obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
> >  obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
> > diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c 
> > b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> > new file mode 100644
> > index ..f84983cbb250
> > --- /dev/null
> > +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> > @@ -0,0 +1,1285 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Ilitek ILI9341 TFT LCD drm_panel driver.
> > + *
> > + * This panel can be configured to support:
> > + * - 16-bit parallel RGB interface
> > + * - 18-bit parallel RGB interface
> > + * - 4-line serial spi interface
> > + *
> > + * Copyright (C) 2020 Dillon Min 
> > + * Derived from drivers/drm/gpu/panel/panel-ilitek-ili9322.c
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define ILI9341_RGB_INTERFACE  0xb0   /* RGB Interface Signal Control */
> > +#define ILI9341_FRC0xb1   /* Frame Rate Control register */
> > +#define ILI9341_DFC0xb6   /* Display Function Control register 
> > */
> > +#define ILI9341_POWER1 0xc0   /* Power Control

Re: [PATCH 0/4] Fix the i2c/clk bug of stm32 mcu platform

2021-05-31 Thread Dillon Min
Hi Patrice

Thanks for your time to test my patch.

On Mon, May 31, 2021 at 9:20 PM Patrice CHOTARD
 wrote:
>
> Hi Dillon
>
>
>
> On 5/14/21 1:02 PM, dillon.min...@gmail.com wrote:
> > From: Dillon Min 
> >
> > This seriese fix three i2c/clk bug for stm32 f4/f7
> > - kernel runing in sdram, i2c driver get data timeout
> > - ltdc clk turn off after kernel console active
> > - kernel hang in set ltdc clock rate
> >
> > clk bug found on stm32f429/f469-disco board
> >
> > Hi Patrice:
> > below is the guide to verify the patch:
> >
> > setup test env with following files(link at below 'files link'):
> > [1] u-boot-dtb.bin
> > [2] rootfs zip file (used in kernel initramfs)
> > [3] u-boot's mkimage to create itb file
> > [4] kernel config file
> > [5] my itb with-or-without i2c patch
> >
> > This patch based on kernel commit:
> > 88b06399c9c766c283e070b022b5ceafa4f63f19
> >
> > Note:
> > panel-ilitek-ili9341.c is the driver which was submitted last year, but not
> > get accepted. it's used to setup touch screen calibration, then test i2c.
> >
> > create itb file(please correct path of 'data'):
> > ./mkimage -f stm32.its stm32.itb
> >
> > HW setup:
> > console:
> >PA9, PA10
> >usart0
> >serial@40011000
> >115200 8n1
> >
> > -- flash u-boot.bin to stm32f429-disco on PC
> > $ sudo openocd -f board/stm32f429discovery.cfg -c \
> >   '{PATH-TO-YOUR-UBOOT}/u-boot-dtb.bin 0x0800 exit reset'
> >
> > -- setup kernel load bootargs at u-boot
> > U-Boot > setenv bootargs 'console=tty0 console=ttySTM0,115200
> > root=/dev/ram rdinit=/linuxrc loglevel=8 fbcon=rotate:2'
> > U-Boot > loady;bootm
> > (download stm32.dtb or your kernel with itb format, or download zImage, dtb)
> >
>
>
> Thanks for these informations
> I was able to load and boot DTB and uImage directly in SDRAM as you suggested,
> i saw Linux logo and kernel log on the STM32F429-disco display,
> but i can't reach the login.
>
> The last kernel log i got is :
>
> Starting kernel ...
>
> [0.00] Booting Linux on physical CPU 0x0
> [0.00] Linux version 5.13.0-rc1-00082-g9dbbd5cb6240-dirty 
> (nxp11987@lmecxl0573.lme1
> [0.00] CPU: ARMv7-M [410fc241] revision 1 (ARMv7M), cr=
> [0.00] CPU: unknown data cache, unknown instruction cache
> [0.00] OF: fdt: Machine model: STMicroelectronics STM32F429i-DISCO 
> board
> [0.00] Zone ranges:
> [0.00]   Normal   [mem 0x9000-0x907f]
> [0.00] Movable zone start for each node
> [0.00] Early memory node ranges
>
> [...]
>
> [2.637564] printk: console [ttySTM0] enabled
> [2.747984] panel-ilitek-ili9341 spi0.1: get optional vcc failed
> [2.758986] spi_stm32 40015000.spi: driver initialized
> [2.795733] i2c /dev entries driver
> [2.849955] stmpe-i2c 0-0041: stmpe811 detected, chip id: 0x811
> [2.922030] stmpe-ts stmpe-ts: DMA mask not set
> [2.965729] input: stmpe-ts as 
> /devices/platform/soc/40005c00.i2c/i2c-0/0-0041/stmpe-ts0
> [2.991570] stm32f4-i2c 40005c00.i2c: STM32F4 I2C driver registered
> [3.058262] [drm] Initialized stm 1.0.0 20170330 for 
> 40016800.display-controller on min0
> [3.665951] panel-ilitek-ili9341 spi0.1: initialized display rgb interface
> [3.765208] Console: switching to colour frame buffer device 30x40
> [4.014269] stm32-display 40016800.display-controller: [drm] fb0: stmdrmfb 
> frame buffere
> [4.212737] Freeing unused kernel memory: 324K
> [4.287300] This architecture does not have kernel memory protection.
> [4.401202] Run /linuxrc as init process
> [4.478622]   with arguments:
> [4.555069] /linuxrc
> [4.595406]   with environment:
> [4.672213] HOME=/
> [4.712511] TERM=linux
> [  206.785289] random: crng init done

I guess you didn't add the rootfs to uImage I sent you.
Could you post all the logs from u-boot startup to kernel log end.

If possible, you can try my suggestion.
- tar -jxf stm32_rootfs.tar.bz2
- add stm32_rootfs to your kernel config( enable initramfs)
- make O=YOUR_KERNEL_OUT zImage dtbs LOADADDR=0x90008000
- create itb file (combine dtb and kernel, initramfs) by mkimage
  ./mkimage -f stm32.its stm32.itb
  (before above command, make sure you correct stm32.its adapt to your env)

This process will make u-boot to load the kernel more simple.

Thanks.

Best Regards.
Dillon


>
>
> I can't test your I2C patch.
>
> Patrice
>
>
> > -- setup ts_calibrate running env on stm32f429-disc

Re: [PATCH 0/4] Fix the i2c/clk bug of stm32 mcu platform

2021-05-28 Thread Dillon Min
Hi Patrice, Alain,

Could you help to take a look at this patchset, thanks.

This series is the rebase to the newest kernel commit:
88b06399c9c766c283e070b022b5ceafa4f63f19

according to the request from:
https://lore.kernel.org/lkml/ff2bc09d-1a17-50d4-d3ee-16fd3a86d...@foss.st.com/

The clk bug affects the kernel bootup on stm32f469-disco board
in case display config(CONFIG_DRM_STM, CONFIG_DRM_STM_DSI,
DRM_PANEL_ORISETECH_OTM8009A)
enabled.

If you want to test clk patch on stm32f429-disco board, the
panel-ilitek-ili9341.c can be
used for that purpose (CONFIG_DRM_STM, DRM_PANEL_ILITEK_ILI9341)

i2c driver patch intent to fix the touch panel driver get data through
i2c bus timeout issue.

Best regards.
Dillon

On Fri, May 14, 2021 at 7:02 PM  wrote:
>
> From: Dillon Min 
>
> This seriese fix three i2c/clk bug for stm32 f4/f7
> - kernel runing in sdram, i2c driver get data timeout
> - ltdc clk turn off after kernel console active
> - kernel hang in set ltdc clock rate
>
> clk bug found on stm32f429/f469-disco board
>
> Hi Patrice:
> below is the guide to verify the patch:
>
> setup test env with following files(link at below 'files link'):
> [1] u-boot-dtb.bin
> [2] rootfs zip file (used in kernel initramfs)
> [3] u-boot's mkimage to create itb file
> [4] kernel config file
> [5] my itb with-or-without i2c patch
>
> This patch based on kernel commit:
> 88b06399c9c766c283e070b022b5ceafa4f63f19
>
> Note:
> panel-ilitek-ili9341.c is the driver which was submitted last year, but not
> get accepted. it's used to setup touch screen calibration, then test i2c.
>
> create itb file(please correct path of 'data'):
> ./mkimage -f stm32.its stm32.itb
>
> HW setup:
> console:
>PA9, PA10
>usart0
>serial@40011000
>115200 8n1
>
> -- flash u-boot.bin to stm32f429-disco on PC
> $ sudo openocd -f board/stm32f429discovery.cfg -c \
>   '{PATH-TO-YOUR-UBOOT}/u-boot-dtb.bin 0x0800 exit reset'
>
> -- setup kernel load bootargs at u-boot
> U-Boot > setenv bootargs 'console=tty0 console=ttySTM0,115200
> root=/dev/ram rdinit=/linuxrc loglevel=8 fbcon=rotate:2'
> U-Boot > loady;bootm
> (download stm32.dtb or your kernel with itb format, or download zImage, dtb)
>
> -- setup ts_calibrate running env on stm32f429-disco
> / # export TSLIB_CONFFILE=/etc/ts.conf
> / # export TSLIB_TSDEVICE=/dev/input/event0
> / # export TSLIB_CONSOLEDEVICE=none
> / # export TSLIB_FBDEVICE=/dev/fb0
>
> -- clear screen
> / # ./fb
>
> -- run ts_calibrate
> / # ts_calibrate
> (you can calibrate touchscreen now, and get below errors)
>
> [  113.942087] stmpe-i2c0-0041: failed to read regs 0x52: -110
> [  114.063598] stmpe-i2c 0-0041: failed to read reg 0x4b: -16
> [  114.185629] stmpe-i2c 0-0041: failed to read reg 0x40: -16
> [  114.307257] stmpe-i2c 0-0041: failed to write reg 0xb: -16
>
> ...
> with i2c patch applied, you will find below logs:
>
> RAW-> 3164 908 183 118.110884
> TS_READ_RAW> x = 3164, y =908, pressure = 183
> RAW-----> 3166 922 126 118.138946
> TS_READ_RAW> x = 3166, y = 922, pressure = 126
> 
>
> files link:
> https://drive.google.com/drive/folders/1qNbjChcB6UGtKzne2F5x9_WG_sZFyo3o?usp=sharing
>
>
>
>
> Dillon Min (4):
>   drm/panel: Add ilitek ili9341 panel driver
>   i2c: stm32f4: Fix stmpe811 get xyz data timeout issue
>   clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate
>   clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after
> kernel startup
>
>  drivers/clk/clk-stm32f4.c|   10 +-
>  drivers/gpu/drm/panel/Kconfig|   12 +
>  drivers/gpu/drm/panel/Makefile   |1 +
>  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 1285 
> ++
>  drivers/i2c/busses/i2c-stm32f4.c |   12 +-
>  5 files changed, 1310 insertions(+), 10 deletions(-)
>  create mode 100755 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
>
> --
> 2.7.4
>


Re: [PATCH v6 6/9] clk: stm32: Fix ltdc's clock turn off by clk_disable_unused() after kernel startup

2021-03-10 Thread dillon min
still need more expert to review, so just a gentle ping for this patch

On Wed, May 27, 2020 at 4:35 PM Stephen Boyd  wrote:
>
> Quoting dillon.min...@gmail.com (2020-05-27 00:27:30)
> > From: dillon min 
> >
> > stm32's clk driver register two ltdc gate clk to clk core by
> > clk_hw_register_gate() and clk_hw_register_composite()
> >
> > first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
> > second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver
> >
> > both of them point to the same offset of stm32's RCC register. after
> > kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]'
> > is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.
> >
> > Fixes: daf2d117cbca ("clk: stm32f4: Add lcd-tft clock")
> > Signed-off-by: dillon min 
> > ---
>
> Acked-by: Stephen Boyd 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 5/9] clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate

2021-03-10 Thread dillon min
still need more expert to review, so just a gentle ping for this patch

On Wed, May 27, 2020 at 4:35 PM Stephen Boyd  wrote:
>
> Quoting dillon.min...@gmail.com (2020-05-27 00:27:29)
> > From: dillon min 
> >
> > This is due to misuse \u2018PLL_VCO_SAI' and'PLL_SAI' in clk-stm32f4.c
> > 'PLL_SAI' is 2, 'PLL_VCO_SAI' is 7(defined in
> > include/dt-bindings/clock/stm32fx-clock.h).
> >
> > 'post_div' point to 'post_div_data[]', 'post_div->pll_num'
> > is PLL_I2S or PLL_SAI.
> >
> > 'clks[PLL_VCO_SAI]' has valid 'struct clk_hw* ' return
> > from stm32f4_rcc_register_pll() but, at line 1777 of
> > driver/clk/clk-stm32f4.c, use the 'clks[post_div->pll_num]',
> > equal to 'clks[PLL_SAI]', this is invalid array member at that time.
> >
> > Fixes: 517633ef630e ("clk: stm32f4: Add post divisor for I2S & SAI PLLs")
> > Signed-off-by: dillon min 
> > ---
>
> Acked-by: Stephen Boyd 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 0/8] Enable ili9341 and l3gd20 on stm32f429-disco

2020-07-21 Thread dillon min
Hi, Alexandre,


On Tue, Jul 21, 2020 at 7:54 PM Alexandre Torgue
 wrote:
>
>
>
> On 7/21/20 12:39 PM, dillon min wrote:
> > Hi Alexandre,
> >
> > On Tue, Jul 21, 2020 at 5:19 PM Alexandre Torgue
> >  wrote:
> >>
> >> Hi Dillon
> >>
> >> On 5/25/20 5:40 AM, dillon.min...@gmail.com wrote:
> >>> From: dillon min 
> >>>
> >>> V5's update based on Mark Brown's suggestion, use 'SPI_MASTER_MUST_RX'
> >>> for SPI_SIMPLEX_RX mode on stm32 spi controller.
> >>>
> >>> V5:
> >>> 1 instead of add send dummy data out under SIMPLEX_RX mode,
> >>>  add flags 'SPI_CONTROLLER_MUST_TX' for stm32 spi driver
> >>> 2 bypass 'SPI_CONTROLLER_MUST_TX' and 'SPI_CONTROLLER_MUST_RX' under
> >>> 'SPI_3WIRE' mode
> >>>
> >>
> >> Concerning DT patches, they look goods for me. However I'll merge them
> >> when drivers parts will be merged.
> >>
> >> regards
> >> Alex
> > This patchset status is :
> > dts:
> >  ARM: dts: stm32: Add dma config for spi5
> >  ARM: dts: stm32: Add pin map for ltdc & spi5 on stm32f429-disco board
> >  ARM: dts: stm32: enable ltdc binding with ili9341, gyro l3gd20 on
> >stm32429-disco board
> >
> > panel-bindings: Reviewed-by: Rob Herring, need more reviewing to merge
> >  dt-bindings: display: panel: Add ilitek ili9341 panel bindings
> >
> > clk: Acked-by: Stephen Boyd , need more reviewing to merge
> >  clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate,
> >fix duplicated ltdc clock register to 'clk_core' case ltdc's clock
> >  turn off by clk_disable_unused()
> >
> > drm-panel:  Reviewed-by: Linus Walleij . need more reviewing to merge
> >  drm/panel: Add ilitek ili9341 panel driver
> >
> > spi-driver: Acked-by: Mark Brown ,merged into mainline
> >  spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
> >  spi: flags 'SPI_CONTROLLER_MUST_RX' and 'SPI_CONTROLLER_MUST_TX' can't
> >becoexit with 'SPI_3WIRE' mode
> >
> > For ili9341 drivers, it seems to need more time to review, or might be 
> > dropped.
> > since the drm maintainer might create a new interface to support
> > DPI,DBI,DSI in one driver.
> > Currently it's under discussion. I will rework the ili9341 driver after 
> > that.
> >
> > But, we can use the existing "drivers/gpu/drm/tiny/ili9341.c" driver to 
> > support
> > ili9341 on stm32f429-disco board only using the spi bus. except the
> > display refresh performance is not as good as the ltdc interface.
> >
> > I can submit a new patch just with dts changed this week for it, if you 
> > need.
> >
>
>
> Thanks for this status. I'm close to send my PR for v5.9. There is no
> needs to have an intermediate version (Except you absolutely want it).
>
> Thanks
> alex
Ok, I prefer to use the ltdc interface to drive ili9341 either.

Thanks,
Dillon.
>
> > Thanks,
> > Dillon.
> >>
> >>
> >>
> >>> V4:
> >>> According to alexandre torgue's suggestion, combine ili9341 and
> >>> l3gd20's modification on stm32f429-disco board to one patchset.
> >>>
> >>> Changes:
> >>>
> >>> ili9341:
> >>>
> >>> 1 update ili9341 panel driver according to Linus's suggestion
> >>> 2 drop V1's No.5 patch, sumbit new changes for clk-stm32f4
> >>> 3 merge l3gd20's change to this patchset
> >>>
> >>> V3:
> >>> 1 merge original tiny/ili9341.c driver to panel/panel-ilitek-ili9341.c
> >>> to support serial spi & parallel rgb interface in one driver.
> >>> 2 update ilitek,ili9341.yaml dts binding documentation.
> >>> 3 update stm32f429-disco dts binding
> >>>
> >>> V2:
> >>> 1 verify ilitek,ili9341.yaml with make O=../linux-stm32
> >>> dt_binding_check
> >>> DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/panel/
> >>> ilitek,ili9341.yaml
> >>>
> >>> V1:
> >>> 1 add ili9341 drm panel driver
> >>> 2 add ltdc, spi5 controller for stm32f429-disco
> >>> 3 add ltdc, spi5 pin map for stm32f429-disco
> >>> 4 add docs about ili9341
> >>> 5 fix ltdc driver loading hang in clk set rate bug
> >>>
> >>>
> >>> L3gd20:
> >>> V3:
> >>> 1 merge stm32f429-disco d

Re: [PATCH v5 0/8] Enable ili9341 and l3gd20 on stm32f429-disco

2020-07-21 Thread dillon min
Hi Alexandre,

On Tue, Jul 21, 2020 at 5:19 PM Alexandre Torgue
 wrote:
>
> Hi Dillon
>
> On 5/25/20 5:40 AM, dillon.min...@gmail.com wrote:
> > From: dillon min 
> >
> > V5's update based on Mark Brown's suggestion, use 'SPI_MASTER_MUST_RX'
> > for SPI_SIMPLEX_RX mode on stm32 spi controller.
> >
> > V5:
> > 1 instead of add send dummy data out under SIMPLEX_RX mode,
> > add flags 'SPI_CONTROLLER_MUST_TX' for stm32 spi driver
> > 2 bypass 'SPI_CONTROLLER_MUST_TX' and 'SPI_CONTROLLER_MUST_RX' under
> > 'SPI_3WIRE' mode
> >
>
> Concerning DT patches, they look goods for me. However I'll merge them
> when drivers parts will be merged.
>
> regards
> Alex
This patchset status is :
dts:
ARM: dts: stm32: Add dma config for spi5
ARM: dts: stm32: Add pin map for ltdc & spi5 on stm32f429-disco board
ARM: dts: stm32: enable ltdc binding with ili9341, gyro l3gd20 on
  stm32429-disco board

panel-bindings: Reviewed-by: Rob Herring, need more reviewing to merge
dt-bindings: display: panel: Add ilitek ili9341 panel bindings

clk: Acked-by: Stephen Boyd , need more reviewing to merge
clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate,
  fix duplicated ltdc clock register to 'clk_core' case ltdc's clock
turn off by clk_disable_unused()

drm-panel:  Reviewed-by: Linus Walleij . need more reviewing to merge
drm/panel: Add ilitek ili9341 panel driver

spi-driver: Acked-by: Mark Brown ,merged into mainline
spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
spi: flags 'SPI_CONTROLLER_MUST_RX' and 'SPI_CONTROLLER_MUST_TX' can't
  becoexit with 'SPI_3WIRE' mode

For ili9341 drivers, it seems to need more time to review, or might be dropped.
since the drm maintainer might create a new interface to support
DPI,DBI,DSI in one driver.
Currently it's under discussion. I will rework the ili9341 driver after that.

But, we can use the existing "drivers/gpu/drm/tiny/ili9341.c" driver to support
ili9341 on stm32f429-disco board only using the spi bus. except the
display refresh performance is not as good as the ltdc interface.

I can submit a new patch just with dts changed this week for it, if you need.

Thanks,
Dillon.
>
>
>
> > V4:
> > According to alexandre torgue's suggestion, combine ili9341 and
> > l3gd20's modification on stm32f429-disco board to one patchset.
> >
> > Changes:
> >
> > ili9341:
> >
> > 1 update ili9341 panel driver according to Linus's suggestion
> > 2 drop V1's No.5 patch, sumbit new changes for clk-stm32f4
> > 3 merge l3gd20's change to this patchset
> >
> > V3:
> > 1 merge original tiny/ili9341.c driver to panel/panel-ilitek-ili9341.c
> >to support serial spi & parallel rgb interface in one driver.
> > 2 update ilitek,ili9341.yaml dts binding documentation.
> > 3 update stm32f429-disco dts binding
> >
> > V2:
> > 1 verify ilitek,ili9341.yaml with make O=../linux-stm32
> >dt_binding_check
> >DT_SCHEMA_FILES=Documentation/devicetree/bindings/display/panel/
> >ilitek,ili9341.yaml
> >
> > V1:
> > 1 add ili9341 drm panel driver
> > 2 add ltdc, spi5 controller for stm32f429-disco
> > 3 add ltdc, spi5 pin map for stm32f429-disco
> > 4 add docs about ili9341
> > 5 fix ltdc driver loading hang in clk set rate bug
> >
> >
> > L3gd20:
> > V3:
> > 1 merge stm32f429-disco dtbs binding with ili9341 part
> >
> > V2:
> > 1 insert blank line at stm32f420-disco.dts line 143
> > 2 add more description for l3gd20 in commit message
> >
> > V1:
> > 1 enable spi5 controller on stm32f429-disco (dts)
> > 2 add spi5 pinmap for stm32f429-disco  (dts)
> > 3 add SPI_SIMPLEX_RX, SPI_3WIRE_RX support for stm32f4
> >
> >
> > dillon min (8):
> >ARM: dts: stm32: Add dma config for spi5
> >ARM: dts: stm32: Add pin map for ltdc & spi5 on stm32f429-disco board
> >ARM: dts: stm32: enable ltdc binding with ili9341, gyro l3gd20 on
> >  stm32429-disco board
> >dt-bindings: display: panel: Add ilitek ili9341 panel bindings
> >clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate,
> >  fix duplicated ltdc clock register to 'clk_core' case ltdc's clock
> >turn off by clk_disable_unused()
> >drm/panel: Add ilitek ili9341 panel driver
> >spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4
> >spi: flags 'SPI_CONTROLLER_MUST_RX' and 'SPI_CONTROLLER_MUST_TX' can't
> >  be coexit with 'SPI_3WIRE' mode
> >
> >   .../bindings/display/panel/ilitek,ili9341.yaml |   69 ++
> >   arch/arm/bo

Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-07-01 Thread dillon min
Hi Andy, Noralf,

gentle ping for this patch set,
do we have any new structure, or idea to support both dpi and dbi
interface by one drm panel driver?
from this thread
https://lists.freedesktop.org/archives/dri-devel/2020-May/267031.html
, it's seems
discussing was stopped at may 25.

if there are any new information about this topic, please feel free to
let me know. hope i can make some
progress on it.

thanks,

Dillon,

best regards

On Tue, May 26, 2020 at 6:38 PM Noralf Trønnes  wrote:
>
>
>
> Den 26.05.2020 11.08, skrev dillon min:
> > Hi Andy,
> >
> > Thanks for input.
> >
> > On Tue, May 26, 2020 at 3:46 PM Andy Shevchenko
> >  wrote:
> >>
> >> On Mon, May 25, 2020 at 6:46 AM  wrote:
> >>>
> >>> From: dillon min 
> >>>
> >>> This driver combine tiny/ili9341.c mipi_dbi_interface driver
> >>> with mipi_dpi_interface driver, can support ili9341 with serial
> >>> mode or parallel rgb interface mode by register configuration.
> >>
> >> Noralf told once that this driver should be unified with mi0283qt.c.
> >>
> >> So, what should we do here?
> >>
> >> --
> >> With Best Regards,
> >> Andy Shevchenko
> >
> > from sam's suggestion, we can't setup two drivers to support one panel
> > in the tree. so, i copy the mipi dbi part from tiny/ili9341.c. to this 
> > driver
> > from register settings and dts binding is keep the same to tiny/ili9341.c.
> >
> > so, in my opinion if tiny/ili9341.c is unified with mi0283qt.c, this
> > driver should be
> > too.
> >
>
> There's a discussion about MIPI DBI panels here:
>
> MIPI DSI, DBI, and tinydrm drivers
> https://lists.freedesktop.org/archives/dri-devel/2020-May/267031.html
>
> Noralf.
>
> > thanks.
> >
> > best regards,
> >
> > Dillon,
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 2/9] ARM: dts: stm32: Add pin map for ltdc & spi5 on stm32f429-disco board

2020-06-16 Thread dillon min
On Mon, Jun 15, 2020 at 5:45 PM Alexandre Torgue
 wrote:
>
> Hi Dillon
>
> On 5/27/20 9:27 AM, dillon.min...@gmail.com wrote:
> > From: dillon min 
> >
> > This patch adds the pin configuration for ltdc and spi5 controller
> > on stm32f429-disco board.
> >
> > Signed-off-by: dillon min 
> > ---
> >   arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 67 
> > ++
> >   1 file changed, 67 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi 
> > b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > index 392fa143ce07..0eb107f968cd 100644
> > --- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > +++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > @@ -316,6 +316,73 @@
> >   };
> >   };
> >
> > + ltdc_pins_f429_disco: ltdc-1 {
>
> Sorry I missed this issue during review. I changed ltdc_pins_f429_disco
> by ltdc_pins_b when I applied your patch.
Okay, thanks for reviewing.

Regrades,
Dillon,
>
>
> Regards
> alex
>
> > + pins {
> > + pinmux =  > AF14)>,
> > + /* LCD_HSYNC */
> > +   > AF14)>,
> > +  /* LCD_VSYNC */
> > +   > AF14)>,
> > +  /* LCD_CLK */
> > +   > AF14)>,
> > +  /* LCD_R2 */
> > +  ,
> > +  /* LCD_R3 */
> > +   > AF14)>,
> > +  /* LCD_R4 */
> > +   > AF14)>,
> > +  /* LCD_R5 */
> > +  ,
> > +  /* LCD_R6*/
> > +   > AF14)>,
> > +  /* LCD_R7 */
> > +   > AF14)>,
> > +  /* LCD_G2 */
> > +  ,
> > +  /* LCD_G3 */
> > +   > AF14)>,
> > +  /* LCD_G4 */
> > +   > AF14)>,
> > +  /* LCD_B2 */
> > +   > AF14)>,
> > +  /* LCD_B3*/
> > +   > AF14)>,
> > +  /* LCD_G5 */
> > +   > AF14)>,
> > +  /* LCD_G6 */
> > +   > AF14)>,
> > +  /* LCD_G7 */
> > +  ,
> > +  /* LCD_B4 */
> > +   > AF14)>,
> > +  /* LCD_B5 */
> > +   > AF14)>,
> > +  /* LCD_B6 */
> > +   > AF14)>,
> > +  /* LCD_B7 */
> > +   > AF14)>;
> > +  /* LCD_DE */
> > + slew-rate = <2>;
> > + };
> > + };
> > +
> > + spi5_pins: spi5-0 {
> > + pins1 {
> > + pinmux = ,
> > + /* SPI5_CLK */
> > +  ;
> > + /* SPI5_MOSI */
> > + bias-disable;
> > + drive-push-pull;
> > +

Re: [PATCH v6 8/9] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4

2020-05-28 Thread dillon min
On Wed, May 27, 2020 at 5:51 PM Mark Brown  wrote:
>
> On Wed, May 27, 2020 at 03:27:32PM +0800, dillon.min...@gmail.com wrote:
> > From: dillon min 
> >
> > in l3gd20 driver startup, there is a setup failed error return from
> > stm32 spi driver
>
> Please do not submit new versions of already applied patches, please
> submit incremental updates to the existing code.  Modifying existing
> commits creates problems for other users building on top of those
> commits so it's best practice to only change pubished git commits if
> absolutely essential.

Hi Mark,

sorry, forget to remove these two patch from this submits, will not
include it in later submits
which ack other's review result.

thanks.

best regards

Dillon,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 5/8] clk: stm32: Fix stm32f429's ltdc driver hang in set clock rate, fix duplicated ltdc clock register to 'clk_core' case ltdc's clock turn off by clk_disable_unused()

2020-05-27 Thread dillon min
Hi Stephen,

Thanks for reviewing.

On Wed, May 27, 2020 at 9:44 AM Stephen Boyd  wrote:
>
> Quoting dillon.min...@gmail.com (2020-05-24 20:45:45)
> > From: dillon min 
> >
> > ltdc set clock rate crashed
> >'post_div_data[]''s pll_num is PLL_I2S, PLL_SAI (number is 1,2). but,
>
> Please write "post_div_data[]'s" if it is possessive. "But" doesn't
> start a sentence. This is one sentence, not two.
Ok.

>
> > as pll_num is offset of 'clks[]' input to clk_register_pll_div(), which
> > is FCLK, CLK_LSI, defined in 'include/dt-bindings/clock/stm32fx-clock.h'
> > so, this is a null object at the register time.
> > then, in ltdc's clock is_enabled(), enable(), will call to_clk_gate().
> > will return a null object, cause kernel crashed.
> > need change pll_num to PLL_VCO_I2S, PLL_VCO_SAI for 'post_div_data[]'
> >
> >  duplicated ltdc clock
> >'stm32f429_gates[]' has a member 'ltdc' register to 'clk_core', but no
> > upper driver use it, ltdc driver use the lcd-tft defined in
> >'stm32f429_aux_clk[]'. after system startup, as stm32f429_gates[]'s ltdc
> > enable_count is zero, so turn off by clk_disable_unused()
>
> I sort of follow this. Is this another patch? Seems like two things are
> going on here.

This patch fix two bugs about stm32's clock.
bug1:  ltdc driver loading hang in clk_set_rate(), this is due to
misuse ‘PLL_VCO_SAI' and
   'PLL_SAI'.

 speak in short, from the below code,
’PLL_SAI' is 2, 'PLL_VCO_SAI' is 7.
'post_div' point to 'post_div_data[]', 'post_div->pll_num' is
PLL_I2S, PLL_SAI.
'clks[PLL_VCOM_SAI' has vaild 'struct clk_hw* ' return from
stm32f4_rcc_register_pll()
but, at line 1776, use the 'clks[post_div->pll_num]', equal to
'clks[PLL_SAI]', this is invaild
at that time.

include/dt-bindings/clock/stm32fx-clock.h
29 #define PLL_VCO_SAI 7

drivers/clk/clk-stm32f4.c
 494 enum {
 495 PLL,
 496 PLL_I2S,
 497 PLL_SAI,
 498 };


 558 static const struct stm32f4_pll_post_div_data
post_div_data[MAX_POST_DIV] = {
 559 { CLK_I2SQ_PDIV, PLL_I2S, "plli2s-q-div", "plli2s-q",
 560 CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 0, 5, 0, NULL},
 561
 562 { CLK_SAIQ_PDIV, PLL_SAI, "pllsai-q-div", "pllsai-q",
 563 CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 8, 5, 0, NULL },
 564
 565 { NO_IDX, PLL_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT,
 566 STM32F4_RCC_DCKCFGR, 16, 2, 0, post_divr_table },
 567 };


1759 clks[PLL_VCO_SAI] = stm32f4_rcc_register_pll("vco_in",
1760 >pll_data[2], _clk_lock);
1761
1762 for (n = 0; n < MAX_POST_DIV; n++) {
1763 const struct stm32f4_pll_post_div_data *post_div;
1764 struct clk_hw *hw;
1765
1766 post_div = _div_data[n];
1767
1768 hw = clk_register_pll_div(post_div->name,
1769 post_div->parent,
1770 post_div->flag,
1771 base + post_div->offset,
1772 post_div->shift,
1773 post_div->width,
1774 post_div->flag_div,
1775 post_div->div_table,
1776 clks[post_div->pll_num],
1777 _clk_lock);
1778
1779 if (post_div->idx != NO_IDX)
1780 clks[post_div->idx] = hw;
1781 }

bug2: ltdc's clock turn off by clk_disable_unused()

from your comments at '[PATCH v3 4/5] clk: stm32: Fix stm32f429 ltdc
driver loading hang
 in clk set rate. keep ltdc clk running after kernel startup' , i go
deep into the code, found
stm32's clk driver register two gate clk to clk core by
clk_hw_register_gate() and
clk_hw_register_composite()

first: 'stm32f429_gates[]', clk name is 'ltdc', this is no user used.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', this is used by
ltdc driver

both of them point to the same offset of stm32's RCC register. after
kernel enter console,
clk core turn off ltdc's clk as 'stm32f429_gates[]' is unused. but,
actually 'stm32f429_aux_clk[]'
is in use.

i can separate this patch to two, each bug a patch if necessary

>
> >
> > Changes since V3:
> > 1 drop last wrong changes about 'CLK_IGNORE_UNUSED' patch
> > 2 fix PLL_SAI mismatch with PLL_VCO_SAI
>
> This change log goes under the --- below.
ok

>
> >
> > Signed-off-by: dillon min 
>
> Any Fixes tag?
ok, will add --fixup in git commit next time, this patch fix two bugs,
i should make two commit, each one has a
fixes tag, right?
first point to '517633e clk: stm32f4: Add post divisor for I2S & SAI PLLs'
second point to 'daf2d11 clk: stm32f4: Add lcd-tft clock'
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 6/8] drm/panel: Add ilitek ili9341 panel driver

2020-05-27 Thread dillon min
Hi Andy,

Thanks for input.

On Tue, May 26, 2020 at 3:46 PM Andy Shevchenko
 wrote:
>
> On Mon, May 25, 2020 at 6:46 AM  wrote:
> >
> > From: dillon min 
> >
> > This driver combine tiny/ili9341.c mipi_dbi_interface driver
> > with mipi_dpi_interface driver, can support ili9341 with serial
> > mode or parallel rgb interface mode by register configuration.
>
> Noralf told once that this driver should be unified with mi0283qt.c.
>
> So, what should we do here?
>
> --
> With Best Regards,
> Andy Shevchenko

from sam's suggestion, we can't setup two drivers to support one panel
in the tree. so, i copy the mipi dbi part from tiny/ili9341.c. to this driver
from register settings and dts binding is keep the same to tiny/ili9341.c.

so, in my opinion if tiny/ili9341.c is unified with mi0283qt.c, this
driver should be
too.

thanks.

best regards,

Dillon,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4

2020-05-23 Thread dillon min
On Fri, May 22, 2020 at 10:57 PM dillon min  wrote:
>
> hi Mark,
>
> Thanks for reviewing.
>
> On Fri, May 22, 2020 at 7:36 PM Mark Brown  wrote:
> >
> > On Mon, May 18, 2020 at 07:09:20PM +0800, dillon.min...@gmail.com wrote:
> >
> > > 2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as tx_buf 
> > > is
> > > null, we must add dummy data sent out before read data.
> > > so, add stm32f4_spi_tx_dummy() to handle this situation.
> >
> > There are flags SPI_CONTROLLER_MUST_TX and SPI_CONTROLLER_MUST_RX flags
> > that the driver can set if it needs to, no need to open code this in the
> > driver.
>
> Yes, after check SPI_CONTROLLER_MUST_TX in drivers/spi/spi.c , it's
> indeed to meet
> this situation,  i will try it and sumbmit a new patch.
>
> thanks.
>
> best regards
>
> Dillon

Hi Mark,

There might be a conflict with 'SPI_CONTROLLER_MUST_TX' and 'SPI_3WIRE' mode,
i need to know the SPI_3WIRE direction,  currently i get this
information from 'struct spi_device'
and 'struct spi_transfer'
if ((spi_device->mode & SPI_3WIRE) && (spi_transfer->tx_buf == NULL)
&& (spi_transfer->rx_buf != NULL))
this is a SPI_3WIRE_RX transfer
if ((spi_device->mode & SPI_3WIRE) && (spi_transfer->tx_buf != NULL)
&& (spi_transfer->rx_buf == NULL))
this is a SPI_3WIRE_TX transfer

but, after spi-core create a dummy tx_buf or rx_buf, then i can't get
the correct spi_3wire direction.
actually, this dummy tx_buf is useless for SPI_3WIRE. it's has meaning
for SPI_SIMPLE_RX mode,
simulate SPI_FULL_DUMPLEX

how do you think?

thanks

best regards

Dillon
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4

2020-05-23 Thread dillon min
hi Mark,

Thanks for reviewing.

On Fri, May 22, 2020 at 7:36 PM Mark Brown  wrote:
>
> On Mon, May 18, 2020 at 07:09:20PM +0800, dillon.min...@gmail.com wrote:
>
> > 2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as tx_buf is
> > null, we must add dummy data sent out before read data.
> > so, add stm32f4_spi_tx_dummy() to handle this situation.
>
> There are flags SPI_CONTROLLER_MUST_TX and SPI_CONTROLLER_MUST_RX flags
> that the driver can set if it needs to, no need to open code this in the
> driver.

Yes, after check SPI_CONTROLLER_MUST_TX in drivers/spi/spi.c , it's
indeed to meet
this situation,  i will try it and sumbmit a new patch.

thanks.

best regards

Dillon
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 3/8] spi: stm32: Add 'SPI_SIMPLEX_RX', 'SPI_3WIRE_RX' support for stm32f4

2020-05-23 Thread dillon min
On Sat, May 23, 2020 at 12:29 AM Mark Brown  wrote:
>
> On Fri, May 22, 2020 at 11:59:25PM +0800, dillon min wrote:
>
> > but, after spi-core create a dummy tx_buf or rx_buf, then i can't get
> > the correct spi_3wire direction.
> > actually, this dummy tx_buf is useless for SPI_3WIRE. it's has meaning
> > for SPI_SIMPLE_RX mode,
> > simulate SPI_FULL_DUMPLEX
>
> Oh, that's annoying.  I think the fix here is in the core, it should
> ignore MUST_TX and MUST_RX in 3WIRE mode since they clearly make no
> sense there.

How about add below changes to spi-core

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8994545..bfd465c 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1022,7 +1022,8 @@ static int spi_map_msg(struct spi_controller
*ctlr, struct spi_message *msg)
void *tmp;
unsigned int max_tx, max_rx;

-   if (ctlr->flags & (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX)) {
+   if ((ctlr->flags & (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX)) &&
+   !(msg->spi->mode & SPI_3WIRE)) {
max_tx = 0;
max_rx = 0;

for my board, lcd panel ilitek ill9341 use 3wire mode, gyro l3gd20 use
simplex rx mode.
it's has benefits to l3gd20, no impact to ili9341.

if it's fine to spi-core, i will include it to my next submits.

thanks

best regards.

Dillon
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Linux-stm32] [PATCH v3 3/5] ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board

2020-05-16 Thread dillon min
Hi Benjamin,

thanks for reply.

On Fri, May 15, 2020 at 4:31 PM Benjamin GAIGNARD
 wrote:
>
>
>
> On 5/14/20 3:07 PM, dillon min wrote:
> > Hi Alexandre,
> >
> > On Thu, May 14, 2020 at 8:53 PM Alexandre Torgue
> >  wrote:
> >>
> >>
> >> On 5/14/20 10:24 AM, Linus Walleij wrote:
> >>> On Tue, May 12, 2020 at 9:04 AM  wrote:
> >>>
> >>>> From: dillon min 
> >>>>
> >>>> Enable the ltdc & ili9341 on stm32429-disco board.
> >>>>
> >>>> Signed-off-by: dillon min 
> >>> This mostly looks good but...
> >>>
> >>>> + {
> >>>> +   status = "okay";
> >>>> +   pinctrl-0 = <_pins>;
> >>>> +   pinctrl-names = "default";
> >>>> +   #address-cells = <1>;
> >>>> +   #size-cells = <0>;
> >>>> +   cs-gpios = < 2 GPIO_ACTIVE_LOW>;
> >>>> +   dmas = < 3 2 0x400 0x0>,
> >>>> +  < 4 2 0x400 0x0>;
> >>>> +   dma-names = "rx", "tx";
> >>> These DMA assignments seem to be SoC things and should
> >>> rather be in the DTS(I) file where  is defined, right?
> >>> stm32f429.dtsi I suppose?
> >> I agree with Linus, DMA have to be defined in SoC dtsi. And if a board
> >> doesn't want to use it, we use the "delete-property".
> > Yes, will move to Soc dtsi in next submits.
> >
> > i'm working on write a v4l2-m2m driver for dma2d of stm32 to support
> > pixel conversion
> > alpha blending between foreground and background graphics.
> >
> > as you know, some soc's engineer trying to add this function to drm system.
> >
> > do you know st's planning about soc's hardware accelerator driver on 
> > stm32mp?
> > such as chrom-art, will add to drm subsystem via ioctl to access, or to 
> > v4l2,
> On stm32mp we do not plan to use chrom-art in drm or v4l2 because it
> does fit
> with userland way of working. We use the GPU to do conversion, scaling,
> blending
> and composition in only one go.
> As explain here [1] DRM subsytem it isn't a solution and v4l2-m2m isn't
> used in any
> mainline compositors like Weston or android surfaceflinger.
>
> Benjamin
>

After check stm32mp's datasheets, they don't have chrom-art ip inside. sorry for
didn't check it yet.

for stm32h7 series with chrom-art, jpeg hardware accelerator inside.
does st has plan to
setup a driver to support it ? i prefer v4l2-m2m should be easier to
implement it.
co work with dcmi, fbdev.

thanks.

best regards.

Dillon
> [1]
> https://www.phoronix.com/scan.php?page=news_item=Linux-DRM-No-2D-Accel-API
> >
> > thanks.
> >
> >>> It is likely the same no matter which device is using spi5.
> >>>
> >>> Yours,
> >>> Linus Walleij
> >>>
> > ___
> > Linux-stm32 mailing list
> > linux-st...@st-md-mailman.stormreply.com
> > https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Linux-stm32] [PATCH v3 3/5] ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board

2020-05-16 Thread dillon min
Hi Benjamin,

got it, thanks a lot.

best regards

Dillon

On Fri, May 15, 2020 at 5:34 PM Benjamin GAIGNARD
 wrote:
>
>
>
> On 5/15/20 11:24 AM, dillon min wrote:
> > Hi Benjamin,
> >
> > thanks for reply.
> >
> > On Fri, May 15, 2020 at 4:31 PM Benjamin GAIGNARD
> >  wrote:
> >>
> >>
> >> On 5/14/20 3:07 PM, dillon min wrote:
> >>> Hi Alexandre,
> >>>
> >>> On Thu, May 14, 2020 at 8:53 PM Alexandre Torgue
> >>>  wrote:
> >>>>
> >>>> On 5/14/20 10:24 AM, Linus Walleij wrote:
> >>>>> On Tue, May 12, 2020 at 9:04 AM  wrote:
> >>>>>
> >>>>>> From: dillon min 
> >>>>>>
> >>>>>> Enable the ltdc & ili9341 on stm32429-disco board.
> >>>>>>
> >>>>>> Signed-off-by: dillon min 
> >>>>> This mostly looks good but...
> >>>>>
> >>>>>> + {
> >>>>>> +   status = "okay";
> >>>>>> +   pinctrl-0 = <_pins>;
> >>>>>> +   pinctrl-names = "default";
> >>>>>> +   #address-cells = <1>;
> >>>>>> +   #size-cells = <0>;
> >>>>>> +   cs-gpios = < 2 GPIO_ACTIVE_LOW>;
> >>>>>> +   dmas = < 3 2 0x400 0x0>,
> >>>>>> +  < 4 2 0x400 0x0>;
> >>>>>> +   dma-names = "rx", "tx";
> >>>>> These DMA assignments seem to be SoC things and should
> >>>>> rather be in the DTS(I) file where  is defined, right?
> >>>>> stm32f429.dtsi I suppose?
> >>>> I agree with Linus, DMA have to be defined in SoC dtsi. And if a board
> >>>> doesn't want to use it, we use the "delete-property".
> >>> Yes, will move to Soc dtsi in next submits.
> >>>
> >>> i'm working on write a v4l2-m2m driver for dma2d of stm32 to support
> >>> pixel conversion
> >>> alpha blending between foreground and background graphics.
> >>>
> >>> as you know, some soc's engineer trying to add this function to drm 
> >>> system.
> >>>
> >>> do you know st's planning about soc's hardware accelerator driver on 
> >>> stm32mp?
> >>> such as chrom-art, will add to drm subsystem via ioctl to access, or to 
> >>> v4l2,
> >> On stm32mp we do not plan to use chrom-art in drm or v4l2 because it
> >> does fit
> >> with userland way of working. We use the GPU to do conversion, scaling,
> >> blending
> >> and composition in only one go.
> >> As explain here [1] DRM subsytem it isn't a solution and v4l2-m2m isn't
> >> used in any
> >> mainline compositors like Weston or android surfaceflinger.
> >>
> >> Benjamin
> >>
> > After check stm32mp's datasheets, they don't have chrom-art ip inside. 
> > sorry for
> > didn't check it yet.
> >
> > for stm32h7 series with chrom-art, jpeg hardware accelerator inside.
> > does st has plan to
> > setup a driver to support it ? i prefer v4l2-m2m should be easier to
> > implement it.
> > co work with dcmi, fbdev.
> ST doesn't plan to create a driver for chrom-art because nothing in
> mainline
> userland could use it.
>
> Benjamin
> >
> > thanks.
> >
> > best regards.
> >
> > Dillon
> >> [1]
> >> https://www.phoronix.com/scan.php?page=news_item=Linux-DRM-No-2D-Accel-API
> >>> thanks.
> >>>
> >>>>> It is likely the same no matter which device is using spi5.
> >>>>>
> >>>>> Yours,
> >>>>> Linus Walleij
> >>>>>
> >>> ___
> >>> Linux-stm32 mailing list
> >>> linux-st...@st-md-mailman.stormreply.com
> >>> https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 4/5] clk: stm32: Fix stm32f429 ltdc driver loading hang in clk set rate. keep ltdc clk running after kernel startup

2020-05-16 Thread dillon min
Hi Stephen,

thanks for reviewing.

On Fri, May 15, 2020 at 5:02 AM Stephen Boyd  wrote:
>
> Quoting dillon.min...@gmail.com (2020-05-12 00:03:36)
> > From: dillon min 
> >
> > as store stm32f4_rcc_register_pll return to the wrong offset of clks,
>
> Use () on functions, i.e. stm32f4_rcc_register_pll().
ok
>
> > so ltdc gate clk is null. need change clks[PLL_VCO_SAI] to clks[PLL_SAI]
>
> And quote variables like 'clks[PLL_VCO_SAI]'
ok
>
> >
> > add CLK_IGNORE_UNUSED for ltdc to make sure clk not be freed by
> > clk_disable_unused
>
> clk_disable_unused() doesn't free anything. Why does ltdc not need to be
> turned off if it isn't used? Is it critical to system operation? Should
> it be marked with the critical clk flag then? The CLK_IGNORE_UNUSED flag
> is almost always wrong to use.

Yes, you are right. thanks. CLK_IGNORE_UNUSED just hide the root
cause. after deeper debugging.
i need to drop the last changes , they are not the root cause.

post diff and analyse here first, i will resubmit clk's changes in
next patchset with gyro and ili9341.

--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -129,8 +129,6 @@ static const struct stm32f4_gate_data
stm32f429_gates[] __initconst = {
{ STM32F4_RCC_APB2ENR, 20,  "spi5", "apb2_div" },
{ STM32F4_RCC_APB2ENR, 21,  "spi6", "apb2_div" },
{ STM32F4_RCC_APB2ENR, 22,  "sai1", "apb2_div" },
-   { STM32F4_RCC_APB2ENR, 26,  "ltdc", "apb2_div",
-   CLK_IGNORE_UNUSED },
 };

 static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -558,13 +556,13 @@ static const struct clk_div_table post_divr_table[] = {

 #define MAX_POST_DIV 3
 static const struct stm32f4_pll_post_div_data  post_div_data[MAX_POST_DIV] = {
-   { CLK_I2SQ_PDIV, PLL_I2S, "plli2s-q-div", "plli2s-q",
+   { CLK_I2SQ_PDIV, PLL_VCO_I2S, "plli2s-q-div", "plli2s-q",
CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 0, 5, 0, NULL},

-   { CLK_SAIQ_PDIV, PLL_SAI, "pllsai-q-div", "pllsai-q",
+   { CLK_SAIQ_PDIV, PLL_VCO_SAI, "pllsai-q-div", "pllsai-q",
CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 8, 5, 0, NULL },

-   { NO_IDX, PLL_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT,
+   { NO_IDX, PLL_VCO_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT,
STM32F4_RCC_DCKCFGR, 16, 2, 0, post_divr_table },
 };

@@ -1758,7 +1756,7 @@ static void __init stm32f4_rcc_init(struct
device_node *np)
clks[PLL_VCO_I2S] = stm32f4_rcc_register_pll("vco_in",
>pll_data[1], _clk_lock);

-   clks[PLL_SAI] = stm32f4_rcc_register_pll("vco_in",
+   clks[PLL_VCO_SAI] = stm32f4_rcc_register_pll("vco_in",
>pll_data[2], _clk_lock);

for (n = 0; n < MAX_POST_DIV; n++) {

issue 1: ili9341 hang in clk set rate, the root cause should be
PLL_VCO_SAI, PLL_SAI mismatch
for 'clks[]'

1, first at stm32f4_rcc_init() ,
clks[PLL_VCO_SAI] = stm32f4_rcc_register_pll("vco_in",
>pll_data[2], _clk_lock);
   the clk_hw from stm32f4_rcc_register_pll() is store to 'clks[7]', defined in
   'include/dt-bindings/clock/stm32fx-clock.h'

2, next
hw = clk_register_pll_div(post_div->name,
post_div->parent,
post_div->flag,
base + post_div->offset,
post_div->shift,
post_div->width,
post_div->flag_div,
post_div->div_table,
clks[post_div->pll_num],
_clk_lock);
the 'clks[post_div->pll_num]', the pll_num is PLL_SAI, the value is 2,
defined at
enum {
PLL,
PLL_I2S,
PLL_SAI,
};
'post_div_data[]'

so 7 != 2 offset of 'clks[]', input the wrong 'clks[]' to
clk_register_pll_div. cause to_clk_gate result is null,
crashed in ltdc driver's loading.

issue 2: clk_disable_unused() turn off ltdc clock.
1, ltdc clk is defined in 'stm32f429_gates[]', register to clk core,
but there is no user to use it.
ltdc driver use dts binding name "lcd", connect to CLK_LCD, then
aux clk 'lcd-tft '
2, as no one use 'stm32f429_gates[]' s ltdc clock , so the
enable_count is zero, after kernel startup
it's been turn off by clk_disable_unused() is fine.

my chages for this is remove the ltdc from 'stm32f429_gates[]'
but this modification still need 'clk-stm32f4.c''s maintainer to check
if there is side effect.

>
> >
> >

Re: [PATCH v3 5/5] drm/panel: Add ilitek ili9341 driver

2020-05-15 Thread dillon min
Hi Linus,

Linus Walleij  于2020年5月14日周四 下午10:08写道:
>
> On Thu, May 14, 2020 at 12:22 PM dillon min  wrote:
>
> > > > +   /* Gamma */
> > > > +   mipi_dbi_command(dbi, ILI9341_3GAMMA_EN, 0x00);
> > > > +   mipi_dbi_command(dbi, MIPI_DCS_SET_GAMMA_CURVE, 0x01);
> > > > +   mipi_dbi_command(dbi, ILI9341_PGAMMA,
> > > > +0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1,
> > > > +0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00);
> > > > +   mipi_dbi_command(dbi, ILI9341_NGAMMA,
> > > > +0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xc1,
> > > > +0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f);
> > >
> > > It seems to be copies of the stuff above, but why is there a different
> > > gamma if you use DBI?
>
> > for dbi interface, currently i just copy the code from tiny/ili9341.c.
> > as so many boards use this driver now, like raspberry pi, etc
> > i'm afraid it's will not work after modification. so, just leave the
> > original code there.
>
> OK if you move it to ili9341_config it will be clear which panels
> need this gamma and which panels need another gamma.
>
> I think there should be one ili9341_config for the new st,*
> variant and one for the old DBI variant.
>
Okay, it's a good idea to setup two different configs.  ili9341_dbi_config,
ili9341_dpi_config. first for old dbi variant, second for dpi variant.

> > anther question:
> > is there any panel driver have dbi & dpi or dpi & dsi supported? which
> > i mean support
> > two different panel interface in one driver.
> > thanks
>
> Usually you split the driver in three files becuase a driver can
> only list one initcall, and also it makes it modularized.
>
> There is nothing in-tree but look at my branch here:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/log/?h=ux500-skomer-v5.7-rc1
>
> You see how I split up the s6e63m0 driver in one SPI part
> and one DSI part:
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?h=ux500-skomer-v5.7-rc1=6c0e1fb5df5fa8fa857dee65f6c0f54d06d158a7
> https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?h=ux500-skomer-v5.7-rc1=cfbf562cc709b53b62f5fbc7fedf176ffa17b088
>
> The overall idea should work the same with DBI.
>
> Yours,
> Linus Walleij
>
> Yours,
> Linus Walleij

Thanks for share, but i thinks it's not suitable to my case. the difference is
for panel s6e63m0
1 spi only for panel register configuration
2 dpi for rgb video data transfer (drm_panel_init(..., DRM_MODE_CONNECTOR_DPI);)

my case:
1 support ili9341 by drm mipi dbi (only spi bus,  "3/4 line serial
interface", pdf chap 7.6.1), Ie, raspberry pi + ili9341 + spi
2 support ili9341 by spi & dpi (spi for register set, dpi for rgb
data, "6/16/18 bit parallel rgb interface", pdf chap 7.6.8)
   Ie, stm32f429+ili9341+ltdc+spi
these two communication type has no dependency with each other.

DBI has much more difference than DPI & SPI, or DSI & SPI in drm.
   drm_mipi_dbi support both panel register configuration and video
data transfer via spi
   with or without dc pins.
   also the registration to drm is difference, for dbi is
mipi_dbi_dev_init and drm_fbdev_generic_setup
   for panel driver is drm_panel_init and drm_panel_add
at soc's view, we can drive ili9341 to work just by drm mipi dbi
(actually it's dbi -> spi bus) without host's lcd or dsi controller
but for some panel can't transfer video data by spi, and with dpi or
dsi interface, must connect to host's lcd or dsi controller.

so, for ilitek-ili9341 , it's use different dts binding drive to
register different client type (dbi, or dpi & spi) to drm.
actually, there is a driver tiny/ili9341.c support this panel by spi
bus only already. but, from Sam's suggestion, should extend this
driver
to support dpi & spi interface, this is the background of panel-ilitek-ili9341.c

thanks.

best regards.

dillon
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 5/5] drm/panel: Add ilitek ili9341 driver

2020-05-15 Thread dillon min
Hi Linus,

Thanks for reviewing.

On Thu, May 14, 2020 at 4:14 PM Linus Walleij  wrote:
>
> Hi Dillon,
>
> thanks for your patch! Overall this looks like a good start.
>
> On Tue, May 12, 2020 at 9:04 AM  wrote:
>
> > #define ILI9341_SLEEP_OUT0x11   /* Sleep out register */
>
> This is not a register, also just use MIPI_DCS_EXIT_SLEEP_MODE
> in the code.
>
Yes, i will try to reuse MIPI_DCS_xxx.

> > +#define ILI9341_DFC  0xb6   /* Display Function Control
> > +* register
> > +*/
>
> This commenting style doesn't work, either just put it after /* the define */
> and don't care if the line gets a bit long and checkpatch complains,
> or
>
> /*
>  * Put it above the define like this
>  */
> #define FOO 0x00
>
Ok, will change this comments.

> > +/**
> > + * struct ili9341_config - the system specific ILI9341 configuration
>
> Nice with this per-system config, it makes the driver easy to maintain
> for new users.
>
Yes, will try to move more system related configurations to this part,
instead of hard code.

> > +static int ili9341_dpi_init(struct ili9341 *ili)
> > +{
> > +   ili9341_command(ili, 0xca, 0xc3, 0x08, 0x50);
>
> This stuff is a bit hard to understand, don't you think?
>
> But given that register 0xCA seems undocumented I don't
> know if there is anything more you can do, so it is OK
> I suppose.
>
> > +   ili9341_command(ili, ILI9341_POWERB, 0x00, 0xc1, 0x30);
>
> This command is described in the manual  page 196.
> Version: V1.11
> Document No.: ILI9341_DS_V1.11.pdf
> https://dflund.se/~triad/ILI9341_v1.11.pdf
>
Yes, "ili9341_command(ili, 0xca, 0xc3, 0x08, 0x50);" i ported from st's sdk.
will use ILI9341_XXX to replace these magic numbers

> And this goes for all the below commands. Please add some more defines
> from the datasheet and have less magic numbers in the driver.
>
> > +   ili9341_command(ili, ILI9341_POWER_SEQ, 0x64, 0x03, 0x12, 0x81);
> > +   ili9341_command(ili, ILI9341_DTCA, 0x85, 0x00, 0x78);
> > +   ili9341_command(ili, ILI9341_POWERA, 0x39, 0x2c, 0x00, 0x34, 0x02);
> > +   ili9341_command(ili, ILI9341_PRC, 0x20);
> > +   ili9341_command(ili, ILI9341_DTCB, 0x00, 0x00);
> > +   ili9341_command(ili, ILI9341_FRC, 0x00, 0x1b);
> > +   ili9341_command(ili, ILI9341_DFC, 0x0a, 0xa2);
> > +   ili9341_command(ili, ILI9341_POWER1, 0x10);
> > +   ili9341_command(ili, ILI9341_POWER2, 0x10);
> > +   ili9341_command(ili, ILI9341_VCOM1, 0x45, 0x15);
> > +   ili9341_command(ili, ILI9341_VCOM2, 0x90);
> > +   ili9341_command(ili, ILI9341_MAC, 0xc8);
> > +   ili9341_command(ili, ILI9341_3GAMMA_EN, 0x00);
> > +   ili9341_command(ili, ILI9341_RGB_INTERFACE, 0xc2);
> > +   ili9341_command(ili, ILI9341_DFC, 0x0a, 0xa7, 0x27, 0x04);
> > +   ili9341_command(ili, ILI9341_COLUMN_ADDR, 0x00, 0x00, 0x00, 0xef);
> > +   ili9341_command(ili, ILI9341_PAGE_ADDR, 0x00, 0x00, 0x01, 0x3f);
> > +   ili9341_command(ili, ILI9341_INTERFACE, 0x01, 0x00, 0x06);
> > +   if (ili->input == ILI9341_INPUT_PRGB_18_BITS)
> > +   ili9341_command(ili, ILI9341_PIXEL_FORMAT, 0x66);
> > +   else
> > +   ili9341_command(ili, ILI9341_PIXEL_FORMAT, 0x56);
> > +   ili9341_command(ili, ILI9341_GRAM);
> > +   msleep(200);
>
> I think some of the above should not be hard coded but should instead
> be stored in fields in struct ili9341_config. I know it can be a bit
> tedious but it makes things much more clear.
>
Ok, will go deeper to find out some register configuration move to
system config like rgb bus 16/18 bits

> > +   ili9341_command(ili, ILI9341_GAMMA, 0x01);
> > +   ili9341_command(ili, ILI9341_PGAMMA, 0x0f, 0x29, 0x24, 0x0c, 0x0e,
> > +   0x09, 0x4e, 0x78, 0x3c, 
> > 0x09,
> > +   0x13, 0x05, 0x17, 0x11, 
> > 0x00);
> > +   ili9341_command(ili, ILI9341_NGAMMA, 0x00, 0x16, 0x1b, 0x04, 0x11,
> > +   0x07, 0x31, 0x33, 0x42, 
> > 0x05,
> > +   0x0c, 0x0a, 0x28, 0x2f, 
> > 0x0f);
>
> This should definately be in ili9341_config, as it is a screen property.
>
> In the long run I would like these panels to support setting gamma
> from userspace etc but it is a big tedious work to get that right
> so hard-coding a default per-variant is fine.
>
ok, will refer to panel-ilitek-ili9322 and panel-novatek-nt35510 driver.

> You can check in e.g. panel-novatek-nt35510.c how I encoded
> such sequences in per-variant data.
>
> > +static int ili9341_dpi_power_off(struct ili9341 *ili)
> > +{
> > +   /* Disable power */
> > +   if (!IS_ERR(ili->vcc))
> > +   return regulator_disable(ili->vcc);
> > +
> > +   return 0;
> > +}
>
> Usually you should also assert RESET when disabling
> power.
>
ok

> > +/* This is 

Re: [PATCH v3 3/5] ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board

2020-05-15 Thread dillon min
Hi Alexandre,

On Thu, May 14, 2020 at 8:53 PM Alexandre Torgue
 wrote:
>
>
>
> On 5/14/20 10:24 AM, Linus Walleij wrote:
> > On Tue, May 12, 2020 at 9:04 AM  wrote:
> >
> >> From: dillon min 
> >>
> >> Enable the ltdc & ili9341 on stm32429-disco board.
> >>
> >> Signed-off-by: dillon min 
> >
> > This mostly looks good but...
> >
> >> + {
> >> +   status = "okay";
> >> +   pinctrl-0 = <_pins>;
> >> +   pinctrl-names = "default";
> >> +   #address-cells = <1>;
> >> +   #size-cells = <0>;
> >> +   cs-gpios = < 2 GPIO_ACTIVE_LOW>;
> >> +   dmas = < 3 2 0x400 0x0>,
> >> +  < 4 2 0x400 0x0>;
> >> +   dma-names = "rx", "tx";
> >
> > These DMA assignments seem to be SoC things and should
> > rather be in the DTS(I) file where  is defined, right?
> > stm32f429.dtsi I suppose?
>
> I agree with Linus, DMA have to be defined in SoC dtsi. And if a board
> doesn't want to use it, we use the "delete-property".
Yes, will move to Soc dtsi in next submits.

i'm working on write a v4l2-m2m driver for dma2d of stm32 to support
pixel conversion
alpha blending between foreground and background graphics.

as you know, some soc's engineer trying to add this function to drm system.

do you know st's planning about soc's hardware accelerator driver on stm32mp?
such as chrom-art, will add to drm subsystem via ioctl to access, or to v4l2,

thanks.

>
> >
> > It is likely the same no matter which device is using spi5.
> >
> > Yours,
> > Linus Walleij
> >
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 3/5] ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board

2020-05-15 Thread dillon min
Hi, Linus,

thanks for reviewing.

On Thu, May 14, 2020 at 4:24 PM Linus Walleij  wrote:
>
> On Tue, May 12, 2020 at 9:04 AM  wrote:
>
> > From: dillon min 
> >
> > Enable the ltdc & ili9341 on stm32429-disco board.
> >
> > Signed-off-by: dillon min 
>
> This mostly looks good but...
>
> > + {
> > +   status = "okay";
> > +   pinctrl-0 = <_pins>;
> > +   pinctrl-names = "default";
> > +   #address-cells = <1>;
> > +   #size-cells = <0>;
> > +   cs-gpios = < 2 GPIO_ACTIVE_LOW>;
> > +   dmas = < 3 2 0x400 0x0>,
> > +  < 4 2 0x400 0x0>;
> > +   dma-names = "rx", "tx";
>
> These DMA assignments seem to be SoC things and should
> rather be in the DTS(I) file where  is defined, right?
> stm32f429.dtsi I suppose?
>
> It is likely the same no matter which device is using spi5.
>
> Yours,
> Linus Walleij

Yes, the dma assignments can be moved to stm32f429.dtsi file.
i will change it.

thanks.

best regards.

dillon,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 5/5] drm/panel: add panel driver for Ilitek ili9341 panels

2020-05-11 Thread dillon min
Sam Ravnborg  于2020年5月10日周日 上午4:06写道:
>
> Hi Dillon.
>
> On Fri, May 08, 2020 at 06:13:43PM +0800, dillon min wrote:
> > Hi Sam,
> >
> >   Thanks for your comments, i will rework this panel driver after l3gd20
> > patch submission.
> >
> > Sam Ravnborg  于2020年5月8日周五 下午5:02写道:
> >
> > > Hi Dillon.
> > >
> > > Patch submissions starts to look fine.
> > >
> > > On Fri, May 08, 2020 at 12:13:14PM +0800, dillon.min...@gmail.com wrote:
> > > > From: dillon min 
> > > >
> > > > This is a driver for 320x240 TFT panels, accepting a rgb input
> > > > streams that get adapted and scaled to the panel.
> > > This driver is, I suppose, prepared to be a driver for ILI9341 based
> > > panles, and as such not for a fixed resolution.
> > > I expect (hope) we in the future will see more panels added.
> > >
> > > As i checked ili9341 datasheets, this panel just support 240x320
> > resolution only.  if i'm wrong , please correct me. thanks
> > https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf
> >
> > This panel can support 9 different kinds of interface , "3/4-line Serial
> > Interface" have been supported by tiny/ili9341.c. i was verified it
> > but the performance on stm32f4 is very low.
> It had somehow escaped my mind we already have a driver for ili9341
> based panels.
> And we do not want onyl one driver for this IC.
> So please extent the current driver to match your panel as well as
> the original panel.
> And then also extend the current binding for ili9341, which
> you may have to convert to DT Schema in the process.
>
> This is more work now but when it is done we end up with a much better
> solution than if we introduce an additional driver for ili9341.
>
> Sorry for not catching this in the inital review.
>
> Sam
>
>
Hi Sam,

Yes, it's should be more reasonable to support different interface of
a panel in one driver.
i will add mipi dpi & dbi support to this panel in one driver just
like panel-simple.c(dpi & dsi)

one question, what to do next:
1 should i just add code to tiny/ili9341.c to support mipi dpi.
   which means remove panel/panel-ilitek-ili9341.c
2 merge tiny/ili9341.c mipi dbi support to panel/panel-ilitek-ili9341.c ,
   which means remove tiny/ili9341.c after this work done.

to extend dts binding for different interface. Ie.

original:
164 static const struct of_device_id ili9341_of_match[] = {
165 { .compatible = "adafruit,yx240qv29" },
166 { }
167 };
168 MODULE_DEVICE_TABLE(of, ili9341_of_match);
169
170 static const struct spi_device_id ili9341_id[] = {
171 { "yx240qv29", 0 },
172 { }
173 };
174 MODULE_DEVICE_TABLE(spi, ili9341_id);

i want to extend of_device_id and spi_device_id for driver to identify
dpi or dbi in probe.
"adafruit,yx240qv29" is for users who use original tiny drm driver
mipi dbi compatible

for panel's parallel mcu and parallel rgb interface.
static const struct of_device_id ili9341_of_match[] = {
 { .compatible = "adafruit,yx240qv29" },
 { .compatible = "ili9341,parallel-mcu" },
 { .compatible = "ili9341,parallel-rgb" },
 { }
};
static const struct spi_device_id ili9341_id[] = {
 { "yx240qv29", 0 },
 { "parallel-mcu", 0 },
 { "parallel-rgb", 0 },
 { }
};
static int ili9341_probe(struct spi_device *spi)
{
   ...
  const struct spi_device_id *id = spi_get_device_id(spi);
  if (!strcmp(id->name, "yx240qv29")) {
  mipi dbi register
  } else if (!strcmp(id->name, "parallel-rgb") ||
   !strcmp(id->name, "parallel-mcu") {
 mipi dpi register
  } else {
failed handle
 }
 
}

if this is a good idea to extend dts binding ?

thanks,

best regards.

Dillon
> >
> > currently, i just have stm32f429-disco in hands, with 18-bit parallel rgb
> > bus connected on this board. reference to panel-ilitek-ili9322 and
> > panel-ilitek-ili9881 driver, i have some plan to rewrite this driver.
> >
> > 1 add your below comments in.
> > 2 use dc-gpio, reset-gpio, rgb-interface-bits from dts to config panel
> > interface.
> > 3 drop regmap, porting drm_mipi_dbi's mipi_dbi_command to config panel
> > paramter. like tiny/ili9341.c
> > 4 support rgb-16, rgb-18 interface.
> > 5 use optional regulator or power gpio to control panel's power, as panel
> > power is always on for my board, so i can't test this part. could i add the
> > code which can't be tested?
> > 6 support rotation in panel confi

Re: [PATCH v2 5/5] drm/panel: add panel driver for Ilitek ili9341 panels

2020-05-09 Thread dillon min
Hi sam, all,

i'm not sure you had receive this mail , as gmail's html encoded
messages blocked by linux arm kernel mailing list.
so, resent it in plain text again. with my name "dillon:  " at left

sorry for trouble.

dillon

best regards

dillon min  于2020年5月8日周五 下午6:13写道:
>
Hi Sam,

   Thanks for your comments, i will rework this panel driver after
l3gd20 patch submission.

> Sam Ravnborg  于2020年5月8日周五 下午5:02写道:
>>
>> Hi Dillon.
>>
>> Patch submissions starts to look fine.
>>
>> On Fri, May 08, 2020 at 12:13:14PM +0800, dillon.min...@gmail.com wrote:
>> > From: dillon min 
>> >
>> > This is a driver for 320x240 TFT panels, accepting a rgb input
>> > streams that get adapted and scaled to the panel.
> This driver is, I suppose, prepared to be a driver for ILI9341 based
> panles, and as such not for a fixed resolution.
> I expect (hope) we in the future will see more panels added.
>
dillon:
As i checked ili9341 datasheets, this panel just support 240x320
resolution only.  if i'm wrong , please correct me. thanks
https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf

This panel can support 9 different kinds of interface , "3/4-line
Serial Interface" have been supported by tiny/ili9341.c. i was
verified it
but the performance on stm32f4 is very low.

currently, i just have stm32f429-disco in hands, with 18-bit parallel
rgb bus connected on this board. reference to panel-ilitek-ili9322 and
panel-ilitek-ili9881 driver, i have some plan to rewrite this driver.

1 add your below comments in.
2 use dc-gpio, reset-gpio, rgb-interface-bits from dts to config panel
interface.
3 drop regmap, porting drm_mipi_dbi's mipi_dbi_command to config panel
paramter. like tiny/ili9341.c
4 support rgb-16, rgb-18 interface.
5 use optional regulator or power gpio to control panel's power, as
panel power is always on for my board, so i can't test this part.
could i add the code which can't be tested?
6 support rotation in panel config (currently , i rotate the screen by
kernel cmdline paramter)

 if you have any other common panel configuration should be add ,
please inform me.

 thanks.
>>
>>
>> Some things to fix, see comments in the follwoing.
>>
>> Sam
>>
>> >
>> > Signed-off-by: dillon min 
>> > ---
>> >  drivers/gpu/drm/panel/Kconfig|   8 +
>> >  drivers/gpu/drm/panel/Makefile   |   1 +
>> >  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 561 
>> > +++
>> >  3 files changed, 570 insertions(+)
>> >  create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
>> >
>> > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
>> > index a1723c1..e42692c 100644
>> > --- a/drivers/gpu/drm/panel/Kconfig
>> > +++ b/drivers/gpu/drm/panel/Kconfig
>> > @@ -95,6 +95,14 @@ config DRM_PANEL_ILITEK_IL9322
>> > Say Y here if you want to enable support for Ilitek IL9322
>> > QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
>> >
>> > +config DRM_PANEL_ILITEK_IL9341
>> ILI9341 - so the config name matches the name of the driver IC.
>>
>> > + tristate "Ilitek ILI9341 240x320 QVGA panels"
>> > + depends on OF && SPI
>> > + select REGMAP
>> > + help
>> > +   Say Y here if you want to enable support for Ilitek IL9341
>> > +   QVGA (240x320) RGB panels.
>> See comment to the changelog, the driver is more generic - I assume.
>> So the wording here can be improved to express this.
>>

dillon:  Add support RGB 16bits and RGB 18bits bus only ?

>>
>> > +
>> >  config DRM_PANEL_ILITEK_ILI9881C
>> >   tristate "Ilitek ILI9881C-based panels"
>> >   depends on OF
>> > diff --git a/drivers/gpu/drm/panel/Makefile 
>> > b/drivers/gpu/drm/panel/Makefile
>> > index 96a883c..d123543 100644
>> > --- a/drivers/gpu/drm/panel/Makefile
>> > +++ b/drivers/gpu/drm/panel/Makefile
>> > @@ -8,6 +8,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += 
>> > panel-elida-kd35t133.o
>> >  obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) += panel-feixin-k101-im2ba02.o
>> >  obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += 
>> > panel-feiyang-fy07024di26a30d.o
>> >  obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
>> > +obj-$(CONFIG_DRM_PANEL_ILITEK_IL9341) += panel-ilitek-ili9341.o
>> >  obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
>> >  obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
>> >  obj-$(CONF

Re: [PATCH v2 5/5] drm/panel: add panel driver for Ilitek ili9341 panels

2020-05-09 Thread dillon min
Hi Sam,

  Thanks for your comments, i will rework this panel driver after l3gd20
patch submission.

Sam Ravnborg  于2020年5月8日周五 下午5:02写道:

> Hi Dillon.
>
> Patch submissions starts to look fine.
>
> On Fri, May 08, 2020 at 12:13:14PM +0800, dillon.min...@gmail.com wrote:
> > From: dillon min 
> >
> > This is a driver for 320x240 TFT panels, accepting a rgb input
> > streams that get adapted and scaled to the panel.
> This driver is, I suppose, prepared to be a driver for ILI9341 based
> panles, and as such not for a fixed resolution.
> I expect (hope) we in the future will see more panels added.
>
> As i checked ili9341 datasheets, this panel just support 240x320
resolution only.  if i'm wrong , please correct me. thanks
https://cdn-shop.adafruit.com/datasheets/ILI9341.pdf

This panel can support 9 different kinds of interface , "3/4-line Serial
Interface" have been supported by tiny/ili9341.c. i was verified it
but the performance on stm32f4 is very low.

currently, i just have stm32f429-disco in hands, with 18-bit parallel rgb
bus connected on this board. reference to panel-ilitek-ili9322 and
panel-ilitek-ili9881 driver, i have some plan to rewrite this driver.

1 add your below comments in.
2 use dc-gpio, reset-gpio, rgb-interface-bits from dts to config panel
interface.
3 drop regmap, porting drm_mipi_dbi's mipi_dbi_command to config panel
paramter. like tiny/ili9341.c
4 support rgb-16, rgb-18 interface.
5 use optional regulator or power gpio to control panel's power, as panel
power is always on for my board, so i can't test this part. could i add the
code which can't be tested?
6 support rotation in panel config (currently , i rotate the screen by
kernel cmdline paramter)

if you have any other common panel configuration should be add , please
inform me.

thanks.

>
> Some things to fix, see comments in the follwoing.
>
> Sam
>
> >
> > Signed-off-by: dillon min 
> > ---
> >  drivers/gpu/drm/panel/Kconfig|   8 +
> >  drivers/gpu/drm/panel/Makefile   |   1 +
> >  drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 561
> +++
> >  3 files changed, 570 insertions(+)
> >  create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> >
> > diff --git a/drivers/gpu/drm/panel/Kconfig
> b/drivers/gpu/drm/panel/Kconfig
> > index a1723c1..e42692c 100644
> > --- a/drivers/gpu/drm/panel/Kconfig
> > +++ b/drivers/gpu/drm/panel/Kconfig
> > @@ -95,6 +95,14 @@ config DRM_PANEL_ILITEK_IL9322
> > Say Y here if you want to enable support for Ilitek IL9322
> > QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
> >
> > +config DRM_PANEL_ILITEK_IL9341
> ILI9341 - so the config name matches the name of the driver IC.
>
> > + tristate "Ilitek ILI9341 240x320 QVGA panels"
> > + depends on OF && SPI
> > + select REGMAP
> > + help
> > +   Say Y here if you want to enable support for Ilitek IL9341
> > +   QVGA (240x320) RGB panels.
> See comment to the changelog, the driver is more generic - I assume.
> So the wording here can be improved to express this.
>
> Add support RGB 16bits and RGB 18bits bus only ?

> > +
> >  config DRM_PANEL_ILITEK_ILI9881C
> >   tristate "Ilitek ILI9881C-based panels"
> >   depends on OF
> > diff --git a/drivers/gpu/drm/panel/Makefile
> b/drivers/gpu/drm/panel/Makefile
> > index 96a883c..d123543 100644
> > --- a/drivers/gpu/drm/panel/Makefile
> > +++ b/drivers/gpu/drm/panel/Makefile
> > @@ -8,6 +8,7 @@ obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) +=
> panel-elida-kd35t133.o
> >  obj-$(CONFIG_DRM_PANEL_FEIXIN_K101_IM2BA02) +=
> panel-feixin-k101-im2ba02.o
> >  obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) +=
> panel-feiyang-fy07024di26a30d.o
> >  obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
> > +obj-$(CONFIG_DRM_PANEL_ILITEK_IL9341) += panel-ilitek-ili9341.o
> >  obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
> >  obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
> >  obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
> > diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> > new file mode 100644
> > index 000..ec22d80
> > --- /dev/null
> > +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
> > @@ -0,0 +1,561 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Ilitek ILI9341 TFT LCD drm_panel driver.
> > + *
> > + * This panel can be configured to support:
> > + * - 16-bit parallel RGB interface
> The

Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-05-06 Thread dillon min
Sam Ravnborg  于2020年5月2日周六 下午2:30写道:

> Hi dillon min
>
> > > okay, thanks alexandre, i will go through these docs. currently i'm on
> may
> > day holiday,  will be back at  next wensday.
> > after go back to work. i will separate this patch to five part with 9
> > patchs , should be more clear
> >
> > dts releated
> > 1,  ARM: dts: stm32: Add i2c3 node for stm32f429
> > 2,  ARM: dts: stm32: Add drm panel ili9341 nodes connect to ldtc
> > support for stm32f429-disco board
> > 3,  ARM: dts: stm32: Add stmpe811 touch screen support for
> > stm32f429-disco board
> > 4,  ARM: dts: stm32: Add l3gd20 gyroscope sensor support for
> > stm32f429-disco board
> >
> > clk releated
> > 1, clk: stm32: Fix ltdc loading hang in set clk rate, pll_hw set to
> > clks[PLL_VCO_SAI] but not clks[PLL_SAI]
> > 2, clk: stm32: Add CLK_IGNORE_UNUSED flags for ltdc, make sure ltdc
> clk
> > not be released after system startup
> >
> > spi releated
> > 1, spi: stm32: Add transfer mode SPI_SIMPLE_RX, SPI_3WIRE_RX support
> > for stm32f4
> >
> > drm releated
> > 1, drm/panel: Add panel driver ilitek-ili9341
> >
> > doc releated
> >  1, dt-bindings: display: panel: Add binding document for Ilitek
> Ili9341
>
> Patch separation looks good.
> Please cc: me on both the binding and the panel patches.
> The binding must be in DT Schema format (.yaml).
> See a lot of examples in drm-misc-next for inspiration.
>
> Looks forward to see/review your submission.
>
> Sam
>

hi Sam,

just sumbmit a patchset about ltdc with ili-9341 support on stm32f429-disco
board, with yaml
documents inside as well.

thanks,

Dillon,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-05-02 Thread dillon min
Hi Alexandre,

Alexandre Torgue  于2020年4月30日周四 下午7:45写道:

>
>
> On 4/30/20 12:26 PM, dillon min wrote:
> > Hi Alexandre,
> >
> > Alexandre Torgue  > <mailto:alexandre.tor...@st.com>> 于2020年4月30日周四 下午5:57写道:
> >
> > Hi
> >
> > On 4/30/20 11:43 AM, dillon.min...@gmail.com
> >     <mailto:dillon.min...@gmail.com> wrote:
> >  > From: dillon min  > <mailto:dillon.min...@gmail.com>>
> >  >
> >  > Signed-off-by: dillon min  > <mailto:dillon.min...@gmail.com>>
> >
> > Commit title should be ARM: dts: stm32: bla bla on stm32f429 and
> please
> > a commit message.
> >
> >
> > *okay, thanks for your quicky response, this is my first kernel pull
> > request, i will resubmit all patchsets following the history submits
> > style who was did.*
>
> ok no pb. In general way you have to execute ./scripts/checkpatch.pl to
> check some style errors before sending. Use ./scripts/get_maintainer.pl
> to see to who you have to send the patch. When you have several patches
> in a series, you need to have a cover-letter which explains the aim of
> your series. To have an idea of commit format just use git log on the
> file changed to see how previous accepted commi have been written.
>
> More details here: Documentation/process/submitting-patches.rst
>
> okay, thanks alexandre, i will go through these docs. currently i'm on may
day holiday,  will be back at  next wensday.
after go back to work. i will separate this patch to five part with 9
patchs , should be more clear

dts releated
1,  ARM: dts: stm32: Add i2c3 node for stm32f429
2,  ARM: dts: stm32: Add drm panel ili9341 nodes connect to ldtc
support for stm32f429-disco board
3,  ARM: dts: stm32: Add stmpe811 touch screen support for
stm32f429-disco board
4,  ARM: dts: stm32: Add l3gd20 gyroscope sensor support for
stm32f429-disco board

clk releated
1, clk: stm32: Fix ltdc loading hang in set clk rate, pll_hw set to
clks[PLL_VCO_SAI] but not clks[PLL_SAI]
2, clk: stm32: Add CLK_IGNORE_UNUSED flags for ltdc, make sure ltdc clk
not be released after system startup

spi releated
1, spi: stm32: Add transfer mode SPI_SIMPLE_RX, SPI_3WIRE_RX support
for stm32f4

drm releated
1, drm/panel: Add panel driver ilitek-ili9341

doc releated
 1, dt-bindings: display: panel: Add binding document for Ilitek Ili9341

TODO:
ltdc was verified by fbcon+logo, uname -a > /dev/tty0 , need more time to
write test code with libdrm to verify osd
stmpe811 need cross compile tslib to do touch screen calibration
l3gd20 was tested by read data from /sys/bus/iio, need cross compile libiio
to be verified by application with libiio
add dma2d to ltdc driver to speed up graphic render
dcmi camera with ov5640, the sdram might be not enough to support this.
currently after zImage load to sdram,
just leave less than 2M bytes for application.

>
> >  > ---
> >  >   .../bindings/display/panel/ilitek,ili9341.txt  | 42
> +++
> >  >   arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 79
> > +++
> >  >   arch/arm/boot/dts/stm32f429-disco.dts  | 88
> > ++
> >  >   arch/arm/boot/dts/stm32f429.dtsi   | 12 +++
> >  >   4 files changed, 221 insertions(+)
> >  >   create mode 100644
> > Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> >  >
> >  > diff --git
> > a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> > b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> >
> > This binding description should be in a separate patch and you have
> to
> > write in YAML format.
> >
> > *okay, will do it later. *
> >
> >
> >  > new file mode 100644
> >  > index 000..f5a4e55
> >  > --- /dev/null
> >  > +++
> > b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> >  > @@ -0,0 +1,42 @@
> >  > +Ilitek ILI9341 TFT panel driver with SPI control bus
> >  > +
> >  > +This is a driver for 240x320 TFT panels, accepting a rgb input
> >  > +streams that get adapted and scaled to the panel.
> >  > +
> >  > +Required properties:
> >  > +  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
> >  > +(full system-specific compatible is always required to look
> > up configuration)
> >  > +  - reg: address of the panel on the SPI bus
> >  > +
&

Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-05-01 Thread dillon min
Hi Alexandre,

Alexandre Torgue  于2020年4月30日周四 下午5:57写道:

> Hi
>
> On 4/30/20 11:43 AM, dillon.min...@gmail.com wrote:
> > From: dillon min 
> >
> > Signed-off-by: dillon min 
>
> Commit title should be ARM: dts: stm32: bla bla on stm32f429 and please
> a commit message.
>
>
*okay, thanks for your quicky response, this is my first kernel pull
request, i will resubmit all patchsets following the history submits style
who was did.*


> > ---
> >   .../bindings/display/panel/ilitek,ili9341.txt  | 42 +++
> >   arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 79
> +++
> >   arch/arm/boot/dts/stm32f429-disco.dts  | 88
> ++
> >   arch/arm/boot/dts/stm32f429.dtsi   | 12 +++
> >   4 files changed, 221 insertions(+)
> >   create mode 100644
> Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> >
> > diff --git
> a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
>
> This binding description should be in a separate patch and you have to
> write in YAML format.
>
> *okay, will do it later. *

>
> > new file mode 100644
> > index 000..f5a4e55
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> > @@ -0,0 +1,42 @@
> > +Ilitek ILI9341 TFT panel driver with SPI control bus
> > +
> > +This is a driver for 240x320 TFT panels, accepting a rgb input
> > +streams that get adapted and scaled to the panel.
> > +
> > +Required properties:
> > +  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
> > +(full system-specific compatible is always required to look up
> configuration)
> > +  - reg: address of the panel on the SPI bus
> > +
> > +Optional properties:
> > +  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
> > +  - dc-gpios: a GPIO spec for the dc pin, see gpio/gpio.txt
> > +
> > +  The following optional properties only apply to RGB input mode:
> > +
> > +  - pixelclk-active: see display/panel/display-timing.txt
> > +  - de-active: see display/panel/display-timing.txt
> > +  - hsync-active: see display/panel/display-timing.txt
> > +  - vsync-active: see display/panel/display-timing.txt
> > +
> > +The panel must obey the rules for a SPI slave device as specified in
> > +spi/spi-bus.txt
> > +
> > +The device node can contain one 'port' child node with one child
> > +'endpoint' node, according to the bindings defined in
> > +media/video-interfaces.txt. This node should describe panel's video bus.
> > +
> > +Example:
> > +
> > +panel: display@0 {
> > + compatible = "stm32f429-disco,ltdc-panel", "ilitek,ili9341";
> > + reg = <0>;
> > + spi-3wire;
> > + spi-max-frequency = <1000>;
> > + dc-gpios = < 13 0>;
> > + port {
> > + panel_in: endpoint {
> > + remote-endpoint = <_out>;
> > + };
> > + };
> > +};
> > diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > index 392fa14..45b68f4 100644
> > --- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > +++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > @@ -316,6 +316,85 @@
> >   };
> >   };
> >
> > + ltdc_pins_f429_disco: ltdc-1 {
> > + pins {
> > + pinmux =  AF14)>,
> > + /* LCD_HSYNC */
> > +   AF14)>,
> > +  /* LCD_VSYNC */
> > +   AF14)>,
> > +  /* LCD_CLK */
> > +   AF14)>,
> > +  /* LCD_R2 */
> > +   AF9)>,
> > +  /* LCD_R3 */
> > +   AF14)>,
> > +  /* LCD_R4 */
> > +   AF14)>,
> > +  /* LCD_R5 */
> > +

Re: [PATCH 1/4] add dts node for drm panel driver ili9341 add dts i2c3 for stmpe touch add dts spi5 for gyro & ili9341

2020-05-01 Thread dillon min
Philippe Schenker  于 2020年4月30日周四 20:08写道:

> On Thu, 2020-04-30 at 17:43 +0800, dillon.min...@gmail.com wrote:
> > From: dillon min 
> >
> > Signed-off-by: dillon min 
> > ---
> >  .../bindings/display/panel/ilitek,ili9341.txt  | 42 +++
> >  arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 79
> > +++
> >  arch/arm/boot/dts/stm32f429-disco.dts  | 88
> > ++
> >  arch/arm/boot/dts/stm32f429.dtsi   | 12 +++
> >  4 files changed, 221 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> >
> > diff --git
> > a/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> > b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> > new file mode 100644
> > index 000..f5a4e55
> > --- /dev/null
> > +++
> > b/Documentation/devicetree/bindings/display/panel/ilitek,ili9341.txt
> > @@ -0,0 +1,42 @@
> > +Ilitek ILI9341 TFT panel driver with SPI control bus
> > +
> > +This is a driver for 240x320 TFT panels, accepting a rgb input
> > +streams that get adapted and scaled to the panel.
> > +
> > +Required properties:
> > +  - compatible: "stm32f429-disco,ltdc-panel", "ilitek,ili9341"
> > +(full system-specific compatible is always required to look up
> > configuration)
> > +  - reg: address of the panel on the SPI bus
> > +
> > +Optional properties:
> > +  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
> > +  - dc-gpios: a GPIO spec for the dc pin, see gpio/gpio.txt
> > +
> > +  The following optional properties only apply to RGB input mode:
> > +
> > +  - pixelclk-active: see display/panel/display-timing.txt
> > +  - de-active: see display/panel/display-timing.txt
> > +  - hsync-active: see display/panel/display-timing.txt
> > +  - vsync-active: see display/panel/display-timing.txt
> > +
> > +The panel must obey the rules for a SPI slave device as specified in
> > +spi/spi-bus.txt
> > +
> > +The device node can contain one 'port' child node with one child
> > +'endpoint' node, according to the bindings defined in
> > +media/video-interfaces.txt. This node should describe panel's video
> > bus.
> > +
> > +Example:
> > +
> > +panel: display@0 {
> > + compatible = "stm32f429-disco,ltdc-panel", "ilitek,ili9341";
> > + reg = <0>;
> > + spi-3wire;
> > + spi-max-frequency = <1000>;
> > + dc-gpios = < 13 0>;
> > + port {
> > + panel_in: endpoint {
> > + remote-endpoint = <_out>;
> > + };
> > + };
> > +};
> > diff --git a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > index 392fa14..45b68f4 100644
> > --- a/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > +++ b/arch/arm/boot/dts/stm32f4-pinctrl.dtsi
> > @@ -316,6 +316,85 @@
> >   };
> >   };
> >
> > + ltdc_pins_f429_disco: ltdc-1 {
> > + pins {
> > + pinmux =  > 6,  AF14)>,
> > + /* LCD_HSYNC */
> > +   > 4,  AF14)>,
> > +  /* LCD_VSYNC */
> > +   > 7,  AF14)>,
> > +  /* LCD_CLK */
> > +   > AF14)>,
> > +  /* LCD_R2 */
> > +   > 0,  AF9)>,
> > +  /* LCD_R3 */
> > +   > AF14)>,
> > +  /* LCD_R4 */
> > +   > AF14)>,
> > +  /* LCD_R5 */
> > +   > 1,  AF9)>,
> > +  /* LCD_R6*/
> > +   > 6,  AF14)>,
> > +  /* LCD_R7 */
> > +   > 6,  AF14)>,
> > +