Remove i2c_set_frequency interface 50/125650/1
authorHyeongsik Min <hyeongsik.min@samsung.com>
Tue, 18 Apr 2017 07:57:44 +0000 (16:57 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Tue, 18 Apr 2017 07:57:44 +0000 (16:57 +0900)
As ioctl for frequency setting is not defined in kernel, remove the
function and related enum type.

Change-Id: I3031b01e65995029251b6f33a1285ecffe66d58f
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
src/daemon/peripheral_bus_i2c.c
src/interface/i2c.c
src/interface/include/i2c.h

index 391d442..0493f2d 100644 (file)
@@ -28,11 +28,6 @@ int peripheral_bus_i2c_init(peripheral_i2c_context_h dev, int bus)
        return i2c_open(bus, &dev->fd);
 }
 
-int peripheral_bus_i2c_set_freq(peripheral_i2c_context_h dev, int mode)
-{
-       return i2c_set_frequency(dev->fd, mode);
-}
-
 int peripheral_bus_i2c_set_addr(peripheral_i2c_context_h dev, int addr)
 {
        return i2c_set_address(dev->fd, addr);
@@ -64,8 +59,6 @@ int peripheral_bus_i2c_process(peripheral_i2c_context_h dev, char *func_name, in
 
        if (!g_strcmp0(func_name, "INIT"))
                ret = peripheral_bus_i2c_init(dev, value);
-       else if (!g_strcmp0(func_name, "SET_FREQ"))
-               ret = peripheral_bus_i2c_set_freq(dev, value);
        else if (!g_strcmp0(func_name, "SET_ADDR"))
                ret = peripheral_bus_i2c_set_addr(dev, value);
        else if (!g_strcmp0(func_name, "READ"))
index d9b7614..15e1c69 100644 (file)
@@ -60,42 +60,6 @@ int i2c_close(int file_hndl)
        return 0;
 }
 
-int i2c_set_frequency(int file_hndl, i2c_mode_e speed)
-{
-       int status;
-       int fd;
-       char i2c_dev[I2C_BUFFER_MAX] = {0,};
-       int frequency = 0;
-
-       snprintf(i2c_dev, sizeof(i2c_dev)-1, SYSFS_I2C_DIR"-%d", file_hndl);
-       fd = open(i2c_dev, O_RDWR);
-
-       if (fd < 0)
-               return -ENODEV;
-
-       if (speed == I2C_STD) {
-               frequency = 10000;
-       } else if (speed == I2C_FAST) {
-               frequency = 400000;
-       } else if (speed == I2C_HIGH) {
-               frequency = 3400000;
-       } else {
-               _E("Error: speed is not supported [%d]\n", speed);
-               close(fd);
-               return -EINVAL;
-       }
-
-       status = ioctl(fd, I2C_FREQUENCY, (unsigned long)((unsigned int*)&frequency));
-
-       if (status < 0) {
-               _E("Error  I2C_FREQUENCY, speed[%d]:\n",  speed);
-               close(fd);
-               return -EIO;
-       }
-       close(fd);
-       return 0;
-}
-
 int i2c_set_address(int file_hndl, int address)
 {
        int status;
index 78ff48e..08afcc9 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __I2C_H_
+#ifndef __I2C_H__
 #define __I2C_H__
 
-/* Define *******************************************************************/
 #define SYSFS_I2C_DIR "/dev/i2c"
 #define I2C_BUFFER_MAX 64
-#define I2C_FREQUENCY 0X801
 #define I2C_SLAVE 0x0703
 
-typedef enum {
-       I2C_STD = 0,
-       I2C_FAST = 1,
-       I2C_HIGH = 2
-} i2c_mode_e;
-
 int i2c_open(int bus, int *file_hndl);
 int i2c_close(int file_hndl);
-int i2c_set_frequency(int file_hndl, i2c_mode_e speed);
 int i2c_set_address(int file_hndl, int address);
 int i2c_read(int file_hndl, unsigned char *data, int length, int addr);
 int i2c_write(int file_hndl, const unsigned char *data, int length, int addr);
 
-#endif/*__I2C_H_*/
+#endif/* __I2C_H__ */