Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de3445c0 authored by Srinivasarao P's avatar Srinivasarao P
Browse files

Reverting incrementalfs, power,usb and scheduler changes



Reverting below changes from android-4.19-stable.113

	8794e1ed ANDROID: Incremental fs: Fix four resource bugs
	05cf04f6 ANDROID: Incremental fs: Add INCFS_IOC_GET_FILLED_BLOCKS
	f2e257e6 ANDROID: Incremental fs: Fix two typos
	5635d764 ANDROID: GKI: power_supply: add more soc properties
	363ef6df ANDROID: GKI: google_battery: return string type for serial_number property
	0de5e99f ANDROID: GKI: power: supply: Add APSD based power-supply properties
	c5bdb846 ANDROID: GKI: power: supply: Remove "Wipower" PSY type
	8eb88369 ANDROID: GKI: power: supply: Add support for HVDCP_3P5
	4c6b35ad ANDROID: GKI: power_supply: Define Debug Accessory Mode
	f022b125 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_AICL_*
	caaeb5f7 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_ALIGNMENT
	63ea9d3f ANDROID: GKI: power_supply: Add CP_ISNS_SLAVE power supply property
	cb77fe70 ANDROID: GKI: power_supply: add properties to report parallel connection topology
	f7b16318 ANDROID: GKI: power_supply: add POWER_SUPPLY_PROP_IRQ_STATUS property
	3eef5574 ANDROID: GKI: power: supply: add CHARGE_CHARGER_STATE property
	aadbdeec ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_PTMC_ID
	4f709294 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_OTG_FASTROLESWAP
	d46562ac ANDROID: GKI: power: supply: Add VOLTAGE_STEP property
	abcee9a5 ANDROID: GKI: power: supply: Add AICL_DONE parameter
	c4bb7e5e ANDROID: GKI: power_supply: Add operating frequency property
	958192fe ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_CC_UAH
	c4b94d4c ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_VOLTAGE_FIFO
	d8fb4a93 ANDROID: GKI: power: supply: Add capacity and resistance estimates
	cd5c0c79 ANDROID: GKI: power_supply: Add vendor specific dead battery property
	6c9a8542 ANDROID: GKI: power-supply: add ADAPTER_DETAILS power supply property
	e90672c3 ANDROID: GKI: power: supply: Add POWER_SUPPLY_PROP_CHARGE_DISABLE
	554dd9d9 ANDROID: GKI: power: power_supply: Add property to display skin thermal status
	55d9887c ANDROID: GKI: power_supply: Add properties to support PPS constant current(CC) mode
	954e48cc ANDROID: GKI: power: power_supply: Add REAL_CAPACITY property
	913ef301 ANDROID: GKI: power_supply: Add VOLTAGE_MAX_LIMIT power supply property
	1b3d52f5 ANDROID: GKI: power_supply: Add DC_RESET power-supply property
	1dbd6b40 ANDROID: GKI: power_supply: Add "THERM_ICL_LIMIT" property
	8b94d072 ANDROID: GKI: power_supply: add CHIP_VERSION property
	d4ce1e67 ANDROID: GKI: power-supply: Add VOLTAGE_VPH power supply property
	2193e751 ANDROID: GKI: power_supply: Add SCALE_MODE_EN power-supply property
	e419098d ANDROID: GKI: power_supply: Add local extensions of string property names properly
	e58a0534 ANDROID: GKI: power_supply: add batt_age_level property
	eecc3db9 ANDROID: GKI: power-supply: Add CC_SOC power supply property
	48c932ac ANDROID: GKI: power_supply: add property to disable QC userspace optimizations
	2c0ee0ec ANDROID: GKI: power: power_supply: Add FG_RESET power supply property
	ab63e517 ANDROID: GKI: power_supply: Add power supply type "Charge Pump"
	7c08ec15 ANDROID: GKI: power: supply: Add snapshot of power supply framework files
	8e68102c ANDROID: GKI: power: power_supply: Add property CHARGE_COUNTER_EXT and 64-bit precision properties
	1d4485a7 ANDROID: GKI: power: power_supply: add POWER_SUPPLY_PROP_CHARGE_ENABLED
	d50f3843 ANDROID: GKI: power: power_supply: add POWER_SUPPLY_PROP_USB_OTG
	76daf69a ANDROID: GKI: power: power_supply: Add custom property for USB High Current mode
	b582ef5b ANDROID: GKI: drivers: usb: Add functions usb_func_ep_queue/usb_func_wakeup
	34f6bfd9 ANDROID: GKI: Add API usb_ep_autoconfig_by_name
	7ff8c349 ANDROID: GKI: usb: core: Add helper function to return controller id
	b38208f0 FROMGIT: sched/rt: cpupri_find: Trigger a full search as fallback
	32061ff6 FROMGIT: sched/rt: Remove unnecessary push for unfit tasks
	8efce171 BACKPORT: FROMGIT: sched/rt: Allow pulling unfitting task
	2bf4a52c FROMGIT: sched/rt: Optimize cpupri_find() on non-heterogenous systems
	27d84b63 FROMGIT: sched/rt: Re-instate old behavior in select_task_rq_rt()
	ca79ac3c BACKPORT: FROMGIT: sched/rt: cpupri_find: Implement fallback mechanism for !fit case

