return (ret == 2) ? 0 : -1;
}
-static ssize_t rk1000_show(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t rk1000_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
- int ret=-1;
- int i=0;
- unsigned char tv_encoder_regs[] = {0x00, 0x00, 0x00, 0x03, 0x00, 0x00};
- unsigned char tv_encoder_control_regs[] = {0x43, 0x01};
-
-
- for (i = 0; i < sizeof(tv_encoder_regs); i++) {
- ret = rk1000_i2c_recv(I2C_ADDR_TVE, i, buf);
- printk("---%x--\n",buf[0]);
- if (ret < 0) {
- pr_err("rk1000_tv_write_block err!\n");
- return ret;
- }
- }
-
- for (i = 0; i < sizeof(tv_encoder_control_regs); i++) {
- ret = rk1000_i2c_recv(I2C_ADDR_CTRL,i + 3,buf);
- printk("cntrl---%x--\n",buf[0]);
- if (ret < 0) {
- pr_err("rk1000_control_write_block err!\n");
- return ret;
- }
- }
- return 0;
+ int ret = -1;
+ int i = 0;
+ unsigned char tv_encoder_regs[] = {0x00, 0x00, 0x00, 0x03, 0x00, 0x00};
+ unsigned char tv_encoder_control_regs[] = {0x43, 0x01};
+
+ for (i = 0; i < sizeof(tv_encoder_regs); i++) {
+ ret = rk1000_i2c_recv(I2C_ADDR_TVE, i, buf);
+ pr_info("---%x--\n", buf[0]);
+ if (ret < 0) {
+ pr_err("rk1000_tv_write_block err!\n");
+ return ret;
+ }
+ }
+
+ for (i = 0; i < sizeof(tv_encoder_control_regs); i++) {
+ ret = rk1000_i2c_recv(I2C_ADDR_CTRL, i + 3, buf);
+ pr_info("cntrl---%x--\n", buf[0]);
+ if (ret < 0) {
+ pr_err("rk1000_control_write_block err!\n");
+ return ret;
+ }
+ }
+ return 0;
}
static DEVICE_ATTR(rkcontrl, 0666, rk1000_show, NULL);
-static int __init bootloader_cvbs_setup(char *str){
- static int ret;
- if (str) {
- printk("cvbs init tve.format is %s\n", str);
- ret = sscanf(str, "%d", &cvbsmode);
- }
+static int __init bootloader_cvbs_setup(char *str)
+{
+ static int ret;
+
+ if (str) {
+ pr_info("cvbs init tve.format is %s\n", str);
+ ret = kstrtoint(str, 0, &cvbsmode);
+ }
return 0;
}
early_param("tve.format", bootloader_cvbs_setup);
DBG("ret=0x%x\n", ret);
ret = rk1000_i2c_send(I2C_ADDR_CTRL, CTRL_TVE, 0x07);
DBG("ret=0x%x\n", ret);
- //rk1000_reset_ctrl(0);
+ /* rk1000_reset_ctrl(0); */
return 0;
}
{
int ret;
- //rk1000_reset_ctrl(1);
+ /* rk1000_reset_ctrl(1); */
DBG("rk1000_control_resume\n");
/* ADC power off */
ret = rk1000_i2c_send(I2C_ADDR_CTRL, CTRL_ADC, 0x88);
enum of_gpio_flags flags;
int ret;
-
DBG("[%s] start\n", __func__);
rk1000 = kmalloc(sizeof(*rk1000), GFP_KERNEL);
if (!rk1000) {
dev_err(&client->dev, ">> rk1000 core inf kmalloc fail!");
return -ENOMEM;
}
-
+
memset(rk1000, 0, sizeof(struct rk1000));
rk1000->client = client;
rk1000->dev = &client->dev;
rk1000_np = rk1000->dev->of_node;
-
- if(cvbsmode<0){
+
+ if (cvbsmode < 0) {
/********Get reset pin***********/
rk1000->io_reset.gpio = of_get_named_gpio_flags(rk1000_np,
"gpio-reset",
"gpio-power",
0, &flags);
if (gpio_is_valid(rk1000->io_power.gpio)) {
- ret = gpio_request(rk1000->io_power.gpio, "rk1000-power-io");
+ ret = gpio_request(rk1000->io_power.gpio,
+ "rk1000-power-io");
if (ret != 0) {
- DBG("gpio_request rk1000->io_power.gpio invalid: %d\n",
+ DBG("request gpio for power invalid: %d\n",
rk1000->io_power.gpio);
goto err;
}
- rk1000->io_power.active = !(flags & OF_GPIO_ACTIVE_LOW);
+ rk1000->io_power.active =
+ !(flags & OF_GPIO_ACTIVE_LOW);
gpio_direction_output(rk1000->io_power.gpio,
rk1000->io_power.active);
}
/********rk1000 reset***********/
- gpio_set_value(rk1000->io_reset.gpio, rk1000->io_reset.active);
+ gpio_set_value(rk1000->io_reset.gpio,
+ rk1000->io_reset.active);
msleep(100);
- gpio_set_value(rk1000->io_reset.gpio, !(rk1000->io_reset.active));
+ gpio_set_value(rk1000->io_reset.gpio,
+ !(rk1000->io_reset.active));
}
rk1000_i2c_send(I2C_ADDR_CTRL, CTRL_ADC, 0x88);
#ifdef CONFIG_SND_SOC_RK1000
#endif
rk1000_i2c_send(I2C_ADDR_CTRL, CTRL_I2C, 0x22);
- if(cvbsmode<0){
+ if (cvbsmode < 0)
rk1000_i2c_send(I2C_ADDR_CTRL, CTRL_TVE, 0x00);
- }
- device_create_file(&client->dev, &dev_attr_rkcontrl);
+
+ device_create_file(&client->dev, &dev_attr_rkcontrl);
DBG("rk1000 probe ok\n");
return 0;
err: