summaryrefslogtreecommitdiffstats
path: root/package/fonera-mp3/Makefile
blob: 1cdbd4c51cc9cabeee75ce5c1ae62ba62546223f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 8444 2007-08-20 16:12:24Z nbd $

include $(TOPDIR)/rules.mk

PKG_NAME:=fonera-mp3d
PKG_RELEASE:=1
PKG_VERSION:=1.0

PKG_BUILD_DEPENDS:=libjson

include $(INCLUDE_DIR)/package.mk

define Package/fonera-mp3d
  SECTION:=utils
  CATEGORY:=Utilities
  DEPENDS:=@TARGET_atheros
  TITLE:=Daemon for fonera-mp3
endef

define Package/fonera-mp3d/description
 Daemon to drive a vs1011X mp3 decoder attached to the 
 fonera gpio pins
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR) \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)"
	$(MAKE) -C $(PKG_BUILD_DIR)/cgi \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS) -I $(STAGING_DIR)/usr/include/json" \
		LDLIBS="$(STAGING_DIR)/usr/lib/libjson.a"
	$(MAKE) -C $(PKG_BUILD_DIR)/cli \
		$(TARGET_CONFIGURE_OPTS) \
		CFLAGS="$(TARGET_CFLAGS)" 
endef

define Package/fonera-mp3d/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/mp3d $(1)/usr/bin/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/mplay $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/www/cgi-bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cgi/mp3.cgi $(1)/www/cgi-bin/
	ln -sf mp3.cgi $(1)/www/cgi-bin/mp3_cmd.cgi
	ln -sf mp3.cgi $(1)/www/cgi-bin/mp3_json.cgi 
	ln -sf mp3.cgi $(1)/www/cgi-bin/mp3_remote.cgi 
	$(INSTALL_DIR) $(1)/www/local
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/cgi/{stylesheet.css,json.js} $(1)/www/local/
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/mp3d.init $(1)/etc/init.d/mp3d
endef

$(eval $(call BuildPackage,fonera-mp3d))
("Oh crap PMU IRQ register read failed -- " - "retrying later %d\n", ret); + dev_info(&pcf->client.dev, + "Oh crap PMU IRQ register read failed -- " + "retrying later %d\n", ret); /* - * this situation can happen during resume, just defer - * handling the interrupt until enough I2C is up we can - * actually talk to the PMU. We can't just ignore this - * because we are on a falling edge interrupt and our - * PMU interrupt source does not clear until we read these - * interrupt source registers. + * it shouldn't fail, we no longer attempt to use I2C while + * it can be suspended. But we don't have much option but to + * retry if if it ever did fail, because if we don't service + * the interrupt to clear it, we will never see another PMU + * interrupt edge. */ - if (!schedule_work(&pcf->work) && !pcf->working) - dev_dbg(&pcf->client.dev, "work item may be lost\n"); - - /* we don't put the device here, hold it for next time */ - mutex_unlock(&pcf->working_lock); - /* don't spew, delaying whatever else is happening */ - msleep(1); - return; + goto reschedule; } /* hey did we just resume? */ if (pcf->have_been_suspended) { + /* resume is officially over now then */ pcf->have_been_suspended = 0; + /* * grab a copy of resume interrupt reasons * from pcf50633 POV @@ -1044,6 +1059,19 @@ static void pcf50633_work(struct work_struct *work) input_sync(pcf->input_dev); put_device(&pcf->client.dev); mutex_unlock(&pcf->working_lock); + + return; + +reschedule: + /* don't spew, delaying whatever else is happening */ + msleep(100); + + dev_info(&pcf->client.dev, "rescheduling interrupt service\n"); + if (!schedule_work(&pcf->work)) + dev_err(&pcf->client.dev, "int service reschedule failed\n"); + + /* we don't put the device here, hold it for next time */ + mutex_unlock(&pcf->working_lock); } static irqreturn_t pcf50633_irq(int irq, void *_pcf) @@ -1051,10 +1079,11 @@ static irqreturn_t pcf50633_irq(int irq, void *_pcf) struct pcf50633_data *pcf = _pcf; DEBUGP("entering(irq=%u, pcf=%p): scheduling work\n", irq, _pcf); + dev_info(&pcf->client.dev, "pcf50633_irq scheduling work\n"); get_device(&pcf->client.dev); if (!schedule_work(&pcf->work) && !pcf->working) - dev_dbg(&pcf->client.dev, "work item may be lost\n"); + dev_err(&pcf->client.dev, "work item may be lost\n"); return IRQ_HANDLED; } @@ -2234,9 +2263,9 @@ static int pcf50633_suspend(struct device *dev, pm_message_t state) int pcf50633_ready(struct pcf50633_data *pcf) { if (!pcf) - return -EBUSY; + return -EACCES; - if (pcf->have_been_suspended) + if (pcf->have_been_suspended && (pcf->have_been_suspended < 3)) return -EBUSY; return 0; -- 1.5.6.3