diff options
author | Arun Mankuzhi <arun.m@samsung.com> | 2014-10-21 07:07:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-10-28 13:50:34 -0400 |
commit | 773e635266b10244c63259f3366b5b4bc7c215c1 (patch) | |
tree | c0bd5adb847beb094451d60d01b91dc0248208b7 | |
parent | 9a7bc6b0c456bdc642269659fb13f29a8c13815b (diff) |
[media] s5p-mfc: modify mfc wakeup sequence for V8
MFC wakeup command has to be sent after the host receives
firmware load complete status from risc.
Signed-off-by: Arun Mankuzhi <arun.m@samsung.com>
Signed-off-by: Kiran AVND <avnd.kiran@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 78 |
1 files changed, 61 insertions, 17 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index fbffb102ef78..6308150e638f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | |||
@@ -353,6 +353,58 @@ int s5p_mfc_sleep(struct s5p_mfc_dev *dev) | |||
353 | return ret; | 353 | return ret; |
354 | } | 354 | } |
355 | 355 | ||
356 | static int s5p_mfc_v8_wait_wakeup(struct s5p_mfc_dev *dev) | ||
357 | { | ||
358 | int ret; | ||
359 | |||
360 | /* Release reset signal to the RISC */ | ||
361 | dev->risc_on = 1; | ||
362 | mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); | ||
363 | |||
364 | if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_FW_STATUS_RET)) { | ||
365 | mfc_err("Failed to reset MFCV8\n"); | ||
366 | return -EIO; | ||
367 | } | ||
368 | mfc_debug(2, "Write command to wakeup MFCV8\n"); | ||
369 | ret = s5p_mfc_hw_call(dev->mfc_cmds, wakeup_cmd, dev); | ||
370 | if (ret) { | ||
371 | mfc_err("Failed to send command to MFCV8 - timeout\n"); | ||
372 | return ret; | ||
373 | } | ||
374 | |||
375 | if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_WAKEUP_RET)) { | ||
376 | mfc_err("Failed to wakeup MFC\n"); | ||
377 | return -EIO; | ||
378 | } | ||
379 | return ret; | ||
380 | } | ||
381 | |||
382 | static int s5p_mfc_wait_wakeup(struct s5p_mfc_dev *dev) | ||
383 | { | ||
384 | int ret; | ||
385 | |||
386 | /* Send MFC wakeup command */ | ||
387 | ret = s5p_mfc_hw_call(dev->mfc_cmds, wakeup_cmd, dev); | ||
388 | if (ret) { | ||
389 | mfc_err("Failed to send command to MFC - timeout\n"); | ||
390 | return ret; | ||
391 | } | ||
392 | |||
393 | /* Release reset signal to the RISC */ | ||
394 | if (IS_MFCV6_PLUS(dev)) { | ||
395 | dev->risc_on = 1; | ||
396 | mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); | ||
397 | } else { | ||
398 | mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET); | ||
399 | } | ||
400 | |||
401 | if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_WAKEUP_RET)) { | ||
402 | mfc_err("Failed to wakeup MFC\n"); | ||
403 | return -EIO; | ||
404 | } | ||
405 | return ret; | ||
406 | } | ||
407 | |||
356 | int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) | 408 | int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) |
357 | { | 409 | { |
358 | int ret; | 410 | int ret; |
@@ -365,6 +417,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) | |||
365 | ret = s5p_mfc_reset(dev); | 417 | ret = s5p_mfc_reset(dev); |
366 | if (ret) { | 418 | if (ret) { |
367 | mfc_err("Failed to reset MFC - timeout\n"); | 419 | mfc_err("Failed to reset MFC - timeout\n"); |
420 | s5p_mfc_clock_off(); | ||
368 | return ret; | 421 | return ret; |
369 | } | 422 | } |
370 | mfc_debug(2, "Done MFC reset..\n"); | 423 | mfc_debug(2, "Done MFC reset..\n"); |
@@ -373,25 +426,16 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) | |||
373 | /* 2. Initialize registers of channel I/F */ | 426 | /* 2. Initialize registers of channel I/F */ |
374 | s5p_mfc_clear_cmds(dev); | 427 | s5p_mfc_clear_cmds(dev); |
375 | s5p_mfc_clean_dev_int_flags(dev); | 428 | s5p_mfc_clean_dev_int_flags(dev); |
376 | /* 3. Initialize firmware */ | 429 | /* 3. Send MFC wakeup command and wait for completion*/ |
377 | ret = s5p_mfc_hw_call(dev->mfc_cmds, wakeup_cmd, dev); | 430 | if (IS_MFCV8(dev)) |
378 | if (ret) { | 431 | ret = s5p_mfc_v8_wait_wakeup(dev); |
379 | mfc_err("Failed to send command to MFC - timeout\n"); | ||
380 | return ret; | ||
381 | } | ||
382 | /* 4. Release reset signal to the RISC */ | ||
383 | if (IS_MFCV6_PLUS(dev)) { | ||
384 | dev->risc_on = 1; | ||
385 | mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); | ||
386 | } | ||
387 | else | 432 | else |
388 | mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET); | 433 | ret = s5p_mfc_wait_wakeup(dev); |
389 | mfc_debug(2, "Ok, now will write a command to wakeup the system\n"); | 434 | |
390 | if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_WAKEUP_RET)) { | ||
391 | mfc_err("Failed to load firmware\n"); | ||
392 | return -EIO; | ||
393 | } | ||
394 | s5p_mfc_clock_off(); | 435 | s5p_mfc_clock_off(); |
436 | if (ret) | ||
437 | return ret; | ||
438 | |||
395 | dev->int_cond = 0; | 439 | dev->int_cond = 0; |
396 | if (dev->int_err != 0 || dev->int_type != | 440 | if (dev->int_err != 0 || dev->int_type != |
397 | S5P_MFC_R2H_CMD_WAKEUP_RET) { | 441 | S5P_MFC_R2H_CMD_WAKEUP_RET) { |