linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] new locomo driver
@ 2014-10-28  0:01 Dmitry Eremin-Solenikov
  2014-10-28  0:01 ` [PATCH 01/15] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
                   ` (10 more replies)
  0 siblings, 11 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Sharp Zaurus SL-5500 and SL-5600 use special companion Gate Array. Current
drivers present in Linux kernel has some problems:

 * It uses custom bus instead of platform bus/mfd core.
 * Device drivers are not well layered/separated.
 * It uses custom gpio accessors instead of using GPIOLIB.

With this patchset I tried to modernise and restructure the LoCoMo driver.
Also I added an experimental SPI driver that will be used by mmc-spi on
Sharp SL-5500 collie devices.

----------------------------------------------------------------
Dmitry Eremin-Solenikov (15):
      mfd: add new driver for Sharp LoCoMo
      GPIO: port LoCoMo gpio support from old driver
      leds: port locomo leds driver to new locomo core
      input: convert LoCoMo keyboard driver to use new locomo core
      video: backlight: add new locomo backlight driver
      video: lcd: add LoCoMo LCD driver
      video: backlight: drop old locomo bl/lcd driver
      ARM: sa1100: make collie use new locomo drivers
      ARM: sa1100: don't preallocate IRQ space for locomo
      ARM: pxa: poodle: use new LoCoMo driver
      sound: soc: poodle: make use of new locomo GPIO interface
      ARM: pxa: poodle: don't preallocate IRQ space for locomo
      ARM: drop old LoCoMo driver
      gpio: locomo: implement per-pin irq handling
      spi: add locomo SPI driver

 arch/arm/common/Kconfig                            |   3 -
 arch/arm/common/Makefile                           |   1 -
 arch/arm/common/locomo.c                           | 914 ---------------------
 arch/arm/mach-pxa/Kconfig                          |   1 -
 arch/arm/mach-pxa/include/mach/poodle.h            |  16 +-
 arch/arm/mach-pxa/poodle.c                         |  23 +-
 arch/arm/mach-sa1100/Kconfig                       |   1 -
 arch/arm/mach-sa1100/collie.c                      | 112 +--
 arch/arm/mach-sa1100/include/mach/collie.h         |  25 +-
 arch/arm/mach-sa1100/include/mach/irqs.h           |  19 +-
 drivers/gpio/Kconfig                               |   7 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-locomo.c                         | 386 +++++++++
 drivers/input/keyboard/Kconfig                     |   1 -
 drivers/input/keyboard/locomokbd.c                 | 165 ++--
 drivers/leds/Kconfig                               |   1 -
 drivers/leds/leds-locomo.c                         | 104 ++-
 drivers/mfd/Kconfig                                |   8 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/locomo.c                               | 644 +++++++++++++++
 drivers/spi/Kconfig                                |   8 +
 drivers/spi/Makefile                               |   1 +
 drivers/spi/spi-locomo.c                           | 370 +++++++++
 drivers/video/backlight/Kconfig                    |  14 +-
 drivers/video/backlight/Makefile                   |   3 +-
 drivers/video/backlight/locomo_bl.c                | 171 ++++
 drivers/video/backlight/locomo_lcd.c               | 224 +++++
 drivers/video/backlight/locomolcd.c                | 255 ------
 .../asm/hardware => include/linux/mfd}/locomo.h    | 148 ++--
 sound/soc/pxa/poodle.c                             |  51 +-
 30 files changed, 2185 insertions(+), 1493 deletions(-)
 delete mode 100644 arch/arm/common/locomo.c
 create mode 100644 drivers/gpio/gpio-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
 rename {arch/arm/include/asm/hardware => include/linux/mfd}/locomo.h (55%)

^ permalink raw reply	[flat|nested] 54+ messages in thread

* [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:01 ` Dmitry Eremin-Solenikov
       [not found]   ` <1414454528-24240-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-10-28  0:01 ` [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

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 <dbaryshkov@gmail.com>
---
 drivers/mfd/Kconfig        |   8 +
 drivers/mfd/Makefile       |   1 +
 drivers/mfd/locomo.c       | 644 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/locomo.h | 171 ++++++++++++
 4 files changed, 824 insertions(+)
 create mode 100644 drivers/mfd/locomo.c
 create mode 100644 include/linux/mfd/locomo.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1456ea7..1824a12 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1318,6 +1318,14 @@ 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
+	help
+	  Support for Sharp LoCoMo Grid Array found in Sharp SL-5x00
+          PDA family.
+
 menu "Multimedia Capabilities Port drivers"
 	depends on ARCH_SA1100
 
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 8bd54b1..a4ea8de 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -174,6 +174,7 @@ obj-$(CONFIG_MFD_STW481X)	+= stw481x.o
 obj-$(CONFIG_MFD_IPAQ_MICRO)	+= ipaq-micro.o
 obj-$(CONFIG_MFD_MENF21BMC)	+= menf21bmc.o
 obj-$(CONFIG_MFD_HI6421_PMIC)	+= hi6421-pmic-core.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
diff --git a/drivers/mfd/locomo.c b/drivers/mfd/locomo.c
new file mode 100644
index 0000000..16b0208
--- /dev/null
+++ b/drivers/mfd/locomo.c
@@ -0,0 +1,644 @@
+/*
+ * Sharp LoCoMo support
+ *
+ * Based on old driver at arch/arm/common/locomo.c
+ *
+ * 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/module.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/core.h>
+#include <linux/mfd/locomo.h>
+
+/* 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 */
+struct locomo {
+	unsigned int irq;
+	int irq_base;
+	spinlock_t lock;
+	void __iomem *base;
+
+	bool	has_amp_control;
+	int	gpio_amp1_on;
+	int	gpio_amp2_on;
+
+#ifdef CONFIG_PM_SLEEP
+	u16	LCM_ASD;
+#endif
+};
+
+static struct gpio locomo_amp_gpios[] = {
+	{ 0, GPIOF_OUT_INIT_LOW, "AMP1 ON" },
+	{ 0, GPIOF_OUT_INIT_LOW, "AMP2 ON" },
+};
+
+static struct resource locomo_kbd_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_KEYBOARD, 0x10),
+	DEFINE_RES_IRQ(IRQ_LOCOMO_KEY),
+};
+
+static struct resource locomo_gpio_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_GPIO, 0x28),
+	DEFINE_RES_IRQ(IRQ_LOCOMO_GPIO),
+};
+
+static struct resource locomo_lt_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_LTC, 0x8),
+	DEFINE_RES_IRQ(IRQ_LOCOMO_LT),
+};
+
+static struct resource locomo_spi_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_SPI, 0x30),
+	DEFINE_RES_IRQ(IRQ_LOCOMO_SPI),
+};
+
+static struct resource locomo_led_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_LED, 0x8),
+};
+
+static struct resource locomo_backlight_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_FRONTLIGHT, 0x08),
+};
+
+static struct resource locomo_lcd_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_TFT, 0x08),
+};
+
+static struct resource locomo_audio_resources[] = {
+	DEFINE_RES_MEM(LOCOMO_AUDIO, 0x04),
+	DEFINE_RES_MEM(LOCOMO_PAIF, 0x04),
+};
+
+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),
+	},
+	{
+		.name = "locomo-lt", /* Long time timer */
+		.resources = locomo_lt_resources,
+		.num_resources = ARRAY_SIZE(locomo_lt_resources),
+	},
+	{
+		.name = "locomo-spi",
+		.resources = locomo_spi_resources,
+		.num_resources = ARRAY_SIZE(locomo_spi_resources),
+	},
+	{
+		.name = "locomo-led",
+		.resources = locomo_led_resources,
+		.num_resources = ARRAY_SIZE(locomo_led_resources),
+	},
+	{
+		.name = "locomo-backlight",
+		.resources = locomo_backlight_resources,
+		.num_resources = ARRAY_SIZE(locomo_backlight_resources),
+	},
+	{
+		.name = "locomo-lcd",
+		.resources = locomo_lcd_resources,
+		.num_resources = ARRAY_SIZE(locomo_lcd_resources),
+	},
+	{
+		.name = "locomo-audio",
+		.resources = locomo_audio_resources,
+		.num_resources = ARRAY_SIZE(locomo_audio_resources),
+	},
+};
+
+/* DAC send data */
+#define	M62332_SLAVE_ADDR	0x4e	/* Slave address  */
+#define	M62332_W_BIT		0x00	/* W bit (0 only) */
+#define	M62332_SUB_ADDR		0x00	/* Sub address    */
+#define	M62332_A_BIT		0x00	/* A bit (0 only) */
+
+/* DAC setup and hold times (expressed in us) */
+#define DAC_BUS_FREE_TIME	5	/*   4.7 us */
+#define DAC_START_SETUP_TIME	5	/*   4.7 us */
+#define DAC_STOP_SETUP_TIME	4	/*   4.0 us */
+#define DAC_START_HOLD_TIME	5	/*   4.7 us */
+#define DAC_SCL_LOW_HOLD_TIME	5	/*   4.7 us */
+#define DAC_SCL_HIGH_HOLD_TIME	4	/*   4.0 us */
+#define DAC_DATA_SETUP_TIME	1	/*   250 ns */
+#define DAC_DATA_HOLD_TIME	1	/*   300 ns */
+#define DAC_LOW_SETUP_TIME	1	/*   300 ns */
+#define DAC_HIGH_SETUP_TIME	1	/*  1000 ns */
+
+/* I2C dedicated to external DAC */
+static void locomo_m62332_sendbit(struct locomo *lchip, int bit)
+{
+	u16 r;
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_DATA_HOLD_TIME);	/* 300 nsec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+
+	if (bit & 1) {
+		r = readw(lchip->base + LOCOMO_DAC);
+		r |=  LOCOMO_DAC_SDAOEB;
+		writew(r, lchip->base + LOCOMO_DAC);
+
+		udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	} else {
+		r = readw(lchip->base + LOCOMO_DAC);
+		r &=  ~(LOCOMO_DAC_SDAOEB);
+		writew(r, lchip->base + LOCOMO_DAC);
+
+		udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	}
+	udelay(DAC_DATA_SETUP_TIME);	/* 250 nsec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/*  4.0 usec */
+}
+
+/* Start */
+static void locomo_m62332_start(struct locomo *lchip)
+{
+	u16 r;
+
+	udelay(DAC_BUS_FREE_TIME);	/* 5.0 usec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.0 usec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_START_HOLD_TIME);	/* 5.0 usec */
+	udelay(DAC_DATA_HOLD_TIME);	/* 300 nsec */
+
+}
+
+/* Check A bit */
+static int locomo_m62332_check_a(struct locomo *lchip)
+{
+	u16 r;
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
+
+	return readw(lchip->base + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB;
+}
+
+/* Stop */
+static void locomo_m62332_stop(struct locomo *lchip)
+{
+	u16 r;
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4 usec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SDAOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4 usec */
+
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	udelay(DAC_LOW_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+}
+
+void locomo_m62332_senddata(struct device *dev, unsigned int dac_data,
+		int channel)
+{
+	struct locomo *lchip = dev_get_drvdata(dev);
+	int i;
+	unsigned char data;
+	unsigned long flags;
+
+	/* This works for now */
+	if (lchip->has_amp_control && dac_data) {
+		gpio_set_value(lchip->gpio_amp1_on, 1);
+		gpio_set_value(lchip->gpio_amp2_on, 1);
+		mdelay(5);
+	}
+
+	spin_lock_irqsave(&lchip->lock, flags);
+
+	locomo_m62332_start(lchip);
+
+	/* Send slave address and W bit (LSB is W bit) */
+	data = (M62332_SLAVE_ADDR << 1) | M62332_W_BIT;
+	for (i = 1; i <= 8; i++)
+		locomo_m62332_sendbit(lchip, data >> (8 - i));
+
+	if (locomo_m62332_check_a(lchip)) {	/* High is error */
+		dev_warn(dev, "locomo: m62332_senddata Error 1\n");
+		goto out;
+	}
+
+	/* Send Sub address (LSB is channel select) */
+	/*    channel = 0 : ch1 select              */
+	/*            = 1 : ch2 select              */
+	data = M62332_SUB_ADDR + channel;
+	for (i = 1; i <= 8; i++)
+		locomo_m62332_sendbit(lchip, data >> (8 - i));
+
+	if (locomo_m62332_check_a(lchip)) {	/* High is error */
+		dev_warn(dev, "locomo: m62332_senddata Error 2\n");
+		goto out;
+	}
+
+	/* Send DAC data */
+	for (i = 1; i <= 8; i++)
+		locomo_m62332_sendbit(lchip, dac_data >> (8 - i));
+
+	if (locomo_m62332_check_a(lchip)) {	/* High is error */
+		dev_warn(dev, "locomo: m62332_senddata Error 3\n");
+		goto out;
+	}
+
+out:
+	locomo_m62332_stop(lchip);
+
+	spin_unlock_irqrestore(&lchip->lock, flags);
+
+	/* This works for now */
+	if (lchip->has_amp_control && !dac_data) {
+		mdelay(5);
+		gpio_set_value(lchip->gpio_amp1_on, 0);
+		gpio_set_value(lchip->gpio_amp2_on, 0);
+	}
+
+}
+EXPORT_SYMBOL(locomo_m62332_senddata);
+
+/* IRQ support */
+static void locomo_handler(unsigned int irq, struct irq_desc *desc)
+{
+	struct locomo *lchip = irq_get_handler_data(irq);
+	int req, i;
+
+	/* Acknowledge the parent IRQ */
+	desc->irq_data.chip->irq_ack(&desc->irq_data);
+
+	/* check why this interrupt was generated */
+	req = readw(lchip->base + LOCOMO_ICR) & 0x0f00;
+
+	if (req) {
+		/* generate the next interrupt(s) */
+		irq = lchip->irq_base;
+		for (i = 0; i <= 3; i++, irq++) {
+			if (req & (0x0100 << i))
+				generic_handle_irq(irq);
+
+		}
+	}
+}
+
+static void locomo_ack_irq(struct irq_data *d)
+{
+}
+
+static void locomo_mask_irq(struct irq_data *d)
+{
+	struct locomo *lchip = irq_data_get_irq_chip_data(d);
+	unsigned int r;
+
+	r = readw(lchip->base + LOCOMO_ICR);
+	r &= ~(0x0010 << (d->irq - lchip->irq_base));
+	writew(r, lchip->base + LOCOMO_ICR);
+}
+
+static void locomo_unmask_irq(struct irq_data *d)
+{
+	struct locomo *lchip = irq_data_get_irq_chip_data(d);
+	unsigned int r;
+
+	r = readw(lchip->base + LOCOMO_ICR);
+	r |= (0x0010 << (d->irq - lchip->irq_base));
+	writew(r, lchip->base + LOCOMO_ICR);
+}
+
+static struct irq_chip locomo_chip = {
+	.name		= "LOCOMO",
+	.irq_ack	= locomo_ack_irq,
+	.irq_mask	= locomo_mask_irq,
+	.irq_unmask	= locomo_unmask_irq,
+};
+
+static void locomo_setup_irq(struct locomo *lchip)
+{
+	int irq;
+
+	lchip->irq_base = irq_alloc_descs(-1, 0, LOCOMO_NR_IRQS, -1);
+
+	/* Install handlers for IRQ_LOCOMO_* */
+	for (irq = lchip->irq_base;
+			irq < lchip->irq_base + LOCOMO_NR_IRQS;
+			irq++) {
+		irq_set_chip_and_handler(irq, &locomo_chip, handle_level_irq);
+		irq_set_chip_data(irq, lchip);
+		set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+	}
+
+	/*
+	 * Install handler for IRQ_LOCOMO_HW.
+	 */
+	irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);
+	irq_set_handler_data(lchip->irq, lchip);
+	irq_set_chained_handler(lchip->irq, locomo_handler);
+}
+
+
+#ifdef CONFIG_PM_SLEEP
+static int locomo_suspend(struct device *dev)
+{
+	struct locomo *lchip = dev_get_drvdata(dev);
+	unsigned long flags;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+
+	/* ADSTART */
+	lchip->LCM_ASD = readw(lchip->base + LOCOMO_ASD);	/* ADSTART */
+	writew(0x00, lchip->base + LOCOMO_ASD);
+
+	/* AUDIO */
+	writew(0x00, lchip->base + LOCOMO_PAIF);
+	writew(0x00, lchip->base + LOCOMO_DAC);
+
+	if ((readw(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) &&
+	    (readw(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88))
+		/* CLK32 off */
+		writew(0x00, lchip->base + LOCOMO_C32K);
+	else
+		/* 18MHz already enabled, so no wait */
+		/* CLK32 on */
+		writew(0xc1, lchip->base + LOCOMO_C32K);
+
+	/* 18MHz clock off*/
+	writew(0x00, lchip->base + LOCOMO_TADC);
+	/* 22MHz/24MHz clock off */
+	writew(0x00, lchip->base + LOCOMO_AUDIO + LOCOMO_ACC);
+
+	spin_unlock_irqrestore(&lchip->lock, flags);
+
+	return 0;
+}
+
+static int locomo_resume(struct device *dev)
+{
+	struct locomo *lchip = dev_get_drvdata(dev);
+	unsigned long flags;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+
+	writew(lchip->LCM_ASD, lchip->base + LOCOMO_ASD);
+
+	writew(0x00, lchip->base + LOCOMO_C32K);
+	writew(0x90, lchip->base + LOCOMO_TADC);
+
+	spin_unlock_irqrestore(&lchip->lock, flags);
+
+	return 0;
+}
+static SIMPLE_DEV_PM_OPS(locomo_pm, locomo_suspend, locomo_resume);
+#define LOCOMO_PM	(&locomo_pm)
+#else
+#define LOCOMO_PM	NULL
+#endif
+
+static int locomo_probe(struct platform_device *dev)
+{
+	struct locomo_platform_data *pdata = dev_get_platdata(&dev->dev);
+	struct resource *mem;
+	int irq;
+	struct locomo *lchip;
+	unsigned long r;
+	int ret = -ENODEV;
+
+	mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
+	if (!mem)
+		return -EINVAL;
+	irq = platform_get_irq(dev, 0);
+	if (irq < 0)
+		return -ENXIO;
+
+	lchip = devm_kzalloc(&dev->dev, sizeof(struct locomo), GFP_KERNEL);
+	if (!lchip)
+		return -ENOMEM;
+
+	spin_lock_init(&lchip->lock);
+
+	/*
+	 * Map the whole region.  This also maps the
+	 * registers for our children.
+	 */
+	lchip->base = devm_ioremap(&dev->dev, mem->start, resource_size(mem));
+	if (!lchip->base)
+		return -ENOMEM;
+
+	lchip->irq = irq;
+	platform_set_drvdata(dev, lchip);
+
+	if (pdata) {
+		locomo_cells[1].platform_data = &pdata->gpio_data;
+		locomo_cells[1].pdata_size =
+			sizeof(struct locomo_gpio_platform_data);
+		locomo_cells[5].platform_data = &pdata->bl_data;
+		locomo_cells[5].pdata_size =
+			sizeof(struct locomo_bl_platform_data);
+		locomo_cells[6].platform_data = &pdata->lcd_data;
+		locomo_cells[6].pdata_size =
+			sizeof(struct locomo_lcd_platform_data);
+
+		lchip->gpio_amp1_on = pdata->gpio_amp1_on;
+		lchip->gpio_amp2_on = pdata->gpio_amp2_on;
+	}
+
+	if (gpio_is_valid(lchip->gpio_amp1_on) &&
+			gpio_is_valid(lchip->gpio_amp2_on)) {
+		lchip->has_amp_control = true;
+		locomo_amp_gpios[0].gpio = lchip->gpio_amp1_on;
+		locomo_amp_gpios[1].gpio = lchip->gpio_amp2_on;
+		ret = gpio_request_array(locomo_amp_gpios,
+				ARRAY_SIZE(locomo_amp_gpios));
+		if (ret)
+			return ret;
+	}
+
+	/* locomo initialize */
+	writew(0, lchip->base + LOCOMO_ICR);
+
+	/* Longtime timer */
+	writew(0, lchip->base + LOCOMO_LTINT);
+	/* SPI */
+	writew(0, lchip->base + LOCOMO_SPI + LOCOMO_SPIIE);
+
+	writew(6 + 8 + 320 + 30 - 10, lchip->base + LOCOMO_ASD);
+	r = readw(lchip->base + LOCOMO_ASD);
+	r |= 0x8000;
+	writew(r, lchip->base + LOCOMO_ASD);
+
+	writew(6 + 8 + 320 + 30 - 10 - 128 + 4, lchip->base + LOCOMO_HSD);
+	r = readw(lchip->base + LOCOMO_HSD);
+	r |= 0x8000;
+	writew(r, lchip->base + LOCOMO_HSD);
+
+	writew(128 / 8, lchip->base + LOCOMO_HSC);
+
+	/* XON */
+	writew(0x80, lchip->base + LOCOMO_TADC);
+	udelay(1000);
+	/* CLK9MEN */
+	r = readw(lchip->base + LOCOMO_TADC);
+	r |= 0x10;
+	writew(r, lchip->base + LOCOMO_TADC);
+	udelay(100);
+
+	/* init DAC */
+	r = readw(lchip->base + LOCOMO_DAC);
+	r |= LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
+	writew(r, lchip->base + LOCOMO_DAC);
+
+	r = readw(lchip->base + LOCOMO_VER);
+	dev_info(&dev->dev, "LoCoMo Chip: %lu%lu\n", (r >> 8), (r & 0xff));
+
+	/*
+	 * The interrupt controller must be initialised before any
+	 * other device to ensure that the interrupts are available.
+	 */
+	if (lchip->irq != NO_IRQ)
+		locomo_setup_irq(lchip);
+
+	ret = mfd_add_devices(&dev->dev, dev->id,
+			locomo_cells, ARRAY_SIZE(locomo_cells),
+			mem, lchip->irq_base, NULL);
+	if (ret)
+		goto err_add;
+
+	return 0;
+
+err_add:
+	if (lchip->irq != NO_IRQ) {
+		irq_set_chained_handler(lchip->irq, NULL);
+		irq_set_handler_data(lchip->irq, NULL);
+		irq_free_descs(lchip->irq_base, LOCOMO_NR_IRQS);
+	}
+
+	if (lchip->has_amp_control)
+		gpio_free_array(locomo_amp_gpios,
+					ARRAY_SIZE(locomo_amp_gpios));
+	platform_set_drvdata(dev, NULL);
+
+	return ret;
+}
+
+static int locomo_remove(struct platform_device *dev)
+{
+	struct locomo *lchip = platform_get_drvdata(dev);
+
+	if (!lchip)
+		return 0;
+
+	mfd_remove_devices(&dev->dev);
+
+	if (lchip->irq != NO_IRQ) {
+		irq_set_chained_handler(lchip->irq, NULL);
+		irq_set_handler_data(lchip->irq, NULL);
+		irq_free_descs(lchip->irq_base, LOCOMO_NR_IRQS);
+	}
+
+	if (lchip->has_amp_control)
+		gpio_free_array(locomo_amp_gpios,
+					ARRAY_SIZE(locomo_amp_gpios));
+	platform_set_drvdata(dev, NULL);
+
+	return 0;
+}
+
+static struct platform_driver locomo_device_driver = {
+	.probe		= locomo_probe,
+	.remove		= locomo_remove,
+	.driver		= {
+		.name	= "locomo",
+		.owner	= THIS_MODULE,
+		.pm	= LOCOMO_PM,
+	},
+};
+
+module_platform_driver(locomo_device_driver);
+
+MODULE_DESCRIPTION("Sharp LoCoMo core driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>");
+MODULE_ALIAS("platform:locomo");
diff --git a/include/linux/mfd/locomo.h b/include/linux/mfd/locomo.h
new file mode 100644
index 0000000..1f54300
--- /dev/null
+++ b/include/linux/mfd/locomo.h
@@ -0,0 +1,171 @@
+/*
+ * include/linux/mfd/locomo.h
+ *
+ * This file contains the definitions for the LoCoMo G/A Chip
+ *
+ * (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 version */
+#define LOCOMO_VER	0x00
+
+/* Pin status */
+#define LOCOMO_ST	0x04
+
+/* Pin status */
+#define LOCOMO_C32K	0x08
+
+/* Interrupt controller */
+#define LOCOMO_ICR	0x0C
+
+/* MCS decoder for boot selecting */
+#define LOCOMO_MCSX0	0x10
+#define LOCOMO_MCSX1	0x14
+#define LOCOMO_MCSX2	0x18
+#define LOCOMO_MCSX3	0x1c
+
+/* 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 */
+
+
+/* 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       */
+
+/* SPI interface */
+#define LOCOMO_SPI	0x60
+#define LOCOMO_SPIMD	0x00		/* SPI mode setting */
+#define LOCOMO_SPICT	0x04		/* SPI mode control */
+#define LOCOMO_SPIST	0x08		/* SPI status */
+#define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */
+#define	LOCOMO_SPI_REND	(1 << 2)	/* Receive end bit */
+#define	LOCOMO_SPI_RFW	(1 << 1)	/* write buffer bit */
+#define	LOCOMO_SPI_RFR	(1)		/* read buffer bit */
+
+#define LOCOMO_SPIIS	0x10		/* SPI interrupt status */
+#define LOCOMO_SPIWE	0x14		/* SPI interrupt status write enable */
+#define LOCOMO_SPIIE	0x18		/* SPI interrupt enable */
+#define LOCOMO_SPIIR	0x1c		/* SPI interrupt request */
+#define LOCOMO_SPITD	0x20		/* SPI transfer data write */
+#define LOCOMO_SPIRD	0x24		/* SPI receive data read */
+#define LOCOMO_SPITS	0x28		/* SPI transfer data shift */
+#define LOCOMO_SPIRS	0x2C		/* SPI receive data shift */
+
+/* GPIO */
+#define LOCOMO_GPIO		0x90
+#define LOCOMO_GPD		0x00	/* GPIO direction */
+#define LOCOMO_GPE		0x04	/* GPIO input enable */
+#define LOCOMO_GPL		0x08	/* GPIO level */
+#define LOCOMO_GPO		0x0c	/* GPIO out data setting */
+#define LOCOMO_GRIE		0x10	/* GPIO rise detection */
+#define LOCOMO_GFIE		0x14	/* GPIO fall detection */
+#define LOCOMO_GIS		0x18	/* GPIO edge detection status */
+#define LOCOMO_GWE		0x1c	/* GPIO status write enable */
+#define LOCOMO_GIE		0x20	/* GPIO interrupt enable */
+#define LOCOMO_GIR		0x24	/* GPIO interrupt request */
+
+/* Start the definitions of the devices.  Each device has an initial
+ * base address and a series of offsets from that base address. */
+
+/* Keyboard controller */
+#define LOCOMO_KEYBOARD		0x40
+#define LOCOMO_KIB		0x00	/* KIB level */
+#define LOCOMO_KSC		0x04	/* KSTRB control */
+#define LOCOMO_KCMD		0x08	/* KSTRB command */
+#define LOCOMO_KIC		0x0c	/* Key interrupt */
+
+/* Front light adjustment controller */
+#define LOCOMO_FRONTLIGHT	0xc8
+#define LOCOMO_ALS		0x00	/* Adjust light cycle */
+#define LOCOMO_ALD		0x04	/* Adjust light duty */
+
+#define LOCOMO_ALC_EN		0x8000
+
+/* Backlight controller: TFT signal */
+#define LOCOMO_TFT		0x38
+#define LOCOMO_TC		0x00		/* TFT control signal */
+#define LOCOMO_CPSD		0x04		/* CPS delay */
+
+/* Audio controller */
+#define LOCOMO_AUDIO		0x54
+#define LOCOMO_ACC		0x00	/* Audio clock */
+#define LOCOMO_PAIF		0xD0	/* PCM audio interface */
+/* 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 */
+/* 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
+
+/* LED controller */
+#define LOCOMO_LED		0xe8
+#define LOCOMO_LPT0		0x00
+#define LOCOMO_LPT1		0x04
+/* LED control */
+#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;
+	int gpio_lcd_vsha_on;
+	int gpio_lcd_vshd_on;
+	int gpio_lcd_vee_on;
+	int gpio_lcd_mod;
+};
+
+struct locomo_bl_platform_data {
+	int gpio_fl_vr;
+};
+
+struct locomo_platform_data {
+	struct locomo_gpio_platform_data gpio_data;
+	struct locomo_lcd_platform_data lcd_data;
+	struct locomo_bl_platform_data bl_data;
+
+	int gpio_amp1_on;
+	int gpio_amp2_on;
+};
+
+/* Send data to i2c DAC connected to LoCoMo i2c bus */
+extern void locomo_m62332_senddata(struct device *dev, unsigned int dac_data,
+		int channel);
+
+#endif
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
  2014-10-28  0:01 ` [PATCH 01/15] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
@ 2014-10-28  0:01 ` Dmitry Eremin-Solenikov
  2014-10-31  7:48   ` Linus Walleij
  2014-10-28  0:01 ` [PATCH 03/15] leds: port locomo leds driver to new locomo core Dmitry Eremin-Solenikov
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Add gpiolib driver for gpio pins placed on the LoCoMo GA.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/gpio/Kconfig       |   7 ++
 drivers/gpio/Makefile      |   1 +
 drivers/gpio/gpio-locomo.c | 228 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 236 insertions(+)
 create mode 100644 drivers/gpio/gpio-locomo.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 0959ca9..11c03d4 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -457,6 +457,13 @@ config GPIO_TB10X
 	select GENERIC_IRQ_CHIP
 	select OF_GPIO
 
+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.
+
 comment "I2C GPIO expanders:"
 
 config GPIO_ARIZONA
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index e5d346c..ed73f63 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -39,6 +39,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_LP3943)	+= gpio-lp3943.o
 obj-$(CONFIG_ARCH_LPC32XX)	+= gpio-lpc32xx.o
 obj-$(CONFIG_GPIO_LYNXPOINT)	+= gpio-lynxpoint.o
diff --git a/drivers/gpio/gpio-locomo.c b/drivers/gpio/gpio-locomo.c
new file mode 100644
index 0000000..3b54b07
--- /dev/null
+++ b/drivers/gpio/gpio-locomo.c
@@ -0,0 +1,228 @@
+/*
+ * Sharp LoCoMo support for GPIO
+ *
+ * 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/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+#include <linux/spinlock.h>
+#include <linux/mfd/locomo.h>
+
+struct locomo_gpio {
+	void __iomem *regs;
+
+	spinlock_t lock;
+	struct gpio_chip gpio;
+
+	u16 rising_edge;
+	u16 falling_edge;
+
+	u16 save_gpo;
+	u16 save_gpe;
+};
+
+static int locomo_gpio_get(struct gpio_chip *chip,
+		unsigned offset)
+{
+	struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+
+	return readw(lg->regs + LOCOMO_GPL) & (1 << offset);
+}
+
+static void __locomo_gpio_set(struct gpio_chip *chip,
+		unsigned offset, int value)
+{
+	struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+	u16  r;
+
+	r = readw(lg->regs + LOCOMO_GPO);
+	if (value)
+		r |= 1 << offset;
+	else
+		r &= ~(1 << offset);
+	writew(r, lg->regs + LOCOMO_GPO);
+}
+
+static void locomo_gpio_set(struct gpio_chip *chip,
+		unsigned offset, int value)
+{
+	struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+	unsigned long flags;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	__locomo_gpio_set(chip, offset, value);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+}
+
+static int locomo_gpio_direction_input(struct gpio_chip *chip,
+			unsigned offset)
+{
+	struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+	unsigned long flags;
+	u16 r;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	r = readw(lg->regs + LOCOMO_GPD);
+	r |= (1 << offset);
+	writew(r, lg->regs + LOCOMO_GPD);
+
+	r = readw(lg->regs + LOCOMO_GPE);
+	r |= (1 << offset);
+	writew(r, lg->regs + LOCOMO_GPE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+
+	return 0;
+}
+
+static int locomo_gpio_direction_output(struct gpio_chip *chip,
+			unsigned offset, int value)
+{
+	struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+	unsigned long flags;
+	u16 r;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	__locomo_gpio_set(chip, offset, value);
+
+	r = readw(lg->regs + LOCOMO_GPD);
+	r &= ~(1 << offset);
+	writew(r, lg->regs + LOCOMO_GPD);
+
+	r = readw(lg->regs + LOCOMO_GPE);
+	r &= ~(1 << offset);
+	writew(r, lg->regs + LOCOMO_GPE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int locomo_gpio_suspend(struct device *dev)
+{
+	struct locomo_gpio *lg = dev_get_drvdata(dev);
+	unsigned long flags;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	lg->save_gpo = readw(lg->regs + LOCOMO_GPO);
+	writew(0x00, lg->regs + LOCOMO_GPO);
+
+	lg->save_gpo = readw(lg->regs + LOCOMO_GPE);
+	writew(0x00, lg->regs + LOCOMO_GPE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+	return 0;
+}
+
+static int locomo_gpio_resume(struct device *dev)
+{
+	struct locomo_gpio *lg = dev_get_drvdata(dev);
+	unsigned long flags;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	writew(lg->save_gpo, lg->regs + LOCOMO_GPO);
+
+	writew(lg->save_gpe, lg->regs + LOCOMO_GPE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+	return 0;
+}
+static SIMPLE_DEV_PM_OPS(locomo_gpio_pm,
+		locomo_gpio_suspend, locomo_gpio_resume);
+#define LOCOMO_GPIO_PM	(&locomo_gpio_pm)
+#else
+#define LOCOMO_GPIO_PM	NULL
+#endif
+
+static int locomo_gpio_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	struct locomo_gpio *lg;
+	int ret;
+	struct locomo_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	lg = devm_kzalloc(&pdev->dev, sizeof(struct locomo_gpio),
+			GFP_KERNEL);
+	if (!lg)
+		return -ENOMEM;
+
+	lg->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(lg->regs))
+		return PTR_ERR(lg->regs);
+
+	spin_lock_init(&lg->lock);
+
+	platform_set_drvdata(pdev, lg);
+
+	writew(0, lg->regs + LOCOMO_GPO);
+	writew(0, lg->regs + LOCOMO_GPE);
+	writew(0, lg->regs + LOCOMO_GPD);
+	writew(0, lg->regs + LOCOMO_GIE);
+
+	lg->gpio.base = pdata ? pdata->gpio_base : -1;
+	lg->gpio.label = "locomo-gpio";
+	lg->gpio.ngpio = 16;
+	lg->gpio.set = locomo_gpio_set;
+	lg->gpio.get = locomo_gpio_get;
+	lg->gpio.direction_input = locomo_gpio_direction_input;
+	lg->gpio.direction_output = locomo_gpio_direction_output;
+
+	ret = gpiochip_add(&lg->gpio);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int locomo_gpio_remove(struct platform_device *pdev)
+{
+	struct locomo_gpio *lg = platform_get_drvdata(pdev);
+	int ret;
+
+	ret = gpiochip_remove(&lg->gpio);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't remove gpio chip: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static struct platform_driver locomo_gpio_driver = {
+	.probe		= locomo_gpio_probe,
+	.remove		= locomo_gpio_remove,
+	.driver		= {
+		.name	= "locomo-gpio",
+		.owner	= THIS_MODULE,
+		.pm	= LOCOMO_GPIO_PM,
+	},
+};
+module_platform_driver(locomo_gpio_driver);
+
+MODULE_DESCRIPTION("Sharp LoCoMo GPIO driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>");
+MODULE_ALIAS("platform:locomo-gpio");
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 03/15] leds: port locomo leds driver to new locomo core
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
  2014-10-28  0:01 ` [PATCH 01/15] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
  2014-10-28  0:01 ` [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:01 ` Dmitry Eremin-Solenikov
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Adapt locomo leds driver to new locomo core setup.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/leds/Kconfig       |   1 -
 drivers/leds/leds-locomo.c | 104 +++++++++++++++++++++++++++------------------
 2 files changed, 62 insertions(+), 43 deletions(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index a210338..22ebf1c 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -69,7 +69,6 @@ config LEDS_LM3642
 config LEDS_LOCOMO
 	tristate "LED Support for Locomo device"
 	depends on LEDS_CLASS
-	depends on SHARP_LOCOMO
 	help
 	  This option enables support for the LEDs on Sharp Locomo.
 	  Zaurus models SL-5500 and SL-5600.
diff --git a/drivers/leds/leds-locomo.c b/drivers/leds/leds-locomo.c
index 80ba048..acb288f 100644
--- a/drivers/leds/leds-locomo.c
+++ b/drivers/leds/leds-locomo.c
@@ -11,87 +11,107 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/leds.h>
+#include <linux/io.h>
+#include <linux/err.h>
+#include <linux/mfd/locomo.h>
 
-#include <mach/hardware.h>
-#include <asm/hardware/locomo.h>
+struct locomo_led {
+	struct led_classdev led;
+	void __iomem *reg;
+};
 
 static void locomoled_brightness_set(struct led_classdev *led_cdev,
-				enum led_brightness value, int offset)
+				enum led_brightness value)
 {
-	struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev->parent);
+	struct locomo_led *led = container_of(led_cdev, struct locomo_led, led);
 	unsigned long flags;
 
 	local_irq_save(flags);
 	if (value)
-		locomo_writel(LOCOMO_LPT_TOFH, locomo_dev->mapbase + offset);
+		writew(LOCOMO_LPT_TOFH, led->reg);
 	else
-		locomo_writel(LOCOMO_LPT_TOFL, locomo_dev->mapbase + offset);
+		writew(LOCOMO_LPT_TOFL, led->reg);
 	local_irq_restore(flags);
 }
 
