intel_scu_ipcutil: add OSC_CLK setting ioctl support
authorShijie Zhang <shijie.zhang@intel.com>
Fri, 20 Apr 2012 16:55:01 +0000 (00:55 +0800)
committerbuildbot <buildbot@intel.com>
Tue, 24 Apr 2012 08:35:08 +0000 (01:35 -0700)
BZ: 32771

This patch adds an OSC_CLK ioctl command for OSC_CLK control, which
makes OSC_CLK control, test and debug more easier.

Change-Id: I7e48106cd04633c5840bbb3e2b57fd3479a9e972
Signed-off-by: Shijie Zhang <shijie.zhang@intel.com>
Reviewed-on: http://android.intel.com:8080/44122
Reviewed-by: Du, Alek <alek.du@intel.com>
Tested-by: Wang, Zhifeng <zhifeng.wang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/platform/x86/intel_scu_ipcutil.c

index 2e0a1e7..c33397b 100644 (file)
@@ -5,6 +5,8 @@
  * Author: Sreedhara DS (sreedhara.ds@intel.com)
  * (C) Copyright 2010 Intel Corporation
  * Author: Sudha Krishnakumar (sudha.krishnakumar@intel.com)
+ * (C) Copyright 2012 Intel Corporation
+ * Author: Shijie Zhang (shijie.zhang@intel.com)
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -44,6 +46,7 @@
 #define INTEL_SCU_IPC_WRITE_RR_TO_OSNIB        0xC2
 #define INTEL_SCU_IPC_READ_VBATTCRIT   0xC4
 #define INTEL_SCU_IPC_WRITE_ALARM_FLAG_TO_OSNIB 0xC5
+#define INTEL_SCU_IPC_OSC_CLK_CNTL 0xC6
 
 #define OSHOB_PMIT_OFFSET              0x0000002c
 #define OSNIB_RR_OFFSET                        OSNIB_OFFSET
@@ -75,6 +78,11 @@ struct scu_ipc_version {
        u8      data[16]; /* version data */
 };
 
+struct osc_clk_t {
+       unsigned int id; /* clock id */
+       unsigned int khz; /* clock frequency */
+};
+
 /**
  *     scu_reg_access          -       implement register access ioctls
  *     @cmd: command we are doing (read/write/update)
@@ -232,6 +240,19 @@ static long scu_ipc_ioctl(struct file *fp, unsigned int cmd,
                        ret = -EFAULT;
                break;
        }
+       case INTEL_SCU_IPC_OSC_CLK_CNTL:
+       {
+               struct osc_clk_t osc_clk;
+
+               if (copy_from_user(&osc_clk, argp, sizeof(struct osc_clk_t)))
+                       return -EFAULT;
+
+               ret = intel_scu_ipc_osc_clk(osc_clk.id, osc_clk.khz);
+               if (ret)
+                       pr_err("%s: failed to set osc clk\n", __func__);
+
+               break;
+       }
        default:
                if (copy_from_user(&data, argp, sizeof(struct scu_ipc_data)))
                        return -EFAULT;