Skip to content

Commit

Permalink
Merge tag 'br-v6.2i' of git://linuxtv.org/hverkuil/media_tree into me…
Browse files Browse the repository at this point in the history
…dia_stage

Tag branch

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

* tag 'br-v6.2i' of git://linuxtv.org/hverkuil/media_tree: (31 commits)
  media: s5c73m3: Switch to GPIO descriptors
  media: i2c: s5k5baf: switch to using gpiod API
  media: i2c: s5k6a3: switch to using gpiod API
  media: imx: remove code for non-existing config IMX_GPT_ICAP
  media: si470x: Fix use-after-free in si470x_int_in_callback()
  media: staging: stkwebcam: Restore MEDIA_{USB,CAMERA}_SUPPORT dependencies
  media: coda: Add check for kmalloc
  media: coda: Add check for dcoda_iram_alloc
  dt-bindings: media: s5c73m3: Fix reset-gpio descriptor
  media: dt-bindings: allwinner: h6-vpu-g2: Add IOMMU reference property
  media: s5k4ecgx: Delete driver
  media: s5k4ecgx: Switch to GPIO descriptors
  media: Switch to use dev_err_probe() helper
  headers: Remove some left-over license text in include/uapi/linux/v4l2-*
  headers: Remove some left-over license text in include/uapi/linux/dvb/
  media: usb: pwc-uncompress: Use flex array destination for memcpy()
  media: s5p-mfc: Fix to handle reference queue during finishing
  media: s5p-mfc: Clear workbit to handle error condition
  media: s5p-mfc: Fix in register read and write for H264
  media: imx: Use get_mbus_config instead of parsing upstream DT endpoints
  ...
  • Loading branch information
mchehab authored and Hans Verkuil committed Dec 7, 2022
2 parents b2ea130 + a14e84d commit 3178804
Show file tree
Hide file tree
Showing 59 changed files with 247 additions and 1,788 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ properties:
resets:
maxItems: 1

iommus:
maxItems: 1

required:
- compatible
- reg
- interrupts
- clocks
- clock-names
- resets
- iommus

additionalProperties: false

