host-drivers/base-driver/vca/plx87xx/plx_hw.c
int plx_card_check_power_button_state(struct plx_device *xdev, int cpu_id)
{
	int ret = 0;
	if (xdev->card_type & VCA_MV) {
		u32 data;
		u32 bit = 0;

		if (cpu_id < 0 || cpu_id >= plx_get_cpu_num(xdev)) {
			dev_err(&xdev->pdev->dev, "Unknown CPU ID: card %d cpu %d\n",
					xdev->card_id, cpu_id);
			ret = -EINVAL;
			return ret;
		}

		bit = plx_power_button_bits[cpu_id];
		data = plx_mmio_read(&xdev->mmio, GPIO_REG);
		if (!(data & bit)) {
			ret = 1;
		} else {
			u64 time = get_jiffies_64();
			if (time_after_eq64(time, xdev->power_ts[cpu_id]) &&
				time_before64(time, xdev->power_ts[cpu_id]
					+ msecs_to_jiffies(POWER_GRACE_PERIOD_MS))) {
				ret = 2;
			}
		}
	} else if (!(xdev->card_type & VCA_VV)) {
		/* Ignore power button for VV cards, display error for others */
		dev_err(&xdev->pdev->dev, "Power status unsupported: card %d cpu %d\n",
				xdev->card_id, cpu_id);
		ret = -EINVAL;
	}

	return ret;
}
/**
 * plx_card_check_power_button_state - Read power button on VCA device.
 * @xdev: pointer to plx_device instance
 * @cpu_id: id of cpu to read status
 * RETURNS: 0 if power button is released, positive number if power button
 *     is pressed down, or time during padding between minimal time to change
 *     button state, negative number if error.
 */
Read power button on VCA device.
@xdev: pointer to plx_device instance
@cpu_id: id of cpu to read status
RETURNS: 0 if power button is released, positive number if power button
is pressed down, or time during padding between minimal time to change
button state, negative number if error.
Read power button on VCA device . @xdev : pointer to plx_device instance @cpu_id : id of cpu to read status RETURNS : 0 if power button is released positive number if power button is pressed down or time during padding between minimal time to change button state negative number if error .
int plx_card_check_power_button_state(struct plx_device *xdev, int cpu_id)
{
	int ret = 0;
	if (xdev->card_type & VCA_MV) {
		u32 data;
		u32 bit = 0;
		if (cpu_id < 0 || cpu_id >= plx_get_cpu_num(xdev)) {
			dev_err(&xdev->pdev->dev, "Unknown CPU ID: card %d cpu %d\n",
					xdev->card_id, cpu_id);
			ret = -EINVAL;
			return ret;
		}
		bit = plx_power_button_bits[cpu_id];
		data = plx_mmio_read(&xdev->mmio, GPIO_REG);
		if (!(data & bit)) {
			ret = 1;
		} else {
			u64 time = get_jiffies_64();
			if (time_after_eq64(time, xdev->power_ts[cpu_id]) &&
				time_before64(time, xdev->power_ts[cpu_id]
					+ msecs_to_jiffies(POWER_GRACE_PERIOD_MS))) {
				ret = 2;
			}
		}
	} else if (!(xdev->card_type & VCA_VV)) {
		dev_err(&xdev->pdev->dev, "Power status unsupported: card %d cpu %d\n",
				xdev->card_id, cpu_id);
		ret = -EINVAL;
	}
	return ret;
}
int plx_card_check_power_button_state ( struct plx_device * xdev , int cpu_id ) { int ret = 0 ; if ( xdev -> card_type & VCA_MV ) { u32 data ; u32 bit = 0 ; if ( cpu_id < 0 || cpu_id >= plx_get_cpu_num ( xdev ) ) { dev_err ( & xdev -> pdev -> dev , " \n " , xdev -> card_id , cpu_id ) ; ret = - EINVAL ; return ret ; } bit = plx_power_button_bits [ cpu_id ] ; data = plx_mmio_read ( & xdev -> mmio , GPIO_REG ) ; if ( ! ( data & bit ) ) { ret = 1 ; } else { u64 time = get_jiffies_64 ( ) ; if ( time_after_eq64 ( time , xdev -> power_ts [ cpu_id ] ) && time_before64 ( time , xdev -> power_ts [ cpu_id ] + msecs_to_jiffies ( POWER_GRACE_PERIOD_MS ) ) ) { ret = 2 ; } } } else if ( ! ( xdev -> card_type & VCA_VV ) ) { dev_err ( & xdev -> pdev -> dev , " \n " , xdev -> card_id , cpu_id ) ; ret = - EINVAL ; } return ret ; }
plx_card_check_power_button_state - Read power button on VCA device.
plx_card_check_power_button_state - Read power button on VCA device .
/* Ignore power button for VV cards, display error for others */