new LoCoMo driver set
Subsystems (14)
v3 cover new LoCoMo driver set
Sharp Zaurus SL-5500 and SL-5600 use special companion Gate Array. With this patchset I tried to modernise and restructure the LoCoMo drivers.
* Use platform bus and mfd core code
* Use GPIO API instead of custom locomo GPIO code
* Use irqdomains to manage IRQs
* Split mixed locomolcd driver to lcd and backlight parts
* Implement IRQ handling in GPIO driver
* Implement SPI driver used as a host for mmc_spi device to control SD cards
Changes since V2:
* Implemented most of review findings (lots of small changes)
* Added comments where the review feedback was ignored
The following changes since commit b787f68c36d49bb1d9236f403813641efa74a031:
Linux 4.1-rc1 (2015-04-26 17:59:10 -0700)
are available in the git repository at:
git://git.infradead.org/users/dbaryshkov/zaurus.git locomo-v3
for you to fetch changes up to c7405f110836863287c505650ac2133fecabea7b:
ARM: drop old LoCoMo driver (2015-05-17 19:23:20 +0300)
----------------------------------------------------------------
Dmitry Eremin-Solenikov (17):
mfd: add new driver for Sharp LoCoMo
leds: port locomo leds driver to new locomo core
input: convert LoCoMo keyboard driver to use new locomo core
input: make LoCoMo keyboard driver support both poodle and collie
video: backlight: add new locomo backlight driver
video: lcd: add LoCoMo LCD driver
gpio: port LoCoMo gpio support from old driver
gpio: locomo: implement per-pin irq handling
spi: add locomo SPI driver
i2c: add locomo i2c driver
ARM: sa1100: make collie use new locomo drivers
ARM: sa1100: don't preallocate IRQ space for locomo
ASoC: pxa: poodle: make use of new locomo GPIO interface
ARM: pxa: poodle: use new LoCoMo driver
ARM: pxa: poodle: don't preallocate IRQ space for locomo
video: backlight: drop old locomo bl/lcd driver
ARM: drop old LoCoMo driver
arch/arm/common/Kconfig | 3 - arch/arm/common/Makefile | 1 - arch/arm/common/locomo.c | 914 ----------------------------- arch/arm/include/asm/hardware/locomo.h | 221 ------- arch/arm/mach-pxa/Kconfig | 1 - arch/arm/mach-pxa/include/mach/poodle.h | 8 +- arch/arm/mach-pxa/poodle.c | 58 +- arch/arm/mach-sa1100/Kconfig | 1 - arch/arm/mach-sa1100/collie.c | 213 +++++-- arch/arm/mach-sa1100/include/mach/collie.h | 16 +- arch/arm/mach-sa1100/include/mach/irqs.h | 19 +- drivers/gpio/Kconfig | 13 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-locomo.c | 285 +++++++++ drivers/i2c/busses/Kconfig | 12 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-locomo.c | 135 +++++ drivers/input/keyboard/Kconfig | 2 +- drivers/input/keyboard/locomokbd.c | 264 ++++----- drivers/leds/Kconfig | 2 +- drivers/leds/leds-locomo.c | 117 ++-- drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/locomo.c | 346 +++++++++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-locomo.c | 332 +++++++++++ drivers/video/backlight/Kconfig | 16 +- drivers/video/backlight/Makefile | 3 +- drivers/video/backlight/locomo_bl.c | 153 +++++ drivers/video/backlight/locomo_lcd.c | 285 +++++++++ drivers/video/backlight/locomolcd.c | 255 -------- include/linux/mfd/locomo.h | 167 ++++++ sound/soc/pxa/poodle.c | 52 +- 34 files changed, 2216 insertions(+), 1702 deletions(-) delete mode 100644 arch/arm/common/locomo.c delete mode 100644 arch/arm/include/asm/hardware/locomo.h create mode 100644 drivers/gpio/gpio-locomo.c create mode 100644 drivers/i2c/busses/i2c-locomo.c create mode 100644 drivers/mfd/locomo.c create mode 100644 drivers/spi/spi-locomo.c create mode 100644 drivers/video/backlight/locomo_bl.c create mode 100644 drivers/video/backlight/locomo_lcd.c delete mode 100644 drivers/video/backlight/locomolcd.c create mode 100644 include/linux/mfd/locomo.h
Signature · 2 lines
With best wishes Dmitry
A message that is not in the archive (sent off-list or not yet received): 1431880077-26321-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH v3 1/17 mfd: add new driver for Sharp LoCoMo
LoCoMo is a GA used on Sharp Zaurus SL-5x00. Current driver does has several design issues (special bus instead of platform bus, doesn't use mfd-core, etc).
Implement 'core' parts of locomo support as an mfd driver.
--- drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/locomo.c | 346 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/locomo.h | 167 ++++++++++++++++++++++ 4 files changed, 524 insertions(+) create mode 100644 drivers/mfd/locomo.c create mode 100644 include/linux/mfd/locomo.h
drivers/mfd/Kconfig +10 -0
@@ -1430,6 +1430,16 @@ config MFD_STW481X in various ST Microelectronics and ST-Ericsson embedded Nomadik series. +config MFD_LOCOMO + bool "Sharp LoCoMo support" + depends on ARM + select MFD_CORE + select IRQ_DOMAIN + select REGMAP_MMIO + help + Support for Sharp LoCoMo Grid Array found in Sharp SL-5x00 + PDA family. + menu "Multimedia Capabilities Port drivers" depends on ARCH_SA1100
drivers/mfd/Makefile +1 -0
@@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o +obj-$(CONFIG_MFD_LOCOMO) += locomo.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
drivers/mfd/locomo.c new file +346 -0
346 lines not on this page · raw message
include/linux/mfd/locomo.h new file +167 -0
167 lines not on this page · raw message
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1431880077-26321-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH v3 01/17] mfd: add new driver for Sharp LoCoMo
Quoted 76 lines · Dmitry Eremin-Solenikov
LoCoMo is a GA used on Sharp Zaurus SL-5x00. Current driver does has several design issues (special bus instead of platform bus, doesn't use mfd-core, etc).
Implement 'core' parts of locomo support as an mfd driver.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/locomo.c | 346 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/locomo.h | 167 ++++++++++++++++++++++ 4 files changed, 524 insertions(+) create mode 100644 drivers/mfd/locomo.c create mode 100644 include/linux/mfd/locomo.hdrivers/mfd/Kconfig +10
-0@@ -1430,6 +1430,16 @@ config MFD_STW481X in various ST Microelectronics and ST-Ericsson embedded Nomadik series. +config MFD_LOCOMO + bool "Sharp LoCoMo support" + depends on ARM + select MFD_CORE + select IRQ_DOMAIN + select REGMAP_MMIO + help + Support for Sharp LoCoMo Grid Array found in Sharp SL-5x00 + PDA family. + menu "Multimedia Capabilities Port drivers" depends on ARCH_SA1100drivers/mfd/Makefile +1
-0@@ -181,6 +181,7 @@ obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o +obj-$(CONFIG_MFD_LOCOMO) += locomo.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.odrivers/mfd/locomo.c new file +21
-0@@ -0,0 +1,346 @@ +/* +* Sharp LoCoMo support +* +* (C) Copyright 2015 Dmitry Eremin-Solenikov +* +* Based on old driver at arch/arm/common/locomo.c +* +* (C) Copyright 2004 John Lenz +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This file contains all generic LoCoMo support. +* +* All initialization functions provided here are intended to be called +* from machine specific code with proper arguments when required. +*/ + +#include <linux/delay.h> +#include <linux/gpio.h>
drivers/mfd/locomo.c line 31
Quoted 10 lines
drivers/mfd/locomo.c new file +10
-0+#include <linux/io.h> +#include <linux/irq.h> +#include <linux/irqdomain.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/regmap.h> +#include <linux/slab.h> +#include <linux/platform_device.h> +#include <linux/mfd/core.h> +#include <linux/mfd/locomo.h>
Alphabetical please.
drivers/mfd/locomo.c line 41
Quoted 9 lines
drivers/mfd/locomo.c new file +9
-0+/* LoCoMo Interrupts */ +#define IRQ_LOCOMO_KEY 0 +#define IRQ_LOCOMO_GPIO 1 +#define IRQ_LOCOMO_LT 2 +#define IRQ_LOCOMO_SPI 3 + +#define LOCOMO_NR_IRQS 4 + +/* the following is the overall data for the locomo chip */
Capitalisation, to be consistent with the other comments.
Quoted 49 lines
drivers/mfd/locomo.c new file +49
-0+struct locomo { +struct device *dev; +unsigned int irq; +spinlock_t lock; +struct irq_domain *domain; +struct regmap *regmap; +}; + +static struct resource locomo_kbd_resources[] = { +DEFINE_RES_IRQ (IRQ_LOCOMO_KEY ), +}; + +static struct resource locomo_gpio_resources[] = { +DEFINE_RES_IRQ (IRQ_LOCOMO_GPIO ), +}; + +/* Filled in locomo_probe() function, will be kmemduped by platform core */ +static struct locomo_gpio_platform_data locomo_gpio_pdata; + +static struct resource locomo_lt_resources[] = { +DEFINE_RES_IRQ (IRQ_LOCOMO_LT ), +}; + +static struct resource locomo_spi_resources[] = { +DEFINE_RES_IRQ (IRQ_LOCOMO_SPI ), +}; + +/* Filled in locomo_probe() function, will be kmemduped by platform core */ +static struct locomo_lcd_platform_data locomo_lcd_pdata; + +static struct mfd_cell locomo_cells[] = { + { + .name ="locomo-kbd" , + .resources = locomo_kbd_resources, + .num_resources =ARRAY_SIZE (locomo_kbd_resources), + }, + { + .name ="locomo-gpio" , + .resources = locomo_gpio_resources, + .num_resources =ARRAY_SIZE (locomo_gpio_resources), + .platform_data = &locomo_gpio_pdata, + .pdata_size =sizeof (locomo_gpio_pdata), + }, + { + .name ="locomo-lt" ,/* Long time timer */ + .resources = locomo_lt_resources, + .num_resources =ARRAY_SIZE (locomo_lt_resources), + }, + {
drivers/mfd/locomo.c line 100
Quoted 10 lines
drivers/mfd/locomo.c new file +10
-0+ .name = "locomo-spi", + .resources = locomo_spi_resources, + .num_resources = ARRAY_SIZE(locomo_spi_resources), + }, + { + .name = "locomo-led", + }, + { + .name = "locomo-backlight", + },
Are these to be filled in?
If not, make them one liners and put them at the bottom.
Quoted 19 lines
drivers/mfd/locomo.c new file +19
-0+ { + .name = "locomo-lcd", + .platform_data = &locomo_lcd_pdata, + .pdata_size = sizeof(locomo_lcd_pdata), + }, + { + .name = "locomo-i2c", + }, +}; + +/* +* IRQ support +* +* ICR reg contains IRQ status at bits 9-12, IRQ mask at bits 4-7. +* Thus 0xf00 selects all triggered IRQ sources, and decrementing +* ffs result by 9 will get hardware IRQ number. +*/ +static void locomo_handler (unsigned int irq,struct irq_desc *desc) +{
drivers/mfd/locomo.c line 129
Quoted 10 lines
drivers/mfd/locomo.c new file +10
-0+struct locomo *ldev =irq_get_handler_data (irq); +struct irq_chip *irqchip =irq_desc_get_chip (desc); +unsigned int req; + +chained_irq_enter (irqchip, desc); + +/* Check why this interrupt was generated */ +while (1 ) { +regmap_read (ldev->regmap,LOCOMO_ICR , &req); + req &=0x0f00 ;
I see the comment above, which is good, but it would be better to define these values (0x0f00 and 9).
Quoted 4 lines
drivers/mfd/locomo.c new file +4
-0+if (!req) +break ; + + irq =ffs (req) -9 ;
drivers/mfd/locomo.c line 144
Quoted 10 lines
drivers/mfd/locomo.c new file +10
-0+generic_handle_irq (irq_find_mapping (ldev->domain, irq)); + } + +chained_irq_exit (irqchip, desc); +} + +static void locomo_mask_irq (struct irq_data *d) +{ +struct locomo *ldev =irq_data_get_irq_chip_data (d); +unsigned int mask =0x0010 << d->hwirq;
This also needs defining.
Why not
BIT(d->hwirq + 1)
drivers/mfd/locomo.c line 152
Quoted 7 lines
drivers/mfd/locomo.c new file +7
-0+regmap_update_bits (ldev->regmap,LOCOMO_ICR , mask,0 ); +} + +static void locomo_unmask_irq (struct irq_data *d) +{ +struct locomo *ldev =irq_data_get_irq_chip_data (d); +unsigned int mask =0x0010 << d->hwirq;
As above.
Quoted 28 lines
drivers/mfd/locomo.c new file +28
-0+regmap_update_bits (ldev->regmap,LOCOMO_ICR , mask, mask); +} + +static struct irq_chip locomo_chip = { + .name ="locomo" , + .irq_mask = locomo_mask_irq, + .irq_unmask = locomo_unmask_irq, +}; + +static int locomo_irq_map (struct irq_domain *d,unsigned int virq, +irq_hw_number_t hwirq) +{ +struct locomo *locomo = d->host_data; + +irq_set_chip_data (virq, locomo); +irq_set_chip_and_handler (virq, &locomo_chip, handle_level_irq); +set_irq_flags (virq,IRQF_VALID ); + +return 0 ; +} + +static void locomo_irq_unmap (struct irq_domain *d,unsigned int virq) +{ +set_irq_flags (virq,0 ); +irq_set_chip_and_handler (virq,NULL ,NULL ); +irq_set_chip_data (virq,NULL ); +} +
drivers/mfd/locomo.c line 191
Quoted 10 lines
drivers/mfd/locomo.c new file +10
-0+static struct irq_domain_ops locomo_irq_ops = { + .map = locomo_irq_map, + .unmap = locomo_irq_unmap, + .xlate = irq_domain_xlate_onecell, +}; + +static int locomo_setup_irq (struct locomo *ldev) +{ + ldev->domain =irq_domain_add_simple (NULL ,LOCOMO_NR_IRQS ,0 , + &locomo_irq_ops, ldev);
Can you line-up with the '(' please?
Quoted 9 lines
drivers/mfd/locomo.c new file +9
-0+if (!ldev->domain) +return -ENOMEM ; + +/* +* Install handler for IRQ_LOCOMO_HW. +*/ +irq_set_irq_type (ldev->irq,IRQ_TYPE_EDGE_FALLING ); +irq_set_handler_data (ldev->irq, ldev); +irq_set_chained_handler (ldev->irq, locomo_handler);
drivers/mfd/locomo.c line 210
Quoted 10 lines
drivers/mfd/locomo.c new file +10
-0+ +return 0 ; +} + +#ifdef CONFIG_PM_SLEEP +static int locomo_suspend (struct device *dev) +{ +struct locomo *ldev =dev_get_drvdata (dev); + +/* audio */
Audio
Quoted 309 lines
drivers/mfd/locomo.c new file +136
-0+regmap_write (ldev->regmap,LOCOMO_PAIF ,0x00 ); + +/* +* Original code disabled the clock depending on leds settings +* However we disable leds before suspend, thus it's safe +* to just assume this setting. +*/ +/* CLK32 off */ +regmap_write (ldev->regmap,LOCOMO_C32K ,0x00 ); + +/* 22MHz/24MHz clock off */ +regmap_write (ldev->regmap,LOCOMO_ACC ,0x00 ); + +return 0 ; +} + +static int locomo_resume (struct device *dev) +{ +struct locomo *ldev =dev_get_drvdata (dev); + +regmap_write (ldev->regmap,LOCOMO_C32K ,0x00 ); + +return 0 ; +} +#endif + +static SIMPLE_DEV_PM_OPS(locomo_pm, locomo_suspend, locomo_resume); + +static const struct regmap_config locomo_regmap_config = { + .name ="LoCoMo" , + .reg_bits =8 , + .reg_stride =4 , + .val_bits =16 , + .cache_type =REGCACHE_NONE , + .max_register =0xec , +}; + +static int locomo_probe (struct platform_device *pdev) +{ +struct locomo_platform_data *pdata =dev_get_platdata (&pdev->dev); +struct resource *res; +void __iomem *base; +struct locomo *ldev; +unsigned int rev; +int ret; + + ldev =devm_kzalloc (&pdev->dev,sizeof (*ldev),GFP_KERNEL ); +if (!ldev) +return -ENOMEM ; + +spin_lock_init (&ldev->lock); + ldev->dev = &pdev->dev; + + ldev->irq =platform_get_irq (pdev,0 ); +if (ldev->irq <0 ) +return ldev->irq; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (base)) +return PTR_ERR (base); + + ldev->regmap =devm_regmap_init_mmio (&pdev->dev, base, + &locomo_regmap_config); +if (IS_ERR (ldev->regmap)) +return PTR_ERR (ldev->regmap); + +if (pdata) { + locomo_gpio_pdata.gpio_base = pdata->gpio_base; + locomo_lcd_pdata.comadj = pdata->comadj; + }else { + locomo_gpio_pdata.gpio_base =-1 ; + locomo_lcd_pdata.comadj =128 ; + } + +platform_set_drvdata (pdev, ldev); + +regmap_read (ldev->regmap,LOCOMO_VER , &rev); +dev_info (&pdev->dev,"LoCoMo Chip: %04x\n" , rev); + +/* Clear IRQ status and mask */ +regmap_write (ldev->regmap,LOCOMO_ICR ,0 ); + +/* Longtime timer */ +regmap_write (ldev->regmap,LOCOMO_LTINT ,0 ); + + ret =locomo_setup_irq (ldev); +if (ret) +return ret; + + ret =mfd_add_devices (&pdev->dev, pdev->id, + locomo_cells,ARRAY_SIZE (locomo_cells), + res,-1 , ldev->domain); +if (ret) + goto err; + +return 0 ; + +err: +irq_set_chained_handler (ldev->irq,NULL ); +irq_set_handler_data (ldev->irq,NULL ); + +irq_domain_remove (ldev->domain); + +return ret; +} + +static int locomo_remove (struct platform_device *dev) +{ +struct locomo *ldev =platform_get_drvdata (dev); + +mfd_remove_devices (&dev->dev); + +irq_set_chained_handler (ldev->irq,NULL ); +irq_set_handler_data (ldev->irq,NULL ); + +irq_domain_remove (ldev->domain); + +return 0 ; +} + +static struct platform_driver locomo_device_driver = { + .probe = locomo_probe, + .remove = locomo_remove, + .driver = { + .name ="locomo" , + .pm = &locomo_pm, + }, +}; + +module_platform_driver (locomo_device_driver); + +MODULE_DESCRIPTION ("Sharp LoCoMo core driver" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_AUTHOR ("John Lenz <[email protected]>" ); +MODULE_ALIAS ("platform:locomo" );include/linux/mfd/locomo.h new file +167
-0@@ -0,0 +1,167 @@ +/* +* This file contains the definitions for the LoCoMo G/A Chip +* +* (C) Copyright 2015 Dmitry Eremin-Solenikov +* (C) Copyright 2004 John Lenz +* +* May be copied or modified under the terms of the GNU General Public +* License. See linux/COPYING for more information. +* +* Based on sa1111.h +*/ + +#ifndef _ASM_ARCH_LOCOMO +#define _ASM_ARCH_LOCOMO + +/* LOCOMO chip version */ +#define LOCOMO_VER 0x00 + +/* Pin status */ +#define LOCOMO_ST 0x04 + +/* Pin status */ +#define LOCOMO_C32K 0x08 + +/* Interrupt controller */ +#define LOCOMO_ICR 0x0C + +/* Touch panel controller */ +#define LOCOMO_ASD 0x20/* AD start delay */ +#define LOCOMO_HSD 0x28/* HSYS delay */ +#define LOCOMO_HSC 0x2c/* HSYS period */ +#define LOCOMO_TADC 0x30/* tablet ADC clock */ + +/* Backlight controller: TFT signal */ +#define LOCOMO_TC 0x38/* TFT control signal */ +#define LOCOMO_CPSD 0x3c/* CPS delay */ + +/* Keyboard controller */ +#define LOCOMO_KIB 0x40/* KIB level */ +#define LOCOMO_KSC 0x44/* KSTRB control */ +#define LOCOMO_KCMD 0x48/* KSTRB command */ +#define LOCOMO_KIC 0x4c/* Key interrupt */ + +/* Audio clock */ +#define LOCOMO_ACC 0x54/* Audio clock */ +#define LOCOMO_ACC_XON 0x80 +#define LOCOMO_ACC_XEN 0x40 +#define LOCOMO_ACC_XSEL0 0x00 +#define LOCOMO_ACC_XSEL1 0x20 +#define LOCOMO_ACC_MCLKEN 0x10 +#define LOCOMO_ACC_64FSEN 0x08 +#define LOCOMO_ACC_CLKSEL000 0x00/* mclk 2 */ +#define LOCOMO_ACC_CLKSEL001 0x01/* mclk 3 */ +#define LOCOMO_ACC_CLKSEL010 0x02/* mclk 4 */ +#define LOCOMO_ACC_CLKSEL011 0x03/* mclk 6 */ +#define LOCOMO_ACC_CLKSEL100 0x04/* mclk 8 */ +#define LOCOMO_ACC_CLKSEL101 0x05/* mclk 12 */ + +/* SPI interface */ +#define LOCOMO_SPIMD 0x60/* SPI mode setting */ +#define LOCOMO_SPIMD_LOOPBACK BIT(15)/* loopback tx to rx */ +#define LOCOMO_SPIMD_MSB1ST BIT(14)/* send MSB first */ +#define LOCOMO_SPIMD_DOSTAT BIT(13)/* transmit line is idle high */ +#define LOCOMO_SPIMD_TCPOL BIT(11)/* transmit CPOL (maybe affects CPHA) */ +#define LOCOMO_SPIMD_RCPOL BIT(10)/* receive CPOL (maybe affects CPHA) */ +#define LOCOMO_SPIMD_TDINV BIT(9)/* invert transmit line */ +#define LOCOMO_SPIMD_RDINV BIT(8)/* invert receive line */ +#define LOCOMO_SPIMD_XON BIT(7)/* enable spi controller clock */ +#define LOCOMO_SPIMD_XEN BIT(6)/* clock bit write enable */ +#define LOCOMO_SPIMD_XSEL 0x0018/* clock select */ +/* xon must be off when enabling xen, wait 300 us before xon -> 1 */ +#define CLOCK_18MHZ 0/* 18,432 MHz clock */ +#define CLOCK_22MHZ 1/* 22,5792 MHz clock */ +#define CLOCK_25MHZ 2/* 24,576 MHz clock */ +#define LOCOMO_SPIMD_CLKSEL 0x7 +#define DIV_1 0/* don't divide clock */ +#define DIV_2 1/* divide clock by two */ +#define DIV_4 2/* divide clock by four */ +#define DIV_8 3/* divide clock by eight */ +#define DIV_64 4/* divide clock by 64 */ + +#define LOCOMO_SPICT 0x64/* SPI mode control */ +#define LOCOMO_SPICT_CRC16_7_B BIT(15)/* 0: crc16 1: crc7 */ +#define LOCOMO_SPICT_CRCRX_TX_B BIT(14) +#define LOCOMO_SPICT_CRCRESET_B BIT(13) +#define LOCOMO_SPICT_CEN BIT(7)/* ?? enable */ +#define LOCOMO_SPICT_CS BIT(6)/* chip select */ +#define LOCOMO_SPICT_UNIT16 BIT(5)/* 0: 8 bit, 1: 16 bit*/ +#define LOCOMO_SPICT_ALIGNEN BIT(2)/* align transfer enable */ +#define LOCOMO_SPICT_RXWEN BIT(1)/* continuous receive */ +#define LOCOMO_SPICT_RXUEN BIT(0)/* aligned receive */ + +#define LOCOMO_SPIST 0x68/* SPI status */ +#define LOCOMO_SPI_TEND BIT(3)/* Transfer end bit */ +#define LOCOMO_SPI_REND BIT(2)/* Receive end bit */ +#define LOCOMO_SPI_RFW BIT(1)/* write buffer bit */ +#define LOCOMO_SPI_RFR BIT(0)/* read buffer bit */ + +#define LOCOMO_SPIIS 0x70/* SPI interrupt status */ +#define LOCOMO_SPIWE 0x74/* SPI interrupt status write enable */ +#define LOCOMO_SPIIE 0x78/* SPI interrupt enable */ +#define LOCOMO_SPIIR 0x7c/* SPI interrupt request */ +#define LOCOMO_SPITD 0x80/* SPI transfer data write */ +#define LOCOMO_SPIRD 0x84/* SPI receive data read */ +#define LOCOMO_SPITS 0x88/* SPI transfer data shift */ +#define LOCOMO_SPIRS 0x8C/* SPI receive data shift */ + +/* GPIO */ +#define LOCOMO_GPD 0x90/* GPIO direction */ +#define LOCOMO_GPE 0x94/* GPIO input enable */ +#define LOCOMO_GPL 0x98/* GPIO level */ +#define LOCOMO_GPO 0x9c/* GPIO out data setting */ +#define LOCOMO_GRIE 0xa0/* GPIO rise detection */ +#define LOCOMO_GFIE 0xa4/* GPIO fall detection */ +#define LOCOMO_GIS 0xa8/* GPIO edge detection status */ +#define LOCOMO_GWE 0xac/* GPIO status write enable */ +#define LOCOMO_GIE 0xb0/* GPIO interrupt enable */ +#define LOCOMO_GIR 0xb4/* GPIO interrupt request */ + +/* Front light adjustment controller */ +#define LOCOMO_ALS 0xc8/* Adjust light cycle */ +#define LOCOMO_ALS_EN 0x8000 +#define LOCOMO_ALD 0xcc/* Adjust light duty */ + +/* PCM audio interface */ +#define LOCOMO_PAIF 0xd0/* PCM audio interface */ +#define LOCOMO_PAIF_SCINV 0x20 +#define LOCOMO_PAIF_SCEN 0x10 +#define LOCOMO_PAIF_LRCRST 0x08 +#define LOCOMO_PAIF_LRCEVE 0x04 +#define LOCOMO_PAIF_LRCINV 0x02 +#define LOCOMO_PAIF_LRCEN 0x01 + +/* Long time timer */ +#define LOCOMO_LTC 0xd8/* LTC interrupt setting */ +#define LOCOMO_LTINT 0xdc/* LTC interrupt */ + +/* DAC control signal for LCD (COMADJ ) */ +#define LOCOMO_DAC 0xe0 +/* DAC control */ +#define LOCOMO_DAC_SCLOEB 0x08/* SCL pin output data */ +#define LOCOMO_DAC_TEST 0x04/* Test bit */ +#define LOCOMO_DAC_SDA 0x02/* SDA pin level (read-only) */ +#define LOCOMO_DAC_SDAOEB 0x01/* SDA pin output data */ + +/* LED controller */ +#define LOCOMO_LPT0 0xe8 +#define LOCOMO_LPT1 0xec +#define LOCOMO_LPT_TOFH 0x80 +#define LOCOMO_LPT_TOFL 0x08 +#define LOCOMO_LPT_TOH (TOH ) ((TOH & 0x7) << 4) +#define LOCOMO_LPT_TOL (TOL ) ((TOL & 0x7)) + +struct locomo_gpio_platform_data { +unsigned int gpio_base; +}; + +struct locomo_lcd_platform_data { +u8 comadj; +}; + +struct locomo_platform_data { +unsigned int gpio_base; +u8 comadj; +}; + +#endif
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 01/17] mfd: add new driver for Sharp LoCoMo
Quoted 10 lines · Lee Jones
drivers/mfd/locomo.c line 144
Quoted 4 lines · Dmitry Eremin-Solenikov
drivers/mfd/locomo.c new file +4
-0+static void locomo_mask_irq (struct irq_data *d) +{ +struct locomo *ldev =irq_data_get_irq_chip_data (d); +unsigned int mask =0x0010 << d->hwirq;This also needs defining.
Why not
BIT(d->hwirq + 1)
I think your maths is off...
0x0010 << d->hwirq != BIT(d->hwirq + 1)
Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 01/17] mfd: add new driver for Sharp LoCoMo
Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Lee Jones
drivers/mfd/locomo.c line 144
Quoted 4 lines · Dmitry Eremin-Solenikov
drivers/mfd/locomo.c new file +4
-0+static void locomo_mask_irq (struct irq_data *d) +{ +struct locomo *ldev =irq_data_get_irq_chip_data (d); +unsigned int mask =0x0010 << d->hwirq;This also needs defining.
Quoted 6 lines
Quoted 2 lines
Why not
BIT(d->hwirq + 1)I think your maths is off...
0x0010<<d->hwirq!=BIT(d->hwirq + 1)
Ah, that's hex. I was blinded by the 1's and 0's. Doh!
Thanks Russell.
---
Why not
BIT(d->hwirq + 4)
... with an explanation as to why you're skipping the first 4 bits?
/me hopes that maths is right now. :)
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 4/17 input: make LoCoMo keyboard driver support both poodle and collie
In reply to a message not in the archiveKeyboards on collie and poodle differ only in wiring of 'Home' key. Instead of complicating the driver with platform data, just check for the machine for the time being. This will be converted to DTS property sometime in the future.
--- drivers/input/keyboard/locomokbd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/input/keyboard/locomokbd.c +9 -1
@@ -33,6 +33,9 @@#include <linux/slab.h> #include <linux/mfd/locomo.h> +/* There is one minor difference between mappings on poodle and collie */ +#include <asm/mach-types.h> +#define KEY_ACTIVITY KEY_F16#define KEY_CONTACT KEY_F18#define KEY_CENTER KEY_F15
@@ -45,7 +48,7 @@static const unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS ] = {0 ,KEY_ESC ,KEY_ACTIVITY ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 0 - 9 */ -0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_MENU ,KEY_HOME ,KEY_CONTACT ,/* 10 - 19 */ +0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_MENU ,0 ,KEY_CONTACT ,/* 10 - 19 */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 20 - 29 */ 0 ,0 ,0 ,KEY_CENTER ,0 ,KEY_MAIL ,0 ,0 ,0 ,0 ,/* 30 - 39 */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_RIGHT ,/* 40 - 49 */
@@ -278,6 +281,11 @@ static int locomokbd_probe(struct platform_device *dev) locomokbd_keycode, sizeof(locomokbd->keycode)); +if (machine_is_collie ()) + locomokbd->keycode[18 ] =KEY_HOME ; +else + locomokbd->keycode[3 ] =KEY_HOME ; +for (i =0 ; i <LOCOMOKBD_NUMKEYS ; i++)input_set_capability (input_dev,EV_KEY , locomokbd->keycode[i]);input_set_capability (input_dev,EV_PWR ,KEY_SUSPEND );
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1431880077-26321-5-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Dmitry Torokhov
Acked-byRe: [PATCH v3 04/17] input: make LoCoMo keyboard driver support both poodle and collie
Quoted 6 lines · Dmitry Eremin-Solenikov
Keyboards on collie and poodle differ only in wiring of 'Home' key. Instead of complicating the driver with platform data, just check for the machine for the time being. This will be converted to DTS property sometime in the future.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>
Quoted 42 lines
--- drivers/input/keyboard/locomokbd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/input/keyboard/locomokbd.c +9
-1@@ -33,6 +33,9 @@#include <linux/slab.h> #include <linux/mfd/locomo.h> +/* There is one minor difference between mappings on poodle and collie */ +#include <asm/mach-types.h> +#define KEY_ACTIVITY KEY_F16#define KEY_CONTACT KEY_F18#define KEY_CENTER KEY_F15@@ -45,7 +48,7 @@static const unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS ] = {0 ,KEY_ESC ,KEY_ACTIVITY ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 0 - 9 */ -0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_MENU ,KEY_HOME ,KEY_CONTACT ,/* 10 - 19 */ +0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_MENU ,0 ,KEY_CONTACT ,/* 10 - 19 */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 20 - 29 */ 0 ,0 ,0 ,KEY_CENTER ,0 ,KEY_MAIL ,0 ,0 ,0 ,0 ,/* 30 - 39 */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_RIGHT ,/* 40 - 49 */ @@ -278,6 +281,11 @@ static int locomokbd_probe(struct platform_device *dev) locomokbd_keycode, sizeof(locomokbd->keycode)); +if (machine_is_collie ()) + locomokbd->keycode[18 ] =KEY_HOME ; +else + locomokbd->keycode[3 ] =KEY_HOME ; +for (i =0 ; i <LOCOMOKBD_NUMKEYS ; i++)input_set_capability (input_dev,EV_KEY , locomokbd->keycode[i]);input_set_capability (input_dev,EV_PWR ,KEY_SUSPEND );Signature · 1 line
2.1.4
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 13/17 ASoC: pxa: poodle: make use of new locomo GPIO interface
In reply to a message not in the archiveSince LoCoMo driver has been converted to provide proper gpiolib interface, make poodle ASoC platform driver use gpiolib API.
--- sound/soc/pxa/poodle.c | 52 +++++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 32 deletions(-)
sound/soc/pxa/poodle.c +20 -32
@@ -20,15 +20,11 @@#include <linux/i2c.h> #include <linux/interrupt.h> #include <linux/platform_device.h> +#include <linux/gpio/consumer.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> -#include <asm/mach-types.h> -#include <asm/hardware/locomo.h> -#include <mach/poodle.h> -#include <mach/audio.h> -#include "../codecs/wm8731.h" #include "pxa2xx-i2s.h"
@@ -42,22 +38,18 @@static int poodle_jack_func;static int poodle_spk_func; +static struct gpio_desc *poodle_mute_l, *poodle_mute_r, *poodle_amp_on;static void poodle_ext_control (struct snd_soc_dapm_context *dapm) {/* set up jack connection */ if (poodle_jack_func ==POODLE_HP ) { -/* set = unmute headphone */ -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_L ,1 ); -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_R ,1 ); +gpiod_set_value (poodle_mute_l,0 ); +gpiod_set_value (poodle_mute_r,0 );snd_soc_dapm_enable_pin (dapm,"Headphone Jack" ); }else { -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_L ,0 ); -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_R ,0 ); +gpiod_set_value (poodle_mute_l,1 ); +gpiod_set_value (poodle_mute_r,1 );snd_soc_dapm_disable_pin (dapm,"Headphone Jack" ); }
@@ -84,11 +76,8 @@ static int poodle_startup(struct snd_pcm_substream *substream)/* we need to unmute the HP at shutdown as the mute burns power on poodle */ static void poodle_shutdown (struct snd_pcm_substream *substream) { -/* set = unmute headphone */ -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_L ,1 ); -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_R ,1 ); +gpiod_set_value (poodle_mute_l,0 ); +gpiod_set_value (poodle_mute_r,0 ); } static int poodle_hw_params(struct snd_pcm_substream *substream,
@@ -178,12 +167,7 @@ static int poodle_set_spk(struct snd_kcontrol *kcontrol,static int poodle_amp_event (struct snd_soc_dapm_widget *w,struct snd_kcontrol *k,int event) { -if (SND_SOC_DAPM_EVENT_ON (event)) -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_AMP_ON ,0 ); -else -locomo_gpio_write (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_AMP_ON ,1 ); +gpiod_set_value (poodle_amp_on, (SND_SOC_DAPM_EVENT_ON (event)));return 0 ; }
@@ -268,13 +252,17 @@ static int poodle_probe(struct platform_device *pdev)struct snd_soc_card *card = &poodle;int ret; -locomo_gpio_set_dir (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_AMP_ON ,0 ); -/* should we mute HP at startup - burning power ?*/ -locomo_gpio_set_dir (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_L ,0 ); -locomo_gpio_set_dir (&poodle_locomo_device.dev, -POODLE_LOCOMO_GPIO_MUTE_R ,0 ); + poodle_mute_l =devm_gpiod_get (&pdev->dev,"mute-l" ,GPIOD_OUT_HIGH ); +if (IS_ERR (poodle_mute_l)) +return PTR_ERR (poodle_mute_l); + + poodle_mute_r =devm_gpiod_get (&pdev->dev,"mute-r" ,GPIOD_OUT_HIGH ); +if (IS_ERR (poodle_mute_r)) +return PTR_ERR (poodle_mute_l); + + poodle_amp_on =devm_gpiod_get (&pdev->dev,"amp-on" ,GPIOD_OUT_LOW ); +if (IS_ERR (poodle_amp_on)) +return PTR_ERR (poodle_amp_on); card->dev = &pdev->dev;
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 14/17 ARM: pxa: poodle: use new LoCoMo driver
In reply to a message not in the archiveConvert poodle to use new mfd-based LoCoMo driver.
--- arch/arm/mach-pxa/Kconfig | 1 - arch/arm/mach-pxa/include/mach/poodle.h | 6 ---- arch/arm/mach-pxa/poodle.c | 58 ++++++++++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 11 deletions(-)
arch/arm/mach-pxa/Kconfig +0 -1
@@ -481,7 +481,6 @@ config MACH_POODLE bool "Enable Sharp SL-5600 (Poodle) Support" depends on PXA_SHARPSL select PXA25x - select SHARP_LOCOMO config MACH_CORGI bool "Enable Sharp SL-C700 (Corgi) Support"
arch/arm/mach-pxa/include/mach/poodle.h +0 -6
@@ -81,12 +81,6 @@#define POODLE_GPIO_L_LCLK (POODLE_SCOOP_GPIO_BASE + 10)#define POODLE_GPIO_HS_OUT (POODLE_SCOOP_GPIO_BASE + 11) -#define POODLE_LOCOMO_GPIO_AMP_ON LOCOMO_GPIO(8) -#define POODLE_LOCOMO_GPIO_MUTE_L LOCOMO_GPIO(10) -#define POODLE_LOCOMO_GPIO_MUTE_R LOCOMO_GPIO(11) -#define POODLE_LOCOMO_GPIO_232VCC_ON LOCOMO_GPIO(12) -#define POODLE_LOCOMO_GPIO_JK_B LOCOMO_GPIO(13) -#define POODLE_NR_IRQS (IRQ_BOARD_START + 4)/* 4 for LoCoMo */ extern struct platform_device poodle_locomo_device;
arch/arm/mach-pxa/poodle.c +54 -4
106 lines not on this page · raw message
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 17/17 ARM: drop old LoCoMo driver
In reply to a message not in the archiveAs there are no in-kernel users of old locomo driver, drop all alltogether. Remove Kconfig entry, driver and header.
--- arch/arm/common/Kconfig | 3 - arch/arm/common/Makefile | 1 - arch/arm/common/locomo.c | 914 --------------------------------- arch/arm/include/asm/hardware/locomo.h | 221 -------- 4 files changed, 1139 deletions(-) delete mode 100644 arch/arm/common/locomo.c delete mode 100644 arch/arm/include/asm/hardware/locomo.h
arch/arm/common/Kconfig +0 -3
@@ -9,9 +9,6 @@ config DMABOUNCE bool select ZONE_DMA -config SHARP_LOCOMO - bool - config SHARP_PARAM bool
arch/arm/common/Makefile +0 -1
@@ -7,7 +7,6 @@ obj-y += firmware.o obj-$(CONFIG_ICST) += icst.o obj-$(CONFIG_SA1111) += sa1111.o obj-$(CONFIG_DMABOUNCE) += dmabounce.o -obj-$(CONFIG_SHARP_LOCOMO) += locomo.o obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
arch/arm/common/locomo.c deleted +0 -914
914 lines not on this page · raw message
arch/arm/include/asm/hardware/locomo.h deleted +0 -221
221 lines not on this page · raw message
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/17 leds: port locomo leds driver to new locomo core
In reply to Dmitry Eremin-SolenikovAdapt locomo leds driver to new locomo core setup.
--- drivers/leds/Kconfig | 2 +- drivers/leds/leds-locomo.c | 117 +++++++++++++++++++++++---------------------- 2 files changed, 61 insertions(+), 58 deletions(-)
drivers/leds/Kconfig +1 -1
@@ -79,7 +79,7 @@ config LEDS_LM3642 config LEDS_LOCOMO tristate "LED Support for Locomo device" depends on LEDS_CLASS - depends on SHARP_LOCOMO + depends on MFD_LOCOMO help This option enables support for the LEDs on Sharp Locomo. Zaurus models SL-5500 and SL-5600.
drivers/leds/leds-locomo.c +60 -57
149 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH v3 02/17] leds: port locomo leds driver to new locomo core
Hi Dmitry,
Quoted 7 lines · Dmitry Eremin-Solenikov
Adapt locomo leds driver to new locomo core setup.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/leds/Kconfig | 2 +- drivers/leds/leds-locomo.c | 117 +++++++++++++++++++++++---------------------- 2 files changed, 61 insertions(+), 58 deletions(-)
Signature · 2 lines
Best Regards, Jacek Anaszewski
PATCH v3 3/17 input: convert LoCoMo keyboard driver to use new locomo core
In reply to Dmitry Eremin-SolenikovAs LoCoMo is switching to new device model, adapt keyboard driver to support new locomo core driver.
--- drivers/input/keyboard/Kconfig | 2 +- drivers/input/keyboard/locomokbd.c | 256 ++++++++++++++++++------------------- 2 files changed, 125 insertions(+), 133 deletions(-)
drivers/input/keyboard/Kconfig +1 -1
@@ -337,7 +337,7 @@ config KEYBOARD_LM8333 config KEYBOARD_LOCOMO tristate "LoCoMo Keyboard Support" - depends on SHARP_LOCOMO + depends on MFD_LOCOMO help Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA
drivers/input/keyboard/locomokbd.c +124 -132
418 lines not on this page · raw message
Signature · 1 line
2.1.4
Dmitry Torokhov
maintainerRe: [PATCH v3 03/17] input: convert LoCoMo keyboard driver to use new locomo core
Quoted 67 lines · Dmitry Eremin-Solenikov
As LoCoMo is switching to new device model, adapt keyboard driver to support new locomo core driver.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/input/keyboard/Kconfig | 2 +- drivers/input/keyboard/locomokbd.c | 256 ++++++++++++++++++------------------- 2 files changed, 125 insertions(+), 133 deletions(-)drivers/input/keyboard/Kconfig +1
-1@@ -337,7 +337,7 @@ config KEYBOARD_LM8333 config KEYBOARD_LOCOMO tristate "LoCoMo Keyboard Support" - depends on SHARP_LOCOMO + depends on MFD_LOCOMO help Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDAdrivers/input/keyboard/locomokbd.c +11
-14@@ -23,28 +23,25 @@* */ -#include <linux/slab.h> -#include <linux/module.h> +#include <linux/delay.h> #include <linux/init.h> #include <linux/input.h> -#include <linux/delay.h> -#include <linux/device.h> #include <linux/interrupt.h> -#include <linux/ioport.h> - -#include <asm/hardware/locomo.h> -#include <asm/irq.h> - -MODULE_AUTHOR ("John Lenz <[email protected]>" ); -MODULE_DESCRIPTION ("LoCoMo keyboard driver" ); -MODULE_LICENSE ("GPL" ); - -#define LOCOMOKBD_NUMKEYS 128 +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> +#include <linux/slab.h> +#include <linux/mfd/locomo.h> #define KEY_ACTIVITY KEY_F16#define KEY_CONTACT KEY_F18#define KEY_CENTER KEY_F15 +#define KB_ROWS 16 +#define KB_COLS 8 +#define LOCOMOKBD_NUMKEYS (KB_ROWS * KB_COLS) +#define SCANCODE (c, r) (((c)<<4) + (r) + 1) +static const unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS ] = {0 ,KEY_ESC ,KEY_ACTIVITY ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 0 - 9 */
drivers/input/keyboard/locomokbd.c locomokbd_keycode[LOCOMOKBD_NUMKEYS] = { · line 53
Quoted 5 lines
drivers/input/keyboard/locomokbd.c +1
-1@@ -53,7 +50,7 @@ locomokbd_keycode[LOCOMOKBD_NUMKEYS] = {0 ,0 ,0 ,KEY_CENTER ,0 ,KEY_MAIL ,0 ,0 ,0 ,0 ,/* 30 - 39 */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,KEY_RIGHT ,/* 40 - 49 */ KEY_UP ,KEY_LEFT ,0 ,0 ,KEY_P ,0 ,KEY_O ,KEY_I ,KEY_Y ,KEY_T ,/* 50 - 59 */ - KEY_E, KEY_W, 0, 0, 0, 0, KEY_DOWN, KEY_ENTER, 0, 0, /* 60 - 69 */ + KEY_E, KEY_W, 0, 0, 0, 0, KEY_DOWN, KEY_KPENTER, 0, 0, /* 60 - 69 */
Please split this into a separate patch or at least call it out in the changelog.
Quoted 280 lines
drivers/input/keyboard/locomokbd.c +75
-82KEY_BACKSPACE ,0 ,KEY_L ,KEY_U ,KEY_H ,KEY_R ,KEY_D ,KEY_Q ,0 ,0 ,/* 70 - 79 */ 0 ,0 ,0 ,0 ,0 ,0 ,KEY_ENTER ,KEY_RIGHTSHIFT ,KEY_K ,KEY_J ,/* 80 - 89 */ KEY_G, KEY_F, KEY_X, KEY_S, 0, 0, 0, 0, 0, 0, /* 90 - 99 */@@ -62,20 +59,14 @@ locomokbd_keycode[LOCOMOKBD_NUMKEYS] = {KEY_M ,KEY_SPACE ,KEY_V ,KEY_APOSTROPHE ,KEY_SLASH ,0 ,0 ,0 /* 120 - 128 */ }; -#define KB_ROWS 16 -#define KB_COLS 8 -#define KB_ROWMASK (r) (1 << (r)) -#define SCANCODE (c,r) ( ((c)<<4) + (r) + 1 ) -#define KB_DELAY 8 -#define SCAN_INTERVAL (HZ/10)struct locomokbd {unsigned char keycode[LOCOMOKBD_NUMKEYS ];struct input_dev *input; -char phys[32 ]; -unsigned long base; +struct regmap *regmap; +int irq;spinlock_t lock;struct timer_list timer;@@ -84,37 +75,33 @@ struct locomokbd { };/* helper functions for reading the keyboard matrix */ -static inline void locomokbd_charge_all (unsigned long membase) +static void locomokbd_charge_all (struct locomokbd *locomokbd) { -locomo_writel (0x00FF , membase +LOCOMO_KSC ); +regmap_write (locomokbd->regmap,LOCOMO_KSC ,0x00ff ); } -static inline void locomokbd_activate_all (unsigned long membase) +static void locomokbd_activate_all (struct locomokbd *locomokbd) { -unsigned long r; - -locomo_writel (0 , membase +LOCOMO_KSC ); - r =locomo_readl (membase +LOCOMO_KIC ); - r &=0xFEFF ; -locomo_writel (r, membase +LOCOMO_KIC ); +regmap_write (locomokbd->regmap,LOCOMO_KSC ,0 ); +regmap_update_bits (locomokbd->regmap,LOCOMO_KIC ,0x100 ,0 ); } -static inline void locomokbd_activate_col (unsigned long membase,int col) +static void locomokbd_activate_col (struct locomokbd *locomokbd,int col) {unsigned short nset;unsigned short nbset; - nset =0xFF & ~(1 << col); + nset =0xFF & ~BIT (col); nbset = (nset <<8 ) + nset; -locomo_writel (nbset, membase +LOCOMO_KSC ); +regmap_write (locomokbd->regmap,LOCOMO_KSC , nbset); } -static inline void locomokbd_reset_col (unsigned long membase,int col) +static void locomokbd_reset_col (struct locomokbd *locomokbd,int col) {unsigned short nbset; - nbset = ((0xFF & ~(1 << col)) <<8 ) +0xFF ; -locomo_writel (nbset, membase +LOCOMO_KSC ); + nbset = ((0xFF & ~BIT (col)) <<8 ) +0xFF ; +regmap_write (locomokbd->regmap,LOCOMO_KSC , nbset); }/* @@ -129,24 +116,25 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)unsigned int row, col, rowd;unsigned long flags;unsigned int num_pressed; -unsigned long membase = locomokbd->base; +bool esc_pressed = false;spin_lock_irqsave (&locomokbd->lock, flags); -locomokbd_charge_all (membase); +locomokbd_charge_all (locomokbd); num_pressed =0 ;for (col =0 ; col <KB_COLS ; col++) { - -locomokbd_activate_col (membase, col); +udelay (KB_DELAY ); +locomokbd_activate_col (locomokbd, col);udelay (KB_DELAY ); - rowd = ~locomo_readl (membase +LOCOMO_KIB ); +regmap_read (locomokbd->regmap,LOCOMO_KIB , &rowd); + rowd = ~rowd;for (row =0 ; row <KB_ROWS ; row++) {unsigned int scancode, pressed, key; scancode =SCANCODE (col, row); - pressed = rowd &KB_ROWMASK (row); + pressed = rowd &BIT (row); key = locomokbd->keycode[scancode];input_report_key (locomokbd->input, key, pressed);@@ -158,30 +146,32 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)/* The "Cancel/ESC" key is labeled "On/Off" on * Collie and Poodle and should suspend the device * if it was pressed for more than a second. */ -if (unlikely (key ==KEY_ESC )) { -if (!time_after (jiffies, - locomokbd->suspend_jiffies +HZ )) -continue ; -if (locomokbd->count_cancel++ - != (HZ /SCAN_INTERVAL +1 )) -continue ; -input_event (locomokbd->input,EV_PWR , -KEY_SUSPEND ,1 ); - locomokbd->suspend_jiffies = jiffies; - }else - locomokbd->count_cancel =0 ; +if (unlikely (key ==KEY_ESC )) + esc_pressed = true; } -locomokbd_reset_col (membase, col); +locomokbd_reset_col (locomokbd, col); } -locomokbd_activate_all (membase); +locomokbd_activate_all (locomokbd);input_sync (locomokbd->input);/* if any keys are pressed, enable the timer */ if (num_pressed) -mod_timer (&locomokbd->timer, jiffies +SCAN_INTERVAL ); +mod_timer (&locomokbd->timer, jiffies +msecs_to_jiffies (100 ));else +regmap_update_bits (locomokbd->regmap,LOCOMO_KIC ,0x10 ,0x10 ); + + +if (esc_pressed &&time_after (jiffies, + locomokbd->suspend_jiffies +msecs_to_jiffies (1000 ))) { +if (locomokbd->count_cancel++ >20 ) { +input_event (locomokbd->input,EV_PWR , +KEY_SUSPEND ,1 ); + locomokbd->suspend_jiffies = jiffies; + } + }else { locomokbd->count_cancel =0 ; + }spin_unlock_irqrestore (&locomokbd->lock, flags); }@@ -192,18 +182,17 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)static irqreturn_t locomokbd_interrupt (int irq,void *dev_id) {struct locomokbd *locomokbd = dev_id; -u16 r; +unsigned int r; - r =locomo_readl (locomokbd->base +LOCOMO_KIC ); +regmap_read (locomokbd->regmap,LOCOMO_KIC , &r);if ((r &0x0001 ) ==0 )return IRQ_HANDLED ; -locomo_writel (r & ~0x0100 , locomokbd->base +LOCOMO_KIC );/* Ack */ +/* Mask and Ack */ +regmap_write (locomokbd->regmap,LOCOMO_KIC , r & ~0x110 ); -/** wait chattering delay **/ -udelay (100 ); +mod_timer (&locomokbd->timer, jiffies +msecs_to_jiffies (1 )); -locomokbd_scankeyboard (locomokbd);return IRQ_HANDLED ; }@@ -220,47 +209,39 @@ static void locomokbd_timer_callback(unsigned long data)static int locomokbd_open (struct input_dev *dev) {struct locomokbd *locomokbd =input_get_drvdata (dev); -u16 r; - - r =locomo_readl (locomokbd->base +LOCOMO_KIC ) |0x0010 ; -locomo_writel (r, locomokbd->base +LOCOMO_KIC ); -return 0 ; + +return regmap_update_bits (locomokbd->regmap,LOCOMO_KIC ,0x10 ,0x10 ); }static void locomokbd_close (struct input_dev *dev) {struct locomokbd *locomokbd =input_get_drvdata (dev); -u16 r; - - r =locomo_readl (locomokbd->base +LOCOMO_KIC ) & ~0x0010 ; -locomo_writel (r, locomokbd->base +LOCOMO_KIC ); + +regmap_update_bits (locomokbd->regmap,LOCOMO_KIC ,0x10 ,0x0 ); + +del_timer_sync (&locomokbd->timer); } -static int locomokbd_probe (struct locomo_dev *dev) +static int locomokbd_probe (struct platform_device *dev) {struct locomokbd *locomokbd;struct input_dev *input_dev;int i, err; - locomokbd =kzalloc (sizeof (struct locomokbd ),GFP_KERNEL ); - input_dev =input_allocate_device (); -if (!locomokbd || !input_dev) { - err = -ENOMEM ; - goto err_free_mem; - } + locomokbd =devm_kzalloc (&dev->dev,sizeof (struct locomokbd ), +GFP_KERNEL ); +if (!locomokbd) +return -ENOMEM ; -/* try and claim memory region */ -if (!request_mem_region ((unsigned long ) dev->mapbase, - dev->length, -LOCOMO_DRIVER_NAME (dev))) { - err = -EBUSY ; -printk (KERN_ERR "locomokbd: Can't acquire access to io memory for keyboard\n" ); - goto err_free_mem; - } + locomokbd->regmap =dev_get_regmap (dev->dev.parent,NULL ); +if (!locomokbd->regmap) +return -EINVAL ; -locomo_set_drvdata (dev, locomokbd); + locomokbd->irq =platform_get_irq (dev,0 ); +if (locomokbd->irq <0 ) +return -ENXIO ; - locomokbd->base = (unsigned long ) dev->mapbase; +platform_set_drvdata (dev, locomokbd);spin_lock_init (&locomokbd->lock);@@ -270,11 +251,13 @@ static int locomokbd_probe(struct locomo_dev *dev) locomokbd->suspend_jiffies = jiffies; - locomokbd->input = input_dev; -strcpy (locomokbd->phys,"locomokbd/input0" ); + input_dev =devm_input_allocate_device (&dev->dev); +if (!input_dev) +return -ENOMEM ; + locomokbd->input = input_dev; input_dev->name ="LoCoMo keyboard" ; - input_dev->phys = locomokbd->phys; + input_dev->phys ="locomokbd/input0" ; input_dev->id.bustype =BUS_HOST ; input_dev->id.vendor =0x0001 ; input_dev->id.product =0x0001 ;@@ -291,72 +274,81 @@ static int locomokbd_probe(struct locomo_dev *dev)input_set_drvdata (input_dev, locomokbd); -memcpy (locomokbd->keycode, locomokbd_keycode,sizeof (locomokbd->keycode)); +memcpy (locomokbd->keycode, + locomokbd_keycode, +sizeof (locomokbd->keycode)); +for (i =0 ; i <LOCOMOKBD_NUMKEYS ; i++) -set_bit (locomokbd->keycode[i], input_dev->keybit); -clear_bit (0 , input_dev->keybit); +input_set_capability (input_dev,EV_KEY , locomokbd->keycode[i]); +input_set_capability (input_dev,EV_PWR ,KEY_SUSPEND ); +__set_bit (EV_REP , input_dev->evbit); + +regmap_write (locomokbd->regmap,LOCOMO_KCMD ,1 ); +regmap_write (locomokbd->regmap,LOCOMO_KSC ,0x0 );
drivers/input/keyboard/locomokbd.c static int locomokbd_probe(struct locomo_dev *dev) · line 294
Quoted 10 lines
drivers/input/keyboard/locomokbd.c +4
-3+regmap_write (locomokbd->regmap,LOCOMO_KIC ,0x0 );/* attempt to get the interrupt */ - err =request_irq (dev->irq[0 ], locomokbd_interrupt,0 ,"locomokbd" , locomokbd); + err =devm_request_irq (&dev->dev, locomokbd->irq, locomokbd_interrupt, +0 ,"locomokbd" , locomokbd);if (err) { -printk (KERN_ERR "locomokbd: Can't get irq for keyboard\n" ); - goto err_release_region; +dev_err (&dev->dev,"locomokbd: Can't get irq for keyboard\n" );
No need for "locomokbd: " prefix it will come from dev_err.
Quoted 17 lines
drivers/input/keyboard/locomokbd.c +2
-8+return err; } err =input_register_device (locomokbd->input);if (err) - goto err_free_irq; +return err;return 0 ; - err_free_irq: -free_irq (dev->irq[0 ], locomokbd); - err_release_region: -release_mem_region ((unsigned long ) dev->mapbase, dev->length); -locomo_set_drvdata (dev,NULL ); - err_free_mem: -input_free_device (input_dev);
drivers/input/keyboard/locomokbd.c static int locomokbd_probe(struct locomo_dev *dev) · line 310
Quoted 10 lines
drivers/input/keyboard/locomokbd.c +4
-3-kfree (locomokbd); -return err; } -static int locomokbd_remove (struct locomo_dev *dev) +static int locomokbd_remove (struct platform_device *dev) +{ +return 0 ; +}
No need for the empty stub.
Quoted 19 lines
drivers/input/keyboard/locomokbd.c +8
-5+ +static int __maybe_unused locomokbd_suspend (struct device *dev) { -struct locomokbd *locomokbd =locomo_get_drvdata (dev); +struct locomokbd *locomokbd =dev_get_drvdata (dev); -free_irq (dev->irq[0 ], locomokbd); +regmap_update_bits (locomokbd->regmap,LOCOMO_KIC ,0x10 ,0x0 );del_timer_sync (&locomokbd->timer); -input_unregister_device (locomokbd->input); -locomo_set_drvdata (dev,NULL ); +return 0 ; +} -release_mem_region ((unsigned long ) dev->mapbase, dev->length); +static int __maybe_unused locomokbd_resume (struct device *dev) +{
drivers/input/keyboard/locomokbd.c static int locomokbd_probe(struct locomo_dev *dev) · line 333
Quoted 10 lines
drivers/input/keyboard/locomokbd.c +8
-1+struct locomokbd *locomokbd =dev_get_drvdata (dev); -kfree (locomokbd); +regmap_write (locomokbd->regmap,LOCOMO_KCMD ,1 ); +regmap_write (locomokbd->regmap,LOCOMO_KSC ,0 ); +regmap_write (locomokbd->regmap,LOCOMO_KIC ,0x0 ); + +/* Rescan keyboard only if we are open by somebody */ +if (locomokbd->input->users) +locomokbd_scankeyboard (locomokbd);
input->users should be accessed while holing input->mutex.
Quoted 39 lines
drivers/input/keyboard/locomokbd.c +11
-15return 0 ; } -static struct locomo_driver keyboard_driver = { - .drv = { - .name ="locomokbd" +static SIMPLE_DEV_PM_OPS(locomo_kbd_pm, locomokbd_suspend, locomokbd_resume); + +static struct platform_driver locomokbd_driver = { + .driver = { + .name ="locomo-kbd" , + .pm = &locomo_kbd_pm, }, - .devid =LOCOMO_DEVID_KEYBOARD , .probe = locomokbd_probe, .remove = locomokbd_remove, }; -static int __init locomokbd_init (void ) -{ -return locomo_driver_register (&keyboard_driver); -} - -static void __exit locomokbd_exit(void) -{ -locomo_driver_unregister (&keyboard_driver); -} +module_platform_driver (locomokbd_driver); -module_init (locomokbd_init); -module_exit (locomokbd_exit); +MODULE_AUTHOR ("John Lenz <[email protected]>" ); +MODULE_DESCRIPTION ("LoCoMo keyboard driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:locomo-kbd" );Signature · 1 line
2.1.4
Thanks.
Signature · 1 line
Dmitry
PATCH v3 5/17 video: backlight: add new locomo backlight driver
In reply to Dmitry Eremin-SolenikovAdd new simple backlight driver - it cares only about PWM/frontlight part of LoCoMo, it does not touch TFT settings and does not export TFT power control.
--- drivers/video/backlight/Kconfig | 6 +- drivers/video/backlight/Makefile | 2 +- drivers/video/backlight/locomo_bl.c | 153 ++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 drivers/video/backlight/locomo_bl.c
drivers/video/backlight/Kconfig +3 -3
@@ -217,12 +217,12 @@ config BACKLIGHT_LM3533 levels. config BACKLIGHT_LOCOMO - tristate "Sharp LOCOMO LCD/Backlight Driver" - depends on SHARP_LOCOMO + tristate "Sharp LOCOMO Backlight Driver" + depends on MFD_LOCOMO default y help If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to - enable the LCD/backlight driver. + enable the backlight driver. config BACKLIGHT_OMAP1 tristate "OMAP1 PWL-based LCD Backlight"
drivers/video/backlight/Makefile +1 -1
@@ -39,7 +39,7 @@ obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o -obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o +obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomo_bl.o obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o obj-$(CONFIG_BACKLIGHT_LV5207LP) += lv5207lp.o
drivers/video/backlight/locomo_bl.c new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 6/17 video: lcd: add LoCoMo LCD driver
In reply to Dmitry Eremin-SolenikovLoCoMo has some special handling for TFT screens attached to Collie and Poodle. Implement that as a separate driver.
--- drivers/video/backlight/Kconfig | 10 ++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/locomo_lcd.c | 285 +++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 drivers/video/backlight/locomo_lcd.c
drivers/video/backlight/Kconfig +10 -0
@@ -48,6 +48,16 @@ config LCD_LMS283GF05 SPI driver for Samsung LMS283GF05. This provides basic support for powering the LCD up/down through a sysfs interface. +config LCD_LOCOMO + tristate "Sharp LOCOMO LCD Driver" + depends on MFD_LOCOMO + select IIO + help + If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to + enable the LCD driver. The panel starts up in power + off state, so you need this driver in order to see any + output. + config LCD_LTV350QV tristate "Samsung LTV350QV LCD Panel" depends on SPI_MASTER
drivers/video/backlight/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o obj-$(CONFIG_LCD_LD9040) += ld9040.o obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o obj-$(CONFIG_LCD_LMS501KF03) += lms501kf03.o +obj-$(CONFIG_LCD_LOCOMO) += locomo_lcd.o obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.o
drivers/video/backlight/locomo_lcd.c new file +285 -0
285 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH v3 06/17] video: lcd: add LoCoMo LCD driver
Quoted 10 lines · Dmitry Eremin-Solenikov
LoCoMo has some special handling for TFT screens attached to Collie and Poodle. Implement that as a separate driver.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/video/backlight/Kconfig | 10 ++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/locomo_lcd.c | 285 +++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 drivers/video/backlight/locomo_lcd.c
This looks like it should be part of patch 16.
How much of this file is the same as the one removed later in the set?
Quoted 324 lines
drivers/video/backlight/Kconfig +10
-0@@ -48,6 +48,16 @@ config LCD_LMS283GF05 SPI driver for Samsung LMS283GF05. This provides basic support for powering the LCD up/down through a sysfs interface. +config LCD_LOCOMO + tristate "Sharp LOCOMO LCD Driver" + depends on MFD_LOCOMO + select IIO + help + If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to + enable the LCD driver. The panel starts up in power + off state, so you need this driver in order to see any + output. + config LCD_LTV350QV tristate "Samsung LTV350QV LCD Panel" depends on SPI_MASTERdrivers/video/backlight/Makefile +1
-0@@ -11,6 +11,7 @@ obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o obj-$(CONFIG_LCD_LD9040) += ld9040.o obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o obj-$(CONFIG_LCD_LMS501KF03) += lms501kf03.o +obj-$(CONFIG_LCD_LOCOMO) += locomo_lcd.o obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o obj-$(CONFIG_LCD_S6E63M0) += s6e63m0.odrivers/video/backlight/locomo_lcd.c new file +285
-0@@ -0,0 +1,285 @@ +/* +* Backlight control code for Sharp Zaurus SL-5500 +* +* Copyright 2005 John Lenz <[email protected]> +* Maintainer: Pavel Machek <[email protected]> (unless John wants to :-) +* GPL v2 +* +* This driver assumes single CPU. That's okay, because collie is +* slightly old hardware, and no one is going to retrofit second CPU to +* old PDA. +*/ + +#include <linux/delay.h> +#include <linux/fb.h> +#include <linux/gpio/consumer.h> +#include <linux/iio/consumer.h> +#include <linux/lcd.h> +#include <linux/mfd/locomo.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +struct locomo_lcd { +struct regmap *regmap; +struct platform_device *dev; +struct locomo_lcd_platform_data *data; +int power; +struct iio_channel *comadj; +struct gpio_desc *vsha, *vshd, *vee, *mod; +}; + +static void locomo_lcd_on (struct locomo_lcd *lcd) +{ +gpiod_set_value (lcd->vsha,1 ); +usleep_range (2000 ,3000 ); + +gpiod_set_value (lcd->vshd,1 ); +usleep_range (2000 ,3000 ); + +iio_write_channel_raw (lcd->comadj, lcd->data->comadj); +usleep_range (5000 ,6000 ); + +gpiod_set_value (lcd->vee,1 ); +usleep_range (10000 ,11000 ); + +/* TFTCRST | CPSOUT=0 | CPSEN */ +regmap_write (lcd->regmap,LOCOMO_TC ,0x01 ); + +/* Set CPSD */ +regmap_write (lcd->regmap,LOCOMO_CPSD ,6 ); + +/* TFTCRST | CPSOUT=0 | CPSEN */ +regmap_write (lcd->regmap,LOCOMO_TC ,0x04 |0x01 ); +usleep_range (10000 ,11000 ); + +gpiod_set_value (lcd->mod,1 ); +} + +static void locomo_lcd_off (struct locomo_lcd *lcd) +{ +/* TFTCRST=1 | CPSOUT=1 | CPSEN = 0 */ +regmap_write (lcd->regmap,LOCOMO_TC ,0x06 ); +usleep_range (1000 ,2000 ); + +gpiod_set_value (lcd->vsha,0 ); +msleep (110 ); + +gpiod_set_value (lcd->vee,0 ); +msleep (700 ); + +iio_write_channel_raw (lcd->comadj,0 ); +usleep_range (5000 ,6000 ); + +/* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */ +regmap_write (lcd->regmap,LOCOMO_TC ,0 ); +gpiod_set_value (lcd->mod,0 ); +gpiod_set_value (lcd->vshd,0 ); +} + +static void locomo_lcd_program_adsync (struct locomo_lcd *lcd) +{ +regmap_write (lcd->regmap,LOCOMO_ASD , +6 +8 +320 +30 -10 ); +regmap_update_bits (lcd->regmap,LOCOMO_ASD , +0x8000 , +0x8000 ); + +regmap_write (lcd->regmap,LOCOMO_HSD , +6 +8 +320 +30 -10 -128 +4 ); +regmap_update_bits (lcd->regmap,LOCOMO_HSD , +0x8000 , +0x8000 ); + +regmap_write (lcd->regmap,LOCOMO_HSC ,128 /8 ); + +/* XON */ +regmap_write (lcd->regmap,LOCOMO_TADC ,0x80 ); +usleep_range (1000 ,1100 ); + +/* CLK9MEN */ +regmap_update_bits (lcd->regmap,LOCOMO_TADC , +0x10 , +0x10 ); +usleep_range (100 ,200 ); +} + +static void locomo_lcd_disable_adsync (struct locomo_lcd *lcd) +{ +/* ADSTART */ +regmap_write (lcd->regmap,LOCOMO_ASD ,0x00 ); + +/* 18MHz clock off*/ +regmap_write (lcd->regmap,LOCOMO_TADC ,0x00 ); +} + +int locomo_lcd_set_power (struct lcd_device *ldev,int power) +{ +struct locomo_lcd *lcd =lcd_get_data (ldev); + +dev_dbg (&ldev->dev,"LCD power %d (is %d)\n" , power, lcd->power); + +if (!power && lcd->power) +locomo_lcd_on (lcd); + +if (power && !lcd->power) +locomo_lcd_off (lcd); + + lcd->power = power; + +return 0 ; +} + +static int locomo_lcd_get_power (struct lcd_device *ldev) +{ +struct locomo_lcd *lcd =lcd_get_data (ldev); + +return lcd->power; +} + +static struct lcd_ops locomo_lcd_ops = { + .set_power = locomo_lcd_set_power, + .get_power = locomo_lcd_get_power, +}; + +#ifdef CONFIG_PM_SLEEP +static int locomo_lcd_suspend (struct device *dev) +{ +struct lcd_device *ldev =dev_get_drvdata (dev); +struct locomo_lcd *lcd =lcd_get_data (ldev); + +locomo_lcd_off (lcd); + +locomo_lcd_disable_adsync (lcd); + +return 0 ; +} + +static int locomo_lcd_resume (struct device *dev) +{ +struct lcd_device *ldev =dev_get_drvdata (dev); +struct locomo_lcd *lcd =lcd_get_data (ldev); + +locomo_lcd_program_adsync (lcd); + +if (!lcd->power) +locomo_lcd_on (lcd); + +return 0 ; +} + +static SIMPLE_DEV_PM_OPS(locomo_lcd_pm, locomo_lcd_suspend, locomo_lcd_resume); +#define LOCOMOLCD_PM (&locomo_lcd_pm) +#else +#define LOCOMOLCD_PM NULL +#endif + +static int locomo_lcd_probe (struct platform_device *dev) +{ +struct lcd_device *lcd_dev; +struct locomo_lcd *lcd; +int rc; + + lcd =devm_kmalloc (&dev->dev,sizeof (struct locomo_lcd ),GFP_KERNEL ); +if (!lcd) +return -ENOMEM ; + + lcd->dev = dev; + lcd->power =FB_BLANK_NORMAL ; + + lcd->regmap =dev_get_regmap (dev->dev.parent,NULL ); +if (!lcd->regmap) +return -ENODEV ; + + lcd->data =dev_get_platdata (&dev->dev); +if (!lcd->data) +return -EINVAL ; + + lcd->vsha =devm_gpiod_get (&dev->dev,"VSHA" ,GPIOD_OUT_LOW ); +if (IS_ERR (lcd->vsha)) +return PTR_ERR (lcd->vsha); + + lcd->vshd =devm_gpiod_get (&dev->dev,"VSHD" ,GPIOD_OUT_LOW ); +if (IS_ERR (lcd->vshd)) +return PTR_ERR (lcd->vshd); + + lcd->vee =devm_gpiod_get (&dev->dev,"Vee" ,GPIOD_OUT_LOW ); +if (IS_ERR (lcd->vee)) +return PTR_ERR (lcd->vee); + + lcd->mod =devm_gpiod_get (&dev->dev,"MOD" ,GPIOD_OUT_LOW ); +if (IS_ERR (lcd->mod)) +return PTR_ERR (lcd->mod); + + lcd->comadj =iio_channel_get (&dev->dev,"comadj" ); +if (IS_ERR (lcd->comadj)) { + rc =PTR_ERR (lcd->comadj); +if (rc == -ENODEV ) + rc = -EPROBE_DEFER ; + +return rc; + } + +locomo_lcd_program_adsync (lcd); + + lcd_dev =devm_lcd_device_register (&dev->dev,"locomo" , &dev->dev, lcd, + &locomo_lcd_ops); +if (IS_ERR (lcd_dev)) { + rc =PTR_ERR (lcd_dev); + goto err; + } + +platform_set_drvdata (dev, lcd_dev); + +lcd_set_power (lcd_dev,FB_BLANK_UNBLANK ); + +return 0 ; + +err: +locomo_lcd_disable_adsync (lcd); +iio_channel_release (lcd->comadj); + +return rc; +} + +static int locomo_lcd_remove (struct platform_device *dev) +{ +struct lcd_device *ldev =platform_get_drvdata (dev); +struct locomo_lcd *lcd =lcd_get_data (ldev); + +locomo_lcd_off (lcd); + +locomo_lcd_disable_adsync (lcd); + +iio_channel_release (lcd->comadj); + +return 0 ; +} + +static void locomo_lcd_shutdown (struct platform_device *dev) +{ +struct lcd_device *ldev =platform_get_drvdata (dev); +struct locomo_lcd *lcd =lcd_get_data (ldev); + +locomo_lcd_off (lcd); + +locomo_lcd_disable_adsync (lcd); +} + +static struct platform_driver locomo_lcd_driver = { + .driver = { + .name ="locomo-lcd" , + .pm =LOCOMOLCD_PM , + }, + .probe = locomo_lcd_probe, + .remove = locomo_lcd_remove, + .shutdown = locomo_lcd_shutdown, +}; + +module_platform_driver (locomo_lcd_driver); + +MODULE_AUTHOR ("John Lenz <[email protected]>" ); +MODULE_AUTHOR ("Pavel Machek <[email protected]>" ); +MODULE_DESCRIPTION ("LoCoMo LCD driver" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_ALIAS ("platform:locomo-lcd" );
Signature · 8 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 06/17] video: lcd: add LoCoMo LCD driver
2015-05-19 12:36 GMT+03:00 Lee Jones <[email protected]>:
Quoted 13 lines · Dmitry Eremin-Solenikov
Quoted 11 lines
LoCoMo has some special handling for TFT screens attached to Collie and Poodle. Implement that as a separate driver.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/video/backlight/Kconfig | 10 ++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/locomo_lcd.c | 285 +++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 drivers/video/backlight/locomo_lcd.c
Quoted 3 lines
This looks like it should be part of patch 16.
How much of this file is the same as the one removed later in the set?
This is a completely new driver. Only few comments remained from old locomolcd.c.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v3 06/17] video: lcd: add LoCoMo LCD driver
Quoted 14 lines · Dmitry Eremin-Solenikov
2015-05-19 12:36 GMT+03:00 Lee Jones <[email protected]>:
Quoted 13 lines · Dmitry Eremin-Solenikov
Quoted 11 lines
LoCoMo has some special handling for TFT screens attached to Collie and Poodle. Implement that as a separate driver.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- drivers/video/backlight/Kconfig | 10 ++ drivers/video/backlight/Makefile | 1 + drivers/video/backlight/locomo_lcd.c | 285 +++++++++++++++++++++++++++++++++++ 3 files changed, 296 insertions(+) create mode 100644 drivers/video/backlight/locomo_lcd.c
Quoted 6 lines
Quoted 3 lines
This looks like it should be part of patch 16.
How much of this file is the same as the one removed later in the set?
This is a completely new driver. Only few comments remained from old
locomolcd.c.
Okay, thanks for the explanation.
I'm sure Jingoo will be around to review shortly.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 7/17 gpio: port LoCoMo gpio support from old driver
In reply to Dmitry Eremin-SolenikovAdd gpiolib driver for gpio pins placed on the LoCoMo GA.
--- drivers/gpio/Kconfig | 12 ++++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-locomo.c | 170 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 drivers/gpio/gpio-locomo.c
drivers/gpio/Kconfig +12 -0
@@ -734,6 +734,18 @@ config GPIO_KEMPLD This driver can also be built as a module. If so, the module will be called gpio-kempld. +config GPIO_LOCOMO + bool "Sharp LoCoMo GPIO support" + depends on MFD_LOCOMO + help + Select this to support GPIO pins on Sharp LoCoMo Grid Array found + in Sharp Zaurus collie and poodle models. + + Sat Yes if you have such PDA, say No otherwise. + + This driver can also be built as a module. If so, the module will be + called gpio-locomo. + config GPIO_LP3943 tristate "TI/National Semiconductor LP3943 GPIO expander" depends on MFD_LP3943
drivers/gpio/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o obj-$(CONFIG_GPIO_INTEL_MID) += gpio-intel-mid.o +obj-$(CONFIG_GPIO_LOCOMO) += gpio-locomo.o obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
drivers/gpio/gpio-locomo.c new file +170 -0
170 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 8/17 gpio: locomo: implement per-pin irq handling
In reply to Dmitry Eremin-SolenikovLoCoMo has a possibility to generate per-GPIO edge irqs. Support for that was there in old locomo driver, got 'cleaned up' during old driver IRQ cascading cleanup and is now reimplemented. It is expected that SL-5500 (collie) will use locomo gpio irqs for mmc detection irq.
--- drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-locomo.c | 117 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 117 insertions(+), 1 deletion(-)
drivers/gpio/Kconfig +1 -0
@@ -737,6 +737,7 @@ config GPIO_KEMPLD config GPIO_LOCOMO bool "Sharp LoCoMo GPIO support" depends on MFD_LOCOMO + select GPIOLIB_IRQCHIP help Select this to support GPIO pins on Sharp LoCoMo Grid Array found in Sharp Zaurus collie and poodle models.
drivers/gpio/gpio-locomo.c +116 -1
154 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 9/17 spi: add locomo SPI driver
In reply to Dmitry Eremin-SolenikovLoCoMo chip has a built-in simple SPI controller. On Sharp SL-5500 PDDAs it is connected to external MMC slot.
--- drivers/spi/Kconfig | 10 ++ drivers/spi/Makefile | 1 + drivers/spi/spi-locomo.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 343 insertions(+) create mode 100644 drivers/spi/spi-locomo.c
drivers/spi/Kconfig +10 -0
@@ -258,6 +258,16 @@ config SPI_LM70_LLP which interfaces to an LM70 temperature sensor using a parallel port. +config SPI_LOCOMO + tristate "Locomo SPI master" + depends on MFD_LOCOMO + help + This enables using the SPI controller as present in the LoCoMo + chips. It is probably only useful on the Sharp SL-5x00 PDA family. + + On SL-5500 and SL-5000 devices this controller is used for + MMC/SD cards. + config SPI_MPC52xx tristate "Freescale MPC52xx SPI (non-PSC) controller support" depends on PPC_MPC52xx
drivers/spi/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LOCOMO) += spi-locomo.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-locomo.c new file +332 -0
332 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 10/17 i2c: add locomo i2c driver
In reply to Dmitry Eremin-SolenikovLoCoMo chip contains a tiny i2c controller destined to control M62332 DAC. Provide a separate I2C driver for this cell.
--- drivers/i2c/busses/Kconfig | 12 ++++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-locomo.c | 135 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 drivers/i2c/busses/i2c-locomo.c
drivers/i2c/busses/Kconfig +12 -0
@@ -602,6 +602,18 @@ config I2C_KEMPLD This driver can also be built as a module. If so, the module will be called i2c-kempld. +config I2C_LOCOMO + tristate "I2C bus support for LoCoMo chips" + depends on MFD_LOCOMO + select I2C_ALGOBIT + help + Say yes if you will run the kernel on Sharp SL-5x00 family of devices. + + If you don't know what to do here, say N. + + This driver can also be built as a module. If so, the module + will be called i2c-locomo. + config I2C_MESON tristate "Amlogic Meson I2C controller" depends on ARCH_MESON
drivers/i2c/busses/Makefile +1 -0
@@ -58,6 +58,7 @@ obj-$(CONFIG_I2C_IMX) += i2c-imx.o obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o obj-$(CONFIG_I2C_JZ4780) += i2c-jz4780.o obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o +obj-$(CONFIG_I2C_LOCOMO) += i2c-locomo.o obj-$(CONFIG_I2C_MESON) += i2c-meson.o obj-$(CONFIG_I2C_MPC) += i2c-mpc.o obj-$(CONFIG_I2C_MV64XXX) += i2c-mv64xxx.o
drivers/i2c/busses/i2c-locomo.c new file +135 -0
135 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v3 11/17 ARM: sa1100: make collie use new locomo drivers
In reply to Dmitry Eremin-SolenikovSwitch collie to new mfd-based locomo driver. Update platform data and add necessary spi, i2c and regulator devices.
--- arch/arm/mach-sa1100/Kconfig | 1 - arch/arm/mach-sa1100/collie.c | 213 ++++++++++++++++++++++------- arch/arm/mach-sa1100/include/mach/collie.h | 16 ++- 3 files changed, 178 insertions(+), 52 deletions(-)
arch/arm/mach-sa1100/Kconfig +0 -1
@@ -48,7 +48,6 @@ endchoice config SA1100_COLLIE bool "Sharp Zaurus SL5500" # FIXME: select ARM_SA11x0_CPUFREQ - select SHARP_LOCOMO select SHARP_PARAM select SHARP_SCOOP help
arch/arm/mach-sa1100/collie.c +165 -48
312 lines not on this page · raw message
arch/arm/mach-sa1100/include/mach/collie.h +13 -3
@@ -24,12 +24,12 @@ extern void locomolcd_power(int on);#define COLLIE_SCP_MUTE_L SCOOP_GPCR_PA14#define COLLIE_SCP_MUTE_R SCOOP_GPCR_PA15#define COLLIE_SCP_5VON SCOOP_GPCR_PA16 -#define COLLIE_SCP_AMP_ON SCOOP_GPCR_PA17 +#define COLLIE_GPIO_AMP2_ON (COLLIE_SCOOP_GPIO_BASE + 6)#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7)#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19#define COLLIE_SCOOP_IO_DIR (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \ - COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \ + COLLIE_SCP_5VON | \ COLLIE_SCP_LB_VOL_CHG)#define COLLIE_SCOOP_IO_OUT (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R)
@@ -81,7 +81,7 @@ extern void locomolcd_power(int on);#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2#define COLLIE_GPIO_IR_ON (COLLIE_TC35143_GPIO_BASE + 3) -#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 +#define COLLIE_GPIO_AMP1_ON (COLLIE_TC35143_GPIO_BASE + 4)#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6
@@ -92,4 +92,14 @@ extern void locomolcd_power(int on);#define COLLIE_TC35143_GPIO_OUT (UCB_IO_1 | UCB_IO_3 | UCB_IO_4 \ | UCB_IO_6) +/* GPIOs on LoCoMo GA */ +#define COLLIE_LOCOMO_GPIO_BASE (GPIO_MAX + 13 + 10) +#define COLLIE_GPIO_RTS (COLLIE_LOCOMO_GPIO_BASE + 0) +#define COLLIE_GPIO_CTS (COLLIE_LOCOMO_GPIO_BASE + 1) +#define COLLIE_GPIO_DSR (COLLIE_LOCOMO_GPIO_BASE + 2) +#define COLLIE_GPIO_DTR (COLLIE_LOCOMO_GPIO_BASE + 3) +#define COLLIE_GPIO_CARD_DETECT (COLLIE_LOCOMO_GPIO_BASE + 13) +#define COLLIE_GPIO_CARD_RO (COLLIE_LOCOMO_GPIO_BASE + 14) +#define COLLIE_GPIO_CARD_POWER (COLLIE_LOCOMO_GPIO_BASE + 15) +#endif
Signature · 1 line
2.1.4
PATCH v3 12/17 ARM: sa1100: don't preallocate IRQ space for locomo
In reply to Dmitry Eremin-SolenikovAs new locomo driver properly supports SPARSE_IRQ, stop playing with NR_IRQS on sa1100 (locomo was the last chip requiring NR_IRQ tricks).
--- arch/arm/mach-sa1100/include/mach/irqs.h | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
arch/arm/mach-sa1100/include/mach/irqs.h +2 -17
@@ -79,22 +79,7 @@#define IRQ_BOARD_START 61#define IRQ_BOARD_END 77 -/* -* Figure out the MAX IRQ number. -* -* Neponset, SA1111 and UCB1x00 are sparse IRQ aware, so can dynamically -* allocate their IRQs above NR_IRQS. -* -* LoCoMo has 4 additional IRQs, but is not sparse IRQ aware, and so has -* to be included in the NR_IRQS calculation. -*/ -#ifdef CONFIG_SHARP_LOCOMO -#define NR_IRQS_LOCOMO 4 -#else -#define NR_IRQS_LOCOMO 0 -#endif -#ifndef NR_IRQS -#define NR_IRQS (IRQ_BOARD_START + NR_IRQS_LOCOMO) +#define NR_IRQS IRQ_BOARD_START#endif -#define SA1100_NR_IRQS (IRQ_BOARD_START + NR_IRQS_LOCOMO) +#define SA1100_NR_IRQS IRQ_BOARD_START
Signature · 1 line
2.1.4
PATCH v3 15/17 ARM: pxa: poodle: don't preallocate IRQ space for locomo
In reply to Dmitry Eremin-SolenikovAs new locomo driver supports SPARSE_IRQ, don't preallocate NR_IRQS space for it on poodle.
--- arch/arm/mach-pxa/include/mach/poodle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/include/mach/poodle.h +1 -1
@@ -81,7 +81,7 @@#define POODLE_GPIO_L_LCLK (POODLE_SCOOP_GPIO_BASE + 10)#define POODLE_GPIO_HS_OUT (POODLE_SCOOP_GPIO_BASE + 11) -#define POODLE_NR_IRQS (IRQ_BOARD_START + 4)/* 4 for LoCoMo */ +#define POODLE_NR_IRQS IRQ_BOARD_STARTextern struct platform_device poodle_locomo_device;
Signature · 1 line
2.1.4
PATCH v3 16/17 video: backlight: drop old locomo bl/lcd driver
In reply to Dmitry Eremin-SolenikovOld locomolcd driver is now completely obsolete by new locomo_bl and locomo_lcd drivers, so let's drop it.
--- drivers/video/backlight/locomolcd.c | 255 ------------------------------------ 1 file changed, 255 deletions(-) delete mode 100644 drivers/video/backlight/locomolcd.c
drivers/video/backlight/locomolcd.c deleted +0 -255
@@ -1,255 +0,0 @@ -/* -* Backlight control code for Sharp Zaurus SL-5500 -* -* Copyright 2005 John Lenz <[email protected]> -* Maintainer: Pavel Machek <[email protected]> (unless John wants to :-) -* GPL v2 -* -* This driver assumes single CPU. That's okay, because collie is -* slightly old hardware, and no one is going to retrofit second CPU to -* old PDA. -*/ - -/* LCD power functions */ -#include <linux/module.h> -#include <linux/init.h> -#include <linux/delay.h> -#include <linux/device.h> -#include <linux/interrupt.h> -#include <linux/fb.h> -#include <linux/backlight.h> - -#include <asm/hardware/locomo.h> -#include <asm/irq.h> -#include <asm/mach/sharpsl_param.h> -#include <asm/mach-types.h> - -#include "../../../arch/arm/mach-sa1100/generic.h" - -static struct backlight_device *locomolcd_bl_device; -static struct locomo_dev *locomolcd_dev; -static unsigned long locomolcd_flags; -#define LOCOMOLCD_SUSPENDED 0x01 - -static void locomolcd_on (int comadj) -{ -locomo_gpio_set_dir (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VSHA_ON ,0 ); -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VSHA_ON ,1 ); -mdelay (2 ); - -locomo_gpio_set_dir (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VSHD_ON ,0 ); -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VSHD_ON ,1 ); -mdelay (2 ); - -locomo_m62332_senddata (locomolcd_dev, comadj,0 ); -mdelay (5 ); - -locomo_gpio_set_dir (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VEE_ON ,0 ); -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VEE_ON ,1 ); -mdelay (10 ); - -/* TFTCRST | CPSOUT=0 | CPSEN */ -locomo_writel (0x01 , locomolcd_dev->mapbase +LOCOMO_TC ); - -/* Set CPSD */ -locomo_writel (6 , locomolcd_dev->mapbase +LOCOMO_CPSD ); - -/* TFTCRST | CPSOUT=0 | CPSEN */ -locomo_writel ((0x04 |0x01 ), locomolcd_dev->mapbase +LOCOMO_TC ); -mdelay (10 ); - -locomo_gpio_set_dir (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_MOD ,0 ); -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_MOD ,1 ); -} - -static void locomolcd_off (int comadj) -{ -/* TFTCRST=1 | CPSOUT=1 | CPSEN = 0 */ -locomo_writel (0x06 , locomolcd_dev->mapbase +LOCOMO_TC ); -mdelay (1 ); - -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VSHA_ON ,0 ); -mdelay (110 ); - -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VEE_ON ,0 ); -mdelay (700 ); - -/* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */ -locomo_writel (0 , locomolcd_dev->mapbase +LOCOMO_TC ); -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_MOD ,0 ); -locomo_gpio_write (locomolcd_dev->dev.parent,LOCOMO_GPIO_LCD_VSHD_ON ,0 ); -} - -void locomolcd_power (int on) -{ -int comadj = sharpsl_param.comadj; -unsigned long flags; - -local_irq_save (flags); - -if (!locomolcd_dev) { -local_irq_restore (flags); -return ; - } - -/* read comadj */ -if (comadj ==-1 &&machine_is_collie ()) - comadj =128 ; -if (comadj ==-1 &&machine_is_poodle ()) - comadj =118 ; - -if (on) -locomolcd_on (comadj); -else -locomolcd_off (comadj); - -local_irq_restore (flags); -} -EXPORT_SYMBOL (locomolcd_power); - -static int current_intensity; - -static int locomolcd_set_intensity (struct backlight_device *bd) -{ -int intensity = bd->props.brightness; - -if (bd->props.power !=FB_BLANK_UNBLANK ) - intensity =0 ; -if (bd->props.fb_blank !=FB_BLANK_UNBLANK ) - intensity =0 ; -if (locomolcd_flags &LOCOMOLCD_SUSPENDED ) - intensity =0 ; - -switch (intensity) { -/* -* AC and non-AC are handled differently, -* but produce same results in sharp code? -*/ -case 0 : -locomo_frontlight_set (locomolcd_dev,0 ,0 ,161 ); -break ; -case 1 : -locomo_frontlight_set (locomolcd_dev,117 ,0 ,161 ); -break ; -case 2 : -locomo_frontlight_set (locomolcd_dev,163 ,0 ,148 ); -break ; -case 3 : -locomo_frontlight_set (locomolcd_dev,194 ,0 ,161 ); -break ; -case 4 : -locomo_frontlight_set (locomolcd_dev,194 ,1 ,161 ); -break ; -default : -return -ENODEV ; - } - current_intensity = intensity; -return 0 ; -} - -static int locomolcd_get_intensity (struct backlight_device *bd) -{ -return current_intensity; -} - -static const struct backlight_ops locomobl_data = { - .get_brightness = locomolcd_get_intensity, - .update_status = locomolcd_set_intensity, -}; - -#ifdef CONFIG_PM_SLEEP -static int locomolcd_suspend (struct device *dev) -{ - locomolcd_flags |=LOCOMOLCD_SUSPENDED ; -locomolcd_set_intensity (locomolcd_bl_device); -return 0 ; -} - -static int locomolcd_resume (struct device *dev) -{ - locomolcd_flags &= ~LOCOMOLCD_SUSPENDED ; -locomolcd_set_intensity (locomolcd_bl_device); -return 0 ; -} -#endif - -static SIMPLE_DEV_PM_OPS(locomolcd_pm_ops, locomolcd_suspend, locomolcd_resume); - -static int locomolcd_probe (struct locomo_dev *ldev) -{ -struct backlight_properties props; -unsigned long flags; - -local_irq_save (flags); - locomolcd_dev = ldev; - -locomo_gpio_set_dir (ldev->dev.parent,LOCOMO_GPIO_FL_VR ,0 ); - -/* -* the poodle_lcd_power function is called for the first time -* from fs_initcall, which is before locomo is activated. -* We need to recall poodle_lcd_power here -*/ -if (machine_is_poodle ()) -locomolcd_power (1 ); - -local_irq_restore (flags); - -memset (&props,0 ,sizeof (struct backlight_properties )); - props.type =BACKLIGHT_RAW ; - props.max_brightness =4 ; - locomolcd_bl_device =backlight_device_register ("locomo-bl" , - &ldev->dev,NULL , - &locomobl_data, &props); - -if (IS_ERR (locomolcd_bl_device)) -return PTR_ERR (locomolcd_bl_device); - -/* Set up frontlight so that screen is readable */ - locomolcd_bl_device->props.brightness =2 ; -locomolcd_set_intensity (locomolcd_bl_device); - -return 0 ; -} - -static int locomolcd_remove (struct locomo_dev *dev) -{ -unsigned long flags; - - locomolcd_bl_device->props.brightness =0 ; - locomolcd_bl_device->props.power =0 ; -locomolcd_set_intensity (locomolcd_bl_device); - -backlight_device_unregister (locomolcd_bl_device); -local_irq_save (flags); - locomolcd_dev =NULL ; -local_irq_restore (flags); -return 0 ; -} - -static struct locomo_driver poodle_lcd_driver = { - .drv = { - .name ="locomo-backlight" , - .pm = &locomolcd_pm_ops, - }, - .devid =LOCOMO_DEVID_BACKLIGHT , - .probe = locomolcd_probe, - .remove = locomolcd_remove, -}; - -static int __init locomolcd_init (void ) -{ -return locomo_driver_register (&poodle_lcd_driver); -} - -static void __exit locomolcd_exit(void) -{ -locomo_driver_unregister (&poodle_lcd_driver); -} - -module_init (locomolcd_init); -module_exit (locomolcd_exit); - -MODULE_AUTHOR ("John Lenz <[email protected]>, Pavel Machek <[email protected]>" ); -MODULE_DESCRIPTION ("Collie LCD driver" ); -MODULE_LICENSE ("GPL" );
Signature · 1 line
2.1.4