-static void locomoled_brightness_set0(struct led_classdev *led_cdev,
-				enum led_brightness value)
+static int locomo_led_register(
+		struct locomo_led *led,
+		struct device *dev,
+		const char *name,
+		const char *trigger,
+		void __iomem *reg)
 {
-	locomoled_brightness_set(led_cdev, value, LOCOMO_LPT0);
+	led->led.name = name;
+	led->led.default_trigger = trigger;
+	led->led.brightness_set = locomoled_brightness_set;
+	led->reg = reg;
+
+	return led_classdev_register(dev, &led->led);
 }
 
-static void locomoled_brightness_set1(struct led_classdev *led_cdev,
-				enum led_brightness value)
+static int locomoled_probe(struct platform_device *pdev)
 {
-	locomoled_brightness_set(led_cdev, value, LOCOMO_LPT1);
-}
+	int ret;
+	struct resource *mem;
+	void __iomem *regs;
+	struct locomo_led *leds;
 
-static struct led_classdev locomo_led0 = {
-	.name			= "locomo:amber:charge",
-	.default_trigger	= "main-battery-charging",
-	.brightness_set		= locomoled_brightness_set0,
-};
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!mem)
+		return -EINVAL;
 
-static struct led_classdev locomo_led1 = {
-	.name			= "locomo:green:mail",
-	.default_trigger	= "nand-disk",
-	.brightness_set		= locomoled_brightness_set1,
-};
+	regs = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
-static int locomoled_probe(struct locomo_dev *ldev)
-{
-	int ret;
+	leds = devm_kzalloc(&pdev->dev, 2 * sizeof(*leds), GFP_KERNEL);
+	if (!leds)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, leds);
 
-	ret = led_classdev_register(&ldev->dev, &locomo_led0);
+	ret = locomo_led_register(leds,
+			&pdev->dev,
+			"locomo:amber:charge",
+			"main-battery-charging",
+			regs + LOCOMO_LPT0);
 	if (ret < 0)
 		return ret;
 
-	ret = led_classdev_register(&ldev->dev, &locomo_led1);
+	ret = locomo_led_register(leds + 1,
+			&pdev->dev,
+			"locomo:green:mail",
+			"nand-disk",
+			regs + LOCOMO_LPT1);
 	if (ret < 0)
-		led_classdev_unregister(&locomo_led0);
+		led_classdev_unregister(&leds[0].led);
 
 	return ret;
 }
 
-static int locomoled_remove(struct locomo_dev *dev)
+static int locomoled_remove(struct platform_device *pdev)
 {
-	led_classdev_unregister(&locomo_led0);
-	led_classdev_unregister(&locomo_led1);
+	struct locomo_led *leds = platform_get_drvdata(pdev);
+
+	led_classdev_unregister(&leds[0].led);
+	led_classdev_unregister(&leds[1].led);
+
 	return 0;
 }
 
-static struct locomo_driver locomoled_driver = {
-	.drv = {
-		.name = "locomoled"
+static struct platform_driver locomoled_driver = {
+	.driver = {
+		.name = "locomo-led"
 	},
-	.devid	= LOCOMO_DEVID_LED,
 	.probe	= locomoled_probe,
 	.remove	= locomoled_remove,
 };
 
-static int __init locomoled_init(void)
-{
-	return locomo_driver_register(&locomoled_driver);
-}
-module_init(locomoled_init);
+module_platform_driver(locomoled_driver);
 
 MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>");
 MODULE_DESCRIPTION("Locomo LED driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:locomo-led");
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 04/15] input: convert LoCoMo keyboard driver to use new locomo core
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-28  0:01   ` Dmitry Eremin-Solenikov
  2014-10-28  0:09     ` Dmitry Torokhov
  2014-10-28  0:02   ` [PATCH 08/15] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

As LoCoMo is switching to new device model, adapt keyboard driver to
support new locomo core driver.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/input/keyboard/Kconfig     |   1 -
 drivers/input/keyboard/locomokbd.c | 165 ++++++++++++++++++++-----------------
 2 files changed, 91 insertions(+), 75 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index a3958c6..b660516 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -337,7 +337,6 @@ config KEYBOARD_LM8333
 
 config KEYBOARD_LOCOMO
 	tristate "LoCoMo Keyboard Support"
-	depends on SHARP_LOCOMO
 	help
 	  Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA
 
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index c94d610..c2fabf3 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -28,16 +28,10 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/delay.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/interrupt.h>
-#include <linux/ioport.h>
-
-#include <asm/hardware/locomo.h>
-#include <asm/irq.h>
-
-MODULE_AUTHOR("John Lenz <lenz-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>");
-MODULE_DESCRIPTION("LoCoMo keyboard driver");
-MODULE_LICENSE("GPL");
+#include <linux/io.h>
+#include <linux/mfd/locomo.h>
 
 #define LOCOMOKBD_NUMKEYS	128
 
@@ -75,7 +69,8 @@ struct locomokbd {
 	struct input_dev *input;
 	char phys[32];
 
-	unsigned long base;
+	void __iomem *base;
+	int irq;
 	spinlock_t lock;
 
 	struct timer_list timer;
@@ -84,37 +79,37 @@ struct locomokbd {
 };
 
 /* helper functions for reading the keyboard matrix */
-static inline void locomokbd_charge_all(unsigned long membase)
+static inline void locomokbd_charge_all(void __iomem *membase)
 {
-	locomo_writel(0x00FF, membase + LOCOMO_KSC);
+	writew(0x00FF, membase + LOCOMO_KSC);
 }
 
-static inline void locomokbd_activate_all(unsigned long membase)
+static inline void locomokbd_activate_all(void __iomem *membase)
 {
 	unsigned long r;
 
-	locomo_writel(0, membase + LOCOMO_KSC);
-	r = locomo_readl(membase + LOCOMO_KIC);
+	writew(0, membase + LOCOMO_KSC);
+	r = readw(membase + LOCOMO_KIC);
 	r &= 0xFEFF;
-	locomo_writel(r, membase + LOCOMO_KIC);
+	writew(r, membase + LOCOMO_KIC);
 }
 
-static inline void locomokbd_activate_col(unsigned long membase, int col)
+static inline void locomokbd_activate_col(void __iomem *membase, int col)
 {
 	unsigned short nset;
 	unsigned short nbset;
 
 	nset = 0xFF & ~(1 << col);
 	nbset = (nset << 8) + nset;
-	locomo_writel(nbset, membase + LOCOMO_KSC);
+	writew(nbset, membase + LOCOMO_KSC);
 }
 
-static inline void locomokbd_reset_col(unsigned long membase, int col)
+static inline void locomokbd_reset_col(void __iomem *membase, int col)
 {
 	unsigned short nbset;
 
 	nbset = ((0xFF & ~(1 << col)) << 8) + 0xFF;
-	locomo_writel(nbset, membase + LOCOMO_KSC);
+	writew(nbset, membase + LOCOMO_KSC);
 }
 
 /*
@@ -129,7 +124,7 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
 	unsigned int row, col, rowd;
 	unsigned long flags;
 	unsigned int num_pressed;
-	unsigned long membase = locomokbd->base;
+	void __iomem *membase = locomokbd->base;
 
 	spin_lock_irqsave(&locomokbd->lock, flags);
 
@@ -141,7 +136,7 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
 		locomokbd_activate_col(membase, col);
 		udelay(KB_DELAY);
 
-		rowd = ~locomo_readl(membase + LOCOMO_KIB);
+		rowd = ~readw(membase + LOCOMO_KIB);
 		for (row = 0; row < KB_ROWS; row++) {
 			unsigned int scancode, pressed, key;
 
@@ -194,11 +189,11 @@ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
 	struct locomokbd *locomokbd = dev_id;
 	u16 r;
 
-	r = locomo_readl(locomokbd->base + LOCOMO_KIC);
+	r = readw(locomokbd->base + LOCOMO_KIC);
 	if ((r & 0x0001) == 0)
 		return IRQ_HANDLED;
 
-	locomo_writel(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack */
+	writew(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack */
 
 	/** wait chattering delay **/
 	udelay(100);
@@ -222,8 +217,8 @@ 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);
+	r = readw(locomokbd->base + LOCOMO_KIC) | 0x0010;
+	writew(r, locomokbd->base + LOCOMO_KIC);
 	return 0;
 }
 
@@ -232,35 +227,39 @@ 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);
+	r = readw(locomokbd->base + LOCOMO_KIC) & ~0x0010;
+	writew(r, locomokbd->base + LOCOMO_KIC);
 }
 
-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;
+	struct resource *res;
+
+	locomokbd = devm_kzalloc(&dev->dev, sizeof(struct locomokbd),
+			GFP_KERNEL);
+	if (!locomokbd)
+		return -ENOMEM;
 
-	locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
 	input_dev = input_allocate_device();
-	if (!locomokbd || !input_dev) {
-		err = -ENOMEM;
-		goto err_free_mem;
-	}
+	if (!input_dev)
+		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;
-	}
+	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
 
-	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);
+
+	locomokbd->base = devm_ioremap_resource(&dev->dev, res);
+	if (IS_ERR(locomokbd->base))
+		return PTR_ERR(locomokbd->base);
 
 	spin_lock_init(&locomokbd->lock);
 
@@ -296,11 +295,15 @@ static int locomokbd_probe(struct locomo_dev *dev)
 		set_bit(locomokbd->keycode[i], input_dev->keybit);
 	clear_bit(0, input_dev->keybit);
 
+	writew(0, locomokbd->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
+	writew(0, locomokbd->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
+
 	/* attempt to get the interrupt */
-	err = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
+	err = request_irq(locomokbd->irq, locomokbd_interrupt, 0,
+			"locomokbd", locomokbd);
 	if (err) {
 		printk(KERN_ERR "locomokbd: Can't get irq for keyboard\n");
-		goto err_release_region;
+		goto err_free_mem;
 	}
 
 	err = input_register_device(locomokbd->input);
@@ -309,54 +312,68 @@ static int locomokbd_probe(struct locomo_dev *dev)
 
 	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:
+err_free_irq:
+	free_irq(locomokbd->irq, locomokbd);
+err_free_mem:
+	platform_set_drvdata(dev, NULL);
 	input_free_device(input_dev);
-	kfree(locomokbd);
 
 	return err;
 }
 
-static int locomokbd_remove(struct locomo_dev *dev)
+static int locomokbd_remove(struct platform_device *dev)
 {
-	struct locomokbd *locomokbd = locomo_get_drvdata(dev);
+	struct locomokbd *locomokbd = platform_get_drvdata(dev);
 
-	free_irq(dev->irq[0], locomokbd);
+	free_irq(locomokbd->irq, locomokbd);
 
 	del_timer_sync(&locomokbd->timer);
 
 	input_unregister_device(locomokbd->input);
-	locomo_set_drvdata(dev, NULL);
+	platform_set_drvdata(dev, NULL);
+
+	return 0;
+}
 
-	release_mem_region((unsigned long) dev->mapbase, dev->length);
+#ifdef CONFIG_PM_SLEEP
+static int locomokbd_resume(struct device *dev)
+{
+	struct locomokbd *locomokbd = dev_get_drvdata(dev);
+	unsigned long flags;
+	u16 r;
+
+	spin_lock_irqsave(&locomokbd->lock, flags);
+
+	writew(0, locomokbd->base + LOCOMO_KSC);
+	r = readw(locomokbd->base + LOCOMO_KIC);
+	r &= 0xFEFF;
+	writew(r, locomokbd->base + LOCOMO_KIC);
+	writew(0x1, locomokbd->base + LOCOMO_KCMD);
 
-	kfree(locomokbd);
+	spin_unlock_irqrestore(&locomokbd->lock, flags);
 
 	return 0;
 }
 
-static struct locomo_driver keyboard_driver = {
-	.drv = {
-		.name = "locomokbd"
+static SIMPLE_DEV_PM_OPS(locomo_kbd_pm, NULL, locomokbd_resume);
+#define LOCOMO_KBD_PM	(&locomo_kbd_pm)
+#else
+#define LOCOMO_KBD_PM	NULL
+#endif
+
+static struct platform_driver locomokbd_driver = {
+	.driver = {
+		.name	= "locomo-kbd",
+		.owner	= THIS_MODULE,
+		.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 <lenz-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>");
+MODULE_DESCRIPTION("LoCoMo keyboard driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:locomo-kbd");
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 05/15] video: backlight: add new locomo backlight driver
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (3 preceding siblings ...)
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-28  0:01 ` Dmitry Eremin-Solenikov
  2014-10-28  0:24   ` Jingoo Han
  2014-10-28  0:01 ` [PATCH 06/15] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Add 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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/video/backlight/Kconfig     |   6 +-
 drivers/video/backlight/Makefile    |   2 +-
 drivers/video/backlight/locomo_bl.c | 171 ++++++++++++++++++++++++++++++++++++
 3 files changed, 175 insertions(+), 4 deletions(-)
 create mode 100644 drivers/video/backlight/locomo_bl.c

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 8d03924..03b77b33 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -218,12 +218,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"
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index fcd50b73..2a61b7e 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -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
diff --git a/drivers/video/backlight/locomo_bl.c b/drivers/video/backlight/locomo_bl.c
new file mode 100644
index 0000000..cec1b51
--- /dev/null
+++ b/drivers/video/backlight/locomo_bl.c
@@ -0,0 +1,171 @@
+/*
+ * Backlight control code for Sharp Zaurus SL-5500
+ *
+ * Copyright 2005 John Lenz <lenz@cs.wisc.edu>
+ * Maintainer: Pavel Machek <pavel@ucw.cz> (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/module.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/mfd/locomo.h>
+
+struct locomo_bl {
+	void __iomem *regs;
+	int current_intensity;
+	int gpio_fl_vr;
+};
+
+static const struct {
+	u16 duty, bpwf;
+	bool vr;
+} locomo_bl_pwm[] = {
+	{ 0, 161, false },
+	{ 117, 161, false },
+	{ 163, 148, false },
+	{ 194, 161, false },
+	{ 194, 161, true },
+};
+
+static int locomo_bl_set_intensity(struct backlight_device *bd)
+{
+	int intensity = bd->props.brightness;
+	struct locomo_bl *bl = dev_get_drvdata(&bd->dev);
+
+	if (bd->props.power != FB_BLANK_UNBLANK)
+		intensity = 0;
+	if (bd->props.fb_blank != FB_BLANK_UNBLANK)
+		intensity = 0;
+	if (bd->props.state & BL_CORE_SUSPENDED)
+		intensity = 0;
+
+	gpio_set_value(bl->gpio_fl_vr, locomo_bl_pwm[intensity].vr);
+
+	writew(locomo_bl_pwm[intensity].bpwf, bl->regs + LOCOMO_ALS);
+	udelay(100);
+	writew(locomo_bl_pwm[intensity].duty, bl->regs + LOCOMO_ALD);
+	udelay(100);
+	writew(locomo_bl_pwm[intensity].bpwf | LOCOMO_ALC_EN,
+			bl->regs + LOCOMO_ALS);
+
+	bl->current_intensity = intensity;
+	if (bd->props.state & BL_CORE_SUSPENDED)
+		writew(0x00, bl->regs + LOCOMO_ALS);
+
+	return 0;
+}
+
+static int locomo_bl_get_intensity(struct backlight_device *bd)
+{
+	struct locomo_bl *bl = dev_get_drvdata(&bd->dev);
+
+	return bl->current_intensity;
+}
+
+static const struct backlight_ops locomo_bl_ops = {
+	.options	= BL_CORE_SUSPENDRESUME,
+	.get_brightness = locomo_bl_get_intensity,
+	.update_status  = locomo_bl_set_intensity,
+};
+
+static int locomo_bl_probe(struct platform_device *dev)
+{
+	struct backlight_properties props;
+	struct resource *res;
+	struct locomo_bl_platform_data *pdata;
+	struct locomo_bl *bl;
+	struct backlight_device *locomo_bl_device;
+	int rc;
+
+	bl = devm_kmalloc(&dev->dev, sizeof(struct locomo_bl), GFP_KERNEL);
+	if (!bl)
+		return -ENOMEM;
+
+	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+	bl->regs = devm_ioremap_resource(&dev->dev, res);
+	if (!bl->regs)
+		return -EINVAL;
+
+	pdata = dev_get_platdata(&dev->dev);
+	if (!pdata)
+		return -EINVAL;
+
+	bl->gpio_fl_vr = pdata->gpio_fl_vr;
+	rc = devm_gpio_request_one(&dev->dev, bl->gpio_fl_vr,
+			GPIOF_OUT_INIT_LOW, "FL VR");
+	if (rc)
+		return rc;
+
+	writew(0, bl->regs + LOCOMO_ALS);
+	writew(0, bl->regs + LOCOMO_ALD);
+
+	memset(&props, 0, sizeof(struct backlight_properties));
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = ARRAY_SIZE(locomo_bl_pwm) - 1;
+	props.brightness = props.max_brightness / 2;
+	locomo_bl_device = backlight_device_register("locomo-bl",
+						&dev->dev, bl,
+						&locomo_bl_ops, &props);
+
+	if (IS_ERR(locomo_bl_device))
+		return PTR_ERR(locomo_bl_device);
+
+	platform_set_drvdata(dev, locomo_bl_device);
+
+	/* Set up frontlight so that screen is readable */
+	backlight_update_status(locomo_bl_device);
+
+	return 0;
+}
+
+static int locomo_bl_remove(struct platform_device *dev)
+{
+	struct backlight_device *locomo_bl_device = platform_get_drvdata(dev);
+
+	locomo_bl_device->props.brightness = 0;
+	locomo_bl_device->props.power = 0;
+	locomo_bl_set_intensity(locomo_bl_device);
+
+	backlight_device_unregister(locomo_bl_device);
+
+	return 0;
+}
+
+static void locomo_bl_shutdown(struct platform_device *dev)
+{
+	struct backlight_device *locomo_bl_device = platform_get_drvdata(dev);
+
+	locomo_bl_device->props.brightness = 0;
+	locomo_bl_device->props.power = 0;
+	locomo_bl_set_intensity(locomo_bl_device);
+}
+
+static struct platform_driver locomo_bl_driver = {
+	.driver = {
+		.name	= "locomo-backlight",
+		.owner	= THIS_MODULE,
+	},
+	.probe	= locomo_bl_probe,
+	.remove	= locomo_bl_remove,
+	/* Turn off bl on power off/reboot */
+	.shutdown = locomo_bl_shutdown,
+};
+
+module_platform_driver(locomo_bl_driver);
+
+MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>, Pavel Machek <pavel@ucw.cz>");
+MODULE_DESCRIPTION("Collie Backlight driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:locomo-backlight");
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 06/15] video: lcd: add LoCoMo LCD driver
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (4 preceding siblings ...)
  2014-10-28  0:01 ` [PATCH 05/15] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:01 ` Dmitry Eremin-Solenikov
  2014-10-28  0:30   ` Jingoo Han
  2014-10-28  0:02 ` [PATCH 07/15] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:01 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

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 <dbaryshkov@gmail.com>
---
 drivers/video/backlight/Kconfig      |   8 ++
 drivers/video/backlight/Makefile     |   1 +
 drivers/video/backlight/locomo_lcd.c | 224 +++++++++++++++++++++++++++++++++++
 3 files changed, 233 insertions(+)
 create mode 100644 drivers/video/backlight/locomo_lcd.c

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 03b77b33..bc5c671 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -48,6 +48,14 @@ 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
+	default y
+	help
+	  If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to
+	  enable the LCD driver.
+
 config LCD_LTV350QV
 	tristate "Samsung LTV350QV LCD Panel"
 	depends on SPI_MASTER
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 2a61b7e..b2580e7 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_LCD_ILI922X)		+= ili922x.o
 obj-$(CONFIG_LCD_ILI9320)		+= ili9320.o
 obj-$(CONFIG_LCD_L4F00242T03)		+= l4f00242t03.o
 obj-$(CONFIG_LCD_LD9040)		+= ld9040.o
+obj-$(CONFIG_LCD_LOCOMO)		+= locomo_lcd.o
 obj-$(CONFIG_LCD_LMS283GF05)		+= lms283gf05.o
 obj-$(CONFIG_LCD_LMS501KF03)		+= lms501kf03.o
 obj-$(CONFIG_LCD_LTV350QV)		+= ltv350qv.o
