type
stringclasses
5 values
content
stringlengths
9
163k
functions
void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number) { const char *str; time_t ti; char *p; char buf2[32]; switch(error_number) { #include "rtspcodes.h" #undef DEF default: str = "Unknown Error"; break; }
functions
void rtsp_reply_error(HTTPContext *c, enum RTSPStatusCode error_number) { rtsp_reply_header(c, error_number); url_fprintf(c->pb, "\r\n"); }
functions
int rtsp_parse_request(HTTPContext *c) { const char *p, *p1, *p2; char cmd[32]; char url[1024]; char protocol[32]; char line[1024]; ByteIOContext pb1; int len; RTSPHeader header1, *header = &header1; c->buffer_ptr[0] = '\0'; p = c->buffer; get_word(cmd, sizeof(cmd), &p); get_word(url, sizeof(url), &p); get_word(protocol, sizeof(protocol), &p); pstrcpy(c->method, sizeof(c->method), cmd); pstrcpy(c->url, sizeof(c->url), url); pstrcpy(c->protocol, sizeof(c->protocol), protocol); c->pb = &pb1; if (url_open_dyn_buf(c->pb) < 0) { /* XXX: cannot do more */ c->pb = NULL; /* safety */ return -1; }
functions
int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, struct in_addr my_ip) { ByteIOContext pb1, *pb = &pb1; int i, payload_type, port, private_payload_type, j; const char *ipstr, *title, *mediatype; AVStream *st; if (url_open_dyn_buf(pb) < 0) return -1; /* general media info */ url_fprintf(pb, "v=0\n"); ipstr = inet_ntoa(my_ip); url_fprintf(pb, "o=- 0 0 IN IP4 %s\n", ipstr); title = stream->title; if (title[0] == '\0') title = "No Title"; url_fprintf(pb, "s=%s\n", title); if (stream->comment[0] != '\0') url_fprintf(pb, "i=%s\n", stream->comment); if (stream->is_multicast) { url_fprintf(pb, "c=IN IP4 %s\n", inet_ntoa(stream->multicast_ip)); }
functions
void rtsp_cmd_options(HTTPContext *c, const char *url) { // rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK"); url_fprintf(c->pb, "CSeq: %d\r\n", c->seq); url_fprintf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE"); url_fprintf(c->pb, "\r\n"); }
functions
void rtsp_cmd_describe(HTTPContext *c, const char *url) { FFStream *stream; char path1[1024]; const char *path; uint8_t *content; int content_length, len; struct sockaddr_in my_addr; /* find which url is asked */ url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && stream->fmt == &rtp_mux && !strcmp(path, stream->filename)) { goto found; }
functions
void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPHeader *h) { FFStream *stream; int stream_index, port; char buf[1024]; char path1[1024]; const char *path; HTTPContext *rtp_c; RTSPTransportField *th; struct sockaddr_in dest_addr; RTSPActionServerSetup setup; /* find which url is asked */ url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; /* now check each stream */ for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && stream->fmt == &rtp_mux) { /* accept aggregate filenames only if single stream */ if (!strcmp(path, stream->filename)) { if (stream->nb_streams != 1) { rtsp_reply_error(c, RTSP_STATUS_AGGREGATE); return; }
functions
void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; }
functions
void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; }
functions
void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPHeader *h) { HTTPContext *rtp_c; rtp_c = find_rtp_session_with_url(url, h->session_id); if (!rtp_c) { rtsp_reply_error(c, RTSP_STATUS_SESSION); return; }
functions
int rtp_new_av_stream(HTTPContext *c, int stream_index, struct sockaddr_in *dest_addr, HTTPContext *rtsp_c) { AVFormatContext *ctx; AVStream *st; char *ipaddr; URLContext *h; uint8_t *dummy_buf; char buf2[32]; int max_packet_size; /* now we can open the relevant output stream */ ctx = av_alloc_format_context(); if (!ctx) return -1; ctx->oformat = &rtp_mux; st = av_mallocz(sizeof(AVStream)); if (!st) goto fail; ctx->nb_streams = 1; ctx->streams[0] = st; if (!c->stream->feed || c->stream->feed == c->stream) { memcpy(st, c->stream->streams[stream_index], sizeof(AVStream)); }
functions
int add_av_stream(FFStream *feed, AVStream *st) { AVStream *fst; AVCodecContext *av, *av1; int i; av = &st->codec; for(i=0;i<feed->nb_streams;i++) { st = feed->streams[i]; av1 = &st->codec; if (av1->codec_id == av->codec_id && av1->codec_type == av->codec_type && av1->bit_rate == av->bit_rate) { switch(av->codec_type) { case CODEC_TYPE_AUDIO: if (av1->channels == av->channels && av1->sample_rate == av->sample_rate) goto found; break; case CODEC_TYPE_VIDEO: if (av1->width == av->width && av1->height == av->height && av1->frame_rate == av->frame_rate && av1->frame_rate_base == av->frame_rate_base && av1->gop_size == av->gop_size) goto found; break; default: av_abort(); }
functions
void remove_stream(FFStream *stream) { FFStream **ps; ps = &first_stream; while (*ps != NULL) { if (*ps == stream) { *ps = (*ps)->next; }
functions
void extract_mpeg4_header(AVFormatContext *infile) { int mpeg4_count, i, size; AVPacket pkt; AVStream *st; const uint8_t *p; mpeg4_count = 0; for(i=0;i<infile->nb_streams;i++) { st = infile->streams[i]; if (st->codec.codec_id == CODEC_ID_MPEG4 && st->codec.extradata_size == 0) { mpeg4_count++; }
functions
void build_file_streams(void) { FFStream *stream, *stream_next; AVFormatContext *infile; int i; /* gather all streams */ for(stream = first_stream; stream != NULL; stream = stream_next) { stream_next = stream->next; if (stream->stream_type == STREAM_TYPE_LIVE && !stream->feed) { /* the stream comes from a file */ /* try to open the file */ /* open stream */ stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); if (stream->fmt == &rtp_mux) { /* specific case : if transport stream output to RTP, we use a raw transport stream reader */ stream->ap_in->mpeg2ts_raw = 1; stream->ap_in->mpeg2ts_compute_pcr = 1; }
functions
void build_feed_streams(void) { FFStream *stream, *feed; int i; /* gather all streams */ for(stream = first_stream; stream != NULL; stream = stream->next) { feed = stream->feed; if (feed) { if (!stream->is_feed) { /* we handle a stream coming from a feed */ for(i=0;i<stream->nb_streams;i++) { stream->feed_streams[i] = add_av_stream(feed, stream->streams[i]); }
functions
else if (ccf->codec_type == CODEC_TYPE_VIDEO) { if (CHECK_CODEC(frame_rate) || CHECK_CODEC(frame_rate_base) || CHECK_CODEC(width) || CHECK_CODEC(height)) { printf("Codec width, height and framerate do not match for stream %d\n", i); matches = 0; }
functions
else if (ccf->codec_type == CODEC_TYPE_AUDIO) { if (CHECK_CODEC(sample_rate) || CHECK_CODEC(channels) || CHECK_CODEC(frame_size)) { printf("Codec sample_rate, channels, frame_size do not match for stream %d\n", i); matches = 0; }
functions
void compute_bandwidth(void) { int bandwidth, i; FFStream *stream; for(stream = first_stream; stream != NULL; stream = stream->next) { bandwidth = 0; for(i=0;i<stream->nb_streams;i++) { AVStream *st = stream->streams[i]; switch(st->codec.codec_type) { case CODEC_TYPE_AUDIO: case CODEC_TYPE_VIDEO: bandwidth += st->codec.bit_rate; break; default: break; }
functions
void get_arg(char *buf, int buf_size, const char **pp) { const char *p; char *q; int quote; p = *pp; while (isspace(*p)) p++; q = buf; quote = 0; if (*p == '\"' || *p == '\'') quote = *p++; for(;;) { if (quote) { if (*p == quote) break; }
functions
void add_codec(FFStream *stream, AVCodecContext *av) { AVStream *st; /* compute default parameters */ switch(av->codec_type) { case CODEC_TYPE_AUDIO: if (av->bit_rate == 0) av->bit_rate = 64000; if (av->sample_rate == 0) av->sample_rate = 22050; if (av->channels == 0) av->channels = 1; break; case CODEC_TYPE_VIDEO: if (av->bit_rate == 0) av->bit_rate = 64000; if (av->frame_rate == 0){ av->frame_rate = 5; av->frame_rate_base = 1; }
functions
int opt_audio_codec(const char *arg) { AVCodec *p; p = first_avcodec; while (p) { if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_AUDIO) break; p = p->next; }
functions
int opt_video_codec(const char *arg) { AVCodec *p; p = first_avcodec; while (p) { if (!strcmp(p->name, arg) && p->type == CODEC_TYPE_VIDEO) break; p = p->next; }
functions
void load_module(const char *filename) { void *dll; void (*init_func)(void); dll = dlopen(filename, RTLD_NOW); if (!dll) { fprintf(stderr, "Could not load module '%s' - %s\n", filename, dlerror()); return; }
functions
int parse_ffconfig(const char *filename) { FILE *f; char line[1024]; char cmd[64]; char arg[1024]; const char *p; int val, errors, line_num; FFStream **last_stream, *stream, *redirect; FFStream **last_feed, *feed; AVCodecContext audio_enc, video_enc; int audio_id, video_id; f = fopen(filename, "r"); if (!f) { perror(filename); return -1; }
functions
else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); }
functions
else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); }
functions
else if (feed) { naclp = &feed->acl; }
functions
void write_packet(FFCodec *ffenc, uint8_t *buf, int size) { PacketHeader hdr; AVCodecContext *enc = &ffenc->enc; uint8_t *wptr; mk_header(&hdr, enc, size); wptr = http_fifo.wptr; fifo_write(&http_fifo, (uint8_t *)&hdr, sizeof(hdr), &wptr); fifo_write(&http_fifo, buf, size, &wptr); /* atomic modification of wptr */ http_fifo.wptr = wptr; ffenc->data_count += size; ffenc->avg_frame_size = ffenc->avg_frame_size * AVG_COEF + size * (1.0 - AVG_COEF); }
functions
void show_banner(void) { printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000-2003 Fabrice Bellard\n"); }
functions
void show_help(void) { show_banner(); printf("usage: ffserver [-L] [-h] [-f configfile]\n" "Hyper fast multi format Audio/Video streaming server\n" "\n" "-L : print the LICENSE\n" "-h : this help\n" "-f configfile : use configfile instead of /etc/ffserver.conf\n" ); }
functions
void show_license(void) { show_banner(); printf( "This library is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU Lesser General Public\n" "License as published by the Free Software Foundation; either\n" "version 2 of the License, or (at your option) any later version.\n" "\n" "This library is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" "Lesser General Public License for more details.\n" "\n" "You should have received a copy of the GNU Lesser General Public\n" "License along with this library; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" ); }
functions
void handle_child_exit(int sig) { pid_t pid; int status; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { FFStream *feed; for (feed = first_feed; feed; feed = feed->next) { if (feed->pid == pid) { int uptime = time(0) - feed->pid_start; feed->pid = 0; fprintf(stderr, "%s: Pid %d exited with status %d after %d seconds\n", feed->filename, pid, status, uptime); if (uptime < 30) { /* Turn off any more restarts */ feed->child_argv = 0; }
functions
else if (pid > 0) { /* parent : exit */ exit(0); }
main
int main(int argc, char **argv) { const char *config_filename; int c; struct sigaction sigact; av_register_all(); config_filename = "/etc/ffserver.conf"; my_program_name = argv[0]; my_program_dir = getcwd(0, 0); ffserver_daemon = 1; for(;;) { c = getopt(argc, argv, "ndLh?f:"); if (c == -1) break; switch(c) { case 'L': show_license(); exit(1); case '?': case 'h': show_help(); exit(1); case 'n': no_launch = 1; break; case 'd': ffserver_debug = 1; ffserver_daemon = 0; break; case 'f': config_filename = optarg; break; default: exit(2); }
includes
#include <linux/kernel.h>
includes
#include <linux/init.h>
includes
#include <linux/module.h>
includes
#include <linux/moduleparam.h>
includes
#include <linux/platform_device.h>
includes
#include <linux/gpio.h>
includes
#include <linux/interrupt.h>
includes
#include <linux/workqueue.h>
includes
#include <linux/slab.h>
includes
#include <linux/delay.h>
includes
#include <linux/fs.h>
includes
#include <linux/uaccess.h>
includes
#include <linux/wakelock.h>
includes
#include <linux/spinlock.h>
includes
#include <linux/usb.h>
includes
#include <linux/pm_runtime.h>
includes
#include <linux/suspend.h>
includes
#include <mach/usb_phy.h>
includes
#include <mach/board_htc.h>
includes
#include <linux/pm_qos_params.h>
includes
#include <asm/mach-types.h>
includes
#include <mach/htc_hostdbg.h>
defines
#define MODULE_NAME "[XMM_v15]"
defines
#define BOOST_CPU_FREQ_MIN 1500000
defines
#define auto_sleep(x) \
defines
#define PRINT_GPIO(gpio,name) pr_info( "PRINT_GPIO %s <%d>", name, gpio_get_value(gpio) )
defines
#define MSIZE 30
functions
ssize_t host_dbg_show(struct device *dev, struct device_attribute *attr, char *buf) { int ret = -EINVAL; ret = sprintf(buf, "%x\n", host_dbg_flag); return ret; }
functions
ssize_t host_dbg_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { const int hedge = 2 + 8 + 1; /* hedge: "0x" 2 chars, max: 8 chars, plus one 0x0a char */ pr_info(MODULE_NAME "%s size = %d\n", __func__, size); if (size > hedge) { pr_info(MODULE_NAME "%s size > hedge:%d, return\n", __func__, hedge); return size; }
functions
int MIN( int x, int y ) { return x > y ? y : x; }
functions
ssize_t debug_handler(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { if( !strncmp( buf, "0", MIN( count, strlen("0") ) ) ) { debug_gpio_dump(); }
functions
int debug_gpio_dump() { PRINT_GPIO( TEGRA_GPIO_PM4, "BB_VDD_EN" ); PRINT_GPIO( TEGRA_GPIO_PC1, "AP2BB_RST_PWRDWNn" ); PRINT_GPIO( TEGRA_GPIO_PN0, "AP2BB_RSTn" ); PRINT_GPIO( TEGRA_GPIO_PN3, "AP2BB_PWRON" ); PRINT_GPIO( TEGRA_GPIO_PN2, "BB2AP_RADIO_FATAL" ); PRINT_GPIO( TEGRA_GPIO_PN1, "IPC_HSIC_ACTIVE" ); PRINT_GPIO( TEGRA_GPIO_PV0, "HSIC_SUS_REQ" ); PRINT_GPIO( TEGRA_GPIO_PC6, "IPC_BB_WAKE" ); PRINT_GPIO( TEGRA_GPIO_PS2, "IPC_AP_WAKE" ); if(SKU_ID_ENDEAVORU != s_sku_id) { PRINT_GPIO( TEGRA_GPIO_PS5, "BB2AP_RST2" ); }
functions
int trigger_radio_fatal_get_coredump(void) { #if 0 if (!reason) reason = "No Reason"; pr_info("Trigger Modem Fatal!! reason <%s>", reason); /*set BB2AP_SUSPEND_REQ Pin (TEGRA_GPIO_PV0) to OutPut High to trigger Modem fatal*/ int ret=gpio_direction_output(TEGRA_GPIO_PV0,1); if (ret < 0) pr_err("%s: set BB2AP_SUSPEND_REQ Pin to Output error", __func__); /* reset HOST_ACTIVE to notify modem since suspend req is not a wakeup source of modem. */ queue_work( workqueue_debug, &work_reset_host_active ); #else pr_info("Didn't trigger fatal for better user experience"); #endif return 0; }
functions
int trigger_silent_reset(char *reason) { char message[MSIZE] = "ResetReason="; char *envp[] = { message, NULL }
functions
int Modem_is_6360() { return s_sku_id == SKU_ID_ENRC2_TMO; }
functions
int Modem_is_6260() { return ( s_sku_id == SKU_ID_ENRC2_GLOBAL || s_sku_id == SKU_ID_ENDEAVORU ); }
functions
int Modem_is_IMC(void) { return ( machine_is_enrc2b() || machine_is_endeavoru() || machine_is_enrc2u() ); }
functions
irqreturn_t radio_reset_irq(int irq, void *dev_id) { pr_err("%s: Radio reset detected!", __func__); debug_gpio_dump(); return IRQ_HANDLED; }
functions
int enable_avdd_dsi_csi_power() { pr_info(MODULE_NAME "[xmm]%s\n",__func__); int ret=0; if (endeavor_dsi_reg == NULL) { endeavor_dsi_reg = regulator_get(NULL, "avdd_dsi_csi"); pr_info(MODULE_NAME "[xmm]%s regulator_getED\n",__func__); if (IS_ERR_OR_NULL(endeavor_dsi_reg)) { pr_err("dsi: Could not get regulator avdd_dsi_csi\n"); endeavor_dsi_reg = NULL; return PTR_ERR(endeavor_dsi_reg); }
functions
int disable_avdd_dsi_csi_power() { pr_info(MODULE_NAME "[xmm]%s\n",__func__); int ret=0; if (endeavor_dsi_reg == NULL) { endeavor_dsi_reg = regulator_get(NULL, "avdd_dsi_csi"); pr_info(MODULE_NAME "[xmm]%s regulator_getED\n",__func__); if (IS_ERR_OR_NULL(endeavor_dsi_reg)) { pr_err("dsi: Could not get regulator avdd_dsi_csi\n"); endeavor_dsi_reg = NULL; return PTR_ERR(endeavor_dsi_reg); }
functions
int gpio_config_only_one(unsigned gpio, unsigned long flags, const char *label) { int err=0; if (flags & GPIOF_DIR_IN) err = gpio_direction_input(gpio); else err = gpio_direction_output(gpio, (flags & GPIOF_INIT_HIGH) ? 1 : 0); return err; }
functions
int gpio_config_only_array(struct gpio *array, size_t num) { int i, err=0; for (i = 0; i < num; i++, array++) { if( array->gpio != -1 ) { err = gpio_config_only_one(array->gpio, array->flags, array->label); if (err) goto err_free; }
functions
int gpio_request_only_one(unsigned gpio,const char *label) { int err = gpio_request(gpio, label); if (err) return err; else return 0; }
functions
int gpio_request_only_array(struct gpio *array, size_t num) { int i, err=0; for (i = 0; i < num; i++, array++) { if( array->gpio != -1 ) { err = gpio_request_only_one(array->gpio, array->label); if (err) goto err_free; }
functions
int gpio_o_l_uart(int gpio, char* name) { int ret=0; pr_info(MODULE_NAME "%s ,name=%s gpio=%d\n", __func__,name,gpio); ret = gpio_direction_output(gpio, 0); if (ret < 0) { pr_err(" %s: gpio_direction_output failed %d\n", __func__, ret); gpio_free(gpio); return ret; }
functions
void modem_on_for_uart_config(void) { pr_info(MODULE_NAME "%s ,first_time=%s uart_pin_pull_low=%d\n", __func__,first_time?"true":"false",uart_pin_pull_state); if(uart_pin_pull_state==0){ //if uart pin pull low, then we put back to normal pr_info(MODULE_NAME "%s tegra_gpio_disable for UART\n", __func__); tegra_gpio_disable(TEGRA_GPIO_PJ7); tegra_gpio_disable(TEGRA_GPIO_PK7); tegra_gpio_disable(TEGRA_GPIO_PB0); tegra_gpio_disable(TEGRA_GPIO_PB1); uart_pin_pull_state=1;//set back to UART }
functions
int modem_off_for_uart_config(void) { int err=0; pr_info(MODULE_NAME "%s uart_pin_pull_low=%d\n", __func__,uart_pin_pull_state); if(uart_pin_pull_state==1){ //if uart pin not pull low yet, then we pull them low+enable err=gpio_o_l_uart(TEGRA_GPIO_PJ7, "IMC_UART_TX"); err=gpio_o_l_uart(TEGRA_GPIO_PK7, "IMC_UART_RTS"); err=gpio_o_l_uart(TEGRA_GPIO_PB0 ,"IMC_UART_RX"); err=gpio_o_l_uart(TEGRA_GPIO_PB1, "IMC_UART_CTS"); uart_pin_pull_state=0;//chagne to gpio }
functions
int modem_off_for_usb_config(struct gpio *array, size_t num) { //pr_info(MODULE_NAME "%s 1219_01\n", __func__); int err=0; err = gpio_config_only_array(tegra_baseband_gpios_power_off_modem, ARRAY_SIZE(tegra_baseband_gpios_power_off_modem)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; }
functions
int modem_on_for_usb_config(struct gpio *array, size_t num) { pr_info(MODULE_NAME "%s \n", __func__); int err=0; err = gpio_config_only_array(tegra_baseband_gpios, ARRAY_SIZE(tegra_baseband_gpios)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; }
functions
int config_gpio_for_power_off(void) { int err=0; pr_info(MODULE_NAME "%s for power consumation 4st \n", __func__); #if 1 /* config baseband gpio(s) for modem off */ err = modem_off_for_usb_config(tegra_baseband_gpios_power_off_modem, ARRAY_SIZE(tegra_baseband_gpios_power_off_modem)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; }
functions
int config_gpio_for_power_on() { int err=0; pr_info(MODULE_NAME "%s for power consumation 4st \n", __func__); #if 1 /* config baseband gpio(s) for modem off */ err = modem_on_for_usb_config(tegra_baseband_gpios, ARRAY_SIZE(tegra_baseband_gpios)); if (err < 0) { pr_err("%s - gpio_config_array gpio(s) for modem off failed\n", __func__); return -ENODEV; }
functions
int baseband_modem_power_on(struct baseband_power_platform_data *data) { /* HTC: called in atomic context */ int ret=0, i=0; pr_info("%s VP: 07/05 22.52{\n", __func__); if (!data) { pr_err("%s: data is NULL\n", __func__); return -1; }
functions
int baseband_xmm_power_on(struct platform_device *device) { struct baseband_power_platform_data *data = (struct baseband_power_platform_data *) device->dev.platform_data; int ret; /* HTC: ENR#U wakeup src fix */ //int value; pr_info(MODULE_NAME "%s{\n", __func__); /* check for platform data */ if (!data) { pr_err("%s: !data\n", __func__); return -EINVAL; }
functions
int baseband_xmm_power_off(struct platform_device *device) { struct baseband_power_platform_data *data; int ret; /* HTC: ENR#U wakeup src fix */ unsigned long flags; pr_info("%s {\n", __func__); if (baseband_xmm_powerstate == BBXMM_PS_UNINIT) { pr_err("%s: baseband_xmm_powerstate != BBXMM_PS_UNINIT\n", __func__); return -EINVAL; }
functions
ssize_t baseband_xmm_onoff(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { //int size; struct platform_device *device = to_platform_device(dev); mutex_lock(&baseband_xmm_onoff_lock); /* check input */ if (buf == NULL) { pr_err("%s: buf NULL\n", __func__); mutex_unlock(&baseband_xmm_onoff_lock); return -EINVAL; }
functions
BB_XMM_OEM1 if (buf[0] == 0x01 || buf[0] == '1') { /* pr_info("%s: buf[0] = 0x%x\n", __func__, buf[0]); */ power_onoff = 1; }
functions
void baseband_xmm_set_power_status(unsigned int status) { struct baseband_power_platform_data *data = baseband_power_driver_data; //int value = 0; unsigned long flags; if (baseband_xmm_powerstate == status) return; pr_info(MODULE_NAME"%s{ status=%d\n", __func__,status); switch (status) { case BBXMM_PS_L0: if (modem_sleep_flag) { #ifdef CONFIG_REMOVE_HSIC_L3_STATE pr_info("%s, resume to L0 with modem_sleep_flag", __func__ ); #else pr_info("%s Resume from L3 without calling resume function\n", __func__); baseband_xmm_power_driver_handle_resume(data); #endif }
functions
0305 if (usbdev) { struct usb_interface *intf; intf = usb_ifnum_to_if(usbdev, 0); //pr_info("%s - autopm_get - usbdev = %d - %d {\n", __func__, usbdev, __LINE__); //pr_info("%s: cnt %d intf=%p &intf->dev=%p kobje=%s\n", //__func__, atomic_read(&intf->dev.power.usage_count),intf,&intf->dev,kobject_name(&intf->dev.kobj)); if (usb_autopm_get_interface_async(intf) >= 0) { pr_info("get_interface_async succeeded" " - call put_interface\n"); //pr_info("%s - usb_put - usbdev = %d - %d {\n", __func__, usbdev, __LINE__); usb_autopm_put_interface_async(intf); //pr_info("%s - usb_put - usbdev = %d - %d {\n", __func__, usbdev, __LINE__); }
functions
0 if (usbdev) { struct usb_interface *intf; intf = usb_ifnum_to_if(usbdev, 0); pr_info("%s: cnt %d intf=%p &intf->dev=%p kobje=%s\n", __func__, atomic_read(&intf->dev.power.usage_count),intf,&intf->dev,kobject_name(&intf->dev.kobj)); }
functions
irqreturn_t baseband_xmm_power_ipc_ap_wake_irq(int irq, void *dev_id) { int value; struct baseband_power_platform_data *data = baseband_power_driver_data; /* pr_info("%s\n", __func__); */ value = gpio_get_value(data->modem.xmm.ipc_ap_wake); if (ipc_ap_wake_state < IPC_AP_WAKE_IRQ_READY) { pr_err("%s - spurious irq\n", __func__); }
functions
else if (ipc_ap_wake_state == IPC_AP_WAKE_IRQ_READY) { if (!value) { pr_info("%s - IPC_AP_WAKE_INIT1" " - got falling edge\n", __func__); if (waiting_falling_flag == 0) { pr_info("%s return because irq must get the rising event at first\n", __func__); return IRQ_HANDLED; }
functions
else if (ipc_ap_wake_state == IPC_AP_WAKE_INIT1) { if (!value) { pr_info("%s - IPC_AP_WAKE_INIT2" " - wait for rising edge\n", __func__); }
functions
CONFIG_REMOVE_HSIC_L3_STATE if (baseband_xmm_powerstate == BBXMM_PS_L3) { spin_unlock(&xmm_lock); pr_info(" CP L3 -> L0\n"); pr_info("set wakeup_pending=true, wait for no-irq-resuem if you are not under LP0 yet !.\n"); pr_info("set wakeup_pending=true, wait for system resume if you already under LP0.\n"); }
functions
endif if (baseband_xmm_powerstate == BBXMM_PS_L2) { CP_initiated_L2toL0 = true; spin_unlock(&xmm_lock); baseband_xmm_set_power_status (BBXMM_PS_L2TOL0); }
functions
void baseband_xmm_power_reset_host_active_work(struct work_struct *work) { /* set host_active for interrupt modem */ int value = gpio_get_value(TEGRA_GPIO_PN1); pr_info("Oringial IPC_HSIC_ACTIVE =%d", value); gpio_set_value(TEGRA_GPIO_PN1,!value); msleep(100); gpio_set_value(TEGRA_GPIO_PN1,value); }