Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753442AbbGWLJj (ORCPT ); Thu, 23 Jul 2015 07:09:39 -0400 Received: from smtp.domeneshop.no ([194.63.252.55]:48117 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752613AbbGWLJb (ORCPT ); Thu, 23 Jul 2015 07:09:31 -0400 Message-ID: <55B0CB5E.8070808@tronnes.org> Date: Thu, 23 Jul 2015 13:09:18 +0200 From: =?windows-1252?Q?Noralf_Tr=F8nnes?= User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Fabio Falzoi , 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 References: <1435646597-7612-1-git-send-email-fabio.falzoi84@gmail.com> <1435646597-7612-4-git-send-email-fabio.falzoi84@gmail.com> In-Reply-To: <1435646597-7612-4-git-send-email-fabio.falzoi84@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2830 Lines: 78 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 > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/