diff --git a/drivers/video/backlight/locomo_lcd.c b/drivers/video/backlight/locomo_lcd.c
new file mode 100644
index 0000000..245efb8
--- /dev/null
+++ b/drivers/video/backlight/locomo_lcd.c
@@ -0,0 +1,224 @@
+/*
+ * Backlight control code for Sharp Zaurus SL-5500
+ *
+ * Copyright 2005 John Lenz <lenz@cs.wisc.edu>
+ * Maintainer: Pavel Machek <pavel@ucw.cz> (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/platform_device.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/lcd.h>
+#include <linux/mfd/locomo.h>
+
+static struct platform_device *locomolcd_dev;
+static struct locomo_lcd_platform_data lcd_data;
+static bool locomolcd_is_on;
+static bool locomolcd_is_suspended;
+static void __iomem *locomolcd_regs;
+static struct lcd_device *lcd_dev;
+
+static struct gpio locomo_gpios[] = {
+	{ 0, GPIOF_OUT_INIT_LOW, "LCD VSHA on" },
+	{ 0, GPIOF_OUT_INIT_LOW, "LCD VSHD on" },
+	{ 0, GPIOF_OUT_INIT_LOW, "LCD Vee on" },
+	{ 0, GPIOF_OUT_INIT_LOW, "LCD MOD" },
+};
+
+static void locomolcd_on(void)
+{
+	gpio_set_value(lcd_data.gpio_lcd_vsha_on, 1);
+	mdelay(2);
+
+	gpio_set_value(lcd_data.gpio_lcd_vshd_on, 1);
+	mdelay(2);
+
+	locomo_m62332_senddata(locomolcd_dev->dev.parent, lcd_data.comadj, 0);
+	mdelay(5);
+
+	gpio_set_value(lcd_data.gpio_lcd_vee_on, 1);
+	mdelay(10);
+
+	/* TFTCRST | CPSOUT=0 | CPSEN */
+	writew(0x01, locomolcd_regs + LOCOMO_TC);
+
+	/* Set CPSD */
+	writew(6, locomolcd_regs + LOCOMO_CPSD);
+
+	/* TFTCRST | CPSOUT=0 | CPSEN */
+	writew((0x04 | 0x01), locomolcd_regs + LOCOMO_TC);
+	mdelay(10);
+
+	gpio_set_value(lcd_data.gpio_lcd_mod, 1);
+}
+
+static void locomolcd_off(void)
+{
+	/* TFTCRST=1 | CPSOUT=1 | CPSEN = 0 */
+	writew(0x06, locomolcd_regs + LOCOMO_TC);
+	mdelay(1);
+
+	gpio_set_value(lcd_data.gpio_lcd_vsha_on, 0);
+	mdelay(110);
+
+	gpio_set_value(lcd_data.gpio_lcd_vee_on, 0);
+	mdelay(700);
+
+	locomo_m62332_senddata(locomolcd_dev->dev.parent, 0, 0);
+	mdelay(5);
+
+	/* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */
+	writew(0, locomolcd_regs + LOCOMO_TC);
+	gpio_set_value(lcd_data.gpio_lcd_mod, 0);
+	gpio_set_value(lcd_data.gpio_lcd_vshd_on, 0);
+}
+
+int locomo_lcd_set_power(struct lcd_device *lcd, int power)
+{
+	dev_dbg(&lcd->dev, "LCD power %d (is %d)\n", power, locomolcd_is_on);
+	if (power == 0 && !locomolcd_is_on) {
+		locomolcd_is_on = 1;
+		locomolcd_on();
+	}
+	if (power != 0 && locomolcd_is_on) {
+		locomolcd_is_on = 0;
+		locomolcd_off();
+	}
+	return 0;
+}
+
+static int locomo_lcd_get_power(struct lcd_device *lcd)
+{
+	return !locomolcd_is_on;
+}
+
+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 locomolcd_suspend(struct device *dev)
+{
+	locomolcd_is_suspended = true;
+	locomolcd_off();
+
+	return 0;
+}
+
+static int locomolcd_resume(struct device *dev)
+{
+	locomolcd_is_suspended = false;
+
+	if (locomolcd_is_on)
+		locomolcd_on();
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(locomolcd_pm, locomolcd_suspend, locomolcd_resume);
+#define LOCOMOLCD_PM	(&locomolcd_pm)
+#else
+#define LOCOMOLCD_PM	NULL
+#endif
+
+static int locomolcd_probe(struct platform_device *dev)
+{
+	unsigned long flags;
+	struct resource *res;
+	struct locomo_lcd_platform_data *pdata;
+	int rc;
+
+	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+	locomolcd_regs = devm_ioremap_resource(&dev->dev, res);
+	if (!locomolcd_regs)
+		return -EINVAL;
+
+	pdata = dev_get_platdata(&dev->dev);
+	if (!pdata)
+		return -EINVAL;
+
+	lcd_data = *pdata;
+
+	locomo_gpios[0].gpio = lcd_data.gpio_lcd_vsha_on;
+	locomo_gpios[1].gpio = lcd_data.gpio_lcd_vshd_on;
+	locomo_gpios[2].gpio = lcd_data.gpio_lcd_vee_on;
+	locomo_gpios[3].gpio = lcd_data.gpio_lcd_mod;
+	dev_info(&dev->dev, "GPIOs: %d %d %d %d\n",
+			locomo_gpios[0].gpio,
+			locomo_gpios[1].gpio,
+			locomo_gpios[2].gpio,
+			locomo_gpios[3].gpio);
+
+	rc = gpio_request_array(locomo_gpios, ARRAY_SIZE(locomo_gpios));
+	if (rc)
+		return rc;
+
+	local_irq_save(flags);
+	locomolcd_dev = dev;
+
+	locomolcd_is_on = 1;
+	if (locomolcd_is_on)
+		locomolcd_on();
+
+	local_irq_restore(flags);
+
+	lcd_dev = lcd_device_register("locomo", &dev->dev, NULL,
+			&locomo_lcd_ops);
+
+	return 0;
+}
+
+static int locomolcd_remove(struct platform_device *dev)
+{
+	unsigned long flags;
+
+	lcd_device_unregister(lcd_dev);
+
+	local_irq_save(flags);
+
+	locomolcd_off();
+	locomolcd_dev = NULL;
+
+	local_irq_restore(flags);
+
+	gpio_free_array(locomo_gpios, ARRAY_SIZE(locomo_gpios));
+
+	return 0;
+}
+
+static void locomolcd_shutdown(struct platform_device *dev)
+{
+	locomolcd_off();
+}
+
+static struct platform_driver locomolcd_driver = {
+	.driver = {
+		.name	= "locomo-lcd",
+		.owner	= THIS_MODULE,
+		.pm	= LOCOMOLCD_PM,
+	},
+	.probe	= locomolcd_probe,
+	.remove	= locomolcd_remove,
+	.shutdown = locomolcd_shutdown,
+};
+
+module_platform_driver(locomolcd_driver);
+
+MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>, Pavel Machek <pavel@ucw.cz>");
+MODULE_DESCRIPTION("Collie LCD driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:locomo-lcd");
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 07/15] video: backlight: drop old locomo bl/lcd driver
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (5 preceding siblings ...)
  2014-10-28  0:01 ` [PATCH 06/15] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:02 ` Dmitry Eremin-Solenikov
  2014-10-28  0:02 ` [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Old locomolcd driver is now completely obsolete by new locomo_bl and
locomo_lcd drivers, so let's drop it.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/video/backlight/locomolcd.c | 255 ------------------------------------
 1 file changed, 255 deletions(-)
 delete mode 100644 drivers/video/backlight/locomolcd.c

diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
deleted file mode 100644
index 6c3ec42..0000000
--- a/drivers/video/backlight/locomolcd.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Backlight control code for Sharp Zaurus SL-5500
- *
- * Copyright 2005 John Lenz <lenz@cs.wisc.edu>
- * Maintainer: Pavel Machek <pavel@ucw.cz> (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 <lenz@cs.wisc.edu>, Pavel Machek <pavel@ucw.cz>");
-MODULE_DESCRIPTION("Collie LCD driver");
-MODULE_LICENSE("GPL");
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 08/15] ARM: sa1100: make collie use new locomo drivers
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-10-28  0:01   ` [PATCH 04/15] input: convert LoCoMo keyboard driver to use " Dmitry Eremin-Solenikov
@ 2014-10-28  0:02   ` Dmitry Eremin-Solenikov
  2014-10-28  0:02   ` [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Switch collie to new mfd-based locomo driver.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-sa1100/Kconfig               |   1 -
 arch/arm/mach-sa1100/collie.c              | 112 +++++++++++++++--------------
 arch/arm/mach-sa1100/include/mach/collie.h |  25 ++++++-
 3 files changed, 79 insertions(+), 59 deletions(-)

diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index c6f6ed1..37af126 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -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
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 108939f..43d3291 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -24,6 +24,7 @@
 #include <linux/platform_data/sa11x0-serial.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/ucb1x00.h>
+#include <linux/mfd/locomo.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/timer.h>
@@ -47,7 +48,6 @@
 
 #include <asm/hardware/scoop.h>
 #include <asm/mach/sharpsl_param.h>
-#include <asm/hardware/locomo.h>
 #include <linux/platform_data/mfd-mcp-sa11x0.h>
 #include <mach/irqs.h>
 
@@ -189,36 +189,54 @@ static struct platform_device collie_power_device = {
 	.num_resources		= ARRAY_SIZE(collie_power_resource),
 };
 
-#ifdef CONFIG_SHARP_LOCOMO
 /*
  * low-level UART features.
  */
-struct platform_device collie_locomo_device;
+static struct gpio collie_uart_gpio[] = {
+	{ COLLIE_GPIO_CTS, GPIOF_IN, "CTS" },
+	{ COLLIE_GPIO_RTS, GPIOF_OUT_INIT_LOW, "RTS" },
+	{ COLLIE_GPIO_DTR, GPIOF_OUT_INIT_LOW, "DTR" },
+	{ COLLIE_GPIO_DSR, GPIOF_IN, "DSR" },
+};
+
+static bool collie_uart_gpio_ok;
 
 static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl)
 {
-	if (mctrl & TIOCM_RTS)
-		locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 0);
-	else
-		locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 1);
-
-	if (mctrl & TIOCM_DTR)
-		locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 0);
-	else
-		locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 1);
+	if (!collie_uart_gpio_ok) {
+		int rc = gpio_request_array(collie_uart_gpio,
+				ARRAY_SIZE(collie_uart_gpio));
+		if (rc)
+			pr_err("collie_uart_set_mctrl: gpio request %d\n", rc);
+		else
+			collie_uart_gpio_ok = true;
+	}
+
+	if (collie_uart_gpio_ok) {
+		gpio_set_value(COLLIE_GPIO_RTS, !(mctrl & TIOCM_RTS));
+		gpio_set_value(COLLIE_GPIO_DTR, !(mctrl & TIOCM_DTR));
+	}
 }
 
 static u_int collie_uart_get_mctrl(struct uart_port *port)
 {
 	int ret = TIOCM_CD;
-	unsigned int r;
 
-	r = locomo_gpio_read_output(&collie_locomo_device.dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR);
-	if (r == -ENODEV)
+	if (!collie_uart_gpio_ok) {
+		int rc = gpio_request_array(collie_uart_gpio,
+				ARRAY_SIZE(collie_uart_gpio));
+		if (rc)
+			pr_err("collie_uart_get_mctrl: gpio request %d\n", rc);
+		else
+			collie_uart_gpio_ok = true;
+	}
+
+	if (!collie_uart_gpio_ok)
 		return ret;
-	if (r & LOCOMO_GPIO_CTS)
+
+	if (gpio_get_value(COLLIE_GPIO_CTS))
 		ret |= TIOCM_CTS;
-	if (r & LOCOMO_GPIO_DSR)
+	if (gpio_get_value(COLLIE_GPIO_DSR))
 		ret |= TIOCM_DSR;
 
 	return ret;
@@ -229,33 +247,6 @@ static struct sa1100_port_fns collie_port_fns __initdata = {
 	.get_mctrl	= collie_uart_get_mctrl,
 };
 
-static int collie_uart_probe(struct locomo_dev *dev)
-{
-	return 0;
-}
-
-static int collie_uart_remove(struct locomo_dev *dev)
-{
-	return 0;
-}
-
-static struct locomo_driver collie_uart_driver = {
-	.drv = {
-		.name = "collie_uart",
-	},
-	.devid	= LOCOMO_DEVID_UART,
-	.probe	= collie_uart_probe,
-	.remove	= collie_uart_remove,
-};
-
-static int __init collie_uart_init(void)
-{
-	return locomo_driver_register(&collie_uart_driver);
-}
-device_initcall(collie_uart_init);
-
-#endif
-
 
 static struct resource locomo_resources[] = {
 	[0] = DEFINE_RES_MEM(0x40000000, SZ_8K),
@@ -263,14 +254,28 @@ static struct resource locomo_resources[] = {
 };
 
 static struct locomo_platform_data locomo_info = {
-	.irq_base	= IRQ_BOARD_START,
+	.gpio_data = {
+		.gpio_base = COLLIE_LOCOMO_GPIO_BASE,
+	},
+	.lcd_data = {
+		.comadj	          = 128,
+		.gpio_lcd_vsha_on = COLLIE_GPIO_LCD_VSHA_ON,
+		.gpio_lcd_vshd_on = COLLIE_GPIO_LCD_VSHD_ON,
+		.gpio_lcd_vee_on  = COLLIE_GPIO_LCD_VEE_ON,
+		.gpio_lcd_mod     = COLLIE_GPIO_LCD_MOD,
+	},
+	.bl_data = {
+		.gpio_fl_vr       = COLLIE_GPIO_FL_VR,
+	},
+	.gpio_amp1_on	  = COLLIE_GPIO_AMP1_ON,
+	.gpio_amp2_on	  = COLLIE_GPIO_AMP2_ON,
 };
 
-struct platform_device collie_locomo_device = {
+static struct platform_device collie_locomo_device = {
 	.name		= "locomo",
 	.id		= 0,
 	.dev		= {
-		.platform_data	= &locomo_info,
+		.platform_data  = &locomo_info,
 	},
 	.num_resources	= ARRAY_SIZE(locomo_resources),
 	.resource	= locomo_resources,
@@ -385,10 +390,6 @@ static struct sa1100fb_mach_info collie_lcd_info = {
 
 	.lccr0		= LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
 	.lccr3		= LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
-
-#ifdef CONFIG_BACKLIGHT_LOCOMO
-	.lcd_power	= locomolcd_power
-#endif
 };
 
 static void __init collie_init(void)
@@ -420,6 +421,8 @@ static void __init collie_init(void)
 
 	GPSR |= _COLLIE_GPIO_UCB1x00_RESET;
 
+	sharpsl_save_param();
+
 	collie_power_resource[0].start = gpio_to_irq(COLLIE_GPIO_AC_IN);
 	collie_power_resource[0].end = gpio_to_irq(COLLIE_GPIO_AC_IN);
 
@@ -428,6 +431,9 @@ static void __init collie_init(void)
 
 	platform_scoop_config = &collie_pcmcia_config;
 
+	if (sharpsl_param.comadj != -1)
+		locomo_info.lcd_data.comadj = sharpsl_param.comadj;
+
 	ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	if (ret) {
 		printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
@@ -438,8 +444,6 @@ static void __init collie_init(void)
 			    ARRAY_SIZE(collie_flash_resources));
 	sa11x0_register_mcp(&collie_mcp_data);
 	sa11x0_register_irda(&collie_ir_data);
-
-	sharpsl_save_param();
 }
 
 static struct map_desc collie_io_desc[] __initdata = {
@@ -461,9 +465,7 @@ static void __init collie_map_io(void)
 	sa1100_map_io();
 	iotable_init(collie_io_desc, ARRAY_SIZE(collie_io_desc));
 
-#ifdef CONFIG_SHARP_LOCOMO
 	sa1100_register_uart_fns(&collie_port_fns);
-#endif
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
 }
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h
index b478ca1..22a7c7e 100644
--- a/arch/arm/mach-sa1100/include/mach/collie.h
+++ b/arch/arm/mach-sa1100/include/mach/collie.h
@@ -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,23 @@ 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 + 23)
+#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_LCD_VSHA_ON		(COLLIE_LOCOMO_GPIO_BASE + 4)
+#define COLLIE_GPIO_LCD_VSHD_ON		(COLLIE_LOCOMO_GPIO_BASE + 5)
+#define COLLIE_GPIO_LCD_VEE_ON		(COLLIE_LOCOMO_GPIO_BASE + 6)
+#define COLLIE_GPIO_LCD_MOD		(COLLIE_LOCOMO_GPIO_BASE + 7)
+#define COLLIE_LOCOMO_GPIO_DAC_ON	LOCOMO_GPIO(8)
+#define COLLIE_GPIO_FL_VR		(COLLIE_LOCOMO_GPIO_BASE + 9)
+#define COLLIE_LOCOMO_GPIO_DAC_SDATA	LOCOMO_GPIO(10)
+#define COLLIE_LOCOMO_GPIO_DAC_SCK	LOCOMO_GPIO(11)
+#define COLLIE_LOCOMO_GPIO_DAC_SLOAD	LOCOMO_GPIO(12)
+#define COLLIE_LOCOMO_GPIO_CARD_DETECT	LOCOMO_GPIO(13)
+#define COLLIE_LOCOMO_GPIO_WRITE_PROT	LOCOMO_GPIO(14)
+#define COLLIE_LOCOMO_GPIO_CARD_POWER	LOCOMO_GPIO(15)
+
 #endif
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (6 preceding siblings ...)
  2014-10-28  0:02 ` [PATCH 07/15] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:02 ` Dmitry Eremin-Solenikov
  2014-10-31  7:50   ` Linus Walleij
  2014-10-28  0:02 ` [PATCH 10/15] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

As new locomo driver properly supports SPARSE_IRQ, stop playing with
NR_IRQS on sa1100 (locomo was the last chip requiring NR_IRQ tricks).

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 arch/arm/mach-sa1100/include/mach/irqs.h | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-sa1100/include/mach/irqs.h b/arch/arm/mach-sa1100/include/mach/irqs.h
index 3790298..99e7202 100644
--- a/arch/arm/mach-sa1100/include/mach/irqs.h
+++ b/arch/arm/mach-sa1100/include/mach/irqs.h
@@ -68,22 +68,7 @@
 #define IRQ_BOARD_START		49
 #define IRQ_BOARD_END		65
 
-/*
- * 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
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 10/15] ARM: pxa: poodle: use new LoCoMo driver
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (7 preceding siblings ...)
  2014-10-28  0:02 ` [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
@ 2014-10-28  0:02 ` Dmitry Eremin-Solenikov
  2014-10-28  0:02 ` [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface Dmitry Eremin-Solenikov
  2014-10-28  0:13 ` [PATCH 00/15] new locomo driver Russell King - ARM Linux
  10 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Convert poodle to use new mfd-based LoCoMo driver.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 arch/arm/mach-pxa/Kconfig               |  1 -
 arch/arm/mach-pxa/include/mach/poodle.h | 14 +++++++++-----
 arch/arm/mach-pxa/poodle.c              | 19 +++++++++++++++----
 3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index e6690a4..1da3e8f 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -473,7 +473,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"
diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h
index b56b193..e8eb51e 100644
--- a/arch/arm/mach-pxa/include/mach/poodle.h
+++ b/arch/arm/mach-pxa/include/mach/poodle.h
@@ -81,11 +81,15 @@
 #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_LOCOMO_GPIO_BASE	(PXA_NR_BUILTIN_GPIO + 12)
+#define POODLE_GPIO_LCD_VSHA_ON	(POODLE_LOCOMO_GPIO_BASE + 4)
+#define POODLE_GPIO_LCD_VSHD_ON	(POODLE_LOCOMO_GPIO_BASE + 5)
+#define POODLE_GPIO_LCD_VEE_ON	(POODLE_LOCOMO_GPIO_BASE + 6)
+#define POODLE_GPIO_LCD_MOD	(POODLE_LOCOMO_GPIO_BASE + 7)
+#define POODLE_GPIO_AMP_ON	(POODLE_LOCOMO_GPIO_BASE + 8)
+#define POODLE_GPIO_FL_VR	(POODLE_LOCOMO_GPIO_BASE + 9)
+#define POODLE_GPIO_MUTE_L	(POODLE_LOCOMO_GPIO_BASE + 10)
+#define POODLE_GPIO_MUTE_R	(POODLE_LOCOMO_GPIO_BASE + 11)
 
 #define POODLE_NR_IRQS		(IRQ_BOARD_START + 4)	/* 4 for LoCoMo */
 
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 1319916..3041d83 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -30,6 +30,7 @@
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/mtd/sharpsl.h>
 #include <linux/memblock.h>
+#include <linux/mfd/locomo.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -48,7 +49,6 @@
 #include <linux/platform_data/video-pxafb.h>
 
 #include <asm/hardware/scoop.h>
-#include <asm/hardware/locomo.h>
 #include <asm/mach/sharpsl_param.h>
 
 #include "generic.h"
@@ -178,7 +178,17 @@ static struct resource locomo_resources[] = {
 };
 
 static struct locomo_platform_data locomo_info = {
-	.irq_base	= IRQ_BOARD_START,
+	.gpio_data = {
+		.gpio_base = POODLE_LOCOMO_GPIO_BASE,
+	},
+	.bl_data = {
+		.comadj	          = 118,
+		.gpio_lcd_vsha_on = POODLE_GPIO_LCD_VSHA_ON,
+		.gpio_lcd_vshd_on = POODLE_GPIO_LCD_VSHD_ON,
+		.gpio_lcd_vee_on  = POODLE_GPIO_LCD_VEE_ON,
+		.gpio_lcd_mod     = POODLE_GPIO_LCD_MOD,
+		.gpio_fl_vr       = POODLE_GPIO_FL_VR,
+	},
 };
 
 struct platform_device poodle_locomo_device = {
@@ -191,8 +201,6 @@ struct platform_device poodle_locomo_device = {
 	},
 };
 
-EXPORT_SYMBOL(poodle_locomo_device);
-
 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
 static struct pxa2xx_spi_master poodle_spi_info = {
 	.num_chipselect	= 1,
@@ -444,6 +452,9 @@ static void __init poodle_init(void)
 
 	platform_scoop_config = &poodle_pcmcia_config;
 
+	if (sharpsl_param.comadj != -1)
+		locomo_info.bl_data.comadj = sharpsl_param.comadj;
+
 	ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	if (ret)
 		pr_warning("poodle: Unable to register LoCoMo device\n");
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (8 preceding siblings ...)
  2014-10-28  0:02 ` [PATCH 10/15] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:02 ` Dmitry Eremin-Solenikov
       [not found]   ` <1414454528-24240-12-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-10-28  0:13 ` [PATCH 00/15] new locomo driver Russell King - ARM Linux
  10 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

Since LoCoMo driver has been converted to provide proper gpiolib
interface, make poodle ASoC platform driver use gpiolib API.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 sound/soc/pxa/poodle.c | 51 ++++++++++++++++++++++++--------------------------
 1 file changed, 24 insertions(+), 27 deletions(-)

diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 21f3400..a593bff 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -20,12 +20,12 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/gpio.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>
 
@@ -48,16 +48,12 @@ 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);
+		gpio_set_value(POODLE_GPIO_MUTE_L, 1);
+		gpio_set_value(POODLE_GPIO_MUTE_R, 1);
 		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);
+		gpio_set_value(POODLE_GPIO_MUTE_L, 0);
+		gpio_set_value(POODLE_GPIO_MUTE_R, 0);
 		snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
 	}
 
@@ -85,10 +81,8 @@ static int poodle_startup(struct snd_pcm_substream *substream)
 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);
+	gpio_set_value(POODLE_GPIO_MUTE_L, 1);
+	gpio_set_value(POODLE_GPIO_MUTE_R, 1);
 }
 
 static int poodle_hw_params(struct snd_pcm_substream *substream,
@@ -178,12 +172,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);
+	gpio_set_value(POODLE_GPIO_AMP_ON, !(SND_SOC_DAPM_EVENT_ON(event)));
 
 	return 0;
 }
@@ -263,25 +252,32 @@ static struct snd_soc_card poodle = {
 	.num_dapm_routes = ARRAY_SIZE(poodle_audio_map),
 };
 
+struct gpio poodle_gpios[] = {
+	{ POODLE_GPIO_AMP_ON, GPIOF_OUT_INIT_HIGH, "Amplifier" },
+	{ POODLE_GPIO_MUTE_L, GPIOF_OUT_INIT_LOW, "Mute left" },
+	{ POODLE_GPIO_MUTE_R, GPIOF_OUT_INIT_LOW, "Mute right" },
+};
+
 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);
+	ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
+	if (ret) {
+		dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
+				ret);
+		return ret;
+	}
 
 	card->dev = &pdev->dev;
 
 	ret = snd_soc_register_card(card);
-	if (ret)
+	if (ret) {
 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
 			ret);
+		gpio_free_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
+	}
 	return ret;
 }
 
@@ -290,6 +286,7 @@ static int poodle_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
 	snd_soc_unregister_card(card);
+	gpio_free_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
 	return 0;
 }
 
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2014-10-28  0:01   ` [PATCH 04/15] input: convert LoCoMo keyboard driver to use " Dmitry Eremin-Solenikov
  2014-10-28  0:02   ` [PATCH 08/15] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
