From patchwork Mon Apr 15 12:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629856 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C094679E5 for ; Mon, 15 Apr 2024 12:02:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182562; cv=none; b=ng7Cz5sFt8YEaqUvL9332ErmO84WDLNLhsuHvaNXNfY3zAufkd6rJfWsMMP01669iYQjEOBaOVMrPghq8SqAmtJJ/BwZPpDIJNLHTERclTR865r6NIw9e5iZUKLeO+Fxl0UYNDpv390Ad4kvAAL9id88Oxt3uoZ7jGv4r5r71WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182562; c=relaxed/simple; bh=0k3ZMAtsbbMabIJN5YnU1EDQMyp2UrIwP0aCSXI6i1c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GTGQyz8LtaL9SeFELEYtDuJa4HRXbh7ZYLUn5RqttTLsjTlTZ/hjefYoOiWYvJzPSueKJ4c434POdf0of8THdRaGJ0m3qjnG4JwGcY+eEPZgJvvWnJcn/W8nI6pgsjGzp5etNFqZErvfCVQgozdyvEDSKI+ANpM5Gee7A0MstCA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iqUZ2tKQ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iqUZ2tKQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3OvhZXrdaj6kh6le8vlD4nY1MC+CIrAqAcC635JIIro=; b=iqUZ2tKQ96f7rOuykOuS6WqVlm1KRZz3aeMc98ERtOW3PMo2D8HumVZP1Qha7TExWGvTbF E170D5M22VLOoZzfaEJBwGKmuAn7Wt58zPIgm4tgSnt3cMrfQTHIbSehXhSoamqkkRsspc tRwBO5eDYDsAAWD9k0NpB9SsvaTGoCY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-IkbdprHGPtmLzYmcSQeyjA-1; Mon, 15 Apr 2024 08:02:36 -0400 X-MC-Unique: IkbdprHGPtmLzYmcSQeyjA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACA4A38143AE; Mon, 15 Apr 2024 12:02:35 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75F8AC01595; Mon, 15 Apr 2024 12:02:34 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 01/23] media: atomisp: Add atomisp_s_sensor_power() helper Date: Mon, 15 Apr 2024 14:01:58 +0200 Message-ID: <20240415120220.219480-2-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Since the atomisp driver only supports 1 stream / only has 1 asd now, there is no longer a need to track which stream owns the sensor. So the asd owner-pointer of struct atomisp_input_subdev can be dropped, replace this with a simple camera_on boolean and add a new atomisp_s_sensor_power() helper which takes care of avoiding unbalanced s_power() subdev calls as well as takes care of handling the special -ENOIOCTLCMD return for subdevs which don't implement s_power(). Signed-off-by: Hans de Goede --- .../staging/media/atomisp/pci/atomisp_cmd.c | 17 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_cmd.h | 3 +++ .../staging/media/atomisp/pci/atomisp_fops.c | 14 +------------ .../media/atomisp/pci/atomisp_internal.h | 6 +----- .../staging/media/atomisp/pci/atomisp_ioctl.c | 21 ++++--------------- 5 files changed, 26 insertions(+), 35 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 3a56cf68b688..6b8ff9f1ae63 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3722,6 +3722,23 @@ void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, *padding_h = max_t(u32, *padding_h, min_pad_h); } +int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool on) +{ + int ret; + + if (isp->inputs[input].camera_on == on) + return 0; + + ret = v4l2_subdev_call(isp->inputs[input].camera, core, s_power, on); + if (ret && ret != -ENOIOCTLCMD) { + dev_err(isp->dev, "Error setting sensor power %d: %d\n", on, ret); + return ret; + } + + isp->inputs[input].camera_on = on; + return 0; +} + static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp, struct v4l2_mbus_framefmt *ffmt, int which) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index b8cd957eebdc..2676236ee015 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -241,6 +241,9 @@ int atomisp_compare_grid(struct atomisp_sub_device *asd, void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, u32 *padding_w, u32 *padding_h); +/* Set sensor power (no-op if already on/off) */ +int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool on); + /* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret, diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 4dba6120af39..b464a6bd0bad 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -445,12 +445,8 @@ const struct vb2_ops atomisp_vb2_ops = { static void atomisp_dev_init_struct(struct atomisp_device *isp) { - unsigned int i; - isp->isp_fatal_error = false; - for (i = 0; i < isp->input_cnt; i++) - isp->inputs[i].asd = NULL; /* * For Merrifield, frequency is scalable. * After boot-up, the default frequency is 200MHz. @@ -584,15 +580,7 @@ static int atomisp_release(struct file *file) atomisp_css_free_stat_buffers(asd); atomisp_free_internal_buffers(asd); - if (isp->inputs[asd->input_curr].asd == asd) { - ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, - core, s_power, 0); - if (ret && ret != -ENOIOCTLCMD) - dev_warn(isp->dev, "Failed to power-off sensor\n"); - - /* clear the asd field to show this camera is not used */ - isp->inputs[asd->input_curr].asd = NULL; - } + atomisp_s_sensor_power(isp, asd->input_curr, 0); atomisp_destroy_pipes_stream(asd); diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index d6e86d013be9..02fffa7f65e1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -127,17 +127,13 @@ struct atomisp_input_subdev { u32 code; /* MEDIA_BUS_FMT_* */ bool binning_support; bool crop_support; + bool camera_on; struct v4l2_subdev *camera; /* Sensor rects for sensors which support crop */ struct v4l2_rect native_rect; struct v4l2_rect active_rect; /* Sensor state for which == V4L2_SUBDEV_FORMAT_TRY calls */ struct v4l2_subdev_state *try_sd_state; - /* - * To show this resource is used by - * which stream, in ISP multiple stream mode - */ - struct atomisp_sub_device *asd; }; enum atomisp_dfs_mode { diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index d602bda134f9..be1f3f2ee63e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -469,28 +469,15 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) } /* power off the current owned sensor, as it is not used this time */ - if (isp->inputs[asd->input_curr].asd == asd && - asd->input_curr != input) { - ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, - core, s_power, 0); - if (ret && ret != -ENOIOCTLCMD) - dev_warn(isp->dev, - "Failed to power-off sensor\n"); - /* clear the asd field to show this camera is not used */ - isp->inputs[asd->input_curr].asd = NULL; - } + if (input != isp->asd.input_curr) + atomisp_s_sensor_power(isp, isp->asd.input_curr, 0); /* powe on the new sensor */ - ret = v4l2_subdev_call(isp->inputs[input].camera, core, s_power, 1); - if (ret && ret != -ENOIOCTLCMD) { - dev_err(isp->dev, "Failed to power-on sensor\n"); + ret = atomisp_s_sensor_power(isp, input, 1); + if (ret) return ret; - } asd->input_curr = input; - /* mark this camera is used by the current stream */ - isp->inputs[input].asd = asd; - return 0; } From patchwork Mon Apr 15 12:01:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629857 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 494E062147 for ; Mon, 15 Apr 2024 12:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182564; cv=none; b=gFc6YYaGT59Kt0Y03AjYBnhwSkEN0qtj4B9H14jQCHGF55+w8jMCjdAArbUWsT/35ueO8fRqUPMLm6X87M2kd75LkmFr62dg9yfpoPlWIb/trdaEe/N339dXJQcyCLyJ4rAO907qMT5j+TXTK2J2MZ9bn2Ri3GWULLG3sNkF+lA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182564; c=relaxed/simple; bh=0ng/Uh2IiF1+biK7I3jkErPf2zT5My7sZKgxs9kxcCs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XVXQZzii04e9zc2YOK5QS6SU9Jts/qkJiD4O+7JJRVK9kEqw5SL/97P0bYDNIPI0pbwOBGDmI1jJCY2ZS+Vct83Vl9g6B3zBelXNvbSrAX9WzGZC6AQLo426QxrCBMKuiwMN57r1KqhkW+/nX0g1mwiXhRqMrVjJ+7B7egnjs64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XDKqRr4w; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XDKqRr4w" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cctytGkP8WgnsEbgahTDeIrEPS2Ieg4avjV+z+utBcY=; b=XDKqRr4wLu4BmNMdbf22H61Pro6Jj3Ykln0O/lv+VNzDQz54HKFLf8VHuQ9cn+jJ3hRMQw 40oaC4RjUJkXtGuhdgh1HE6WXfdx2Sq8n6555/QJpKc9IyalR8y/4YYDSVNw/ueXmQID7F KuYJ66ScM+C2/sV7IMuK6laubepjUXo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-OwGQZXbKPnOcxAmPNGF4zw-1; Mon, 15 Apr 2024 08:02:37 -0400 X-MC-Unique: OwGQZXbKPnOcxAmPNGF4zw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 205061049BC8; Mon, 15 Apr 2024 12:02:37 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE553C13FA2; Mon, 15 Apr 2024 12:02:35 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 02/23] media: atomisp: Turn on sensor power from atomisp_set_fmt() Date: Mon, 15 Apr 2024 14:01:59 +0200 Message-ID: <20240415120220.219480-3-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 ATM the atomisp driver does not call s_power() at all when no s_input ioctl() is done by the application. This breaks older sensor drivers which rely on s_power() for power-management. Some drivers have worked around this, e.g. commit c5fafbadaeae ("media: atomisp: gc0310: Power on sensor from set_fmt() callback") and commit b3118a942c82 ("media: atomisp: ov2722: Power on sensor from set_fmt() callback"), but this really should be fixed in the atomisp driver itself, so that all old drivers can work. A logical place to call s_power() would be from atomisp_start_streaming() / atomisp_stop_streaming(). But some older drivers, e.g. the atomisp-ov2722 driver already write mode related registers on set_fmt() instead of waiting on stream on. So the s_power(1) needs to happen at the first set_fmt(). Add an atomisp_s_sensor_power(..., 1) call just before calling set_fmt() for this. If the power was already enabled through e.g. a s_input ioctl atomisp_s_sensor_power() will skip calling the s_power() v4l2-subdev-op a second time. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 6b8ff9f1ae63..83a15a2d358e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3760,6 +3760,17 @@ static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp, if (!input->camera) return -EINVAL; + /* + * Some old sensor drivers already write the registers on set_fmt + * instead of on stream on, power on the sensor now (on newer + * sensor drivers the s_power op is a no-op). + */ + if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { + ret = atomisp_s_sensor_power(isp, isp->asd.input_curr, 1); + if (ret) + return ret; + } + sd_state = (which == V4L2_SUBDEV_FORMAT_TRY) ? input->try_sd_state : input->camera->active_state; if (sd_state) From patchwork Mon Apr 15 12:02:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629858 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C571A67A0E for ; Mon, 15 Apr 2024 12:02:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182565; cv=none; b=HKXq4Lv6VfggfaYlocvRg0CfZR1NQO+eoR59hQSMgjpWdq6HE2K9TPfiKmTilXfTl57DMjl18OqRem/4mXxBEh/hWg8uLR0zE8jR+MCUUoQrYFhfAPblaWG+j5zvLwLeh4hL3e6hhd8AZZUavtigrktsFzjnOHqJcP68jF7iQF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182565; c=relaxed/simple; bh=bn4C09QgbWnHKaxNqGOnx0SAwLHERIaTJJ8HSQp6oZM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y2iM2Wiiq12UtRKmgZy6lRo5dxgwsaGTdbhEh1QsXNM2rWkaoXXmhKGampsodbf3i4OgMZJhIA7D157iZ+aoy4nXPSbDS36s4z5pBraUMvxr/c1G2W1i+5r+2bYl/Yh3eWoAkI6jdWgwStmj4oLMazVexQ7UqChPICvvyOTANVQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NaoRV8uv; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NaoRV8uv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fHI36XDZDyeTaj+0SBGseJViDF1Wc/0ZCb60c8D7L5A=; b=NaoRV8uvHh7Kli0LEM2uWHBGgWOwVC3OGd8xaWMbqILJoW2I9b+JHRfUpWP/kNz9Vt2qP+ xKrUA5H8IHb8cTEQDFMvesOxWltStJ2dGw/3EbIIG+VoxY1ZQZeLeA1MVQft4SjdqdYglx xdkFHh2c5gbhOhd9oBoVTKocD3CaZzM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-KhA95-ruNmCjqxCbLRPb3w-1; Mon, 15 Apr 2024 08:02:39 -0400 X-MC-Unique: KhA95-ruNmCjqxCbLRPb3w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8AED7805918; Mon, 15 Apr 2024 12:02:38 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51FC4C13FA1; Mon, 15 Apr 2024 12:02:37 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 03/23] media: atomisp: Add atomisp_select_input() helper Date: Mon, 15 Apr 2024 14:02:00 +0200 Message-ID: <20240415120220.219480-4-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 When switching input/sensor the s_power() callback must be called for old sensor drivers to power on the new sensor and power off the previous sensor. atomisp_s_input() already does this but atomisp_link_setup() did not do this. Add a new atomisp_select_input() helper which does this and use this in both atomisp_s_input() and atomisp_link_setup() for consistent behavior. Also make atomisp_link_setup() turn the sensor back off when a link gets disabled. Signed-off-by: Hans de Goede --- .../staging/media/atomisp/pci/atomisp_cmd.c | 19 +++++++++++++++++++ .../staging/media/atomisp/pci/atomisp_cmd.h | 3 +++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 13 +------------ .../media/atomisp/pci/atomisp_subdev.c | 15 +++++++++------ 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 83a15a2d358e..6c93bab17955 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3739,6 +3739,25 @@ int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool return 0; } +int atomisp_select_input(struct atomisp_device *isp, unsigned int input) +{ + unsigned int input_orig = isp->asd.input_curr; + int ret; + + /* Power on new sensor */ + ret = atomisp_s_sensor_power(isp, input, 1); + if (ret) + return ret; + + isp->asd.input_curr = input; + + /* Power off previous sensor */ + if (input != input_orig) + atomisp_s_sensor_power(isp, input_orig, 0); + + return 0; +} + static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp, struct v4l2_mbus_framefmt *ffmt, int which) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index 2676236ee015..f302763b7b2f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -244,6 +244,9 @@ void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, /* Set sensor power (no-op if already on/off) */ int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool on); +/* Select which sensor to use, must be called with a valid input */ +int atomisp_select_input(struct atomisp_device *isp, unsigned int input); + /* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret, diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index be1f3f2ee63e..b3ad53449cb8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -449,7 +449,6 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) struct video_device *vdev = video_devdata(file); struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); - struct atomisp_sub_device *asd = pipe->asd; struct v4l2_subdev *camera = NULL; int ret; @@ -468,17 +467,7 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) return -EINVAL; } - /* power off the current owned sensor, as it is not used this time */ - if (input != isp->asd.input_curr) - atomisp_s_sensor_power(isp, isp->asd.input_curr, 0); - - /* powe on the new sensor */ - ret = atomisp_s_sensor_power(isp, input, 1); - if (ret) - return ret; - - asd->input_curr = input; - return 0; + return atomisp_select_input(isp, input); } /* diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index c36aae69d6f7..aabffd6a424d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -663,9 +663,6 @@ static int atomisp_link_setup(struct media_entity *entity, return -EINVAL; } - /* Ignore disables, input_curr should only be updated on enables */ - if (!(flags & MEDIA_LNK_FL_ENABLED)) - return 0; for (i = 0; i < isp->input_cnt; i++) { if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx]) @@ -679,11 +676,17 @@ static int atomisp_link_setup(struct media_entity *entity, mutex_lock(&isp->mutex); ret = atomisp_pipe_check(&asd->video_out, true); - if (ret == 0) - asd->input_curr = i; mutex_unlock(&isp->mutex); + if (ret) + return ret; - return ret; + /* Turn off the sensor on link disable */ + if (!(flags & MEDIA_LNK_FL_ENABLED)) { + atomisp_s_sensor_power(isp, i, 0); + return 0; + } + + return atomisp_select_input(isp, i); } static const struct media_entity_operations isp_subdev_media_ops = { From patchwork Mon Apr 15 12:02:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629859 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D4BC69DFD for ; Mon, 15 Apr 2024 12:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182566; cv=none; b=Fni1/BX58gjYRZMjGwUqx4QMc6etZlSb4SwhqtGplbSR0pLc9hkPp5rJCIgGECSAEio80xlmTxg5n4xg4ZqrhRK5HSsW5iB6VihadBXMhWrThNv/YOAVYBsHKloail6Pa50gsS3Y9WukJM9dRcYE4S0DL7Oki8M1lkhM1PR78Yg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182566; c=relaxed/simple; bh=IBjycQH/ah2J6zEhfDYnafJcHq1wuOsLvoN3Mm1nCcY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZZfYRIYqUJCXVac5hpqfQmidMW81DeE+tN/CORr3mN63l37gavbKky0K0K9r2GFoFlJ3I1kwnXbUKvLSPHQlC0u+sYt+MUfBYgmjzN7G/hghrLOGeGipd2jubZVZ6GRxL5OyyEDkf10h9gksfUcIZRHeWVLVeh/3rtW1HSSGTNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cvSolHNT; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cvSolHNT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BOItoHEXWBi06NOb9JNy1oZLgbJnOL7jxLkfa62azxc=; b=cvSolHNTOFhXYZsyGMSoNUz+nINMboArB0kkjk85ZmJ2Hb9ItKNOIMMU15QQGeMd8rU8eR nN8vhQowbIapbNzBnJ/YiULyDqmIox/9rWI3hnsBzvx2BOnbf711VQ2GCGTlMzJcYO8PPT zEb/aL/uA0jNKfF+FqD92IbIoOMkPmU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-609-NNeDycYkPWenH6Bs8heE3A-1; Mon, 15 Apr 2024 08:02:40 -0400 X-MC-Unique: NNeDycYkPWenH6Bs8heE3A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 014C91049BC7; Mon, 15 Apr 2024 12:02:40 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBE19C13FA2; Mon, 15 Apr 2024 12:02:38 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 04/23] media: atomisp: Simplify atomisp_s_input() input argument checking Date: Mon, 15 Apr 2024 14:02:01 +0200 Message-ID: <20240415120220.219480-5-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Simplify the checking of the input argument to atomisp_s_input(): - Remove the check for input >= ATOM_ISP_MAX_INPUTS, input_cnt never is > ATOM_ISP_MAX_INPUTS so checking only that is sufficient - Remove the unnecessary camera local variable - Move the 2 invalid argument checks to above the atomisp_pipe_check() which checks if the pipe is busy or not Signed-off-by: Hans de Goede --- .../staging/media/atomisp/pci/atomisp_ioctl.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index b3ad53449cb8..1f8d44900a82 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -449,24 +449,18 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) struct video_device *vdev = video_devdata(file); struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); - struct v4l2_subdev *camera = NULL; int ret; + if (input >= isp->input_cnt) + return -EINVAL; + + if (!isp->inputs[input].camera) + return -EINVAL; + ret = atomisp_pipe_check(pipe, true); if (ret) return ret; - if (input >= ATOM_ISP_MAX_INPUTS || input >= isp->input_cnt) { - dev_dbg(isp->dev, "input_cnt: %d\n", isp->input_cnt); - return -EINVAL; - } - - camera = isp->inputs[input].camera; - if (!camera) { - dev_err(isp->dev, "%s, no camera\n", __func__); - return -EINVAL; - } - return atomisp_select_input(isp, input); } From patchwork Mon Apr 15 12:02:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629860 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3C006BB48 for ; Mon, 15 Apr 2024 12:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182568; cv=none; b=uN9G+eWHoKgwzBJ57BVzSgE/IiO8WjtDso/6ZA8ELzQOxF6hCigmznyEQZgafYFOM7GY76/wZubVD3Xv8bTE6Nc7oIy7HGLmYb0TBmuh1FRcirugkJE17DzbLgvRB1uCbtXHIiwH6+7CGbWZtOql6d645UWB+PeGQs+QUREP3fk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182568; c=relaxed/simple; bh=x3kCVnAyw5tLJJjpuLblY+XLP3kYr3A6D8hRR+rN4yY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UxDv3C/nkCB1xnJ0XdzJfBRnbnklpCbk1dstarBT7BtCgIlZ88a3YyfSsrhevfChs0XuXRwLtIcJHw//tvMoeaM9LHBRiotO1cEBgLzYlE9rd8zOCuVCpCuteO6EXzxZiPCmDieA0LFqaIZHowwqmLCEM/tw+IrKAPtiJhssh4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=E6dr4SH7; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E6dr4SH7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8XYDpUrp+f4HmqzJpMM1JPG8lEyHLpq3QLCxRwUTsRw=; b=E6dr4SH7wqaSvt99c5DLUTbx3uqjutf4Ahdxb+lEML/xrap0wnLffokAU5Zj+XMfq5UW+S 6JirGqorx/y/77ML57XFyWMSl7q6tWNSNuoFr3WbA9MdNzSPRII1BB8U2p3g0rhStMOn6r FbJ/GmtcyNvJ5Ai+l4cRODtqN+j2gWo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-zPjW32AVOU2QKMVNSSNsDw-1; Mon, 15 Apr 2024 08:02:42 -0400 X-MC-Unique: zPjW32AVOU2QKMVNSSNsDw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A68A1049BC8; Mon, 15 Apr 2024 12:02:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32F6EC01594; Mon, 15 Apr 2024 12:02:40 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 05/23] media: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current sensor Date: Mon, 15 Apr 2024 14:02:02 +0200 Message-ID: <20240415120220.219480-6-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Add a new atomisp_setup_input_links() helper which ensures that the CSI-receiver -> ISP link for input_curr is marked as enabled and the other CSI-receiver -> ISP links are disabled. And call this helper from atomisp_register_device_nodes() for the initial setup and from atomisp_select_input() for runtime input_curr changes. Signed-off-by: Hans de Goede --- .../staging/media/atomisp/pci/atomisp_cmd.c | 34 +++++++++++++++++++ .../staging/media/atomisp/pci/atomisp_cmd.h | 3 ++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 6 +++- .../staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++ 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 6c93bab17955..b273234dc439 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3755,9 +3755,43 @@ int atomisp_select_input(struct atomisp_device *isp, unsigned int input) if (input != input_orig) atomisp_s_sensor_power(isp, input_orig, 0); + atomisp_setup_input_links(isp); return 0; } +/* + * Ensure the CSI-receiver -> ISP link for input_curr is marked as enabled and + * the other CSI-receiver -> ISP links are disabled. + */ +void atomisp_setup_input_links(struct atomisp_device *isp) +{ + struct media_link *link; + + lockdep_assert_held(&isp->media_dev.graph_mutex); + + for (int i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) { + link = media_entity_find_link( + &isp->csi2_port[i].subdev.entity.pads[CSI2_PAD_SOURCE], + &isp->asd.subdev.entity.pads[ATOMISP_SUBDEV_PAD_SINK]); + if (!link) { + dev_err(isp->dev, "Error cannot find CSI2-port[%d] -> ISP link\n", i); + continue; /* Should never happen */ + } + + /* + * Modify the flags directly, calling media_entity_setup_link() + * will end up calling atomisp_link_setup() which calls this + * function again leading to endless recursion. + */ + if (isp->sensor_subdevs[i] == isp->inputs[isp->asd.input_curr].camera) + link->flags |= MEDIA_LNK_FL_ENABLED; + else + link->flags &= ~MEDIA_LNK_FL_ENABLED; + + link->reverse->flags = link->flags; + } +} + static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp, struct v4l2_mbus_framefmt *ffmt, int which) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index f302763b7b2f..03703eed86fa 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -247,6 +247,9 @@ int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool /* Select which sensor to use, must be called with a valid input */ int atomisp_select_input(struct atomisp_device *isp, unsigned int input); +/* Setup media-controller links to reflect input_curr setting */ +void atomisp_setup_input_links(struct atomisp_device *isp); + /* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret, diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 1f8d44900a82..c16942051cfb 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -461,7 +461,11 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) if (ret) return ret; - return atomisp_select_input(isp, input); + mutex_lock(&isp->media_dev.graph_mutex); + ret = atomisp_select_input(isp, input); + mutex_unlock(&isp->media_dev.graph_mutex); + + return ret; } /* diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 1d7d38e2f904..1008a709b589 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1085,6 +1085,10 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) dev_warn(isp->dev, "too many atomisp inputs, TPG ignored.\n"); } + mutex_lock(&isp->media_dev.graph_mutex); + atomisp_setup_input_links(isp); + mutex_unlock(&isp->media_dev.graph_mutex); + isp->asd.video_out.vdev.v4l2_dev = &isp->v4l2_dev; isp->asd.video_out.vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; err = video_register_device(&isp->asd.video_out.vdev, VFL_TYPE_VIDEO, -1); From patchwork Mon Apr 15 12:02:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629862 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5024967C53 for ; Mon, 15 Apr 2024 12:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182571; cv=none; b=pdLKDhje0ibNi4XYHZ1fxkBAZDBuoBNZxyMc9f4fNPo1RyD/xqhc+BcRAJklquhfO+49I2iyjDL3dnbkwsysFpbjxIzxwjfh3jSfdi+XxlbP0zBe1OBp6XBdP7m3Olu3nPKN1TUsW0N1b4c+lGjnAwdgWvqABhcneyQ5A5kj34Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182571; c=relaxed/simple; bh=I/crcJGKiGCPrKWos2HMZnCxZmGYZxEmvwoI5y3ZeRE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VAdeG5pW8pv/Ak9kPE2LlMigvCRpBIsrHEAU/IcvcYU6pBWHl4mbE4+OE6+W4vo3mLysiTKgrvrqF8/bxeldpUICBInE63fmlyMrEIKxX6yZ51aCd3MOPBbwGzCvE6Q7VbN6fz5P0wyIaUwvUqfRLjFN1BZkA20Z7z7Vrei51Wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=bLTDNj5W; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bLTDNj5W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hHzcZyoOlxgXyDuEDBT5OdCwYlfJiRf4NMMCpBV++9c=; b=bLTDNj5WKIcjESn521t41nMEBGHGGnwq/TchvKzPBhmfPj2gO4BNWAWLCb4T66feyqJbaq smM1RTmzob0hMyNDcVxNCM7RkxOTh9VeBp2xYYWI/9SAYjosQxiVkZrV/N60+oZVzzVyp3 8PF0MqfCX2caKuKipoYR0fJMgt04gKw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-679-PgibmUJzNUuyYj6HEf46pg-1; Mon, 15 Apr 2024 08:02:43 -0400 X-MC-Unique: PgibmUJzNUuyYj6HEf46pg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D7EAE1C0C64B; Mon, 15 Apr 2024 12:02:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DCA3C13FA2; Mon, 15 Apr 2024 12:02:41 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 06/23] media: atomisp: Propagate set_fmt on sensor results to CSI port Date: Mon, 15 Apr 2024 14:02:03 +0200 Message-ID: <20240415120220.219480-7-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 So far the CSI port sink and source pads have not had their fmt set at all, leaving things at the default of SBGGR8_1X8/0x0. This means that pipeline validation such as e.g. done when calling media_pipeline_start() will fail since the links to / from the CSI ports have different fmts on each end. Store a pointer to the CSI port v4l2-subdev in struct atomisp_input_subdev, and use this in atomisp_set_sensor_crop_and_fmt() to propagate the sensors new fmt after a successful set_fmt to the CSI port it is connected too. The input->csi_port pointer also allows simplifying atomisp_link_setup(). Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 7 +++++++ .../media/atomisp/pci/atomisp_internal.h | 1 + .../staging/media/atomisp/pci/atomisp_subdev.c | 17 +++-------------- .../staging/media/atomisp/pci/atomisp_v4l2.c | 1 + 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index b273234dc439..ecd521043021 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3858,6 +3858,13 @@ static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp, if (sd_state) v4l2_subdev_unlock_state(sd_state); + /* Propagate new fmt to CSI port */ + if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { + ret = v4l2_subdev_call(input->csi_port, pad, set_fmt, NULL, &format); + if (ret) + return ret; + } + *ffmt = format.format; return ret; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index 02fffa7f65e1..c81a1c5f2864 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -129,6 +129,7 @@ struct atomisp_input_subdev { bool crop_support; bool camera_on; struct v4l2_subdev *camera; + struct v4l2_subdev *csi_port; /* Sensor rects for sensors which support crop */ struct v4l2_rect native_rect; struct v4l2_rect active_rect; diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index aabffd6a424d..53225958c23b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -644,7 +644,7 @@ static int atomisp_link_setup(struct media_entity *entity, entity); struct atomisp_sub_device *asd = v4l2_get_subdevdata(sd); struct atomisp_device *isp = asd->isp; - int i, csi_idx, ret; + int i, ret; /* ISP's source is immutable */ if (local != &asd->pads[ATOMISP_SUBDEV_PAD_SINK]) { @@ -653,24 +653,13 @@ static int atomisp_link_setup(struct media_entity *entity, return -EINVAL; } - for (csi_idx = 0; csi_idx < ATOMISP_CAMERA_NR_PORTS; csi_idx++) { - if (&isp->csi2_port[csi_idx].pads[CSI2_PAD_SOURCE] == remote) - break; - } - - if (csi_idx == ATOMISP_CAMERA_NR_PORTS) { - v4l2_err(sd, "Error cannot find CSI receiver for remote pad\n"); - return -EINVAL; - } - - for (i = 0; i < isp->input_cnt; i++) { - if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx]) + if (&isp->inputs[i].csi_port->entity.pads[CSI2_PAD_SOURCE] == remote) break; } if (i == isp->input_cnt) { - v4l2_err(sd, "Error no sensor for CSI receiver %d\n", csi_idx); + v4l2_err(sd, "Error no sensor for selected CSI receiver\n"); return -EINVAL; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 1008a709b589..809b9c4e7a92 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -1058,6 +1058,7 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) input->type = RAW_CAMERA; input->port = i; input->camera = isp->sensor_subdevs[i]; + input->csi_port = &isp->csi2_port[i].subdev; atomisp_init_sensor(input); From patchwork Mon Apr 15 12:02:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629861 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 640A36BB46 for ; Mon, 15 Apr 2024 12:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182570; cv=none; b=k+rOrYRzeBOsIjhT6f4e05Gd9mbH0oKeG7ytWFBNscIG2viucVUfbF0u2ZvBRXJ1QUOkmOU5pI/6u1DlkA63Kf9ThcQmgDqf8Rz9BCwikgMVeET3LCuGm0JXWdKvI7uce1iNEaKBTnyQDl3lecPoLEUupErBK240ASylvd7VAb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182570; c=relaxed/simple; bh=tUq7lwX0vF8fdvib6LhCKRkou0XV5TAkKQ8Jqf72BhE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LKW5GBByOGngp6ZsLg/A4kQb2198AvegkLdEhfici+19tGW7tg0Ldw54CPNeMUTzEe6zKY8hUfX3fRSubJy0byjMwM6SrRIK6eEa3h+vFcq+9ceiRuQuLDS+673ob0f80ENz80qsvO7EZs4egNKsDDQ9fLvx9wC04jQnezTuP0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JjVRUs9r; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JjVRUs9r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5hUwAdp8wxs1jFxxpeLQwctLRnJdVN0kFo2BYKYYTfc=; b=JjVRUs9rk8ADWK0iGK/PCwfurDnHVQfL1jTuN3hqFgy7GpB5KSt1WzuiE+k5vrbzcFiE3i FiR06EJxEYZlsioQiPfSiG4hIqEHOdsyd42pHX9Ax5laYaHw8pfgsTc9BWrBgC3Vt4S5QB jwcZbkwG9xbJnifrOP8UEryPAnCoSmk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-ssassCmsNCmIq7k3abJBmg-1; Mon, 15 Apr 2024 08:02:44 -0400 X-MC-Unique: ssassCmsNCmIq7k3abJBmg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B38238143A0; Mon, 15 Apr 2024 12:02:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14E2DC13FA3; Mon, 15 Apr 2024 12:02:42 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 07/23] media: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink pad Date: Mon, 15 Apr 2024 14:02:04 +0200 Message-ID: <20240415120220.219480-8-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Most sensor drivers report V4L2_FIELD_NONE as v4l2_mbus_framefmt.field value. Propagate this to the v4l2_mbus_framefmt for the CSI port to pass the link validation done by media_pipeline_start(). Keep the v4l2_mbus_framefmt.field for the source pad of the CSI port as V4L2_FIELD_ANY to match the ISP sink pad. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_csi2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index 89118438a3b6..e939a09a279b 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -107,9 +107,12 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, actual_ffmt->height = clamp_t(u32, ffmt->height, ATOM_ISP_MIN_HEIGHT, ATOM_ISP_MAX_HEIGHT); + actual_ffmt->field = ffmt->field; tmp_ffmt = *ffmt = *actual_ffmt; + /* Always use V4L2_FIELD_ANY to match the ISP sink pad */ + tmp_ffmt.field = V4L2_FIELD_ANY; return atomisp_csi2_set_ffmt(sd, sd_state, which, CSI2_PAD_SOURCE, &tmp_ffmt); From patchwork Mon Apr 15 12:02:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629865 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC9A16BFC5 for ; Mon, 15 Apr 2024 12:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182575; cv=none; b=DlTtXpCXI+b3HBRH6Enu1BNSLAvMz7jNHyCONvXJWi7nxcjLCMGmN+RG2UPTdojUnmdBLabJLRXM/J+O4u8mby6m/4O7uNNd6a90AAcAqXibfCYek98gi1ZlWb40dTgsAhrsdSk6QuJL4Q3XQKDeZIWjSt+XFHlF/LIWqTz1CTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182575; c=relaxed/simple; bh=/2KJ/TsMOZJB6hH86nftC0fSo3cHqvgpF5KdM3jdmtc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LqxyHd4SUM8+Z6fTpk+0Y9hcftHuhQACU2A7OTCJcY8EnJxXrukByRf7Z+BWjqEDpAjMAQGqq0PyCBvrxkAK+2SUs/A216q1kYDAHZnvo4aMbsKXuvIx/vWXwAmMl85sszB3eB5TbzOA3nGoLw/FtAAUP9qNXsJ47VsK/XycHYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=auaEFygo; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="auaEFygo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oHHrJR8HiRcRSBbFDuzyUMs/wZE2RbsTa3jSRIQeRbo=; b=auaEFygoRUU1G8YjopStAOQ5wUc0mvSaiBuVFjxYvfS7TQkppdK5vWCzusX//Egq8YtDGB SlWXMjxpO3+uPfDFpGyxKsr5aKJhFkmK8sAMHPN8D9pM6/B8x/WbvIDBtGDoOIe2FJrkRK Tv0pNOsP83ajlTT+azS3kl2KbcwLhIc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-490-vTy0ymoRMKuhzaK2IVM07A-1; Mon, 15 Apr 2024 08:02:47 -0400 X-MC-Unique: vTy0ymoRMKuhzaK2IVM07A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B3D1780171E; Mon, 15 Apr 2024 12:02:45 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CE7BC13FA1; Mon, 15 Apr 2024 12:02:44 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 08/23] media: atomisp: Call media_pipeline_alloc_start() in stream start Date: Mon, 15 Apr 2024 14:02:05 +0200 Message-ID: <20240415120220.219480-9-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Call media_pipeline_alloc_start() from atomisp_start_streaming() to mark all involved subdevs as busy so that the links cannot be changed through the media-controller APIs while streaming. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 15 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_subdev.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index c16942051cfb..8ef8cbc3b7a7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -902,6 +902,20 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count) if (ret) goto out_unlock; + /* + * When running a classic v4l2 app after a media-controller aware + * app, the CSI-receiver -> ISP link for the current sensor may be + * disabled. Fix this up before marking the pipeline as started. + */ + mutex_lock(&isp->media_dev.graph_mutex); + atomisp_setup_input_links(isp); + ret = __media_pipeline_start(&asd->video_out.vdev.entity.pads[0], &asd->video_out.pipe); + mutex_unlock(&isp->media_dev.graph_mutex); + if (ret) { + dev_err(isp->dev, "Error starting mc pipline: %d\n", ret); + goto out_unlock; + } + /* Input system HW workaround */ atomisp_dma_burst_len_cfg(asd); @@ -1054,6 +1068,7 @@ void atomisp_stop_streaming(struct vb2_queue *vq) if (ret) dev_warn(isp->dev, "Recreating streams failed: %d\n", ret); + media_pipeline_stop(&asd->video_out.vdev.entity.pads[0]); mutex_unlock(&isp->mutex); } diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h index 9c1703bf439c..bcfa829dbf61 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -49,6 +49,7 @@ struct atomisp_video_pipe { struct video_device vdev; enum v4l2_buf_type type; struct media_pad pad; + struct media_pipeline pipe; struct vb2_queue vb_queue; /* Lock for vb_queue, when also taking isp->mutex this must be taken first! */ struct mutex vb_queue_mutex; From patchwork Mon Apr 15 12:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629863 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB59D6BFB0 for ; Mon, 15 Apr 2024 12:02:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182573; cv=none; b=O1yuW+5Dq+4kB18GalNvk50ezbFTbDr/9NlHRwCeDeUlAQ0sjuMywmax91cA1WFcHKBAOHkKC0CDswIeB4kuTlbiS9gjJ9fuChHqD6ifDNNasaGA6wjAGTL54kqPuX03d6TXuCvdALEnvt1Hux/ujgdtbFOjGE4u2/QBSG3rbdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182573; c=relaxed/simple; bh=8abwr+b3L1AaVGNNdHGX2GedwzaDTMXGCg2UGiHzzKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OviPXeRc4YxDZuaeqyOoO7ijwaOQlfIvRc+Y+NqYex7T5NyFJfr4la+buYaDT2ZMoZftRtk3SQ2Hnr36S2cfo1VzM9W0fB2QFNFCJMubIk+eLKuzDnGuJei21lUtZfAzZdnUaQs+QmW762sS8ieR94Ep+tf8fovQzsrfYY3pgcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hyhaxuc/; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hyhaxuc/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yjnGO37/1HmO/T1PUaHWC4oTgJQkZ4oUbzDCgOMCbEE=; b=hyhaxuc/BlmpZA0ZM4Mi6vwQoLMyT1OxZNsPrVfV/JOz3esYlaOtN2WfWcD5gZTih3Ugfw GxpkxNydi69NEPvzNqogkWWP/M42L7CMmgXPmFlXUzzU+Vf5ou+3woIPp4QsccPHRTJzGG Ts80DXft8CGNqyXo6BPNuTxJY6ip3Bw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-656-yUjjsIzLNn-pcdUxDmFnJA-1; Mon, 15 Apr 2024 08:02:47 -0400 X-MC-Unique: yUjjsIzLNn-pcdUxDmFnJA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E2D928C97C7; Mon, 15 Apr 2024 12:02:47 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5FB6C13FA2; Mon, 15 Apr 2024 12:02:45 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 09/23] media: atomisp: Drop atomisp_pipe_check() from atomisp_link_setup() Date: Mon, 15 Apr 2024 14:02:06 +0200 Message-ID: <20240415120220.219480-10-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 The media-controller core (__media_entity_setup_link()) already checks that the pads of the link are not streaming before calling the setup_link() pad-op so calling atomisp_pipe_check() is not necessary; and taking isp->mutex inside the setup_link() pad-op leads to a possible ABBA deadlock vs the media-device graph_mutex which in the case of the setup_link() pad-op is taken before calling the op, while in other scenarios the graph_mutex is taken after the isp->mutex. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index 53225958c23b..1bb33460210c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -644,7 +644,7 @@ static int atomisp_link_setup(struct media_entity *entity, entity); struct atomisp_sub_device *asd = v4l2_get_subdevdata(sd); struct atomisp_device *isp = asd->isp; - int i, ret; + int i; /* ISP's source is immutable */ if (local != &asd->pads[ATOMISP_SUBDEV_PAD_SINK]) { @@ -663,12 +663,6 @@ static int atomisp_link_setup(struct media_entity *entity, return -EINVAL; } - mutex_lock(&isp->mutex); - ret = atomisp_pipe_check(&asd->video_out, true); - mutex_unlock(&isp->mutex); - if (ret) - return ret; - /* Turn off the sensor on link disable */ if (!(flags & MEDIA_LNK_FL_ENABLED)) { atomisp_s_sensor_power(isp, i, 0); From patchwork Mon Apr 15 12:02:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629864 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 728B06BB54 for ; Mon, 15 Apr 2024 12:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182574; cv=none; b=VxwdhcWVnxgfW0ms+uDRsj51hyRLvg06Hfo81rOw2JmWylGjKIv4dFpcW5k811qiGrYZMyh+yiDpuc8Z9sMfO4dH2oP9dIUsw7/jn2lultOEIRCHutlFbvo5HCm7Qbajp6KZO6UUtluVKczo+cuI1Uew+mTsRscVXs6I4/4u+tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182574; c=relaxed/simple; bh=TyvtyYWLVLteFRLJofQYoGhX4EBIYlVcQvdNAJOt1U8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d7mOt/gBXaxQ3as0p17sG5sFAUeyeyDl35dlD2dm6sTDCaCOtYZNJ2Q8Hfb2j2GmSQCOgJaa0p9i8buPNQZwQKKHsd1w5uzJPDLTSB89/scCBRv+ANphyLwX8v108apO4JCvLetDb1K7sxhrNC6ZH3WbX5Y2zzJA33SX865Hgaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=R+t7oSkL; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R+t7oSkL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oY80KwTzoqhoG9HboYfuMAuXhGbSeDqny1msoJyxThg=; b=R+t7oSkLO/IAHStuHERZlkioOEceZeOQ9X7XixKwtqZ4QaP7uMmbNW/p2KLHOzvfHflmR+ Bc0bWFFBaol4ZqmxBNeEaXwi/cvFGfbSXLe3sMH5QCRgK8c15H3npGeXxGqTtbbTPeYKAc pcA19LcJ4IGC6ICBTrYnmivh+dT5ngk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-331-_6SAe04KNyuULr8ktd3SHQ-1; Mon, 15 Apr 2024 08:02:49 -0400 X-MC-Unique: _6SAe04KNyuULr8ktd3SHQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9877B802A6F; Mon, 15 Apr 2024 12:02:48 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 601F5C01594; Mon, 15 Apr 2024 12:02:47 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 10/23] media: atomisp: ov2722: Remove power on sensor from set_fmt() callback Date: Mon, 15 Apr 2024 14:02:07 +0200 Message-ID: <20240415120220.219480-11-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 The atomisp driver now properly ensures s_power(1) is called before calling the set_fmt() callback, so this workaround is no longer necessary. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 12 ------------ drivers/staging/media/atomisp/i2c/ov2722.h | 1 - 2 files changed, 13 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index 133e346ae51b..d60630ea16df 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -528,9 +528,6 @@ static int power_up(struct v4l2_subdev *sd) return -ENODEV; } - if (dev->power_on == 1) - return 0; /* Already on */ - /* power control */ ret = power_ctrl(sd, 1); if (ret) @@ -555,7 +552,6 @@ static int power_up(struct v4l2_subdev *sd) /* according to DS, 20ms is needed between PWDN and i2c access */ msleep(20); - dev->power_on = 1; return 0; fail_clk: @@ -579,9 +575,6 @@ static int power_down(struct v4l2_subdev *sd) return -ENODEV; } - if (dev->power_on == 0) - return 0; /* Already off */ - ret = dev->platform_data->flisclk_ctrl(sd, 0); if (ret) dev_err(&client->dev, "flisclk failed\n"); @@ -599,7 +592,6 @@ static int power_down(struct v4l2_subdev *sd) if (ret) dev_err(&client->dev, "vprog failed.\n"); - dev->power_on = 0; return ret; } @@ -677,9 +669,6 @@ static int ov2722_set_fmt(struct v4l2_subdev *sd, mutex_lock(&dev->input_lock); - /* s_power has not been called yet for std v4l2 clients (camorama) */ - power_up(sd); - dev->pixels_per_line = dev->res->pixels_per_line; dev->lines_per_frame = dev->res->lines_per_frame; @@ -978,7 +967,6 @@ static int ov2722_probe(struct i2c_client *client) return -ENOMEM; mutex_init(&dev->input_lock); - dev->power_on = -1; dev->res = &ov2722_res_preview[0]; v4l2_i2c_subdev_init(&dev->sd, client, &ov2722_ops); diff --git a/drivers/staging/media/atomisp/i2c/ov2722.h b/drivers/staging/media/atomisp/i2c/ov2722.h index 640d3ffcaa5c..5920a4d45d06 100644 --- a/drivers/staging/media/atomisp/i2c/ov2722.h +++ b/drivers/staging/media/atomisp/i2c/ov2722.h @@ -198,7 +198,6 @@ struct ov2722_device { struct ov2722_resolution *res; struct camera_sensor_platform_data *platform_data; - int power_on; u16 pixels_per_line; u16 lines_per_frame; u8 type; From patchwork Mon Apr 15 12:02:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629867 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE57A6BFCF for ; Mon, 15 Apr 2024 12:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182579; cv=none; b=GBL/yIaaW1HeppwVtHXB01uYmYOl7+ZNpUdB0RoSf8ILDvmUuPNvcOBX05HTAS5xf19kjyUNzULrWpfDsW8ILOAc9Q7Yld3bmK8uW+MEXIxkqTIO/BAuCwaTaNFUZhQ5kwleRha3QNksP5xMzkLryOp5NflZ29RFcT2my1KJJI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182579; c=relaxed/simple; bh=ZmjCRhY0WWeoN4gXyHQRVvraqfld4aAO0Eqn20tvJ+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EYScHPxVAhdQuX+m5SbnvE6lHanyrGvY90jGPmtDIlKeN5yM6FiwdYE8QEIbL+fyc4h3jW7oKkOxKwhD6vDXx1L0eEbKeHno+44ldx7je5FtSmcgYYDVCTZcCCkMGOPLcqDiM/GiVJvC55nMc84+OhUXt36bRemz/C2KqdXV/Gs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hhPA9a7P; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hhPA9a7P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0lgRDzoUyaZiE+36QlQkX2xaH6dDkt4MbFBOVs7lYKI=; b=hhPA9a7PftU9D4phTT5SZMpHWrLOi1iEVlyPi2rPwsbpKbssH8TVb8/iA/vCxwyNulZyEt 4aU+rrhfjb5ZTTnKLo4Y38q57N5rm2M3zffulvHCLGoL0DOL0HtRMOgmg/b2PISBMbaxg5 zPZNyCvSYmFP3o/FRpnugs+v3CphUfU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-6QbQ-ZbuNJmXw_tDon2UJw-1; Mon, 15 Apr 2024 08:02:50 -0400 X-MC-Unique: 6QbQ-ZbuNJmXw_tDon2UJw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 294431049BC7; Mon, 15 Apr 2024 12:02:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA438C01595; Mon, 15 Apr 2024 12:02:48 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support Date: Mon, 15 Apr 2024 14:02:08 +0200 Message-ID: <20240415120220.219480-12-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 The TPG support registers a v4l2-subdev for this, but this is not part of the media-controller graph in any way. After manually selecting the TPG as input using the s_input ioctl it does not work. Several supported sensors have their own working TPG and using the sensor's TPG means that the same data-flow is used as with actual sensors rather then the quite different data-flow from the ISP's builtin TPG. Remove the broken TPG support, when a test-pattern is needed for testing a sensor's TPG can be used. Using a sensor's TPG is actually better for testing since then the actual normal data-flow is being tested. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/Makefile | 1 - .../atomisp/include/linux/atomisp_platform.h | 1 - .../staging/media/atomisp/pci/atomisp_cmd.c | 36 ++-- .../media/atomisp/pci/atomisp_compat_css20.c | 31 +--- .../media/atomisp/pci/atomisp_internal.h | 2 - .../staging/media/atomisp/pci/atomisp_tpg.c | 164 ------------------ .../staging/media/atomisp/pci/atomisp_tpg.h | 39 ----- .../staging/media/atomisp/pci/atomisp_v4l2.c | 27 --- .../hive_isp_css_common/host/input_system.c | 38 ---- drivers/staging/media/atomisp/pci/ia_css.h | 1 - .../media/atomisp/pci/ia_css_stream_public.h | 3 - .../staging/media/atomisp/pci/ia_css_tpg.h | 79 --------- .../atomisp/pci/isp2400_input_system_global.h | 1 - .../atomisp/pci/isp2400_input_system_public.h | 15 -- .../atomisp/pci/isp2401_input_system_global.h | 1 - .../pci/runtime/debug/src/ia_css_debug.c | 17 -- .../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 11 -- .../pci/runtime/isys/src/virtual_isys.c | 28 +-- drivers/staging/media/atomisp/pci/sh_css.c | 88 +--------- .../media/atomisp/pci/sh_css_internal.h | 1 - drivers/staging/media/atomisp/pci/sh_css_sp.c | 14 -- drivers/staging/media/atomisp/pci/sh_css_sp.h | 7 - 22 files changed, 20 insertions(+), 585 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_tpg.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_tpg.h delete mode 100644 drivers/staging/media/atomisp/pci/ia_css_tpg.h diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile index fcd3e51ae9ce..43116c74781d 100644 --- a/drivers/staging/media/atomisp/Makefile +++ b/drivers/staging/media/atomisp/Makefile @@ -21,7 +21,6 @@ atomisp-objs += \ pci/atomisp_fops.o \ pci/atomisp_ioctl.o \ pci/atomisp_subdev.o \ - pci/atomisp_tpg.o \ pci/atomisp_v4l2.o \ pci/sh_css_firmware.o \ pci/sh_css_host_data.o \ diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index 2535402afd73..63dd7236e3a8 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -112,7 +112,6 @@ enum atomisp_input_format { enum intel_v4l2_subdev_type { RAW_CAMERA = 1, LED_FLASH = 2, - TEST_PATTERN = 3, }; struct intel_v4l2_subdev_id { diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index ecd521043021..4505261a563f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -4143,28 +4143,26 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, if (!format) return -EINVAL; - if (input->type != TEST_PATTERN) { - mipi_info = atomisp_to_sensor_mipi_info(input->camera); + mipi_info = atomisp_to_sensor_mipi_info(input->camera); - if (atomisp_set_sensor_mipi_to_isp(asd, ATOMISP_INPUT_STREAM_GENERAL, - mipi_info)) - return -EINVAL; + if (atomisp_set_sensor_mipi_to_isp(asd, ATOMISP_INPUT_STREAM_GENERAL, + mipi_info)) + return -EINVAL; - if (mipi_info) - fc = atomisp_find_in_fmt_conv_by_atomisp_in_fmt(mipi_info->input_format); + if (mipi_info) + fc = atomisp_find_in_fmt_conv_by_atomisp_in_fmt(mipi_info->input_format); - if (!fc) - fc = atomisp_find_in_fmt_conv( - atomisp_subdev_get_ffmt(&asd->subdev, - NULL, V4L2_SUBDEV_FORMAT_ACTIVE, - ATOMISP_SUBDEV_PAD_SINK)->code); - if (!fc) - return -EINVAL; - if (format->sh_fmt == IA_CSS_FRAME_FORMAT_RAW && - raw_output_format_match_input(fc->atomisp_in_fmt, - pix->pixelformat)) - return -EINVAL; - } + if (!fc) + fc = atomisp_find_in_fmt_conv( + atomisp_subdev_get_ffmt(&asd->subdev, + NULL, V4L2_SUBDEV_FORMAT_ACTIVE, + ATOMISP_SUBDEV_PAD_SINK)->code); + if (!fc) + return -EINVAL; + if (format->sh_fmt == IA_CSS_FRAME_FORMAT_RAW && + raw_output_format_match_input(fc->atomisp_in_fmt, + pix->pixelformat)) + return -EINVAL; /* * Configure viewfinder also when vfpp is disabled: the diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index 6fe8b0b7467a..a62a5c0b3c00 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -302,21 +302,6 @@ static void __dump_stream_config(struct atomisp_sub_device *asd, "stream_config.source.port.compression.uncompressed_bits_per_pixel=%d.\n", s_config->source.port.compression. uncompressed_bits_per_pixel); - } else if (s_config->mode == IA_CSS_INPUT_MODE_TPG) { - dev_dbg(isp->dev, "stream_config.source.tpg.id=%d.\n", - s_config->source.tpg.id); - dev_dbg(isp->dev, "stream_config.source.tpg.mode=%d.\n", - s_config->source.tpg.mode); - dev_dbg(isp->dev, "stream_config.source.tpg.x_mask=%d.\n", - s_config->source.tpg.x_mask); - dev_dbg(isp->dev, "stream_config.source.tpg.x_delta=%d.\n", - s_config->source.tpg.x_delta); - dev_dbg(isp->dev, "stream_config.source.tpg.y_mask=%d.\n", - s_config->source.tpg.y_mask); - dev_dbg(isp->dev, "stream_config.source.tpg.y_delta=%d.\n", - s_config->source.tpg.y_delta); - dev_dbg(isp->dev, "stream_config.source.tpg.xy_mask=%d.\n", - s_config->source.tpg.xy_mask); } else if (s_config->mode == IA_CSS_INPUT_MODE_PRBS) { dev_dbg(isp->dev, "stream_config.source.prbs.id=%d.\n", s_config->source.prbs.id); @@ -1672,26 +1657,12 @@ void atomisp_css_capture_set_mode(struct atomisp_sub_device *asd, void atomisp_css_input_set_mode(struct atomisp_sub_device *asd, enum ia_css_input_mode mode) { - int i; - struct atomisp_device *isp = asd->isp; unsigned int size_mem_words; + int i; for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) asd->stream_env[i].stream_config.mode = mode; - if (isp->inputs[asd->input_curr].type == TEST_PATTERN) { - struct ia_css_stream_config *s_config = - &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream_config; - s_config->mode = IA_CSS_INPUT_MODE_TPG; - s_config->source.tpg.mode = IA_CSS_TPG_MODE_CHECKERBOARD; - s_config->source.tpg.x_mask = (1 << 4) - 1; - s_config->source.tpg.x_delta = -2; - s_config->source.tpg.y_mask = (1 << 4) - 1; - s_config->source.tpg.y_delta = 3; - s_config->source.tpg.xy_mask = (1 << 8) - 1; - return; - } - if (mode != IA_CSS_INPUT_MODE_BUFFERED_SENSOR) return; diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index c81a1c5f2864..54ab872b91ee 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -36,7 +36,6 @@ #include "atomisp_csi2.h" #include "atomisp_subdev.h" -#include "atomisp_tpg.h" #include "atomisp_compat.h" #include "gp_device.h" @@ -188,7 +187,6 @@ struct atomisp_device { bool pm_only; struct atomisp_mipi_csi2_device csi2_port[ATOMISP_CAMERA_NR_PORTS]; - struct atomisp_tpg_device tpg; /* Purpose of mutex is to protect and serialize use of isp data * structures and css API calls. */ diff --git a/drivers/staging/media/atomisp/pci/atomisp_tpg.c b/drivers/staging/media/atomisp/pci/atomisp_tpg.c deleted file mode 100644 index 92e61ee90993..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp_tpg.c +++ /dev/null @@ -1,164 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Support for Medifield PNW Camera Imaging ISP subsystem. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - */ - -#include -#include -#include "atomisp_internal.h" -#include "atomisp_tpg.h" - -static int tpg_s_stream(struct v4l2_subdev *sd, int enable) -{ - return 0; -} - -static int tpg_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - /*to fake*/ - return 0; -} - -static int tpg_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct v4l2_mbus_framefmt *fmt = &format->format; - - if (format->pad) - return -EINVAL; - /* only raw8 grbg is supported by TPG */ - fmt->code = MEDIA_BUS_FMT_SGRBG8_1X8; - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { - *v4l2_subdev_state_get_format(sd_state, 0) = *fmt; - return 0; - } - return 0; -} - -static int tpg_log_status(struct v4l2_subdev *sd) -{ - /*to fake*/ - return 0; -} - -static int tpg_s_power(struct v4l2_subdev *sd, int on) -{ - return 0; -} - -static int tpg_enum_mbus_code(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_mbus_code_enum *code) -{ - /*to fake*/ - return 0; -} - -static int tpg_enum_frame_size(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_frame_size_enum *fse) -{ - /*to fake*/ - return 0; -} - -static int tpg_enum_frame_ival(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_frame_interval_enum *fie) -{ - /*to fake*/ - return 0; -} - -static const struct v4l2_subdev_video_ops tpg_video_ops = { - .s_stream = tpg_s_stream, -}; - -static const struct v4l2_subdev_core_ops tpg_core_ops = { - .log_status = tpg_log_status, - .s_power = tpg_s_power, -}; - -static const struct v4l2_subdev_pad_ops tpg_pad_ops = { - .enum_mbus_code = tpg_enum_mbus_code, - .enum_frame_size = tpg_enum_frame_size, - .enum_frame_interval = tpg_enum_frame_ival, - .get_fmt = tpg_get_fmt, - .set_fmt = tpg_set_fmt, -}; - -static const struct v4l2_subdev_ops tpg_ops = { - .core = &tpg_core_ops, - .video = &tpg_video_ops, - .pad = &tpg_pad_ops, -}; - -void atomisp_tpg_unregister_entities(struct atomisp_tpg_device *tpg) -{ - media_entity_cleanup(&tpg->sd.entity); - v4l2_device_unregister_subdev(&tpg->sd); -} - -int atomisp_tpg_register_entities(struct atomisp_tpg_device *tpg, - struct v4l2_device *vdev) -{ - int ret; - /* Register the subdev and video nodes. */ - ret = v4l2_device_register_subdev(vdev, &tpg->sd); - if (ret < 0) - goto error; - - return 0; - -error: - atomisp_tpg_unregister_entities(tpg); - return ret; -} - -void atomisp_tpg_cleanup(struct atomisp_device *isp) -{ -} - -int atomisp_tpg_init(struct atomisp_device *isp) -{ - struct atomisp_tpg_device *tpg = &isp->tpg; - struct v4l2_subdev *sd = &tpg->sd; - struct media_pad *pads = tpg->pads; - struct media_entity *me = &sd->entity; - int ret; - - tpg->isp = isp; - v4l2_subdev_init(sd, &tpg_ops); - sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - strscpy(sd->name, "tpg_subdev", sizeof(sd->name)); - v4l2_set_subdevdata(sd, tpg); - - pads[0].flags = MEDIA_PAD_FL_SINK; - me->function = MEDIA_ENT_F_PROC_VIDEO_ISP; - - ret = media_entity_pads_init(me, 1, pads); - if (ret < 0) - goto fail; - return 0; -fail: - atomisp_tpg_cleanup(isp); - return ret; -} diff --git a/drivers/staging/media/atomisp/pci/atomisp_tpg.h b/drivers/staging/media/atomisp/pci/atomisp_tpg.h deleted file mode 100644 index 4176e076f63d..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp_tpg.h +++ /dev/null @@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Medifield PNW Camera Imaging ISP subsystem. - * - * Copyright (c) 2010 Intel Corporation. All Rights Reserved. - * - * Copyright (c) 2010 Silicon Hive www.siliconhive.com. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - */ - -#ifndef __ATOMISP_TPG_H__ -#define __ATOMISP_TPG_H__ - -#include -#include - -struct atomisp_tpg_device { - struct v4l2_subdev sd; - struct atomisp_device *isp; - struct media_pad pads[1]; -}; - -void atomisp_tpg_cleanup(struct atomisp_device *isp); -int atomisp_tpg_init(struct atomisp_device *isp); -void atomisp_tpg_unregister_entities(struct atomisp_tpg_device *tpg); -int atomisp_tpg_register_entities(struct atomisp_tpg_device *tpg, - struct v4l2_device *vdev); - -#endif /* __ATOMISP_TPG_H__ */ diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 809b9c4e7a92..0069b547754d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -847,7 +847,6 @@ static void atomisp_unregister_entities(struct atomisp_device *isp) struct v4l2_subdev *sd, *next; atomisp_subdev_unregister_entities(&isp->asd); - atomisp_tpg_unregister_entities(&isp->tpg); for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) atomisp_mipi_csi2_unregister_entities(&isp->csi2_port[i]); @@ -902,12 +901,6 @@ static int atomisp_register_entities(struct atomisp_device *isp) goto csi_and_subdev_probe_failed; } - ret = atomisp_tpg_register_entities(&isp->tpg, &isp->v4l2_dev); - if (ret < 0) { - dev_err(isp->dev, "atomisp_tpg_register_entities\n"); - goto tpg_register_failed; - } - ret = atomisp_subdev_register_subdev(&isp->asd, &isp->v4l2_dev); if (ret < 0) { dev_err(isp->dev, "atomisp_subdev_register_subdev fail\n"); @@ -917,8 +910,6 @@ static int atomisp_register_entities(struct atomisp_device *isp) return 0; subdev_register_failed: - atomisp_tpg_unregister_entities(&isp->tpg); -tpg_register_failed: for (i = 0; i < ATOMISP_CAMERA_NR_PORTS; i++) atomisp_mipi_csi2_unregister_entities(&isp->csi2_port[i]); csi_and_subdev_probe_failed: @@ -1077,15 +1068,6 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) else dev_info(isp->dev, "detected %d camera sensors\n", isp->input_cnt); - if (isp->input_cnt < ATOM_ISP_MAX_INPUTS) { - dev_dbg(isp->dev, "TPG detected, camera_cnt: %d\n", isp->input_cnt); - isp->inputs[isp->input_cnt].type = TEST_PATTERN; - isp->inputs[isp->input_cnt].port = -1; - isp->inputs[isp->input_cnt++].camera = &isp->tpg.sd; - } else { - dev_warn(isp->dev, "too many atomisp inputs, TPG ignored.\n"); - } - mutex_lock(&isp->media_dev.graph_mutex); atomisp_setup_input_links(isp); mutex_unlock(&isp->media_dev.graph_mutex); @@ -1119,12 +1101,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp) goto error_mipi_csi2; } - ret = atomisp_tpg_init(isp); - if (ret < 0) { - dev_err(isp->dev, "tpg initialization failed\n"); - goto error_tpg; - } - ret = atomisp_subdev_init(isp); if (ret < 0) { dev_err(isp->dev, "ISP subdev initialization failed\n"); @@ -1134,8 +1110,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp) return 0; error_isp_subdev: -error_tpg: - atomisp_tpg_cleanup(isp); error_mipi_csi2: atomisp_mipi_csi2_cleanup(isp); return ret; @@ -1143,7 +1117,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp) static void atomisp_uninitialize_modules(struct atomisp_device *isp) { - atomisp_tpg_cleanup(isp); atomisp_mipi_csi2_cleanup(isp); } diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c index ca1ce6689034..8f2f4e8eddd9 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c @@ -426,7 +426,6 @@ static input_system_err_t input_system_configure_channel( case INPUT_SYSTEM_SOURCE_SENSOR: error = input_system_configure_channel_sensor(channel); break; - case INPUT_SYSTEM_SOURCE_TPG: case INPUT_SYSTEM_SOURCE_PRBS: case INPUT_SYSTEM_SOURCE_FIFO: default: @@ -814,7 +813,6 @@ static input_system_err_t configuration_to_registers(void) //... break; - case INPUT_SYSTEM_SOURCE_TPG: case INPUT_SYSTEM_SOURCE_PRBS: case INPUT_SYSTEM_SOURCE_FIFO: break; @@ -1065,42 +1063,6 @@ input_system_err_t input_system_prbs_channel_cfg( return input_system_configure_channel(channel); } -input_system_err_t input_system_tpg_channel_cfg( - u32 ch_id, - u32 nof_frames,//not used yet - u32 x_mask, - u32 y_mask, - u32 x_delta, - u32 y_delta, - u32 xy_mask, - u32 sync_gen_width, - u32 sync_gen_height, - u32 sync_gen_hblank_cycles, - u32 sync_gen_vblank_cycles, - target_cfg2400_t target -) -{ - channel_cfg_t channel; - - (void)nof_frames; - - channel.ch_id = ch_id; - channel.source_type = INPUT_SYSTEM_SOURCE_TPG; - - channel.source_cfg.tpg_cfg.x_mask = x_mask; - channel.source_cfg.tpg_cfg.y_mask = y_mask; - channel.source_cfg.tpg_cfg.x_delta = x_delta; - channel.source_cfg.tpg_cfg.y_delta = y_delta; - channel.source_cfg.tpg_cfg.xy_mask = xy_mask; - channel.source_cfg.tpg_cfg.sync_gen_cfg.width = sync_gen_width; - channel.source_cfg.tpg_cfg.sync_gen_cfg.height = sync_gen_height; - channel.source_cfg.tpg_cfg.sync_gen_cfg.hblank_cycles = sync_gen_hblank_cycles; - channel.source_cfg.tpg_cfg.sync_gen_cfg.vblank_cycles = sync_gen_vblank_cycles; - - channel.target_cfg = target; - return input_system_configure_channel(channel); -} - // MW: Don't use system specific names, (even in system specific files) "cfg2400" -> cfg input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, diff --git a/drivers/staging/media/atomisp/pci/ia_css.h b/drivers/staging/media/atomisp/pci/ia_css.h index d83e1ae5b0b3..421056287853 100644 --- a/drivers/staging/media/atomisp/pci/ia_css.h +++ b/drivers/staging/media/atomisp/pci/ia_css.h @@ -42,7 +42,6 @@ #include "ia_css_properties.h" #include "ia_css_stream_format.h" #include "ia_css_stream_public.h" -#include "ia_css_tpg.h" #include "ia_css_version.h" #include "ia_css_mmu.h" #include "ia_css_morph.h" diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream_public.h b/drivers/staging/media/atomisp/pci/ia_css_stream_public.h index 47846ece8d64..888f54d8495e 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_stream_public.h +++ b/drivers/staging/media/atomisp/pci/ia_css_stream_public.h @@ -24,7 +24,6 @@ #include "ia_css_types.h" #include "ia_css_pipe_public.h" #include "ia_css_metadata.h" -#include "ia_css_tpg.h" #include "ia_css_prbs.h" #include "ia_css_input_port.h" @@ -34,7 +33,6 @@ enum ia_css_input_mode { IA_CSS_INPUT_MODE_SENSOR, /** data from sensor */ IA_CSS_INPUT_MODE_FIFO, /** data from input-fifo */ - IA_CSS_INPUT_MODE_TPG, /** data from test-pattern generator */ IA_CSS_INPUT_MODE_PRBS, /** data from pseudo-random bit stream */ IA_CSS_INPUT_MODE_MEMORY, /** data from a frame in memory */ IA_CSS_INPUT_MODE_BUFFERED_SENSOR /** data is sent through mipi buffer */ @@ -91,7 +89,6 @@ struct ia_css_stream_config { enum ia_css_input_mode mode; /** Input mode */ union { struct ia_css_input_port port; /** Port, for sensor only. */ - struct ia_css_tpg_config tpg; /** TPG configuration */ struct ia_css_prbs_config prbs; /** PRBS configuration */ } source; /** Source of input data */ unsigned int channel_id; /** Channel on which input data diff --git a/drivers/staging/media/atomisp/pci/ia_css_tpg.h b/drivers/staging/media/atomisp/pci/ia_css_tpg.h deleted file mode 100644 index 8c744bedb0a6..000000000000 --- a/drivers/staging/media/atomisp/pci/ia_css_tpg.h +++ /dev/null @@ -1,79 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -#ifndef __IA_CSS_TPG_H -#define __IA_CSS_TPG_H - -/* @file - * This file contains support for the test pattern generator (TPG) - */ - -/* Enumerate the TPG IDs. - */ -enum ia_css_tpg_id { - IA_CSS_TPG_ID0, - IA_CSS_TPG_ID1, - IA_CSS_TPG_ID2 -}; - -/** - * Maximum number of TPG IDs. - * - * Make sure the value of this define gets changed to reflect the correct - * number of ia_css_tpg_id enum if you add/delete an item in the enum. - */ -#define N_CSS_TPG_IDS (IA_CSS_TPG_ID2 + 1) - -/* Enumerate the TPG modes. - */ -enum ia_css_tpg_mode { - IA_CSS_TPG_MODE_RAMP, - IA_CSS_TPG_MODE_CHECKERBOARD, - IA_CSS_TPG_MODE_FRAME_BASED_COLOR, - IA_CSS_TPG_MODE_MONO -}; - -/* @brief Configure the test pattern generator. - * - * Configure the Test Pattern Generator, the way these values are used to - * generate the pattern can be seen in the HRT extension for the test pattern - * generator: - * devices/test_pat_gen/hrt/include/test_pat_gen.h: hrt_calc_tpg_data(). - * - * This interface is deprecated, it is not portable -> move to input system API - * -@code -unsigned int test_pattern_value(unsigned int x, unsigned int y) -{ - unsigned int x_val, y_val; - if (x_delta > 0) (x_val = (x << x_delta) & x_mask; - else (x_val = (x >> -x_delta) & x_mask; - if (y_delta > 0) (y_val = (y << y_delta) & y_mask; - else (y_val = (y >> -y_delta) & x_mask; - return (x_val + y_val) & xy_mask; -} -@endcode - */ -struct ia_css_tpg_config { - enum ia_css_tpg_id id; - enum ia_css_tpg_mode mode; - unsigned int x_mask; - int x_delta; - unsigned int y_mask; - int y_delta; - unsigned int xy_mask; -}; - -#endif /* __IA_CSS_TPG_H */ diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h index 3ff61faf0621..c00acf764b93 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h @@ -35,7 +35,6 @@ typedef enum { typedef enum { INPUT_SYSTEM_SOURCE_SENSOR = 0, INPUT_SYSTEM_SOURCE_FIFO, - INPUT_SYSTEM_SOURCE_TPG, INPUT_SYSTEM_SOURCE_PRBS, INPUT_SYSTEM_SOURCE_MEMORY, N_INPUT_SYSTEM_SOURCE diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h index 523c948923f3..03b7ab7a70d9 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h @@ -308,21 +308,6 @@ input_system_err_t input_system_prbs_channel_cfg( target_cfg2400_t target ); -input_system_err_t input_system_tpg_channel_cfg( - u32 ch_id, - u32 nof_frames,//not used yet - u32 x_mask, - u32 y_mask, - u32 x_delta, - u32 y_delta, - u32 xy_mask, - u32 sync_gen_width, - u32 sync_gen_height, - u32 sync_gen_hblank_cycles, - u32 sync_gen_vblank_cycles, - target_cfg2400_t target -); - input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, u32 nof_frames, diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h index e3c86069b390..b116be415074 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h @@ -39,7 +39,6 @@ typedef enum { INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED = 0, INPUT_SYSTEM_SOURCE_TYPE_SENSOR, - INPUT_SYSTEM_SOURCE_TYPE_TPG, INPUT_SYSTEM_SOURCE_TYPE_PRBS, N_INPUT_SYSTEM_SOURCE_TYPE } input_system_source_type_t; diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 3807b31bb98f..9982e77716a7 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -1549,23 +1549,6 @@ ia_css_debug_dump_stream_config_source( ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "compression: %d\n", config->source.port.compression.type); break; - case IA_CSS_INPUT_MODE_TPG: - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.tpg\n"); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "id: %d\n", - config->source.tpg.id); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "mode: %d\n", - config->source.tpg.mode); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "x_mask: 0x%x\n", - config->source.tpg.x_mask); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "x_delta: %d\n", - config->source.tpg.x_delta); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "y_mask: 0x%x\n", - config->source.tpg.y_mask); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "y_delta: %d\n", - config->source.tpg.y_delta); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "xy_mask: 0x%x\n", - config->source.tpg.xy_mask); - break; case IA_CSS_INPUT_MODE_PRBS: ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.prbs\n"); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "id: %d\n", diff --git a/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c index 86254888f676..7b5603e4e173 100644 --- a/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c @@ -382,17 +382,6 @@ int ia_css_ifmtr_configure(struct ia_css_stream_config *config, vectors_per_buffer = buffer_height * buffer_width / ISP_VEC_NELEMS; - if (config->mode == IA_CSS_INPUT_MODE_TPG && - ((binary && binary->info->sp.pipeline.mode == IA_CSS_BINARY_MODE_VIDEO) || - (!binary))) { - /* !binary -> sp raw copy pipe */ - /* workaround for TPG in video mode */ - start_line = 0; - start_column = 0; - cropped_height -= start_line; - width_a -= start_column; - } - if_a_config.start_line = start_line; if_a_config.start_column = start_column; if_a_config.left_padding = left_padding / deinterleaving; diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c index 269a81190577..52483498239d 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c @@ -96,12 +96,6 @@ static void release_be_lut_entry( csi_mipi_packet_type_t packet_type, csi_rx_backend_lut_entry_t *entry); -static bool calculate_tpg_cfg( - input_system_channel_t *channel, - input_system_input_port_t *input_port, - isp2401_input_system_cfg_t *isys_cfg, - pixelgen_tpg_cfg_t *cfg); - static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, @@ -517,13 +511,6 @@ static bool calculate_input_system_input_port_cfg( rc &= calculate_be_cfg(input_port, isys_cfg, true, &input_port_cfg->csi_rx_cfg.md_backend_cfg); break; - case INPUT_SYSTEM_SOURCE_TYPE_TPG: - rc = calculate_tpg_cfg( - channel, - input_port, - isys_cfg, - &input_port_cfg->pixelgen_cfg.tpg_cfg); - break; case INPUT_SYSTEM_SOURCE_TYPE_PRBS: rc = calculate_prbs_cfg( channel, @@ -633,17 +620,6 @@ static void release_be_lut_entry( ia_css_isys_csi_rx_lut_rmgr_release(backend, packet_type, entry); } -static bool calculate_tpg_cfg( - input_system_channel_t *channel, - input_system_input_port_t *input_port, - isp2401_input_system_cfg_t *isys_cfg, - pixelgen_tpg_cfg_t *cfg) -{ - memcpy(cfg, &isys_cfg->tpg_port_attr, sizeof(pixelgen_tpg_cfg_t)); - - return true; -} - static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, @@ -703,9 +679,7 @@ static bool calculate_stream2mmio_cfg( cfg->bits_per_pixel = metadata ? isys_cfg->metadata.bits_per_pixel : isys_cfg->input_port_resolution.bits_per_pixel; - cfg->enable_blocking = - ((isys_cfg->mode == INPUT_SYSTEM_SOURCE_TYPE_TPG) || - (isys_cfg->mode == INPUT_SYSTEM_SOURCE_TYPE_PRBS)); + cfg->enable_blocking = isys_cfg->mode == INPUT_SYSTEM_SOURCE_TYPE_PRBS; return true; } diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 8c30191b21a7..22c8cdcb2eb8 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -462,9 +462,6 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream) return bpp; } -/* TODO: move define to proper file in tools */ -#define GP_ISEL_TPG_MODE 0x90058 - static int sh_css_config_input_network_2400(struct ia_css_stream *stream) { @@ -500,8 +497,7 @@ sh_css_config_input_network_2400(struct ia_css_stream *stream) return err; } - if (stream->config.mode == IA_CSS_INPUT_MODE_TPG || - stream->config.mode == IA_CSS_INPUT_MODE_PRBS) { + if (stream->config.mode == IA_CSS_INPUT_MODE_PRBS) { unsigned int hblank_cycles = 100, vblank_lines = 6, width, @@ -513,8 +509,6 @@ sh_css_config_input_network_2400(struct ia_css_stream *stream) vblank_cycles = vblank_lines * (width + hblank_cycles); sh_css_sp_configure_sync_gen(width, height, hblank_cycles, vblank_cycles); - if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) - ia_css_device_store_uint32(GP_ISEL_TPG_MODE, 0); } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_config_input_network() leave:\n"); @@ -654,16 +648,6 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_id( rc = true; switch (stream_cfg->mode) { - case IA_CSS_INPUT_MODE_TPG: - - if (stream_cfg->source.tpg.id == IA_CSS_TPG_ID0) - isys_stream_descr->input_port_id = INPUT_SYSTEM_PIXELGEN_PORT0_ID; - else if (stream_cfg->source.tpg.id == IA_CSS_TPG_ID1) - isys_stream_descr->input_port_id = INPUT_SYSTEM_PIXELGEN_PORT1_ID; - else if (stream_cfg->source.tpg.id == IA_CSS_TPG_ID2) - isys_stream_descr->input_port_id = INPUT_SYSTEM_PIXELGEN_PORT2_ID; - - break; case IA_CSS_INPUT_MODE_PRBS: if (stream_cfg->source.prbs.id == IA_CSS_PRBS_ID0) @@ -700,11 +684,6 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_type( rc = true; switch (stream_cfg->mode) { - case IA_CSS_INPUT_MODE_TPG: - - isys_stream_descr->mode = INPUT_SYSTEM_SOURCE_TYPE_TPG; - - break; case IA_CSS_INPUT_MODE_PRBS: isys_stream_descr->mode = INPUT_SYSTEM_SOURCE_TYPE_PRBS; @@ -733,54 +712,6 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_attr( rc = true; switch (stream_cfg->mode) { - case IA_CSS_INPUT_MODE_TPG: - if (stream_cfg->source.tpg.mode == IA_CSS_TPG_MODE_RAMP) - isys_stream_descr->tpg_port_attr.mode = PIXELGEN_TPG_MODE_RAMP; - else if (stream_cfg->source.tpg.mode == IA_CSS_TPG_MODE_CHECKERBOARD) - isys_stream_descr->tpg_port_attr.mode = PIXELGEN_TPG_MODE_CHBO; - else if (stream_cfg->source.tpg.mode == IA_CSS_TPG_MODE_MONO) - isys_stream_descr->tpg_port_attr.mode = PIXELGEN_TPG_MODE_MONO; - else - rc = false; - - /* - * TODO - * - Make "color_cfg" as part of "ia_css_tpg_config". - */ - isys_stream_descr->tpg_port_attr.color_cfg.R1 = 51; - isys_stream_descr->tpg_port_attr.color_cfg.G1 = 102; - isys_stream_descr->tpg_port_attr.color_cfg.B1 = 255; - isys_stream_descr->tpg_port_attr.color_cfg.R2 = 0; - isys_stream_descr->tpg_port_attr.color_cfg.G2 = 100; - isys_stream_descr->tpg_port_attr.color_cfg.B2 = 160; - - isys_stream_descr->tpg_port_attr.mask_cfg.h_mask = - stream_cfg->source.tpg.x_mask; - isys_stream_descr->tpg_port_attr.mask_cfg.v_mask = - stream_cfg->source.tpg.y_mask; - isys_stream_descr->tpg_port_attr.mask_cfg.hv_mask = - stream_cfg->source.tpg.xy_mask; - - isys_stream_descr->tpg_port_attr.delta_cfg.h_delta = - stream_cfg->source.tpg.x_delta; - isys_stream_descr->tpg_port_attr.delta_cfg.v_delta = - stream_cfg->source.tpg.y_delta; - - /* - * TODO - * - Make "sync_gen_cfg" as part of "ia_css_tpg_config". - */ - isys_stream_descr->tpg_port_attr.sync_gen_cfg.hblank_cycles = 100; - isys_stream_descr->tpg_port_attr.sync_gen_cfg.vblank_cycles = 100; - isys_stream_descr->tpg_port_attr.sync_gen_cfg.pixels_per_clock = - stream_cfg->pixels_per_clock; - isys_stream_descr->tpg_port_attr.sync_gen_cfg.nr_of_frames = (uint32_t)~(0x0); - isys_stream_descr->tpg_port_attr.sync_gen_cfg.pixels_per_line = - stream_cfg->isys_config[IA_CSS_STREAM_DEFAULT_ISYS_STREAM_IDX].input_res.width; - isys_stream_descr->tpg_port_attr.sync_gen_cfg.lines_per_frame = - stream_cfg->isys_config[IA_CSS_STREAM_DEFAULT_ISYS_STREAM_IDX].input_res.height; - - break; case IA_CSS_INPUT_MODE_PRBS: isys_stream_descr->prbs_port_attr.seed0 = stream_cfg->source.prbs.seed; @@ -8153,23 +8084,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, if (!IS_ISP2401) ia_css_stream_configure_rx(curr_stream); break; - case IA_CSS_INPUT_MODE_TPG: - if (!IS_ISP2401) { - IA_CSS_LOG("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d", - curr_stream->config.source.tpg.x_mask, - curr_stream->config.source.tpg.y_mask, - curr_stream->config.source.tpg.x_delta, - curr_stream->config.source.tpg.y_delta, - curr_stream->config.source.tpg.xy_mask); - - sh_css_sp_configure_tpg( - curr_stream->config.source.tpg.x_mask, - curr_stream->config.source.tpg.y_mask, - curr_stream->config.source.tpg.x_delta, - curr_stream->config.source.tpg.y_delta, - curr_stream->config.source.tpg.xy_mask); - } - break; case IA_CSS_INPUT_MODE_PRBS: if (!IS_ISP2401) { IA_CSS_LOG("mode prbs"); diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index 2349eb4d3767..bef2b8c5132b 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -360,7 +360,6 @@ struct sh_css_sp_config { } input_formatter; sync_generator_cfg_t sync_gen; - tpg_cfg_t tpg; prbs_cfg_t prbs; input_system_cfg_t input_circuit; u8 input_circuit_cfg_changed; diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index 55f9c89c6932..29e5bee78c20 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -669,20 +669,6 @@ sh_css_sp_configure_sync_gen(int width, int height, sh_css_sp_group.config.sync_gen.vblank_cycles = vblank_cycles; } -void -sh_css_sp_configure_tpg(int x_mask, - int y_mask, - int x_delta, - int y_delta, - int xy_mask) -{ - sh_css_sp_group.config.tpg.x_mask = x_mask; - sh_css_sp_group.config.tpg.y_mask = y_mask; - sh_css_sp_group.config.tpg.x_delta = x_delta; - sh_css_sp_group.config.tpg.y_delta = y_delta; - sh_css_sp_group.config.tpg.xy_mask = xy_mask; -} - void sh_css_sp_configure_prbs(int seed) { diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.h b/drivers/staging/media/atomisp/pci/sh_css_sp.h index 36b693bd916a..c12f57f5befc 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.h +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.h @@ -164,13 +164,6 @@ sh_css_sp_configure_sync_gen(int width, int hblank_cycles, int vblank_cycles); -void -sh_css_sp_configure_tpg(int x_mask, - int y_mask, - int x_delta, - int y_delta, - int xy_mask); - void sh_css_sp_configure_prbs(int seed); From patchwork Mon Apr 15 12:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629866 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C67B6996E for ; Mon, 15 Apr 2024 12:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182575; cv=none; b=A04wSsAQTN1Qg5ltqdFwN63j4nYu1AtOYAXek6uOgD6U3Wz+prJg4boRVw+sdZKgE8VG1RLZdgcedpeYCqBRdJYtvEjaqNmngmLdgIzDW8zTypX8B8zidlAfJgXcCuYXmH1zvglebvlnX3l1s9FfHb/1Ty16jXqIIjZXwcClMkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182575; c=relaxed/simple; bh=Ylz6rzQsgY/smEeOjGzzC4QgItrBXNo3xi5lbtRO3wE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/s5CUnfXmVgkljsgVR+lZGyUXpKfMD3G0QuCNtu90sxqBQa0pwRevlw40kr9bgXUr7X9gJW459/LyrI7hjKb3vxNS0jyCv3WEPFGYS+eE/nmh/l3hC7mmBQrR7K+1Mq+PAMKIGkR9wxJ7wN2HaJ11dCOJUZLorll3oN7klsATk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eFEQ6zad; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eFEQ6zad" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182573; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ynX0DGXz84eH72mur6sdT5zYy1ByXKBp3wkUemoSC/8=; b=eFEQ6zad6K6ZA21AoOm4zXTmu1d+sMqnCDvKnAdxcYBjcoBKcyR9NfBGAGoPZyzglklXxb LwexY/wxJWI7wHZddXeh7FalW5aI19JnpT6yA71s9h5V6wz6hhr/J2gARegQMCQXHeb2o0 aMt5QjEGLEdw9cO8NRzC0HILH01PjJg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-pw2uRze3Pee3v1fMGDJvrA-1; Mon, 15 Apr 2024 08:02:52 -0400 X-MC-Unique: pw2uRze3Pee3v1fMGDJvrA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 950F33C0252A; Mon, 15 Apr 2024 12:02:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AA5CC15771; Mon, 15 Apr 2024 12:02:50 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 12/23] media: atomisp: Remove input_port_ID_t Date: Mon, 15 Apr 2024 14:02:09 +0200 Message-ID: <20240415120220.219480-13-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Change the single, unexpected user of CSI_PORT0_ID for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++) to for (port = 0; port < N_CSI_PORTS; port++) { matching all the other for-loops iterating over the ports in the same file. And remove the now fully unused input_port_ID_t enum type. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 2 +- drivers/staging/media/atomisp/pci/system_global.h | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index 6e11fd771938..80f0395cc560 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -489,7 +489,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) } } else { /* pipe ==NULL */ /* AM TEMP: free-ing all mipi buffers just like a legacy code. */ - for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++) { + for (port = 0; port < N_CSI_PORTS; port++) { unsigned int i; for (i = 0; i < my_css.num_mipi_frames[port]; i++) { diff --git a/drivers/staging/media/atomisp/pci/system_global.h b/drivers/staging/media/atomisp/pci/system_global.h index 060b924023ec..e8a29f73d67a 100644 --- a/drivers/staging/media/atomisp/pci/system_global.h +++ b/drivers/staging/media/atomisp/pci/system_global.h @@ -201,18 +201,6 @@ enum mipi_port_id { #define N_RX_CHANNEL_ID 4 -/* Generic port enumeration with an internal port type ID */ -typedef enum { - CSI_PORT0_ID = 0, - CSI_PORT1_ID, - CSI_PORT2_ID, - TPG_PORT0_ID, - PRBS_PORT0_ID, - FIFO_PORT0_ID, - MEMORY_PORT0_ID, - N_INPUT_PORT_ID -} input_port_ID_t; - typedef enum { CAPTURE_UNIT0_ID = 0, CAPTURE_UNIT1_ID, From patchwork Mon Apr 15 12:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629870 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05D886A03D for ; Mon, 15 Apr 2024 12:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182584; cv=none; b=dXrb4Omz9oRud5pblQ/wzGd9KsHyrpqvuT9Zry7EpWpQXCsKRlhVDWM1N+lrEfnqcBfQA9DfoqantTNeKeEhVOQlHRS7GNqWWjUDY+tZ94sd6gRNei6cqydZQWcY+8d+fC7Vt8ocyK2TNMG1wx83pidxnfePglDCeuYgHS2Egn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182584; c=relaxed/simple; bh=4bdV63xW3BNgp0tkK/Uu9VixCVRv9HXaQV4sT9MbgsY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ICSUhRZwWRWj4B8f8ADHt1QOSMdyQg9b5jdFsi2KYhh7rZK6x3hzcK7gBpI2UDh1Qr8jeLCz6Xgik6lR13EuYPosnjX7A1kqOJ92/you/s2smFzf4Vdf7Z+FrxZo7mDa/Now67V5qIvowyO7LtTh+KAOUvOrDF3YlC4nKuDOZ98= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VhSiouCk; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VhSiouCk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ACnU75nwZiaQZ6p0V7s8TicecX4otRBGb5R+/9u+Pn8=; b=VhSiouCk5AFJKS5l/rsOQdzNZEALjJ1+OjmlqIHycBC2076yvtxTSpNCrrpcsqEWe0a2+Q Nf8y11k6kWwNfQhe4lJwYpp5JWGLsE0XINsfzT4jzbE2W2jSk/Hx+rQIyZWJXMBEm4btFz ZqiNAlZW0QWrpuc1rOsiuTETTMTWB6U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-hOCPxSSeMa28NsfaMwKUjA-1; Mon, 15 Apr 2024 08:02:53 -0400 X-MC-Unique: hOCPxSSeMa28NsfaMwKUjA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09D541887316; Mon, 15 Apr 2024 12:02:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5DDDC13FA2; Mon, 15 Apr 2024 12:02:51 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 13/23] media: atomisp: Drop the atomisp custom lm3554 flash driver Date: Mon, 15 Apr 2024 14:02:10 +0200 Message-ID: <20240415120220.219480-14-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Drop the atomisp custom lm3554 flash driver, support for flash drivers using the custom atomisp flash interface is going to be removed from the atomisp driver. If flash supports for the lm3554 turns out to be necessary on some atomisp devices in the future then this should be re-implemented using the new include/linux/led-class-flash.h APIs. The atomisp specific lm3554 driver could still be usable as a reference for how to use / driver the lm3554 for a future re-implementation using standardized APIs, but for that it can be retrieved from the git history. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/i2c/Kconfig | 15 - drivers/staging/media/atomisp/i2c/Makefile | 5 - .../media/atomisp/i2c/atomisp-lm3554.c | 955 ------------------ .../media/atomisp/include/media/lm3554.h | 132 --- 4 files changed, 1107 deletions(-) delete mode 100644 drivers/staging/media/atomisp/i2c/atomisp-lm3554.c delete mode 100644 drivers/staging/media/atomisp/include/media/lm3554.h diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index f62d183b787f..8710c483015c 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -56,18 +56,3 @@ config VIDEO_ATOMISP_GC0310 help This is a Video4Linux2 sensor-level driver for the Galaxycore GC0310 0.3MP sensor. - -# -# Kconfig for flash drivers -# - -config VIDEO_ATOMISP_LM3554 - tristate "LM3554 flash light driver" - depends on ACPI - depends on VIDEO_DEV && I2C - help - This is a Video4Linux2 sub-dev driver for the LM3554 - flash light driver. - - To compile this driver as a module, choose M here: the - module will be called lm3554 diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index e946cc91e5ff..3073cfa75ecf 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -9,8 +9,3 @@ obj-$(CONFIG_VIDEO_ATOMISP_OV2722) += atomisp-ov2722.o obj-$(CONFIG_VIDEO_ATOMISP_GC0310) += atomisp-gc0310.o obj-$(CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER) += atomisp-libmsrlisthelper.o - -# Makefile for flash drivers -# - -obj-$(CONFIG_VIDEO_ATOMISP_LM3554) += atomisp-lm3554.o diff --git a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c b/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c deleted file mode 100644 index cf5d9317b11a..000000000000 --- a/drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +++ /dev/null @@ -1,955 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * LED flash driver for LM3554 - * - * Copyright (c) 2010-2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - */ -#include -#include -#include -#include -#include -#include - -#include "../include/media/lm3554.h" -#include -#include -#include -#include "../include/linux/atomisp_gmin_platform.h" -#include "../include/linux/atomisp.h" - -/* Registers */ - -#define LM3554_TORCH_BRIGHTNESS_REG 0xA0 -#define LM3554_TORCH_MODE_SHIFT 0 -#define LM3554_TORCH_CURRENT_SHIFT 3 -#define LM3554_INDICATOR_CURRENT_SHIFT 6 - -#define LM3554_FLASH_BRIGHTNESS_REG 0xB0 -#define LM3554_FLASH_MODE_SHIFT 0 -#define LM3554_FLASH_CURRENT_SHIFT 3 -#define LM3554_STROBE_SENSITIVITY_SHIFT 7 - -#define LM3554_FLASH_DURATION_REG 0xC0 -#define LM3554_FLASH_TIMEOUT_SHIFT 0 -#define LM3554_CURRENT_LIMIT_SHIFT 5 - -#define LM3554_FLAGS_REG 0xD0 -#define LM3554_FLAG_TIMEOUT BIT(0) -#define LM3554_FLAG_THERMAL_SHUTDOWN BIT(1) -#define LM3554_FLAG_LED_FAULT BIT(2) -#define LM3554_FLAG_TX1_INTERRUPT BIT(3) -#define LM3554_FLAG_TX2_INTERRUPT BIT(4) -#define LM3554_FLAG_LED_THERMAL_FAULT BIT(5) -#define LM3554_FLAG_UNUSED BIT(6) -#define LM3554_FLAG_INPUT_VOLTAGE_LOW BIT(7) - -#define LM3554_CONFIG_REG_1 0xE0 -#define LM3554_ENVM_TX2_SHIFT 5 -#define LM3554_TX2_POLARITY_SHIFT 6 - -struct lm3554 { - struct v4l2_subdev sd; - - struct mutex power_lock; - struct v4l2_ctrl_handler ctrl_handler; - int power_count; - - unsigned int mode; - int timeout; - u8 torch_current; - u8 indicator_current; - u8 flash_current; - - struct timer_list flash_off_delay; - struct lm3554_platform_data *pdata; -}; - -#define to_lm3554(p_sd) container_of(p_sd, struct lm3554, sd) - -/* Return negative errno else zero on success */ -static int lm3554_write(struct lm3554 *flash, u8 addr, u8 val) -{ - struct i2c_client *client = v4l2_get_subdevdata(&flash->sd); - int ret; - - ret = i2c_smbus_write_byte_data(client, addr, val); - - dev_dbg(&client->dev, "Write Addr:%02X Val:%02X %s\n", addr, val, - ret < 0 ? "fail" : "ok"); - - return ret; -} - -/* Return negative errno else a data byte received from the device. */ -static int lm3554_read(struct lm3554 *flash, u8 addr) -{ - struct i2c_client *client = v4l2_get_subdevdata(&flash->sd); - int ret; - - ret = i2c_smbus_read_byte_data(client, addr); - - dev_dbg(&client->dev, "Read Addr:%02X Val:%02X %s\n", addr, ret, - ret < 0 ? "fail" : "ok"); - - return ret; -} - -/* ----------------------------------------------------------------------------- - * Hardware configuration - */ - -static int lm3554_set_mode(struct lm3554 *flash, unsigned int mode) -{ - u8 val; - int ret; - - val = (mode << LM3554_FLASH_MODE_SHIFT) | - (flash->flash_current << LM3554_FLASH_CURRENT_SHIFT); - - ret = lm3554_write(flash, LM3554_FLASH_BRIGHTNESS_REG, val); - if (ret == 0) - flash->mode = mode; - return ret; -} - -static int lm3554_set_torch(struct lm3554 *flash) -{ - u8 val; - - val = (flash->mode << LM3554_TORCH_MODE_SHIFT) | - (flash->torch_current << LM3554_TORCH_CURRENT_SHIFT) | - (flash->indicator_current << LM3554_INDICATOR_CURRENT_SHIFT); - - return lm3554_write(flash, LM3554_TORCH_BRIGHTNESS_REG, val); -} - -static int lm3554_set_flash(struct lm3554 *flash) -{ - u8 val; - - val = (flash->mode << LM3554_FLASH_MODE_SHIFT) | - (flash->flash_current << LM3554_FLASH_CURRENT_SHIFT); - - return lm3554_write(flash, LM3554_FLASH_BRIGHTNESS_REG, val); -} - -static int lm3554_set_duration(struct lm3554 *flash) -{ - u8 val; - - val = (flash->timeout << LM3554_FLASH_TIMEOUT_SHIFT) | - (flash->pdata->current_limit << LM3554_CURRENT_LIMIT_SHIFT); - - return lm3554_write(flash, LM3554_FLASH_DURATION_REG, val); -} - -static int lm3554_set_config1(struct lm3554 *flash) -{ - u8 val; - - val = (flash->pdata->envm_tx2 << LM3554_ENVM_TX2_SHIFT) | - (flash->pdata->tx2_polarity << LM3554_TX2_POLARITY_SHIFT); - return lm3554_write(flash, LM3554_CONFIG_REG_1, val); -} - -/* ----------------------------------------------------------------------------- - * Hardware trigger - */ -static void lm3554_flash_off_delay(struct timer_list *t) -{ - struct lm3554 *flash = from_timer(flash, t, flash_off_delay); - struct lm3554_platform_data *pdata = flash->pdata; - - gpiod_set_value(pdata->gpio_strobe, 0); -} - -static int lm3554_hw_strobe(struct i2c_client *client, bool strobe) -{ - int ret, timer_pending; - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct lm3554 *flash = to_lm3554(sd); - struct lm3554_platform_data *pdata = flash->pdata; - - /* - * An abnormal high flash current is observed when strobe off the - * flash. Workaround here is firstly set flash current to lower level, - * wait a short moment, and then strobe off the flash. - */ - - timer_pending = del_timer_sync(&flash->flash_off_delay); - - /* Flash off */ - if (!strobe) { - /* set current to 70mA and wait a while */ - ret = lm3554_write(flash, LM3554_FLASH_BRIGHTNESS_REG, 0); - if (ret < 0) - goto err; - mod_timer(&flash->flash_off_delay, - jiffies + msecs_to_jiffies(LM3554_TIMER_DELAY)); - return 0; - } - - /* Flash on */ - - /* - * If timer is killed before run, flash is not strobe off, - * so must strobe off here - */ - if (timer_pending) - gpiod_set_value(pdata->gpio_strobe, 0); - - /* Restore flash current settings */ - ret = lm3554_set_flash(flash); - if (ret < 0) - goto err; - - /* Strobe on Flash */ - gpiod_set_value(pdata->gpio_strobe, 1); - - return 0; -err: - dev_err(&client->dev, "failed to %s flash strobe (%d)\n", - strobe ? "on" : "off", ret); - return ret; -} - -/* ----------------------------------------------------------------------------- - * V4L2 controls - */ - -static int lm3554_read_status(struct lm3554 *flash) -{ - int ret; - struct i2c_client *client = v4l2_get_subdevdata(&flash->sd); - - /* NOTE: reading register clear fault status */ - ret = lm3554_read(flash, LM3554_FLAGS_REG); - if (ret < 0) - return ret; - - /* - * Accordingly to datasheet we read back '1' in bit 6. - * Clear it first. - */ - ret &= ~LM3554_FLAG_UNUSED; - - /* - * Do not take TX1/TX2 signal as an error - * because MSIC will not turn off flash, but turn to - * torch mode according to gsm modem signal by hardware. - */ - ret &= ~(LM3554_FLAG_TX1_INTERRUPT | LM3554_FLAG_TX2_INTERRUPT); - - if (ret > 0) - dev_dbg(&client->dev, "LM3554 flag status: %02x\n", ret); - - return ret; -} - -static int lm3554_s_flash_timeout(struct v4l2_subdev *sd, u32 val) -{ - struct lm3554 *flash = to_lm3554(sd); - - val = clamp(val, LM3554_MIN_TIMEOUT, LM3554_MAX_TIMEOUT); - val = val / LM3554_TIMEOUT_STEPSIZE - 1; - - flash->timeout = val; - - return lm3554_set_duration(flash); -} - -static int lm3554_g_flash_timeout(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - - *val = (u32)(flash->timeout + 1) * LM3554_TIMEOUT_STEPSIZE; - - return 0; -} - -static int lm3554_s_flash_intensity(struct v4l2_subdev *sd, u32 intensity) -{ - struct lm3554 *flash = to_lm3554(sd); - - intensity = LM3554_CLAMP_PERCENTAGE(intensity); - intensity = LM3554_PERCENT_TO_VALUE(intensity, LM3554_FLASH_STEP); - - flash->flash_current = intensity; - - return lm3554_set_flash(flash); -} - -static int lm3554_g_flash_intensity(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - - *val = LM3554_VALUE_TO_PERCENT((u32)flash->flash_current, - LM3554_FLASH_STEP); - - return 0; -} - -static int lm3554_s_torch_intensity(struct v4l2_subdev *sd, u32 intensity) -{ - struct lm3554 *flash = to_lm3554(sd); - - intensity = LM3554_CLAMP_PERCENTAGE(intensity); - intensity = LM3554_PERCENT_TO_VALUE(intensity, LM3554_TORCH_STEP); - - flash->torch_current = intensity; - - return lm3554_set_torch(flash); -} - -static int lm3554_g_torch_intensity(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - - *val = LM3554_VALUE_TO_PERCENT((u32)flash->torch_current, - LM3554_TORCH_STEP); - - return 0; -} - -static int lm3554_s_indicator_intensity(struct v4l2_subdev *sd, u32 intensity) -{ - struct lm3554 *flash = to_lm3554(sd); - - intensity = LM3554_CLAMP_PERCENTAGE(intensity); - intensity = LM3554_PERCENT_TO_VALUE(intensity, LM3554_INDICATOR_STEP); - - flash->indicator_current = intensity; - - return lm3554_set_torch(flash); -} - -static int lm3554_g_indicator_intensity(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - - *val = LM3554_VALUE_TO_PERCENT((u32)flash->indicator_current, - LM3554_INDICATOR_STEP); - - return 0; -} - -static int lm3554_s_flash_strobe(struct v4l2_subdev *sd, u32 val) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - - return lm3554_hw_strobe(client, val); -} - -static int lm3554_s_flash_mode(struct v4l2_subdev *sd, u32 new_mode) -{ - struct lm3554 *flash = to_lm3554(sd); - unsigned int mode; - - switch (new_mode) { - case ATOMISP_FLASH_MODE_OFF: - mode = LM3554_MODE_SHUTDOWN; - break; - case ATOMISP_FLASH_MODE_FLASH: - mode = LM3554_MODE_FLASH; - break; - case ATOMISP_FLASH_MODE_INDICATOR: - mode = LM3554_MODE_INDICATOR; - break; - case ATOMISP_FLASH_MODE_TORCH: - mode = LM3554_MODE_TORCH; - break; - default: - return -EINVAL; - } - - return lm3554_set_mode(flash, mode); -} - -static int lm3554_g_flash_mode(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - *val = flash->mode; - return 0; -} - -static int lm3554_g_flash_status(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - int value; - - value = lm3554_read_status(flash); - if (value < 0) - return value; - - if (value & LM3554_FLAG_TIMEOUT) - *val = ATOMISP_FLASH_STATUS_TIMEOUT; - else if (value > 0) - *val = ATOMISP_FLASH_STATUS_HW_ERROR; - else - *val = ATOMISP_FLASH_STATUS_OK; - - return 0; -} - -static int lm3554_g_flash_status_register(struct v4l2_subdev *sd, s32 *val) -{ - struct lm3554 *flash = to_lm3554(sd); - int ret; - - ret = lm3554_read(flash, LM3554_FLAGS_REG); - - if (ret < 0) - return ret; - - *val = ret; - return 0; -} - -static int lm3554_s_ctrl(struct v4l2_ctrl *ctrl) -{ - struct lm3554 *dev = - container_of(ctrl->handler, struct lm3554, ctrl_handler); - int ret = 0; - - switch (ctrl->id) { - case V4L2_CID_FLASH_TIMEOUT: - ret = lm3554_s_flash_timeout(&dev->sd, ctrl->val); - break; - case V4L2_CID_FLASH_INTENSITY: - ret = lm3554_s_flash_intensity(&dev->sd, ctrl->val); - break; - case V4L2_CID_FLASH_TORCH_INTENSITY: - ret = lm3554_s_torch_intensity(&dev->sd, ctrl->val); - break; - case V4L2_CID_FLASH_INDICATOR_INTENSITY: - ret = lm3554_s_indicator_intensity(&dev->sd, ctrl->val); - break; - case V4L2_CID_FLASH_STROBE: - ret = lm3554_s_flash_strobe(&dev->sd, ctrl->val); - break; - case V4L2_CID_FLASH_MODE: - ret = lm3554_s_flash_mode(&dev->sd, ctrl->val); - break; - default: - ret = -EINVAL; - } - return ret; -} - -static int lm3554_g_volatile_ctrl(struct v4l2_ctrl *ctrl) -{ - struct lm3554 *dev = - container_of(ctrl->handler, struct lm3554, ctrl_handler); - int ret = 0; - - switch (ctrl->id) { - case V4L2_CID_FLASH_TIMEOUT: - ret = lm3554_g_flash_timeout(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FLASH_INTENSITY: - ret = lm3554_g_flash_intensity(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FLASH_TORCH_INTENSITY: - ret = lm3554_g_torch_intensity(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FLASH_INDICATOR_INTENSITY: - ret = lm3554_g_indicator_intensity(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FLASH_MODE: - ret = lm3554_g_flash_mode(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FLASH_STATUS: - ret = lm3554_g_flash_status(&dev->sd, &ctrl->val); - break; - case V4L2_CID_FLASH_STATUS_REGISTER: - ret = lm3554_g_flash_status_register(&dev->sd, &ctrl->val); - break; - default: - ret = -EINVAL; - } - - return ret; -} - -static const struct v4l2_ctrl_ops ctrl_ops = { - .s_ctrl = lm3554_s_ctrl, - .g_volatile_ctrl = lm3554_g_volatile_ctrl -}; - -static const struct v4l2_ctrl_config lm3554_controls[] = { - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_TIMEOUT, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Flash Timeout", - .min = 0x0, - .max = LM3554_MAX_TIMEOUT, - .step = 0x01, - .def = LM3554_DEFAULT_TIMEOUT, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_INTENSITY, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Flash Intensity", - .min = LM3554_MIN_PERCENT, - .max = LM3554_MAX_PERCENT, - .step = 0x01, - .def = LM3554_FLASH_DEFAULT_BRIGHTNESS, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_TORCH_INTENSITY, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Torch Intensity", - .min = LM3554_MIN_PERCENT, - .max = LM3554_MAX_PERCENT, - .step = 0x01, - .def = LM3554_TORCH_DEFAULT_BRIGHTNESS, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_INDICATOR_INTENSITY, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Indicator Intensity", - .min = LM3554_MIN_PERCENT, - .max = LM3554_MAX_PERCENT, - .step = 0x01, - .def = LM3554_INDICATOR_DEFAULT_BRIGHTNESS, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_STROBE, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Flash Strobe", - .min = 0, - .max = 1, - .step = 1, - .def = 0, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_MODE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Flash Mode", - .min = 0, - .max = 100, - .step = 1, - .def = ATOMISP_FLASH_MODE_OFF, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_STATUS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Flash Status", - .min = ATOMISP_FLASH_STATUS_OK, - .max = ATOMISP_FLASH_STATUS_TIMEOUT, - .step = 1, - .def = ATOMISP_FLASH_STATUS_OK, - .flags = 0, - }, - { - .ops = &ctrl_ops, - .id = V4L2_CID_FLASH_STATUS_REGISTER, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Flash Status Register", - .min = 0, - .max = 255, - .step = 1, - .def = 0, - .flags = 0, - }, -}; - -/* ----------------------------------------------------------------------------- - * V4L2 subdev core operations - */ - -/* Put device into known state. */ -static int lm3554_setup(struct lm3554 *flash) -{ - struct i2c_client *client = v4l2_get_subdevdata(&flash->sd); - int ret; - - /* clear the flags register */ - ret = lm3554_read(flash, LM3554_FLAGS_REG); - if (ret < 0) - return ret; - - dev_dbg(&client->dev, "Fault info: %02x\n", ret); - - ret = lm3554_set_config1(flash); - if (ret < 0) - return ret; - - ret = lm3554_set_duration(flash); - if (ret < 0) - return ret; - - ret = lm3554_set_torch(flash); - if (ret < 0) - return ret; - - ret = lm3554_set_flash(flash); - if (ret < 0) - return ret; - - /* read status */ - ret = lm3554_read_status(flash); - if (ret < 0) - return ret; - - return ret ? -EIO : 0; -} - -static int __lm3554_s_power(struct lm3554 *flash, int power) -{ - struct lm3554_platform_data *pdata = flash->pdata; - int ret; - - /*initialize flash driver*/ - gpiod_set_value(pdata->gpio_reset, power); - usleep_range(100, 100 + 1); - - if (power) { - /* Setup default values. This makes sure that the chip - * is in a known state. - */ - ret = lm3554_setup(flash); - if (ret < 0) { - __lm3554_s_power(flash, 0); - return ret; - } - } - - return 0; -} - -static int lm3554_s_power(struct v4l2_subdev *sd, int power) -{ - struct lm3554 *flash = to_lm3554(sd); - int ret = 0; - - mutex_lock(&flash->power_lock); - - if (flash->power_count == !power) { - ret = __lm3554_s_power(flash, !!power); - if (ret < 0) - goto done; - } - - flash->power_count += power ? 1 : -1; - WARN_ON(flash->power_count < 0); - -done: - mutex_unlock(&flash->power_lock); - return ret; -} - -static const struct v4l2_subdev_core_ops lm3554_core_ops = { - .s_power = lm3554_s_power, -}; - -static const struct v4l2_subdev_ops lm3554_ops = { - .core = &lm3554_core_ops, -}; - -static int lm3554_detect(struct v4l2_subdev *sd) -{ - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct i2c_adapter *adapter = client->adapter; - struct lm3554 *flash = to_lm3554(sd); - int ret; - - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { - dev_err(&client->dev, "lm3554_detect i2c error\n"); - return -ENODEV; - } - - /* Power up the flash driver and reset it */ - ret = lm3554_s_power(&flash->sd, 1); - if (ret < 0) { - dev_err(&client->dev, "Failed to power on lm3554 LED flash\n"); - } else { - dev_dbg(&client->dev, "Successfully detected lm3554 LED flash\n"); - lm3554_s_power(&flash->sd, 0); - } - - return ret; -} - -static int lm3554_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) -{ - return lm3554_s_power(sd, 1); -} - -static int lm3554_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) -{ - return lm3554_s_power(sd, 0); -} - -static const struct v4l2_subdev_internal_ops lm3554_internal_ops = { - .registered = lm3554_detect, - .open = lm3554_open, - .close = lm3554_close, -}; - -/* ----------------------------------------------------------------------------- - * I2C driver - */ -#ifdef CONFIG_PM - -static int lm3554_suspend(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); - struct lm3554 *flash = to_lm3554(subdev); - int rval; - - if (flash->power_count == 0) - return 0; - - rval = __lm3554_s_power(flash, 0); - - dev_dbg(&client->dev, "Suspend %s\n", rval < 0 ? "failed" : "ok"); - - return rval; -} - -static int lm3554_resume(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); - struct lm3554 *flash = to_lm3554(subdev); - int rval; - - if (flash->power_count == 0) - return 0; - - rval = __lm3554_s_power(flash, 1); - - dev_dbg(&client->dev, "Resume %s\n", rval < 0 ? "fail" : "ok"); - - return rval; -} - -#else - -#define lm3554_suspend NULL -#define lm3554_resume NULL - -#endif /* CONFIG_PM */ - -static int lm3554_gpio_init(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct lm3554 *flash = to_lm3554(sd); - struct lm3554_platform_data *pdata = flash->pdata; - int ret; - - if (!pdata->gpio_reset) - return -EINVAL; - - ret = gpiod_direction_output(pdata->gpio_reset, 0); - if (ret < 0) - return ret; - - if (!pdata->gpio_strobe) - return -EINVAL; - - ret = gpiod_direction_output(pdata->gpio_strobe, 0); - if (ret < 0) - return ret; - - return 0; -} - -static void lm3554_gpio_uninit(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct lm3554 *flash = to_lm3554(sd); - struct lm3554_platform_data *pdata = flash->pdata; - int ret; - - ret = gpiod_direction_output(pdata->gpio_strobe, 0); - if (ret < 0) - dev_err(&client->dev, - "gpio request/direction_output fail for gpio_strobe"); - - ret = gpiod_direction_output(pdata->gpio_reset, 0); - if (ret < 0) - dev_err(&client->dev, - "gpio request/direction_output fail for gpio_reset"); -} - -static void *lm3554_platform_data_func(struct i2c_client *client) -{ - static struct lm3554_platform_data platform_data; - - platform_data.gpio_reset = gpiod_get_index(&client->dev, - NULL, 2, GPIOD_OUT_LOW); - if (IS_ERR(platform_data.gpio_reset)) - return ERR_CAST(platform_data.gpio_reset); - platform_data.gpio_strobe = gpiod_get_index(&client->dev, - NULL, 0, GPIOD_OUT_LOW); - if (IS_ERR(platform_data.gpio_strobe)) - return ERR_CAST(platform_data.gpio_strobe); - platform_data.gpio_torch = gpiod_get_index(&client->dev, - NULL, 1, GPIOD_OUT_LOW); - if (IS_ERR(platform_data.gpio_torch)) - return ERR_CAST(platform_data.gpio_torch); - - /* Set to TX2 mode, then ENVM/TX2 pin is a power amplifier sync input: - * ENVM/TX pin asserted, flash forced into torch; - * ENVM/TX pin desserted, flash set back; - */ - platform_data.envm_tx2 = 1; - platform_data.tx2_polarity = 0; - - /* set peak current limit to be 1000mA */ - platform_data.current_limit = 0; - - return &platform_data; -} - -static int lm3554_probe(struct i2c_client *client) -{ - int err = 0; - struct lm3554 *flash; - unsigned int i; - - flash = kzalloc(sizeof(*flash), GFP_KERNEL); - if (!flash) - return -ENOMEM; - - flash->pdata = lm3554_platform_data_func(client); - if (IS_ERR(flash->pdata)) { - err = PTR_ERR(flash->pdata); - goto free_flash; - } - - v4l2_i2c_subdev_init(&flash->sd, client, &lm3554_ops); - flash->sd.internal_ops = &lm3554_internal_ops; - flash->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - flash->mode = ATOMISP_FLASH_MODE_OFF; - flash->timeout = LM3554_MAX_TIMEOUT / LM3554_TIMEOUT_STEPSIZE - 1; - err = - v4l2_ctrl_handler_init(&flash->ctrl_handler, - ARRAY_SIZE(lm3554_controls)); - if (err) { - dev_err(&client->dev, "error initialize a ctrl_handler.\n"); - goto unregister_subdev; - } - - for (i = 0; i < ARRAY_SIZE(lm3554_controls); i++) - v4l2_ctrl_new_custom(&flash->ctrl_handler, &lm3554_controls[i], - NULL); - - if (flash->ctrl_handler.error) { - dev_err(&client->dev, "ctrl_handler error.\n"); - err = flash->ctrl_handler.error; - goto free_handler; - } - - flash->sd.ctrl_handler = &flash->ctrl_handler; - err = media_entity_pads_init(&flash->sd.entity, 0, NULL); - if (err) { - dev_err(&client->dev, "error initialize a media entity.\n"); - goto free_handler; - } - - flash->sd.entity.function = MEDIA_ENT_F_FLASH; - - mutex_init(&flash->power_lock); - - timer_setup(&flash->flash_off_delay, lm3554_flash_off_delay, 0); - - err = lm3554_gpio_init(client); - if (err) { - dev_err(&client->dev, "gpio request/direction_output fail.\n"); - goto cleanup_media; - } - - err = atomisp_register_i2c_module(&flash->sd, NULL, LED_FLASH); - if (err) { - dev_err(&client->dev, "fail to register atomisp i2c module.\n"); - goto uninit_gpio; - } - - return 0; - -uninit_gpio: - lm3554_gpio_uninit(client); -cleanup_media: - media_entity_cleanup(&flash->sd.entity); -free_handler: - v4l2_ctrl_handler_free(&flash->ctrl_handler); -unregister_subdev: - v4l2_device_unregister_subdev(&flash->sd); -free_flash: - kfree(flash); - - return err; -} - -static void lm3554_remove(struct i2c_client *client) -{ - struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct lm3554 *flash = to_lm3554(sd); - - media_entity_cleanup(&flash->sd.entity); - v4l2_ctrl_handler_free(&flash->ctrl_handler); - v4l2_device_unregister_subdev(sd); - - atomisp_gmin_remove_subdev(sd); - - timer_shutdown_sync(&flash->flash_off_delay); - - lm3554_gpio_uninit(client); - - kfree(flash); -} - -static const struct dev_pm_ops lm3554_pm_ops = { - .suspend = lm3554_suspend, - .resume = lm3554_resume, -}; - -static const struct acpi_device_id lm3554_acpi_match[] = { - { "INTCF1C" }, - {}, -}; -MODULE_DEVICE_TABLE(acpi, lm3554_acpi_match); - -static struct i2c_driver lm3554_driver = { - .driver = { - .name = "lm3554", - .pm = &lm3554_pm_ops, - .acpi_match_table = lm3554_acpi_match, - }, - .probe = lm3554_probe, - .remove = lm3554_remove, -}; -module_i2c_driver(lm3554_driver); - -MODULE_AUTHOR("Jing Tao "); -MODULE_DESCRIPTION("LED flash driver for LM3554"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/media/atomisp/include/media/lm3554.h b/drivers/staging/media/atomisp/include/media/lm3554.h deleted file mode 100644 index 711b7d7c9950..000000000000 --- a/drivers/staging/media/atomisp/include/media/lm3554.h +++ /dev/null @@ -1,132 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * include/media/lm3554.h - * - * Copyright (c) 2010-2012 Intel Corporation. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - */ -#ifndef _LM3554_H_ -#define _LM3554_H_ - -#include -#include -#include - -#define LM3554_ID 3554 - -#define v4l2_queryctrl_entry_integer(_id, _name,\ - _minimum, _maximum, _step, \ - _default_value, _flags) \ - {\ - .id = (_id), \ - .type = V4L2_CTRL_TYPE_INTEGER, \ - .name = _name, \ - .minimum = (_minimum), \ - .maximum = (_maximum), \ - .step = (_step), \ - .default_value = (_default_value),\ - .flags = (_flags),\ - } -#define v4l2_queryctrl_entry_boolean(_id, _name,\ - _default_value, _flags) \ - {\ - .id = (_id), \ - .type = V4L2_CTRL_TYPE_BOOLEAN, \ - .name = _name, \ - .minimum = 0, \ - .maximum = 1, \ - .step = 1, \ - .default_value = (_default_value),\ - .flags = (_flags),\ - } - -#define s_ctrl_id_entry_integer(_id, _name, \ - _minimum, _maximum, _step, \ - _default_value, _flags, \ - _s_ctrl, _g_ctrl) \ - {\ - .qc = v4l2_queryctrl_entry_integer(_id, _name,\ - _minimum, _maximum, _step,\ - _default_value, _flags), \ - .s_ctrl = _s_ctrl, \ - .g_ctrl = _g_ctrl, \ - } - -#define s_ctrl_id_entry_boolean(_id, _name, \ - _default_value, _flags, \ - _s_ctrl, _g_ctrl) \ - {\ - .qc = v4l2_queryctrl_entry_boolean(_id, _name,\ - _default_value, _flags), \ - .s_ctrl = _s_ctrl, \ - .g_ctrl = _g_ctrl, \ - } - -/* Value settings for Flash Time-out Duration*/ -#define LM3554_DEFAULT_TIMEOUT 512U -#define LM3554_MIN_TIMEOUT 32U -#define LM3554_MAX_TIMEOUT 1024U -#define LM3554_TIMEOUT_STEPSIZE 32U - -/* Flash modes */ -#define LM3554_MODE_SHUTDOWN 0 -#define LM3554_MODE_INDICATOR 1 -#define LM3554_MODE_TORCH 2 -#define LM3554_MODE_FLASH 3 - -/* timer delay time */ -#define LM3554_TIMER_DELAY 5 - -/* Percentage <-> value macros */ -#define LM3554_MIN_PERCENT 0U -#define LM3554_MAX_PERCENT 100U -#define LM3554_CLAMP_PERCENTAGE(val) \ - clamp(val, LM3554_MIN_PERCENT, LM3554_MAX_PERCENT) - -#define LM3554_VALUE_TO_PERCENT(v, step) (((((unsigned long)(v)) * (step)) + 50) / 100) -#define LM3554_PERCENT_TO_VALUE(p, step) (((((unsigned long)(p)) * 100) + (step >> 1)) / (step)) - -/* Product specific limits - * TODO: get these from platform data */ -#define LM3554_FLASH_MAX_LVL 0x0F /* 1191mA */ - -/* Flash brightness, input is percentage, output is [0..15] */ -#define LM3554_FLASH_STEP \ - ((100ul * (LM3554_MAX_PERCENT) + ((LM3554_FLASH_MAX_LVL) >> 1)) / ((LM3554_FLASH_MAX_LVL))) -#define LM3554_FLASH_DEFAULT_BRIGHTNESS \ - LM3554_VALUE_TO_PERCENT(13, LM3554_FLASH_STEP) - -/* Torch brightness, input is percentage, output is [0..7] */ -#define LM3554_TORCH_STEP 1250 -#define LM3554_TORCH_DEFAULT_BRIGHTNESS \ - LM3554_VALUE_TO_PERCENT(2, LM3554_TORCH_STEP) - -/* Indicator brightness, input is percentage, output is [0..3] */ -#define LM3554_INDICATOR_STEP 2500 -#define LM3554_INDICATOR_DEFAULT_BRIGHTNESS \ - LM3554_VALUE_TO_PERCENT(1, LM3554_INDICATOR_STEP) - -/* - * lm3554_platform_data - Flash controller platform data - */ -struct lm3554_platform_data { - struct gpio_desc *gpio_torch; - struct gpio_desc *gpio_strobe; - struct gpio_desc *gpio_reset; - - unsigned int current_limit; - unsigned int envm_tx2; - unsigned int tx2_polarity; -}; - -#endif /* _LM3554_H_ */ From patchwork Mon Apr 15 12:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629871 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 388D169D2C for ; Mon, 15 Apr 2024 12:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182585; cv=none; b=KJ4wS35sSMG01yogmbaxFV6fS3h0uJvKx7m8wMaoCRndvaWj4gkdn+MlknT22wb8U37+Uve+RkcNIiO2YU1qRGGOEStUtgiBqI4YfEiGUzAdPmQUXPLHaPpgHTlxHc0eivZ2usAIt3N/mTf+TwVx3ps7ADenstq1vAmgqT2+RP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182585; c=relaxed/simple; bh=RzcpKMiXmkKgWerMZ+T/YnspAcNE53yjOWw0HPdSfC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O75Uzz/5/P7rNDKaz9kZrxmEbiuuEzhwm7XH9v2r1xyBJmIm7FnSCrwgW0fVR2ZiQ8YXJ/TqZA8r0rt5I4ZN/UjWVkomn/j2OcLLNzcL/DprkCk2sIZWmOdDYgpAx9OqzHbHhwTtHD0QkWA6pDJ2QZTrZ7H63uQoBoMTOLV8Ruc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=M1yPEc8E; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="M1yPEc8E" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Euk+XHMkJouHBDFnSpR99VI4U8gTH+lkeZqF4iS19wQ=; b=M1yPEc8EJNKgK836INsHZU6mB+MAVS71l5J3XHbpD6HH1zLkFNU5iR6Qo87gRMxtKmrMPY E10kZ0DS+Vnky6LshG3FmbS4xhuYVQoQslURZZhPe5Sgom0in3c1/0ogREZ3aTQOOUFDOm 9Do1yCzTlDyLPxUESNT2eOka8PnZfik= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-oPyhIrAWO6u4e9iA4rmyjA-1; Mon, 15 Apr 2024 08:02:55 -0400 X-MC-Unique: oPyhIrAWO6u4e9iA4rmyjA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 751C438143AA; Mon, 15 Apr 2024 12:02:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F046C01595; Mon, 15 Apr 2024 12:02:53 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 14/23] media: atomisp: Drop custom flash support Date: Mon, 15 Apr 2024 14:02:11 +0200 Message-ID: <20240415120220.219480-15-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Remove the custom flash handling from the atomisp driver. There are only very few Bay Trail / Cherry Trail devices with flash and if those will ever get supported then this should be done through the new standard include/linux/led-class-flash.h APIs instead of with atomisp specific custom APIs. Signed-off-by: Hans de Goede --- .../media/atomisp/include/linux/atomisp.h | 42 ------- .../atomisp/include/linux/atomisp_platform.h | 1 - .../staging/media/atomisp/pci/atomisp_cmd.c | 117 +----------------- .../staging/media/atomisp/pci/atomisp_cmd.h | 4 - .../staging/media/atomisp/pci/atomisp_fops.c | 14 --- .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 61 --------- .../media/atomisp/pci/atomisp_subdev.h | 13 -- .../staging/media/atomisp/pci/atomisp_v4l2.c | 7 -- .../media/atomisp/pci/ia_css_frame_public.h | 8 -- .../media/atomisp/pci/ia_css_stream_public.h | 14 --- drivers/staging/media/atomisp/pci/sh_css.c | 33 ----- 12 files changed, 2 insertions(+), 313 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h index b2735a008052..db0c1b87c9ef 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -614,26 +614,6 @@ enum atomisp_camera_port { ATOMISP_CAMERA_NR_PORTS }; -/* Flash modes. Default is off. - * Setting a flash to TORCH or INDICATOR mode will automatically - * turn it on. Setting it to FLASH mode will not turn on the flash - * until the FLASH_STROBE command is sent. */ -enum atomisp_flash_mode { - ATOMISP_FLASH_MODE_OFF, - ATOMISP_FLASH_MODE_FLASH, - ATOMISP_FLASH_MODE_TORCH, - ATOMISP_FLASH_MODE_INDICATOR, -}; - -/* Flash statuses, used by atomisp driver to check before starting - * flash and after having started flash. */ -enum atomisp_flash_status { - ATOMISP_FLASH_STATUS_OK, - ATOMISP_FLASH_STATUS_HW_ERROR, - ATOMISP_FLASH_STATUS_INTERRUPTED, - ATOMISP_FLASH_STATUS_TIMEOUT, -}; - /* Frame status. This is used to detect corrupted frames and flash * exposed frames. Usually, the first 2 frames coming out of the sensor * are corrupted. When using flash, the frame before and the frame after @@ -661,7 +641,6 @@ enum atomisp_ext_isp_id { EXT_ISP_CID_AF_STATUS, EXT_ISP_CID_GET_AF_MODE, EXT_ISP_CID_CAPTURE_BURST, - EXT_ISP_CID_FLASH_MODE, EXT_ISP_CID_ZOOM, EXT_ISP_CID_SHOT_MODE }; @@ -694,12 +673,6 @@ enum atomisp_burst_capture_options { EXT_ISP_BURST_CAPTURE_CTRL_STOP }; -#define EXT_ISP_FLASH_MODE_OFF 0 -#define EXT_ISP_FLASH_MODE_ON 1 -#define EXT_ISP_FLASH_MODE_AUTO 2 -#define EXT_ISP_LED_TORCH_OFF 3 -#define EXT_ISP_LED_TORCH_ON 4 - #define EXT_ISP_SHOT_MODE_AUTO 0 #define EXT_ISP_SHOT_MODE_BEAUTY_FACE 1 #define EXT_ISP_SHOT_MODE_BEST_PHOTO 2 @@ -894,18 +867,6 @@ enum atomisp_burst_capture_options { * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */ #define V4L2_CID_CAMERA_LASTP1 (V4L2_CID_CAMERA_CLASS_BASE + 1024) -/* Flash related CIDs, see also: - * http://linuxtv.org/downloads/v4l-dvb-apis/extended-controls.html\ - * #flash-controls */ - -/* Request a number of flash-exposed frames. The frame status can be - * found in the reserved field in the v4l2_buffer struct. */ -#define V4L2_CID_REQUEST_FLASH (V4L2_CID_CAMERA_LASTP1 + 3) -/* Query flash driver status. See enum atomisp_flash_status above. */ -#define V4L2_CID_FLASH_STATUS (V4L2_CID_CAMERA_LASTP1 + 5) -/* Set the flash mode (see enum atomisp_flash_mode) */ -#define V4L2_CID_FLASH_MODE (V4L2_CID_CAMERA_LASTP1 + 10) - #define V4L2_CID_RUN_MODE (V4L2_CID_CAMERA_LASTP1 + 20) #define ATOMISP_RUN_MODE_VIDEO 1 #define ATOMISP_RUN_MODE_STILL_CAPTURE 2 @@ -925,9 +886,6 @@ enum atomisp_burst_capture_options { #define ATOMISP_VFPP_DISABLE_SCALER 1 #define ATOMISP_VFPP_DISABLE_LOWLAT 2 -/* Query real flash status register value */ -#define V4L2_CID_FLASH_STATUS_REGISTER (V4L2_CID_CAMERA_LASTP1 + 26) - #define V4L2_CID_START_ZSL_CAPTURE (V4L2_CID_CAMERA_LASTP1 + 28) /* Lock and unlock raw buffer */ #define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index 63dd7236e3a8..8060db0e0c5f 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -111,7 +111,6 @@ enum atomisp_input_format { enum intel_v4l2_subdev_type { RAW_CAMERA = 1, - LED_FLASH = 2, }; struct intel_v4l2_subdev_id { diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 4505261a563f..f5a578a9c588 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -61,14 +61,6 @@ #include "ia_css_debug.h" #include "bits.h" -/* We should never need to run the flash for more than 2 frames. - * At 15fps this means 133ms. We set the timeout a bit longer. - * Each flash driver is supposed to set its own timeout, but - * just in case someone else changed the timeout, we set it - * here to make sure we don't damage the flash hardware. - */ -#define FLASH_TIMEOUT 800 /* ms */ - union host { struct { void *kernel_ptr; @@ -677,7 +669,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, struct atomisp_metadata_buf *md_buf = NULL, *_md_buf_tmp, *md_iter; enum atomisp_metadata_type md_type; struct atomisp_device *isp = asd->isp; - struct v4l2_control ctrl; int i, err; lockdep_assert_held(&isp->mutex); @@ -792,19 +783,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, dev_dbg(isp->dev, "%s: vf frame with exp_id %d is ready\n", __func__, frame->exp_id); - if (asd->params.flash_state == ATOMISP_FLASH_ONGOING) { - if (frame->flash_state - == IA_CSS_FRAME_FLASH_STATE_PARTIAL) - dev_dbg(isp->dev, "%s thumb partially flashed\n", - __func__); - else if (frame->flash_state - == IA_CSS_FRAME_FLASH_STATE_FULL) - dev_dbg(isp->dev, "%s thumb completely flashed\n", - __func__); - else - dev_dbg(isp->dev, "%s thumb no flash in this frame\n", - __func__); - } pipe->frame_config_id[frame->vb.vb2_buf.index] = frame->isp_config_id; break; case IA_CSS_BUFFER_TYPE_OUTPUT_FRAME: @@ -835,40 +813,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, } pipe->frame_config_id[i] = frame->isp_config_id; - ctrl.id = V4L2_CID_FLASH_MODE; - if (asd->params.flash_state == ATOMISP_FLASH_ONGOING) { - if (frame->flash_state == IA_CSS_FRAME_FLASH_STATE_PARTIAL) { - asd->frame_status[i] = ATOMISP_FRAME_STATUS_FLASH_PARTIAL; - dev_dbg(isp->dev, "%s partially flashed\n", __func__); - } else if (frame->flash_state == IA_CSS_FRAME_FLASH_STATE_FULL) { - asd->frame_status[i] = ATOMISP_FRAME_STATUS_FLASH_EXPOSED; - asd->params.num_flash_frames--; - dev_dbg(isp->dev, "%s completely flashed\n", __func__); - } else { - asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; - dev_dbg(isp->dev, "%s no flash in this frame\n", __func__); - } - - /* Check if flashing sequence is done */ - if (asd->frame_status[i] == ATOMISP_FRAME_STATUS_FLASH_EXPOSED) - asd->params.flash_state = ATOMISP_FLASH_DONE; - } else if (isp->flash) { - if (v4l2_g_ctrl(isp->flash->ctrl_handler, &ctrl) == 0 && - ctrl.value == ATOMISP_FLASH_MODE_TORCH) { - ctrl.id = V4L2_CID_FLASH_TORCH_INTENSITY; - if (v4l2_g_ctrl(isp->flash->ctrl_handler, &ctrl) == 0 && - ctrl.value > 0) - asd->frame_status[i] = ATOMISP_FRAME_STATUS_FLASH_EXPOSED; - else - asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; - } else { - asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; - } - } else { - asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; - } - - asd->params.last_frame_status = asd->frame_status[i]; + asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; if (asd->params.css_update_params_needed) { atomisp_apply_css_parameters(asd, @@ -1011,36 +956,6 @@ void atomisp_assert_recovery_work(struct work_struct *work) mutex_unlock(&isp->mutex); } -void atomisp_setup_flash(struct atomisp_sub_device *asd) -{ - struct atomisp_device *isp = asd->isp; - struct v4l2_control ctrl; - - if (!isp->flash) - return; - - if (asd->params.flash_state != ATOMISP_FLASH_REQUESTED && - asd->params.flash_state != ATOMISP_FLASH_DONE) - return; - - if (asd->params.num_flash_frames) { - /* make sure the timeout is set before setting flash mode */ - ctrl.id = V4L2_CID_FLASH_TIMEOUT; - ctrl.value = FLASH_TIMEOUT; - - if (v4l2_s_ctrl(NULL, isp->flash->ctrl_handler, &ctrl)) { - dev_err(isp->dev, "flash timeout configure failed\n"); - return; - } - - ia_css_stream_request_flash(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream); - - asd->params.flash_state = ATOMISP_FLASH_ONGOING; - } else { - asd->params.flash_state = ATOMISP_FLASH_IDLE; - } -} - irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) { struct atomisp_device *isp = isp_ptr; @@ -1083,14 +998,8 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) * time, instead, dequue one and process one, then another */ mutex_lock(&isp->mutex); - if (atomisp_css_isr_thread(isp)) - goto out; - - if (isp->asd.streaming) - atomisp_setup_flash(&isp->asd); -out: + atomisp_css_isr_thread(isp); mutex_unlock(&isp->mutex); - dev_dbg(isp->dev, "<%s\n", __func__); return IRQ_HANDLED; } @@ -4580,28 +4489,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, return ret; } -int atomisp_flash_enable(struct atomisp_sub_device *asd, int num_frames) -{ - struct atomisp_device *isp = asd->isp; - - if (num_frames < 0) { - dev_dbg(isp->dev, "%s ERROR: num_frames: %d\n", __func__, - num_frames); - return -EINVAL; - } - /* a requested flash is still in progress. */ - if (num_frames && asd->params.flash_state != ATOMISP_FLASH_IDLE) { - dev_dbg(isp->dev, "%s flash busy: %d frames left: %d\n", - __func__, asd->params.flash_state, - asd->params.num_flash_frames); - return -EBUSY; - } - - asd->params.num_flash_frames = num_frames; - asd->params.flash_state = ATOMISP_FLASH_REQUESTED; - return 0; -} - static int __checking_exp_id(struct atomisp_sub_device *asd, int exp_id) { struct atomisp_device *isp = asd->isp; diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h index 03703eed86fa..e69ca14645b9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h @@ -58,7 +58,6 @@ void atomisp_clear_css_buffer_counters(struct atomisp_sub_device *asd); void atomisp_msi_irq_init(struct atomisp_device *isp); void atomisp_msi_irq_uninit(struct atomisp_device *isp); void atomisp_assert_recovery_work(struct work_struct *work); -void atomisp_setup_flash(struct atomisp_sub_device *asd); irqreturn_t atomisp_isr(int irq, void *dev); irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr); const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mbus( @@ -262,9 +261,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, void atomisp_free_internal_buffers(struct atomisp_sub_device *asd); -int atomisp_flash_enable(struct atomisp_sub_device *asd, - int num_frames); - int atomisp_freq_scaling(struct atomisp_device *vdev, enum atomisp_dfs_mode mode, bool force); diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index b464a6bd0bad..0d0c1649eaad 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -520,21 +520,12 @@ static int atomisp_open(struct file *file) } atomisp_dev_init_struct(isp); - - ret = v4l2_subdev_call(isp->flash, core, s_power, 1); - if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD) { - dev_err(isp->dev, "Failed to power-on flash\n"); - goto css_error; - } - atomisp_subdev_init_struct(asd); pipe->users++; mutex_unlock(&isp->mutex); return 0; -css_error: - pm_runtime_put(vdev->v4l2_dev->dev); error: mutex_unlock(&isp->mutex); v4l2_fh_release(file); @@ -549,7 +540,6 @@ static int atomisp_release(struct file *file) struct atomisp_sub_device *asd = pipe->asd; struct v4l2_subdev_fh fh; struct v4l2_rect clear_compose = {0}; - int ret; v4l2_fh_init(&fh.vfh, vdev); @@ -584,10 +574,6 @@ static int atomisp_release(struct file *file) atomisp_destroy_pipes_stream(asd); - ret = v4l2_subdev_call(isp->flash, core, s_power, 0); - if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD) - dev_warn(isp->dev, "Failed to power-off flash\n"); - if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0) dev_err(isp->dev, "Failed to power off device\n"); diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index 54ab872b91ee..d021c26aacd7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -200,7 +200,6 @@ struct atomisp_device { struct v4l2_subdev *sensor_subdevs[ATOMISP_CAMERA_NR_PORTS]; unsigned int input_cnt; struct atomisp_input_subdev inputs[ATOM_ISP_MAX_INPUTS]; - struct v4l2_subdev *flash; struct atomisp_regs saved_regs; struct atomisp_css_env css_env; diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index 8ef8cbc3b7a7..e243faec143e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -136,15 +136,6 @@ static struct v4l2_queryctrl ci_v4l2_controls[] = { .step = 1, .default_value = 0, }, - { - .id = V4L2_CID_REQUEST_FLASH, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Request flash frames", - .minimum = 0, - .maximum = 10, - .step = 1, - .default_value = 1, - }, { .id = V4L2_CID_ATOMISP_LOW_LIGHT, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -956,12 +947,6 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count) atomisp_qbuffers_to_css(asd); - if (isp->flash) { - asd->params.num_flash_frames = 0; - asd->params.flash_state = ATOMISP_FLASH_IDLE; - atomisp_setup_flash(asd); - } - atomisp_css_irq_enable(isp, IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF, atomisp_css_valid_sof(isp)); atomisp_csi2_configure(asd); @@ -1039,11 +1024,6 @@ void atomisp_stop_streaming(struct vb2_queue *vq) if (ret) dev_warn(isp->dev, "Stopping sensor stream failed: %d\n", ret); - if (isp->flash) { - asd->params.num_flash_frames = 0; - asd->params.flash_state = ATOMISP_FLASH_IDLE; - } - /* Disable the CSI interface on ANN B0/K0 */ if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 << ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) { @@ -1165,9 +1145,6 @@ static int atomisp_s_ctrl(struct file *file, void *fh, case V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION: ret = atomisp_false_color(asd, 1, &control->value); break; - case V4L2_CID_REQUEST_FLASH: - ret = atomisp_flash_enable(asd, control->value); - break; case V4L2_CID_ATOMISP_LOW_LIGHT: ret = atomisp_low_light(asd, 1, &control->value); break; @@ -1212,7 +1189,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, { struct video_device *vdev = video_devdata(file); struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; - struct atomisp_device *isp = video_get_drvdata(vdev); struct v4l2_control ctrl; int i; int ret = 0; @@ -1221,19 +1197,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, ctrl.id = c->controls[i].id; ctrl.value = c->controls[i].value; switch (ctrl.id) { - case V4L2_CID_FLASH_STATUS: - case V4L2_CID_FLASH_INTENSITY: - case V4L2_CID_FLASH_TORCH_INTENSITY: - case V4L2_CID_FLASH_INDICATOR_INTENSITY: - case V4L2_CID_FLASH_TIMEOUT: - case V4L2_CID_FLASH_STROBE: - case V4L2_CID_FLASH_MODE: - case V4L2_CID_FLASH_STATUS_REGISTER: - if (isp->flash) - ret = - v4l2_g_ctrl(isp->flash->ctrl_handler, - &ctrl); - break; case V4L2_CID_ZOOM_ABSOLUTE: ret = atomisp_digital_zoom(asd, 0, &ctrl.value); break; @@ -1283,7 +1246,6 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, { struct video_device *vdev = video_devdata(file); struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; - struct atomisp_device *isp = video_get_drvdata(vdev); struct v4l2_control ctrl; int i; int ret = 0; @@ -1294,29 +1256,6 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, ctrl.id = c->controls[i].id; ctrl.value = c->controls[i].value; switch (ctrl.id) { - case V4L2_CID_FLASH_STATUS: - case V4L2_CID_FLASH_INTENSITY: - case V4L2_CID_FLASH_TORCH_INTENSITY: - case V4L2_CID_FLASH_INDICATOR_INTENSITY: - case V4L2_CID_FLASH_TIMEOUT: - case V4L2_CID_FLASH_STROBE: - case V4L2_CID_FLASH_MODE: - case V4L2_CID_FLASH_STATUS_REGISTER: - if (isp->flash) { - ret = - v4l2_s_ctrl(NULL, isp->flash->ctrl_handler, - &ctrl); - /* - * When flash mode is changed we need to reset - * flash state - */ - if (ctrl.id == V4L2_CID_FLASH_MODE) { - asd->params.flash_state = - ATOMISP_FLASH_IDLE; - asd->params.num_flash_frames = 0; - } - } - break; case V4L2_CID_ZOOM_ABSOLUTE: ret = atomisp_digital_zoom(asd, 1, &ctrl.value); break; diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h index bcfa829dbf61..4ab123a1c165 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -108,14 +108,6 @@ struct atomisp_pad_format { struct v4l2_rect compose; }; -/* Internal states for flash process */ -enum atomisp_flash_state { - ATOMISP_FLASH_IDLE, - ATOMISP_FLASH_REQUESTED, - ATOMISP_FLASH_ONGOING, - ATOMISP_FLASH_DONE -}; - /* * This structure is used to cache the CSS parameters, it aligns to * struct ia_css_isp_config but without un-supported and deprecated parts. @@ -221,11 +213,6 @@ struct atomisp_subdev_params { int dvs_ver_proj_bytes; int dvs_hor_proj_bytes; - /* Flash */ - int num_flash_frames; - enum atomisp_flash_state flash_state; - enum atomisp_frame_status last_frame_status; - /* Flag to check if driver needs to update params to css */ bool css_update_params_needed; }; diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 0069b547754d..4c3d55301089 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -825,13 +825,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) isp->sensor_lanes[mipi_port] = subdevs->lanes; isp->sensor_subdevs[subdevs->port] = subdevs->subdev; break; - case LED_FLASH: - if (isp->flash) { - dev_warn(isp->dev, "too many atomisp flash devices\n"); - continue; - } - isp->flash = subdevs->subdev; - break; default: dev_dbg(isp->dev, "unknown subdev probed\n"); break; diff --git a/drivers/staging/media/atomisp/pci/ia_css_frame_public.h b/drivers/staging/media/atomisp/pci/ia_css_frame_public.h index 7ba464abf447..a26d9598e400 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_frame_public.h +++ b/drivers/staging/media/atomisp/pci/ia_css_frame_public.h @@ -137,12 +137,6 @@ enum ia_css_frame_delay { IA_CSS_FRAME_DELAY_2 /** Frame delay = 2 */ }; -enum ia_css_frame_flash_state { - IA_CSS_FRAME_FLASH_STATE_NONE, - IA_CSS_FRAME_FLASH_STATE_PARTIAL, - IA_CSS_FRAME_FLASH_STATE_FULL -}; - /* Frame structure. This structure describes an image buffer or frame. * This is the main structure used for all input and output images. */ @@ -176,7 +170,6 @@ struct ia_css_frame { * binary, we use output port, but we expect VF_OUTPUT_DONE event */ enum ia_css_buffer_type buf_type; - enum ia_css_frame_flash_state flash_state; unsigned int exp_id; /** exposure id, see ia_css_event_public.h for more detail */ u32 isp_config_id; /** Unique ID to track which config was actually applied to a particular frame */ @@ -202,7 +195,6 @@ struct ia_css_frame { .frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .dynamic_queue_id = SH_CSS_INVALID_QUEUE_ID, \ .buf_type = IA_CSS_BUFFER_TYPE_INVALID, \ - .flash_state = IA_CSS_FRAME_FLASH_STATE_NONE, \ } /* @brief Allocate a CSS frame structure diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream_public.h b/drivers/staging/media/atomisp/pci/ia_css_stream_public.h index 888f54d8495e..961c61288083 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_stream_public.h +++ b/drivers/staging/media/atomisp/pci/ia_css_stream_public.h @@ -457,20 +457,6 @@ ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream, void ia_css_stream_end_input_frame(const struct ia_css_stream *stream); -/* @brief send a request flash command to SP - * - * @param[in] stream The stream. - * @return None - * - * Driver needs to call this function to send a flash request command - * to SP, SP will be responsible for switching on/off the flash at proper - * time. Due to the SP multi-threading environment, this request may have - * one-frame delay, the driver needs to check the flashed flag in frame info - * to determine which frame is being flashed. - */ -void -ia_css_stream_request_flash(struct ia_css_stream *stream); - /* @brief Configure a stream with filter coefficients. * @deprecated {Replaced by * ia_css_pipe_set_isp_config_on_pipe()} diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 22c8cdcb2eb8..6520a35b6e47 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -2834,7 +2834,6 @@ init_vf_frameinfo_defaults(struct ia_css_pipe *pipe, assert(vf_frame); sh_css_pipe_get_viewfinder_frame_info(pipe, &vf_frame->frame_info, idx); - vf_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE; ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME + idx, thread_id, &queue_id); vf_frame->dynamic_queue_id = queue_id; @@ -3012,7 +3011,6 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe, in_frame->frame_info.raw_bit_depth = ia_css_pipe_util_pipe_input_format_bpp(pipe); ia_css_frame_info_set_width(&in_frame->frame_info, pipe->stream->config.input_config.input_res.width, 0); - in_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE; ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_INPUT_FRAME, thread_id, &queue_id); in_frame->dynamic_queue_id = queue_id; @@ -3040,7 +3038,6 @@ init_out_frameinfo_defaults(struct ia_css_pipe *pipe, assert(out_frame); sh_css_pipe_get_output_frame_info(pipe, &out_frame->frame_info, idx); - out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE; ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_OUTPUT_FRAME + idx, thread_id, &queue_id); out_frame->dynamic_queue_id = queue_id; @@ -3821,12 +3818,6 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, buffer->exp_id = ddr_buffer.payload.frame.exp_id; frame->exp_id = ddr_buffer.payload.frame.exp_id; frame->isp_config_id = ddr_buffer.payload.frame.isp_parameters_id; - if (ddr_buffer.payload.frame.flashed == 1) - frame->flash_state = - IA_CSS_FRAME_FLASH_STATE_PARTIAL; - if (ddr_buffer.payload.frame.flashed == 2) - frame->flash_state = - IA_CSS_FRAME_FLASH_STATE_FULL; frame->valid = pipe->num_invalid_frames == 0; if (!frame->valid) pipe->num_invalid_frames--; @@ -6788,8 +6779,6 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe, ia_css_pipeline_clean(me); /* Construct out_frame info */ - out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE; - if (copy_on_sp(pipe) && pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) { ia_css_frame_info_init(&out_frame->frame_info, JPEG_BYTES, 1, @@ -6837,7 +6826,6 @@ create_host_isyscopy_capture_pipeline(struct ia_css_pipe *pipe) err = sh_css_pipe_get_output_frame_info(pipe, &out_frame->frame_info, 0); if (err) return err; - out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE; ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_OUTPUT_FRAME, thread_id, &queue_id); out_frame->dynamic_queue_id = queue_id; @@ -7492,27 +7480,6 @@ int ia_css_stream_capture(struct ia_css_stream *stream, int num_captures, return return_err; } -void ia_css_stream_request_flash(struct ia_css_stream *stream) -{ - (void)stream; - - assert(stream); - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, - "ia_css_stream_request_flash() enter: void\n"); - - if (!IS_ISP2401 || sh_css_sp_is_running()) { - if (!sh_css_write_host2sp_command(host2sp_cmd_start_flash) && IS_ISP2401) { - IA_CSS_ERROR("Call to 'sh-css_write_host2sp_command()' failed"); - ia_css_debug_dump_sp_sw_debug_info(); - } - } else { - IA_CSS_LOG("SP is not running!"); - } - - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, - "ia_css_stream_request_flash() leave: return_void\n"); -} - static void sh_css_init_host_sp_control_vars(void) { From patchwork Mon Apr 15 12:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629868 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CBD569D27 for ; Mon, 15 Apr 2024 12:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182582; cv=none; b=S8na9AEhtn4BIOvsDeU3z4MEobN0g7Y1AtsrBnOhq7bfrLfxUzQMaBmTsYbExeRkiqVdL/Ahp9KyJLm7ZVhyDAvsm5sLIbYK8KuzmNJuqhipuvlRd/7X7dJosasG7589XGHV/qcQzWqBalx25v+p8uKLGdAcMf787GN2XPepA3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182582; c=relaxed/simple; bh=+CtNWgYGWpP5j42MzV1exFGOYqUCCjUktCEoxWwY7SA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vELWATaMCKZjCpRMOpfNPBB5rdLpD5Nk5+soV2YvfIO+zcanYKhauNWxnvgyXsAKygj+veu8xTOXlKudWbtvfxn2OJd80RglAJaCNbOmiGx9rNkKbANZBFt8uIqB1Z4B0Qf1PkAwlU5+lLuJRO++XLWFRrtpGXNBMvZTG2Wq/VA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OyWDz+ik; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OyWDz+ik" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=97szRONu3Y+HNfKnkwz8oaUzYMNxyyfzc++oFrEsKFA=; b=OyWDz+ikW22O6rw1yvWO4WFt+fWaPhD5hil5JEWI7ZQ95R7WvVizReWVaRLRoT6jko/E9F oEAbSkHS1ChSKaJGR/rJHB2jdWMsoNQaTHqMOl2w2v08u8hy8P3fnYu4cfy6cVQ3IbyWzG yAxTfuDlRIBcqbEeVsb9fMYoYJpocR8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-5ZMAqZ0kPbqrWJVl7CEV6Q-1; Mon, 15 Apr 2024 08:02:56 -0400 X-MC-Unique: 5ZMAqZ0kPbqrWJVl7CEV6Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDEE929AA2CD; Mon, 15 Apr 2024 12:02:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6AC3C13FA1; Mon, 15 Apr 2024 12:02:54 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 15/23] media: atomisp: Drop unused frame_status tracking Date: Mon, 15 Apr 2024 14:02:12 +0200 Message-ID: <20240415120220.219480-16-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 After removing the flash support frame_status now always is ATOMISP_FRAME_STATUS_OK aka 0. Drop frame_status tracking. This also means one less atomisp custom use for the vb2_buffer->reserved* fields (all custom use of these fields should be removed). While at it also remove the no longer used vf_frame pointer from struct atomisp_sub_device. Signed-off-by: Hans de Goede --- .../staging/media/atomisp/include/linux/atomisp.h | 15 --------------- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 1 - drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 12 ++---------- .../staging/media/atomisp/pci/atomisp_subdev.h | 3 --- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp.h b/drivers/staging/media/atomisp/include/linux/atomisp.h index db0c1b87c9ef..16c9da172c03 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp.h @@ -614,21 +614,6 @@ enum atomisp_camera_port { ATOMISP_CAMERA_NR_PORTS }; -/* Frame status. This is used to detect corrupted frames and flash - * exposed frames. Usually, the first 2 frames coming out of the sensor - * are corrupted. When using flash, the frame before and the frame after - * the flash exposed frame may be partially exposed by flash. The ISP - * statistics for these frames should not be used by the 3A library. - * The frame status value can be found in the "reserved" field in the - * v4l2_buffer struct. */ -enum atomisp_frame_status { - ATOMISP_FRAME_STATUS_OK, - ATOMISP_FRAME_STATUS_CORRUPTED, - ATOMISP_FRAME_STATUS_FLASH_EXPOSED, - ATOMISP_FRAME_STATUS_FLASH_PARTIAL, - ATOMISP_FRAME_STATUS_FLASH_FAILED, -}; - enum atomisp_ext_isp_id { EXT_ISP_CID_ISO = 0, EXT_ISP_CID_CAPTURE_HDR, diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index f5a578a9c588..335f142c1fc5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -813,7 +813,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, } pipe->frame_config_id[i] = frame->isp_config_id; - asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; if (asd->params.css_update_params_needed) { atomisp_apply_css_parameters(asd, diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index e243faec143e..d7c842997139 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -826,7 +826,6 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer { struct video_device *vdev = video_devdata(file); struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); - struct atomisp_sub_device *asd = pipe->asd; struct atomisp_device *isp = video_get_drvdata(vdev); struct ia_css_frame *frame; struct vb2_buffer *vb; @@ -839,15 +838,8 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer vb = vb2_get_buffer(&pipe->vb_queue, buf->index); frame = vb_to_frame(vb); - buf->reserved = asd->frame_status[buf->index]; - - /* - * Hack: - * Currently frame_status in the enum type which takes no more lower - * 8 bit. - * use bit[31:16] for exp_id as it is only in the range of 1~255 - */ - buf->reserved &= 0x0000ffff; + /* reserved bit[31:16] is used for exp_id */ + buf->reserved = 0; if (!(buf->flags & V4L2_BUF_FLAG_ERROR)) buf->reserved |= frame->exp_id; buf->reserved2 = pipe->frame_config_id[buf->index]; diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h index 4ab123a1c165..b6c66a5d523c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h @@ -274,9 +274,6 @@ struct atomisp_sub_device { struct list_head dis_stats_in_css; spinlock_t dis_stats_lock; - struct ia_css_frame *vf_frame; /* TODO: needed? */ - enum atomisp_frame_status frame_status[VIDEO_MAX_FRAME]; - /* This field specifies which camera (v4l2 input) is selected. */ int input_curr; From patchwork Mon Apr 15 12:02:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629869 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 032EF6A8A8 for ; Mon, 15 Apr 2024 12:03:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182584; cv=none; b=WHgpggqBJnPqG/yv0V5QPqhk8xRjgvWAuzglaAG7ZodMddtVj642L/oYE4DQNcxjIJ/1wQwNGtuf3+ZLq/jfdu8WnOWDT1hfRAMOD9VMkUlt50+Pzrb/LvowotKd63glzGNypCZ1WrSfL60Vmj0gZrzQk7dJtCIDC0sYLKqlU8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182584; c=relaxed/simple; bh=io4p/xGKofzGg1VLrRaY16usZNLDtjF2Mp1dY4+N+SQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=epJOWmpJqqYtMi1XIvs+kdIsiRUUwnd9lpeBCHsSHvOBTYCc5kc8lsqTGgwkDBwbGKO1HxR8d3NqPGXooOKaVbROOMbgZL0pIstZ9TADWM++Cls4NHXKv5rwFfBNLCW4QymDtdMVtlzBntYBA6CUEwZcCLatZ+TY9IJm4fVl0oU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=QcdJkvYO; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QcdJkvYO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YicPWuxNSGhGs8XNVS/NeHX9jQLt9CWfLI8HHlUtwRM=; b=QcdJkvYOiIclrYN2OjmyXMZOUmRCNnFKjf4d955+j9SKQp7B6OKJsY/uwSLqWyFBMtsz3L qhpsd8+Cx62dqC+4nDeU/4EW/LwyfcurgHqOMKTSTStNIRg8Uqasb0oLW98yqLydG3acYW QltFp8ESjy4j7PQxamsrGWqgCm8YDSU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-D7L_AS0gOkqnhpzeydiLag-1; Mon, 15 Apr 2024 08:02:57 -0400 X-MC-Unique: D7L_AS0gOkqnhpzeydiLag-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5715738143AF; Mon, 15 Apr 2024 12:02:57 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CBC7C13FA2; Mon, 15 Apr 2024 12:02:56 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 16/23] media: atomisp: Drop intel_v4l2_subdev_type Date: Mon, 15 Apr 2024 14:02:13 +0200 Message-ID: <20240415120220.219480-17-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 intel_v4l2_subdev_type / atomisp_input_subdev.type now always is RAW_CAMERA, drop it. Signed-off-by: Hans de Goede --- .../media/atomisp/i2c/atomisp-gc2235.c | 2 +- .../media/atomisp/i2c/atomisp-mt9m114.c | 2 +- .../media/atomisp/i2c/atomisp-ov2722.c | 2 +- .../include/linux/atomisp_gmin_platform.h | 3 +- .../atomisp/include/linux/atomisp_platform.h | 11 ------ .../media/atomisp/pci/atomisp_gmin_platform.c | 16 +++------ .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 1 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 36 ++++++++----------- 9 files changed, 23 insertions(+), 51 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c index bec4c5615864..994b8bceb4f5 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c @@ -852,7 +852,7 @@ static int gc2235_probe(struct i2c_client *client) if (ret) gc2235_remove(client); - return atomisp_register_i2c_module(&dev->sd, gcpdev, RAW_CAMERA); + return atomisp_register_i2c_module(&dev->sd, gcpdev); out_free: v4l2_device_unregister_subdev(&dev->sd); diff --git a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c index 20f02d18a8de..03ebee976d5b 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c @@ -1552,7 +1552,7 @@ static int mt9m114_probe(struct i2c_client *client) return ret; } - ret = atomisp_register_i2c_module(&dev->sd, pdata, RAW_CAMERA); + ret = atomisp_register_i2c_module(&dev->sd, pdata); if (ret) { v4l2_device_unregister_subdev(&dev->sd); kfree(dev); diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c index d60630ea16df..c31a81d64950 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c @@ -992,7 +992,7 @@ static int ov2722_probe(struct i2c_client *client) if (ret) ov2722_remove(client); - return atomisp_register_i2c_module(&dev->sd, ovpdev, RAW_CAMERA); + return atomisp_register_i2c_module(&dev->sd, ovpdev); out_ctrl_handler_free: v4l2_ctrl_handler_free(&dev->ctrl_handler); diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h index 64bd54835c32..711e8fb3464f 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h @@ -19,8 +19,7 @@ #include "atomisp_platform.h" int atomisp_register_i2c_module(struct v4l2_subdev *subdev, - struct camera_sensor_platform_data *plat_data, - enum intel_v4l2_subdev_type type); + struct camera_sensor_platform_data *plat_data); int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd); int gmin_get_var_int(struct device *dev, bool is_gmin, const char *var, int def); diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index 8060db0e0c5f..51e7b199e005 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -109,18 +109,7 @@ enum atomisp_input_format { #define N_ATOMISP_INPUT_FORMAT (ATOMISP_INPUT_FORMAT_USER_DEF8 + 1) -enum intel_v4l2_subdev_type { - RAW_CAMERA = 1, -}; - -struct intel_v4l2_subdev_id { - char name[17]; - enum intel_v4l2_subdev_type type; - enum atomisp_camera_port port; -}; - struct intel_v4l2_subdev_table { - enum intel_v4l2_subdev_type type; enum atomisp_camera_port port; unsigned int lanes; struct v4l2_subdev *subdev; diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index a5e68b2cac50..aba69cf97785 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -126,7 +126,7 @@ static DEFINE_MUTEX(gmin_regulator_mutex); static int gmin_v1p8_enable_count; static int gmin_v2p8_enable_count; -/* The atomisp uses type==0 for the end-of-list marker, so leave space. */ +/* The atomisp uses subdev==NULL for the end-of-list marker, so leave space. */ static struct intel_v4l2_subdev_table pdata_subdevs[MAX_SUBDEVS + 1]; static const struct atomisp_platform_data pdata = { @@ -145,16 +145,13 @@ const struct atomisp_platform_data *atomisp_get_platform_data(void) EXPORT_SYMBOL_GPL(atomisp_get_platform_data); int atomisp_register_i2c_module(struct v4l2_subdev *subdev, - struct camera_sensor_platform_data *plat_data, - enum intel_v4l2_subdev_type type) + struct camera_sensor_platform_data *plat_data) { int i; struct gmin_subdev *gs; struct i2c_client *client = v4l2_get_subdevdata(subdev); struct acpi_device *adev = ACPI_COMPANION(&client->dev); - dev_info(&client->dev, "register atomisp i2c module type %d\n", type); - /* The windows driver model (and thus most BIOSes by default) * uses ACPI runtime power management for camera devices, but * we don't. Disable it, or else the rails will be needlessly @@ -172,10 +169,10 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, adev->power.flags.power_resources = 0; for (i = 0; i < MAX_SUBDEVS; i++) - if (!pdata.subdevs[i].type) + if (!pdata.subdevs[i].subdev) break; - if (pdata.subdevs[i].type) + if (i == MAX_SUBDEVS) return -ENOMEM; /* Note subtlety of initialization order: at the point where @@ -187,7 +184,6 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, if (!gs) return -ENODEV; - pdata.subdevs[i].type = type; pdata.subdevs[i].port = gs->csi_port; pdata.subdevs[i].lanes = gs->csi_lanes; pdata.subdevs[i].subdev = subdev; @@ -1136,7 +1132,7 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, } for (i = 0; i < MAX_SUBDEVS; i++) - if (!pdata.subdevs[i].type) + if (!pdata.subdevs[i].subdev) break; if (i >= MAX_SUBDEVS) { @@ -1148,7 +1144,6 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, if (ret) return ret; - pdata.subdevs[i].type = RAW_CAMERA; pdata.subdevs[i].port = port; pdata.subdevs[i].lanes = lanes; pdata.subdevs[i].subdev = subdev; @@ -1166,7 +1161,6 @@ void atomisp_unregister_subdev(struct v4l2_subdev *subdev) camera_sensor_csi_free(subdev); pdata.subdevs[i].subdev = NULL; - pdata.subdevs[i].type = 0; pdata.subdevs[i].port = 0; break; } diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index d021c26aacd7..9227399502b9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -121,7 +121,6 @@ round_down((2 * (n) + (d) * (step)) / (2 * (d)), (step)) struct atomisp_input_subdev { - unsigned int type; enum atomisp_camera_port port; u32 code; /* MEDIA_BUS_FMT_* */ bool binning_support; diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index d7c842997139..effc71b5a439 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -406,7 +406,6 @@ static int atomisp_enum_input(struct file *file, void *fh, input->type = V4L2_INPUT_TYPE_CAMERA; input->index = index; - input->reserved[0] = isp->inputs[index].type; input->reserved[1] = isp->inputs[index].port; return 0; diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 4c3d55301089..470c123256a7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -803,32 +803,25 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) * converting them to standard v4l2 sensor drivers using runtime-pm + * ACPI for pm and v4l2_async_register_subdev_sensor() registration. */ - for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) { + for (subdevs = pdata->subdevs; subdevs->subdev; ++subdevs) { ret = v4l2_device_register_subdev(&isp->v4l2_dev, subdevs->subdev); if (ret) continue; - switch (subdevs->type) { - case RAW_CAMERA: - if (subdevs->port >= ATOMISP_CAMERA_NR_PORTS) { - dev_err(isp->dev, "port %d not supported\n", subdevs->port); - break; - } - - if (isp->sensor_subdevs[subdevs->port]) { - dev_err(isp->dev, "port %d already has a sensor attached\n", - subdevs->port); - break; - } - - mipi_port = atomisp_port_to_mipi_port(isp, subdevs->port); - isp->sensor_lanes[mipi_port] = subdevs->lanes; - isp->sensor_subdevs[subdevs->port] = subdevs->subdev; - break; - default: - dev_dbg(isp->dev, "unknown subdev probed\n"); - break; + if (subdevs->port >= ATOMISP_CAMERA_NR_PORTS) { + dev_err(isp->dev, "port %d not supported\n", subdevs->port); + continue; } + + if (isp->sensor_subdevs[subdevs->port]) { + dev_err(isp->dev, "port %d already has a sensor attached\n", + subdevs->port); + continue; + } + + mipi_port = atomisp_port_to_mipi_port(isp, subdevs->port); + isp->sensor_lanes[mipi_port] = subdevs->lanes; + isp->sensor_subdevs[subdevs->port] = subdevs->subdev; } return atomisp_csi_lane_config(isp); @@ -1039,7 +1032,6 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) input = &isp->inputs[isp->input_cnt]; - input->type = RAW_CAMERA; input->port = i; input->camera = isp->sensor_subdevs[i]; input->csi_port = &isp->csi2_port[i].subdev; From patchwork Mon Apr 15 12:02:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629875 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E963E6D1A7 for ; Mon, 15 Apr 2024 12:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182589; cv=none; b=V+uXkc55GUh/sm3fnKQrkrMBQGi4MGsee7E7JmKe6MAa5bwbYGJm569IQoqaZREUJiBXX3AQehxkI0eIsAXEAcaTEQxD7A6k89RK4QvKsIc1Yd8XJJ2+GYy0Wfcpk8IgAVo6g5aIQVawLyLn626FqM98S3HzdDfjqAk1aoUIO+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182589; c=relaxed/simple; bh=TaB+/cqAPY2OKk4xB2AVQ7lJzMrfYJQAGsXq5ugtY1w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ry9X4rMjG2IeGADuDyupHKtc8dvGMAIMvYpY4OqmTJ+TKwYdym0BVcRS2HVIVbWmOrBB+bGiPDkbr1XB9L4tP0aiDXcC8aGq5DuVOmaAf5PXtxvTv472fM+zJnIRhCGN5EfLApYqbqcLFx3hDINhsXtpPZqldKk2A6jLZYGl0Qw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=geOBsizW; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="geOBsizW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m7NCgwC3XBVbL5XHa69mXFMIijUU/ioL2QzPflqh4FQ=; b=geOBsizW1HqfdqJqua0F5Thrh5ayGY4FS7Bu+tg/g2c+MV+fYMm+O5YsyITS4J3gNtUkho 9WjWtEbsGyiE4i442LsUOrxHaA4CFSdrwQLKpocRmSq+cH6kpylkh4Jsd40MdVzHGmk0az +e+kCr1mKddmNjLQSD9BX636B6kdCLI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-_mCXweOaP_WuWwCc0icTFg-1; Mon, 15 Apr 2024 08:02:59 -0400 X-MC-Unique: _mCXweOaP_WuWwCc0icTFg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C23CB1887313; Mon, 15 Apr 2024 12:02:58 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8941CC13FA1; Mon, 15 Apr 2024 12:02:57 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 17/23] media: atomisp: Remove gmin_platform VCM code. Date: Mon, 15 Apr 2024 14:02:14 +0200 Message-ID: <20240415120220.219480-18-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 VCM support has already been removed from the main atomisp driver in commit 7473c97dd8d0 ("media: atomisp: Remove custom VCM handling") remove the left-over dead VCM handling from the gmin platform code. Signed-off-by: Hans de Goede --- .../include/linux/atomisp_gmin_platform.h | 3 -- .../atomisp/include/linux/atomisp_platform.h | 21 --------- .../media/atomisp/pci/atomisp_gmin_platform.c | 47 ------------------- 3 files changed, 71 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h index 711e8fb3464f..ecd82220f04a 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h @@ -28,7 +28,4 @@ gmin_camera_platform_data( struct v4l2_subdev *subdev, enum atomisp_input_format csi_format, enum atomisp_bayer_order csi_bayer); - -int atomisp_gmin_register_vcm_control(struct camera_vcm_control *); - #endif diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index 51e7b199e005..098859bde86f 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -147,25 +147,6 @@ struct atomisp_input_stream_info { struct atomisp_isys_config_info isys_info[MAX_STREAMS_PER_CHANNEL]; }; -struct camera_vcm_control; -struct camera_vcm_ops { - int (*power_up)(struct v4l2_subdev *sd, struct camera_vcm_control *vcm); - int (*power_down)(struct v4l2_subdev *sd, - struct camera_vcm_control *vcm); - int (*queryctrl)(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc, - struct camera_vcm_control *vcm); - int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl, - struct camera_vcm_control *vcm); - int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl, - struct camera_vcm_control *vcm); -}; - -struct camera_vcm_control { - char camera_module[CAMERA_MODULE_ID_LEN]; - struct camera_vcm_ops *ops; - struct list_head list; -}; - struct camera_sensor_platform_data { int (*flisclk_ctrl)(struct v4l2_subdev *subdev, int flag); int (*csi_cfg)(struct v4l2_subdev *subdev, int flag); @@ -179,8 +160,6 @@ struct camera_sensor_platform_data { int (*v1p8_ctrl)(struct v4l2_subdev *subdev, int on); int (*v2p8_ctrl)(struct v4l2_subdev *subdev, int on); int (*v1p2_ctrl)(struct v4l2_subdev *subdev, int on); - struct camera_vcm_control *(*get_vcm_ctrl)(struct v4l2_subdev *subdev, - char *module_id); }; struct camera_mipi_info { diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index aba69cf97785..e12354820a3a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -75,7 +75,6 @@ struct gmin_subdev { struct regulator *v1p8_reg; struct regulator *v2p8_reg; struct regulator *v1p2_reg; - struct regulator *v2p8_vcm_reg; enum atomisp_camera_port csi_port; unsigned int csi_lanes; enum atomisp_input_format csi_fmt; @@ -85,7 +84,6 @@ struct gmin_subdev { bool v1p8_on; bool v2p8_on; bool v1p2_on; - bool v2p8_vcm_on; int v1p8_gpio; int v2p8_gpio; @@ -133,9 +131,6 @@ static const struct atomisp_platform_data pdata = { .subdevs = pdata_subdevs, }; -static LIST_HEAD(vcm_devices); -static DEFINE_MUTEX(vcm_lock); - static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev); const struct atomisp_platform_data *atomisp_get_platform_data(void) @@ -214,7 +209,6 @@ int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd) regulator_put(gmin_subdevs[i].v1p8_reg); regulator_put(gmin_subdevs[i].v2p8_reg); regulator_put(gmin_subdevs[i].v1p2_reg); - regulator_put(gmin_subdevs[i].v2p8_vcm_reg); } gmin_subdevs[i].subdev = NULL; } @@ -664,7 +658,6 @@ static int gmin_subdev_add(struct gmin_subdev *gs) gs->v2p8_reg = regulator_get(dev, "V2P8SX"); gs->v1p2_reg = regulator_get(dev, "V1P2A"); - gs->v2p8_vcm_reg = regulator_get(dev, "VPROG4B"); /* Note: ideally we would initialize v[12]p8_on to the * output of regulator_is_enabled(), but sadly that @@ -1167,31 +1160,6 @@ void atomisp_unregister_subdev(struct v4l2_subdev *subdev) } EXPORT_SYMBOL_GPL(atomisp_unregister_subdev); -static struct camera_vcm_control *gmin_get_vcm_ctrl(struct v4l2_subdev *subdev, - char *camera_module) -{ - struct i2c_client *client = v4l2_get_subdevdata(subdev); - struct gmin_subdev *gs = find_gmin_subdev(subdev); - struct camera_vcm_control *vcm; - - if (!client || !gs) - return NULL; - - if (!camera_module) - return NULL; - - mutex_lock(&vcm_lock); - list_for_each_entry(vcm, &vcm_devices, list) { - if (!strcmp(camera_module, vcm->camera_module)) { - mutex_unlock(&vcm_lock); - return vcm; - } - } - - mutex_unlock(&vcm_lock); - return NULL; -} - static struct camera_sensor_platform_data pmic_gmin_plat = { .gpio0_ctrl = gmin_gpio0_ctrl, .gpio1_ctrl = gmin_gpio1_ctrl, @@ -1200,7 +1168,6 @@ static struct camera_sensor_platform_data pmic_gmin_plat = { .v1p2_ctrl = gmin_v1p2_ctrl, .flisclk_ctrl = gmin_flisclk_ctrl, .csi_cfg = gmin_csi_cfg, - .get_vcm_ctrl = gmin_get_vcm_ctrl, }; static struct camera_sensor_platform_data acpi_gmin_plat = { @@ -1211,7 +1178,6 @@ static struct camera_sensor_platform_data acpi_gmin_plat = { .v1p2_ctrl = gmin_acpi_pm_ctrl, .flisclk_ctrl = gmin_acpi_pm_ctrl, .csi_cfg = gmin_csi_cfg, - .get_vcm_ctrl = gmin_get_vcm_ctrl, }; struct camera_sensor_platform_data * @@ -1236,19 +1202,6 @@ gmin_camera_platform_data(struct v4l2_subdev *subdev, } EXPORT_SYMBOL_GPL(gmin_camera_platform_data); -int atomisp_gmin_register_vcm_control(struct camera_vcm_control *vcmCtrl) -{ - if (!vcmCtrl) - return -EINVAL; - - mutex_lock(&vcm_lock); - list_add_tail(&vcmCtrl->list, &vcm_devices); - mutex_unlock(&vcm_lock); - - return 0; -} -EXPORT_SYMBOL_GPL(atomisp_gmin_register_vcm_control); - static int gmin_get_hardcoded_var(struct device *dev, struct gmin_cfg_var *varlist, const char *var8, char *out, size_t *out_len) From patchwork Mon Apr 15 12:02:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629872 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C53A6CDD5 for ; Mon, 15 Apr 2024 12:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182586; cv=none; b=fVZyM+e9I831C+YVdbk1e8JSbiPY2O3Hiik7theBjmzqFIlul/+dIw+SjvaFVPFoV1f/1BHDeB/boVfxv7d2rpIM33a2COKFjv7kmD4PdVroNA9Hlr1lQ4za0NiWbK8yFxgR8rmET1qA4FjHYW+2jb5MGircnnE8idsX0vzTA98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182586; c=relaxed/simple; bh=KKMyyTAJpFqESuB5V6vdcIg2wnpqr+JE1DJB4LNDbiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BmEqXpyDS6rdulgJBC8pRTpOJxifan4fk+s6Ht6PvzEQmyBpeaytw5SzGcEtHxFqTY4Nwbw/xp1IgFPb8+sUMgPjRJQmfYFL28uP97rVXfVCh8FGO4126ypMFOv2OcHKB82WHPXJ41Rev2x2R3YT20ZVEd+Yo0v+IkgFr0noexw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=E4ihh8z0; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E4ihh8z0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nAxWP/s/oIBjuL1HfB2KxTYGQKJBNrhVAEBZv4tLZwo=; b=E4ihh8z0MsPAvuoyFYD504HNjbT7dFad1y0gaEE+xEGpKPNtY2J7OEpjDsVODoeDylPABX sS0PxrjIx1L9dKaA/3gMwUSgPgtra+tggxGNuiPriKSziakjJmL8uuNyQIUVwmOlA9gh45 bzfxD7SWiQBnMB+rFgxqfPel1mh3vZs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-467-WZseYm0-Mk60lJ7kryeAOw-1; Mon, 15 Apr 2024 08:03:00 -0400 X-MC-Unique: WZseYm0-Mk60lJ7kryeAOw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3C50F29ABA13; Mon, 15 Apr 2024 12:03:00 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00512C13FA2; Mon, 15 Apr 2024 12:02:58 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 18/23] media: atomisp: Remove struct atomisp_platform_data Date: Mon, 15 Apr 2024 14:02:15 +0200 Message-ID: <20240415120220.219480-19-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 struct atomisp_platform_data only has a single subdevs member. Remove this struct and replace atomisp_get_platform_data() with atomisp_platform_get_subdevs(). Note atomisp_get_platform_data() and now atomisp_platform_get_subdevs() always succeed, so while at it also remove unnecessary error checking. Signed-off-by: Hans de Goede --- .../atomisp/include/linux/atomisp_platform.h | 6 +--- .../media/atomisp/pci/atomisp_gmin_platform.c | 36 +++++++++---------- .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 16 ++------- 4 files changed, 19 insertions(+), 40 deletions(-) diff --git a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h index 098859bde86f..0e3f6fb78483 100644 --- a/drivers/staging/media/atomisp/include/linux/atomisp_platform.h +++ b/drivers/staging/media/atomisp/include/linux/atomisp_platform.h @@ -115,10 +115,6 @@ struct intel_v4l2_subdev_table { struct v4l2_subdev *subdev; }; -struct atomisp_platform_data { - struct intel_v4l2_subdev_table *subdevs; -}; - /* * Sensor of external ISP can send multiple steams with different mipi data * type in the same virtual channel. This information needs to come from the @@ -173,7 +169,7 @@ struct camera_mipi_info { const u32 *metadata_effective_width; }; -const struct atomisp_platform_data *atomisp_get_platform_data(void); +const struct intel_v4l2_subdev_table *atomisp_platform_get_subdevs(void); int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, enum atomisp_input_format format, enum atomisp_bayer_order bayer_order); diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index e12354820a3a..e176483df301 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -127,17 +127,13 @@ static int gmin_v2p8_enable_count; /* The atomisp uses subdev==NULL for the end-of-list marker, so leave space. */ static struct intel_v4l2_subdev_table pdata_subdevs[MAX_SUBDEVS + 1]; -static const struct atomisp_platform_data pdata = { - .subdevs = pdata_subdevs, -}; - static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev); -const struct atomisp_platform_data *atomisp_get_platform_data(void) +const struct intel_v4l2_subdev_table *atomisp_platform_get_subdevs(void) { - return &pdata; + return pdata_subdevs; } -EXPORT_SYMBOL_GPL(atomisp_get_platform_data); +EXPORT_SYMBOL_GPL(atomisp_platform_get_subdevs); int atomisp_register_i2c_module(struct v4l2_subdev *subdev, struct camera_sensor_platform_data *plat_data) @@ -164,7 +160,7 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, adev->power.flags.power_resources = 0; for (i = 0; i < MAX_SUBDEVS; i++) - if (!pdata.subdevs[i].subdev) + if (!pdata_subdevs[i].subdev) break; if (i == MAX_SUBDEVS) @@ -179,9 +175,9 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, if (!gs) return -ENODEV; - pdata.subdevs[i].port = gs->csi_port; - pdata.subdevs[i].lanes = gs->csi_lanes; - pdata.subdevs[i].subdev = subdev; + pdata_subdevs[i].port = gs->csi_port; + pdata_subdevs[i].lanes = gs->csi_lanes; + pdata_subdevs[i].subdev = subdev; return 0; } EXPORT_SYMBOL_GPL(atomisp_register_i2c_module); @@ -194,9 +190,9 @@ int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd) return 0; for (i = 0; i < MAX_SUBDEVS; i++) { - if (pdata.subdevs[i].subdev == sd) { + if (pdata_subdevs[i].subdev == sd) { for (j = i + 1; j <= MAX_SUBDEVS; j++) - pdata.subdevs[j - 1] = pdata.subdevs[j]; + pdata_subdevs[j - 1] = pdata_subdevs[j]; } if (gmin_subdevs[i].subdev == sd) { if (gmin_subdevs[i].gpio0) @@ -1125,7 +1121,7 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, } for (i = 0; i < MAX_SUBDEVS; i++) - if (!pdata.subdevs[i].subdev) + if (!pdata_subdevs[i].subdev) break; if (i >= MAX_SUBDEVS) { @@ -1137,9 +1133,9 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, if (ret) return ret; - pdata.subdevs[i].port = port; - pdata.subdevs[i].lanes = lanes; - pdata.subdevs[i].subdev = subdev; + pdata_subdevs[i].port = port; + pdata_subdevs[i].lanes = lanes; + pdata_subdevs[i].subdev = subdev; return 0; } EXPORT_SYMBOL_GPL(atomisp_register_sensor_no_gmin); @@ -1149,12 +1145,12 @@ void atomisp_unregister_subdev(struct v4l2_subdev *subdev) int i; for (i = 0; i < MAX_SUBDEVS; i++) { - if (pdata.subdevs[i].subdev != subdev) + if (pdata_subdevs[i].subdev != subdev) continue; camera_sensor_csi_free(subdev); - pdata.subdevs[i].subdev = NULL; - pdata.subdevs[i].port = 0; + pdata_subdevs[i].subdev = NULL; + pdata_subdevs[i].port = 0; break; } } diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h index 9227399502b9..9c2bc5332fa4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h @@ -175,7 +175,6 @@ struct atomisp_device { struct media_device media_dev; struct atomisp_sub_device asd; struct v4l2_async_notifier notifier; - struct atomisp_platform_data *pdata; void *mmu_l1_base; void __iomem *base; const struct firmware *firmware; diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 470c123256a7..4a87401a5389 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -783,27 +783,20 @@ int atomisp_csi_lane_config(struct atomisp_device *isp) static int atomisp_subdev_probe(struct atomisp_device *isp) { - const struct atomisp_platform_data *pdata; - struct intel_v4l2_subdev_table *subdevs; + const struct intel_v4l2_subdev_table *subdevs; int ret, mipi_port; ret = atomisp_csi2_bridge_parse_firmware(isp); if (ret) return ret; - pdata = atomisp_get_platform_data(); - if (!pdata) { - dev_err(isp->dev, "no platform data available\n"); - return 0; - } - /* * TODO: this is left here for now to allow testing atomisp-sensor * drivers which are still using the atomisp_gmin_platform infra before * converting them to standard v4l2 sensor drivers using runtime-pm + * ACPI for pm and v4l2_async_register_subdev_sensor() registration. */ - for (subdevs = pdata->subdevs; subdevs->subdev; ++subdevs) { + for (subdevs = atomisp_platform_get_subdevs(); subdevs->subdev; ++subdevs) { ret = v4l2_device_register_subdev(&isp->v4l2_dev, subdevs->subdev); if (ret) continue; @@ -1186,7 +1179,6 @@ static void atomisp_pm_uninit(struct atomisp_device *isp) static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - const struct atomisp_platform_data *pdata; struct atomisp_device *isp; unsigned int start; u32 val; @@ -1195,10 +1187,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i /* Pointer to struct device. */ atomisp_dev = &pdev->dev; - pdata = atomisp_get_platform_data(); - if (!pdata) - dev_warn(&pdev->dev, "no platform data available\n"); - start = pci_resource_start(pdev, ATOM_ISP_PCI_BAR); dev_dbg(&pdev->dev, "start: 0x%x\n", start); From patchwork Mon Apr 15 12:02:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629873 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 428236A005 for ; Mon, 15 Apr 2024 12:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182588; cv=none; b=kjdqHTO2H951GrzbEQYe5nCy7wYcnDSnQ+JSKg4ydZc6XHqhKDZ+7ulZ5qhaXXy2uOkF0UhyqVK8DwsPdk6ZLNt6eWQOcuLPcl+qYTonYnlZQ00R2J6Dz6ysqel3bYqASmEfV0MOJy5Lyw1XynPZb0F2ZNij7IkucQeY6IKnb4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182588; c=relaxed/simple; bh=X2zszUGBEvyLh6pvdq9YYGejPi+fN+/vjf5f7dDh6JU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PeWGRthgkDOg0GzraGyxpuY/AJvykllisuieG020xKEko6Yutwizgm3hWauEue2tPJI3H4KXuUSVMw2FUcX/uCsYSAwV00pRtO2WT/CGjcbBtqViVtw/+Fxax9aWj8lW8yHHqWxXfa826RDIeYCHUbXQmMykDe569Tju2dEc8G4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Y1li+l6w; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y1li+l6w" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3I0kj/gQOo/SKjO/SH+29fGHV3spCquGvHv/QsdfZM4=; b=Y1li+l6wnGh1UQMjKCZfJ/irGpADUR3UxJjNbsULHbt8toUv7qTPElqbV6ktZdnz6EM8+S o79kLpK683CTi3JVY/vHc8DI76f2mGAdx1Kj/djsBiDdEbGcczDodK426laUcqRA0/b2h0 AtlmqUWvbX3m22oC9/jwwNrx77fmEd0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-oPWsgqtnNWCUcqZCgMvlLw-1; Mon, 15 Apr 2024 08:03:02 -0400 X-MC-Unique: oPWsgqtnNWCUcqZCgMvlLw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7A7C80D678; Mon, 15 Apr 2024 12:03:01 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 700EAC13FA4; Mon, 15 Apr 2024 12:03:00 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 19/23] media: atomisp: Remove clearing of ISP crop / compose rectangles on file release Date: Mon, 15 Apr 2024 14:02:16 +0200 Message-ID: <20240415120220.219480-20-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 There is no need to clear the ISP sink-pad crop and source-pad compose rectangles on release of the /dev/video# file. Both will be reset by atomisp_set_fmt() which is guaranteed to get called by atomisp_queue_setup() (if not called already) before another stream starts and thus before these selections are used again. Also the file injection support the comment talks about has long been dropped from the driver. Signed-off-by: Hans de Goede --- .../staging/media/atomisp/pci/atomisp_fops.c | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 0d0c1649eaad..50c4123ba006 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -539,7 +539,6 @@ static int atomisp_release(struct file *file) struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); struct atomisp_sub_device *asd = pipe->asd; struct v4l2_subdev_fh fh; - struct v4l2_rect clear_compose = {0}; v4l2_fh_init(&fh.vfh, vdev); @@ -552,21 +551,6 @@ static int atomisp_release(struct file *file) pipe->users--; - /* - * A little trick here: - * file injection input resolution is recorded in the sink pad, - * therefore can not be cleared when releaseing one device node. - * The sink pad setting can only be cleared when all device nodes - * get released. - */ - { - struct v4l2_mbus_framefmt isp_sink_fmt = { 0 }; - - atomisp_subdev_set_ffmt(&asd->subdev, fh.state, - V4L2_SUBDEV_FORMAT_ACTIVE, - ATOMISP_SUBDEV_PAD_SINK, &isp_sink_fmt); - } - atomisp_css_free_stat_buffers(asd); atomisp_free_internal_buffers(asd); @@ -577,11 +561,6 @@ static int atomisp_release(struct file *file) if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0) dev_err(isp->dev, "Failed to power off device\n"); - atomisp_subdev_set_selection(&asd->subdev, fh.state, - V4L2_SUBDEV_FORMAT_ACTIVE, - ATOMISP_SUBDEV_PAD_SOURCE, - V4L2_SEL_TGT_COMPOSE, 0, - &clear_compose); mutex_unlock(&isp->mutex); return 0; } From patchwork Mon Apr 15 12:02:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629874 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C45276CDD5 for ; Mon, 15 Apr 2024 12:03:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182589; cv=none; b=VmL4Wg4XS1j0Id3OEoOC4uTYUhCxg3mXor9L4aU2h1S7DncQbDBj/I8gOLAAO185UuuBAs9lJJG/Na+rXSG9TSC01Z4ryZbvlYLbtPrg8Z4MbKed2lgmXcuKd4vE9VumU9jtmZoMYyIFBg+BsDxyn8pjdBE1eu0yc6eyxtq5nMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182589; c=relaxed/simple; bh=5PiI2EAGhlCp5O7Mu/AfGmr2NBv2RumY+w+9GqUDSYg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C3I4X+UAE9qEtNPkW2iN6nYFGAfvxOjRUc5nspEub1lR05n8rGS7kEpGN7zWrk1YtS/ioRPaSPLv/9Ai5NvHYCQEhaNEcYclZBF/5qSqoZII21debSu3XsVvG8OJ4CJwFAt9CBn/T2iNpk4sr88YwNk3hpfcO/ksrmr8bMSpnEY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iDVk9F6S; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iDVk9F6S" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IEtlZak3Z40jh25+hruqW/khfsHk4/m1Rl4X63tPTWk=; b=iDVk9F6SuzcX1mq2TesYe3gsWg/qFip0xbObuXhX+t897rwqsp4t/SNiwITeolp1MubhW3 jkbqjkUI+6JCna6yjZtWPha1zb0qzILDsf4iEJjiWaePI6w4SBmKn276fq2J7nsV+mFgne sEI5b7MJvi8Cm8/Yg2eOeWEwiJM6qSE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-112-Y1TUjfGsNS-jBsi8kihbSQ-1; Mon, 15 Apr 2024 08:03:03 -0400 X-MC-Unique: Y1TUjfGsNS-jBsi8kihbSQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C265810431; Mon, 15 Apr 2024 12:03:03 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA82FC13FA1; Mon, 15 Apr 2024 12:03:01 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 20/23] media: atomisp: Remove empty s_power() op from ISP subdev Date: Mon, 15 Apr 2024 14:02:17 +0200 Message-ID: <20240415120220.219480-21-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Remove the empty isp_subdev_set_power() callback. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c index 1bb33460210c..3a3e84a035e2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c @@ -149,18 +149,6 @@ static long isp_subdev_ioctl(struct v4l2_subdev *sd, return 0; } -/* - * isp_subdev_set_power - Power on/off the CCDC module - * @sd: ISP V4L2 subdevice - * @on: power on/off - * - * Return 0 on success or a negative error code otherwise. - */ -static int isp_subdev_set_power(struct v4l2_subdev *sd, int on) -{ - return 0; -} - static int isp_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh, struct v4l2_event_subscription *sub) @@ -596,7 +584,7 @@ static int isp_subdev_set_format(struct v4l2_subdev *sd, /* V4L2 subdev core operations */ static const struct v4l2_subdev_core_ops isp_subdev_v4l2_core_ops = { - .ioctl = isp_subdev_ioctl, .s_power = isp_subdev_set_power, + .ioctl = isp_subdev_ioctl, .subscribe_event = isp_subdev_subscribe_event, .unsubscribe_event = isp_subdev_unsubscribe_event, }; From patchwork Mon Apr 15 12:02:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629878 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 396926E612 for ; Mon, 15 Apr 2024 12:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182593; cv=none; b=uTaLDH/OCtLnybywygUdRRIGg05hCoYc7lpu3Uz9F1cqi7l9ojFsFiTvpirNym7e5VVLiiuhFdP4XROG6S9T24pPYxtaiHizCh+1WMmGFGeSaTPSHSvYbOCo8wHQu0ngiSYd/7H4Nkiug3WUOc6NdIcofmCdcsa+EkfexbBssNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182593; c=relaxed/simple; bh=q6rHdIn6dchLE6k0F2udACPulFYGMVefymCg4z9zpgs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qelfCFAqlsd/IxEWMB/7r/9vjduXwwtDXM8zvRu5tqXZMDR8LDPEkdxJYlFnXWdSLTqfBe3ZPtUYCbURpzD919kgUbNVFvRssyvSwWJzr/tZMgID1l6eefjYZaczP7daAkQURMUHEadhkTwt8kC0FiksHqBuIwwv0ERkdh+sskg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=chRiEa2D; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="chRiEa2D" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MrlpKl+CLRTkcOb/fI4iafeGBBfDR+vru+NAApFe2Cg=; b=chRiEa2DhjyOf0IPwk/NV4iCR7xVRkNfQlUb8r+uROSKKLsWJy1UjWbLlAn9L4o/aAu8LR Cpo1z48vaeGoCmffbXmMMvU/MtyAUjDSc+om7ePE/c1xPFE4h/w1wAp3Nfx+WIyJ9bCr9H F0NeU4hRf2Ul5H9ytLm8Ck4oOpCzXXM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-96-5Eft6LV5MO-UZKzeKR2EYQ-1; Mon, 15 Apr 2024 08:03:05 -0400 X-MC-Unique: 5Eft6LV5MO-UZKzeKR2EYQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85D67881E64; Mon, 15 Apr 2024 12:03:04 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DA35C13FA2; Mon, 15 Apr 2024 12:03:03 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 21/23] media: atomisp: Remove empty s_stream() op from CSI subdev Date: Mon, 15 Apr 2024 14:02:18 +0200 Message-ID: <20240415120220.219480-22-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Remove the empty csi2_set_stream() callback and remove the now empty csi2_video_ops struct. While at it also remove the empty csi2_core_ops struct. Signed-off-by: Hans de Goede --- .../staging/media/atomisp/pci/atomisp_csi2.c | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.c b/drivers/staging/media/atomisp/pci/atomisp_csi2.c index e939a09a279b..9288910eeb6c 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.c @@ -141,27 +141,6 @@ static int csi2_set_format(struct v4l2_subdev *sd, &fmt->format); } -/* - * csi2_set_stream - Enable/Disable streaming on the CSI2 module - * @sd: ISP CSI2 V4L2 subdevice - * @enable: Enable/disable stream (1/0) - * - * Return 0 on success or a negative error code otherwise. - */ -static int csi2_set_stream(struct v4l2_subdev *sd, int enable) -{ - return 0; -} - -/* subdev core operations */ -static const struct v4l2_subdev_core_ops csi2_core_ops = { -}; - -/* subdev video operations */ -static const struct v4l2_subdev_video_ops csi2_video_ops = { - .s_stream = csi2_set_stream, -}; - /* subdev pad operations */ static const struct v4l2_subdev_pad_ops csi2_pad_ops = { .enum_mbus_code = csi2_enum_mbus_code, @@ -172,8 +151,6 @@ static const struct v4l2_subdev_pad_ops csi2_pad_ops = { /* subdev operations */ static const struct v4l2_subdev_ops csi2_ops = { - .core = &csi2_core_ops, - .video = &csi2_video_ops, .pad = &csi2_pad_ops, }; From patchwork Mon Apr 15 12:02:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629877 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A83BA6D1A1 for ; Mon, 15 Apr 2024 12:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182591; cv=none; b=dSYdglHSlFiE2B47yTiJ87Xoml5HLx4rPCeWkmmd9pGAf2+O0N8rrO+vwE3L18fI5eDAc2PChLr9htyUFFU55mLXt5Zrv97R6PO8gVQUl2syTVkI8xqoZCKYZulAQntPc7Cl4KEInr1QA0M4+UV/kxfDXHF2ppmj6rB+aK2+Ejg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182591; c=relaxed/simple; bh=4A12lSJA6l8U+R4GmtlhI1T51PVdJMQlR4um/eO9V9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kW14p0HHYOm5ykju4jWDjkcUIzqdGzlEvoQ+IjyY+KytXDNeQGhBjLIjvEFLg6rxDbEEfmZeJR/NSTrwdnMU1n92PkfM9siz6g8ozwDcYQHppI/o83yva8J7ufOOLSS6JUULdGCQRGq3jNElpP6axrDa0AORqCksMl/bN+vb4t8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=hx4Z7Uc7; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hx4Z7Uc7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j4bIkIOaw3L+Fr90uYhfAwyVujSHhjyH9BvjoJY9NuA=; b=hx4Z7Uc7oh7aoGoaSVTITrtz/9iYTOpd1MFAWoNfIlWkHJmY+/6nH+EpLosEdViOGuI9Ph o+PwtXlIT4xDTaPRmwk3kN6aXEC/Ic147+0viGNfp/IM153nB1Vvdhrt1UDhTgcfCfFVDe TCDsO6VA9gnnEsHPWuUnat6C3s+4dmw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-RMtv7UeqP2uCRKq65icPkQ-1; Mon, 15 Apr 2024 08:03:06 -0400 X-MC-Unique: RMtv7UeqP2uCRKq65icPkQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEB8B881E66; Mon, 15 Apr 2024 12:03:05 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id B736EC15771; Mon, 15 Apr 2024 12:03:04 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 22/23] media: atomisp: Cleanup atomisp_isr_thread() spinlock handling Date: Mon, 15 Apr 2024 14:02:19 +0200 Message-ID: <20240415120220.219480-23-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Refactor the code a tiny bit to avoid the need to have 2 different paths with spin_unlock_irqrestore() in there. While at it also remove the non helpful dev_dbg() message. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 335f142c1fc5..2c95fd6505e0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -959,18 +959,15 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) { struct atomisp_device *isp = isp_ptr; unsigned long flags; - - dev_dbg(isp->dev, ">%s\n", __func__); + bool streaming; spin_lock_irqsave(&isp->lock, flags); - - if (!isp->asd.streaming) { - spin_unlock_irqrestore(&isp->lock, flags); - return IRQ_HANDLED; - } - + streaming = isp->asd.streaming; spin_unlock_irqrestore(&isp->lock, flags); + if (!streaming) + return IRQ_HANDLED; + /* * The standard CSS2.0 API tells the following calling sequence of * dequeue ready buffers: From patchwork Mon Apr 15 12:02:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13629876 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 777196D1A7 for ; Mon, 15 Apr 2024 12:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182591; cv=none; b=CIJI4ZZy3WOvbCi1O5XVdBEKXQEGubpEMRo91VrRFp7BLrbvLK4a3wlQ62Bp+JjAYSWPHxtypGkHX0yYHx895aeUifof/7T3YsvLby8RdJTxhXoqTkItZSji9RGyMEftUxsPo4OuszztnpPQHtSgMbOTYaZNCpSjtL3sjuzwm68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713182591; c=relaxed/simple; bh=YKSNmJ9meTEoy9zIufeabQgPHINDjfXPuWfRNlPUiaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hgvFlQhOdg1lPjx7As7APoHM2ILXDEGXLl/uTuDLsH+9/IDC64WNrnhUr3DSiO41vGQpsoEjsy9az0ta8eNXla0yYLADDTDnE4iSBVq3VrfACL2GJ5sgq2Ssmmup0075Vml7KUfVFOAzBSyofQLeCcXWvxSUmsnyzovGzqCBA/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=f1ID+OrC; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="f1ID+OrC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713182589; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A119hcBTOajWEhL+s5a5KfbuwpEfz7ZsTsceD7xkrwg=; b=f1ID+OrCBZqKPWzNSnTEHx2S9An21w1h14icu+8DnkwaWWxBgZZrhOQKavna8+KM3rPO4p lBXvaCPV0i9kPti0ZJtLqQkEahxbzRctX2RPhVclpR8vmzKVbDB6KCz8OwyxKqE72vieSa oGT1q1k0qltwIRWQgMbwlt9F57a//5U= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-574-FQNiPVqGOfG3HSbri9w91w-1; Mon, 15 Apr 2024 08:03:07 -0400 X-MC-Unique: FQNiPVqGOfG3HSbri9w91w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64BA138143A2; Mon, 15 Apr 2024 12:03:07 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.195.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B94AC13FA2; Mon, 15 Apr 2024 12:03:06 +0000 (UTC) From: Hans de Goede To: Sakari Ailus , Andy Shevchenko Cc: Hans de Goede , Mauro Carvalho Chehab , Kate Hsuan , Tsuchiya Yuto , Fabio Aiuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 23/23] media: atomisp: Remove setting of f->fmt.pix.priv from atomisp_set_fmt() Date: Mon, 15 Apr 2024 14:02:20 +0200 Message-ID: <20240415120220.219480-24-hdegoede@redhat.com> In-Reply-To: <20240415120220.219480-1-hdegoede@redhat.com> References: <20240415120220.219480-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 This value is not used by the driver, only returned to userspace and userspace should not rely on / use the priv fields. Drop setting this. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 2c95fd6505e0..4ecaded57b9a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -4412,8 +4412,6 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f) atomisp_fill_pix_format(&pipe->pix, f->fmt.pix.width, f->fmt.pix.height, format_bridge); f->fmt.pix = pipe->pix; - f->fmt.pix.priv = PAGE_ALIGN(pipe->pix.width * - pipe->pix.height * 2); dev_dbg(isp->dev, "%s: %dx%d, image size: %d, %d bytes per line\n", __func__,