AnsweredAssumed Answered

ov5640_write_reg error?

Question asked by Ganesh Biradar on Jan 20, 2016
Latest reply on Jan 21, 2016 by Ganesh Biradar

Hi Guys,


well i have actually able to create sysfs entry and able to pass some value to desired brightness level  but it is returning ov5640_write_reg fail. i have only modified ov5640_mipi.c file only.

Below is my code snippet please check.




static struct kobject *ov5640_mipi_kobj;


static ssize_t ov5640_mipi_brightness_set(struct device *dev, struct device_attribute *attr, char *buf,size_t size)


   int err;

  unsigned long val;

  if (strict_strtoul(buf, 10, &val))

                return -EINVAL;

  pr_info("GB : ov5640_mipi_brightness_set\n");


  case 0 :      ov5640_write_reg(0x5001, 0xff);

                     ov5640_write_reg(0x5587, 0x40);

                     ov5640_write_reg(0x5580, 0x04);

                     ov5640_write_reg(0x5588, 0x01);





static struct kobj_attribute brightness = __ATTR(brightness_ctrl, 0664, NULL, ov5640_mipi_brightness_set);

static struct attribute *attributes_ov5640_mipi[] = {




static struct attribute_group attr_group_ov5640_mipi = {

        .attrs = attributes_ov5640_mipi,


static int create_sysfs_interfaces(struct device *dev)// calling from probe function


        int err;

        ov5640_mipi_kobj = kobject_create_and_add("ov5640_mipi_sensor", &dev->kobj);


                return -ENOMEM;

        err = sysfs_create_group(ov5640_mipi_kobj, &attr_group_ov5640_mipi);

        if (err)



                dev_err(dev, "%s:Unable to create interface\n", __func__);

                 return -1;


  pr_info("GB : create_sysfs_interfaces\n");

  return 0;



$ echo 0 > /sys/bus/i2c/../devices/ov5640_brightness_set/brightness_ctrl

GB : ov5640_mipi_brightness_set

ov5640_write_reg:write reg error:reg=5001,val=ff

ov5640_write_reg:write reg error:reg=5587,val=40

ov5640_write_reg:write reg error:reg=5580,val=4

ov5640_write_reg:write reg error:reg=5588,val=1