@ 2014-10-28  0:02   ` Dmitry Eremin-Solenikov
  2014-10-28 19:13     ` Robert Jarzmik
  2014-10-28  0:02   ` [PATCH 13/15] ARM: drop old LoCoMo driver Dmitry Eremin-Solenikov
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

As new locomo driver supports SPARSE_IRQ, don't preallocate NR_IRQS
space for it on poodle.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/mach-pxa/include/mach/poodle.h | 2 +-
 arch/arm/mach-pxa/poodle.c              | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h
index e8eb51e..105410a 100644
--- a/arch/arm/mach-pxa/include/mach/poodle.h
+++ b/arch/arm/mach-pxa/include/mach/poodle.h
@@ -91,7 +91,7 @@
 #define POODLE_GPIO_MUTE_L	(POODLE_LOCOMO_GPIO_BASE + 10)
 #define POODLE_GPIO_MUTE_R	(POODLE_LOCOMO_GPIO_BASE + 11)
 
-#define POODLE_NR_IRQS		(IRQ_BOARD_START + 4)	/* 4 for LoCoMo */
+#define POODLE_NR_IRQS		IRQ_BOARD_START
 
 extern struct platform_device poodle_locomo_device;
 
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 3041d83..97eced9 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -181,14 +181,18 @@ static struct locomo_platform_data locomo_info = {
 	.gpio_data = {
 		.gpio_base = POODLE_LOCOMO_GPIO_BASE,
 	},
-	.bl_data = {
+	.lcd_data = {
 		.comadj	          = 118,
 		.gpio_lcd_vsha_on = POODLE_GPIO_LCD_VSHA_ON,
 		.gpio_lcd_vshd_on = POODLE_GPIO_LCD_VSHD_ON,
 		.gpio_lcd_vee_on  = POODLE_GPIO_LCD_VEE_ON,
 		.gpio_lcd_mod     = POODLE_GPIO_LCD_MOD,
+	},
+	.bl_data = {
 		.gpio_fl_vr       = POODLE_GPIO_FL_VR,
 	},
+	.gpio_amp1_on	= -1,
+	.gpio_amp2_on	= -1,
 };
 
 struct platform_device poodle_locomo_device = {
@@ -453,7 +457,7 @@ static void __init poodle_init(void)
 	platform_scoop_config = &poodle_pcmcia_config;
 
 	if (sharpsl_param.comadj != -1)
-		locomo_info.bl_data.comadj = sharpsl_param.comadj;
+		locomo_info.lcd_data.comadj = sharpsl_param.comadj;
 
 	ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	if (ret)
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 13/15] ARM: drop old LoCoMo driver
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2014-10-28  0:02   ` [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
@ 2014-10-28  0:02   ` Dmitry Eremin-Solenikov
  2014-10-28  0:02   ` [PATCH 14/15] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
  2014-10-28  0:02   ` [PATCH 15/15] spi: add locomo SPI driver Dmitry Eremin-Solenikov
  5 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

As there are no in-kernel users of old locomo driver, drop all
alltogether. Remove Kconfig entry, driver and header.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 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

diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index c3a4e9c..76c9970 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -9,9 +9,6 @@ config DMABOUNCE
 	bool
 	select ZONE_DMA
 
-config SHARP_LOCOMO
-	bool
-
 config SHARP_PARAM
 	bool
 
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 70b1eff..437c79a 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -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
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
deleted file mode 100644
index b55c362..0000000
--- a/arch/arm/common/locomo.c
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
- * linux/arch/arm/common/locomo.c
- *
- * Sharp LoCoMo support
- *
- * 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.
- *
- * Based on sa1111.c
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/ioport.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/spinlock.h>
-#include <linux/io.h>
-
-#include <mach/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach/irq.h>
-
-#include <asm/hardware/locomo.h>
-
-/* LoCoMo Interrupts */
-#define IRQ_LOCOMO_KEY		(0)
-#define IRQ_LOCOMO_GPIO		(1)
-#define IRQ_LOCOMO_LT		(2)
-#define IRQ_LOCOMO_SPI		(3)
-
-/* M62332 output channel selection */
-#define M62332_EVR_CH	1	/* M62332 volume channel number  */
-				/*   0 : CH.1 , 1 : CH. 2        */
-/* DAC send data */
-#define	M62332_SLAVE_ADDR	0x4e	/* Slave address  */
-#define	M62332_W_BIT		0x00	/* W bit (0 only) */
-#define	M62332_SUB_ADDR		0x00	/* Sub address    */
-#define	M62332_A_BIT		0x00	/* A bit (0 only) */
-
-/* DAC setup and hold times (expressed in us) */
-#define DAC_BUS_FREE_TIME	5	/*   4.7 us */
-#define DAC_START_SETUP_TIME	5	/*   4.7 us */
-#define DAC_STOP_SETUP_TIME	4	/*   4.0 us */
-#define DAC_START_HOLD_TIME	5	/*   4.7 us */
-#define DAC_SCL_LOW_HOLD_TIME	5	/*   4.7 us */
-#define DAC_SCL_HIGH_HOLD_TIME	4	/*   4.0 us */
-#define DAC_DATA_SETUP_TIME	1	/*   250 ns */
-#define DAC_DATA_HOLD_TIME	1	/*   300 ns */
-#define DAC_LOW_SETUP_TIME	1	/*   300 ns */
-#define DAC_HIGH_SETUP_TIME	1	/*  1000 ns */
-
-/* the following is the overall data for the locomo chip */
-struct locomo {
-	struct device *dev;
-	unsigned long phys;
-	unsigned int irq;
-	int irq_base;
-	spinlock_t lock;
-	void __iomem *base;
-#ifdef CONFIG_PM
-	void *saved_state;
-#endif
-};
-
-struct locomo_dev_info {
-	unsigned long	offset;
-	unsigned long	length;
-	unsigned int	devid;
-	unsigned int	irq[1];
-	const char *	name;
-};
-
-/* All the locomo devices.  If offset is non-zero, the mapbase for the
- * locomo_dev will be set to the chip base plus offset.  If offset is
- * zero, then the mapbase for the locomo_dev will be set to zero.  An
- * offset of zero means the device only uses GPIOs or other helper
- * functions inside this file */
-static struct locomo_dev_info locomo_devices[] = {
-	{
-		.devid 		= LOCOMO_DEVID_KEYBOARD,
-		.irq		= { IRQ_LOCOMO_KEY },
-		.name		= "locomo-keyboard",
-		.offset		= LOCOMO_KEYBOARD,
-		.length		= 16,
-	},
-	{
-		.devid		= LOCOMO_DEVID_FRONTLIGHT,
-		.irq		= {},
-		.name		= "locomo-frontlight",
-		.offset		= LOCOMO_FRONTLIGHT,
-		.length		= 8,
-
-	},
-	{
-		.devid		= LOCOMO_DEVID_BACKLIGHT,
-		.irq		= {},
-		.name		= "locomo-backlight",
-		.offset		= LOCOMO_BACKLIGHT,
-		.length		= 8,
-	},
-	{
-		.devid		= LOCOMO_DEVID_AUDIO,
-		.irq		= {},
-		.name		= "locomo-audio",
-		.offset		= LOCOMO_AUDIO,
-		.length		= 4,
-	},
-	{
-		.devid		= LOCOMO_DEVID_LED,
-		.irq 		= {},
-		.name		= "locomo-led",
-		.offset		= LOCOMO_LED,
-		.length		= 8,
-	},
-	{
-		.devid		= LOCOMO_DEVID_UART,
-		.irq		= {},
-		.name		= "locomo-uart",
-		.offset		= 0,
-		.length		= 0,
-	},
-	{
-		.devid		= LOCOMO_DEVID_SPI,
-		.irq		= {},
-		.name		= "locomo-spi",
-		.offset		= LOCOMO_SPI,
-		.length		= 0x30,
-	},
-};
-
-static void locomo_handler(unsigned int irq, struct irq_desc *desc)
-{
-	struct locomo *lchip = irq_get_chip_data(irq);
-	int req, i;
-
-	/* Acknowledge the parent IRQ */
-	desc->irq_data.chip->irq_ack(&desc->irq_data);
-
-	/* check why this interrupt was generated */
-	req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
-
-	if (req) {
-		/* generate the next interrupt(s) */
-		irq = lchip->irq_base;
-		for (i = 0; i <= 3; i++, irq++) {
-			if (req & (0x0100 << i)) {
-				generic_handle_irq(irq);
-			}
-
-		}
-	}
-}
-
-static void locomo_ack_irq(struct irq_data *d)
-{
-}
-
-static void locomo_mask_irq(struct irq_data *d)
-{
-	struct locomo *lchip = irq_data_get_irq_chip_data(d);
-	unsigned int r;
-	r = locomo_readl(lchip->base + LOCOMO_ICR);
-	r &= ~(0x0010 << (d->irq - lchip->irq_base));
-	locomo_writel(r, lchip->base + LOCOMO_ICR);
-}
-
-static void locomo_unmask_irq(struct irq_data *d)
-{
-	struct locomo *lchip = irq_data_get_irq_chip_data(d);
-	unsigned int r;
-	r = locomo_readl(lchip->base + LOCOMO_ICR);
-	r |= (0x0010 << (d->irq - lchip->irq_base));
-	locomo_writel(r, lchip->base + LOCOMO_ICR);
-}
-
-static struct irq_chip locomo_chip = {
-	.name		= "LOCOMO",
-	.irq_ack	= locomo_ack_irq,
-	.irq_mask	= locomo_mask_irq,
-	.irq_unmask	= locomo_unmask_irq,
-};
-
-static void locomo_setup_irq(struct locomo *lchip)
-{
-	int irq = lchip->irq_base;
-
-	/*
-	 * Install handler for IRQ_LOCOMO_HW.
-	 */
-	irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);
-	irq_set_chip_data(lchip->irq, lchip);
-	irq_set_chained_handler(lchip->irq, locomo_handler);
-
-	/* Install handlers for IRQ_LOCOMO_* */
-	for ( ; irq <= lchip->irq_base + 3; irq++) {
-		irq_set_chip_and_handler(irq, &locomo_chip, handle_level_irq);
-		irq_set_chip_data(irq, lchip);
-		set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
-	}
-}
-
-
-static void locomo_dev_release(struct device *_dev)
-{
-	struct locomo_dev *dev = LOCOMO_DEV(_dev);
-
-	kfree(dev);
-}
-
-static int
-locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
-{
-	struct locomo_dev *dev;
-	int ret;
-
-	dev = kzalloc(sizeof(struct locomo_dev), GFP_KERNEL);
-	if (!dev) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	/*
-	 * If the parent device has a DMA mask associated with it,
-	 * propagate it down to the children.
-	 */
-	if (lchip->dev->dma_mask) {
-		dev->dma_mask = *lchip->dev->dma_mask;
-		dev->dev.dma_mask = &dev->dma_mask;
-	}
-
-	dev_set_name(&dev->dev, "%s", info->name);
-	dev->devid	 = info->devid;
-	dev->dev.parent  = lchip->dev;
-	dev->dev.bus     = &locomo_bus_type;
-	dev->dev.release = locomo_dev_release;
-	dev->dev.coherent_dma_mask = lchip->dev->coherent_dma_mask;
-
-	if (info->offset)
-		dev->mapbase = lchip->base + info->offset;
-	else
-		dev->mapbase = 0;
-	dev->length = info->length;
-
-	dev->irq[0] = (lchip->irq_base == NO_IRQ) ?
-			NO_IRQ : lchip->irq_base + info->irq[0];
-
-	ret = device_register(&dev->dev);
-	if (ret) {
- out:
-		kfree(dev);
-	}
-	return ret;
-}
-
-#ifdef CONFIG_PM
-
-struct locomo_save_data {
-	u16	LCM_GPO;
-	u16	LCM_SPICT;
-	u16	LCM_GPE;
-	u16	LCM_ASD;
-	u16	LCM_SPIMD;
-};
-
-static int locomo_suspend(struct platform_device *dev, pm_message_t state)
-{
-	struct locomo *lchip = platform_get_drvdata(dev);
-	struct locomo_save_data *save;
-	unsigned long flags;
-
-	save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL);
-	if (!save)
-		return -ENOMEM;
-
-	lchip->saved_state = save;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-
-	save->LCM_GPO     = locomo_readl(lchip->base + LOCOMO_GPO);	/* GPIO */
-	locomo_writel(0x00, lchip->base + LOCOMO_GPO);
-	save->LCM_SPICT   = locomo_readl(lchip->base + LOCOMO_SPI + LOCOMO_SPICT);	/* SPI */
-	locomo_writel(0x40, lchip->base + LOCOMO_SPI + LOCOMO_SPICT);
-	save->LCM_GPE     = locomo_readl(lchip->base + LOCOMO_GPE);	/* GPIO */
-	locomo_writel(0x00, lchip->base + LOCOMO_GPE);
-	save->LCM_ASD     = locomo_readl(lchip->base + LOCOMO_ASD);	/* ADSTART */
-	locomo_writel(0x00, lchip->base + LOCOMO_ASD);
-	save->LCM_SPIMD   = locomo_readl(lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);	/* SPI */
-	locomo_writel(0x3C14, lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);
-
-	locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
-	locomo_writel(0x00, lchip->base + LOCOMO_DAC);
-	locomo_writel(0x00, lchip->base + LOCOMO_BACKLIGHT + LOCOMO_TC);
-
-	if ((locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) && (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88))
-		locomo_writel(0x00, lchip->base + LOCOMO_C32K); 	/* CLK32 off */
-	else
-		/* 18MHz already enabled, so no wait */
-		locomo_writel(0xc1, lchip->base + LOCOMO_C32K); 	/* CLK32 on */
-
-	locomo_writel(0x00, lchip->base + LOCOMO_TADC);		/* 18MHz clock off*/
-	locomo_writel(0x00, lchip->base + LOCOMO_AUDIO + LOCOMO_ACC);			/* 22MHz/24MHz clock off */
-	locomo_writel(0x00, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);			/* FL */
-
-	spin_unlock_irqrestore(&lchip->lock, flags);
-
-	return 0;
-}
-
-static int locomo_resume(struct platform_device *dev)
-{
-	struct locomo *lchip = platform_get_drvdata(dev);
-	struct locomo_save_data *save;
-	unsigned long r;
-	unsigned long flags;
-
-	save = lchip->saved_state;
-	if (!save)
-		return 0;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-
-	locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
-	locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPI + LOCOMO_SPICT);
-	locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
-	locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
-	locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPI + LOCOMO_SPIMD);
-
-	locomo_writel(0x00, lchip->base + LOCOMO_C32K);
-	locomo_writel(0x90, lchip->base + LOCOMO_TADC);
-
-	locomo_writel(0, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KSC);
-	r = locomo_readl(lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
-	r &= 0xFEFF;
-	locomo_writel(r, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
-	locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
-
-	spin_unlock_irqrestore(&lchip->lock, flags);
-
-	lchip->saved_state = NULL;
-	kfree(save);
-
-	return 0;
-}
-#endif
-
-
-/**
- *	locomo_probe - probe for a single LoCoMo chip.
- *	@phys_addr: physical address of device.
- *
- *	Probe for a LoCoMo chip.  This must be called
- *	before any other locomo-specific code.
- *
- *	Returns:
- *	%-ENODEV	device not found.
- *	%-EBUSY		physical address already marked in-use.
- *	%0		successful.
- */
-static int
-__locomo_probe(struct device *me, struct resource *mem, int irq)
-{
-	struct locomo_platform_data *pdata = me->platform_data;
-	struct locomo *lchip;
-	unsigned long r;
-	int i, ret = -ENODEV;
-
-	lchip = kzalloc(sizeof(struct locomo), GFP_KERNEL);
-	if (!lchip)
-		return -ENOMEM;
-
-	spin_lock_init(&lchip->lock);
-
-	lchip->dev = me;
-	dev_set_drvdata(lchip->dev, lchip);
-
-	lchip->phys = mem->start;
-	lchip->irq = irq;
-	lchip->irq_base = (pdata) ? pdata->irq_base : NO_IRQ;
-
-	/*
-	 * Map the whole region.  This also maps the
-	 * registers for our children.
-	 */
-	lchip->base = ioremap(mem->start, PAGE_SIZE);
-	if (!lchip->base) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
-	/* locomo initialize */
-	locomo_writel(0, lchip->base + LOCOMO_ICR);
-	/* KEYBOARD */
-	locomo_writel(0, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
-
-	/* GPIO */
-	locomo_writel(0, lchip->base + LOCOMO_GPO);
-	locomo_writel((LOCOMO_GPIO(1) | LOCOMO_GPIO(2) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
-			, lchip->base + LOCOMO_GPE);
-	locomo_writel((LOCOMO_GPIO(1) | LOCOMO_GPIO(2) | LOCOMO_GPIO(13) | LOCOMO_GPIO(14))
-			, lchip->base + LOCOMO_GPD);
-	locomo_writel(0, lchip->base + LOCOMO_GIE);
-
-	/* Frontlight */
-	locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
-	locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
-
-	/* Longtime timer */
-	locomo_writel(0, lchip->base + LOCOMO_LTINT);
-	/* SPI */
-	locomo_writel(0, lchip->base + LOCOMO_SPI + LOCOMO_SPIIE);
-
-	locomo_writel(6 + 8 + 320 + 30 - 10, lchip->base + LOCOMO_ASD);
-	r = locomo_readl(lchip->base + LOCOMO_ASD);
-	r |= 0x8000;
-	locomo_writel(r, lchip->base + LOCOMO_ASD);
-
-	locomo_writel(6 + 8 + 320 + 30 - 10 - 128 + 4, lchip->base + LOCOMO_HSD);
-	r = locomo_readl(lchip->base + LOCOMO_HSD);
-	r |= 0x8000;
-	locomo_writel(r, lchip->base + LOCOMO_HSD);
-
-	locomo_writel(128 / 8, lchip->base + LOCOMO_HSC);
-
-	/* XON */
-	locomo_writel(0x80, lchip->base + LOCOMO_TADC);
-	udelay(1000);
-	/* CLK9MEN */
-	r = locomo_readl(lchip->base + LOCOMO_TADC);
-	r |= 0x10;
-	locomo_writel(r, lchip->base + LOCOMO_TADC);
-	udelay(100);
-
-	/* init DAC */
-	r = locomo_readl(lchip->base + LOCOMO_DAC);
-	r |= LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
-	locomo_writel(r, lchip->base + LOCOMO_DAC);
-
-	r = locomo_readl(lchip->base + LOCOMO_VER);
-	printk(KERN_INFO "LoCoMo Chip: %lu%lu\n", (r >> 8), (r & 0xff));
-
-	/*
-	 * The interrupt controller must be initialised before any
-	 * other device to ensure that the interrupts are available.
-	 */
-	if (lchip->irq != NO_IRQ && lchip->irq_base != NO_IRQ)
-		locomo_setup_irq(lchip);
-
-	for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
-		locomo_init_one_child(lchip, &locomo_devices[i]);
-	return 0;
-
- out:
-	kfree(lchip);
-	return ret;
-}
-
-static int locomo_remove_child(struct device *dev, void *data)
-{
-	device_unregister(dev);
-	return 0;
-} 
-
-static void __locomo_remove(struct locomo *lchip)
-{
-	device_for_each_child(lchip->dev, NULL, locomo_remove_child);
-
-	if (lchip->irq != NO_IRQ) {
-		irq_set_chained_handler(lchip->irq, NULL);
-		irq_set_handler_data(lchip->irq, NULL);
-	}
-
-	iounmap(lchip->base);
-	kfree(lchip);
-}
-
-static int locomo_probe(struct platform_device *dev)
-{
-	struct resource *mem;
-	int irq;
-
-	mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -EINVAL;
-	irq = platform_get_irq(dev, 0);
-	if (irq < 0)
-		return -ENXIO;
-
-	return __locomo_probe(&dev->dev, mem, irq);
-}
-
-static int locomo_remove(struct platform_device *dev)
-{
-	struct locomo *lchip = platform_get_drvdata(dev);
-
-	if (lchip) {
-		__locomo_remove(lchip);
-		platform_set_drvdata(dev, NULL);
-	}
-
-	return 0;
-}
-
-/*
- *	Not sure if this should be on the system bus or not yet.
- *	We really want some way to register a system device at
- *	the per-machine level, and then have this driver pick
- *	up the registered devices.
- */
-static struct platform_driver locomo_device_driver = {
-	.probe		= locomo_probe,
-	.remove		= locomo_remove,
-#ifdef CONFIG_PM
-	.suspend	= locomo_suspend,
-	.resume		= locomo_resume,
-#endif
-	.driver		= {
-		.name	= "locomo",
-	},
-};
-
-/*
- *	Get the parent device driver (us) structure
- *	from a child function device
- */
-static inline struct locomo *locomo_chip_driver(struct locomo_dev *ldev)
-{
-	return (struct locomo *)dev_get_drvdata(ldev->dev.parent);
-}
-
-void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir)
-{
-	struct locomo *lchip = dev_get_drvdata(dev);
-	unsigned long flags;
-	unsigned int r;
-
-	if (!lchip)
-		return;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-
-	r = locomo_readl(lchip->base + LOCOMO_GPD);
-	if (dir)
-		r |= bits;
-	else
-		r &= ~bits;
-	locomo_writel(r, lchip->base + LOCOMO_GPD);
-
-	r = locomo_readl(lchip->base + LOCOMO_GPE);
-	if (dir)
-		r |= bits;
-	else
-		r &= ~bits;
-	locomo_writel(r, lchip->base + LOCOMO_GPE);
-
-	spin_unlock_irqrestore(&lchip->lock, flags);
-}
-EXPORT_SYMBOL(locomo_gpio_set_dir);
-
-int locomo_gpio_read_level(struct device *dev, unsigned int bits)
-{
-	struct locomo *lchip = dev_get_drvdata(dev);
-	unsigned long flags;
-	unsigned int ret;
-
-	if (!lchip)
-		return -ENODEV;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-	ret = locomo_readl(lchip->base + LOCOMO_GPL);
-	spin_unlock_irqrestore(&lchip->lock, flags);
-
-	ret &= bits;
-	return ret;
-}
-EXPORT_SYMBOL(locomo_gpio_read_level);
-
-int locomo_gpio_read_output(struct device *dev, unsigned int bits)
-{
-	struct locomo *lchip = dev_get_drvdata(dev);
-	unsigned long flags;
-	unsigned int ret;
-
-	if (!lchip)
-		return -ENODEV;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-	ret = locomo_readl(lchip->base + LOCOMO_GPO);
-	spin_unlock_irqrestore(&lchip->lock, flags);
-
-	ret &= bits;
-	return ret;
-}
-EXPORT_SYMBOL(locomo_gpio_read_output);
-
-void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set)
-{
-	struct locomo *lchip = dev_get_drvdata(dev);
-	unsigned long flags;
-	unsigned int r;
-
-	if (!lchip)
-		return;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-
-	r = locomo_readl(lchip->base + LOCOMO_GPO);
-	if (set)
-		r |= bits;
-	else
-		r &= ~bits;
-	locomo_writel(r, lchip->base + LOCOMO_GPO);
-
-	spin_unlock_irqrestore(&lchip->lock, flags);
-}
-EXPORT_SYMBOL(locomo_gpio_write);
-
-static void locomo_m62332_sendbit(void *mapbase, int bit)
-{
-	unsigned int r;
-
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SCLOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	udelay(DAC_DATA_HOLD_TIME);	/* 300 nsec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SCLOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
-
-	if (bit & 1) {
-		r = locomo_readl(mapbase + LOCOMO_DAC);
-		r |=  LOCOMO_DAC_SDAOEB;
-		locomo_writel(r, mapbase + LOCOMO_DAC);
-		udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	} else {
-		r = locomo_readl(mapbase + LOCOMO_DAC);
-		r &=  ~(LOCOMO_DAC_SDAOEB);
-		locomo_writel(r, mapbase + LOCOMO_DAC);
-		udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	}
-
-	udelay(DAC_DATA_SETUP_TIME);	/* 250 nsec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/*  4.0 usec */
-}
-
-void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel)
-{
-	struct locomo *lchip = locomo_chip_driver(ldev);
-	int i;
-	unsigned char data;
-	unsigned int r;
-	void *mapbase = lchip->base;
-	unsigned long flags;
-
-	spin_lock_irqsave(&lchip->lock, flags);
-
-	/* Start */
-	udelay(DAC_BUS_FREE_TIME);	/* 5.0 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.0 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SDAOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_START_HOLD_TIME);	/* 5.0 usec */
-	udelay(DAC_DATA_HOLD_TIME);	/* 300 nsec */
-
-	/* Send slave address and W bit (LSB is W bit) */
-	data = (M62332_SLAVE_ADDR << 1) | M62332_W_BIT;
-	for (i = 1; i <= 8; i++) {
-		locomo_m62332_sendbit(mapbase, data >> (8 - i));
-	}
-
-	/* Check A bit */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SCLOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SDAOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
-	if (locomo_readl(mapbase + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB) {	/* High is error */
-		printk(KERN_WARNING "locomo: m62332_senddata Error 1\n");
-		goto out;
-	}
-
-	/* Send Sub address (LSB is channel select) */
-	/*    channel = 0 : ch1 select              */
-	/*            = 1 : ch2 select              */
-	data = M62332_SUB_ADDR + channel;
-	for (i = 1; i <= 8; i++) {
-		locomo_m62332_sendbit(mapbase, data >> (8 - i));
-	}
-
-	/* Check A bit */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SCLOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SDAOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
-	if (locomo_readl(mapbase + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB) {	/* High is error */
-		printk(KERN_WARNING "locomo: m62332_senddata Error 2\n");
-		goto out;
-	}
-
-	/* Send DAC data */
-	for (i = 1; i <= 8; i++) {
-		locomo_m62332_sendbit(mapbase, dac_data >> (8 - i));
-	}
-
-	/* Check A bit */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SCLOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SDAOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
-	if (locomo_readl(mapbase + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB) {	/* High is error */
-		printk(KERN_WARNING "locomo: m62332_senddata Error 3\n");
-	}
-
-out:
-	/* stop */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r &=  ~(LOCOMO_DAC_SCLOEB);
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
-	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4 usec */
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SDAOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4 usec */
-
-	r = locomo_readl(mapbase + LOCOMO_DAC);
-	r |=  LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
-	locomo_writel(r, mapbase + LOCOMO_DAC);
-	udelay(DAC_LOW_SETUP_TIME);	/* 1000 nsec */
-	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
-
-	spin_unlock_irqrestore(&lchip->lock, flags);
-}
-EXPORT_SYMBOL(locomo_m62332_senddata);
-
-/*
- *	Frontlight control
- */
-
-void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf)
-{
-	unsigned long flags;
-	struct locomo *lchip = locomo_chip_driver(dev);
-
-	if (vr)
-		locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 1);
-	else
-		locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 0);
-
-	spin_lock_irqsave(&lchip->lock, flags);
-	locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
-	udelay(100);
-	locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
-	locomo_writel(bpwf | LOCOMO_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
-	spin_unlock_irqrestore(&lchip->lock, flags);
-}
-EXPORT_SYMBOL(locomo_frontlight_set);
-
-/*
- *	LoCoMo "Register Access Bus."
- *
- *	We model this as a regular bus type, and hang devices directly
- *	off this.
- */
-static int locomo_match(struct device *_dev, struct device_driver *_drv)
-{
-	struct locomo_dev *dev = LOCOMO_DEV(_dev);
-	struct locomo_driver *drv = LOCOMO_DRV(_drv);
-
-	return dev->devid == drv->devid;
-}
-
-static int locomo_bus_suspend(struct device *dev, pm_message_t state)
-{
-	struct locomo_dev *ldev = LOCOMO_DEV(dev);
-	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
-
-	if (drv && drv->suspend)
-		ret = drv->suspend(ldev, state);
-	return ret;
-}
-
-static int locomo_bus_resume(struct device *dev)
-{
-	struct locomo_dev *ldev = LOCOMO_DEV(dev);
-	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
-
-	if (drv && drv->resume)
-		ret = drv->resume(ldev);
-	return ret;
-}
-
-static int locomo_bus_probe(struct device *dev)
-{
-	struct locomo_dev *ldev = LOCOMO_DEV(dev);
-	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = -ENODEV;
-
-	if (drv->probe)
-		ret = drv->probe(ldev);
-	return ret;
-}
-
-static int locomo_bus_remove(struct device *dev)
-{
-	struct locomo_dev *ldev = LOCOMO_DEV(dev);
-	struct locomo_driver *drv = LOCOMO_DRV(dev->driver);
-	int ret = 0;
-
-	if (drv->remove)
-		ret = drv->remove(ldev);
-	return ret;
-}
-
-struct bus_type locomo_bus_type = {
-	.name		= "locomo-bus",
-	.match		= locomo_match,
-	.probe		= locomo_bus_probe,
-	.remove		= locomo_bus_remove,
-	.suspend	= locomo_bus_suspend,
-	.resume		= locomo_bus_resume,
-};
-
-int locomo_driver_register(struct locomo_driver *driver)
-{
-	driver->drv.bus = &locomo_bus_type;
-	return driver_register(&driver->drv);
-}
-EXPORT_SYMBOL(locomo_driver_register);
-
-void locomo_driver_unregister(struct locomo_driver *driver)
-{
-	driver_unregister(&driver->drv);
-}
-EXPORT_SYMBOL(locomo_driver_unregister);
-
-static int __init locomo_init(void)
-{
-	int ret = bus_register(&locomo_bus_type);
-	if (ret == 0)
-		platform_driver_register(&locomo_device_driver);
-	return ret;
-}
-
-static void __exit locomo_exit(void)
-{
-	platform_driver_unregister(&locomo_device_driver);
-	bus_unregister(&locomo_bus_type);
-}
-
-module_init(locomo_init);
-module_exit(locomo_exit);
-
-MODULE_DESCRIPTION("Sharp LoCoMo core driver");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("John Lenz <lenz-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>");
diff --git a/arch/arm/include/asm/hardware/locomo.h b/arch/arm/include/asm/hardware/locomo.h
deleted file mode 100644
index 74e51d6b..0000000
--- a/arch/arm/include/asm/hardware/locomo.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * arch/arm/include/asm/hardware/locomo.h
- *
- * This file contains the definitions for the LoCoMo G/A Chip
- *
- * (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
-
-#define locomo_writel(val,addr)	({ *(volatile u16 *)(addr) = (val); })
-#define locomo_readl(addr)	(*(volatile u16 *)(addr))
-
-/* LOCOMO version */
-#define LOCOMO_VER	0x00
-
-/* Pin status */
-#define LOCOMO_ST	0x04
-
-/* Pin status */
-#define LOCOMO_C32K	0x08
-
-/* Interrupt controller */
-#define LOCOMO_ICR	0x0C
-
-/* MCS decoder for boot selecting */
-#define LOCOMO_MCSX0	0x10
-#define LOCOMO_MCSX1	0x14
-#define LOCOMO_MCSX2	0x18
-#define LOCOMO_MCSX3	0x1c
-
-/* 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 */
-
-
-/* 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       */
-
-/* SPI interface */
-#define LOCOMO_SPI	0x60
-#define LOCOMO_SPIMD	0x00		/* SPI mode setting */
-#define LOCOMO_SPICT	0x04		/* SPI mode control */
-#define LOCOMO_SPIST	0x08		/* SPI status */
-#define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */
-#define	LOCOMO_SPI_REND	(1 << 2)	/* Receive end bit */
-#define	LOCOMO_SPI_RFW	(1 << 1)	/* write buffer bit */
-#define	LOCOMO_SPI_RFR	(1)		/* read buffer bit */
-
-#define LOCOMO_SPIIS	0x10		/* SPI interrupt status */
-#define LOCOMO_SPIWE	0x14		/* SPI interrupt status write enable */
-#define LOCOMO_SPIIE	0x18		/* SPI interrupt enable */
-#define LOCOMO_SPIIR	0x1c		/* SPI interrupt request */
-#define LOCOMO_SPITD	0x20		/* SPI transfer data write */
-#define LOCOMO_SPIRD	0x24		/* SPI receive data read */
-#define LOCOMO_SPITS	0x28		/* SPI transfer data shift */
-#define LOCOMO_SPIRS	0x2C		/* 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 */
-#define	LOCOMO_GPIO(Nb)		(0x01 << (Nb))
-#define LOCOMO_GPIO_RTS		LOCOMO_GPIO(0)
-#define LOCOMO_GPIO_CTS		LOCOMO_GPIO(1)
-#define LOCOMO_GPIO_DSR		LOCOMO_GPIO(2)
-#define LOCOMO_GPIO_DTR		LOCOMO_GPIO(3)
-#define LOCOMO_GPIO_LCD_VSHA_ON	LOCOMO_GPIO(4)
-#define LOCOMO_GPIO_LCD_VSHD_ON	LOCOMO_GPIO(5)
-#define LOCOMO_GPIO_LCD_VEE_ON	LOCOMO_GPIO(6)
-#define LOCOMO_GPIO_LCD_MOD	LOCOMO_GPIO(7)
-#define LOCOMO_GPIO_DAC_ON	LOCOMO_GPIO(8)
-#define LOCOMO_GPIO_FL_VR	LOCOMO_GPIO(9)
-#define LOCOMO_GPIO_DAC_SDATA	LOCOMO_GPIO(10)
-#define LOCOMO_GPIO_DAC_SCK	LOCOMO_GPIO(11)
-#define LOCOMO_GPIO_DAC_SLOAD	LOCOMO_GPIO(12)
-#define LOCOMO_GPIO_CARD_DETECT LOCOMO_GPIO(13)
-#define LOCOMO_GPIO_WRITE_PROT  LOCOMO_GPIO(14)
-#define LOCOMO_GPIO_CARD_POWER  LOCOMO_GPIO(15)
-
-/* Start the definitions of the devices.  Each device has an initial
- * base address and a series of offsets from that base address. */
-
-/* Keyboard controller */
-#define LOCOMO_KEYBOARD		0x40
-#define LOCOMO_KIB		0x00	/* KIB level */
-#define LOCOMO_KSC		0x04	/* KSTRB control */
-#define LOCOMO_KCMD		0x08	/* KSTRB command */
-#define LOCOMO_KIC		0x0c	/* Key interrupt */
-
-/* Front light adjustment controller */
-#define LOCOMO_FRONTLIGHT	0xc8
-#define LOCOMO_ALS		0x00	/* Adjust light cycle */
-#define LOCOMO_ALD		0x04	/* Adjust light duty */
-
-#define LOCOMO_ALC_EN		0x8000
-
-/* Backlight controller: TFT signal */
-#define LOCOMO_BACKLIGHT	0x38
-#define LOCOMO_TC		0x00		/* TFT control signal */
-#define LOCOMO_CPSD		0x04		/* CPS delay */
-
-/* Audio controller */
-#define LOCOMO_AUDIO		0x54
-#define LOCOMO_ACC		0x00	/* Audio clock */
-#define LOCOMO_PAIF		0xD0	/* PCM audio interface */
-/* 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 */
-/* 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
-
-/* LED controller */
-#define LOCOMO_LED		0xe8
-#define LOCOMO_LPT0		0x00
-#define LOCOMO_LPT1		0x04
-/* LED control */
-#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))
-
-extern struct bus_type locomo_bus_type;
-
-#define LOCOMO_DEVID_KEYBOARD	0
-#define LOCOMO_DEVID_FRONTLIGHT	1
-#define LOCOMO_DEVID_BACKLIGHT	2
-#define LOCOMO_DEVID_AUDIO	3
-#define LOCOMO_DEVID_LED	4
-#define LOCOMO_DEVID_UART	5
-#define LOCOMO_DEVID_SPI	6
-
-struct locomo_dev {
-	struct device	dev;
-	unsigned int	devid;
-	unsigned int	irq[1];
-
-	void		*mapbase;
-	unsigned long	length;
-
-	u64		dma_mask;
-};
-
-#define LOCOMO_DEV(_d)	container_of((_d), struct locomo_dev, dev)
-
-#define locomo_get_drvdata(d)	dev_get_drvdata(&(d)->dev)
-#define locomo_set_drvdata(d,p)	dev_set_drvdata(&(d)->dev, p)
-
-struct locomo_driver {
-	struct device_driver	drv;
-	unsigned int		devid;
-	int (*probe)(struct locomo_dev *);
-	int (*remove)(struct locomo_dev *);
-	int (*suspend)(struct locomo_dev *, pm_message_t);
-	int (*resume)(struct locomo_dev *);
-};
-
-#define LOCOMO_DRV(_d)	container_of((_d), struct locomo_driver, drv)
-
-#define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name)
-
-void locomo_lcd_power(struct locomo_dev *, int, unsigned int);
-
-int locomo_driver_register(struct locomo_driver *);
-void locomo_driver_unregister(struct locomo_driver *);
-
-/* GPIO control functions */
-void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir);
-int locomo_gpio_read_level(struct device *dev, unsigned int bits);
-int locomo_gpio_read_output(struct device *dev, unsigned int bits);
-void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
-
-/* M62332 control function */
-void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
-
-/* Frontlight control */
-void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf);
-
-struct locomo_platform_data {
-	int	irq_base;	/* IRQ base for cascaded on-chip IRQs */
-};
-
-#endif
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 14/15] gpio: locomo: implement per-pin irq handling
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2014-10-28  0:02   ` [PATCH 13/15] ARM: drop old LoCoMo driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:02   ` Dmitry Eremin-Solenikov
  2014-10-31  8:00     ` Linus Walleij
  2014-10-28  0:02   ` [PATCH 15/15] spi: add locomo SPI driver Dmitry Eremin-Solenikov
  5 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

LoCoMo 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.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/gpio/gpio-locomo.c | 158 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 158 insertions(+)

diff --git a/drivers/gpio/gpio-locomo.c b/drivers/gpio/gpio-locomo.c
index 3b54b07..6ef0fc4 100644
--- a/drivers/gpio/gpio-locomo.c
+++ b/drivers/gpio/gpio-locomo.c
@@ -18,13 +18,18 @@
 #include <linux/gpio.h>
 #include <linux/io.h>
 #include <linux/spinlock.h>
+#include <linux/irq.h>
 #include <linux/mfd/locomo.h>
 
+#define LOCOMO_GPIO_NR_IRQS 16
+
 struct locomo_gpio {
 	void __iomem *regs;
+	int irq;
 
 	spinlock_t lock;
 	struct gpio_chip gpio;
+	int irq_base;
 
 	u16 rising_edge;
 	u16 falling_edge;
@@ -114,6 +119,148 @@ static int locomo_gpio_direction_output(struct gpio_chip *chip,
 	return 0;
 }
 
+static int locomo_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+	struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
+
+	return lg->irq_base + offset;
+}
+
+static void
+locomo_gpio_handler(unsigned int irq, struct irq_desc *desc)
+{
+	u16 req;
+	struct locomo_gpio *lg = irq_get_handler_data(irq);
+	int i = lg->irq_base;
+
+	req = readw(lg->regs + LOCOMO_GIR) &
+	      readw(lg->regs + LOCOMO_GPD);
+
+	while (req) {
+		if (req & 1)
+			generic_handle_irq(i);
+		req >>= 1;
+		i++;
+	}
+}
+
+static void locomo_gpio_ack_irq(struct irq_data *d)
+{
+	struct locomo_gpio *lg = irq_data_get_irq_chip_data(d);
+	unsigned long flags;
+	u16 r;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	r = readw(lg->regs + LOCOMO_GWE);
+	r |= (0x0001 << (d->irq - lg->irq_base));
+	writew(r, lg->regs + LOCOMO_GWE);
+
+	r = readw(lg->regs + LOCOMO_GIS);
+	r &= ~(0x0001 << (d->irq - lg->irq_base));
+	writew(r, lg->regs + LOCOMO_GIS);
+
+	r = readw(lg->regs + LOCOMO_GWE);
+	r &= ~(0x0001 << (d->irq - lg->irq_base));
+	writew(r, lg->regs + LOCOMO_GWE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+}
+
+static void locomo_gpio_mask_irq(struct irq_data *d)
+{
+	struct locomo_gpio *lg = irq_data_get_irq_chip_data(d);
+	unsigned long flags;
+	u16 r;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	r = readw(lg->regs + LOCOMO_GIE);
+	r &= ~(0x0001 << (d->irq - lg->irq_base));
+	writew(r, lg->regs + LOCOMO_GIE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+}
+
+static void locomo_gpio_unmask_irq(struct irq_data *d)
+{
+	struct locomo_gpio *lg = irq_data_get_irq_chip_data(d);
+	unsigned long flags;
+	u16 r;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	r = readw(lg->regs + LOCOMO_GIE);
+	r |= (0x0001 << (d->irq - lg->irq_base));
+	writew(r, lg->regs + LOCOMO_GIE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+}
+
+static int locomo_gpio_type(struct irq_data *d, unsigned int type)
+{
+	unsigned int mask;
+	struct locomo_gpio *lg = irq_data_get_irq_chip_data(d);
+	unsigned long flags;
+
+	mask = 1 << (d->irq - lg->irq_base);
+
+	if (type == IRQ_TYPE_PROBE) {
+		if ((lg->rising_edge | lg->falling_edge) & mask)
+			return 0;
+		type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
+	}
+
+	if (type & IRQ_TYPE_EDGE_RISING)
+		lg->rising_edge |= mask;
+	else
+		lg->rising_edge &= ~mask;
+	if (type & IRQ_TYPE_EDGE_FALLING)
+		lg->falling_edge |= mask;
+	else
+		lg->falling_edge &= ~mask;
+
+	spin_lock_irqsave(&lg->lock, flags);
+
+	writew(lg->rising_edge, lg->regs + LOCOMO_GRIE);
+	writew(lg->falling_edge, lg->regs + LOCOMO_GFIE);
+
+	spin_unlock_irqrestore(&lg->lock, flags);
+
+	return 0;
+}
+
+static struct irq_chip locomo_gpio_chip = {
+	.name		= "LOCOMO-gpio",
+	.irq_ack	= locomo_gpio_ack_irq,
+	.irq_mask	= locomo_gpio_mask_irq,
+	.irq_unmask	= locomo_gpio_unmask_irq,
+	.irq_set_type	= locomo_gpio_type,
+};
+
+static void locomo_gpio_setup_irq(struct locomo_gpio *lg)
+{
+	int irq;
+
+	lg->irq_base = irq_alloc_descs(-1, 0, LOCOMO_GPIO_NR_IRQS, -1);
+
+	/* Install handlers for IRQ_LOCOMO_* */
+	for (irq = lg->irq_base;
+			irq < lg->irq_base + LOCOMO_GPIO_NR_IRQS;
+			irq++) {
+		irq_set_chip_and_handler(irq, &locomo_gpio_chip,
+				handle_edge_irq);
+		irq_set_chip_data(irq, lg);
+		set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
+	}
+
+	/*
+	 * Install handler for IRQ_LOCOMO_HW.
+	 */
+	irq_set_handler_data(lg->irq, lg);
+	irq_set_chained_handler(lg->irq, locomo_gpio_handler);
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int locomo_gpio_suspend(struct device *dev)
 {
@@ -169,6 +316,10 @@ static int locomo_gpio_probe(struct platform_device *pdev)
 	if (!lg)
 		return -ENOMEM;
 
+	lg->irq = platform_get_irq(pdev, 0);
+	if (lg->irq < 0)
+		return -ENXIO;
+
 	lg->regs = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(lg->regs))
 		return PTR_ERR(lg->regs);
@@ -189,11 +340,14 @@ static int locomo_gpio_probe(struct platform_device *pdev)
 	lg->gpio.get = locomo_gpio_get;
 	lg->gpio.direction_input = locomo_gpio_direction_input;
 	lg->gpio.direction_output = locomo_gpio_direction_output;
+	lg->gpio.to_irq = locomo_gpio_to_irq;
 
 	ret = gpiochip_add(&lg->gpio);
 	if (ret)
 		return ret;
 
+	locomo_gpio_setup_irq(lg);
+
 	return 0;
 }
 
@@ -208,6 +362,10 @@ static int locomo_gpio_remove(struct platform_device *pdev)
 		return ret;
 	}
 
+	irq_set_chained_handler(lg->irq, NULL);
+	irq_set_handler_data(lg->irq, NULL);
+	irq_free_descs(lg->irq_base, LOCOMO_GPIO_NR_IRQS);
+
 	return 0;
 }
 
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* [PATCH 15/15] spi: add locomo SPI driver
       [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (4 preceding siblings ...)
  2014-10-28  0:02   ` [PATCH 14/15] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
@ 2014-10-28  0:02   ` Dmitry Eremin-Solenikov
       [not found]     ` <1414454528-24240-16-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  5 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:02 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw
  Cc: Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

LoCoMo chip has a built-in simple SPI controller. On Sharp SL-5500 PDDAs
it is connected to external MMC slot.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/Kconfig        |   8 +
 drivers/spi/Makefile       |   1 +
 drivers/spi/spi-locomo.c   | 370 +++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/locomo.h |  30 ++++
 4 files changed, 409 insertions(+)
 create mode 100644 drivers/spi/spi-locomo.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 84e7c9e..1395780 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -242,6 +242,14 @@ 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
+	select SPI_BITBANG
+	help
+	  This enables using the SPI controller as present in the LoCoMo
+	  chips. It is probably only usefull on the Sharp SL-5x00 PDA family.
+
 config SPI_MPC52xx
 	tristate "Freescale MPC52xx SPI (non-PSC) controller support"
 	depends on PPC_MPC52xx
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 78f24ca..4f96197 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_SPI_FSL_SPI)		+= spi-fsl-spi.o
 obj-$(CONFIG_SPI_GPIO)			+= spi-gpio.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_MPC512x_PSC)		+= spi-mpc512x-psc.o
 obj-$(CONFIG_SPI_MPC52xx_PSC)		+= spi-mpc52xx-psc.o
 obj-$(CONFIG_SPI_MPC52xx)		+= spi-mpc52xx.o