Change-Id: Ifa8ee358e5b368f18e04cb762cf594c7c240bbf6
Signed-off-by: default avatarSrinivasarao P <spathi@codeaurora.org>
parent 2b82910d
Loading
Loading
Loading
Loading
+3 −218
Original line number Original line Diff line number Diff line
@@ -43,10 +43,7 @@ static struct device_attribute power_supply_attrs[];
static const char * const power_supply_type_text[] = {
static const char * const power_supply_type_text[] = {
	"Unknown", "Battery", "UPS", "Mains", "USB",
	"Unknown", "Battery", "UPS", "Mains", "USB",
	"USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
	"USB_DCP", "USB_CDP", "USB_ACA", "USB_C",
	"USB_PD", "USB_PD_DRP", "BrickID",
	"USB_PD", "USB_PD_DRP", "BrickID"
	"USB_HVDCP", "USB_HVDCP_3", "USB_HVDCP_3P5", "Wireless", "USB_FLOAT",
	"BMS", "Parallel", "Main", "USB_C_UFP", "USB_C_DFP",
	"Charge_Pump",
};
};


static const char * const power_supply_usb_type_text[] = {
static const char * const power_supply_usb_type_text[] = {
@@ -59,14 +56,13 @@ static const char * const power_supply_status_text[] = {
};
};


static const char * const power_supply_charge_type_text[] = {
static const char * const power_supply_charge_type_text[] = {
	"Unknown", "N/A", "Trickle", "Fast", "Taper"
	"Unknown", "N/A", "Trickle", "Fast"
};
};


static const char * const power_supply_health_text[] = {
static const char * const power_supply_health_text[] = {
	"Unknown", "Good", "Overheat", "Dead", "Over voltage",
	"Unknown", "Good", "Overheat", "Dead", "Over voltage",
	"Unspecified failure", "Cold", "Watchdog timer expire",
	"Unspecified failure", "Cold", "Watchdog timer expire",
	"Safety timer expire",
	"Safety timer expire"
	"Warm", "Cool", "Hot"
};
};


static const char * const power_supply_technology_text[] = {
static const char * const power_supply_technology_text[] = {
@@ -82,29 +78,6 @@ static const char * const power_supply_scope_text[] = {
	"Unknown", "System", "Device"
	"Unknown", "System", "Device"
};
};


static const char * const power_supply_usbc_text[] = {
	"Nothing attached", "Sink attached", "Powered cable w/ sink",
	"Debug Accessory", "Audio Adapter", "Powered cable w/o sink",
	"Source attached (default current)",
	"Source attached (medium current)",
	"Source attached (high current)",
	"Debug Accessory Mode (default current)",
	"Debug Accessory Mode (medium current)",
	"Debug Accessory Mode (high current)",
	"Non compliant",
	"Non compliant (Rp-Default/Rp-Default)",
	"Non compliant (Rp-1.5A/Rp-1.5A)",
	"Non compliant (Rp-3A/Rp-3A)"
};

static const char * const power_supply_usbc_pr_text[] = {
	"none", "dual power role", "sink", "source"
};

static const char * const power_supply_typec_src_rp_text[] = {
	"Rp-Default", "Rp-1.5A", "Rp-3A"
};

static ssize_t power_supply_show_usb_type(struct device *dev,
static ssize_t power_supply_show_usb_type(struct device *dev,
					  enum power_supply_usb_type *usb_types,
					  enum power_supply_usb_type *usb_types,
					  ssize_t num_usb_types,
					  ssize_t num_usb_types,
@@ -187,7 +160,6 @@ static ssize_t power_supply_show_property(struct device *dev,
			      power_supply_capacity_level_text[value.intval]);
			      power_supply_capacity_level_text[value.intval]);
		break;
		break;
	case POWER_SUPPLY_PROP_TYPE:
	case POWER_SUPPLY_PROP_TYPE:
	case POWER_SUPPLY_PROP_REAL_TYPE:
		ret = sprintf(buf, "%s\n",
		ret = sprintf(buf, "%s\n",
			      power_supply_type_text[value.intval]);
			      power_supply_type_text[value.intval]);
		break;
		break;
@@ -200,27 +172,6 @@ static ssize_t power_supply_show_property(struct device *dev,
		ret = sprintf(buf, "%s\n",
		ret = sprintf(buf, "%s\n",
			      power_supply_scope_text[value.intval]);
			      power_supply_scope_text[value.intval]);
		break;
		break;
	case POWER_SUPPLY_PROP_TYPEC_MODE:
		ret = sprintf(buf, "%s\n",
			      power_supply_usbc_text[value.intval]);
		break;
	case POWER_SUPPLY_PROP_TYPEC_POWER_ROLE:
		ret = sprintf(buf, "%s\n",
			      power_supply_usbc_pr_text[value.intval]);
		break;
	case POWER_SUPPLY_PROP_TYPEC_SRC_RP:
		ret = sprintf(buf, "%s\n",
			      power_supply_typec_src_rp_text[value.intval]);
		break;
	case POWER_SUPPLY_PROP_DIE_HEALTH:
	case POWER_SUPPLY_PROP_SKIN_HEALTH:
	case POWER_SUPPLY_PROP_CONNECTOR_HEALTH:
		ret = sprintf(buf, "%s\n",
			      power_supply_health_text[value.intval]);
		break;
	case POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT:
		ret = sprintf(buf, "%lld\n", value.int64val);
		break;
	case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
	case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
		ret = sprintf(buf, "%s\n", value.strval);
		ret = sprintf(buf, "%s\n", value.strval);
		break;
		break;
@@ -352,169 +303,9 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(precharge_current),
	POWER_SUPPLY_ATTR(precharge_current),
	POWER_SUPPLY_ATTR(charge_term_current),
	POWER_SUPPLY_ATTR(charge_term_current),
	POWER_SUPPLY_ATTR(calibrate),
	POWER_SUPPLY_ATTR(calibrate),
	/* Local extensions */
	POWER_SUPPLY_ATTR(usb_hc),
	POWER_SUPPLY_ATTR(usb_otg),
	POWER_SUPPLY_ATTR(charge_enabled),
	POWER_SUPPLY_ATTR(set_ship_mode),
	POWER_SUPPLY_ATTR(real_type),
	POWER_SUPPLY_ATTR(charge_now_raw),
	POWER_SUPPLY_ATTR(charge_now_error),
	POWER_SUPPLY_ATTR(capacity_raw),
	POWER_SUPPLY_ATTR(battery_charging_enabled),
	POWER_SUPPLY_ATTR(charging_enabled),
	POWER_SUPPLY_ATTR(step_charging_enabled),
	POWER_SUPPLY_ATTR(step_charging_step),
	POWER_SUPPLY_ATTR(pin_enabled),
	POWER_SUPPLY_ATTR(input_suspend),
	POWER_SUPPLY_ATTR(input_voltage_regulation),
	POWER_SUPPLY_ATTR(input_current_max),
	POWER_SUPPLY_ATTR(input_current_trim),
	POWER_SUPPLY_ATTR(input_current_settled),
	POWER_SUPPLY_ATTR(input_voltage_settled),
	POWER_SUPPLY_ATTR(bypass_vchg_loop_debouncer),
	POWER_SUPPLY_ATTR(charge_counter_shadow),
	POWER_SUPPLY_ATTR(hi_power),
	POWER_SUPPLY_ATTR(low_power),
	POWER_SUPPLY_ATTR(temp_cool),
	POWER_SUPPLY_ATTR(temp_warm),
	POWER_SUPPLY_ATTR(temp_cold),
	POWER_SUPPLY_ATTR(temp_hot),
	POWER_SUPPLY_ATTR(system_temp_level),
	POWER_SUPPLY_ATTR(resistance),
	POWER_SUPPLY_ATTR(resistance_capacitive),
	POWER_SUPPLY_ATTR(resistance_id),
	POWER_SUPPLY_ATTR(resistance_now),
	POWER_SUPPLY_ATTR(flash_current_max),
	POWER_SUPPLY_ATTR(update_now),
	POWER_SUPPLY_ATTR(esr_count),
	POWER_SUPPLY_ATTR(buck_freq),
	POWER_SUPPLY_ATTR(boost_current),
	POWER_SUPPLY_ATTR(safety_timer_enabled),
	POWER_SUPPLY_ATTR(charge_done),
	POWER_SUPPLY_ATTR(flash_active),
	POWER_SUPPLY_ATTR(flash_trigger),
	POWER_SUPPLY_ATTR(force_tlim),
	POWER_SUPPLY_ATTR(dp_dm),
	POWER_SUPPLY_ATTR(input_current_limited),
	POWER_SUPPLY_ATTR(input_current_now),
	POWER_SUPPLY_ATTR(charge_qnovo_enable),
	POWER_SUPPLY_ATTR(current_qnovo),
	POWER_SUPPLY_ATTR(voltage_qnovo),
	POWER_SUPPLY_ATTR(rerun_aicl),
	POWER_SUPPLY_ATTR(cycle_count_id),
	POWER_SUPPLY_ATTR(safety_timer_expired),
	POWER_SUPPLY_ATTR(restricted_charging),
	POWER_SUPPLY_ATTR(current_capability),
	POWER_SUPPLY_ATTR(typec_mode),
	POWER_SUPPLY_ATTR(typec_cc_orientation),
	POWER_SUPPLY_ATTR(typec_power_role),
	POWER_SUPPLY_ATTR(typec_src_rp),
	POWER_SUPPLY_ATTR(pd_allowed),
	POWER_SUPPLY_ATTR(pd_active),
	POWER_SUPPLY_ATTR(pd_in_hard_reset),
	POWER_SUPPLY_ATTR(pd_current_max),
	POWER_SUPPLY_ATTR(pd_usb_suspend_supported),
	POWER_SUPPLY_ATTR(charger_temp),
	POWER_SUPPLY_ATTR(charger_temp_max),
	POWER_SUPPLY_ATTR(parallel_disable),
	POWER_SUPPLY_ATTR(pe_start),
	POWER_SUPPLY_ATTR(soc_reporting_ready),
	POWER_SUPPLY_ATTR(debug_battery),
	POWER_SUPPLY_ATTR(fcc_delta),
	POWER_SUPPLY_ATTR(icl_reduction),
	POWER_SUPPLY_ATTR(parallel_mode),
	POWER_SUPPLY_ATTR(die_health),
	POWER_SUPPLY_ATTR(connector_health),
	POWER_SUPPLY_ATTR(ctm_current_max),
	POWER_SUPPLY_ATTR(hw_current_max),
	POWER_SUPPLY_ATTR(pr_swap),
	POWER_SUPPLY_ATTR(cc_step),
	POWER_SUPPLY_ATTR(cc_step_sel),
	POWER_SUPPLY_ATTR(sw_jeita_enabled),
	POWER_SUPPLY_ATTR(pd_voltage_max),
	POWER_SUPPLY_ATTR(pd_voltage_min),
	POWER_SUPPLY_ATTR(sdp_current_max),
	POWER_SUPPLY_ATTR(connector_type),
	POWER_SUPPLY_ATTR(parallel_batfet_mode),
	POWER_SUPPLY_ATTR(parallel_fcc_max),
	POWER_SUPPLY_ATTR(min_icl),
	POWER_SUPPLY_ATTR(moisture_detected),
	POWER_SUPPLY_ATTR(batt_profile_version),
	POWER_SUPPLY_ATTR(batt_full_current),
	POWER_SUPPLY_ATTR(recharge_soc),
	POWER_SUPPLY_ATTR(hvdcp_opti_allowed),
	POWER_SUPPLY_ATTR(smb_en_mode),
	POWER_SUPPLY_ATTR(smb_en_reason),
	POWER_SUPPLY_ATTR(esr_actual),
	POWER_SUPPLY_ATTR(esr_nominal),
	POWER_SUPPLY_ATTR(soh),
	POWER_SUPPLY_ATTR(clear_soh),
	POWER_SUPPLY_ATTR(force_recharge),
	POWER_SUPPLY_ATTR(fcc_stepper_enable),
	POWER_SUPPLY_ATTR(toggle_stat),
	POWER_SUPPLY_ATTR(main_fcc_max),
	POWER_SUPPLY_ATTR(fg_reset),
	POWER_SUPPLY_ATTR(qc_opti_disable),
	POWER_SUPPLY_ATTR(cc_soc),
	POWER_SUPPLY_ATTR(batt_age_level),
	POWER_SUPPLY_ATTR(scale_mode_en),
	POWER_SUPPLY_ATTR(voltage_vph),
	POWER_SUPPLY_ATTR(chip_version),
	POWER_SUPPLY_ATTR(therm_icl_limit),
	POWER_SUPPLY_ATTR(dc_reset),
	POWER_SUPPLY_ATTR(voltage_max_limit),
	POWER_SUPPLY_ATTR(real_capacity),
	POWER_SUPPLY_ATTR(force_main_icl),
	POWER_SUPPLY_ATTR(force_main_fcc),
	POWER_SUPPLY_ATTR(comp_clamp_level),
	POWER_SUPPLY_ATTR(adapter_cc_mode),
	POWER_SUPPLY_ATTR(skin_health),
	POWER_SUPPLY_ATTR(charge_disable),
	POWER_SUPPLY_ATTR(adapter_details),
	POWER_SUPPLY_ATTR(dead_battery),
	POWER_SUPPLY_ATTR(voltage_fifo),
	POWER_SUPPLY_ATTR(cc_uah),
	POWER_SUPPLY_ATTR(operating_freq),
	POWER_SUPPLY_ATTR(aicl_delay),
	POWER_SUPPLY_ATTR(aicl_icl),
	POWER_SUPPLY_ATTR(cutoff_soc),
	POWER_SUPPLY_ATTR(sys_soc),
	POWER_SUPPLY_ATTR(batt_soc),
	/* Capacity Estimation */
	POWER_SUPPLY_ATTR(batt_ce_ctrl),
	POWER_SUPPLY_ATTR(batt_ce_full),
	/* Resistance Estimaton */
	POWER_SUPPLY_ATTR(resistance_avg),
	POWER_SUPPLY_ATTR(batt_res_filt_cnts),
	POWER_SUPPLY_ATTR(aicl_done),
	POWER_SUPPLY_ATTR(voltage_step),
	POWER_SUPPLY_ATTR(otg_fastroleswap),
	POWER_SUPPLY_ATTR(apsd_rerun),
	POWER_SUPPLY_ATTR(apsd_timeout),
	/* Charge pump properties */
	POWER_SUPPLY_ATTR(cp_status1),
	POWER_SUPPLY_ATTR(cp_status2),
	POWER_SUPPLY_ATTR(cp_enable),
	POWER_SUPPLY_ATTR(cp_switcher_en),
	POWER_SUPPLY_ATTR(cp_die_temp),
	POWER_SUPPLY_ATTR(cp_isns),
	POWER_SUPPLY_ATTR(cp_isns_slave),
	POWER_SUPPLY_ATTR(cp_toggle_switcher),
	POWER_SUPPLY_ATTR(cp_irq_status),
	POWER_SUPPLY_ATTR(cp_ilim),
	POWER_SUPPLY_ATTR(irq_status),
	POWER_SUPPLY_ATTR(parallel_output_mode),
	POWER_SUPPLY_ATTR(alignment),
	/* Local extensions of type int64_t */
	POWER_SUPPLY_ATTR(charge_counter_ext),
	POWER_SUPPLY_ATTR(charge_charger_state),
	/* Properties of type `const char *' */
	/* Properties of type `const char *' */
	POWER_SUPPLY_ATTR(model_name),
	POWER_SUPPLY_ATTR(model_name),
	POWER_SUPPLY_ATTR(ptmc_id),
	POWER_SUPPLY_ATTR(manufacturer),
	POWER_SUPPLY_ATTR(manufacturer),
	POWER_SUPPLY_ATTR(battery_type),
	POWER_SUPPLY_ATTR(cycle_counts),
	POWER_SUPPLY_ATTR(serial_number),
	POWER_SUPPLY_ATTR(serial_number),
};
};


@@ -611,12 +402,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)


		attr = &power_supply_attrs[psy->desc->properties[j]];
		attr = &power_supply_attrs[psy->desc->properties[j]];


		if (!attr->attr.name) {
			dev_info(dev, "%s:%d FAKE attr.name=NULL skip\n",
				__FILE__, __LINE__, __func__);
			continue;
		}

		ret = power_supply_show_property(dev, attr, prop_buf);
		ret = power_supply_show_property(dev, attr, prop_buf);
		if (ret == -ENODEV || ret == -ENODATA) {
		if (ret == -ENODEV || ret == -ENODATA) {
			/* When a battery is absent, we expect -ENODEV. Don't abort;
			/* When a battery is absent, we expect -ENODEV. Don't abort;
+0 −10
Original line number Original line Diff line number Diff line
@@ -2235,16 +2235,6 @@ int usb_hcd_get_frame_number (struct usb_device *udev)


/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------*/


int usb_hcd_get_controller_id(struct usb_device *udev)
{
	struct usb_hcd	*hcd = bus_to_hcd(udev->bus);

	if (!HCD_RH_RUNNING(hcd))
		return -EINVAL;

	return hcd->driver->get_core_id(hcd);
}

#ifdef	CONFIG_PM
#ifdef	CONFIG_PM


int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)
int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg)
+0 −13
Original line number Original line Diff line number Diff line
@@ -825,19 +825,6 @@ int usb_get_current_frame_number(struct usb_device *dev)
}
}
EXPORT_SYMBOL_GPL(usb_get_current_frame_number);
EXPORT_SYMBOL_GPL(usb_get_current_frame_number);


