[oe-commits] org.oe.dev logicpd-pxa270-2.6.17-rc5: add touch and audio support (by Shane Volpe)
cbrake commit
openembedded-commits at lists.openembedded.org
Mon Nov 13 19:13:36 UTC 2006
logicpd-pxa270-2.6.17-rc5: add touch and audio support (by Shane Volpe)
Author: cbrake at openembedded.org
Branch: org.openembedded.dev
Revision: 9ebe19c38b13611632684c440b048e45471bf916
ViewMTN: http://monotone.openembedded.org/revision.psp?id=9ebe19c38b13611632684c440b048e45471bf916
Files:
1
packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-ac97-audio.patch
packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-touchscreen.patch
packages/linux/logicpd-pxa270-2.6.17-rc5/defconfig
packages/linux/logicpd-pxa270_2.6.17-rc5.bb
Diffs:
#
# mt diff -ra11e7e98a332b5879fcc81f440c081b429a58a58 -r9ebe19c38b13611632684c440b048e45471bf916
#
#
#
# add_file "packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-ac97-audio.patch"
# content [8b79738e34bd27fd4b4b84f930bbb3caca838dd5]
#
# add_file "packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-touchscreen.patch"
# content [32673a857f878803615b3435a1644cc913798cee]
#
# patch "packages/linux/logicpd-pxa270-2.6.17-rc5/defconfig"
# from [72b7dbee18c773e986a65ef59074577622e1958f]
# to [9d67d0f9b95d3bd15db2991ac47647cb1d1ce55c]
#
# patch "packages/linux/logicpd-pxa270_2.6.17-rc5.bb"
# from [fe517285d52b001e8fca966e004936f27bbbaff5]
# to [38aac701f00c5934d78ab924def7d92adb5b2cfe]
#
============================================================
--- packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-ac97-audio.patch 8b79738e34bd27fd4b4b84f930bbb3caca838dd5
+++ packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-ac97-audio.patch 8b79738e34bd27fd4b4b84f930bbb3caca838dd5
@@ -0,0 +1,86 @@
+Index: linux-2.6.17-rc5/sound/pci/ac97/ac97_codec.c
+===================================================================
+--- linux-2.6.17-rc5.orig/sound/pci/ac97/ac97_codec.c
++++ linux-2.6.17-rc5/sound/pci/ac97/ac97_codec.c
+@@ -151,7 +151,7 @@ static const struct ac97_codec_id snd_ac
+ { 0x4e534300, 0xffffffff, "LM4540,43,45,46,48", NULL, NULL }, // only guess --jk
+ { 0x4e534331, 0xffffffff, "LM4549", NULL, NULL },
+ { 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix
+-{ 0x50534304, 0xffffffff, "UCB1400", NULL, NULL },
++{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL, AC97_HAS_NO_STD_PCM },
+ { 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH },
+ { 0x54524102, 0xffffffff, "TR28022", NULL, NULL },
+ { 0x54524106, 0xffffffff, "TR28026", NULL, NULL },
+Index: linux-2.6.17-rc5/sound/pci/ac97/ac97_patch.c
+===================================================================
+--- linux-2.6.17-rc5.orig/sound/pci/ac97/ac97_patch.c
++++ linux-2.6.17-rc5/sound/pci/ac97/ac97_patch.c
+@@ -375,7 +375,57 @@ int patch_yamaha_ymf753(struct snd_ac97
+ ac97->caps |= 0x04 << 10; /* Yamaha 3D enhancement */
+ return 0;
+ }
++/*
++ * UCB1400 codec
++ */
++
++#define AC97_UCB1400_FCSR1 0x6a
++#define AC97_UCB1400_FCSR2 0x6c
++
++static const snd_kcontrol_new_t ucb1400_snd_ac97_controls[] = {
++ AC97_SINGLE("Tone Control - Bass", AC97_UCB1400_FCSR1, 11, 4, 0),
++ AC97_SINGLE("Tone Control - Treble", AC97_UCB1400_FCSR1, 9, 2, 0),
++ AC97_SINGLE("Headphone Playback Switch", AC97_UCB1400_FCSR1, 6, 1, 0),
++ AC97_SINGLE("De-emphasis", AC97_UCB1400_FCSR1, 5, 1, 0),
++ AC97_SINGLE("DC Filter", AC97_UCB1400_FCSR1, 4, 1, 0),
++ AC97_SINGLE("Hi-pass Filter", AC97_UCB1400_FCSR1, 3, 1, 0),
++ AC97_SINGLE("ADC Filter", AC97_UCB1400_FCSR2, 12, 1, 0),
++};
++
++int patch_ucb1400(ac97_t * ac97)
++{
++ int err, i;
+
++ for(i = 0; i < ARRAY_SIZE(ucb1400_snd_ac97_controls); i++) {
++ if((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&ucb1400_snd_ac97_controls[i], ac97))) < 0)
++ return err;
++ }
++
++ snd_ac97_write_cache(ac97, AC97_UCB1400_FCSR1,
++ (0 << 11) | // 0 base boost
++ (0 << 9) | // 0 treble boost
++ (0 << 7) | // Mode = flat
++ (1 << 6) | // Headphones enable
++ (0 << 5) | // De-emphasis disabled
++ (1 << 4) | // DC filter enabled
++ (1 << 3) | // Hi-pass filter enabled
++ (0 << 2) | // disable interrupt signalling via GPIO_INT
++ (1 << 0) // clear ADC overflow status if set
++ );
++
++ snd_ac97_write_cache(ac97, AC97_UCB1400_FCSR2,
++ (0 << 15) | // must be 0
++ (0 << 13) | // must be 0
++ (1 << 12) | // ADC filter enabled
++ (0 << 10) | // must be 0
++ (0 << 4) | // Smart low power mode on neither Codec nor PLL
++ (0 << 0) // must be 0
++ );
++
++ return 0;
++}
++
++/*
+ /*
+ * May 2, 2003 Liam Girdwood <liam.girdwood at wolfsonmicro.com>
+ * removed broken wolfson00 patch.
+Index: linux-2.6.17-rc5/sound/pci/ac97/ac97_patch.h
+===================================================================
+--- linux-2.6.17-rc5.orig/sound/pci/ac97/ac97_patch.h
++++ linux-2.6.17-rc5/sound/pci/ac97/ac97_patch.h
+@@ -58,5 +58,6 @@ int patch_cm9780(struct snd_ac97 * ac97)
+ int patch_vt1616(struct snd_ac97 * ac97);
+ int patch_vt1617a(struct snd_ac97 * ac97);
+ int patch_it2646(struct snd_ac97 * ac97);
++int patch_ucb1400(ac97_t * ac97);
+ int mpatch_si3036(struct snd_ac97 * ac97);
+ int patch_lm4550(struct snd_ac97 * ac97);
============================================================
--- packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-touchscreen.patch 32673a857f878803615b3435a1644cc913798cee
+++ packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-touchscreen.patch 32673a857f878803615b3435a1644cc913798cee
@@ -0,0 +1,706 @@
+This patch is slightly adjusted from
+
+http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3073/1
+http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3074/2
+http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=3075/2
+
+in order to get it to apply cleanly to the released 2.6.15 codebase
+and to put the Kconfig stuff in a more reasonable place in the tree.
+Actually, I think Kconfig should probably separate the notion of the
+touchscreen driver and the AC97-MCP layer thing; but that problem is
+basically in the underlying mcp-based ucb1x00 driver layout in the
+first place.
+Index: linux-2.6.17-rc5/drivers/mfd/Makefile
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/Makefile
++++ linux-2.6.17-rc5/drivers/mfd/Makefile
+@@ -10,3 +10,6 @@ obj-$(CONFIG_MCP_UCB1200_TS) += ucb1x00-
+ ifeq ($(CONFIG_SA1100_ASSABET),y)
+ obj-$(CONFIG_MCP_UCB1200) += ucb1x00-assabet.o
+ endif
++
++obj-$(CONFIG_TOUCHSCREEN_UCB1400) += mcp-ac97.o ucb1x00-core.o ucb1x00-ts.o
++
+Index: linux-2.6.17-rc5/drivers/mfd/mcp-core.c
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/mcp-core.c
++++ linux-2.6.17-rc5/drivers/mfd/mcp-core.c
+@@ -18,7 +18,6 @@
+ #include <linux/slab.h>
+ #include <linux/string.h>
+
+-#include <asm/dma.h>
+ #include <asm/system.h>
+
+ #include "mcp.h"
+@@ -208,6 +207,7 @@ struct mcp *mcp_host_alloc(struct device
+ mcp->attached_device.bus = &mcp_bus_type;
+ mcp->attached_device.dma_mask = parent->dma_mask;
+ mcp->attached_device.release = mcp_release;
++ mcp->dev = &mcp->attached_device;
+ }
+ return mcp;
+ }
+Index: linux-2.6.17-rc5/drivers/mfd/mcp-sa11x0.c
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/mcp-sa11x0.c
++++ linux-2.6.17-rc5/drivers/mfd/mcp-sa11x0.c
+@@ -31,8 +31,12 @@
+ #include "mcp.h"
+
+ struct mcp_sa11x0 {
+- u32 mccr0;
+- u32 mccr1;
++ u32 mccr0;
++ u32 mccr1;
++ dma_device_t dma_audio_rd;
++ dma_device_t dma_audio_wr;
++ dma_device_t dma_telco_rd;
++ dma_device_t dma_telco_wr;
+ };
+
+ #define priv(mcp) ((struct mcp_sa11x0 *)mcp_priv(mcp))
+@@ -159,10 +163,10 @@ static int mcp_sa11x0_probe(struct platf
+ mcp->owner = THIS_MODULE;
+ mcp->ops = &mcp_sa11x0;
+ mcp->sclk_rate = data->sclk_rate;
+- mcp->dma_audio_rd = DMA_Ser4MCP0Rd;
+- mcp->dma_audio_wr = DMA_Ser4MCP0Wr;
+- mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
+- mcp->dma_telco_wr = DMA_Ser4MCP1Wr;
++ priv(mcp)->dma_audio_rd = DMA_Ser4MCP0Rd;
++ priv(mcp)->dma_audio_wr = DMA_Ser4MCP0Wr;
++ priv(mcp)->dma_telco_rd = DMA_Ser4MCP1Rd;
++ priv(mcp)->dma_telco_wr = DMA_Ser4MCP1Wr;
+
+ platform_set_drvdata(pdev, mcp);
+
+Index: linux-2.6.17-rc5/drivers/mfd/mcp.h
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/mcp.h
++++ linux-2.6.17-rc5/drivers/mfd/mcp.h
+@@ -19,11 +19,8 @@ struct mcp {
+ int use_count;
+ unsigned int sclk_rate;
+ unsigned int rw_timeout;
+- dma_device_t dma_audio_rd;
+- dma_device_t dma_audio_wr;
+- dma_device_t dma_telco_rd;
+- dma_device_t dma_telco_wr;
+ struct device attached_device;
++ struct device *dev;
+ };
+
+ struct mcp_ops {
+Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-assabet.c
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/ucb1x00-assabet.c
++++ linux-2.6.17-rc5/drivers/mfd/ucb1x00-assabet.c
+@@ -15,8 +15,6 @@
+ #include <linux/proc_fs.h>
+ #include <linux/device.h>
+
+-#include <asm/dma.h>
+-
+ #include "ucb1x00.h"
+
+ #define UCB1X00_ATTR(name,input)\
+Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-core.c
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/ucb1x00-core.c
++++ linux-2.6.17-rc5/drivers/mfd/ucb1x00-core.c
+@@ -23,6 +23,7 @@
+ #include <linux/init.h>
+ #include <linux/errno.h>
+ #include <linux/interrupt.h>
++#include <linux/kthread.h>
+ #include <linux/device.h>
+ #include <linux/mutex.h>
+
+@@ -31,6 +32,14 @@
+
+ #include "ucb1x00.h"
+
++#if (defined CONFIG_UCB1400) || (defined CONFIG_UCB1400_MODULE)
++#define UCB_IS_1400(id) ((id) == UCB_ID_1400)
++#define UCB_X_CSR1 0xe /* this fake entry will be translated by mcp */
++#define UCB_X_CSR2 0xf /* this fake entry will be translated by mcp */
++#else
++#define UCB_IS_1400(id) (0)
++#endif
++
+ static DEFINE_MUTEX(ucb1x00_mutex);
+ static LIST_HEAD(ucb1x00_drivers);
+ static LIST_HEAD(ucb1x00_devices);
+@@ -58,9 +67,9 @@ void ucb1x00_io_set_dir(struct ucb1x00 *
+ spin_lock_irqsave(&ucb->io_lock, flags);
+ ucb->io_dir |= out;
+ ucb->io_dir &= ~in;
++ spin_unlock_irqrestore(&ucb->io_lock, flags);
+
+ ucb1x00_reg_write(ucb, UCB_IO_DIR, ucb->io_dir);
+- spin_unlock_irqrestore(&ucb->io_lock, flags);
+ }
+
+ /**
+@@ -86,9 +95,9 @@ void ucb1x00_io_write(struct ucb1x00 *uc
+ spin_lock_irqsave(&ucb->io_lock, flags);
+ ucb->io_out |= set;
+ ucb->io_out &= ~clear;
++ spin_unlock_irqrestore(&ucb->io_lock, flags);
+
+ ucb1x00_reg_write(ucb, UCB_IO_DATA, ucb->io_out);
+- spin_unlock_irqrestore(&ucb->io_lock, flags);
+ }
+
+ /**
+@@ -178,7 +187,7 @@ unsigned int ucb1x00_adc_read(struct ucb
+ schedule_timeout(1);
+ }
+
+- return UCB_ADC_DAT(val);
++ return UCB_IS_1400(ucb->id) ? (val & 0x3ff) : ((val & 0x7fe0) >> 5);
+ }
+
+ /**
+@@ -223,6 +232,47 @@ static irqreturn_t ucb1x00_irq(int irqnr
+ return IRQ_HANDLED;
+ }
+
++/*
++ * A restriction with interrupts exists when using the ucb1400, as
++ * the codec read/write routines may sleep while waiting for codec
++ * access completion and uses semaphores for access control to the
++ * AC97 bus. A complete codec read cycle could take anywhere from
++ * 60 to 100uSec so we *definitely* don't want to spin inside the
++ * interrupt handler waiting for codec access. So, we handle the
++ * interrupt by scheduling a RT kernel thread to run in process
++ * context instead of interrupt context.
++ */
++static int ucb1x00_thread(void *_ucb)
++{
++ struct task_struct *tsk = current;
++ struct ucb1x00 *ucb = _ucb;
++
++ tsk->policy = SCHED_FIFO;
++ tsk->rt_priority = 1;
++
++ while (!kthread_should_stop()) {
++ wait_for_completion_interruptible(&ucb->irq_wait);
++ if (try_to_freeze())
++ continue;
++ ucb1x00_irq(ucb->irq, ucb, NULL);
++ enable_irq(ucb->irq);
++ }
++
++ ucb->irq_task = NULL;
++ return 0;
++}
++
++static irqreturn_t ucb1x00_threaded_irq(int irqnr, void *devid, struct pt_regs *regs)
++{
++ struct ucb1x00 *ucb = devid;
++ if (irqnr == ucb->irq) {
++ disable_irq(ucb->irq);
++ complete(&ucb->irq_wait);
++ return IRQ_HANDLED;
++ }
++ return IRQ_NONE;
++}
++
+ /**
+ * ucb1x00_hook_irq - hook a UCB1x00 interrupt
+ * @ucb: UCB1x00 structure describing chip
+@@ -276,18 +326,22 @@ void ucb1x00_enable_irq(struct ucb1x00 *
+
+ if (idx < 16) {
+ spin_lock_irqsave(&ucb->lock, flags);
+-
+- ucb1x00_enable(ucb);
+- if (edges & UCB_RISING) {
++ if (edges & UCB_RISING)
+ ucb->irq_ris_enbl |= 1 << idx;
+- ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
+- }
+- if (edges & UCB_FALLING) {
++ if (edges & UCB_FALLING)
+ ucb->irq_fal_enbl |= 1 << idx;
+- ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
+- }
+- ucb1x00_disable(ucb);
+ spin_unlock_irqrestore(&ucb->lock, flags);
++
++ ucb1x00_enable(ucb);
++
++ /* This prevents spurious interrupts on the UCB1400 */
++ ucb1x00_reg_write(ucb, UCB_IE_CLEAR, 1 << idx);
++ ucb1x00_reg_write(ucb, UCB_IE_CLEAR, 0);
++
++ ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
++ ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
++
++ ucb1x00_disable(ucb);
+ }
+ }
+
+@@ -305,18 +359,16 @@ void ucb1x00_disable_irq(struct ucb1x00
+
+ if (idx < 16) {
+ spin_lock_irqsave(&ucb->lock, flags);
+-
+- ucb1x00_enable(ucb);
+- if (edges & UCB_RISING) {
++ if (edges & UCB_RISING)
+ ucb->irq_ris_enbl &= ~(1 << idx);
+- ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
+- }
+- if (edges & UCB_FALLING) {
++ if (edges & UCB_FALLING)
+ ucb->irq_fal_enbl &= ~(1 << idx);
+- ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
+- }
+- ucb1x00_disable(ucb);
+ spin_unlock_irqrestore(&ucb->lock, flags);
++
++ ucb1x00_enable(ucb);
++ ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
++ ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
++ ucb1x00_disable(ucb);
+ }
+ }
+
+@@ -349,16 +401,17 @@ int ucb1x00_free_irq(struct ucb1x00 *ucb
+ ucb->irq_ris_enbl &= ~(1 << idx);
+ ucb->irq_fal_enbl &= ~(1 << idx);
+
+- ucb1x00_enable(ucb);
+- ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
+- ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
+- ucb1x00_disable(ucb);
+-
+ irq->fn = NULL;
+ irq->devid = NULL;
+ ret = 0;
+ }
+ spin_unlock_irq(&ucb->lock);
++
++ ucb1x00_enable(ucb);
++ ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
++ ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
++ ucb1x00_disable(ucb);
++
+ return ret;
+
+ bad:
+@@ -478,7 +531,7 @@ static int ucb1x00_probe(struct mcp *mcp
+ mcp_enable(mcp);
+ id = mcp_reg_read(mcp, UCB_ID);
+
+- if (id != UCB_ID_1200 && id != UCB_ID_1300) {
++ if (id != UCB_ID_1200 && id != UCB_ID_1300 && !UCB_IS_1400(id)) {
+ printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id);
+ goto err_disable;
+ }
+@@ -491,12 +544,13 @@ static int ucb1x00_probe(struct mcp *mcp
+ memset(ucb, 0, sizeof(struct ucb1x00));
+
+ ucb->cdev.class = &ucb1x00_class;
+- ucb->cdev.dev = &mcp->attached_device;
++ ucb->cdev.dev = mcp->dev;
+ strlcpy(ucb->cdev.class_id, "ucb1x00", sizeof(ucb->cdev.class_id));
+
+ spin_lock_init(&ucb->lock);
+ spin_lock_init(&ucb->io_lock);
+ sema_init(&ucb->adc_sem, 1);
++ init_completion(&ucb->irq_wait);
+
+ ucb->id = id;
+ ucb->mcp = mcp;
+@@ -507,13 +561,22 @@ static int ucb1x00_probe(struct mcp *mcp
+ goto err_free;
+ }
+
+- ret = request_irq(ucb->irq, ucb1x00_irq, SA_TRIGGER_RISING,
+- "UCB1x00", ucb);
++ ret = request_irq(ucb->irq,
++ UCB_IS_1400(id) ? ucb1x00_threaded_irq : ucb1x00_irq,
++ 0, "UCB1x00", ucb);
+ if (ret) {
+ printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n",
+ ucb->irq, ret);
+ goto err_free;
+ }
++ if (UCB_IS_1400(id)) {
++ ucb->irq_task = kthread_run(ucb1x00_thread, ucb, "kUCB1x00d");
++ if (IS_ERR(ucb->irq_task)) {
++ ret = PTR_ERR(ucb->irq_task);
++ ucb->irq_task = NULL;
++ goto err_irq;
++ }
++ }
+
+ mcp_set_drvdata(mcp, ucb);
+
+@@ -531,6 +594,8 @@ static int ucb1x00_probe(struct mcp *mcp
+ goto out;
+
+ err_irq:
++ if (UCB_IS_1400(id) && ucb->irq_task)
++ kthread_stop(ucb->irq_task);
+ free_irq(ucb->irq, ucb);
+ err_free:
+ kfree(ucb);
+@@ -553,6 +618,8 @@ static void ucb1x00_remove(struct mcp *m
+ }
+ mutex_unlock(&ucb1x00_mutex);
+
++ if (UCB_IS_1400(ucb->id) && ucb->irq_task)
++ kthread_stop(ucb->irq_task);
+ free_irq(ucb->irq, ucb);
+ class_device_unregister(&ucb->cdev);
+ }
+Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
+===================================================================
+--- linux-2.6.17-rc5.orig/drivers/mfd/ucb1x00-ts.c
++++ linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
+@@ -33,10 +33,8 @@
+ #include <linux/slab.h>
+ #include <linux/kthread.h>
+
+-#include <asm/dma.h>
+-#include <asm/semaphore.h>
+-#include <asm/arch/collie.h>
+ #include <asm/mach-types.h>
++#include <asm/arch-sa1100/collie.h>
+
+ #include "ucb1x00.h"
+
+@@ -45,7 +43,7 @@ struct ucb1x00_ts {
+ struct input_dev *idev;
+ struct ucb1x00 *ucb;
+
+- wait_queue_head_t irq_wait;
++ struct completion i%s
>>> DIFF TRUNCATED @ 16K
More information about the Openembedded-commits
mailing list