diff --git a/drivers/spi/spi-locomo.c b/drivers/spi/spi-locomo.c
new file mode 100644
index 0000000..8e9e5c4
--- /dev/null
+++ b/drivers/spi/spi-locomo.c
@@ -0,0 +1,370 @@
+/*
+ * 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; version 2 of the License.
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_bitbang.h>
+#include <linux/mfd/locomo.h>
+#include <linux/delay.h>
+
+struct locomospi_dev {
+	struct spi_bitbang bitbang;
+	void __iomem *base;
+	int clock_base;
+	int clock_div;
+
+	u16 save_ct;
+	u16 save_md;
+};
+
+static void locomospi_reg_open(struct locomospi_dev *spidev)
+{
+	u16 r;
+
+	spidev->clock_div = DIV_64;
+	spidev->clock_base = CLOCK_18MHZ;
+	writew(LOCOMO_SPIMD_MSB1ST | LOCOMO_SPIMD_DOSTAT | LOCOMO_SPIMD_RCPOL |
+		  LOCOMO_SPIMD_TCPOL | (spidev->clock_base << 3) |
+		  spidev->clock_div,
+		  spidev->base + LOCOMO_SPIMD);
+
+	/* if (locomospi_carddetect()) { */
+	r = readw(spidev->base + LOCOMO_SPIMD);
+	r |= LOCOMO_SPIMD_XON;
+	writew(r, spidev->base + LOCOMO_SPIMD);
+
+	r = readw(spidev->base + LOCOMO_SPIMD);
+	r |= LOCOMO_SPIMD_XEN;
+	writew(r, spidev->base + LOCOMO_SPIMD);
+	/* } */
+
+	writew(LOCOMO_SPICT_CS, spidev->base + LOCOMO_SPICT);
+
+	r = readw(spidev->base + LOCOMO_SPICT);
+	r |= (LOCOMO_SPICT_CEN | LOCOMO_SPICT_RXUEN | LOCOMO_SPICT_ALIGNEN);
+	writew(r, spidev->base + LOCOMO_SPICT);
+
+	udelay(200);
+
+	r = readw(spidev->base + LOCOMO_SPICT);
+	writew(r, spidev->base + LOCOMO_SPICT);
+
+	r = readw(spidev->base + LOCOMO_SPICT);
+	r &= ~LOCOMO_SPICT_CS;
+	writew(r, spidev->base + LOCOMO_SPICT);
+}
+
+static void locomospi_reg_release(struct locomospi_dev *spidev)
+{
+	u16 r;
+
+	r = readw(spidev->base + LOCOMO_SPICT);
+	r &= ~LOCOMO_SPICT_CEN;
+	writew(r, spidev->base + LOCOMO_SPICT);
+
+	r = readw(spidev->base + LOCOMO_SPIMD);
+	r &= ~LOCOMO_SPIMD_XEN;
+	writew(r, spidev->base + LOCOMO_SPIMD);
+
+	r = readw(spidev->base + LOCOMO_SPIMD);
+	r &= ~LOCOMO_SPIMD_XON;
+	writew(r, spidev->base + LOCOMO_SPIMD);
+
+	r = readw(spidev->base + LOCOMO_SPICT);
+	r |= LOCOMO_SPIMD_XEN; /* FIXME */
+	writew(r, spidev->base + LOCOMO_SPICT);
+}
+
+
+static void locomospi_chipselect(struct spi_device *spi, int is_active)
+{
+	struct locomospi_dev *spidev;
+	u16 r;
+
+	dev_dbg(&spi->dev, "SPI cs: %d\n", is_active);
+
+	spidev = spi_master_get_devdata(spi->master);
+
+	r = readw(spidev->base + LOCOMO_SPICT);
+	if (!!is_active ^ !!(spi->mode & SPI_CS_HIGH))
+		r &= ~LOCOMO_SPICT_CS;
+	else
+		r |= LOCOMO_SPICT_CS;
+	writew(r, spidev->base + LOCOMO_SPICT);
+}
+
+static u32 locomospi_txrx_word(struct spi_device *spi,
+		unsigned nsecs,
+		u32 word, u8 bits)
+{
+	struct locomospi_dev *spidev;
+	int wait;
+	int j;
+	u32 rx;
+
+	spidev = spi_master_get_devdata(spi->master);
+
+	if (spidev->clock_div == 4)
+		wait = 0x10000;
+	else
+		wait = 8;
+
+	for (j = 0; j < wait; j++) {
+		if (readw(spidev->base + LOCOMO_SPIST) & LOCOMO_SPI_RFW)
+			break;
+	}
+
+	writeb(word, spidev->base + LOCOMO_SPITD);
+	ndelay(nsecs);
+
+	for (j = 0; j < wait; j++) {
+		if (readw(spidev->base + LOCOMO_SPIST) & LOCOMO_SPI_RFR)
+			break;
+	}
+
+	rx = readb(spidev->base + LOCOMO_SPIRD);
+	ndelay(nsecs);
+
+	dev_dbg(&spi->dev, "SPI txrx: %02x/%02x\n", word, rx);
+
+	return rx;
+}
+
+static void locomo_spi_set_speed(struct locomospi_dev *spidev, u32 hz)
+{
+	u16 r;
+
+	if (hz >= 24576000) {
+		spidev->clock_base = CLOCK_25MHZ;
+		spidev->clock_div = DIV_1;
+	} else if (hz >= 22579200) {
+		spidev->clock_base = CLOCK_22MHZ;
+		spidev->clock_div = DIV_1;
+	} else if (hz >= 18432000) {
+		spidev->clock_base = CLOCK_18MHZ;
+		spidev->clock_div = DIV_1;
+	} else if (hz >= 12288000) {
+		spidev->clock_base = CLOCK_25MHZ;
+		spidev->clock_div = DIV_2;
+	} else if (hz >= 11289600) {
+		spidev->clock_base = CLOCK_22MHZ;
+		spidev->clock_div = DIV_2;
+	} else if (hz >= 9216000) {
+		spidev->clock_base = CLOCK_18MHZ;
+		spidev->clock_div = DIV_2;
+	} else if (hz >= 6144000) {
+		spidev->clock_base = CLOCK_25MHZ;
+		spidev->clock_div = DIV_4;
+	} else if (hz >= 5644800) {
+		spidev->clock_base = CLOCK_22MHZ;
+		spidev->clock_div = DIV_4;
+	} else if (hz >= 4608000) {
+		spidev->clock_base = CLOCK_18MHZ;
+		spidev->clock_div = DIV_4;
+	} else if (hz >= 3072000) {
+		spidev->clock_base = CLOCK_25MHZ;
+		spidev->clock_div = DIV_8;
+	} else if (hz >= 2822400) {
+		spidev->clock_base = CLOCK_22MHZ;
+		spidev->clock_div = DIV_8;
+	} else if (hz >= 2304000) {
+		spidev->clock_base = CLOCK_18MHZ;
+		spidev->clock_div = DIV_8;
+	} else if (hz >= 384000) {
+		spidev->clock_base = CLOCK_25MHZ;
+		spidev->clock_div = DIV_64;
+	} else if (hz >= 352800) {
+		spidev->clock_base = CLOCK_22MHZ;
+		spidev->clock_div = DIV_64;
+	} else {		/* set to 288 Khz */
+		spidev->clock_base = CLOCK_18MHZ;
+		spidev->clock_div = DIV_64;
+	}
+
+	r = readw(spidev->base + LOCOMO_SPIMD);
+	if ((r & LOCOMO_SPIMD_CLKSEL) == spidev->clock_div &&
+			(r & LOCOMO_SPIMD_XSEL) == (spidev->clock_div << 3))
+		return;
+
+	r &= ~(LOCOMO_SPIMD_XSEL | LOCOMO_SPIMD_CLKSEL | LOCOMO_SPIMD_XEN);
+	writew(r, spidev->base + LOCOMO_SPIMD);
+
+	r |= (spidev->clock_div | (spidev->clock_base << 3) | LOCOMO_SPIMD_XEN);
+	writew(r, spidev->base + LOCOMO_SPIMD);
+
+	udelay(300);
+}
+
+static int locomo_spi_setup_transfer(struct spi_device *spi,
+		struct spi_transfer *t)
+{
+	struct locomospi_dev *spidev;
+	u16 r;
+	u32 hz = 0;
+	int rc = spi_bitbang_setup_transfer(spi, t);
+
+	if (rc)
+		return rc;
+
+	if (t)
+		hz = t->speed_hz;
+	if (!hz)
+		hz = spi->max_speed_hz;
+
+	spidev = spi_master_get_devdata(spi->master);
+
+	r = readw(spidev->base + LOCOMO_SPIMD);
+	if (hz == 0) {
+		r &= ~LOCOMO_SPIMD_XON;
+		writew(r, spidev->base + LOCOMO_SPIMD);
+	} else {
+		r |= LOCOMO_SPIMD_XON;
+		writew(r, spidev->base + LOCOMO_SPIMD);
+		locomo_spi_set_speed(spidev, hz);
+	}
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int locomo_spi_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct locomospi_dev *spidev = spi_master_get_devdata(master);
+	int ret;
+
+	/* Stop the queue running */
+	ret = spi_master_suspend(master);
+	if (ret) {
+		dev_warn(dev, "cannot suspend master\n");
+		return ret;
+	}
+
+	spidev->save_ct = readw(spidev->base + LOCOMO_SPICT);
+	writew(0x40, spidev->base + LOCOMO_SPICT);
+
+	spidev->save_md = readw(spidev->base + LOCOMO_SPIMD);
+	writew(0x3c14, spidev->base + LOCOMO_SPIMD);
+
+	return 0;
+}
+
+static int locomo_spi_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct locomospi_dev *spidev = spi_master_get_devdata(master);
+	int ret;
+
+	writew(spidev->save_ct, spidev->base + LOCOMO_SPICT);
+	writew(spidev->save_md, spidev->base + LOCOMO_SPIMD);
+
+	/* Start the queue running */
+	ret = spi_master_resume(master);
+	if (ret)
+		dev_err(dev, "problem starting queue (%d)\n", ret);
+
+	return ret;
+}
+
+static SIMPLE_DEV_PM_OPS(locomo_spi_pm_ops,
+		locomo_spi_suspend, locomo_spi_resume);
+
+#define LOCOMO_SPI_PM_OPS	(&locomo_spi_pm_ops)
+#else
+#define LOCOMO_SPI_PM_OPS	NULL
+#endif
+
+static int locomo_spi_probe(struct platform_device *pdev)
+{
+	struct resource *res;
+	struct spi_master *master;
+	struct locomospi_dev *spidev;
+	int ret;
+
+	dev_info(&pdev->dev, "LoCoO SPI Driver\n");
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	master = spi_alloc_master(&pdev->dev, sizeof(struct locomospi_dev));
+	if (!master)
+		return -ENOMEM;
+
+	platform_set_drvdata(pdev, master);
+
+	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 8);
+	master->bus_num = 0;
+	master->num_chipselect = 1;
+
+	spidev = spi_master_get_devdata(master);
+	spidev->bitbang.master = spi_master_get(master);
+
+	spidev->bitbang.setup_transfer = locomo_spi_setup_transfer;
+	spidev->bitbang.chipselect = locomospi_chipselect;
+	spidev->bitbang.txrx_word[SPI_MODE_0] = locomospi_txrx_word;
+	spidev->bitbang.txrx_word[SPI_MODE_1] = locomospi_txrx_word;
+	spidev->bitbang.txrx_word[SPI_MODE_2] = locomospi_txrx_word;
+	spidev->bitbang.txrx_word[SPI_MODE_3] = locomospi_txrx_word;
+
+	spidev->bitbang.master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
+
+	spidev->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(spidev->base)) {
+		ret = PTR_ERR(spidev->base);
+		goto out_put;
+	}
+
+	locomospi_reg_open(spidev);
+
+	ret = spi_bitbang_start(&spidev->bitbang);
+	if (ret) {
+		dev_err(&pdev->dev, "bitbang start failed with %d\n", ret);
+		goto out_put;
+	}
+
+	return 0;
+
+out_put:
+	spi_master_put(master);
+	return ret;
+}
+
+static int locomo_spi_remove(struct platform_device *pdev)
+{
+	struct spi_master *master = platform_get_drvdata(pdev);
+	struct locomospi_dev *spidev = spi_master_get_devdata(master);
+
+	spi_bitbang_stop(&spidev->bitbang);
+	locomospi_reg_release(spidev);
+	spi_master_put(master);
+
+
+	return 0;
+}
+
+static struct platform_driver locomo_spi_driver = {
+	.probe = locomo_spi_probe,
+	.remove = locomo_spi_remove,
+	.driver = {
+		.name = "locomo-spi",
+		.owner = THIS_MODULE,
+		.pm	= LOCOMO_SPI_PM_OPS,
+	},
+};
+module_platform_driver(locomo_spi_driver);
+
+MODULE_AUTHOR("Thomas Kunze thommy-Pp6lxjB34Lw@public.gmane.org");
+MODULE_DESCRIPTION("LoCoMo SPI driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:locomo-spi");
diff --git a/include/linux/mfd/locomo.h b/include/linux/mfd/locomo.h
index 1f54300..f822d77 100644
--- a/include/linux/mfd/locomo.h
+++ b/include/linux/mfd/locomo.h
@@ -53,7 +53,37 @@
 /* SPI interface */
 #define LOCOMO_SPI	0x60
 #define LOCOMO_SPIMD	0x00		/* SPI mode setting */
+#define LOCOMO_SPIMD_LOOPBACK (1 << 15)	/* loopback tx to rx */
+#define LOCOMO_SPIMD_MSB1ST   (1 << 14)	/* send MSB first */
+#define LOCOMO_SPIMD_DOSTAT   (1 << 13)	/* transmit line is idle high */
+#define LOCOMO_SPIMD_TCPOL    (1 << 11)	/* transmit CPOL (maybe affects CPHA too) */
+#define LOCOMO_SPIMD_RCPOL    (1 << 10)	/* receive CPOL (maybe affects CPHA too) */
+#define	LOCOMO_SPIMD_TDINV    (1 << 9)	/* invert transmit line */
+#define LOCOMO_SPIMD_RDINV    (1 << 8)	/* invert receive line */
+#define LOCOMO_SPIMD_XON      (1 << 7)	/* enable spi controller clock */
+#define LOCOMO_SPIMD_XEN      (1 << 6)	/* clock bit write enable xon must be off, wait 300 us before xon->1 */
+#define LOCOMO_SPIMD_XSEL     0x0018	/* clock select */
+#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	0x04		/* SPI mode control */
+#define LOCOMO_SPICT_CRC16_7_B	(1 << 15)	/* 0: crc16 1: crc7 */
+#define LOCOMO_SPICT_CRCRX_TX_B	(1 << 14)
+#define LOCOMO_SPICT_CRCRESET_B	(1 << 13)
+#define LOCOMO_SPICT_CEN	(1 << 7)	/* ?? enable */
+#define LOCOMO_SPICT_CS		(1 << 6)	/* chip select */
+#define LOCOMO_SPICT_UNIT16	(1 << 5)	/* 0: 8 bit units, 1: 16 bit unit */
+#define LOCOMO_SPICT_ALIGNEN	(1 << 2)	/* align transfer enable */
+#define LOCOMO_SPICT_RXWEN	(1 << 1)	/* continous receive */
+#define LOCOMO_SPICT_RXUEN	(1 << 0)	/* aligned receive */
+
 #define LOCOMO_SPIST	0x08		/* SPI status */
 #define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */
 #define	LOCOMO_SPI_REND	(1 << 2)	/* Receive end bit */
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 54+ messages in thread

* Re: [PATCH 04/15] input: convert LoCoMo keyboard driver to use new locomo core
  2014-10-28  0:01   ` [PATCH 04/15] input: convert LoCoMo keyboard driver to use " Dmitry Eremin-Solenikov
@ 2014-10-28  0:09     ` Dmitry Torokhov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Torokhov @ 2014-10-28  0:09 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Bryan Wu, Richard Purdie, Samuel Ortiz, Lee Jones, Mark Brown,
	Jingoo Han, Liam Girdwood

On Tue, Oct 28, 2014 at 03:01:57AM +0300, Dmitry Eremin-Solenikov wrote:
> As LoCoMo is switching to new device model, adapt keyboard driver to
> support new locomo core driver.
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/input/keyboard/Kconfig     |   1 -
>  drivers/input/keyboard/locomokbd.c | 165 ++++++++++++++++++++-----------------
>  2 files changed, 91 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index a3958c6..b660516 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -337,7 +337,6 @@ config KEYBOARD_LM8333
>  
>  config KEYBOARD_LOCOMO
>  	tristate "LoCoMo Keyboard Support"
> -	depends on SHARP_LOCOMO
>  	help
>  	  Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA
>  
> diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
> index c94d610..c2fabf3 100644
> --- a/drivers/input/keyboard/locomokbd.c
> +++ b/drivers/input/keyboard/locomokbd.c
> @@ -28,16 +28,10 @@
>  #include <linux/init.h>
>  #include <linux/input.h>
>  #include <linux/delay.h>
> -#include <linux/device.h>
> +#include <linux/platform_device.h>
>  #include <linux/interrupt.h>
> -#include <linux/ioport.h>
> -
> -#include <asm/hardware/locomo.h>
> -#include <asm/irq.h>
> -
> -MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>");
> -MODULE_DESCRIPTION("LoCoMo keyboard driver");
> -MODULE_LICENSE("GPL");
> +#include <linux/io.h>
> +#include <linux/mfd/locomo.h>
>  
>  #define LOCOMOKBD_NUMKEYS	128
>  
> @@ -75,7 +69,8 @@ struct locomokbd {
>  	struct input_dev *input;
>  	char phys[32];
>  
> -	unsigned long base;
> +	void __iomem *base;
> +	int irq;
>  	spinlock_t lock;
>  
>  	struct timer_list timer;
> @@ -84,37 +79,37 @@ struct locomokbd {
>  };
>  
>  /* helper functions for reading the keyboard matrix */
> -static inline void locomokbd_charge_all(unsigned long membase)
> +static inline void locomokbd_charge_all(void __iomem *membase)
>  {
> -	locomo_writel(0x00FF, membase + LOCOMO_KSC);
> +	writew(0x00FF, membase + LOCOMO_KSC);
>  }
>  
> -static inline void locomokbd_activate_all(unsigned long membase)
> +static inline void locomokbd_activate_all(void __iomem *membase)
>  {
>  	unsigned long r;
>  
> -	locomo_writel(0, membase + LOCOMO_KSC);
> -	r = locomo_readl(membase + LOCOMO_KIC);
> +	writew(0, membase + LOCOMO_KSC);
> +	r = readw(membase + LOCOMO_KIC);
>  	r &= 0xFEFF;
> -	locomo_writel(r, membase + LOCOMO_KIC);
> +	writew(r, membase + LOCOMO_KIC);
>  }
>  
> -static inline void locomokbd_activate_col(unsigned long membase, int col)
> +static inline void locomokbd_activate_col(void __iomem *membase, int col)
>  {
>  	unsigned short nset;
>  	unsigned short nbset;
>  
>  	nset = 0xFF & ~(1 << col);
>  	nbset = (nset << 8) + nset;
> -	locomo_writel(nbset, membase + LOCOMO_KSC);
> +	writew(nbset, membase + LOCOMO_KSC);
>  }
>  
> -static inline void locomokbd_reset_col(unsigned long membase, int col)
> +static inline void locomokbd_reset_col(void __iomem *membase, int col)
>  {
>  	unsigned short nbset;
>  
>  	nbset = ((0xFF & ~(1 << col)) << 8) + 0xFF;
> -	locomo_writel(nbset, membase + LOCOMO_KSC);
> +	writew(nbset, membase + LOCOMO_KSC);
>  }
>  
>  /*
> @@ -129,7 +124,7 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
>  	unsigned int row, col, rowd;
>  	unsigned long flags;
>  	unsigned int num_pressed;
> -	unsigned long membase = locomokbd->base;
> +	void __iomem *membase = locomokbd->base;
>  
>  	spin_lock_irqsave(&locomokbd->lock, flags);
>  
> @@ -141,7 +136,7 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
>  		locomokbd_activate_col(membase, col);
>  		udelay(KB_DELAY);
>  
> -		rowd = ~locomo_readl(membase + LOCOMO_KIB);
> +		rowd = ~readw(membase + LOCOMO_KIB);
>  		for (row = 0; row < KB_ROWS; row++) {
>  			unsigned int scancode, pressed, key;
>  
> @@ -194,11 +189,11 @@ static irqreturn_t locomokbd_interrupt(int irq, void *dev_id)
>  	struct locomokbd *locomokbd = dev_id;
>  	u16 r;
>  
> -	r = locomo_readl(locomokbd->base + LOCOMO_KIC);
> +	r = readw(locomokbd->base + LOCOMO_KIC);
>  	if ((r & 0x0001) == 0)
>  		return IRQ_HANDLED;
>  
> -	locomo_writel(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack */
> +	writew(r & ~0x0100, locomokbd->base + LOCOMO_KIC); /* Ack */
>  
>  	/** wait chattering delay **/
>  	udelay(100);
> @@ -222,8 +217,8 @@ 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);
> +	r = readw(locomokbd->base + LOCOMO_KIC) | 0x0010;
> +	writew(r, locomokbd->base + LOCOMO_KIC);
>  	return 0;
>  }
>  
> @@ -232,35 +227,39 @@ 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);
> +	r = readw(locomokbd->base + LOCOMO_KIC) & ~0x0010;
> +	writew(r, locomokbd->base + LOCOMO_KIC);
>  }
>  
> -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;
> +	struct resource *res;
> +
> +	locomokbd = devm_kzalloc(&dev->dev, sizeof(struct locomokbd),
> +			GFP_KERNEL);
> +	if (!locomokbd)
> +		return -ENOMEM;
>  
> -	locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
>  	input_dev = input_allocate_device();
> -	if (!locomokbd || !input_dev) {
> -		err = -ENOMEM;
> -		goto err_free_mem;
> -	}
> +	if (!input_dev)
> +		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;
> -	}
> +	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -ENODEV;
>  
> -	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);
> +
> +	locomokbd->base = devm_ioremap_resource(&dev->dev, res);
> +	if (IS_ERR(locomokbd->base))
> +		return PTR_ERR(locomokbd->base);

You are leaking memory (input device) here. Since you can't convert all
resources to devm* I'd rather you leave them all explicitly managed
instead of having a mix.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 00/15] new locomo driver
  2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
                   ` (9 preceding siblings ...)
  2014-10-28  0:02 ` [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface Dmitry Eremin-Solenikov
@ 2014-10-28  0:13 ` Russell King - ARM Linux
       [not found]   ` <20141028001338.GZ27405-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
  2014-10-28  0:29   ` Mark Brown
  10 siblings, 2 replies; 54+ messages in thread
From: Russell King - ARM Linux @ 2014-10-28  0:13 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov, Greg KH
  Cc: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

On Tue, Oct 28, 2014 at 03:01:53AM +0300, Dmitry Eremin-Solenikov wrote:
> Sharp Zaurus SL-5500 and SL-5600 use special companion Gate Array. Current
> drivers present in Linux kernel has some problems:
> 
>  * It uses custom bus instead of platform bus/mfd core.

I believe Greg wouldn't see that as a positive point.

Don't think that the platform bus _should_ always be used.  It shouldn't
(Greg has said he'd like to see the platform bus to be totally killed off.)
Instead, custom buses properly suited to the class of device in question
is much preferred, especially if it aids in...

>  * Device drivers are not well layered/separated.

... better layering or separation of drivers.

So, thinking that converting from a custom bus to a platform bus
definitely is /not/ a positive step forward.

(Why mfd was ever allowed to re-use the platform bus stuff is a separate
question not relevent to these patches.)

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 05/15] video: backlight: add new locomo backlight driver
  2014-10-28  0:01 ` [PATCH 05/15] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:24   ` Jingoo Han
  0 siblings, 0 replies; 54+ messages in thread
From: Jingoo Han @ 2014-10-28  0:24 UTC (permalink / raw)
  To: 'Dmitry Eremin-Solenikov'
  Cc: 'Andrea Adami', 'Russell King',
	'Daniel Mack', 'Haojian Zhuang',
	'Robert Jarzmik', 'Linus Walleij',
	linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, 'Alexandre Courbot',
	'Dmitry Torokhov', 'Bryan Wu',
	'Richard Purdie', 'Samuel Ortiz',
	'Lee Jones', 'Mark Brown',
	'Liam Girdwood', 'Jingoo Han'

On Tuesday, October 28, 2014 9:02 AM, Dmitry Eremin-Solenikov wrote:
> 
> Add 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.
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/video/backlight/Kconfig     |   6 +-
>  drivers/video/backlight/Makefile    |   2 +-
>  drivers/video/backlight/locomo_bl.c | 171 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 175 insertions(+), 4 deletions(-)
>  create mode 100644 drivers/video/backlight/locomo_bl.c
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 8d03924..03b77b33 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -218,12 +218,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"
> diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
> index fcd50b73..2a61b7e 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -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
> diff --git a/drivers/video/backlight/locomo_bl.c b/drivers/video/backlight/locomo_bl.c
> new file mode 100644
> index 0000000..cec1b51
> --- /dev/null
> +++ b/drivers/video/backlight/locomo_bl.c
> @@ -0,0 +1,171 @@
> +/*
> + * Backlight control code for Sharp Zaurus SL-5500
> + *
> + * Copyright 2005 John Lenz <lenz@cs.wisc.edu>
> + * Maintainer: Pavel Machek <pavel@ucw.cz> (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/module.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/fb.h>
> +#include <linux/backlight.h>
> +#include <linux/err.h>
> +#include <linux/gpio.h>
> +#include <linux/delay.h>
> +#include <linux/mfd/locomo.h>

Please, re-order these headers alphabetically.
It enhances the readability.

> +
> +struct locomo_bl {
> +	void __iomem *regs;
> +	int current_intensity;
> +	int gpio_fl_vr;
> +};
> +
> +static const struct {
> +	u16 duty, bpwf;
> +	bool vr;
> +} locomo_bl_pwm[] = {
> +	{ 0, 161, false },
> +	{ 117, 161, false },
> +	{ 163, 148, false },
> +	{ 194, 161, false },
> +	{ 194, 161, true },
> +};
> +
> +static int locomo_bl_set_intensity(struct backlight_device *bd)
> +{
> +	int intensity = bd->props.brightness;
> +	struct locomo_bl *bl = dev_get_drvdata(&bd->dev);
> +
> +	if (bd->props.power != FB_BLANK_UNBLANK)
> +		intensity = 0;
> +	if (bd->props.fb_blank != FB_BLANK_UNBLANK)
> +		intensity = 0;
> +	if (bd->props.state & BL_CORE_SUSPENDED)
> +		intensity = 0;
> +
> +	gpio_set_value(bl->gpio_fl_vr, locomo_bl_pwm[intensity].vr);
> +
> +	writew(locomo_bl_pwm[intensity].bpwf, bl->regs + LOCOMO_ALS);
> +	udelay(100);
> +	writew(locomo_bl_pwm[intensity].duty, bl->regs + LOCOMO_ALD);
> +	udelay(100);

How about changing udelay() to usleep_range()?

> +	writew(locomo_bl_pwm[intensity].bpwf | LOCOMO_ALC_EN,
> +			bl->regs + LOCOMO_ALS);

> +
> +	bl->current_intensity = intensity;
> +	if (bd->props.state & BL_CORE_SUSPENDED)
> +		writew(0x00, bl->regs + LOCOMO_ALS);
> +
> +	return 0;
> +}
> +
> +static int locomo_bl_get_intensity(struct backlight_device *bd)
> +{
> +	struct locomo_bl *bl = dev_get_drvdata(&bd->dev);
> +
> +	return bl->current_intensity;
> +}
> +
> +static const struct backlight_ops locomo_bl_ops = {
> +	.options	= BL_CORE_SUSPENDRESUME,
> +	.get_brightness = locomo_bl_get_intensity,
> +	.update_status  = locomo_bl_set_intensity,
> +};
> +
> +static int locomo_bl_probe(struct platform_device *dev)
> +{
> +	struct backlight_properties props;
> +	struct resource *res;
> +	struct locomo_bl_platform_data *pdata;
> +	struct locomo_bl *bl;
> +	struct backlight_device *locomo_bl_device;
> +	int rc;
> +
> +	bl = devm_kmalloc(&dev->dev, sizeof(struct locomo_bl), GFP_KERNEL);
> +	if (!bl)
> +		return -ENOMEM;
> +
> +	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -EINVAL;

There is no need to check this, because devm_ioremap_resource()
will check this.

> +	bl->regs = devm_ioremap_resource(&dev->dev, res);
> +	if (!bl->regs)
> +		return -EINVAL;

The correct usage is as follows.

	if (IS_ERR(base))
		return PTR_ERR(base);

Please change it as below.

	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
	bl->regs = devm_ioremap_resource(&dev->dev, res);
	if (IS_ERR(bl->regs))
		 return PTR_ERR(bl->regs);

> +
> +	pdata = dev_get_platdata(&dev->dev);
> +	if (!pdata)
> +		return -EINVAL;
> +
> +	bl->gpio_fl_vr = pdata->gpio_fl_vr;
> +	rc = devm_gpio_request_one(&dev->dev, bl->gpio_fl_vr,
> +			GPIOF_OUT_INIT_LOW, "FL VR");
> +	if (rc)
> +		return rc;
> +
> +	writew(0, bl->regs + LOCOMO_ALS);
> +	writew(0, bl->regs + LOCOMO_ALD);
> +
> +	memset(&props, 0, sizeof(struct backlight_properties));
> +	props.type = BACKLIGHT_RAW;
> +	props.max_brightness = ARRAY_SIZE(locomo_bl_pwm) - 1;
> +	props.brightness = props.max_brightness / 2;
> +	locomo_bl_device = backlight_device_register("locomo-bl",

Please use devm_backlight_device_register().

> +						&dev->dev, bl,
> +						&locomo_bl_ops, &props);

> +
> +	if (IS_ERR(locomo_bl_device))
> +		return PTR_ERR(locomo_bl_device);
> +
> +	platform_set_drvdata(dev, locomo_bl_device);
> +
> +	/* Set up frontlight so that screen is readable */
> +	backlight_update_status(locomo_bl_device);
> +
> +	return 0;
> +}
> +
> +static int locomo_bl_remove(struct platform_device *dev)
> +{
> +	struct backlight_device *locomo_bl_device = platform_get_drvdata(dev);
> +
> +	locomo_bl_device->props.brightness = 0;
> +	locomo_bl_device->props.power = 0;
> +	locomo_bl_set_intensity(locomo_bl_device);
> +
> +	backlight_device_unregister(locomo_bl_device);

If devm_backlight_device_register() is used in probe(),
there is no need to call backlight_device_unregister() in remove().

> +
> +	return 0;
> +}
> +
> +static void locomo_bl_shutdown(struct platform_device *dev)
> +{
> +	struct backlight_device *locomo_bl_device = platform_get_drvdata(dev);
> +
> +	locomo_bl_device->props.brightness = 0;
> +	locomo_bl_device->props.power = 0;
> +	locomo_bl_set_intensity(locomo_bl_device);
> +}
> +
> +static struct platform_driver locomo_bl_driver = {
> +	.driver = {
> +		.name	= "locomo-backlight",
> +		.owner	= THIS_MODULE,
> +	},
> +	.probe	= locomo_bl_probe,
> +	.remove	= locomo_bl_remove,
> +	/* Turn off bl on power off/reboot */
> +	.shutdown = locomo_bl_shutdown,
> +};
> +
> +module_platform_driver(locomo_bl_driver);
> +
> +MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>, Pavel Machek <pavel@ucw.cz>");

This might make checkpatch warning.
Please split these authors to lines as below.

MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>");
MODULE_AUTHOR("Pavel Machek <pavel@ucw.cz>");

> +MODULE_DESCRIPTION("Collie Backlight driver");

What does mean 'Collie'? 'Locomo' looks better.

> +MODULE_LICENSE("GPL");

How about using "GPL v2"?

Thank you.

Best regards,
Jingoo Han

> +MODULE_ALIAS("platform:locomo-backlight");
> --
> 2.1.1

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 00/15] new locomo driver
       [not found]   ` <20141028001338.GZ27405-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
@ 2014-10-28  0:28     ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28  0:28 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Greg KH, linux-arm-kernel, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input, linux-leds, linux-spi,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Linus Walleij, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo Han, Liam Girdwood

2014-10-28 4:13 GMT+04:00 Russell King - ARM Linux <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>:
> On Tue, Oct 28, 2014 at 03:01:53AM +0300, Dmitry Eremin-Solenikov wrote:
>> Sharp Zaurus SL-5500 and SL-5600 use special companion Gate Array. Current
>> drivers present in Linux kernel has some problems:
>>
>>  * It uses custom bus instead of platform bus/mfd core.
>
> I believe Greg wouldn't see that as a positive point.
>
> Don't think that the platform bus _should_ always be used.  It shouldn't
> (Greg has said he'd like to see the platform bus to be totally killed off.)
> Instead, custom buses properly suited to the class of device in question
> is much preferred, especially if it aids in...

I'm sorry, I must be outdated on this topic. Few years ago things were exactly
opposite - we explicitly had to use platform bus for mfd devices. I
still think that
mfd devices containing several cells should use mfd-core (is it still
OK to use it?).
And mfd-core (up to now) uses platform bus.

>
>>  * Device drivers are not well layered/separated.
>
> ... better layering or separation of drivers.
>
> So, thinking that converting from a custom bus to a platform bus
> definitely is /not/ a positive step forward.

Is there an example of new approach? Current locomo-dev implementation
is poisoned with several bugs. For example it passes ioremapped memory
as resources to child devices that later call request_resource() on it.
Adding additional features (like correct work with IRQs) will duplicate
platform bus code and mfd functions.

>
> (Why mfd was ever allowed to re-use the platform bus stuff is a separate
> question not relevent to these patches.)

I remember this story - Ian Molton and me wrote mfd-core.c.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 00/15] new locomo driver
  2014-10-28  0:13 ` [PATCH 00/15] new locomo driver Russell King - ARM Linux
       [not found]   ` <20141028001338.GZ27405-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
@ 2014-10-28  0:29   ` Mark Brown
  1 sibling, 0 replies; 54+ messages in thread
From: Mark Brown @ 2014-10-28  0:29 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Dmitry Eremin-Solenikov, Greg KH, linux-arm-kernel, linux-gpio,
	linux-input, linux-leds, linux-spi, linux-fbdev, alsa-devel,
	Andrea Adami, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Linus Walleij, Alexandre Courbot, Dmitry Torokhov, Bryan Wu,
	Richard Purdie, Samuel Ortiz, Lee Jones, Jingoo Han,
	Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]

On Tue, Oct 28, 2014 at 12:13:39AM +0000, Russell King - ARM Linux wrote:
> On Tue, Oct 28, 2014 at 03:01:53AM +0300, Dmitry Eremin-Solenikov wrote:
> > Sharp Zaurus SL-5500 and SL-5600 use special companion Gate Array. Current
> > drivers present in Linux kernel has some problems:

> >  * It uses custom bus instead of platform bus/mfd core.

> I believe Greg wouldn't see that as a positive point.

> Don't think that the platform bus _should_ always be used.  It shouldn't
> (Greg has said he'd like to see the platform bus to be totally killed off.)
> Instead, custom buses properly suited to the class of device in question
> is much preferred, especially if it aids in...

> >  * Device drivers are not well layered/separated.

> ... better layering or separation of drivers.

> So, thinking that converting from a custom bus to a platform bus
> definitely is /not/ a positive step forward.

> (Why mfd was ever allowed to re-use the platform bus stuff is a separate
> question not relevent to these patches.)

The reason we ended up reusing the platform bus so much was that
originally people were doing custom buses but people started complaining
that the code was (or should be) a cut'n'paste of the platform bus and
that this duplication was both not pretty and a bit tedious for anyone
doing anything that involved deploying good practice over a lot of
buses.  Early MFDs were actually MMIO devices so the platform bus was a
good fit, then people (including me when I upstreamed the wm97xx drivers
and apparently whoever worked on these devices) started adding custom
buses and then people complianed that we should reuse both the bus type
and the MFD infrastructure so here we are.

Probably a way of sharing the platform code but giving the bus another
name and bus_type would allow for better separation here.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 06/15] video: lcd: add LoCoMo LCD driver
  2014-10-28  0:01 ` [PATCH 06/15] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
@ 2014-10-28  0:30   ` Jingoo Han
  2014-10-28 16:47     ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Jingoo Han @ 2014-10-28  0:30 UTC (permalink / raw)
  To: 'Dmitry Eremin-Solenikov'
  Cc: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, 'Andrea Adami',
	'Russell King', 'Daniel Mack',
	'Haojian Zhuang', 'Robert Jarzmik',
	'Linus Walleij', 'Alexandre Courbot',
	'Dmitry Torokhov', 'Bryan Wu',
	'Richard Purdie', 'Samuel Ortiz',
	'Lee Jones', 'Mark Brown',
	'Liam Girdwood', 'Jingoo Han'

On Tuesday, October 28, 2014 9:02 AM, Dmitry Eremin-Solenikov wrote:
> 
> 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 <dbaryshkov@gmail.com>
> ---
>  drivers/video/backlight/Kconfig      |   8 ++
>  drivers/video/backlight/Makefile     |   1 +
>  drivers/video/backlight/locomo_lcd.c | 224 +++++++++++++++++++++++++++++++++++
>  3 files changed, 233 insertions(+)
>  create mode 100644 drivers/video/backlight/locomo_lcd.c
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 03b77b33..bc5c671 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -48,6 +48,14 @@ 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
> +	default y
> +	help
> +	  If you have a Sharp Zaurus SL-5500 (Collie) or SL-5600 (Poodle) say y to
> +	  enable the LCD driver.
> +
>  config LCD_LTV350QV
>  	tristate "Samsung LTV350QV LCD Panel"
>  	depends on SPI_MASTER
> diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
> index 2a61b7e..b2580e7 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -9,6 +9,7 @@ obj-$(CONFIG_LCD_ILI922X)		+= ili922x.o
>  obj-$(CONFIG_LCD_ILI9320)		+= ili9320.o
>  obj-$(CONFIG_LCD_L4F00242T03)		+= l4f00242t03.o
>  obj-$(CONFIG_LCD_LD9040)		+= ld9040.o
> +obj-$(CONFIG_LCD_LOCOMO)		+= locomo_lcd.o

Please insert this alphabetically for the readability.

>  obj-$(CONFIG_LCD_LMS283GF05)		+= lms283gf05.o
>  obj-$(CONFIG_LCD_LMS501KF03)		+= lms501kf03.o
>  obj-$(CONFIG_LCD_LTV350QV)		+= ltv350qv.o
> diff --git a/drivers/video/backlight/locomo_lcd.c b/drivers/video/backlight/locomo_lcd.c
> new file mode 100644
> index 0000000..245efb8
> --- /dev/null
> +++ b/drivers/video/backlight/locomo_lcd.c
> @@ -0,0 +1,224 @@
> +/*
> + * Backlight control code for Sharp Zaurus SL-5500
> + *
> + * Copyright 2005 John Lenz <lenz@cs.wisc.edu>
> + * Maintainer: Pavel Machek <pavel@ucw.cz> (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/platform_device.h>
> +#include <linux/fb.h>
> +#include <linux/backlight.h>
> +#include <linux/err.h>
> +#include <linux/gpio.h>
> +#include <linux/delay.h>
> +#include <linux/lcd.h>
> +#include <linux/mfd/locomo.h>

Please, re-order these headers alphabetically.
It enhances the readability.

> +
> +static struct platform_device *locomolcd_dev;
> +static struct locomo_lcd_platform_data lcd_data;
> +static bool locomolcd_is_on;
> +static bool locomolcd_is_suspended;
> +static void __iomem *locomolcd_regs;
> +static struct lcd_device *lcd_dev;
> +
> +static struct gpio locomo_gpios[] = {
> +	{ 0, GPIOF_OUT_INIT_LOW, "LCD VSHA on" },
> +	{ 0, GPIOF_OUT_INIT_LOW, "LCD VSHD on" },
> +	{ 0, GPIOF_OUT_INIT_LOW, "LCD Vee on" },
> +	{ 0, GPIOF_OUT_INIT_LOW, "LCD MOD" },
> +};
> +
> +static void locomolcd_on(void)
> +{
> +	gpio_set_value(lcd_data.gpio_lcd_vsha_on, 1);
> +	mdelay(2);
> +
> +	gpio_set_value(lcd_data.gpio_lcd_vshd_on, 1);
> +	mdelay(2);
> +
> +	locomo_m62332_senddata(locomolcd_dev->dev.parent, lcd_data.comadj, 0);
> +	mdelay(5);
> +
> +	gpio_set_value(lcd_data.gpio_lcd_vee_on, 1);
> +	mdelay(10);

How about changing mdelay() to usleep_range()?

> +
> +	/* TFTCRST | CPSOUT=0 | CPSEN */
> +	writew(0x01, locomolcd_regs + LOCOMO_TC);
> +
> +	/* Set CPSD */
> +	writew(6, locomolcd_regs + LOCOMO_CPSD);
> +
> +	/* TFTCRST | CPSOUT=0 | CPSEN */
> +	writew((0x04 | 0x01), locomolcd_regs + LOCOMO_TC);
> +	mdelay(10);
> +
> +	gpio_set_value(lcd_data.gpio_lcd_mod, 1);
> +}
> +
> +static void locomolcd_off(void)
> +{
> +	/* TFTCRST=1 | CPSOUT=1 | CPSEN = 0 */
> +	writew(0x06, locomolcd_regs + LOCOMO_TC);
> +	mdelay(1);
> +
> +	gpio_set_value(lcd_data.gpio_lcd_vsha_on, 0);
> +	mdelay(110);
> +
> +	gpio_set_value(lcd_data.gpio_lcd_vee_on, 0);
> +	mdelay(700);
> +
> +	locomo_m62332_senddata(locomolcd_dev->dev.parent, 0, 0);
> +	mdelay(5);

How about changing mdelay() to usleep_range() or msleep()?

> +
> +	/* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */
> +	writew(0, locomolcd_regs + LOCOMO_TC);
> +	gpio_set_value(lcd_data.gpio_lcd_mod, 0);
> +	gpio_set_value(lcd_data.gpio_lcd_vshd_on, 0);
> +}
> +
> +int locomo_lcd_set_power(struct lcd_device *lcd, int power)
> +{
> +	dev_dbg(&lcd->dev, "LCD power %d (is %d)\n", power, locomolcd_is_on);
> +	if (power == 0 && !locomolcd_is_on) {
> +		locomolcd_is_on = 1;
> +		locomolcd_on();
> +	}
> +	if (power != 0 && locomolcd_is_on) {
> +		locomolcd_is_on = 0;
> +		locomolcd_off();
> +	}
> +	return 0;
> +}
> +
> +static int locomo_lcd_get_power(struct lcd_device *lcd)
> +{
> +	return !locomolcd_is_on;
> +}
> +
> +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 locomolcd_suspend(struct device *dev)
> +{
> +	locomolcd_is_suspended = true;
> +	locomolcd_off();
> +
> +	return 0;
> +}
> +
> +static int locomolcd_resume(struct device *dev)
> +{
> +	locomolcd_is_suspended = false;
> +
> +	if (locomolcd_is_on)
> +		locomolcd_on();
> +
> +	return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(locomolcd_pm, locomolcd_suspend, locomolcd_resume);
> +#define LOCOMOLCD_PM	(&locomolcd_pm)
> +#else
> +#define LOCOMOLCD_PM	NULL
> +#endif
> +
> +static int locomolcd_probe(struct platform_device *dev)
> +{
> +	unsigned long flags;
> +	struct resource *res;
> +	struct locomo_lcd_platform_data *pdata;
> +	int rc;
> +
> +	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -EINVAL;
> +	locomolcd_regs = devm_ioremap_resource(&dev->dev, res);
> +	if (!locomolcd_regs)
> +		return -EINVAL;

Please change it as below.

	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
	locomolcd_regs = devm_ioremap_resource(&dev->dev, res);
	if (IS_ERR(locomolcd_regs))
		 return PTR_ERR(locomolcd_regs);
> +
> +	pdata = dev_get_platdata(&dev->dev);
> +	if (!pdata)
> +		return -EINVAL;
> +
> +	lcd_data = *pdata;
> +
> +	locomo_gpios[0].gpio = lcd_data.gpio_lcd_vsha_on;
> +	locomo_gpios[1].gpio = lcd_data.gpio_lcd_vshd_on;
> +	locomo_gpios[2].gpio = lcd_data.gpio_lcd_vee_on;
> +	locomo_gpios[3].gpio = lcd_data.gpio_lcd_mod;
> +	dev_info(&dev->dev, "GPIOs: %d %d %d %d\n",
> +			locomo_gpios[0].gpio,
> +			locomo_gpios[1].gpio,
> +			locomo_gpios[2].gpio,
> +			locomo_gpios[3].gpio);
> +
> +	rc = gpio_request_array(locomo_gpios, ARRAY_SIZE(locomo_gpios));
> +	if (rc)
> +		return rc;
> +
> +	local_irq_save(flags);
> +	locomolcd_dev = dev;
> +
> +	locomolcd_is_on = 1;
> +	if (locomolcd_is_on)
> +		locomolcd_on();
> +
> +	local_irq_restore(flags);
> +
> +	lcd_dev = lcd_device_register("locomo", &dev->dev, NULL,

Please use devm_lcd_device_register().

> +			&locomo_lcd_ops);
> +
> +	return 0;
> +}
> +
> +static int locomolcd_remove(struct platform_device *dev)
> +{
> +	unsigned long flags;
> +
> +	lcd_device_unregister(lcd_dev);

If devm_lcd_device_register() is used in probe(),
there is no need to call lcd_device_unregister() in remove().

> +
> +	local_irq_save(flags);
> +
> +	locomolcd_off();
> +	locomolcd_dev = NULL;
> +
> +	local_irq_restore(flags);
> +
> +	gpio_free_array(locomo_gpios, ARRAY_SIZE(locomo_gpios));
> +
> +	return 0;
> +}
> +
> +static void locomolcd_shutdown(struct platform_device *dev)
> +{
> +	locomolcd_off();
> +}
> +
> +static struct platform_driver locomolcd_driver = {
> +	.driver = {
> +		.name	= "locomo-lcd",
> +		.owner	= THIS_MODULE,
> +		.pm	= LOCOMOLCD_PM,
> +	},
> +	.probe	= locomolcd_probe,
> +	.remove	= locomolcd_remove,
> +	.shutdown = locomolcd_shutdown,
> +};
> +
> +module_platform_driver(locomolcd_driver);
> +
> +MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>, Pavel Machek <pavel@ucw.cz>");


Please split these authors to lines as below.

MODULE_AUTHOR("John Lenz <lenz@cs.wisc.edu>");
MODULE_AUTHOR("Pavel Machek <pavel@ucw.cz>");

> +MODULE_DESCRIPTION("Collie LCD driver");

What does mean 'Collie'? 'Locomo' looks better.

> +MODULE_LICENSE("GPL");

How about using "GPL v2"?

Thank you.

Best regards,
Jingoo Han

> +MODULE_ALIAS("platform:locomo-lcd");
> --
> 2.1.1

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 15/15] spi: add locomo SPI driver
       [not found]     ` <1414454528-24240-16-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-28 11:03       ` Mark Brown
  0 siblings, 0 replies; 54+ messages in thread
From: Mark Brown @ 2014-10-28 11:03 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Linus Walleij,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones, Jingoo Han, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]

On Tue, Oct 28, 2014 at 03:02:08AM +0300, Dmitry Eremin-Solenikov wrote:
> LoCoMo chip has a built-in simple SPI controller. On Sharp SL-5500 PDDAs
> it is connected to external MMC slot.

> +config SPI_LOCOMO
> +	tristate "Locomo SPI master"
> +	depends on MFD_LOCOMO
> +	select SPI_BITBANG

Rather than using SPI_BITBANG it'd be good for new drivers to convert to
using the core transfer_one() functionality which replaces most of what
the bitbang code is doing.  The bitbang functionality was misnamed for
most of the users and we're going to try to move most of the functionality
not actually related to bitbanging out of it.

> +	/* if (locomospi_carddetect()) { */
> +	r = readw(spidev->base + LOCOMO_SPIMD);
> +	r |= LOCOMO_SPIMD_XON;
> +	writew(r, spidev->base + LOCOMO_SPIMD);
> +
> +	r = readw(spidev->base + LOCOMO_SPIMD);
> +	r |= LOCOMO_SPIMD_XEN;
> +	writew(r, spidev->base + LOCOMO_SPIMD);
> +	/* } */

Either remove or implement the comments.

> +	r = readw(spidev->base + LOCOMO_SPICT);
> +	r |= LOCOMO_SPIMD_XEN; /* FIXME */
> +	writew(r, spidev->base + LOCOMO_SPICT);

FIXME?

> +	if (t)
> +		hz = t->speed_hz;
> +	if (!hz)
> +		hz = spi->max_speed_hz;

The core will ensure that the transfer always has a speed set in it.

> +static int locomo_spi_probe(struct platform_device *pdev)
> +{
> +	struct resource *res;
> +	struct spi_master *master;
> +	struct locomospi_dev *spidev;
> +	int ret;
> +
> +	dev_info(&pdev->dev, "LoCoO SPI Driver\n");

Remove this, it's not adding anything.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
       [not found]   ` <1414454528-24240-12-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-28 14:58     ` Mark Brown
       [not found]       ` <20141028145850.GU18557-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  2014-10-29  3:03       ` Alexandre Courbot
  0 siblings, 2 replies; 54+ messages in thread
From: Mark Brown @ 2014-10-28 14:58 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Linus Walleij,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones, Jingoo Han, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
> Since LoCoMo driver has been converted to provide proper gpiolib
> interface, make poodle ASoC platform driver use gpiolib API.

Please use subject lines matching the style for the subsystem.

> +	ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
> +	if (ret) {
> +		dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
> +				ret);
> +		return ret;
> +	}

I sense a need for devm_gpio_request_array() here.  Otherwise this looks
fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
so no need to block on this.

Acked-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

with at least the subject line fixed.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
       [not found]       ` <20141028145850.GU18557-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2014-10-28 16:45         ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28 16:45 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Linus Walleij,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones, Jingoo Han, Liam Girdwood

On 10/28/2014 05:58 PM, Mark Brown wrote:
> On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
>> Since LoCoMo driver has been converted to provide proper gpiolib
>> interface, make poodle ASoC platform driver use gpiolib API.
>
> Please use subject lines matching the style for the subsystem.
>
>> +	ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
>> +	if (ret) {
>> +		dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
>> +				ret);
>> +		return ret;
>> +	}
>
> I sense a need for devm_gpio_request_array() here.  Otherwise this looks
> fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
> so no need to block on this.

