Beispiel #1
0
int mic2873_led_en(int onoff, int mode)
{
	int ret = 0;

	if (flash_torch_en) {
	    if (onoff) { 	/* enable */
		if (mode) { 	/* flash */
			DEBUG_MIC2873("[LED] %s: mic2873_flash_en set 1\n", __func__);
			mic2873_flash_ctrl(MIC2873_OP_SWITCH_ON, MIC2873_FLASH_CURRENT_FEN0_1P200);
		} else { 	/* torch */
			DEBUG_MIC2873("[LED] %s: mic2873_torch_en set 1\n", __func__);
			mic2873_torch_ctrl(MIC2873_OP_SWITCH_ON, MIC2873_TORCH_CURRENT_TEN1_175P0);
		}
	    } else { 		/* disable */
		if (mode) { 	/* flash */
			DEBUG_MIC2873("[LED] %s: mic2873_flash_en set 0\n", __func__);
			mic2873_flash_ctrl(MIC2873_OP_SWITCH_OFF, MIC2873_FLASH_CURRENT_FEN0_1P200);
		} else { 	/* torch */
			DEBUG_MIC2873("[LED] %s: mic2873_torch_en set 0\n", __func__);
			mic2873_torch_ctrl(MIC2873_OP_SWITCH_OFF, MIC2873_TORCH_CURRENT_TEN1_175P0);
		}
	    }
	} else {
	    pr_err("%s : Error!!, find gpio", __func__);
	    ret = -EINVAL;
	}

	return ret;
}
int mic2873_led_en(int onoff, int mode)
{
	int ret = 0;

        if (sysfs_flash_op) {
            pr_warn("%s : The camera led control is not allowed"
                    " because sysfs led control already used it\n", __FUNCTION__);
            return 0; //no error
        }

	if (flash_torch_en) {
	    if (onoff) { 	/* enable */
		if (mode) { 	/* flash */
			DEBUG_MIC2873("[LED] %s: mic2873_flash_en set 1\n", __func__);
			mic2873_flash_ctrl(MIC2873_OP_SWITCH_ON, MIC2873_FLASH_CURRENT_FEN0_1P200);
		} else { 	/* torch */
			DEBUG_MIC2873("[LED] %s: mic2873_torch_en set 1\n", __func__);
			mic2873_torch_ctrl(MIC2873_OP_SWITCH_ON, MIC2873_TORCH_CURRENT_TEN1_175P0);
		}
	    } else { 		/* disable */
		if (mode) { 	/* flash */
			DEBUG_MIC2873("[LED] %s: mic2873_flash_en set 0\n", __func__);
			mic2873_flash_ctrl(MIC2873_OP_SWITCH_OFF, MIC2873_FLASH_CURRENT_FEN0_1P200);
		} else { 	/* torch */
			DEBUG_MIC2873("[LED] %s: mic2873_torch_en set 0\n", __func__);
			mic2873_torch_ctrl(MIC2873_OP_SWITCH_OFF, MIC2873_TORCH_CURRENT_TEN1_175P0);
		}
	    }
	} else {
	    pr_err("%s : Error!!, find gpio\n", __func__);
	    ret = -EINVAL;
	}

	return ret;
}