Lines Matching refs:rj54n1

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