Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media: i2c: Add ISX021 sensor driver #2538

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

btogorean
Copy link
Contributor

@btogorean btogorean commented Jul 8, 2024

Driver for ISX021 MIPI RGB sensor

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

@btogorean
Copy link
Contributor Author

V2:

  • Fixed CI checkpatch & dt_binding_check errors

Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First round from me. Note that I don't see any reason for not upstreaming this so I definitely expect this to be upstreamed :).

The media and DRM out of tree stuff we have are one of the biggest pain points I have when merging to newer kernels.

MAINTAINERS Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
drivers/media/i2c/isx021.c Show resolved Hide resolved
drivers/media/i2c/isx021.c Outdated Show resolved Hide resolved
@nunojsa
Copy link
Collaborator

nunojsa commented Jul 11, 2024

@btogorean, I merged #2543 so you can rebase this and it should start giving you valid errors in your bindings (I used it an example and I know it has problems :))

Add YAML documentation

Signed-off-by: Bogdan Togorean <[email protected]>
@btogorean
Copy link
Contributor Author

V3:

  • fix .yaml styling
  • mode MAINTAINERS to documentation commit
  • use fsleep
  • fix styling
  • remove isx021_reg_write/read and replace with direct regmap call

Add support for the Sony ISX021 RGB camera sensor

Signed-off-by: Bogdan Togorean <[email protected]>
@btogorean
Copy link
Contributor Author

v4:

  • remove unnecessary empty line

Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments from me. I would say to send it upstream

sensor->supplies);
if (ret) {
dev_err_probe(sensor->dev, ret, "failed to get supplies\n");
return ret;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do return dev_err_probe()


/* -----------------------------------------------------------------------------
* Probe & Remove
*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure these comments add much :)


reg->size = 1;
ret = regmap_read(sensor->regmap, reg->reg, &aux);
reg->val = aux;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still want to do reg->val = aux if, for some reason, regmap_read() fails?


fmt->format = *format;

return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this API void... We're not returning any error

pm_runtime_put_sync(sensor->dev);
sensor->streaming = false;

goto unlock;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awkward... Why not have the label before the 'unlock' one?

int ret;

if (sensor->trigger_mode) {
ret = isx021_set_fsync_trigger_mode(sensor);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignored ret

return ret;

return regmap_write(sensor->regmap, 0xac49,
(ISX021_SHUTTER_TIME_MAX >> 8) & 0xFF);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we could have some meaning on those registers plain numbers...

{
int ret;

fsleep(20000);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this sleep?


ret = gpiod_direction_output(sensor->reset, 0);
if (ret < 0)
goto err_supply;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already output... Use gpiod_set_value_cansleep()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants