Lines Matching refs:rj54n1
151 struct rj54n1 { struct
425 static struct rj54n1 *to_rj54n1(const struct i2c_client *client) in to_rj54n1()
427 return container_of(i2c_get_clientdata(client), struct rj54n1, subdev); in to_rj54n1()
432 struct rj54n1 *rj54n1 = to_rj54n1(client); in reg_read() local
436 if (rj54n1->bank != reg >> 8) { in reg_read()
441 rj54n1->bank = reg >> 8; in reg_read()
449 struct rj54n1 *rj54n1 = to_rj54n1(client); in reg_write() local
453 if (rj54n1->bank != reg >> 8) { in reg_write()
458 rj54n1->bank = reg >> 8; in reg_write()
548 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_set_selection() local
561 output_w = (input_w * 1024 + rj54n1->resize / 2) / rj54n1->resize; in rj54n1_set_selection()
562 output_h = (input_h * 1024 + rj54n1->resize / 2) / rj54n1->resize; in rj54n1_set_selection()
565 input_w, input_h, rj54n1->resize, output_w, output_h); in rj54n1_set_selection()
571 rj54n1->width = output_w; in rj54n1_set_selection()
572 rj54n1->height = output_h; in rj54n1_set_selection()
573 rj54n1->resize = ret; in rj54n1_set_selection()
574 rj54n1->rect.width = input_w; in rj54n1_set_selection()
575 rj54n1->rect.height = input_h; in rj54n1_set_selection()
585 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_get_selection() local
598 sel->r = rj54n1->rect; in rj54n1_get_selection()
611 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_get_fmt() local
616 mf->code = rj54n1->fmt->code; in rj54n1_get_fmt()
617 mf->colorspace = rj54n1->fmt->colorspace; in rj54n1_get_fmt()
622 mf->width = rj54n1->width; in rj54n1_get_fmt()
623 mf->height = rj54n1->height; in rj54n1_get_fmt()
637 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_sensor_scale() local
757 if (!rj54n1->auto_wb) { in rj54n1_sensor_scale()
779 peak = 12 * RJ54N1_MAX_WIDTH * (1 << 14) * resize / rj54n1->tgclk_mhz / in rj54n1_sensor_scale()
822 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_set_clock() local
839 rj54n1->clk_div.ratio_tg); in rj54n1_set_clock()
842 rj54n1->clk_div.ratio_t); in rj54n1_set_clock()
845 rj54n1->clk_div.ratio_r); in rj54n1_set_clock()
858 rj54n1->clk_div.ratio_op); in rj54n1_set_clock()
861 rj54n1->clk_div.ratio_o); in rj54n1_set_clock()
906 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_reg_init() local
946 rj54n1->auto_wb = ret & 0x80; in rj54n1_reg_init()
981 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_set_fmt() local
984 input_w = rj54n1->rect.width, input_h = rj54n1->rect.height; in rj54n1_set_fmt()
1001 fmt = rj54n1->fmt; in rj54n1_set_fmt()
1113 rj54n1->fmt = fmt; in rj54n1_set_fmt()
1114 rj54n1->resize = ret; in rj54n1_set_fmt()
1115 rj54n1->rect.width = input_w; in rj54n1_set_fmt()
1116 rj54n1->rect.height = input_h; in rj54n1_set_fmt()
1117 rj54n1->width = output_w; in rj54n1_set_fmt()
1118 rj54n1->height = output_h; in rj54n1_set_fmt()
1166 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_s_power() local
1169 if (rj54n1->pwup_gpio) in rj54n1_s_power()
1170 gpiod_set_value(rj54n1->pwup_gpio, 1); in rj54n1_s_power()
1171 if (rj54n1->enable_gpio) in rj54n1_s_power()
1172 gpiod_set_value(rj54n1->enable_gpio, 1); in rj54n1_s_power()
1176 return clk_prepare_enable(rj54n1->clk); in rj54n1_s_power()
1179 clk_disable_unprepare(rj54n1->clk); in rj54n1_s_power()
1181 if (rj54n1->enable_gpio) in rj54n1_s_power()
1182 gpiod_set_value(rj54n1->enable_gpio, 0); in rj54n1_s_power()
1183 if (rj54n1->pwup_gpio) in rj54n1_s_power()
1184 gpiod_set_value(rj54n1->pwup_gpio, 0); in rj54n1_s_power()
1191 struct rj54n1 *rj54n1 = container_of(ctrl->handler, struct rj54n1, hdl); in rj54n1_s_ctrl() local
1192 struct v4l2_subdev *sd = &rj54n1->subdev; in rj54n1_s_ctrl()
1222 rj54n1->auto_wb = ctrl->val; in rj54n1_s_ctrl()
1266 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_video_probe() local
1270 ret = rj54n1_s_power(&rj54n1->subdev, 1); in rj54n1_video_probe()
1293 ret = v4l2_ctrl_handler_setup(&rj54n1->hdl); in rj54n1_video_probe()
1296 rj54n1_s_power(&rj54n1->subdev, 0); in rj54n1_video_probe()
1303 struct rj54n1 *rj54n1; in rj54n1_probe() local
1321 rj54n1 = devm_kzalloc(&client->dev, sizeof(struct rj54n1), GFP_KERNEL); in rj54n1_probe()
1322 if (!rj54n1) in rj54n1_probe()
1325 v4l2_i2c_subdev_init(&rj54n1->subdev, client, &rj54n1_subdev_ops); in rj54n1_probe()
1326 v4l2_ctrl_handler_init(&rj54n1->hdl, 4); in rj54n1_probe()
1327 v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops, in rj54n1_probe()
1329 v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops, in rj54n1_probe()
1331 v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops, in rj54n1_probe()
1333 v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops, in rj54n1_probe()
1335 rj54n1->subdev.ctrl_handler = &rj54n1->hdl; in rj54n1_probe()
1336 if (rj54n1->hdl.error) in rj54n1_probe()
1337 return rj54n1->hdl.error; in rj54n1_probe()
1339 rj54n1->clk_div = clk_div; in rj54n1_probe()
1340 rj54n1->rect.left = RJ54N1_COLUMN_SKIP; in rj54n1_probe()
1341 rj54n1->rect.top = RJ54N1_ROW_SKIP; in rj54n1_probe()
1342 rj54n1->rect.width = RJ54N1_MAX_WIDTH; in rj54n1_probe()
1343 rj54n1->rect.height = RJ54N1_MAX_HEIGHT; in rj54n1_probe()
1344 rj54n1->width = RJ54N1_MAX_WIDTH; in rj54n1_probe()
1345 rj54n1->height = RJ54N1_MAX_HEIGHT; in rj54n1_probe()
1346 rj54n1->fmt = &rj54n1_colour_fmts[0]; in rj54n1_probe()
1347 rj54n1->resize = 1024; in rj54n1_probe()
1348 rj54n1->tgclk_mhz = (rj54n1_priv->mclk_freq / PLL_L * PLL_N) / in rj54n1_probe()
1351 rj54n1->clk = clk_get(&client->dev, NULL); in rj54n1_probe()
1352 if (IS_ERR(rj54n1->clk)) { in rj54n1_probe()
1353 ret = PTR_ERR(rj54n1->clk); in rj54n1_probe()
1357 rj54n1->pwup_gpio = gpiod_get_optional(&client->dev, "powerup", in rj54n1_probe()
1359 if (IS_ERR(rj54n1->pwup_gpio)) { in rj54n1_probe()
1361 PTR_ERR(rj54n1->pwup_gpio)); in rj54n1_probe()
1362 ret = PTR_ERR(rj54n1->pwup_gpio); in rj54n1_probe()
1366 rj54n1->enable_gpio = gpiod_get_optional(&client->dev, "enable", in rj54n1_probe()
1368 if (IS_ERR(rj54n1->enable_gpio)) { in rj54n1_probe()
1370 PTR_ERR(rj54n1->enable_gpio)); in rj54n1_probe()
1371 ret = PTR_ERR(rj54n1->enable_gpio); in rj54n1_probe()
1379 ret = v4l2_async_register_subdev(&rj54n1->subdev); in rj54n1_probe()
1386 if (rj54n1->enable_gpio) in rj54n1_probe()
1387 gpiod_put(rj54n1->enable_gpio); in rj54n1_probe()
1389 if (rj54n1->pwup_gpio) in rj54n1_probe()
1390 gpiod_put(rj54n1->pwup_gpio); in rj54n1_probe()
1393 clk_put(rj54n1->clk); in rj54n1_probe()
1396 v4l2_ctrl_handler_free(&rj54n1->hdl); in rj54n1_probe()
1403 struct rj54n1 *rj54n1 = to_rj54n1(client); in rj54n1_remove() local
1405 if (rj54n1->enable_gpio) in rj54n1_remove()
1406 gpiod_put(rj54n1->enable_gpio); in rj54n1_remove()
1407 if (rj54n1->pwup_gpio) in rj54n1_remove()
1408 gpiod_put(rj54n1->pwup_gpio); in rj54n1_remove()
1410 clk_put(rj54n1->clk); in rj54n1_remove()
1411 v4l2_ctrl_handler_free(&rj54n1->hdl); in rj54n1_remove()
1412 v4l2_async_unregister_subdev(&rj54n1->subdev); in rj54n1_remove()