/**
 * usb_get_controller_id - returns the host controller id.
 * @dev: the device whose host controller id is being queried.
 */
int usb_get_controller_id(struct usb_device *dev)
{
	if (dev->state == USB_STATE_NOTATTACHED)
		return -EINVAL;

	return usb_hcd_get_controller_id(dev);
}
EXPORT_SYMBOL_GPL(usb_get_controller_id);

/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
/*
/*
 * __usb_get_extra_descriptor() finds a descriptor of specific type in the
 * __usb_get_extra_descriptor() finds a descriptor of specific type in the
+0 −116
Original line number Original line Diff line number Diff line
@@ -426,122 +426,6 @@ int usb_interface_id(struct usb_configuration *config,
}
}
EXPORT_SYMBOL_GPL(usb_interface_id);
EXPORT_SYMBOL_GPL(usb_interface_id);


static int usb_func_wakeup_int(struct usb_function *func)
{
	int ret;
	struct usb_gadget *gadget;

	if (!func || !func->config || !func->config->cdev ||
		!func->config->cdev->gadget)
		return -EINVAL;

	pr_debug("%s - %s function wakeup\n",
		__func__, func->name ? func->name : "");

	gadget = func->config->cdev->gadget;
	if ((gadget->speed != USB_SPEED_SUPER) || !func->func_wakeup_allowed) {
		DBG(func->config->cdev,
			"Function Wakeup is not possible. speed=%u, func_wakeup_allowed=%u\n",
			gadget->speed,
			func->func_wakeup_allowed);

		return -ENOTSUPP;
	}

	ret = usb_gadget_func_wakeup(gadget, func->intf_id);

	return ret;
}

/**
 * usb_func_wakeup - wakes up a composite device function.
 * @func: composite device function to wake up.
 *
 * Returns 0 on success or a negative error value.
 */
int usb_func_wakeup(struct usb_function *func)
{
	int ret;
	unsigned long flags;

	if (!func || !func->config || !func->config->cdev)
		return -EINVAL;

	pr_debug("%s function wakeup\n",
		func->name ? func->name : "");

	spin_lock_irqsave(&func->config->cdev->lock, flags);
	ret = usb_func_wakeup_int(func);
	if (ret == -EAGAIN) {
		DBG(func->config->cdev,
			"Function wakeup for %s could not complete due to suspend state. Delayed until after bus resume.\n",
			func->name ? func->name : "");
		ret = 0;
	} else if (ret < 0 && ret != -ENOTSUPP) {
		ERROR(func->config->cdev,
			"Failed to wake function %s from suspend state. ret=%d. Canceling USB request.\n",
			func->name ? func->name : "", ret);
	}

	spin_unlock_irqrestore(&func->config->cdev->lock, flags);
	return ret;
}
EXPORT_SYMBOL_GPL(usb_func_wakeup);

/**
 * usb_func_ep_queue - queues (submits) an I/O request to a function endpoint.
 * This function is similar to the usb_ep_queue function, but in addition it
 * also checks whether the function is in Super Speed USB Function Suspend
 * state, and if so a Function Wake notification is sent to the host
 * (USB 3.0 spec, section 9.2.5.2).
 * @func: the function which issues the USB I/O request.
 * @ep:the endpoint associated with the request
 * @req:the request being submitted
 * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't
 * pre-allocate all necessary memory with the request.
 */
