iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Cástor Muñoz
|
|
|
|
* Code based on openiBoot project
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "panic.h"
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
#include "gpio-s5l8702.h"
|
|
|
|
|
|
|
|
|
2014-12-06 18:00:34 +00:00
|
|
|
int rec_hw_ver;
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
static uint32_t gpio_data[] =
|
|
|
|
{
|
|
|
|
0x5322222F, 0xEEEEEE00, 0x2332EEEE, 0x3333E222,
|
|
|
|
0x33333333, 0x33333333, 0x3F000E33, 0xEEEEEEEE,
|
|
|
|
0xEEEEEEEE, 0xEEEEEEEE, 0xE0EEEEEE, 0xEE00EE0E,
|
|
|
|
0xEEEE0EEE, 0xEEEEEEEE, 0xEE2222EE, 0xEEEE0EEE
|
|
|
|
};
|
|
|
|
|
|
|
|
void INIT_ATTR gpio_preinit(void)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
PCON(i) = gpio_data[i];
|
|
|
|
PUNB(i) = 0;
|
|
|
|
PUNC(i) = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-06 18:00:34 +00:00
|
|
|
void INIT_ATTR gpio_init(void)
|
|
|
|
{
|
|
|
|
/* Capture hardware versions:
|
|
|
|
*
|
|
|
|
* HW version 1 includes an amplifier for the jack plug
|
|
|
|
* microphone, it is activated configuring GPIO E7 as output
|
|
|
|
* high. It is posible to detect capture HW version (even
|
|
|
|
* when HP are not plugged) reading GPIO E7:
|
|
|
|
*
|
|
|
|
* Ver GPIO E7 models capture support
|
|
|
|
* --- ------- ------ ---------------
|
|
|
|
* 0 1 80/160fat dock line-in
|
|
|
|
* 1 0 120/160slim dock line-in + jack mic
|
|
|
|
*/
|
|
|
|
GPIOCMD = 0xe0700;
|
2017-04-15 22:36:11 +00:00
|
|
|
udelay(10000);
|
2014-12-06 18:00:34 +00:00
|
|
|
rec_hw_ver = (PDAT(14) & (1 << 7)) ? 0 : 1;
|
2016-05-21 23:12:35 +00:00
|
|
|
GPIOCMD = 0xe070e; /* restore default configuration */
|
2014-12-06 18:00:34 +00:00
|
|
|
|
|
|
|
if (rec_hw_ver == 0) {
|
|
|
|
GPIOCMD = 0xe060e;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* GPIO E6 is connected to mikey IRQ line (active low),
|
|
|
|
configure it as pull-up input */
|
|
|
|
GPIOCMD = 0xe0600;
|
|
|
|
PUNB(14) |= (1 << 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
#if 0
|
|
|
|
uint32_t gpio_group_get(int group)
|
|
|
|
{
|
|
|
|
uint32_t pcon = PCON(group);
|
|
|
|
uint32_t pdat = PDAT(group);
|
|
|
|
uint32_t group_cfg = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
int pin_cfg = pcon & 0xF;
|
|
|
|
if (pin_cfg == 1) /* output */
|
|
|
|
pin_cfg = 0xE | ((pdat >> i) & 1);
|
|
|
|
group_cfg = (group_cfg >> 4) | (pin_cfg << 28);
|
|
|
|
pcon >>= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
return group_cfg;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpio_group_set(int group, uint32_t mask, uint32_t cfg)
|
|
|
|
{
|
|
|
|
PCON(group) = (PCON(group) & ~mask) | (cfg & mask);
|
|
|
|
}
|
2016-05-21 23:12:35 +00:00
|
|
|
#endif
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
/*
|
|
|
|
* eINT API
|
|
|
|
*/
|
|
|
|
#ifndef EINT_MAX_HANDLERS
|
|
|
|
#define EINT_MAX_HANDLERS 1
|
|
|
|
#endif
|
|
|
|
static struct eint_handler* l_handlers[EINT_MAX_HANDLERS] IDATA_ATTR;
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
void INIT_ATTR eint_init(void)
|
|
|
|
{
|
|
|
|
/* disable external interrupts */
|
|
|
|
for (int i = 0; i < EIC_N_GROUPS; i++)
|
|
|
|
EIC_INTEN(i) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void eint_register(struct eint_handler *h)
|
|
|
|
{
|
|
|
|
int i;
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
int flags = disable_irq_save();
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
for (i = 0; i < EINT_MAX_HANDLERS; i++) {
|
|
|
|
if (!l_handlers[i]) {
|
|
|
|
int group = EIC_GROUP(h->gpio_n);
|
|
|
|
int index = EIC_INDEX(h->gpio_n);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
EIC_INTTYPE(group) |= (h->type << index);
|
|
|
|
EIC_INTLEVEL(group) |= (h->level << index);
|
|
|
|
EIC_INTSTAT(group) = (1 << index); /* clear */
|
|
|
|
EIC_INTEN(group) |= (1 << index); /* enable */
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
/* XXX: valid only for gpio_n = 0..127 (IRQ_EXT0..IRQ_EXT3) */
|
|
|
|
VIC0INTENABLE = 1 << (IRQ_EXT0 + (h->gpio_n >> 5));
|
|
|
|
|
|
|
|
l_handlers[i] = h;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
|
|
|
restore_irq(flags);
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
if (i == EINT_MAX_HANDLERS)
|
|
|
|
panicf("%s(): too many handlers!", __func__);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
}
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
void eint_unregister(struct eint_handler *h)
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
{
|
|
|
|
int flags = disable_irq_save();
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
for (int i = 0; i < EINT_MAX_HANDLERS; i++) {
|
|
|
|
if (l_handlers[i] == h) {
|
|
|
|
int group = EIC_GROUP(h->gpio_n);
|
|
|
|
int index = EIC_INDEX(h->gpio_n);
|
|
|
|
|
|
|
|
EIC_INTEN(group) &= ~(1 << index); /* disable */
|
|
|
|
|
|
|
|
/* XXX: valid only for gpio_n = 0..127 (IRQ_EXT0..IRQ_EXT3) */
|
|
|
|
if (EIC_INTEN(group) == 0)
|
|
|
|
VIC0INTENCLEAR = 1 << (IRQ_EXT0 + (h->gpio_n >> 5));
|
|
|
|
|
|
|
|
l_handlers[i] = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
|
|
|
restore_irq(flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ISR */
|
2016-05-26 07:59:44 +00:00
|
|
|
static void ICODE_ATTR eint_handler(int group)
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
{
|
|
|
|
int i;
|
2016-05-21 23:12:35 +00:00
|
|
|
uint32_t ints;
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
ints = EIC_INTSTAT(group) & EIC_INTEN(group);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
for (i = 0; i < EINT_MAX_HANDLERS; i++) {
|
|
|
|
struct eint_handler *h = l_handlers[i];
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
if (!h || (EIC_GROUP(h->gpio_n) != group))
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
continue;
|
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
uint32_t bit = 1 << EIC_INDEX(h->gpio_n);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
if (ints & bit) {
|
|
|
|
/* Clear INTTYPE_EDGE interrupt, to clear INTTYPE_LEVEL
|
|
|
|
interrupts the source (line level) must be "cleared" */
|
|
|
|
if (h->type == EIC_INTTYPE_EDGE)
|
|
|
|
EIC_INTSTAT(group) = bit; /* clear */
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
if (h->autoflip)
|
|
|
|
EIC_INTLEVEL(group) ^= bit; /* swap level */
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
|
2016-05-21 23:12:35 +00:00
|
|
|
if (h->isr)
|
2016-05-26 07:59:44 +00:00
|
|
|
h->isr(h); /* exec app handler */
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICODE_ATTR INT_EXT0(void)
|
|
|
|
{
|
2016-05-21 23:12:35 +00:00
|
|
|
eint_handler(6);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ICODE_ATTR INT_EXT1(void)
|
|
|
|
{
|
2016-05-21 23:12:35 +00:00
|
|
|
eint_handler(5);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ICODE_ATTR INT_EXT2(void)
|
|
|
|
{
|
2016-05-21 23:12:35 +00:00
|
|
|
eint_handler(4);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ICODE_ATTR INT_EXT3(void)
|
|
|
|
{
|
2016-05-21 23:12:35 +00:00
|
|
|
eint_handler(3);
|
iPod Classic: s5l8702 GPIO interrupt controller.
This patch implements a simple API to use the external interrupt
hardware present on s5l8702 (GPIO interrupt controller). This
GPIOIC has been fully tested using emcore apps.
Code is based on openiBoot project, there are a few modifications
to optimize space considering we will only use two or three external
interrupts. The API compiles and works, but has been never used,
therefore probably will need some changes to the final version.
External interrupts are necessary for jack remote+mic controller
(see iAP Interface Specifiction: Headphone Remote and Mic System),
this controller is located at I2C bus address 0x72, there is a IRQ
line for remote button press/release events routed to GPIO E6. At
this moment, the functionallity of this controller has been
extensively tested using emcore, getting a lot of information about
how it works. Microphone is already working on RB, jack accessory
detection and button events are work in progress.
PMU IRQ line is also routed to GPIO F3, it signals many events:
holdswitch, usb plug, wall adapter, low battery... The use of PMU
interrupts is the orthodox way of doing things, at this moment
there is no work done in this direction, there are a lot of PMU
events and i think it is a matter of discursion what to do and how.
Change-Id: Icc2e48965e664ca56c9518d84a81c9d9fdd31736
2014-11-10 03:35:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ICODE_ATTR INT_EXT6(void)
|
|
|
|
{
|
2016-05-21 23:12:35 +00:00
|
|
|
eint_handler(0);
|
2016-02-04 21:49:01 +00:00
|
|
|
}
|