All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Fabio Falzoi <fabio.falzoi84@gmail.com>,
	thomas.petazzoni@free-electrons.com
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/10] Staging: fbtft: Use a struct to describe each LCD controller
Date: Thu, 23 Jul 2015 13:09:18 +0200	[thread overview]
Message-ID: <55B0CB5E.8070808@tronnes.org> (raw)
In-Reply-To: <1435646597-7612-4-git-send-email-fabio.falzoi84@gmail.com>


Den 30.06.2015 08:43, skrev Fabio Falzoi:
> Use a struct flexfb_lcd_controller to holds chip properties, instead of
> relying on a long 'if - else if' chain.
> This allows to:
> - use a simple linear search to verify if a certain LCD controller
> model is supported or not.
> - add support for a new LCD chip controller simply defining a new
> flexfb_lcd_controller struct.
>
> Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
> ---
>   drivers/staging/fbtft/fbtft.h  |  20 ++++
>   drivers/staging/fbtft/flexfb.c | 212 ++++++++++++++++++++++-------------------
>   2 files changed, 136 insertions(+), 96 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> index 7d817eb..c96c06b 100644
> --- a/drivers/staging/fbtft/fbtft.h
> +++ b/drivers/staging/fbtft/fbtft.h
> @@ -256,6 +256,26 @@ struct fbtft_par {
>   	void *extra;
>   };
>   
> +/**
> + * struct flexfb_lcd_controller - Describes the LCD controller properties
> + * @name: Model name of the chip
> + * @width: Width of display in pixels
> + * @height: Height of display in pixels
> + * @setaddrwin: Which set_addr_win() implementation to use
> + * @regwidth: LCD Controller Register width in bits
> + * @init_seq: LCD initialization sequence
> + * @init_seq_sz: Size of LCD initialization sequence
> + */
> +struct flexfb_lcd_controller {
> +	const char *name;
> +	unsigned int width;
> +	unsigned int height;
> +	unsigned int setaddrwin;
> +	unsigned int regwidth;
> +	int *init_seq;
> +	int init_seq_sz;
> +};
> +

Please put this in flexfb.c since it won't be used outside that file.

>   #define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__})/sizeof(int))
>   
>   #define write_reg(par, ...)                                              \
> diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
> index ed867e7..25b394d 100644
> --- a/drivers/staging/fbtft/flexfb.c
> +++ b/drivers/staging/fbtft/flexfb.c
> @@ -126,6 +126,89 @@ static int ssd1351_init[] = { -1, 0xfd, 0x12, -1, 0xfd, 0xb1, -1, 0xae, -1, 0xb3
>   			      -1, 0xab, 0x01, -1, 0xb1, 0x32, -1, 0xb4, 0xa0, 0xb5, 0x55, -1, 0xbb, 0x17, -1, 0xbe, 0x05,
>   			      -1, 0xc1, 0xc8, 0x80, 0xc8, -1, 0xc7, 0x0f, -1, 0xb6, 0x01, -1, 0xa6, -1, 0xaf, -3 };
>   
> +static const struct flexfb_lcd_controller flexfb_chip_table[] = {
> +	{
> +		.name = "st7735r",
> +		.width = 120,
> +		.height = 160,
> +		.init_seq = st7735r_init,
> +		.init_seq_sz = ARRAY_SIZE(st7735r_init),
> +	},
> +	{

Can this be put on one line? }, {

With the struct moved:
Acked-by: Noralf Trønnes <noralf@tronnes.org>


  parent reply	other threads:[~2015-07-23 11:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  6:43 [PATCH 00/10] Staging: fbtft: flexfb.c file clean up Fabio Falzoi
2015-06-30  6:43 ` [PATCH 01/10] Staging: fbtft: Remove paragraph about writing to FSF Fabio Falzoi
2015-06-30  6:43 ` [PATCH 02/10] Staging: fbtft: Remove unnecessary multiple blank lines Fabio Falzoi
2015-06-30  6:43 ` [PATCH 03/10] Staging: fbtft: Use a struct to describe each LCD controller Fabio Falzoi
2015-07-15  2:12   ` Greg KH
2015-07-23 11:09   ` Noralf Trønnes [this message]
2015-08-02 14:57     ` [PATCH v2] " Fabio Falzoi
2015-08-02 17:54       ` Noralf Trønnes
2015-08-02 20:17         ` Fabio Falzoi
2015-08-02 20:30         ` [PATCH v3] " Fabio Falzoi
2015-06-30  6:43 ` [PATCH 04/10] Staging: fbtft: Use a helper function to set write_register op Fabio Falzoi
2015-07-15  2:13   ` Greg KH
2015-06-30  6:43 ` [PATCH 05/10] Staging: fbtft: Set bus specific ops using separate functions Fabio Falzoi
2015-07-15  2:13   ` Greg KH
2015-06-30  6:43 ` [PATCH 06/10] Staging: fbtft: Use a helper function to set set_addr_win op Fabio Falzoi
2015-07-15  2:14   ` Greg KH
2015-07-23 11:19     ` Noralf Trønnes
2015-06-30  6:43 ` [PATCH 07/10] Staging: fbtft: Remove useless newline Fabio Falzoi
2015-06-30  7:42   ` Dan Carpenter
2015-06-30 14:55     ` Joe Perches
2015-06-30 17:45       ` Dan Carpenter
2015-06-30 19:03         ` Joe Perches
2015-06-30  6:43 ` [PATCH 08/10] Staging: fbtft: Avoid duplicating code to check gpio.dc value Fabio Falzoi
2015-06-30  6:43 ` [PATCH 09/10] Staging: fbtft: Fix parenthesis alignment coding style issue Fabio Falzoi
2015-06-30  6:43 ` [PATCH 10/10] Staging: fbtft: Fix spacing " Fabio Falzoi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B0CB5E.8070808@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=fabio.falzoi84@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.