2008-05-21 08:42:11 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008 by Michael Sevakis
|
|
|
|
*
|
|
|
|
* Gigabeat S MC13783 event descriptions
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2008-05-21 08:42:11 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
2010-04-10 09:24:06 +00:00
|
|
|
#include "spi-imx31.h"
|
2008-05-21 08:42:11 +00:00
|
|
|
#include "mc13783.h"
|
|
|
|
#include "mc13783-target.h"
|
|
|
|
#include "adc-target.h"
|
|
|
|
#include "button-target.h"
|
2010-04-09 01:21:53 +00:00
|
|
|
#include "power-gigabeat-s.h"
|
2008-12-21 18:10:36 +00:00
|
|
|
#include "powermgmt-target.h"
|
2008-05-21 08:42:11 +00:00
|
|
|
|
2010-04-10 09:24:06 +00:00
|
|
|
/* Gigabeat S mc13783 serial interface node. */
|
|
|
|
|
|
|
|
/* This is all based on communicating with the MC13783 PMU which is on
|
|
|
|
* CSPI2 with the chip select at 0. The LCD controller resides on
|
|
|
|
* CSPI3 cs1, but we have no idea how to communicate to it */
|
|
|
|
struct spi_node mc13783_spi =
|
|
|
|
{
|
|
|
|
CSPI2_NUM, /* CSPI module 2 */
|
|
|
|
CSPI_CONREG_CHIP_SELECT_SS0 | /* Chip select 0 */
|
|
|
|
CSPI_CONREG_DRCTL_DONT_CARE | /* Don't care about CSPI_RDY */
|
|
|
|
CSPI_CONREG_DATA_RATE_DIV_32 | /* Clock = IPG_CLK/32 = 2,062,500Hz. */
|
|
|
|
CSPI_BITCOUNT(32-1) | /* All 32 bits are to be transferred */
|
|
|
|
CSPI_CONREG_SSPOL | /* SS active high */
|
|
|
|
CSPI_CONREG_SSCTL | /* Negate SS between SPI bursts */
|
|
|
|
CSPI_CONREG_MODE, /* Master mode */
|
|
|
|
0, /* SPI clock - no wait states */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-05-21 08:42:11 +00:00
|
|
|
/* Gigabeat S definitions for static MC13783 event registration */
|
|
|
|
|
2010-05-07 10:53:19 +00:00
|
|
|
const struct mc13783_event mc13783_events[MC13783_NUM_EVENTS] =
|
2008-05-21 08:42:11 +00:00
|
|
|
{
|
|
|
|
[MC13783_ADCDONE_EVENT] = /* ADC conversion complete */
|
|
|
|
{
|
2012-01-02 18:32:35 +00:00
|
|
|
.int_id = MC13783_INT_ID_ADCDONE,
|
|
|
|
.sense = 0,
|
2008-05-21 08:42:11 +00:00
|
|
|
.callback = adc_done,
|
|
|
|
},
|
|
|
|
[MC13783_ONOFD1_EVENT] = /* Power button */
|
|
|
|
{
|
2012-01-02 18:32:35 +00:00
|
|
|
.int_id = MC13783_INT_ID_ONOFD1,
|
|
|
|
.sense = MC13783_ONOFD1S,
|
2008-05-21 08:42:11 +00:00
|
|
|
.callback = button_power_event,
|
|
|
|
},
|
2008-12-21 18:10:36 +00:00
|
|
|
[MC13783_SE1_EVENT] = /* Main charger detection */
|
2008-05-21 08:42:11 +00:00
|
|
|
{
|
2012-01-02 18:32:35 +00:00
|
|
|
.int_id = MC13783_INT_ID_SE1,
|
|
|
|
.sense = MC13783_SE1S,
|
2008-12-21 18:10:36 +00:00
|
|
|
.callback = charger_main_detect_event,
|
2008-05-21 08:42:11 +00:00
|
|
|
},
|
2008-12-21 18:10:36 +00:00
|
|
|
[MC13783_USB_EVENT] = /* USB insertion/USB charger detection */
|
2008-05-21 08:42:11 +00:00
|
|
|
{
|
2012-01-02 18:32:35 +00:00
|
|
|
.int_id = MC13783_INT_ID_USB,
|
|
|
|
.sense = MC13783_USB4V4S,
|
2008-05-21 08:42:11 +00:00
|
|
|
.callback = usb_connect_event,
|
|
|
|
},
|
2008-12-21 18:10:36 +00:00
|
|
|
#ifdef HAVE_HEADPHONE_DETECTION
|
|
|
|
[MC13783_ONOFD2_EVENT] = /* Headphone jack */
|
|
|
|
{
|
2012-01-02 18:32:35 +00:00
|
|
|
.int_id = MC13783_INT_ID_ONOFD2,
|
|
|
|
.sense = 0,
|
2008-12-21 18:10:36 +00:00
|
|
|
.callback = headphone_detect_event,
|
|
|
|
},
|
|
|
|
#endif
|
2008-05-21 08:42:11 +00:00
|
|
|
};
|