Expand All @@ -59,6 +63,7 @@ examples:
clocks = <&ccu CLK_BUS_VP9>, <&ccu CLK_VP9>;
clock-names = "bus", "mod";
resets = <&ccu RST_BUS_VP9>;
iommus = <&iommu 5>;
};
...
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ i2c@138a000000 {
clock-frequency = <24000000>;
clocks = <&clk 0>;
clock-names = "cis_extclk";
reset-gpios = <&gpf1 3 1>;
xshutdown-gpios = <&gpf1 3 1>;
standby-gpios = <&gpm0 1 1>;
port {
s5c73m3_ep: endpoint {
Expand Down
5 changes: 3 additions & 2 deletions Documentation/devicetree/bindings/media/video-interfaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ properties:

pclk-sample:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1 ]
enum: [ 0, 1, 2 ]
description:
Sample data on rising (1) or falling (0) edge of the pixel clock signal.
Sample data on falling (0), rising (1) or both (2) edges of the pixel
clock signal.

sync-on-green-active:
$ref: /schemas/types.yaml#/definitions/uint32
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ config MEDIA_CONTROLLER
#

config DVB_CORE
tristate
tristate "DVB Core"
depends on MEDIA_DIGITAL_TV_SUPPORT
depends on (I2C || I2C=n)
default MEDIA_DIGITAL_TV_SUPPORT
Expand Down
9 changes: 3 additions & 6 deletions drivers/media/cec/platform/stm32/stm32-cec.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,9 @@ static int stm32_cec_probe(struct platform_device *pdev)
return ret;

cec->clk_cec = devm_clk_get(&pdev->dev, "cec");
if (IS_ERR(cec->clk_cec)) {
if (PTR_ERR(cec->clk_cec) != -EPROBE_DEFER)
dev_err(&pdev->dev, "Cannot get cec clock\n");

return PTR_ERR(cec->clk_cec);
}
if (IS_ERR(cec->clk_cec))
return dev_err_probe(&pdev->dev, PTR_ERR(cec->clk_cec),
"Cannot get cec clock\n");

ret = clk_prepare(cec->clk_cec);
if (ret) {
Expand Down
10 changes: 0 additions & 10 deletions drivers/media/i2c/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -751,16 +751,6 @@ config VIDEO_S5C73M3
This is a V4L2 sensor driver for Samsung S5C73M3
8 Mpixel camera.

config VIDEO_S5K4ECGX
tristate "Samsung S5K4ECGX sensor support"
depends on I2C && VIDEO_DEV
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select CRC32
help
This is a V4L2 sensor driver for Samsung S5K4ECGX 5M
camera sensor with an embedded SoC image signal processor.

config VIDEO_S5K5BAF
tristate "Samsung S5K5BAF sensor support"
depends on I2C && VIDEO_DEV
Expand Down
1 change: 0 additions & 1 deletion drivers/media/i2c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ obj-$(CONFIG_VIDEO_RDACM20) += rdacm20.o
obj-$(CONFIG_VIDEO_RDACM21) += rdacm21.o
obj-$(CONFIG_VIDEO_RJ54N1) += rj54n1cb0c.o
obj-$(CONFIG_VIDEO_S5C73M3) += s5c73m3/
obj-$(CONFIG_VIDEO_S5K4ECGX) += s5k4ecgx.o
obj-$(CONFIG_VIDEO_S5K5BAF) += s5k5baf.o
obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o
obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
Expand Down
18 changes: 6 additions & 12 deletions drivers/media/i2c/ad5820.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,21 +300,15 @@ static int ad5820_probe(struct i2c_client *client)
return -ENOMEM;

coil->vana = devm_regulator_get(&client->dev, "VANA");
if (IS_ERR(coil->vana)) {
ret = PTR_ERR(coil->vana);
if (ret != -EPROBE_DEFER)
dev_err(&client->dev, "could not get regulator for vana\n");
return ret;
}
if (IS_ERR(coil->vana))
return dev_err_probe(&client->dev, PTR_ERR(coil->vana),
"could not get regulator for vana\n");

coil->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable",
GPIOD_OUT_LOW);
if (IS_ERR(coil->enable_gpio)) {
ret = PTR_ERR(coil->enable_gpio);
if (ret != -EPROBE_DEFER)
dev_err(&client->dev, "could not get enable gpio\n");
return ret;
}
if (IS_ERR(coil->enable_gpio))
return dev_err_probe(&client->dev, PTR_ERR(coil->enable_gpio),
"could not get enable gpio\n");

mutex_init(&coil->power_lock);

Expand Down
5 changes: 2 additions & 3 deletions drivers/media/i2c/imx274.c
Original file line number Diff line number Diff line change
Expand Up @@ -2060,9 +2060,8 @@ static int imx274_probe(struct i2c_client *client)
imx274->reset_gpio = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(imx274->reset_gpio)) {
if (PTR_ERR(imx274->reset_gpio) != -EPROBE_DEFER)
dev_err(dev, "Reset GPIO not setup in DT");
ret = PTR_ERR(imx274->reset_gpio);
ret = dev_err_probe(dev, PTR_ERR(imx274->reset_gpio),
"Reset GPIO not setup in DT\n");
goto err_me;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/i2c/isl7998x.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ static int isl7998x_set_standard(struct isl7998x *isl7998x, v4l2_std_id norm)
static int isl7998x_init(struct isl7998x *isl7998x)
{
const unsigned int lanes = isl7998x->nr_mipi_lanes;
const u32 isl7998x_video_in_chan_map[] = { 0x00, 0x11, 0x02, 0x02 };
static const u32 isl7998x_video_in_chan_map[] = { 0x00, 0x11, 0x02, 0x02 };
const struct reg_sequence isl7998x_init_seq_custom[] = {
{ ISL7998X_REG_P0_VIDEO_IN_CHAN_CTL,
isl7998x_video_in_chan_map[isl7998x->nr_inputs - 1] },
Expand Down
107 changes: 20 additions & 87 deletions drivers/media/i2c/s5c73m3/s5c73m3-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/media.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/of_graph.h>
#include <linux/regulator/consumer.h>
#include <linux/sizes.h>
Expand Down Expand Up @@ -1347,24 +1346,6 @@ static int s5c73m3_oif_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
return 0;
}

static int s5c73m3_gpio_set_value(struct s5c73m3 *priv, int id, u32 val)
{
if (!gpio_is_valid(priv->gpio[id].gpio))
return 0;
gpio_set_value(priv->gpio[id].gpio, !!val);
return 1;
}

static int s5c73m3_gpio_assert(struct s5c73m3 *priv, int id)
{
return s5c73m3_gpio_set_value(priv, id, priv->gpio[id].level);
}

static int s5c73m3_gpio_deassert(struct s5c73m3 *priv, int id)
{
return s5c73m3_gpio_set_value(priv, id, !priv->gpio[id].level);
}

static int __s5c73m3_power_on(struct s5c73m3 *state)
{
int i, ret;
Expand All @@ -1386,10 +1367,9 @@ static int __s5c73m3_power_on(struct s5c73m3 *state)
v4l2_dbg(1, s5c73m3_dbg, &state->oif_sd, "clock frequency: %ld\n",
clk_get_rate(state->clock));

s5c73m3_gpio_deassert(state, STBY);
gpiod_set_value(state->stby, 0);
usleep_range(100, 200);

s5c73m3_gpio_deassert(state, RSET);
gpiod_set_value(state->reset, 0);
usleep_range(50, 100);

return 0;
Expand All @@ -1404,11 +1384,10 @@ static int __s5c73m3_power_off(struct s5c73m3 *state)
{
int i, ret;

if (s5c73m3_gpio_assert(state, RSET))
usleep_range(10, 50);

if (s5c73m3_gpio_assert(state, STBY))
usleep_range(100, 200);
gpiod_set_value(state->reset, 1);
usleep_range(10, 50);
gpiod_set_value(state->stby, 1);
usleep_range(100, 200);

clk_disable_unprepare(state->clock);

Expand Down Expand Up @@ -1543,58 +1522,10 @@ static const struct v4l2_subdev_ops oif_subdev_ops = {
.video = &s5c73m3_oif_video_ops,
};

static int s5c73m3_configure_gpios(struct s5c73m3 *state)
{
static const char * const gpio_names[] = {
"S5C73M3_STBY", "S5C73M3_RST"
};
struct i2c_client *c = state->i2c_client;
struct s5c73m3_gpio *g = state->gpio;
int ret, i;

for (i = 0; i < GPIO_NUM; ++i) {
unsigned int flags = GPIOF_DIR_OUT;
if (g[i].level)
flags |= GPIOF_INIT_HIGH;
ret = devm_gpio_request_one(&c->dev, g[i].gpio, flags,
gpio_names[i]);
if (ret) {
v4l2_err(c, "failed to request gpio %s\n",
gpio_names[i]);
return ret;
}
}
return 0;
}

static int s5c73m3_parse_gpios(struct s5c73m3 *state)
{
static const char * const prop_names[] = {
"standby-gpios", "xshutdown-gpios",
};
struct device *dev = &state->i2c_client->dev;
struct device_node *node = dev->of_node;
int ret, i;

for (i = 0; i < GPIO_NUM; ++i) {
enum of_gpio_flags of_flags;

ret = of_get_named_gpio_flags(node, prop_names[i],
0, &of_flags);
if (ret < 0) {
dev_err(dev, "failed to parse %s DT property\n",
prop_names[i]);
return -EINVAL;
}
state->gpio[i].gpio = ret;
state->gpio[i].level = !(of_flags & OF_GPIO_ACTIVE_LOW);
}
return 0;
}

static int s5c73m3_get_platform_data(struct s5c73m3 *state)
{
struct device *dev = &state->i2c_client->dev;
struct i2c_client *c = state->i2c_client;
struct device *dev = &c->dev;
const struct s5c73m3_platform_data *pdata = dev->platform_data;
struct device_node *node = dev->of_node;
struct device_node *node_ep;
Expand All @@ -1608,8 +1539,6 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
}

state->mclk_frequency = pdata->mclk_frequency;
state->gpio[STBY] = pdata->gpio_stby;
state->gpio[RSET] = pdata->gpio_reset;
return 0;
}

Expand All @@ -1624,9 +1553,17 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state)
state->mclk_frequency);
}

ret = s5c73m3_parse_gpios(state);
if (ret < 0)
return -EINVAL;
/* Request GPIO lines asserted */
state->stby = devm_gpiod_get(dev, "standby", GPIOD_OUT_HIGH);
if (IS_ERR(state->stby))
return dev_err_probe(dev, PTR_ERR(state->stby),
"failed to request gpio S5C73M3_STBY\n");
gpiod_set_consumer_name(state->stby, "S5C73M3_STBY");
state->reset = devm_gpiod_get(dev, "xshutdown", GPIOD_OUT_HIGH);
if (IS_ERR(state->reset))
return dev_err_probe(dev, PTR_ERR(state->reset),
"failed to request gpio S5C73M3_RST\n");
gpiod_set_consumer_name(state->reset, "S5C73M3_RST");

node_ep = of_graph_get_next_endpoint(node, NULL);
if (!node_ep) {
Expand Down Expand Up @@ -1708,10 +1645,6 @@ static int s5c73m3_probe(struct i2c_client *client)
if (ret < 0)
return ret;

ret = s5c73m3_configure_gpios(state);
if (ret)
goto out_err;

for (i = 0; i < S5C73M3_MAX_SUPPLIES; i++)
state->supplies[i].supply = s5c73m3_supply_names[i];

Expand Down
1 change: 0 additions & 1 deletion drivers/media/i2c/s5c73m3/s5c73m3-ctrls.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <linux/sizes.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/media.h>
Expand Down
10 changes: 3 additions & 7 deletions drivers/media/i2c/s5c73m3/s5c73m3.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/clk.h>
#include <linux/kernel.h>
#include <linux/regulator/consumer.h>
#include <linux/gpio/consumer.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-subdev.h>
Expand Down Expand Up @@ -351,12 +352,6 @@ struct s5c73m3_ctrls {
struct v4l2_ctrl *scene_mode;
};

enum s5c73m3_gpio_id {
STBY,
RSET,
GPIO_NUM,
};

enum s5c73m3_resolution_types {
RES_ISP,
RES_JPEG,
Expand All @@ -383,7 +378,8 @@ struct s5c73m3 {
u32 i2c_read_address;

struct regulator_bulk_data supplies[S5C73M3_MAX_SUPPLIES];
struct s5c73m3_gpio gpio[GPIO_NUM];
struct gpio_desc *stby;
struct gpio_desc *reset;

struct clk *clock;

Expand Down
Loading

0 comments on commit 3178804

Please sign in to comment.