int usb_func_ep_queue(struct usb_function *func, struct usb_ep *ep,
			       struct usb_request *req, gfp_t gfp_flags)
{
	int ret;
	struct usb_gadget *gadget;

	if (!func || !func->config || !func->config->cdev ||
			!func->config->cdev->gadget || !ep || !req) {
		ret = -EINVAL;
		goto done;
	}

	pr_debug("Function %s queueing new data into ep %u\n",
		func->name ? func->name : "", ep->address);

	gadget = func->config->cdev->gadget;
	if (func->func_is_suspended && func->func_wakeup_allowed) {
		ret = usb_gadget_func_wakeup(gadget, func->intf_id);
		if (ret == -EAGAIN) {
			pr_debug("bus suspended func wakeup for %s delayed until bus resume.\n",
				 func->name ? func->name : "");
		} else if (ret < 0 && ret != -ENOTSUPP) {
			pr_err("Failed to wake function %s from suspend state. ret=%d.\n",
			       func->name ? func->name : "", ret);
		}
		goto done;
	}

	if (!func->func_is_suspended)
		ret = 0;

	if (func->func_is_suspended && !func->func_wakeup_allowed) {
		ret = -ENOTSUPP;
		goto done;
	}

	ret = usb_ep_queue(ep, req, gfp_flags);
done:
	return ret;
}
EXPORT_SYMBOL_GPL(usb_func_ep_queue);