I like the idea of devm_gpio_request_array. But I would like not to add 
additional (core) patches to this patchset.

>
> Acked-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>
> with at least the subject line fixed.

Subject line fixed.

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 06/15] video: lcd: add LoCoMo LCD driver
  2014-10-28  0:30   ` Jingoo Han
@ 2014-10-28 16:47     ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-28 16:47 UTC (permalink / raw)
  To: Jingoo Han
  Cc: linux-arm-kernel, linux-gpio, linux-input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, 'Andrea Adami',
	'Russell King', 'Daniel Mack',
	'Haojian Zhuang', 'Robert Jarzmik',
	'Linus Walleij', 'Alexandre Courbot',
	'Dmitry Torokhov', 'Bryan Wu',
	'Richard Purdie', 'Samuel Ortiz',
	'Lee Jones', 'Mark Brown',
	'Liam Girdwood'

On 10/28/2014 03:30 AM, Jingoo Han wrote:
> On Tuesday, October 28, 2014 9:02 AM, Dmitry Eremin-Solenikov wrote:
>>
>> LoCoMo has some special handling for TFT screens attached to Collie and
>> Poodle. Implement that as a separate driver.

Thanks for the review, changes for both LCD and Backlight will be 
implemented in V2.


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo
  2014-10-28  0:02   ` [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
@ 2014-10-28 19:13     ` Robert Jarzmik
  0 siblings, 0 replies; 54+ messages in thread
From: Robert Jarzmik @ 2014-10-28 19:13 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Alexandre Courbot, linux-fbdev, Bryan Wu, Russell King,
	Samuel Ortiz, Liam Girdwood, Linus Walleij, Dmitry Torokhov,
	alsa-devel, Haojian Zhuang, linux-spi, linux-gpio, Mark Brown,
	Andrea Adami, linux-arm-kernel, linux-input, Jingoo Han,
	Daniel Mack, Lee Jones, Richard Purdie, linux-leds

Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> writes:

...zip...

> diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
> index 3041d83..97eced9 100644
> --- a/arch/arm/mach-pxa/poodle.c
> +++ b/arch/arm/mach-pxa/poodle.c
> @@ -181,14 +181,18 @@ static struct locomo_platform_data locomo_info = {
>  	.gpio_data = {
>  		.gpio_base = POODLE_LOCOMO_GPIO_BASE,
>  	},
> -	.bl_data = {
> +	.lcd_data = {
Is that part really belonging to that patch ? It seems to me that this changes
the code included in patch 10/15 "ARM: pxa: poodle: use new LoCoMo
driver".

Therefore I'm wondering if I take the serie, halt it at patch 10, and try to
compile I would succeed ... I think I wouldn't.

> +	},
> +	.bl_data = {
>  		.gpio_fl_vr       = POODLE_GPIO_FL_VR,
>  	},
Ditto.

> +	.gpio_amp1_on	= -1,
> +	.gpio_amp2_on	= -1,
This won't prevent compilation, but is it the target of this patch which is IRQ
space oriented ?

> @@ -453,7 +457,7 @@ static void __init poodle_init(void)
>  	platform_scoop_config = &poodle_pcmcia_config;
>  
>  	if (sharpsl_param.comadj != -1)
> -		locomo_info.bl_data.comadj = sharpsl_param.comadj;
> +		locomo_info.lcd_data.comadj = sharpsl_param.comadj;
Ditto.

Cheers.

-- 
Robert

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
  2014-10-28 14:58     ` Mark Brown
       [not found]       ` <20141028145850.GU18557-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2014-10-29  3:03       ` Alexandre Courbot
       [not found]         ` <CAAVeFuKgARoMFzf+663iP6cULs93d4WSQS8ESjUb9VcxguWurA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 54+ messages in thread
From: Alexandre Courbot @ 2014-10-29  3:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: Dmitry Eremin-Solenikov, linux-arm-kernel, linux-gpio,
	linux-input, linux-leds, linux-spi, linux-fbdev, alsa-devel,
	Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Linus Walleij, Dmitry Torokhov, Bryan Wu,
	Richard Purdie, Samuel Ortiz, Lee Jones, Jingoo Han,
	Liam Girdwood

On Tue, Oct 28, 2014 at 11:58 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
>> Since LoCoMo driver has been converted to provide proper gpiolib
>> interface, make poodle ASoC platform driver use gpiolib API.
>
> Please use subject lines matching the style for the subsystem.
>
>> +     ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
>> +     if (ret) {
>> +             dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
>> +                             ret);
>> +             return ret;
>> +     }
>
> I sense a need for devm_gpio_request_array() here.  Otherwise this looks
> fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
> so no need to block on this.

I wish Dmitry took the opportunity to move this driver to the gpiod
API, especially since doing so would be trivial for this driver. Not a
critical requirement though, the present patch is already an
improvement. But if you want to do that last step, please have a look
at Documentation/gpio/consumer.txt and the "Platform Data" section of
Documentation/gpio/board.txt.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
       [not found]   ` <1414454528-24240-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-31  7:42     ` Linus Walleij
  2014-10-31  9:54       ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-10-31  7:42 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On Tue, Oct 28, 2014 at 1:01 AM, Dmitry Eremin-Solenikov
<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> 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 <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
(...)

> +/* DAC send data */
> +#define        M62332_SLAVE_ADDR       0x4e    /* Slave address  */
> +#define        M62332_W_BIT            0x00    /* W bit (0 only) */
> +#define        M62332_SUB_ADDR         0x00    /* Sub address    */
> +#define        M62332_A_BIT            0x00    /* A bit (0 only) */
> +
> +/* DAC setup and hold times (expressed in us) */
> +#define DAC_BUS_FREE_TIME      5       /*   4.7 us */
> +#define DAC_START_SETUP_TIME   5       /*   4.7 us */
> +#define DAC_STOP_SETUP_TIME    4       /*   4.0 us */
> +#define DAC_START_HOLD_TIME    5       /*   4.7 us */
> +#define DAC_SCL_LOW_HOLD_TIME  5       /*   4.7 us */
> +#define DAC_SCL_HIGH_HOLD_TIME 4       /*   4.0 us */
> +#define DAC_DATA_SETUP_TIME    1       /*   250 ns */
> +#define DAC_DATA_HOLD_TIME     1       /*   300 ns */
> +#define DAC_LOW_SETUP_TIME     1       /*   300 ns */
> +#define DAC_HIGH_SETUP_TIME    1       /*  1000 ns */
(...)

It seems some DAC handling is part of the MFD driver, and we recently
discussed that MFD should not be doing misc stuff but mainly act as
arbiter and switching station.

Can you please move the DAC parts of the driver to
drivers/iio/dac?

The IIO DAC subsystem will likely add other goodies to
the driver for free and give a nice API to consumers.

> +/* IRQ support */
> +static void locomo_handler(unsigned int irq, struct irq_desc *desc)
> +{
> +       struct locomo *lchip = irq_get_handler_data(irq);
> +       int req, i;
> +
> +       /* Acknowledge the parent IRQ */
> +       desc->irq_data.chip->irq_ack(&desc->irq_data);
> +
> +       /* check why this interrupt was generated */
> +       req = readw(lchip->base + LOCOMO_ICR) & 0x0f00;
> +
> +       if (req) {
> +               /* generate the next interrupt(s) */
> +               irq = lchip->irq_base;

This use if a static IRQ base is oldschool. Use irqdomain,
see for example tc3589x.c.

irq_domain_add_simple() should suffice.

IIRC you have used irqdomain before so you know the drill.

> +               for (i = 0; i <= 3; i++, irq++) {
> +                       if (req & (0x0100 << i))
> +                               generic_handle_irq(irq);
> +
> +               }

Reading the status register once and then check the IRQs
can be dangerous on non-threaded interrupt handlers as it could
miss transient IRQs appearing duing the IRQ handling.

The best example code is in drivers/irqchip.

For example in irq-vic.c there is this nice loop:

        while ((stat = readl_relaxed(vic->base + VIC_IRQ_STATUS))) {
                irq = ffs(stat) - 1;
                handle_domain_irq(vic->domain, irq, regs);
                handled = 1;
        }

Note how stat is re-read on each iteration.

> +static void locomo_setup_irq(struct locomo *lchip)
> +{
> +       int irq;
> +
> +       lchip->irq_base = irq_alloc_descs(-1, 0, LOCOMO_NR_IRQS, -1);

irqdomain will allocate descriptors for you when calling
irq_create_mapping() which should be done for all lines.

> +       /* Install handlers for IRQ_LOCOMO_* */
> +       for (irq = lchip->irq_base;
> +                       irq < lchip->irq_base + LOCOMO_NR_IRQS;
> +                       irq++) {
> +               irq_set_chip_and_handler(irq, &locomo_chip, handle_level_irq);
> +               irq_set_chip_data(irq, lchip);
> +               set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> +       }
> +
> +       /*
> +        * Install handler for IRQ_LOCOMO_HW.
> +        */
> +       irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING);
> +       irq_set_handler_data(lchip->irq, lchip);
> +       irq_set_chained_handler(lchip->irq, locomo_handler);
> +}

(...)
> +       /* Longtime timer */
> +       writew(0, lchip->base + LOCOMO_LTINT);
> +       /* SPI */
> +       writew(0, lchip->base + LOCOMO_SPI + LOCOMO_SPIIE);
> +
> +       writew(6 + 8 + 320 + 30 - 10, lchip->base + LOCOMO_ASD);

That's a few magic numbers and calculation don't you think?

A comment stating what's going on would be helpful.

> +       r = readw(lchip->base + LOCOMO_ASD);
> +       r |= 0x8000;
> +       writew(r, lchip->base + LOCOMO_ASD);
> +
> +       writew(6 + 8 + 320 + 30 - 10 - 128 + 4, lchip->base + LOCOMO_HSD);

Dito.

> +       r = readw(lchip->base + LOCOMO_HSD);
> +       r |= 0x8000;
> +       writew(r, lchip->base + LOCOMO_HSD);
> +
> +       writew(128 / 8, lchip->base + LOCOMO_HSC);

Dito.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
  2014-10-28  0:01 ` [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
@ 2014-10-31  7:48   ` Linus Walleij
       [not found]     ` <CACRpkdY7tRadod2vQfEytmw-ubaMAvr_=XTczD5bUMkqie0xkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-10-31  7:48 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On Tue, Oct 28, 2014 at 1:01 AM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:

> Add gpiolib driver for gpio pins placed on the LoCoMo GA.
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

(...)
> +static int locomo_gpio_get(struct gpio_chip *chip,
> +               unsigned offset)
> +{
> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
> +
> +       return readw(lg->regs + LOCOMO_GPL) & (1 << offset);

Do this:

#include <linux/bitops.h>

return !!(readw(lg->regs + LOCOMO_GPL) & BIT(offset));

So you clamp the returned value to a bool.

> +static void __locomo_gpio_set(struct gpio_chip *chip,
> +               unsigned offset, int value)
> +{
> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
> +       u16  r;
> +
> +       r = readw(lg->regs + LOCOMO_GPO);
> +       if (value)
> +               r |= 1 << offset;

r |= BIT(offset);

> +       else
> +               r &= ~(1 << offset);

r &= BIT(offset);

(etc, everywhere this pattern occurs).
> +static void locomo_gpio_set(struct gpio_chip *chip,
> +               unsigned offset, int value)
> +{
> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
> +       unsigned long flags;
> +
> +       spin_lock_irqsave(&lg->lock, flags);
> +
> +       __locomo_gpio_set(chip, offset, value);
> +
> +       spin_unlock_irqrestore(&lg->lock, flags);

If you actually always have to be getting and releasing a spin lock around
the register writes, contemplate using regmap-mmio because that
is part of what it does.

But is this locking really necessary?

> +static int locomo_gpio_remove(struct platform_device *pdev)
> +{
> +       struct locomo_gpio *lg = platform_get_drvdata(pdev);
> +       int ret;
> +
> +       ret = gpiochip_remove(&lg->gpio);
> +       if (ret) {
> +               dev_err(&pdev->dev, "Can't remove gpio chip: %d\n", ret);
> +               return ret;
> +       }

The return value from gpiochip_remove() has been removed in v3.18-rc1
so this will not compile.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo
  2014-10-28  0:02 ` [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
@ 2014-10-31  7:50   ` Linus Walleij
  2014-10-31  9:33     ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-10-31  7:50 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On Tue, Oct 28, 2014 at 1:02 AM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:

> As new locomo driver properly supports SPARSE_IRQ, stop playing with
> NR_IRQS on sa1100 (locomo was the last chip requiring NR_IRQ tricks).
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

That's right! By moving to irqdomain things get even better :)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 14/15] gpio: locomo: implement per-pin irq handling
  2014-10-28  0:02   ` [PATCH 14/15] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
@ 2014-10-31  8:00     ` Linus Walleij
  2014-10-31  9:35       ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-10-31  8:00 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On Tue, Oct 28, 2014 at 1:02 AM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:

> LoCoMo 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.
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

Please don't use open-coded IRQ handling like this, we are moving
away from that.

In Kconfig,

select GPIOLIB_IRQCHIP

and look at the other drivers selecting this for inspiration. There
is even some documentation in Documentation/gpio/driver.txt

You will find that it cuts down a lot of overhead from your driver
and does everything in the right way in a central place.

>  struct locomo_gpio {
>         void __iomem *regs;
> +       int irq;
>
>         spinlock_t lock;
>         struct gpio_chip gpio;
> +       int irq_base;

gpiolib irqchip helpers uses irqdomain to do all this debasing
and rebasing for you. Go with that.

> +static int locomo_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
> +{
> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
> +
> +       return lg->irq_base + offset;
> +}

And it implements .to_irq() in the gpiolib core.

> +static void
> +locomo_gpio_handler(unsigned int irq, struct irq_desc *desc)

It's locomo_gpio_irq_handler() right?

> +{
> +       u16 req;
> +       struct locomo_gpio *lg = irq_get_handler_data(irq);
> +       int i = lg->irq_base;
> +
> +       req = readw(lg->regs + LOCOMO_GIR) &
> +             readw(lg->regs + LOCOMO_GPD);
> +
> +       while (req) {
> +               if (req & 1)
> +                       generic_handle_irq(i);
> +               req >>= 1;
> +               i++;
> +       }

Same thing as the MFD device, look closer at how you construct
the IRQ handling loop, so the register gets re-read each iteration.

> +static void locomo_gpio_ack_irq(struct irq_data *d)
> +{
> +       struct locomo_gpio *lg = irq_data_get_irq_chip_data(d);
> +       unsigned long flags;
> +       u16 r;
> +
> +       spin_lock_irqsave(&lg->lock, flags);
> +
> +       r = readw(lg->regs + LOCOMO_GWE);
> +       r |= (0x0001 << (d->irq - lg->irq_base));
> +       writew(r, lg->regs + LOCOMO_GWE);
> +
> +       r = readw(lg->regs + LOCOMO_GIS);
> +       r &= ~(0x0001 << (d->irq - lg->irq_base));
> +       writew(r, lg->regs + LOCOMO_GIS);
> +
> +       r = readw(lg->regs + LOCOMO_GWE);
> +       r &= ~(0x0001 << (d->irq - lg->irq_base));
> +       writew(r, lg->regs + LOCOMO_GWE);
> +
> +       spin_unlock_irqrestore(&lg->lock, flags);
> +}

I really wonder if this locking is needed around these
regioster accesses. It seems more like a habit than
like something that is actually needed. Think it over.

*irqsave* versions of spinlocks are definately wrong
in the irqchip callbacks, if you give it a minute I think
you quickly realize why.

> +static int locomo_gpio_type(struct irq_data *d, unsigned int type)
> +{
> +       unsigned int mask;
> +       struct locomo_gpio *lg = irq_data_get_irq_chip_data(d);
> +       unsigned long flags;
> +
> +       mask = 1 << (d->irq - lg->irq_base);

This should just use d->hwirq with irqdomain implemented
correctly.

(...)

> +static void locomo_gpio_setup_irq(struct locomo_gpio *lg)
> +{
> +       int irq;
> +
> +       lg->irq_base = irq_alloc_descs(-1, 0, LOCOMO_GPIO_NR_IRQS, -1);
> +
> +       /* Install handlers for IRQ_LOCOMO_* */
> +       for (irq = lg->irq_base;
> +                       irq < lg->irq_base + LOCOMO_GPIO_NR_IRQS;
> +                       irq++) {
> +               irq_set_chip_and_handler(irq, &locomo_gpio_chip,
> +                               handle_edge_irq);
> +               irq_set_chip_data(irq, lg);
> +               set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> +       }
> +
> +       /*
> +        * Install handler for IRQ_LOCOMO_HW.
> +        */
> +       irq_set_handler_data(lg->irq, lg);
> +       irq_set_chained_handler(lg->irq, locomo_gpio_handler);
> +}

All this gets redundant with gpiochip_irqchip_add()
and gpiochip_set_chained_irqchip().

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo
  2014-10-31  7:50   ` Linus Walleij
@ 2014-10-31  9:33     ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-31  9:33 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

2014-10-31 10:50 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> On Tue, Oct 28, 2014 at 1:02 AM, Dmitry Eremin-Solenikov
> <dbaryshkov@gmail.com> wrote:
>
>> As new locomo driver properly supports SPARSE_IRQ, stop playing with
>> NR_IRQS on sa1100 (locomo was the last chip requiring NR_IRQ tricks).
>>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>
> That's right! By moving to irqdomain things get even better :)

That is a separate topic in my repo. I'll push that after finishing with LoCoMo.


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 14/15] gpio: locomo: implement per-pin irq handling
  2014-10-31  8:00     ` Linus Walleij
@ 2014-10-31  9:35       ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-31  9:35 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

2014-10-31 11:00 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> On Tue, Oct 28, 2014 at 1:02 AM, Dmitry Eremin-Solenikov
> <dbaryshkov@gmail.com> wrote:
>
>> LoCoMo 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.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>
> Please don't use open-coded IRQ handling like this, we are moving
> away from that.
>
> In Kconfig,
>
> select GPIOLIB_IRQCHIP
>
> and look at the other drivers selecting this for inspiration. There
> is even some documentation in Documentation/gpio/driver.txt
>
> You will find that it cuts down a lot of overhead from your driver
> and does everything in the right way in a central place.

Thanks, I will take a look.
[Skipped the rest of the comments mostly dedicated to gpiolib_irqchip].


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
       [not found]     ` <CACRpkdY7tRadod2vQfEytmw-ubaMAvr_=XTczD5bUMkqie0xkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-10-31  9:39       ` Dmitry Eremin-Solenikov
       [not found]         ` <CALT56yOgMUA7o2dzfHph=S2zkDV4zERzMh4ishpPwpAx7Cqj6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-31  9:39 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

2014-10-31 10:48 GMT+03:00 Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>:
> On Tue, Oct 28, 2014 at 1:01 AM, Dmitry Eremin-Solenikov
> <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> Add gpiolib driver for gpio pins placed on the LoCoMo GA.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>

[skipped]

> (etc, everywhere this pattern occurs).
>> +static void locomo_gpio_set(struct gpio_chip *chip,
>> +               unsigned offset, int value)
>> +{
>> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
>> +       unsigned long flags;
>> +
>> +       spin_lock_irqsave(&lg->lock, flags);
>> +
>> +       __locomo_gpio_set(chip, offset, value);
>> +
>> +       spin_unlock_irqrestore(&lg->lock, flags);
>
> If you actually always have to be getting and releasing a spin lock around
> the register writes, contemplate using regmap-mmio because that
> is part of what it does.
>
> But is this locking really necessary?

I have a custom of doing such locking and never having to think about
somebody breaking into RMW cycles.

Also isn't regmap an overkill here? Wouldn't regmap also do a lock/unlock
around each register read/write/RMW?

>> +static int locomo_gpio_remove(struct platform_device *pdev)
>> +{
>> +       struct locomo_gpio *lg = platform_get_drvdata(pdev);
>> +       int ret;
>> +
>> +       ret = gpiochip_remove(&lg->gpio);
>> +       if (ret) {
>> +               dev_err(&pdev->dev, "Can't remove gpio chip: %d\n", ret);
>> +               return ret;
>> +       }
>
> The return value from gpiochip_remove() has been removed in v3.18-rc1
> so this will not compile.

Yes, the fix will be in the next iteration. This patchset was based on 3.17

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
       [not found]         ` <CAAVeFuKgARoMFzf+663iP6cULs93d4WSQS8ESjUb9VcxguWurA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-10-31  9:52           ` Linus Walleij
  2014-10-31  9:58             ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-10-31  9:52 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Mark Brown, Dmitry Eremin-Solenikov,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Dmitry Torokhov,
	Bryan Wu, Richard Purdie, Samuel Ortiz, Lee Jones

On Wed, Oct 29, 2014 at 4:03 AM, Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Tue, Oct 28, 2014 at 11:58 PM, Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
>> On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
>>> Since LoCoMo driver has been converted to provide proper gpiolib
>>> interface, make poodle ASoC platform driver use gpiolib API.
>>
>> Please use subject lines matching the style for the subsystem.
>>
>>> +     ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
>>> +     if (ret) {
>>> +             dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
>>> +                             ret);
>>> +             return ret;
>>> +     }
>>
>> I sense a need for devm_gpio_request_array() here.  Otherwise this looks
>> fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
>> so no need to block on this.
>
> I wish Dmitry took the opportunity to move this driver to the gpiod
> API, especially since doing so would be trivial for this driver.

+1 on this.

However this platform is not device tree, so this implies setting up
a descriptor table for the affected driver(s) to work properly.
See Documentation/gpio/board.txt

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-10-31  7:42     ` Linus Walleij
@ 2014-10-31  9:54       ` Dmitry Eremin-Solenikov
       [not found]         ` <CALT56yNX8v4mZn=o1ZoVLHPmg6wq0dgFNowpqNuFtU=eCc+d8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-31  9:54 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

Hello,

Thank you for the review of patches.

2014-10-31 10:42 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> On Tue, Oct 28, 2014 at 1:01 AM, Dmitry Eremin-Solenikov
> <dbaryshkov@gmail.com> wrote:
>
>> 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 <dbaryshkov@gmail.com>
> (...)
>
>> +/* DAC send data */
>> +#define        M62332_SLAVE_ADDR       0x4e    /* Slave address  */
>> +#define        M62332_W_BIT            0x00    /* W bit (0 only) */
>> +#define        M62332_SUB_ADDR         0x00    /* Sub address    */
>> +#define        M62332_A_BIT            0x00    /* A bit (0 only) */
>> +
>> +/* DAC setup and hold times (expressed in us) */
>> +#define DAC_BUS_FREE_TIME      5       /*   4.7 us */
>> +#define DAC_START_SETUP_TIME   5       /*   4.7 us */
>> +#define DAC_STOP_SETUP_TIME    4       /*   4.0 us */
>> +#define DAC_START_HOLD_TIME    5       /*   4.7 us */
>> +#define DAC_SCL_LOW_HOLD_TIME  5       /*   4.7 us */
>> +#define DAC_SCL_HIGH_HOLD_TIME 4       /*   4.0 us */
>> +#define DAC_DATA_SETUP_TIME    1       /*   250 ns */
>> +#define DAC_DATA_HOLD_TIME     1       /*   300 ns */
>> +#define DAC_LOW_SETUP_TIME     1       /*   300 ns */
>> +#define DAC_HIGH_SETUP_TIME    1       /*  1000 ns */
> (...)
>
> It seems some DAC handling is part of the MFD driver, and we recently
> discussed that MFD should not be doing misc stuff but mainly act as
> arbiter and switching station.
>
> Can you please move the DAC parts of the driver to
> drivers/iio/dac?
>
> The IIO DAC subsystem will likely add other goodies to
> the driver for free and give a nice API to consumers.

I wanted this part to be as simple as possible. I will look into IIO
DAC subsystem.
The DAC is as simple 2 channel 8-bit i2c device connected to a separate i2c bus
controlled through a register in LoCoMo device. One channel is used
for backlight,
other will be used for volume control. So (in theory) I can add the
following device
chain:  locomo -> i2c-locomo -> m62332 -> IIO DAC client.  However isn't that
quite an overkill for just backlight & volume control? Please advice me on this.


[skipped the irqdomain part - I will use them, thanks for the suggestion.]

>> +       /* Longtime timer */
>> +       writew(0, lchip->base + LOCOMO_LTINT);
>> +       /* SPI */
>> +       writew(0, lchip->base + LOCOMO_SPI + LOCOMO_SPIIE);
>> +
>> +       writew(6 + 8 + 320 + 30 - 10, lchip->base + LOCOMO_ASD);
>
> That's a few magic numbers and calculation don't you think?
>
> A comment stating what's going on would be helpful.

Unfortunately little is known here - these values are c&p from old 2.4
Lineo code.
This part is related to generating synchronization pulses for accessing
touchscreen.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
  2014-10-31  9:52           ` Linus Walleij
@ 2014-10-31  9:58             ` Dmitry Eremin-Solenikov
  2014-11-01  5:42               ` Alexandre Courbot
  0 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-10-31  9:58 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, Mark Brown, linux-arm-kernel, linux-gpio,
	Linux Input, linux-leds, linux-spi, linux-fbdev, alsa-devel,
	Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones, Jingoo

2014-10-31 12:52 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> On Wed, Oct 29, 2014 at 4:03 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
>> On Tue, Oct 28, 2014 at 11:58 PM, Mark Brown <broonie@kernel.org> wrote:
>>> On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
>>>> Since LoCoMo driver has been converted to provide proper gpiolib
>>>> interface, make poodle ASoC platform driver use gpiolib API.
>>>
>>> Please use subject lines matching the style for the subsystem.
>>>
>>>> +     ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
>>>> +     if (ret) {
>>>> +             dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
>>>> +                             ret);
>>>> +             return ret;
>>>> +     }
>>>
>>> I sense a need for devm_gpio_request_array() here.  Otherwise this looks
>>> fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
>>> so no need to block on this.
>>
>> I wish Dmitry took the opportunity to move this driver to the gpiod
>> API, especially since doing so would be trivial for this driver.
>
> +1 on this.
>
> However this platform is not device tree, so this implies setting up
> a descriptor table for the affected driver(s) to work properly.
> See Documentation/gpio/board.txt

I checked the gpiod interfaces after original suggestion by Alexandre.

Introducing those mapping tables (much like pinctrl tables) look like
a duplicate effort if Russell will permit adding a DT support. So
I thought that I will reconsider gpiod/pinctrl/etc after fixing
LoCoMo, reiterating IRQ patches, possibly switching to COMMON_CLK
and (finally) thinking about device tree support.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface
  2014-10-31  9:58             ` Dmitry Eremin-Solenikov
@ 2014-11-01  5:42               ` Alexandre Courbot
  0 siblings, 0 replies; 54+ messages in thread
From: Alexandre Courbot @ 2014-11-01  5:42 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Linus Walleij, Mark Brown, linux-arm-kernel, linux-gpio,
	Linux Input, linux-leds, linux-spi, linux-fbdev, alsa-devel,
	Andrea Adami, Russell King, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones, Ji

On Fri, Oct 31, 2014 at 6:58 PM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:
> 2014-10-31 12:52 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>> On Wed, Oct 29, 2014 at 4:03 AM, Alexandre Courbot <gnurou@gmail.com> wrote:
>>> On Tue, Oct 28, 2014 at 11:58 PM, Mark Brown <broonie@kernel.org> wrote:
>>>> On Tue, Oct 28, 2014 at 03:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
>>>>> Since LoCoMo driver has been converted to provide proper gpiolib
>>>>> interface, make poodle ASoC platform driver use gpiolib API.
>>>>
>>>> Please use subject lines matching the style for the subsystem.
>>>>
>>>>> +     ret = gpio_request_array(poodle_gpios, ARRAY_SIZE(poodle_gpios));
>>>>> +     if (ret) {
>>>>> +             dev_err(&pdev->dev, "gpio_request_array() failed: %d\n",
>>>>> +                             ret);
>>>>> +             return ret;
>>>>> +     }
>>>>
>>>> I sense a need for devm_gpio_request_array() here.  Otherwise this looks
>>>> fine - ideally it'd move to gpiod but moving to gpiolib is a clear win
>>>> so no need to block on this.
>>>
>>> I wish Dmitry took the opportunity to move this driver to the gpiod
>>> API, especially since doing so would be trivial for this driver.
>>
>> +1 on this.
>>
>> However this platform is not device tree, so this implies setting up
>> a descriptor table for the affected driver(s) to work properly.
>> See Documentation/gpio/board.txt
>
> I checked the gpiod interfaces after original suggestion by Alexandre.
>
> Introducing those mapping tables (much like pinctrl tables) look like
> a duplicate effort if Russell will permit adding a DT support. So
> I thought that I will reconsider gpiod/pinctrl/etc after fixing
> LoCoMo, reiterating IRQ patches, possibly switching to COMMON_CLK
> and (finally) thinking about device tree support.

Note that the mapping tables are likely not going to end up being
huge, and taking that step will allow you to convert to the gpiod
interface, something you would probably want to do later when adding
DT support anyway. So at the end of the day there would be very little
wasted effort: once converting to DT, just add the GPIO properties
into the appropriate node, remove the mapping tables, and you're done.

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
       [not found]         ` <CALT56yNX8v4mZn=o1ZoVLHPmg6wq0dgFNowpqNuFtU=eCc+d8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-03 13:41           ` Linus Walleij
  2014-11-05 20:02             ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-11-03 13:41 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On Fri, Oct 31, 2014 at 10:54 AM, Dmitry Eremin-Solenikov
<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 2014-10-31 10:42 GMT+03:00 Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>:

>> It seems some DAC handling is part of the MFD driver, and we recently
>> discussed that MFD should not be doing misc stuff but mainly act as
>> arbiter and switching station.
>>
>> Can you please move the DAC parts of the driver to
>> drivers/iio/dac?
>>
>> The IIO DAC subsystem will likely add other goodies to
>> the driver for free and give a nice API to consumers.
>
> I wanted this part to be as simple as possible. I will look into IIO
> DAC subsystem.
> The DAC is as simple 2 channel 8-bit i2c device connected to a separate i2c bus
> controlled through a register in LoCoMo device. One channel is used
> for backlight,
> other will be used for volume control. So (in theory) I can add the
> following device
> chain:  locomo -> i2c-locomo -> m62332 -> IIO DAC client.  However isn't that
> quite an overkill for just backlight & volume control? Please advice me on this.

The point is still the same: no unrelated code in drivers/mfd,
then either use IIO DAC as a middle layer or sink the DAC handling
into respective subdriver, i.e. push it into the backlight or
volume directly then.

>>> +       /* Longtime timer */
>>> +       writew(0, lchip->base + LOCOMO_LTINT);
>>> +       /* SPI */
>>> +       writew(0, lchip->base + LOCOMO_SPI + LOCOMO_SPIIE);
>>> +
>>> +       writew(6 + 8 + 320 + 30 - 10, lchip->base + LOCOMO_ASD);
>>
>> That's a few magic numbers and calculation don't you think?
>>
>> A comment stating what's going on would be helpful.
>
> Unfortunately little is known here - these values are c&p from old 2.4
> Lineo code.
> This part is related to generating synchronization pulses for accessing
> touchscreen.

OK we have to live with reverse engineering results, that's OK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
       [not found]         ` <CALT56yOgMUA7o2dzfHph=S2zkDV4zERzMh4ishpPwpAx7Cqj6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-03 13:43           ` Linus Walleij
       [not found]             ` <CACRpkdb7v3LmOhbhQ9TPk1_bnLnpwizawW6RQvhQRLSjRewAaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-11-03 13:43 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On Fri, Oct 31, 2014 at 10:39 AM, Dmitry Eremin-Solenikov
<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 2014-10-31 10:48 GMT+03:00 Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>:
>> On Tue, Oct 28, 2014 at 1:01 AM, Dmitry Eremin-Solenikov
>> <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> Add gpiolib driver for gpio pins placed on the LoCoMo GA.
>>>
>>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>
>
> [skipped]
>
>> (etc, everywhere this pattern occurs).
>>> +static void locomo_gpio_set(struct gpio_chip *chip,
>>> +               unsigned offset, int value)
>>> +{
>>> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
>>> +       unsigned long flags;
>>> +
>>> +       spin_lock_irqsave(&lg->lock, flags);
>>> +
>>> +       __locomo_gpio_set(chip, offset, value);
>>> +
>>> +       spin_unlock_irqrestore(&lg->lock, flags);
>>
>> If you actually always have to be getting and releasing a spin lock around
>> the register writes, contemplate using regmap-mmio because that
>> is part of what it does.
>>
>> But is this locking really necessary?
>
> I have a custom of doing such locking and never having to think about
> somebody breaking into RMW cycles.
>
> Also isn't regmap an overkill here? Wouldn't regmap also do a lock/unlock
> around each register read/write/RMW?

Yes that's the point: if you use regmap mmio you get the RMW-locking
for free, with the regmap implementation.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-03 13:41           ` Linus Walleij
@ 2014-11-05 20:02             ` Dmitry Eremin-Solenikov
  2014-11-05 20:24               ` Mark Brown
  2014-11-05 20:32               ` Lars-Peter Clausen
  0 siblings, 2 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-05 20:02 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

2014-11-03 16:41 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> On Fri, Oct 31, 2014 at 10:54 AM, Dmitry Eremin-Solenikov
> <dbaryshkov@gmail.com> wrote:
>> 2014-10-31 10:42 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>
>>> It seems some DAC handling is part of the MFD driver, and we recently
>>> discussed that MFD should not be doing misc stuff but mainly act as
>>> arbiter and switching station.
>>>
>>> Can you please move the DAC parts of the driver to
>>> drivers/iio/dac?
>>>
>>> The IIO DAC subsystem will likely add other goodies to
>>> the driver for free and give a nice API to consumers.
>>
>> I wanted this part to be as simple as possible. I will look into IIO
>> DAC subsystem.
>> The DAC is as simple 2 channel 8-bit i2c device connected to a separate i2c bus
>> controlled through a register in LoCoMo device. One channel is used
>> for backlight,
>> other will be used for volume control. So (in theory) I can add the
>> following device
>> chain:  locomo -> i2c-locomo -> m62332 -> IIO DAC client.  However isn't that
>> quite an overkill for just backlight & volume control? Please advice me on this.
>
> The point is still the same: no unrelated code in drivers/mfd,
> then either use IIO DAC as a middle layer or sink the DAC handling
> into respective subdriver, i.e. push it into the backlight or
> volume directly then.

The problem is that the DAC is equally used by backlight and by sound
device (WIP).
What about true i2c device driver sitting in drivers/misc and exporting a regmap
of 2 8-bit registers?

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-05 20:02             ` Dmitry Eremin-Solenikov
@ 2014-11-05 20:24               ` Mark Brown
  2014-11-14 12:47                 ` Dmitry Eremin-Solenikov
  2014-11-05 20:32               ` Lars-Peter Clausen
  1 sibling, 1 reply; 54+ messages in thread
From: Mark Brown @ 2014-11-05 20:24 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Linus Walleij, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

On Thu, Nov 06, 2014 at 12:02:49AM +0400, Dmitry Eremin-Solenikov wrote:
> 2014-11-03 16:41 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:

> > The point is still the same: no unrelated code in drivers/mfd,
> > then either use IIO DAC as a middle layer or sink the DAC handling
> > into respective subdriver, i.e. push it into the backlight or
> > volume directly then.

> The problem is that the DAC is equally used by backlight and by sound
> device (WIP).
> What about true i2c device driver sitting in drivers/misc and exporting a regmap
> of 2 8-bit registers?

If it can just export registers that sounds like a MFD.  If it needs to
export functionality then like Linus says the IIO subsystem abstracts
DACs.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-05 20:02             ` Dmitry Eremin-Solenikov
  2014-11-05 20:24               ` Mark Brown
@ 2014-11-05 20:32               ` Lars-Peter Clausen
  2014-11-05 20:42                 ` Lars-Peter Clausen
  1 sibling, 1 reply; 54+ messages in thread
From: Lars-Peter Clausen @ 2014-11-05 20:32 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov, Linus Walleij
  Cc: Alexandre Courbot, linux-fbdev, Bryan Wu, Russell King,
	Samuel Ortiz, Liam Girdwood, Lee Jones, Dmitry Torokhov,
	alsa-devel, Haojian Zhuang, linux-spi, linux-gpio, Mark Brown,
	Andrea Adami, linux-arm-kernel, Linux Input, Jingoo Han,
	Daniel Mack, Robert Jarzmik, Richard Purdie,

On 11/05/2014 09:02 PM, Dmitry Eremin-Solenikov wrote:
> 2014-11-03 16:41 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>> On Fri, Oct 31, 2014 at 10:54 AM, Dmitry Eremin-Solenikov
>> <dbaryshkov@gmail.com> wrote:
>>> 2014-10-31 10:42 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>>
>>>> It seems some DAC handling is part of the MFD driver, and we recently
>>>> discussed that MFD should not be doing misc stuff but mainly act as
>>>> arbiter and switching station.
>>>>
>>>> Can you please move the DAC parts of the driver to
>>>> drivers/iio/dac?
>>>>
>>>> The IIO DAC subsystem will likely add other goodies to
>>>> the driver for free and give a nice API to consumers.
>>>
>>> I wanted this part to be as simple as possible. I will look into IIO
>>> DAC subsystem.
>>> The DAC is as simple 2 channel 8-bit i2c device connected to a separate i2c bus
>>> controlled through a register in LoCoMo device. One channel is used
>>> for backlight,
>>> other will be used for volume control. So (in theory) I can add the
>>> following device
>>> chain:  locomo -> i2c-locomo -> m62332 -> IIO DAC client.  However isn't that
>>> quite an overkill for just backlight & volume control? Please advice me on this.
>>
>> The point is still the same: no unrelated code in drivers/mfd,
>> then either use IIO DAC as a middle layer or sink the DAC handling
>> into respective subdriver, i.e. push it into the backlight or
>> volume directly then.
>
> The problem is that the DAC is equally used by backlight and by sound
> device (WIP).

That shouldn't be a problem. The IIO API allows different consumers to 
request different channels of a converter. You can write a generic IIO based 
backlight driver and a generic IIO based volume control driver. This makes 
it possible to re-use them in other circuits with other DACs but the same 
application.

> What about true i2c device driver sitting in drivers/misc and exporting a regmap
> of 2 8-bit registers?

If it is a generic DAC it should go into drivers/iio/, this will allow code 
sharing and code re-usability. Given the simplicity of the DAC there might 
even be other existing drivers that can be used to control it.

- Lars

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-05 20:32               ` Lars-Peter Clausen
@ 2014-11-05 20:42                 ` Lars-Peter Clausen
  0 siblings, 0 replies; 54+ messages in thread
From: Lars-Peter Clausen @ 2014-11-05 20:42 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov, Linus Walleij
  Cc: linux-arm-kernel, linux-gpio, Linux Input, linux-leds, linux-spi,
	linux-fbdev, alsa-devel, Andrea Adami, Russell King, Daniel Mack,
	Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

On 11/05/2014 09:32 PM, Lars-Peter Clausen wrote:
> If it is a generic DAC it should go into drivers/iio/, this will allow code
> sharing and code re-usability. Given the simplicity of the DAC there might
> even be other existing drivers that can be used to control it.

I just had a quick look and I think the M62332 will work out of the box with 
the max517 driver.

- Lars

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
       [not found]             ` <CACRpkdb7v3LmOhbhQ9TPk1_bnLnpwizawW6RQvhQRLSjRewAaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-05 21:33               ` Dmitry Eremin-Solenikov
  2014-11-06  6:03                 ` Mark Brown
  0 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-05 21:33 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Mark Brown, Jingoo

2014-11-03 16:43 GMT+03:00 Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>:
> On Fri, Oct 31, 2014 at 10:39 AM, Dmitry Eremin-Solenikov
> <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> 2014-10-31 10:48 GMT+03:00 Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>:
>>> On Tue, Oct 28, 2014 at 1:01 AM, Dmitry Eremin-Solenikov
>>> <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>
>>>> Add gpiolib driver for gpio pins placed on the LoCoMo GA.
>>>>
>>>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>
>>
>> [skipped]
>>
>>> (etc, everywhere this pattern occurs).
>>>> +static void locomo_gpio_set(struct gpio_chip *chip,
>>>> +               unsigned offset, int value)
>>>> +{
>>>> +       struct locomo_gpio *lg = container_of(chip, struct locomo_gpio, gpio);
>>>> +       unsigned long flags;
>>>> +
>>>> +       spin_lock_irqsave(&lg->lock, flags);
>>>> +
>>>> +       __locomo_gpio_set(chip, offset, value);
>>>> +
>>>> +       spin_unlock_irqrestore(&lg->lock, flags);
>>>
>>> If you actually always have to be getting and releasing a spin lock around
>>> the register writes, contemplate using regmap-mmio because that
>>> is part of what it does.
>>>
>>> But is this locking really necessary?
>>
>> I have a custom of doing such locking and never having to think about
>> somebody breaking into RMW cycles.
>>
>> Also isn't regmap an overkill here? Wouldn't regmap also do a lock/unlock
>> around each register read/write/RMW?
>
> Yes that's the point: if you use regmap mmio you get the RMW-locking
> for free, with the regmap implementation.


Just to be more concrete. Currently locomo_gpio_ack_irq() function uses
one lock and one unlock for doing 3 consecutive RMW I I convert locomo
to regmap, will that be 3 lock/unlock calls or still one? (Or maybe I'm
trying to be over-protective here and adding more lock/unlock cycles
won't matter that much?)

Next question: if I have to export regmap to several subdrivers, is it better
to have one big regmap or to have one-map-per-driver approach?

-- 
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
  2014-11-05 21:33               ` Dmitry Eremin-Solenikov
@ 2014-11-06  6:03                 ` Mark Brown
  2014-11-11 13:16                   ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Mark Brown @ 2014-11-06  6:03 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Linus Walleij, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

On Thu, Nov 06, 2014 at 01:33:24AM +0400, Dmitry Eremin-Solenikov wrote:
> 2014-11-03 16:43 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:

> > Yes that's the point: if you use regmap mmio you get the RMW-locking
> > for free, with the regmap implementation.

> Just to be more concrete. Currently locomo_gpio_ack_irq() function uses
> one lock and one unlock for doing 3 consecutive RMW I I convert locomo
> to regmap, will that be 3 lock/unlock calls or still one? (Or maybe I'm
> trying to be over-protective here and adding more lock/unlock cycles
> won't matter that much?)

You'll get three lock/unlocks, we could add an interface for bulk
updates under one lock if it's important though.

> Next question: if I have to export regmap to several subdrivers, is it better
> to have one big regmap or to have one-map-per-driver approach?

One regmap for the physical register map which is shared between all the
users.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
  2014-11-06  6:03                 ` Mark Brown
@ 2014-11-11 13:16                   ` Dmitry Eremin-Solenikov
       [not found]                     ` <CALT56yPr42FV66USngocw=eWPt81d5R2MJxmzBnv02HOMmXAkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-11 13:16 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linus Walleij, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones

2014-11-06 9:03 GMT+03:00 Mark Brown <broonie@kernel.org>:
> On Thu, Nov 06, 2014 at 01:33:24AM +0400, Dmitry Eremin-Solenikov wrote:
>> 2014-11-03 16:43 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>
>> > Yes that's the point: if you use regmap mmio you get the RMW-locking
>> > for free, with the regmap implementation.
>
>> Just to be more concrete. Currently locomo_gpio_ack_irq() function uses
>> one lock and one unlock for doing 3 consecutive RMW I I convert locomo
>> to regmap, will that be 3 lock/unlock calls or still one? (Or maybe I'm
>> trying to be over-protective here and adding more lock/unlock cycles
>> won't matter that much?)
>
> You'll get three lock/unlocks, we could add an interface for bulk
> updates under one lock if it's important though.
>
>> Next question: if I have to export regmap to several subdrivers, is it better
>> to have one big regmap or to have one-map-per-driver approach?
>
> One regmap for the physical register map which is shared between all the
> users.

Mark, Linus,

Just to better understand your suggestions: do you want me to convert
to regmap only gpio driver or do you suggest to convert all LoCoMo drivers?
That is doable, of course, but the amount of changes is overwhelming.
Also I'm concerned about the performance impact from going through
regmap layers.


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
       [not found]                     ` <CALT56yPr42FV66USngocw=eWPt81d5R2MJxmzBnv02HOMmXAkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-11-11 13:23                       ` Mark Brown
  2014-11-14 10:11                       ` Linus Walleij
  1 sibling, 0 replies; 54+ messages in thread
From: Mark Brown @ 2014-11-11 13:23 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Linus Walleij, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

On Tue, Nov 11, 2014 at 05:16:38PM +0400, Dmitry Eremin-Solenikov wrote:

> Just to better understand your suggestions: do you want me to convert
> to regmap only gpio driver or do you suggest to convert all LoCoMo drivers?
> That is doable, of course, but the amount of changes is overwhelming.
> Also I'm concerned about the performance impact from going through
> regmap layers.

I don't care.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
       [not found]                     ` <CALT56yPr42FV66USngocw=eWPt81d5R2MJxmzBnv02HOMmXAkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2014-11-11 13:23                       ` Mark Brown
@ 2014-11-14 10:11                       ` Linus Walleij
  2014-11-14 12:48                         ` Dmitry Eremin-Solenikov
  1 sibling, 1 reply; 54+ messages in thread
From: Linus Walleij @ 2014-11-14 10:11 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Mark Brown, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA, Linux Input,
	linux-leds-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Andrea Adami, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Alexandre Courbot,
	Dmitry Torokhov, Bryan Wu, Richard Purdie, Samuel Ortiz,
	Lee Jones, Jingoo

On Tue, Nov 11, 2014 at 2:16 PM, Dmitry Eremin-Solenikov
<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Just to better understand your suggestions: do you want me to convert
> to regmap only gpio driver or do you suggest to convert all LoCoMo drivers?

Um... I was just thinking about this one usecase.

It's no big deal, the other review comments are more important.

> That is doable, of course, but the amount of changes is overwhelming.
> Also I'm concerned about the performance impact from going through
> regmap layers.

Is it on a critical path? The current locking isn't any less invasive
AFAICT.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-05 20:24               ` Mark Brown
@ 2014-11-14 12:47                 ` Dmitry Eremin-Solenikov
  2014-11-14 15:10                   ` Mark Brown
  0 siblings, 1 reply; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-14 12:47 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linus Walleij, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones

Hello,

2014-11-05 23:24 GMT+03:00 Mark Brown <broonie@kernel.org>:
> On Thu, Nov 06, 2014 at 12:02:49AM +0400, Dmitry Eremin-Solenikov wrote:
>> 2014-11-03 16:41 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
>
>> > The point is still the same: no unrelated code in drivers/mfd,
>> > then either use IIO DAC as a middle layer or sink the DAC handling
>> > into respective subdriver, i.e. push it into the backlight or
>> > volume directly then.
>
>> The problem is that the DAC is equally used by backlight and by sound
>> device (WIP).
>> What about true i2c device driver sitting in drivers/misc and exporting a regmap
>> of 2 8-bit registers?
>
> If it can just export registers that sounds like a MFD.  If it needs to
> export functionality then like Linus says the IIO subsystem abstracts
> DACs.

I took a look at IIO subsystem. Thanks for the pointer. Indeed max517 driver
can drive m62332 DAC with minimal modifications. However write support
of the consumer interface is non-existing yet (which would be required
to support DACs in unified manner).

I'm actually looking at the regulator interface. Since this DAC serves mostly
like a (semi-)constant voltage interface, would it be rather logical to use
regulator subsystem to drive it?

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver
  2014-11-14 10:11                       ` Linus Walleij
@ 2014-11-14 12:48                         ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-14 12:48 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Mark Brown, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones, Jingoo

2014-11-14 13:11 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> On Tue, Nov 11, 2014 at 2:16 PM, Dmitry Eremin-Solenikov
> <dbaryshkov@gmail.com> wrote:
>
>> Just to better understand your suggestions: do you want me to convert
>> to regmap only gpio driver or do you suggest to convert all LoCoMo drivers?
>
> Um... I was just thinking about this one usecase.

I ended up converting all drivers. It allowed me to clean up several points
in the driver.

>
> It's no big deal, the other review comments are more important.

Fixed most of the comments. Last remaining issue is factoring out m62332
interface.

>> That is doable, of course, but the amount of changes is overwhelming.
>> Also I'm concerned about the performance impact from going through
>> regmap layers.
>
> Is it on a critical path? The current locking isn't any less invasive
> AFAICT.
>
> Yours,
> Linus Walleij



-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-14 12:47                 ` Dmitry Eremin-Solenikov
@ 2014-11-14 15:10                   ` Mark Brown
  2014-11-14 15:30                     ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 54+ messages in thread
From: Mark Brown @ 2014-11-14 15:10 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Linus Walleij, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

On Fri, Nov 14, 2014 at 04:47:00PM +0400, Dmitry Eremin-Solenikov wrote:

> I'm actually looking at the regulator interface. Since this DAC serves mostly
> like a (semi-)constant voltage interface, would it be rather logical to use
> regulator subsystem to drive it?

Possibly...  it's mostly a function of what the consumers of the
functionality look like - if that code looks weird calling into the
regulator API then it's bad, if that code looks OK it's fine.  I haven't
looked at the hardware at all so don't have strong feelings either way
so long as the result looks tasteful.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread

* Re: [PATCH 01/15] mfd: add new driver for Sharp LoCoMo
  2014-11-14 15:10                   ` Mark Brown
@ 2014-11-14 15:30                     ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 54+ messages in thread
From: Dmitry Eremin-Solenikov @ 2014-11-14 15:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linus Walleij, linux-arm-kernel, linux-gpio, Linux Input,
	linux-leds, linux-spi, linux-fbdev, alsa-devel, Andrea Adami,
	Russell King, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Alexandre Courbot, Dmitry Torokhov, Bryan Wu, Richard Purdie,
	Samuel Ortiz, Lee Jones

2014-11-14 18:10 GMT+03:00 Mark Brown <broonie@kernel.org>:
> On Fri, Nov 14, 2014 at 04:47:00PM +0400, Dmitry Eremin-Solenikov wrote:
>
>> I'm actually looking at the regulator interface. Since this DAC serves mostly
>> like a (semi-)constant voltage interface, would it be rather logical to use
>> regulator subsystem to drive it?
>
> Possibly...  it's mostly a function of what the consumers of the
> functionality look like - if that code looks weird calling into the
> regulator API then it's bad, if that code looks OK it's fine.  I haven't
> looked at the hardware at all so don't have strong feelings either way
> so long as the result looks tasteful.

The DAC is used in backlight driver (control brightness) and in ASoC
machine driver (master joined volume).

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2014-11-14 15:30 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-28  0:01 [PATCH 00/15] new locomo driver Dmitry Eremin-Solenikov
2014-10-28  0:01 ` [PATCH 01/15] mfd: add new driver for Sharp LoCoMo Dmitry Eremin-Solenikov
     [not found]   ` <1414454528-24240-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-31  7:42     ` Linus Walleij
2014-10-31  9:54       ` Dmitry Eremin-Solenikov
     [not found]         ` <CALT56yNX8v4mZn=o1ZoVLHPmg6wq0dgFNowpqNuFtU=eCc+d8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-03 13:41           ` Linus Walleij
2014-11-05 20:02             ` Dmitry Eremin-Solenikov
2014-11-05 20:24               ` Mark Brown
2014-11-14 12:47                 ` Dmitry Eremin-Solenikov
2014-11-14 15:10                   ` Mark Brown
2014-11-14 15:30                     ` Dmitry Eremin-Solenikov
2014-11-05 20:32               ` Lars-Peter Clausen
2014-11-05 20:42                 ` Lars-Peter Clausen
2014-10-28  0:01 ` [PATCH 02/15] GPIO: port LoCoMo gpio support from old driver Dmitry Eremin-Solenikov
2014-10-31  7:48   ` Linus Walleij
     [not found]     ` <CACRpkdY7tRadod2vQfEytmw-ubaMAvr_=XTczD5bUMkqie0xkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-31  9:39       ` Dmitry Eremin-Solenikov
     [not found]         ` <CALT56yOgMUA7o2dzfHph=S2zkDV4zERzMh4ishpPwpAx7Cqj6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-03 13:43           ` Linus Walleij
     [not found]             ` <CACRpkdb7v3LmOhbhQ9TPk1_bnLnpwizawW6RQvhQRLSjRewAaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-05 21:33               ` Dmitry Eremin-Solenikov
2014-11-06  6:03                 ` Mark Brown
2014-11-11 13:16                   ` Dmitry Eremin-Solenikov
     [not found]                     ` <CALT56yPr42FV66USngocw=eWPt81d5R2MJxmzBnv02HOMmXAkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-11 13:23                       ` Mark Brown
2014-11-14 10:11                       ` Linus Walleij
2014-11-14 12:48                         ` Dmitry Eremin-Solenikov
2014-10-28  0:01 ` [PATCH 03/15] leds: port locomo leds driver to new locomo core Dmitry Eremin-Solenikov
     [not found] ` <1414454528-24240-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-28  0:01   ` [PATCH 04/15] input: convert LoCoMo keyboard driver to use " Dmitry Eremin-Solenikov
2014-10-28  0:09     ` Dmitry Torokhov
2014-10-28  0:02   ` [PATCH 08/15] ARM: sa1100: make collie use new locomo drivers Dmitry Eremin-Solenikov
2014-10-28  0:02   ` [PATCH 12/15] ARM: pxa: poodle: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2014-10-28 19:13     ` Robert Jarzmik
2014-10-28  0:02   ` [PATCH 13/15] ARM: drop old LoCoMo driver Dmitry Eremin-Solenikov
2014-10-28  0:02   ` [PATCH 14/15] gpio: locomo: implement per-pin irq handling Dmitry Eremin-Solenikov
2014-10-31  8:00     ` Linus Walleij
2014-10-31  9:35       ` Dmitry Eremin-Solenikov
2014-10-28  0:02   ` [PATCH 15/15] spi: add locomo SPI driver Dmitry Eremin-Solenikov
     [not found]     ` <1414454528-24240-16-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-28 11:03       ` Mark Brown
2014-10-28  0:01 ` [PATCH 05/15] video: backlight: add new locomo backlight driver Dmitry Eremin-Solenikov
2014-10-28  0:24   ` Jingoo Han
2014-10-28  0:01 ` [PATCH 06/15] video: lcd: add LoCoMo LCD driver Dmitry Eremin-Solenikov
2014-10-28  0:30   ` Jingoo Han
2014-10-28 16:47     ` Dmitry Eremin-Solenikov
2014-10-28  0:02 ` [PATCH 07/15] video: backlight: drop old locomo bl/lcd driver Dmitry Eremin-Solenikov
2014-10-28  0:02 ` [PATCH 09/15] ARM: sa1100: don't preallocate IRQ space for locomo Dmitry Eremin-Solenikov
2014-10-31  7:50   ` Linus Walleij
2014-10-31  9:33     ` Dmitry Eremin-Solenikov
2014-10-28  0:02 ` [PATCH 10/15] ARM: pxa: poodle: use new LoCoMo driver Dmitry Eremin-Solenikov
2014-10-28  0:02 ` [PATCH 11/15] sound: soc: poodle: make use of new locomo GPIO interface Dmitry Eremin-Solenikov
     [not found]   ` <1414454528-24240-12-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-28 14:58     ` Mark Brown
     [not found]       ` <20141028145850.GU18557-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-10-28 16:45         ` Dmitry Eremin-Solenikov
2014-10-29  3:03       ` Alexandre Courbot
     [not found]         ` <CAAVeFuKgARoMFzf+663iP6cULs93d4WSQS8ESjUb9VcxguWurA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-31  9:52           ` Linus Walleij
2014-10-31  9:58             ` Dmitry Eremin-Solenikov
2014-11-01  5:42               ` Alexandre Courbot
2014-10-28  0:13 ` [PATCH 00/15] new locomo driver Russell King - ARM Linux
     [not found]   ` <20141028001338.GZ27405-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-10-28  0:28     ` Dmitry Eremin-Solenikov
2014-10-28  0:29   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).