Re: [PATCH] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller
On 07/14/2015 07:56 AM, Sudip Mukherjee wrote: On Tue, Jul 14, 2015 at 03:26:12AM +0200, Henri Chain wrote: This is a driver chip for 240x160 4-bit greyscale LCDs. It is capable of 4-wire (8 bit) or 3-wire (9 bit) SPI that have both been tested. (It also has a 6800 or 8080-style parallel interface, but I have not included support for it.) Signed-off-by: Henri Chain henri.ch...@eleves.ec-nantes.fr --- snip +} + +static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) +{ +fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, +%s(xs=%d, ys=%d, xe=%d, ye=%d)\n, __func__, xs, ys, xe, ye); checkpatch complains: Alignment should match open parenthesis. regards sudip Thanks, didn't catch it because I was running checkpatch without --strict Here is the modified patch: -- 8 -- Subject: [PATCH] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller This is a driver chip for 240x160 4-bit greyscale LCDs. It is capable of 4-wire (8 bit) or 3-wire (9 bit) SPI that have both been tested. (It also has a 6800 or 8080-style parallel interface, but I have not included support for it.) Signed-off-by: Henri Chain henri.ch...@eleves.ec-nantes.fr --- drivers/staging/fbtft/Kconfig| 6 + drivers/staging/fbtft/Makefile | 1 + drivers/staging/fbtft/fb_uc1611.c| 350 +++ drivers/staging/fbtft/fbtft_device.c | 31 4 files changed, 388 insertions(+) create mode 100644 drivers/staging/fbtft/fb_uc1611.c diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index d401878..f7e68fd 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -152,6 +152,12 @@ config FB_TFT_TLS8204 help Generic Framebuffer support for TLS8204 +config FB_TFT_UC1611 + tristate FB driver for the UC1611 LCD controller + depends on FB_TFT + help + Generic Framebuffer support for UC1611 + config FB_TFT_UC1701 tristate FB driver for the UC1701 LCD Controller depends on FB_TFT diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile index 554b526..b26efdc 100644 --- a/drivers/staging/fbtft/Makefile +++ b/drivers/staging/fbtft/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o obj-$(CONFIG_FB_TFT_ST7735R) += fb_st7735r.o obj-$(CONFIG_FB_TFT_TINYLCD) += fb_tinylcd.o obj-$(CONFIG_FB_TFT_TLS8204) += fb_tls8204.o +obj-$(CONFIG_FB_TFT_UC1611) += fb_uc1611.o obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o diff --git a/drivers/staging/fbtft/fb_uc1611.c b/drivers/staging/fbtft/fb_uc1611.c new file mode 100644 index 000..32f3a9d --- /dev/null +++ b/drivers/staging/fbtft/fb_uc1611.c @@ -0,0 +1,350 @@ +/* + * FB driver for the UltraChip UC1611 LCD controller + * + * The display is 4-bit grayscale (16 shades) 240x160. + * + * Copyright (C) 2015 Henri Chain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/module.h +#include linux/kernel.h +#include linux/init.h +#include linux/gpio.h +#include linux/spi/spi.h +#include linux/delay.h + +#include fbtft.h + +#define DRVNAMEfb_uc1611 +#define WIDTH 240 +#define HEIGHT 160 +#define BPP8 +#define FPS40 + +/* + * LCD voltage is a combination of ratio, gain, pot and temp + * + * V_LCD = V_BIAS * ratio + * V_LCD = (C_V0 + C_PM × pot) * (1 + (T - 25) * temp) + * C_V0 and C_PM depend on ratio and gain + * T is ambient temperature + */ + +/* BR - actual ratio: 0-3 - 5, 10, 11, 13 */ +static unsigned ratio = 2; +module_param(ratio, uint, 0); +MODULE_PARM_DESC(ratio, BR[1:0] Bias voltage ratio: 0-3 (default: 2)); + +static unsigned gain = 3; +module_param(gain, uint, 0); +MODULE_PARM_DESC(gain, GN[1:0] Bias voltage gain: 0-3 (default: 3)); + +static unsigned pot = 16; +module_param(pot, uint, 0); +MODULE_PARM_DESC(pot, PM[6:0] Bias voltage pot.: 0-63 (default: 16)); + +/* TC - % compensation per deg C: 0-3 - -.05, -.10, -.015, -.20 */ +static unsigned temp; +module_param(temp, uint, 0); +MODULE_PARM_DESC(temp, TC[1:0] Temperature compensation: 0-3 (default: 0)); + +/* PC[1:0] - LCD capacitance: 0-3 - 20nF, 20-28 nF, 29-40 nF, 40-56 nF */ +static unsigned load = 1; +module_param(load, uint, 0); +MODULE_PARM_DESC(load, PC[1:0] Panel Loading: 0-3 (default: 1)); + +/* PC[3:2] - V_LCD: 0, 1, 3 - ext., int
Re: [PATCH] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller
On Tue, Jul 14, 2015 at 02:04:22PM +0200, Henri Chain wrote: On 07/14/2015 07:56 AM, Sudip Mukherjee wrote: On Tue, Jul 14, 2015 at 03:26:12AM +0200, Henri Chain wrote: Thanks, didn't catch it because I was running checkpatch without --strict my scripts will have --strict by default. Here is the modified patch: But I don't think Greg will accept a patch this way where he has to edit. Please send it as a v2. regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller
On Tue, Jul 14, 2015 at 03:26:12AM +0200, Henri Chain wrote: This is a driver chip for 240x160 4-bit greyscale LCDs. It is capable of 4-wire (8 bit) or 3-wire (9 bit) SPI that have both been tested. (It also has a 6800 or 8080-style parallel interface, but I have not included support for it.) Signed-off-by: Henri Chain henri.ch...@eleves.ec-nantes.fr --- snip +} + +static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) +{ + fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, + %s(xs=%d, ys=%d, xe=%d, ye=%d)\n, __func__, xs, ys, xe, ye); checkpatch complains: Alignment should match open parenthesis. regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: fbtft: Add support for the Ultrachip UC1611 LCD controller
This is a driver chip for 240x160 4-bit greyscale LCDs. It is capable of 4-wire (8 bit) or 3-wire (9 bit) SPI that have both been tested. (It also has a 6800 or 8080-style parallel interface, but I have not included support for it.) Signed-off-by: Henri Chain henri.ch...@eleves.ec-nantes.fr --- drivers/staging/fbtft/Kconfig| 6 + drivers/staging/fbtft/Makefile | 1 + drivers/staging/fbtft/fb_uc1611.c| 349 +++ drivers/staging/fbtft/fbtft_device.c | 31 4 files changed, 387 insertions(+) create mode 100644 drivers/staging/fbtft/fb_uc1611.c diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index d401878..f7e68fd 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -152,6 +152,12 @@ config FB_TFT_TLS8204 help Generic Framebuffer support for TLS8204 +config FB_TFT_UC1611 + tristate FB driver for the UC1611 LCD controller + depends on FB_TFT + help + Generic Framebuffer support for UC1611 + config FB_TFT_UC1701 tristate FB driver for the UC1701 LCD Controller depends on FB_TFT diff --git a/drivers/staging/fbtft/Makefile b/drivers/staging/fbtft/Makefile index 554b526..b26efdc 100644 --- a/drivers/staging/fbtft/Makefile +++ b/drivers/staging/fbtft/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o obj-$(CONFIG_FB_TFT_ST7735R) += fb_st7735r.o obj-$(CONFIG_FB_TFT_TINYLCD) += fb_tinylcd.o obj-$(CONFIG_FB_TFT_TLS8204) += fb_tls8204.o +obj-$(CONFIG_FB_TFT_UC1611) += fb_uc1611.o obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o diff --git a/drivers/staging/fbtft/fb_uc1611.c b/drivers/staging/fbtft/fb_uc1611.c new file mode 100644 index 000..b6280a3 --- /dev/null +++ b/drivers/staging/fbtft/fb_uc1611.c @@ -0,0 +1,349 @@ +/* + * FB driver for the UltraChip UC1611 LCD controller + * + * The display is 4-bit grayscale (16 shades) 240x160. + * + * Copyright (C) 2015 Henri Chain + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/module.h +#include linux/kernel.h +#include linux/init.h +#include linux/gpio.h +#include linux/spi/spi.h +#include linux/delay.h + +#include fbtft.h + +#define DRVNAMEfb_uc1611 +#define WIDTH 240 +#define HEIGHT 160 +#define BPP8 +#define FPS40 + +/* + * LCD voltage is a combination of ratio, gain, pot and temp + * + * V_LCD = V_BIAS * ratio + * V_LCD = (C_V0 + C_PM × pot) * (1 + (T - 25) * temp) + * C_V0 and C_PM depend on ratio and gain + * T is ambient temperature + */ + +/* BR - actual ratio: 0-3 - 5, 10, 11, 13 */ +static unsigned ratio = 2; +module_param(ratio, uint, 0); +MODULE_PARM_DESC(ratio, BR[1:0] Bias voltage ratio: 0-3 (default: 2)); + +static unsigned gain = 3; +module_param(gain, uint, 0); +MODULE_PARM_DESC(gain, GN[1:0] Bias voltage gain: 0-3 (default: 3)); + +static unsigned pot = 16; +module_param(pot, uint, 0); +MODULE_PARM_DESC(pot, PM[6:0] Bias voltage pot.: 0-63 (default: 16)); + +/* TC - % compensation per deg C: 0-3 - -.05, -.10, -.015, -.20 */ +static unsigned temp; +module_param(temp, uint, 0); +MODULE_PARM_DESC(temp, TC[1:0] Temperature compensation: 0-3 (default: 0)); + +/* PC[1:0] - LCD capacitance: 0-3 - 20nF, 20-28 nF, 29-40 nF, 40-56 nF */ +static unsigned load = 1; +module_param(load, uint, 0); +MODULE_PARM_DESC(load, PC[1:0] Panel Loading: 0-3 (default: 1)); + +/* PC[3:2] - V_LCD: 0, 1, 3 - ext., int. with ratio = 5, int. standard */ +static unsigned pump = 3; +module_param(pump, uint, 0); +MODULE_PARM_DESC(pump, PC[3:2] Pump control: 0,1,3 (default: 3)); + +static int init_display(struct fbtft_par *par) +{ + int ret; + + fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, %s()\n, __func__); + + /* Set CS active high */ + par-spi-mode |= SPI_CS_HIGH; + ret = par-spi-master-setup(par-spi); + if (ret) { + dev_err(par-info-device, Could not set SPI_CS_HIGH\n); + return ret; + } + + /* Reset controller */ + write_reg(par, 0xE2); + + /* Set bias ratio */ + write_reg(par, 0xE8 | (ratio 0x03)); + + /* Set bias gain and potentiometer */ + write_reg(par, 0x81); + write_reg(par, (gain 0x03) 6 | (pot 0x3F)); + + /* Set temperature compensation */ + write_reg(par, 0x24 | (temp 0x03)); + + /* Set