{
sc_ipc_t ipcHndl;
sc_err_t sciErr;
- uint32_t mu_id;
+ uint32_t mu_id, ch_id, i;
+ uint8_t chan_mask = 0, temp_mask;
+ struct device_node *parent, *node;
sciErr = sc_ipc_getMuID(&mu_id);
if (sciErr != SC_ERR_NONE) {
return;
}
- sciErr = sc_pm_set_resource_power_mode(ipcHndl, SC_R_ISI_CH0, SC_PM_PW_MODE_OFF);
- if (sciErr != SC_ERR_NONE)
- pr_err("sc_misc_MIPI reset failed! (sciError = %d)\n", sciErr);
+ parent = of_get_parent(mxc_isi->pdev->dev.of_node);
+ if (!parent) {
+ dev_err(&mxc_isi->pdev->dev, "get parent device fail\n");
+ return;
+ }
- sciErr = sc_pm_set_resource_power_mode(ipcHndl, SC_R_ISI_CH0, SC_PM_PW_MODE_ON);
- if (sciErr != SC_ERR_NONE)
- pr_err("sc_misc_MIPI reset failed! (sciError = %d)\n", sciErr);
+ for_each_available_child_of_node(parent, node) {
+ if (!strcmp(node->name, ISI_OF_NODE_NAME)) {
+ ch_id = of_alias_get_id(node, "isi");
+ chan_mask |= 1 << ch_id;
+ }
+ }
- udelay(500);
+ temp_mask = chan_mask;
+ for (i = 0; i < 8; i++) {
+ if (chan_mask & 0x1) {
+ sciErr = sc_pm_set_resource_power_mode(ipcHndl, SC_R_ISI_CH0 + i, SC_PM_PW_MODE_OFF);
+ if (sciErr != SC_ERR_NONE)
+ pr_err("power on ISI%d failed! (sciError = %d)\n", i, sciErr);
+ }
+ chan_mask >>= 1;
+ }
+ chan_mask = temp_mask;
+ for (i = 0; i < 8; i++) {
+ if (chan_mask & 0x1) {
+ sciErr = sc_pm_set_resource_power_mode(ipcHndl, SC_R_ISI_CH0 + i, SC_PM_PW_MODE_ON);
+ if (sciErr != SC_ERR_NONE)
+ pr_err("power off ISI%d failed! (sciError = %d)\n", i, sciErr);
+ }
+ chan_mask >>= 1;
+ }
+
+ udelay(500);
sc_ipc_close(mu_id);
}