diff --git a/firmware/SOURCES b/firmware/SOURCES index 887445b53c..8ba45af533 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -82,19 +82,19 @@ target/hosted/rtc.c target/hosted/kernel-unix.c target/hosted/filesystem-unix.c target/hosted/lc-unix.c -target/hosted/ypr0/button-ypr0.c -target/hosted/ypr0/lcd-ypr0.c -target/hosted/ypr0/system-ypr0.c +target/hosted/samsungypr/ypr0/button-ypr0.c +target/hosted/samsungypr/lcd-ypr.c +target/hosted/samsungypr/ypr0/system-ypr0.c thread.c #ifdef HAVE_BACKLIGHT -target/hosted/ypr0/backlight-ypr0.c +target/hosted/samsungypr/ypr0/backlight-ypr0.c #endif -target/hosted/ypr0/ascodec-ypr0.c -target/hosted/ypr0/powermgmt-ypr0.c -target/hosted/ypr0/gpio_ypr0.c -target/hosted/ypr0/audio-ypr0.c +target/hosted/samsungypr/ypr0/ascodec-ypr0.c +target/hosted/samsungypr/ypr0/powermgmt-ypr0.c +target/hosted/samsungypr/gpio_ypr.c +target/hosted/samsungypr/ypr0/audio-ypr0.c #if CONFIG_TUNER -target/hosted/ypr0/radio-ypr0.c +target/hosted/samsungypr/radio-ypr.c #endif #endif diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h index debe9a3f80..c81fc645bb 100644 --- a/firmware/export/config/samsungypr0.h +++ b/firmware/export/config/samsungypr0.h @@ -12,9 +12,6 @@ #define MODEL_NAME "Samsung YP-R0" -/* Indeed to check that */ -/*TODO: R0 should charge battery automatically, no software stuff to manage that. Just to know about some as3543 registers, that should be set after loading samsung's afe.ko module - */ /*TODO: implement USB data transfer management -> see safe mode script and think a way to implemtent it in the code */ #define USB_NONE @@ -94,20 +91,26 @@ #define HAVE_AS3514 #define HAVE_AS3543 +/* We don't have hardware controls */ #define HAVE_SW_TONE_CONTROLS +/* We have the Si4709, which supports RDS */ #define CONFIG_TUNER SI4700 #define HAVE_TUNER_PWR_CTRL - #define HAVE_RDS_CAP /* Define this for FM radio input available */ #define HAVE_FMRADIO_IN #define INPUT_SRC_CAPS SRC_CAP_FMRADIO -/* We have a GPIO that detects it */ +/* We have a GPIO pin that detects this */ #define HAVE_HEADPHONE_DETECTION +/* FIXME + * Lot of people reports bad battery life and funny charging times. + * Check what's going on... + */ + #define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */ #define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ diff --git a/firmware/target/hosted/ypr0/adc-target.h b/firmware/target/hosted/samsungypr/adc-target.h similarity index 100% rename from firmware/target/hosted/ypr0/adc-target.h rename to firmware/target/hosted/samsungypr/adc-target.h diff --git a/firmware/target/hosted/ypr0/backlight-target.h b/firmware/target/hosted/samsungypr/backlight-target.h similarity index 94% rename from firmware/target/hosted/ypr0/backlight-target.h rename to firmware/target/hosted/samsungypr/backlight-target.h index 561e159e8c..21db75c8c9 100644 --- a/firmware/target/hosted/ypr0/backlight-target.h +++ b/firmware/target/hosted/samsungypr/backlight-target.h @@ -5,7 +5,7 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: backlight-target.h 19322 2008-12-04 04:16:53Z jethead71 $ + * $Id$ * * Copyright (C) 2011 by Lorenzo Miori * diff --git a/firmware/target/hosted/ypr0/dir-target.h b/firmware/target/hosted/samsungypr/dir-target.h similarity index 100% rename from firmware/target/hosted/ypr0/dir-target.h rename to firmware/target/hosted/samsungypr/dir-target.h diff --git a/firmware/target/hosted/ypr0/gpio_ypr0.c b/firmware/target/hosted/samsungypr/gpio_ypr.c similarity index 95% rename from firmware/target/hosted/ypr0/gpio_ypr0.c rename to firmware/target/hosted/samsungypr/gpio_ypr.c index 3ee371d562..0d4a7eceae 100644 --- a/firmware/target/hosted/ypr0/gpio_ypr0.c +++ b/firmware/target/hosted/samsungypr/gpio_ypr.c @@ -23,7 +23,7 @@ #include #include #include -#include /* includes r0GPIOioctl.h */ +#include /* includes common ioctl device definitions */ #include static int r0_gpio_dev = 0; diff --git a/firmware/target/hosted/ypr0/lcd-target.h b/firmware/target/hosted/samsungypr/lcd-target.h similarity index 100% rename from firmware/target/hosted/ypr0/lcd-target.h rename to firmware/target/hosted/samsungypr/lcd-target.h diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/samsungypr/lcd-ypr.c similarity index 100% rename from firmware/target/hosted/ypr0/lcd-ypr0.c rename to firmware/target/hosted/samsungypr/lcd-ypr.c diff --git a/firmware/target/hosted/ypr0/radio-ypr0.c b/firmware/target/hosted/samsungypr/radio-ypr.c similarity index 98% rename from firmware/target/hosted/ypr0/radio-ypr0.c rename to firmware/target/hosted/samsungypr/radio-ypr.c index 14d56826c1..1929bb7c90 100644 --- a/firmware/target/hosted/ypr0/radio-ypr0.c +++ b/firmware/target/hosted/samsungypr/radio-ypr.c @@ -6,7 +6,8 @@ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * - * Module wrapper for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) of Samsung YP-R0 + * Module wrapper for SI4709 FM Radio Chip, using /dev/si470x (si4709.ko) + * Samsung YP-R0 & Samsung YP-R1 * * Copyright (c) 2012 Lorenzo Miori * @@ -27,7 +28,7 @@ #include "string.h" #include "kernel.h" -#include "radio-ypr0.h" +#include "radio-ypr.h" #include "rds.h" #include "si4700.h" #include "power.h" diff --git a/firmware/target/hosted/ypr0/radio-ypr0.h b/firmware/target/hosted/samsungypr/radio-ypr.h similarity index 100% rename from firmware/target/hosted/ypr0/radio-ypr0.h rename to firmware/target/hosted/samsungypr/radio-ypr.h diff --git a/firmware/target/hosted/ypr0/si4709.h b/firmware/target/hosted/samsungypr/si4709.h similarity index 100% rename from firmware/target/hosted/ypr0/si4709.h rename to firmware/target/hosted/samsungypr/si4709.h diff --git a/firmware/target/hosted/ypr0/system-target.h b/firmware/target/hosted/samsungypr/system-target.h similarity index 100% rename from firmware/target/hosted/ypr0/system-target.h rename to firmware/target/hosted/samsungypr/system-target.h diff --git a/firmware/target/hosted/ypr0/ascodec-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/ascodec-ypr0.c similarity index 91% rename from firmware/target/hosted/ypr0/ascodec-ypr0.c rename to firmware/target/hosted/samsungypr/ypr0/ascodec-ypr0.c index cc923842df..24362af0c0 100644 --- a/firmware/target/hosted/ypr0/ascodec-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/ascodec-ypr0.c @@ -5,10 +5,10 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * + * * Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0 * - * Copyright (c) 2011 Lorenzo Miori + * Copyright (c) 2011-2013 Lorenzo Miori * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -29,11 +29,10 @@ #include "ascodec.h" -int afe_dev = -1; +static int afe_dev = -1; -/* ioctl parameter struct */ +/* Structure used for ioctl module call */ struct codec_req_struct { -/* This works for every kind of afe.ko module requests */ unsigned char reg; /* Main register address */ unsigned char subreg; /* Set this only if you are reading/writing a PMU register*/ unsigned char value; /* To be read if reading a register; to be set if writing to a register */ @@ -49,28 +48,31 @@ struct codec_req_struct { /* Read from a PMU register */ #define IOCTL_SUBREG_READ 0x80034103 - +/* Open device */ void ascodec_init(void) { afe_dev = open("/dev/afe", O_RDWR); } +/* Close device */ void ascodec_close(void) { - if (afe_dev >= 0) { + if (afe_dev >= 0) close(afe_dev); - } } -/* Read functions returns -1 if fail, otherwise the register's value if success */ -/* Write functions return >= 0 if success, otherwise -1 if fail */ - +/* Write register. + * Returns >= 0 if success, -1 if fail + */ int ascodec_write(unsigned int reg, unsigned int value) { struct codec_req_struct r = { .reg = reg, .value = value }; return ioctl(afe_dev, IOCTL_REG_WRITE, &r); } +/* Read register. + * Returns -1 if fail, otherwise the register's value if success + */ int ascodec_read(unsigned int reg) { struct codec_req_struct r = { .reg = reg }; @@ -81,6 +83,7 @@ int ascodec_read(unsigned int reg) return retval; } +/* Write PMU register */ void ascodec_write_pmu(unsigned int index, unsigned int subreg, unsigned int value) { @@ -88,6 +91,7 @@ void ascodec_write_pmu(unsigned int index, unsigned int subreg, ioctl(afe_dev, IOCTL_SUBREG_WRITE, &r); } +/* Read PMU register */ int ascodec_read_pmu(unsigned int index, unsigned int subreg) { struct codec_req_struct r = { .reg = index, .subreg = subreg, }; diff --git a/firmware/target/hosted/ypr0/audio-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/audio-ypr0.c similarity index 100% rename from firmware/target/hosted/ypr0/audio-ypr0.c rename to firmware/target/hosted/samsungypr/ypr0/audio-ypr0.c diff --git a/firmware/target/hosted/ypr0/backlight-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c similarity index 100% rename from firmware/target/hosted/ypr0/backlight-ypr0.c rename to firmware/target/hosted/samsungypr/ypr0/backlight-ypr0.c diff --git a/firmware/target/hosted/ypr0/button-target.h b/firmware/target/hosted/samsungypr/ypr0/button-target.h similarity index 100% rename from firmware/target/hosted/ypr0/button-target.h rename to firmware/target/hosted/samsungypr/ypr0/button-target.h diff --git a/firmware/target/hosted/ypr0/button-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c similarity index 97% rename from firmware/target/hosted/ypr0/button-ypr0.c rename to firmware/target/hosted/samsungypr/ypr0/button-ypr0.c index e66ca22737..e3ad309187 100644 --- a/firmware/target/hosted/ypr0/button-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/button-ypr0.c @@ -24,7 +24,7 @@ #include "kernel.h" #include "system.h" #include "button-target.h" -#include /* For headphones sense and buttons */ +#include /* For headphones sense and buttons */ int button_read_device(void) { diff --git a/firmware/target/hosted/ypr0/gpio_ypr0.h b/firmware/target/hosted/samsungypr/ypr0/gpio-target.h similarity index 100% rename from firmware/target/hosted/ypr0/gpio_ypr0.h rename to firmware/target/hosted/samsungypr/ypr0/gpio-target.h diff --git a/firmware/target/hosted/ypr0/powermgmt-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/powermgmt-ypr0.c similarity index 96% rename from firmware/target/hosted/ypr0/powermgmt-ypr0.c rename to firmware/target/hosted/samsungypr/ypr0/powermgmt-ypr0.c index 347e5fa146..6e04d25f58 100644 --- a/firmware/target/hosted/ypr0/powermgmt-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/powermgmt-ypr0.c @@ -5,7 +5,6 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: powermgmt-sim.c 29543 2011-03-08 19:33:30Z thomasjfox $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,7 +23,7 @@ #include "file.h" #include "adc.h" #include "sc900776.h" -#include "radio-ypr0.h" +#include "radio-ypr.h" const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = { diff --git a/firmware/target/hosted/ypr0/r0GPIOIoctl.h b/firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h similarity index 100% rename from firmware/target/hosted/ypr0/r0GPIOIoctl.h rename to firmware/target/hosted/samsungypr/ypr0/r0GPIOIoctl.h diff --git a/firmware/target/hosted/ypr0/sc900776.h b/firmware/target/hosted/samsungypr/ypr0/sc900776.h similarity index 100% rename from firmware/target/hosted/ypr0/sc900776.h rename to firmware/target/hosted/samsungypr/ypr0/sc900776.h diff --git a/firmware/target/hosted/ypr0/system-ypr0.c b/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c similarity index 95% rename from firmware/target/hosted/ypr0/system-ypr0.c rename to firmware/target/hosted/samsungypr/ypr0/system-ypr0.c index 11275c7809..7ee2697a24 100644 --- a/firmware/target/hosted/ypr0/system-ypr0.c +++ b/firmware/target/hosted/samsungypr/ypr0/system-ypr0.c @@ -5,9 +5,8 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: system-sdl.c 29925 2011-05-25 20:11:03Z thomasjfox $ * - * Copyright (C) 2006 by Daniel Everton + * Copyright (C) 2011-2013 by Lorenzo Miori * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -31,7 +30,7 @@ #endif #include "ascodec.h" -#include "gpio_ypr0.h" +#include "gpio-target.h" void power_off(void) { @@ -52,6 +51,7 @@ void system_init(void) #if defined(HAVE_SDL_AUDIO) || defined(HAVE_SDL_THREADS) || defined(HAVE_SDL) SDL_Init(0); /* need this if using any SDL subsystem */ #endif + /* Here begins our platform specific initilization for various things */ ascodec_init(); gpio_init(); diff --git a/firmware/target/hosted/ypr0/ypr0.make b/firmware/target/hosted/samsungypr/ypr0/ypr0.make similarity index 100% rename from firmware/target/hosted/ypr0/ypr0.make rename to firmware/target/hosted/samsungypr/ypr0/ypr0.make diff --git a/tools/configure b/tools/configure index 442b23899b..353b991b04 100755 --- a/tools/configure +++ b/tools/configure @@ -3347,8 +3347,8 @@ fi swcodec="yes" # architecture, manufacturer and model for the target-tree build t_cpu="hosted" - t_manufacturer="ypr0" - t_model="app" + t_manufacturer="samsungypr" + t_model="ypr0" ;; 206|androidmips) diff --git a/tools/root.make b/tools/root.make index c8c4eb4f89..b62cb4d589 100644 --- a/tools/root.make +++ b/tools/root.make @@ -120,7 +120,7 @@ else endif ifneq (,$(findstring ypr0,$(APP_TYPE))) - include $(ROOTDIR)/firmware/target/hosted/ypr0/ypr0.make + include $(ROOTDIR)/firmware/target/hosted/samsungypr/ypr0/ypr0.make endif ifneq (,$(findstring android, $(APP_TYPE)))