static u8 encode_bMaxPower(enum usb_device_speed speed,
static u8 encode_bMaxPower(enum usb_device_speed speed,
		struct usb_configuration *c)
		struct usb_configuration *c)
{
{
+0 −38
Original line number Original line Diff line number Diff line
@@ -205,41 +205,3 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
	gadget->out_epnum = 0;
	gadget->out_epnum = 0;
}
}
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_reset);

/**
 * usb_ep_autoconfig_by_name - Used to pick the endpoint by name. eg ep1in-gsi
 * @gadget: The device to which the endpoint must belong.
 * @desc: Endpoint descriptor, with endpoint direction and transfer mode
 *	initialized.
 * @ep_name: EP name that is to be searched.
 *
 */
struct usb_ep *usb_ep_autoconfig_by_name(
			struct usb_gadget		*gadget,
			struct usb_endpoint_descriptor	*desc,
			const char			*ep_name
)
{
	struct usb_ep	*ep;
	bool ep_found = false;

	list_for_each_entry(ep, &gadget->ep_list, ep_list)
		if (strcmp(ep->name, ep_name) == 0 && !ep->driver_data) {
			ep_found = true;
			break;
		}

	if (ep_found) {
		desc->bEndpointAddress &= USB_DIR_IN;
		desc->bEndpointAddress |= ep->ep_num;
		ep->address = desc->bEndpointAddress;
		pr_debug("Allocating ep address:%x\n", ep->address);
		ep->desc = NULL;
		ep->comp_desc = NULL;
		return ep;
	}

	pr_err("%s:error finding ep %s\n", __func__, ep_name);
	return NULL;
}
EXPORT_SYMBOL_GPL(usb_ep_autoconfig_by_name);
Loading