lkml.org 
[lkml]   [2023]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 3/3] media: i2c: Introduce a driver for the Techwell TW9900 decoder
From
On 06/10/2023 18:25, Mehdi Djait wrote:
> The Techwell video decoder supports PAL, NTSC input formats,
> and outputs a BT.656 signal.
>
> This commit adds support for this device, with basic support for NTSC
> and PAL, along with brightness and contrast controls.
>
> The TW9900 is capable of doing automatic standard detection, this is
> implemented with support for PAL and NTSC autodetection.
>
> Signed-off-by: Mehdi Djait <mehdi.djait@bootlin.com>

...

> +
> +static int tw9900_check_id(struct tw9900 *tw9900,
> + struct i2c_client *client)
> +{
> + struct device *dev = &tw9900->client->dev;
> + int ret;
> +
> + ret = tw9900_read_reg(client, TW9900_CHIP_ID);
> + if (ret < 0)
> + return ret;
> +
> + if (ret != TW9900_CHIP_ID) {
> + dev_err(dev, "Unexpected decoder id(0x%x)\n", ret);
> + return -EINVAL;
> + }
> +
> + dev_info(dev, "Detected TW9900 (0x%x) decoder\n", TW9900_CHIP_ID);

dev_dbg
Do not spam log with simple success messages.

Why do you always print 0x0 (TW9900_CHIP_ID) here? It does not make
sense, drop.


> +
> + return 0;
> +}
> +
> +static int tw9900_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct v4l2_ctrl_handler *hdl;
> + struct tw9900 *tw9900;
> + int ret = 0;
> +
> + tw9900 = devm_kzalloc(dev, sizeof(*tw9900), GFP_KERNEL);
> + if (!tw9900)
> + return -ENOMEM;
> +
> + tw9900->client = client;
> + tw9900->cur_mode = &supported_modes[0];
> +
> + tw9900->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR(tw9900->reset_gpio))
> + tw9900->reset_gpio = NULL;
> +
> + tw9900->regulator = devm_regulator_get(&tw9900->client->dev, "vdd");
> + if (IS_ERR(tw9900->regulator)) {
> + dev_err(dev, "Failed to get power regulator\n");

return dev_err_probe()


Best regards,
Krzysztof

\
 
 \ /
  Last update: 2023-10-07 17:37    [W:0.184 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site